… | |
… | |
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 | |
133 | print <<EOF; |
133 | print <<EOF; |
134 | |
134 | |
135 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
135 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
136 | |
136 | |
137 | |
137 | |
138 | Similarly to the epoll backend above, EV can take advantage of kqueue |
138 | Similarly to the epoll backend above, EV can take advantage of kqueue on |
139 | on many BSD systems (it seems to be broken on Mac OS X though, but what |
139 | many BSD systems. Support for kqueue will be detected at runtime, with a |
140 | isn't broken on that shoddy platform... ah yes, the cash gushing by apple, |
140 | safe fallback to other methods when it cannot be used. |
141 | selling defective software works perfectly there). Support for kqueue will |
|
|
142 | be detected at runtime, with a safe fallback to other methods when it |
|
|
143 | cannot be used. |
|
|
144 | |
141 | |
145 | EOF |
142 | Note that kqueue is broken on most operating systems, so it defaults to |
|
|
143 | 'n' on everything but netbsd. Here is what we know: |
146 | |
144 | |
|
|
145 | NetBSD: working in at least 3.1. Yeah! :) |
|
|
146 | FreeBSD: broken on at least 6.2-STABLE, |
|
|
147 | sockets and pipes *might* work, ptys definitely don't. |
|
|
148 | OpenBSD: reports indicate that it likely doesn't work |
|
|
149 | (similar problems as on FreeBSD). |
|
|
150 | OS X: completely, utterly broken on at least <= 10.5. |
|
|
151 | |
|
|
152 | EOF |
|
|
153 | |
|
|
154 | my $can_kqueue = $^O =~ /netbsd/i && -e "/usr/include/sys/event.h"; |
|
|
155 | |
147 | $DEFINE .= " -DEV_USE_KQUEUE=" . (0 + (prompt ("Enable kqueue backend (y/n)?", (-e "/usr/include/sys/event.h") ? "y" : "n") =~ /[yY]/)); |
156 | $DEFINE .= " -DEV_USE_KQUEUE=" . (0 + (prompt ("Enable kqueue backend (y/n)?", $can_kqueue ? "y" : "n") =~ /[yY]/)); |
148 | |
157 | |
149 | print <<EOF; |
158 | print <<EOF; |
150 | |
159 | |
151 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
160 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
152 | |
161 | |
153 | |
162 | |
154 | 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 |
155 | 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 |
156 | 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. |
157 | |
166 | |
158 | EOF |
167 | EOF |
159 | |
168 | |
160 | $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]/)); |
161 | |
170 | |
162 | print <<EOF; |
171 | print <<EOF; |
163 | |
172 | |
164 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
173 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
165 | |
174 | |
166 | |
175 | |
167 | EV needs the functions pthread_atfork and clock_gettime. On most systems |
176 | EV needs the functions pthread_atfork and clock_gettime. On most systems |
168 | you need some special libraries for this (such as -lrt and -lpthread). You |
177 | you need some special libraries for this (such as -lrt and -lpthread). You |
169 | can specify additional libraries to provide these calls now, or accept the |
178 | can specify additional libraries to provide these calls (and any other |
170 | default. |
179 | required by EV) now, or accept the default. |
171 | |
180 | |
172 | EOF |
181 | EOF |
173 | |
182 | |
|
|
183 | $SOLARIS_LIBS = $^O =~ /solaris/ ? " -lsocket -lnsl" : ""; |
|
|
184 | |
174 | $LIBS = prompt "Extra libraries for pthread_atfork and clock_gettime?", "-lpthread -lrt"; |
185 | $LIBS = prompt "Extra libraries for pthread_atfork and clock_gettime?", "-lpthread -lrt$SOLARIS_LIBS"; |
175 | |
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]/)); |
176 | |
202 | |
177 | print <<EOF; |
203 | print <<EOF; |
178 | |
204 | |
179 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
205 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
180 | |
206 | |