[fpc-devel]Linux syscalls

Marco van de Voort marcov at stack.nl
Sat Jan 24 12:35:36 CET 2004


> 
> rather than a simple test on the sign that is currently in 
> rtl/linux/i386/syscalls.inc. There is a helpful comment explaining this 
> (in glibc/sysdeps/unix/sysv/linux/i386/sysdeps.h):

*BSD use carry indeed. However they also have 64-bit return values for
lseek since a _long_ time, so this problem doesn't exist there as much.
 
> /* 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'll see if I can fix it tonight.




More information about the fpc-devel mailing list