tepoll1.pp 446 B

123456789101112131415161718192021222324
  1. { %target=linux }
  2. uses
  3. baseunix,linux,ctypes;
  4. var
  5. e : tepoll_event;
  6. es : array[0..10] of tepoll_event;
  7. fd : cint;
  8. i : Longint;
  9. begin
  10. fillchar(es,sizeof(es),$de);
  11. fd:=epoll_create(1);
  12. e.Events:=EPOLLIN;
  13. e.Data.u32:=$1234568;
  14. if (epoll_ctl(fd,EPOLL_CTL_ADD,0,@e)<>0) then
  15. begin
  16. writeln('Error in epoll_ctl');
  17. fpclose(fd);
  18. halt(1);
  19. end;
  20. i:=epoll_wait(fd,@es,length(es),100);
  21. fpclose(fd);
  22. end.