2002-04-11 05:55:00

by blesson paul

[permalink] [raw]
Subject: put_user_byte()

Hi all
I need to copy some data from kernel memory space to user
memory space. When I investigated, the command for that purpose is
put_user_byte(). But in kernel2.4, I can't find the implementation of this
command. I want to know the command which replaced put_user_byte() in 2.4
kernel. Also I want to know whether there is any synonyms for verify_area()
in kernel 2.4
regards
Blesson Paul



_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx


2002-04-11 11:03:45

by Brian Gerst

[permalink] [raw]
Subject: Re: put_user_byte()

blesson paul wrote:
> Hi all
> I need to copy some data from kernel memory space to user
> memory space. When I investigated, the command for that purpose is
> put_user_byte(). But in kernel2.4, I can't find the implementation of
> this command. I want to know the command which replaced put_user_byte()
> in 2.4 kernel. Also I want to know whether there is any synonyms for
> verify_area() in kernel 2.4
> regards
> Blesson Paul

Use put_user(val, uaddr). val must be of type unsigned char (or casted
to it). It will return 0 on success or -EFAULT on fault. verify_area()
is normally not needed in 2.4, unless you are copying many values to
user space and only want to do the priviledge check once on the whole range.

--

Brian Gerst

2002-04-13 08:57:37

by Russell King

[permalink] [raw]
Subject: Re: put_user_byte()

On Thu, Apr 11, 2002 at 07:01:25AM -0400, Brian Gerst wrote:
> Use put_user(val, uaddr).

Correct.

> val must be of type unsigned char (or casted to it).

put_user does not care what value you pass it as val. It only cares
about the type of uaddr. The following are all equivalent as far as
the size of the data type written to user space:

put_user((int)foo, (char *)bar);
put_user((char)foo, (char *)bar);
put_user((long)foo, (char *)bar);

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html