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

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Thu, 07 Sep 2006 16:50:59 +0200 CEST

Philippe Houdoin <philippe.houdoin@xxxxxxx> wrote:
> Axel wrote:
> > 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.
> Does it means that in Haiku drivers we've to use user_*() to access 
> user memory
> *only* for ioctl(), not for read/write?

Right now, you always have to care about safely accessing user memory. 
For compatibility with BeOS drivers, this will be changed to ioctl() 
only in the future.
However, for Haiku native drivers, the driver interface hasn't been 
finalized yet - I think it will not come with any guarantees with 
regards to memory, ie. you'll have to take care yourself, but the 
source of memory will be identified. We'll see.

> And do we have for backward source compatibility something along:
> #define user_memcpy memcpy
> to ease compiling Haiku drivers for R5 target?

No, that wouldn't be right either, as you'd only want to use it with 
userland buffers (it's not optimized for speed as much as the standard 
version). Since it worked okay for older drivers in BeOS, it'll work as 
good in Haiku - we will just need to make sure the drivers are properly 
written.

Bye,
   Axel.


Other related posts: