On Wed, Jul 23, 2003 at 02:48:41PM -0700, Julian Elischer wrote:
+> I'd like to have a "suptr and fuptr" to be able to save and read
+> user pointers in a "machine independent" manner..
+> at the moment ia need to know the size of a pointer and select the
+> appropriate 32 or 64 version.. It would jus tbe another ENTRY files in 
+> support.[sS] alongside teh appropriate sized entry
+> for each architecture so it wouldn't 'cost' anything..
+> 
+> for i386 it would be an alternate name for fuword32() and suword32()
+> I'm not sure what it would be on other architectures....
+> 
+> comments?

Yes, good idea. I'm using for now something like this:

static __inline void *
fuptr(void *uaddr)
{
        void *ptr;

        if (copyin(uaddr, &ptr, sizeof(void *)) != 0)
                return ((void *)-1);

        return (ptr);
}

For numbers is always better to use copyin(9)/copyout(9). Functions
like fubyte(9), etc. make no sens for me. -1 is returned on error or
if there is really -1, so one isn't able to find out if there is an
error or not.

-- 
Pawel Jakub Dawidek                       [EMAIL PROTECTED]
UNIX Systems Programmer/Administrator     http://garage.freebsd.pl
Am I Evil? Yes, I Am!                     http://cerber.sourceforge.net

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to