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

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Thu, 07 Sep 2006 11:31:03 +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.
Our VM still has some holes with regard to making memory safe, so the 
user_*() functions are currently the only way to make sure you can 
safely access user memory.

Bye,
   Axel.


Other related posts: