xref: /unit/auto/events (revision 0:a63ceefd6ab0)
1*0Sigor@sysoev.ru
2*0Sigor@sysoev.ru# Copyright (C) Igor Sysoev
3*0Sigor@sysoev.ru# Copyright (C) NGINX, Inc.
4*0Sigor@sysoev.ru
5*0Sigor@sysoev.ru
6*0Sigor@sysoev.ru# Linux epoll.
7*0Sigor@sysoev.ru
8*0Sigor@sysoev.runxt_feature="Linux epoll"
9*0Sigor@sysoev.runxt_feature_name=NXT_HAVE_EPOLL
10*0Sigor@sysoev.runxt_feature_run=
11*0Sigor@sysoev.runxt_feature_incs=
12*0Sigor@sysoev.runxt_feature_libs=
13*0Sigor@sysoev.runxt_feature_test="#include <sys/epoll.h>
14*0Sigor@sysoev.ru                  #include <unistd.h>
15*0Sigor@sysoev.ru
16*0Sigor@sysoev.ru                  int main() {
17*0Sigor@sysoev.ru                      int  n;
18*0Sigor@sysoev.ru
19*0Sigor@sysoev.ru                      n = epoll_create(1);
20*0Sigor@sysoev.ru                      close(n);
21*0Sigor@sysoev.ru                      return 0;
22*0Sigor@sysoev.ru                  }"
23*0Sigor@sysoev.ru. auto/feature
24*0Sigor@sysoev.ru
25*0Sigor@sysoev.ruif [ $nxt_found = yes ]; then
26*0Sigor@sysoev.ru    NXT_HAVE_EPOLL=YES
27*0Sigor@sysoev.ru
28*0Sigor@sysoev.ru    nxt_feature="Linux signalfd()"
29*0Sigor@sysoev.ru    nxt_feature_name=NXT_HAVE_SIGNALFD
30*0Sigor@sysoev.ru    nxt_feature_run=
31*0Sigor@sysoev.ru    nxt_feature_incs=
32*0Sigor@sysoev.ru    nxt_feature_libs=
33*0Sigor@sysoev.ru    nxt_feature_test="#include <signal.h>
34*0Sigor@sysoev.ru                      #include <sys/signalfd.h>
35*0Sigor@sysoev.ru                      #include <unistd.h>
36*0Sigor@sysoev.ru
37*0Sigor@sysoev.ru                      int main() {
38*0Sigor@sysoev.ru                          int       n;
39*0Sigor@sysoev.ru                          sigset_t  mask;
40*0Sigor@sysoev.ru
41*0Sigor@sysoev.ru                          sigemptyset(&mask);
42*0Sigor@sysoev.ru                          n = signalfd(-1, &mask, 0);
43*0Sigor@sysoev.ru                          close(n);
44*0Sigor@sysoev.ru                          return 0;
45*0Sigor@sysoev.ru                      }"
46*0Sigor@sysoev.ru    . auto/feature
47*0Sigor@sysoev.ru
48*0Sigor@sysoev.ru
49*0Sigor@sysoev.ru    nxt_feature="Linux eventfd()"
50*0Sigor@sysoev.ru    nxt_feature_name=NXT_HAVE_EVENTFD
51*0Sigor@sysoev.ru    nxt_feature_run=
52*0Sigor@sysoev.ru    nxt_feature_incs=
53*0Sigor@sysoev.ru    nxt_feature_libs=
54*0Sigor@sysoev.ru    nxt_feature_test="#include <sys/eventfd.h>
55*0Sigor@sysoev.ru                      #include <unistd.h>
56*0Sigor@sysoev.ru
57*0Sigor@sysoev.ru                      int main() {
58*0Sigor@sysoev.ru                          int  n;
59*0Sigor@sysoev.ru
60*0Sigor@sysoev.ru                          n = eventfd(0, 0);
61*0Sigor@sysoev.ru                          close(n);
62*0Sigor@sysoev.ru                          return 0;
63*0Sigor@sysoev.ru                      }"
64*0Sigor@sysoev.ru    . auto/feature
65*0Sigor@sysoev.ru
66*0Sigor@sysoev.ruelse
67*0Sigor@sysoev.ru    NXT_HAVE_EPOLL=NO
68*0Sigor@sysoev.rufi
69*0Sigor@sysoev.ru
70*0Sigor@sysoev.ru
71*0Sigor@sysoev.ru# FreeBSD, MacOSX, NetBSD, OpenBSD kqueue.
72*0Sigor@sysoev.ru
73*0Sigor@sysoev.runxt_feature="kqueue"
74*0Sigor@sysoev.runxt_feature_name=NXT_HAVE_KQUEUE
75*0Sigor@sysoev.runxt_feature_run=
76*0Sigor@sysoev.runxt_feature_incs=
77*0Sigor@sysoev.runxt_feature_libs=
78*0Sigor@sysoev.runxt_feature_test="#include <sys/types.h>
79*0Sigor@sysoev.ru                  #include <sys/event.h>
80*0Sigor@sysoev.ru                  #include <unistd.h>
81*0Sigor@sysoev.ru
82*0Sigor@sysoev.ru                  int main() {
83*0Sigor@sysoev.ru                      int  n;
84*0Sigor@sysoev.ru
85*0Sigor@sysoev.ru                      n = kqueue();
86*0Sigor@sysoev.ru                      close(n);
87*0Sigor@sysoev.ru                      return 0;
88*0Sigor@sysoev.ru                  }"
89*0Sigor@sysoev.ru. auto/feature
90*0Sigor@sysoev.ru
91*0Sigor@sysoev.ruif [ $nxt_found = yes ]; then
92*0Sigor@sysoev.ru    NXT_HAVE_KQUEUE=YES
93*0Sigor@sysoev.ru
94*0Sigor@sysoev.ru    nxt_feature="kqueue EVFILT_USER"
95*0Sigor@sysoev.ru    nxt_feature_name=NXT_HAVE_EVFILT_USER
96*0Sigor@sysoev.ru    nxt_feature_run=
97*0Sigor@sysoev.ru    nxt_feature_incs=
98*0Sigor@sysoev.ru    nxt_feature_libs=
99*0Sigor@sysoev.ru    nxt_feature_test="#include <stdlib.h>
100*0Sigor@sysoev.ru                      #include <sys/types.h>
101*0Sigor@sysoev.ru                      #include <sys/event.h>
102*0Sigor@sysoev.ru
103*0Sigor@sysoev.ru                      int main() {
104*0Sigor@sysoev.ru                          struct kevent  kev;
105*0Sigor@sysoev.ru
106*0Sigor@sysoev.ru                          kev.filter = EVFILT_USER;
107*0Sigor@sysoev.ru                          kevent(0, &kev, 1, NULL, 0, NULL);
108*0Sigor@sysoev.ru                          return 0;
109*0Sigor@sysoev.ru                      }"
110*0Sigor@sysoev.ru    . auto/feature
111*0Sigor@sysoev.ru
112*0Sigor@sysoev.ruelse
113*0Sigor@sysoev.ru    NXT_HAVE_KQUEUE=NO
114*0Sigor@sysoev.rufi
115*0Sigor@sysoev.ru
116*0Sigor@sysoev.ru
117*0Sigor@sysoev.ru# Solaris event port.
118*0Sigor@sysoev.ru
119*0Sigor@sysoev.runxt_feature="Solaris event port"
120*0Sigor@sysoev.runxt_feature_name=NXT_HAVE_EVENTPORT
121*0Sigor@sysoev.runxt_feature_run=
122*0Sigor@sysoev.runxt_feature_incs=
123*0Sigor@sysoev.runxt_feature_libs=
124*0Sigor@sysoev.runxt_feature_test="#include <port.h>
125*0Sigor@sysoev.ru                  #include <unistd.h>
126*0Sigor@sysoev.ru
127*0Sigor@sysoev.ru                  int main() {
128*0Sigor@sysoev.ru                      int  n;
129*0Sigor@sysoev.ru
130*0Sigor@sysoev.ru                      n = port_create();
131*0Sigor@sysoev.ru                      close(n);
132*0Sigor@sysoev.ru                      return 0;
133*0Sigor@sysoev.ru                  }"
134*0Sigor@sysoev.ru. auto/feature
135*0Sigor@sysoev.ru
136*0Sigor@sysoev.ruif [ $nxt_found = yes ]; then
137*0Sigor@sysoev.ru    NXT_HAVE_EVENTPORT=YES
138*0Sigor@sysoev.ruelse
139*0Sigor@sysoev.ru    NXT_HAVE_EVENTPORT=NO
140*0Sigor@sysoev.rufi
141*0Sigor@sysoev.ru
142*0Sigor@sysoev.ru
143*0Sigor@sysoev.ru# Solaris, HP-UX, IRIX, Tru64 UNIX /dev/poll.
144*0Sigor@sysoev.ru
145*0Sigor@sysoev.runxt_feature="/dev/poll"
146*0Sigor@sysoev.runxt_feature_name=NXT_HAVE_DEVPOLL
147*0Sigor@sysoev.runxt_feature_run=yes
148*0Sigor@sysoev.runxt_feature_incs=
149*0Sigor@sysoev.runxt_feature_libs=
150*0Sigor@sysoev.runxt_feature_test="#include <fcntl.h>
151*0Sigor@sysoev.ru                  #include <sys/ioctl.h>
152*0Sigor@sysoev.ru                  #include <sys/devpoll.h>
153*0Sigor@sysoev.ru                  #include <unistd.h>
154*0Sigor@sysoev.ru
155*0Sigor@sysoev.ru                  int main() {
156*0Sigor@sysoev.ru                      int  n;
157*0Sigor@sysoev.ru
158*0Sigor@sysoev.ru                      n = open(\"/dev/poll\", O_RDWR);
159*0Sigor@sysoev.ru                      close(n);
160*0Sigor@sysoev.ru                      return 0;
161*0Sigor@sysoev.ru                  }"
162*0Sigor@sysoev.ru. auto/feature
163*0Sigor@sysoev.ru
164*0Sigor@sysoev.ruif [ $nxt_found = yes ]; then
165*0Sigor@sysoev.ru    NXT_HAVE_DEVPOLL=YES
166*0Sigor@sysoev.ruelse
167*0Sigor@sysoev.ru    NXT_HAVE_DEVPOLL=NO
168*0Sigor@sysoev.rufi
169*0Sigor@sysoev.ru
170*0Sigor@sysoev.ru
171*0Sigor@sysoev.ru# AIX pollset.
172*0Sigor@sysoev.ru
173*0Sigor@sysoev.runxt_feature="AIX pollset"
174*0Sigor@sysoev.runxt_feature_name=NXT_HAVE_POLLSET
175*0Sigor@sysoev.runxt_feature_run=yes
176*0Sigor@sysoev.runxt_feature_incs=
177*0Sigor@sysoev.runxt_feature_libs=
178*0Sigor@sysoev.runxt_feature_test="#include <fcntl.h>
179*0Sigor@sysoev.ru                  #include <sys/poll.h>
180*0Sigor@sysoev.ru                  #include <sys/pollset.h>
181*0Sigor@sysoev.ru                  #include <unistd.h>
182*0Sigor@sysoev.ru
183*0Sigor@sysoev.ru                  int main() {
184*0Sigor@sysoev.ru                      pollset_t  n;
185*0Sigor@sysoev.ru
186*0Sigor@sysoev.ru                      n = pollset_create(-1);
187*0Sigor@sysoev.ru                      pollset_destroy(n);
188*0Sigor@sysoev.ru                      return 0;
189*0Sigor@sysoev.ru                  }"
190*0Sigor@sysoev.ru. auto/feature
191*0Sigor@sysoev.ru
192*0Sigor@sysoev.ruif [ $nxt_found = yes ]; then
193*0Sigor@sysoev.ru    NXT_HAVE_POLLSET=YES
194*0Sigor@sysoev.ruelse
195*0Sigor@sysoev.ru    NXT_HAVE_POLLSET=NO
196*0Sigor@sysoev.rufi
197