Subject: Re: syscalls return values
To: None <p99dreyf@criens.u-psud.fr, wrstuden@zembu.com>
From: None <eeh@netbsd.org>
List: tech-kern
Date: 01/19/2001 23:29:27
For comparison, syscalls in NetBSD all have the following prototype:
int syscall(struct proc *p, void *v, register_t *retval);
So you want to shove the return value in *retval. What you return() from
this routine is the error code to be returned. libc glue takes care of
setting errno as needed for you.
I'm not 100% how linux syscalls work, but I'd expect they are about the
same.
linux syscalls return the value as the return value rather
than through *retval. That means that you're limited to
retirning `int' values. ISTR that errors are returned
by negating by subtracting the errno from -1.
Eduardo