summaryrefslogtreecommitdiff
path: root/mcon/U/d_epoll.U
blob: e039a0deb9dafe03b98a7256e3c9732ceccaeed4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
?RCS: $Id$
?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