* EPoll_Event is packed only on x86-64, not other 64 Bit CPUs, resolves #34416

* epoll_pwait expects the SigSet size as sixth parameter (kernel syscall only)
  + simple epoll* test

git-svn-id: trunk@44093 -
This commit is contained in:
florian 2020-02-02 14:23:51 +00:00
parent e7f5b89c2c
commit 2b7447c78d
3 changed files with 28 additions and 2 deletions

1
.gitattributes vendored
View File

@ -15638,6 +15638,7 @@ tests/test/units/fpwidestring/twide2fpwidestring.pp svneol=native#text/pascal
tests/test/units/fpwidestring/twide6fpwidestring.pp svneol=native#text/pascal
tests/test/units/fpwidestring/twide7fpwidestring.pp svneol=native#text/pascal
tests/test/units/lineinfo/tlininfo.pp svneol=native#text/plain
tests/test/units/linux/tepoll1.pp svneol=native#text/pascal
tests/test/units/linux/tstatx.pp svneol=native#text/pascal
tests/test/units/math/tcmpnan.pp svneol=native#text/plain
tests/test/units/math/tdivmod.pp svneol=native#text/plain

View File

@ -279,7 +279,8 @@ type
TEPoll_Data = Epoll_Data;
PEPoll_Data = ^Epoll_Data;
EPoll_Event = {$ifdef cpu64} packed {$endif} record
{ x86_64 uses a packed record so it is compatible with i386 }
EPoll_Event = {$ifdef cpux86_64} packed {$endif} record
Events: cuint32;
Data : TEpoll_Data;
end;
@ -622,7 +623,7 @@ function epoll_wait(epfd: cint; events: pepoll_event; maxevents, timeout: cint):
begin
{$if defined(generic_linux_syscalls)}
epoll_wait := do_syscall(syscall_nr_epoll_pwait, tsysparam(epfd),
tsysparam(events), tsysparam(maxevents), tsysparam(timeout),0);
tsysparam(events), tsysparam(maxevents), tsysparam(timeout),0,sizeof(TSigSet));
{$else}
epoll_wait := do_syscall(syscall_nr_epoll_wait, tsysparam(epfd),
tsysparam(events), tsysparam(maxevents), tsysparam(timeout));

View File

@ -0,0 +1,24 @@
{ %target=linux }
uses
baseunix,linux,ctypes;
var
e : tepoll_event;
es : array[0..10] of tepoll_event;
fd : cint;
i : Longint;
begin
fillchar(es,sizeof(es),$de);
fd:=epoll_create(1);
e.Events:=EPOLLIN;
e.Data.u32:=$1234568;
if (epoll_ctl(fd,EPOLL_CTL_ADD,0,@e)<>0) then
begin
writeln('Error in epoll_ctl');
fpclose(fd);
halt(1);
end;
i:=epoll_wait(fd,@es,length(es),100);
fpclose(fd);
end.