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
Quoted 5 lines · blesson paul
Hi all
I need to copy some data from kernel memory space to user
memory space. When I investigated, the command for that purpose isput_user_byte(). But in kernel2.4, I can't find the implementation of this command. I want to know the command which replacedput_user_byte()in 2.4 kernel. Also I want to know whether there is any synonyms forverify_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.
Signature · 1 line
Brian Gerst
Quoted 1 line · Brian Gerst
Use
put_user(val, uaddr).
Correct.
Quoted 1 line
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);
Signature · 2 lines
Russell King ([email protected]) The developer of ARM Linux http://www.arm.linux.org.uk/personal/aboutme.html