… | |
… | |
116 | print <<EOF; |
116 | print <<EOF; |
117 | |
117 | |
118 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
118 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
119 | |
119 | |
120 | |
120 | |
121 | EV by default uses select, which makes it hard to write efficient servers, |
121 | Select and poll make it hard to write efficient servers, especially if the |
122 | especially if the number of active connections is much lower than the open |
122 | number of active connections is much lower than the watched ones. GNU/Linux |
123 | ones. GNU/Linux systems have a more scalable method called "epoll", which |
123 | systems have a more scalable method called "epoll", which EV can use. For |
124 | EV can use. For this to work, both your kernel and glibc have to support |
124 | this to work, both your kernel and glibc have to support epoll, but if you |
125 | epoll, but if you can compile it, the detection will be done at runtime, |
125 | can compile it, the detection will be done at runtime, and EV will safely |
126 | and EV will safely fall back to using select when epoll isn't available. |
126 | fall back to using select when epoll isn't available. If unsure, accept |
127 | If unsure, accept the default. |
127 | the default. |
128 | |
128 | |
129 | EOF |
129 | EOF |
130 | |
130 | |
131 | $DEFINE .= " -DEV_USE_EPOLL=" . (0 + (prompt ("Enable epoll backend (y/n)?", (-e "/usr/include/sys/epoll.h") ? "y" : "n") =~ /[yY]/)); |
131 | $DEFINE .= " -DEV_USE_EPOLL=" . (0 + (prompt ("Enable epoll backend (y/n)?", (-e "/usr/include/sys/epoll.h") ? "y" : "n") =~ /[yY]/)); |
132 | |
132 | |
… | |
… | |
138 | Similarly to the epoll backend above, EV can take advantage of kqueue on |
138 | Similarly to the epoll backend above, EV can take advantage of kqueue on |
139 | many BSD systems. Support for kqueue will be detected at runtime, with a |
139 | many BSD systems. Support for kqueue will be detected at runtime, with a |
140 | safe fallback to other methods when it cannot be used. |
140 | safe fallback to other methods when it cannot be used. |
141 | |
141 | |
142 | Note that kqueue is broken on most operating systems, so it defaults to |
142 | Note that kqueue is broken on most operating systems, so it defaults to |
143 | 'n' on most platforms that claim to support it. Here is what we know: |
143 | 'n' on everything but netbsd. Here is what we know: |
144 | |
144 | |
145 | OS X: completely, utterly broken on at least <= 10.5. |
145 | NetBSD: working in at least 3.1. Yeah! :) |
146 | FreeBSD: broken on at least <= 6.2-STABLE, |
146 | FreeBSD: broken on at least 6.2-STABLE, |
147 | sockets and pipes *might* work, ptys definitely don't. |
147 | sockets and pipes *might* work, ptys definitely don't. |
148 | NetBSD: reports indicate that it likely WORKS. Yeah! :) |
|
|
149 | OpenBSD: reports indicate that it likely doesn't work |
148 | OpenBSD: reports indicate that it likely doesn't work |
150 | (similar problems as on FreeBSD). |
149 | (similar problems as on FreeBSD). |
|
|
150 | OS X: completely, utterly broken on at least <= 10.5. |
151 | |
151 | |
152 | EOF |
152 | EOF |
153 | |
153 | |
154 | my $can_kqueue = $^O =~ /netbsd/i && -e "/usr/include/sys/event.h"; |
154 | my $can_kqueue = $^O =~ /netbsd/i && -e "/usr/include/sys/event.h"; |
155 | |
155 | |
… | |
… | |
159 | |
159 | |
160 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
160 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
161 | |
161 | |
162 | |
162 | |
163 | Similarly to the kqueue backend above, EV can take advantage of the |
163 | Similarly to the kqueue backend above, EV can take advantage of the |
164 | solaris 10 port interface. Support for port will be detected at runtime, |
164 | solaris 10 event port interface. Support for event ports will be detected |
165 | with a safe fallback to other methods when it cannot be used. |
165 | at runtime, with a safe fallback to other methods when it cannot be used. |
166 | |
166 | |
167 | EOF |
167 | EOF |
168 | |
168 | |
169 | $DEFINE .= " -DEV_USE_PORT=" . (0 + (prompt ("Enable port backend (y/n)?", (-e "/usr/include/sys/port.h") ? "y" : "n") =~ /[yY]/)); |
169 | $DEFINE .= " -DEV_USE_PORT=" . (0 + (prompt ("Enable event port backend (y/n)?", (-e "/usr/include/sys/port.h") ? "y" : "n") =~ /[yY]/)); |
170 | |
170 | |
171 | print <<EOF; |
171 | print <<EOF; |
172 | |
172 | |
173 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
173 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
174 | |
174 | |
… | |
… | |
182 | |
182 | |
183 | $SOLARIS_LIBS = $^O =~ /solaris/ ? " -lsocket -lnsl" : ""; |
183 | $SOLARIS_LIBS = $^O =~ /solaris/ ? " -lsocket -lnsl" : ""; |
184 | |
184 | |
185 | $LIBS = prompt "Extra libraries for pthread_atfork and clock_gettime?", "-lpthread -lrt$SOLARIS_LIBS"; |
185 | $LIBS = prompt "Extra libraries for pthread_atfork and clock_gettime?", "-lpthread -lrt$SOLARIS_LIBS"; |
186 | |
186 | |
|
|
187 | |
|
|
188 | print <<EOF; |
|
|
189 | |
|
|
190 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
|
|
191 | |
|
|
192 | |
|
|
193 | A backend of a different kind is the Linux inotify(7) interface, which can |
|
|
194 | be used to speed up (and reduce resource consumption) of stat watchers. If |
|
|
195 | you have it, it is usually a good idea to enable it. |
|
|
196 | |
|
|
197 | EOF |
|
|
198 | |
|
|
199 | my $can_inotify = -e "/usr/include/sys/inotify.h"; |
|
|
200 | |
|
|
201 | $DEFINE .= " -DEV_USE_INOTIFY=" . (0 + (prompt ("Enable inotify support (y/n)?", $can_inotify ? "y" : "n") =~ /[yY]/)); |
187 | |
202 | |
188 | print <<EOF; |
203 | print <<EOF; |
189 | |
204 | |
190 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
205 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
191 | |
206 | |