… | |
… | |
1496 | semantics of C<ev_stat> watchers, which means that libev sometimes needs |
1496 | semantics of C<ev_stat> watchers, which means that libev sometimes needs |
1497 | to fall back to regular polling again even with inotify, but changes are |
1497 | to fall back to regular polling again even with inotify, but changes are |
1498 | usually detected immediately, and if the file exists there will be no |
1498 | usually detected immediately, and if the file exists there will be no |
1499 | polling. |
1499 | polling. |
1500 | |
1500 | |
|
|
1501 | =head3 Inotify |
|
|
1502 | |
|
|
1503 | When C<inotify (7)> support has been compiled into libev (generally only |
|
|
1504 | available on Linux) and present at runtime, it will be used to speed up |
|
|
1505 | change detection where possible. The inotify descriptor will be created lazily |
|
|
1506 | when the first C<ev_stat> watcher is being started. |
|
|
1507 | |
|
|
1508 | Inotify presense does not change the semantics of C<ev_stat> watchers |
|
|
1509 | except that changes might be detected earlier, and in some cases, to avoid |
|
|
1510 | making regular C<stat> calls. Even in the presense of inotify support |
|
|
1511 | there are many cases where libev has to resort to regular C<stat> polling. |
|
|
1512 | |
|
|
1513 | (There is no support for kqueue, as apparently it cannot be used to |
|
|
1514 | implement this functionality, due to the requirement of having a file |
|
|
1515 | descriptor open on the object at all times). |
|
|
1516 | |
1501 | =head3 The special problem of stat time resolution |
1517 | =head3 The special problem of stat time resolution |
1502 | |
1518 | |
1503 | The C<stat ()> syscall only supports full-second resolution portably, and |
1519 | The C<stat ()> syscall only supports full-second resolution portably, and |
1504 | even on systems where the resolution is higher, many filesystems still |
1520 | even on systems where the resolution is higher, many filesystems still |
1505 | only support whole seconds. |
1521 | only support whole seconds. |
… | |
… | |
1559 | =item const char *path [read-only] |
1575 | =item const char *path [read-only] |
1560 | |
1576 | |
1561 | The filesystem path that is being watched. |
1577 | The filesystem path that is being watched. |
1562 | |
1578 | |
1563 | =back |
1579 | =back |
|
|
1580 | |
|
|
1581 | =head3 Examples |
1564 | |
1582 | |
1565 | Example: Watch C</etc/passwd> for attribute changes. |
1583 | Example: Watch C</etc/passwd> for attribute changes. |
1566 | |
1584 | |
1567 | static void |
1585 | static void |
1568 | passwd_cb (struct ev_loop *loop, ev_stat *w, int revents) |
1586 | passwd_cb (struct ev_loop *loop, ev_stat *w, int revents) |