[openbeos] Re: memset ---> user_memset ?

  • From: "François Revol" <revol@xxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Thu, 07 Sep 2006 11:54:46 +0200 CEST

> Siarzhuk Zharski <zharik@xxxxxx> wrote:
> > Building my usb_scsi under Haiku I was warned that memset, memcpy 
> > functions have no prototypes. In KernelExports.h I found only 
> > user_memset, user_memcpy ones. Are any peculiarities using those 
> > mem* 
> > in 
> > kernel modules? Should I use user_mem* analogues instead? Are any 
> > technical details about it somewhere to read? Thanks!
> 
> You can still just include <string.h> for those.
> The user_*() versions have to be used whenever you're accessing 
> unsafe 
> user memory. In BeOS, the memory you get in read/write/etc. hooks is 
> already safe - but the one that got passed into ioctl() never was. Be 
> never published how to make memory safe, so you can use the user_*() 
> functions to access it.

Actually they did once (is_valid_range(), in an example serial driver 
IIRC) but the prototype wasn't public and they didn't really used it 
much themselves, plus the is_valid_string() version was actually unsafe 
(only checked the first byte).


François.

Other related posts: