… | |
… | |
210 | watchers\fR, which are relatively small C structures you initialise with the |
210 | watchers\fR, which are relatively small C structures you initialise with the |
211 | details of the event, and then hand it over to libev by \fIstarting\fR the |
211 | details of the event, and then hand it over to libev by \fIstarting\fR the |
212 | watcher. |
212 | watcher. |
213 | .SH "FEATURES" |
213 | .SH "FEATURES" |
214 | .IX Header "FEATURES" |
214 | .IX Header "FEATURES" |
215 | Libev supports \f(CW\*(C`select\*(C'\fR, \f(CW\*(C`poll\*(C'\fR, the linux-specific \f(CW\*(C`epoll\*(C'\fR, the |
215 | Libev supports \f(CW\*(C`select\*(C'\fR, \f(CW\*(C`poll\*(C'\fR, the Linux-specific \f(CW\*(C`epoll\*(C'\fR, the |
216 | bsd-specific \f(CW\*(C`kqueue\*(C'\fR and the solaris-specific event port mechanisms |
216 | BSD-specific \f(CW\*(C`kqueue\*(C'\fR and the Solaris-specific event port mechanisms |
217 | for file descriptor events (\f(CW\*(C`ev_io\*(C'\fR), relative timers (\f(CW\*(C`ev_timer\*(C'\fR), |
217 | for file descriptor events (\f(CW\*(C`ev_io\*(C'\fR), the Linux \f(CW\*(C`inotify\*(C'\fR interface |
|
|
218 | (for \f(CW\*(C`ev_stat\*(C'\fR), relative timers (\f(CW\*(C`ev_timer\*(C'\fR), absolute timers |
218 | absolute timers with customised rescheduling (\f(CW\*(C`ev_periodic\*(C'\fR), synchronous |
219 | with customised rescheduling (\f(CW\*(C`ev_periodic\*(C'\fR), synchronous signals |
219 | signals (\f(CW\*(C`ev_signal\*(C'\fR), process status change events (\f(CW\*(C`ev_child\*(C'\fR), and |
220 | (\f(CW\*(C`ev_signal\*(C'\fR), process status change events (\f(CW\*(C`ev_child\*(C'\fR), and event |
220 | event watchers dealing with the event loop mechanism itself (\f(CW\*(C`ev_idle\*(C'\fR, |
221 | watchers dealing with the event loop mechanism itself (\f(CW\*(C`ev_idle\*(C'\fR, |
221 | \&\f(CW\*(C`ev_embed\*(C'\fR, \f(CW\*(C`ev_prepare\*(C'\fR and \f(CW\*(C`ev_check\*(C'\fR watchers) as well as |
222 | \&\f(CW\*(C`ev_embed\*(C'\fR, \f(CW\*(C`ev_prepare\*(C'\fR and \f(CW\*(C`ev_check\*(C'\fR watchers) as well as |
222 | file watchers (\f(CW\*(C`ev_stat\*(C'\fR) and even limited support for fork events |
223 | file watchers (\f(CW\*(C`ev_stat\*(C'\fR) and even limited support for fork events |
223 | (\f(CW\*(C`ev_fork\*(C'\fR). |
224 | (\f(CW\*(C`ev_fork\*(C'\fR). |
224 | .PP |
225 | .PP |
225 | It also is quite fast (see this |
226 | It also is quite fast (see this |
… | |
… | |
304 | might be supported on the current system, you would need to look at |
305 | might be supported on the current system, you would need to look at |
305 | \&\f(CW\*(C`ev_embeddable_backends () & ev_supported_backends ()\*(C'\fR, likewise for |
306 | \&\f(CW\*(C`ev_embeddable_backends () & ev_supported_backends ()\*(C'\fR, likewise for |
306 | recommended ones. |
307 | recommended ones. |
307 | .Sp |
308 | .Sp |
308 | See the description of \f(CW\*(C`ev_embed\*(C'\fR watchers for more info. |
309 | See the description of \f(CW\*(C`ev_embed\*(C'\fR watchers for more info. |
309 | .IP "ev_set_allocator (void *(*cb)(void *ptr, size_t size))" 4 |
310 | .IP "ev_set_allocator (void *(*cb)(void *ptr, long size))" 4 |
310 | .IX Item "ev_set_allocator (void *(*cb)(void *ptr, size_t size))" |
311 | .IX Item "ev_set_allocator (void *(*cb)(void *ptr, long size))" |
311 | Sets the allocation function to use (the prototype and semantics are |
312 | Sets the allocation function to use (the prototype is similar \- the |
312 | identical to the realloc C function). It is used to allocate and free |
313 | semantics is identical \- to the realloc C function). It is used to |
313 | memory (no surprises here). If it returns zero when memory needs to be |
314 | allocate and free memory (no surprises here). If it returns zero when |
314 | allocated, the library might abort or take some potentially destructive |
315 | memory needs to be allocated, the library might abort or take some |
315 | action. The default is your system realloc function. |
316 | potentially destructive action. The default is your system realloc |
|
|
317 | function. |
316 | .Sp |
318 | .Sp |
317 | You could override this function in high-availability programs to, say, |
319 | You could override this function in high-availability programs to, say, |
318 | free some memory if it cannot allocate memory, to use a special allocator, |
320 | free some memory if it cannot allocate memory, to use a special allocator, |
319 | or even to sleep a while and retry until some memory is available. |
321 | or even to sleep a while and retry until some memory is available. |
320 | .Sp |
322 | .Sp |
… | |
… | |
1381 | The path does not need to exist: changing from \*(L"path exists\*(R" to \*(L"path does |
1383 | The path does not need to exist: changing from \*(L"path exists\*(R" to \*(L"path does |
1382 | not exist\*(R" is a status change like any other. The condition \*(L"path does |
1384 | not exist\*(R" is a status change like any other. The condition \*(L"path does |
1383 | not exist\*(R" is signified by the \f(CW\*(C`st_nlink\*(C'\fR field being zero (which is |
1385 | not exist\*(R" is signified by the \f(CW\*(C`st_nlink\*(C'\fR field being zero (which is |
1384 | otherwise always forced to be at least one) and all the other fields of |
1386 | otherwise always forced to be at least one) and all the other fields of |
1385 | the stat buffer having unspecified contents. |
1387 | the stat buffer having unspecified contents. |
|
|
1388 | .PP |
|
|
1389 | The path \fIshould\fR be absolute and \fImust not\fR end in a slash. If it is |
|
|
1390 | relative and your working directory changes, the behaviour is undefined. |
1386 | .PP |
1391 | .PP |
1387 | Since there is no standard to do this, the portable implementation simply |
1392 | Since there is no standard to do this, the portable implementation simply |
1388 | calls \f(CW\*(C`stat (2)\*(C'\fR regularly on the path to see if it changed somehow. You |
1393 | calls \f(CW\*(C`stat (2)\*(C'\fR regularly on the path to see if it changed somehow. You |
1389 | can specify a recommended polling interval for this case. If you specify |
1394 | can specify a recommended polling interval for this case. If you specify |
1390 | a polling interval of \f(CW0\fR (highly recommended!) then a \fIsuitable, |
1395 | a polling interval of \f(CW0\fR (highly recommended!) then a \fIsuitable, |