lkml.org 
[lkml]   [1999]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: System Call
On Sun, May 16, 1999 at 05:15:15PM +0200, Rik van Riel wrote:
> On 15 May 1999, Livia Catarina Soares wrote:
>
> > I am here again :-) ...
> > at this time to ask about system call .
> >
> > Question: Is there some constraint to a system call return an
> > unsigned long value ??
>
> Error codes are returned as _negative_ numbers (-EPERM
> and the likes). This almost means you have to return
> something signed...

Ahem. No. Sorry to reply so late, I was out of the country for a while.

As I'm working on the native interface to the kernel (no more libc), I was
reading the glibc2.1 sources and in there is written:

| /* Linux uses a negative return value to indicate syscall errors,
| unlike most Unices, which use the condition codes' carry flag.
|
| Since version 2.1 the return value of a system call might be
| negative even if the call succeeded. E.g., the `lseek' system call
| might return a large offset. Therefore we must not anymore test
| for < 0, but test for a real error by making sure the value in %eax
| is a real error number. Linus said he will make sure the no syscall
| returns a value in -1 .. -4095 as a valid result so we can savely
| test with -4095. */

I found no public statement about this fact.

Groetjes, Peter

--
It's logic Jim, but not as we know it. | pvaneynd@debian.org for pleasure,
"God, root, what is difference?",Pitr | pvaneynd@inthan.be for more pleasure!

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:51    [W:0.060 / U:0.664 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site