[fpc-devel] aarch64: bug fix in fpPoll

Edmund Grimley Evans edmund.grimley.evans at gmail.com
Thu Jun 11 20:53:29 CEST 2015


A negative timeout with poll means infinity, but a negative
timespec with ppoll is an error.

Index: rtl/linux/bunxsysc.inc
===================================================================
--- rtl/linux/bunxsysc.inc	(revision 31023)
+++ rtl/linux/bunxsysc.inc	(working copy)
@@ -492,10 +492,15 @@
 {$if defined(generic_linux_syscalls)}
 var ts : timespec;
 begin
-  ts.tv_sec := timeout div 1000;
-  ts.tv_nsec := (timeout mod 1000) * 1000000;
-  fpPoll:=do_syscall(syscall_nr_ppoll,tsysparam(fds),tsysparam(nfds),
-                     tsysparam(@ts),0);
+  if timeout<0 then
+    fpPoll:=do_syscall(syscall_nr_ppoll,tsysparam(fds),tsysparam(nfds),0,0)
+  else
+    begin
+      ts.tv_sec := timeout div 1000;
+      ts.tv_nsec := (timeout mod 1000) * 1000000;
+      fpPoll:=do_syscall(syscall_nr_ppoll,tsysparam(fds),tsysparam(nfds),
+                         tsysparam(@ts),0);
+    end
 end;
 {$else}
 begin



More information about the fpc-devel mailing list