Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

21 lines
454 B

  1. #include <inttypes.h>
  2. #include <sys/epoll.h>
  3. #include <stdio.h>
  4. int main() {
  5. int efd=epoll_create(10);
  6. struct epoll_event x;
  7. if (efd==-1) return 111;
  8. x.events=EPOLLIN;
  9. x.data.fd=0;
  10. if (epoll_ctl(efd,EPOLL_CTL_ADD,0 /* fd */,&x)==-1) return 111;
  11. {
  12. int n;
  13. struct epoll_event y[100];
  14. if ((n=epoll_wait(efd,y,100,1000))==-1) return 111;
  15. if (n>0)
  16. printf("event %d on fd #%d\n",y[0].events,y[0].data.fd);
  17. }
  18. return 0;
  19. }