Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2015-06

aarch64: bug fix in fpPoll

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Edmund Grimley Evans

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

Reply by email