Re: [PATCH v2 0/5] [RFC] copy_strtok_from_user

From: Steven Rostedt
Date: Thu Feb 26 2009 - 07:48:33 EST



On Thu, 26 Feb 2009, Steven Rostedt wrote:
>
> not really. strsep stops at the first delimiter. strtok skips multiple

I may have read the man page wrong. It does stop at the token not the
delimiter.

Never mind :-p

-- Steve

> delimiters. I could implement the copy_strtok_from_user with a
> copy_from_user (all of read), and then use strtok_r (reentrant version) to
> find the next token. This would require implementing strtok_r for the
> kernel.
>
> Having the copy_strtok_from_user will handle the copying and the caller
> would not need to worry about having a big enough buffer to hold
> delimiters and tokens. The copy_strtok_from_user would copy first to an
> internal buffer, then scan for tokens to copy into the callers buffer.
> Then repeat until read or copy limits have been hit.
>
> -- Steve
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/