diff options
Diffstat (limited to 'mcon/U/d_epoll.U')
-rw-r--r-- | mcon/U/d_epoll.U | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/mcon/U/d_epoll.U b/mcon/U/d_epoll.U new file mode 100644 index 0000000..4ee88ec --- /dev/null +++ b/mcon/U/d_epoll.U @@ -0,0 +1,51 @@ +?RCS: $Id: d_epoll.U 167 2013-05-08 17:58:00Z rmanfredi $ +?RCS: +?RCS: Copyright (c) 2006, Christian Biere +?RCS: +?RCS: You may redistribute only under the terms of the Artistic License, +?RCS: as specified in the README file that comes with the distribution. +?RCS: You may reuse parts of this distribution only within the terms of +?RCS: that same Artistic License; a copy of which may be found at the root +?RCS: of the source tree for dist 4.0. +?RCS: +?MAKE:d_epoll: Trylink cat +?MAKE: -pick add $@ %< +?S:d_epoll: +?S: This variable conditionally defines the HAS_EPOLL symbol, which +?S: indicates to the C program that epoll() support is available. +?S:. +?C:HAS_EPOLL: +?C: This symbol is defined when epoll() can be used. +?C:. +?H:#$d_epoll HAS_EPOLL +?H:. +?LINT: set d_epoll +: can we use epoll? +$cat >try.c <<EOC +#include <sys/types.h> +#include <sys/epoll.h> +int main(void) +{ + static struct epoll_event ev; + static int ret, epfd; + epfd |= epoll_create(1); + ev.events |= EPOLLOUT; + ev.events |= EPOLLPRI; + ev.events |= EPOLLERR; + ev.events |= EPOLLHUP; + ev.events |= EPOLLET; + ev.data.ptr = (void *) 0; + ev.data.fd |= 1; + ev.data.u32 |= 1; + ev.data.u64 |= 1; + ret |= epoll_ctl(epfd, 1, EPOLL_CTL_ADD, &ev); + ret |= epoll_ctl(epfd, 1, EPOLL_CTL_MOD, &ev); + ret |= epoll_ctl(epfd, 1, EPOLL_CTL_DEL, &ev); + ret |= epoll_wait(epfd, &ev, 1, -1); + return 0 != ret; +} +EOC +cyn="whether epoll support is available" +set d_epoll +eval $trylink + |