One of the syscall routines in rtl/linux/i386/syscall.inc checks for a return value in the range -4095..-1 as the error return, but all the rest just take a negative value as an error. I think the former is correct and attach a patch that will fix the rest. (I sent something to the list quite a while ago about this, but the complete change did not get made.)
Colin
diff -uNr fpc/rtl/linux/i386/syscall.inc fpc.w/rtl/linux/i386/syscall.inc
--- fpc/rtl/linux/i386/syscall.inc      2005-02-14 20:43:55.000000000 +0000
+++ fpc.w/rtl/linux/i386/syscall.inc    2005-02-26 11:10:58.000000000 +0000
@@ -25,8 +25,8 @@
 { load the registers... }
   movl  sysnr,%eax
   int   $0x80
-  testl %eax,%eax
-  jns   .LSyscOK
+  cmpl  $-4095,%eax
+  jb   .LSyscOK
   negl  %eax
 {$ifdef VER1_0}
   movl  %eax,Errno
@@ -116,8 +116,8 @@
   movl param1,%ebx
   movl param2,%ecx
   int $0x80
-  testl %eax,%eax
-  jns   .LSyscOK
+  cmpl  $-4095,%eax
+  jb   .LSyscOK
   negl  %eax
 {$ifdef VER1_0}
   movl  %eax,Errno
@@ -163,8 +163,8 @@
   movl param2,%ecx
   movl param3,%edx
   int $0x80
-  testl %eax,%eax
-  jns   .LSyscOK
+  cmpl  $-4095,%eax
+  jb   .LSyscOK
   negl  %eax
 {$ifdef VER1_0}
   movl  %eax,Errno
@@ -211,8 +211,8 @@
   movl param3,%edx
   movl param4,%esi
   int $0x80
-  testl %eax,%eax
-  jns   .LSyscOK
+  cmpl  $-4095,%eax
+  jb   .LSyscOK
   negl  %eax
 {$ifdef VER1_0}
   movl  %eax,Errno
@@ -260,8 +260,8 @@
   movl param4,%esi
   movl param5,%edi
   int $0x80
-  testl %eax,%eax
-  jns   .LSyscOK
+  cmpl  $-4095,%eax
+  jb   .LSyscOK
   negl  %eax
 {$ifdef VER1_0}
   movl  %eax,Errno
@@ -311,8 +311,8 @@
   movl param4,%esi
   movl param5,%edi
   int $0x80
-  testl %eax,%eax
-  jns   .LSyscOK
+  cmpl  $-4095,%eax
+  jb   .LSyscOK
   negl  %eax
 {$ifdef VER1_0}
   movl  %eax,Errno
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to