… | |
… | |
1932 | C<stat> on that path in regular intervals (or when the OS says it changed) |
1932 | C<stat> on that path in regular intervals (or when the OS says it changed) |
1933 | and sees if it changed compared to the last time, invoking the callback if |
1933 | and sees if it changed compared to the last time, invoking the callback if |
1934 | it did. |
1934 | it did. |
1935 | |
1935 | |
1936 | The path does not need to exist: changing from "path exists" to "path does |
1936 | The path does not need to exist: changing from "path exists" to "path does |
1937 | not exist" is a status change like any other. The condition "path does |
1937 | not exist" is a status change like any other. The condition "path does not |
1938 | not exist" is signified by the C<st_nlink> field being zero (which is |
1938 | exist" (or more correctly "path cannot be stat'ed") is signified by the |
1939 | otherwise always forced to be at least one) and all the other fields of |
1939 | C<st_nlink> field being zero (which is otherwise always forced to be at |
1940 | the stat buffer having unspecified contents. |
1940 | least one) and all the other fields of the stat buffer having unspecified |
|
|
1941 | contents. |
1941 | |
1942 | |
1942 | The path I<must not> end in a slash or contain special components such as |
1943 | The path I<must not> end in a slash or contain special components such as |
1943 | C<.> or C<..>. The path I<should> be absolute: If it is relative and |
1944 | C<.> or C<..>. The path I<should> be absolute: If it is relative and |
1944 | your working directory changes, then the behaviour is undefined. |
1945 | your working directory changes, then the behaviour is undefined. |
1945 | |
1946 | |
… | |
… | |
1955 | This watcher type is not meant for massive numbers of stat watchers, |
1956 | This watcher type is not meant for massive numbers of stat watchers, |
1956 | as even with OS-supported change notifications, this can be |
1957 | as even with OS-supported change notifications, this can be |
1957 | resource-intensive. |
1958 | resource-intensive. |
1958 | |
1959 | |
1959 | At the time of this writing, the only OS-specific interface implemented |
1960 | At the time of this writing, the only OS-specific interface implemented |
1960 | is the Linux inotify interface (implementing kqueue support is left as |
1961 | is the Linux inotify interface (implementing kqueue support is left as an |
1961 | an exercise for the reader. Note, however, that the author sees no way |
1962 | exercise for the reader. Note, however, that the author sees no way of |
1962 | of implementing C<ev_stat> semantics with kqueue). |
1963 | implementing C<ev_stat> semantics with kqueue, except as a hint). |
1963 | |
1964 | |
1964 | =head3 ABI Issues (Largefile Support) |
1965 | =head3 ABI Issues (Largefile Support) |
1965 | |
1966 | |
1966 | Libev by default (unless the user overrides this) uses the default |
1967 | Libev by default (unless the user overrides this) uses the default |
1967 | compilation environment, which means that on systems with large file |
1968 | compilation environment, which means that on systems with large file |
… | |
… | |
1978 | to exchange stat structures with application programs compiled using the |
1979 | to exchange stat structures with application programs compiled using the |
1979 | default compilation environment. |
1980 | default compilation environment. |
1980 | |
1981 | |
1981 | =head3 Inotify and Kqueue |
1982 | =head3 Inotify and Kqueue |
1982 | |
1983 | |
1983 | When C<inotify (7)> support has been compiled into libev (generally |
1984 | When C<inotify (7)> support has been compiled into libev and present at |
1984 | only available with Linux 2.6.25 or above due to bugs in earlier |
1985 | runtime, it will be used to speed up change detection where possible. The |
1985 | implementations) and present at runtime, it will be used to speed up |
1986 | inotify descriptor will be created lazily when the first C<ev_stat> |
1986 | change detection where possible. The inotify descriptor will be created |
1987 | watcher is being started. |
1987 | lazily when the first C<ev_stat> watcher is being started. |
|
|
1988 | |
1988 | |
1989 | Inotify presence does not change the semantics of C<ev_stat> watchers |
1989 | Inotify presence does not change the semantics of C<ev_stat> watchers |
1990 | except that changes might be detected earlier, and in some cases, to avoid |
1990 | except that changes might be detected earlier, and in some cases, to avoid |
1991 | making regular C<stat> calls. Even in the presence of inotify support |
1991 | making regular C<stat> calls. Even in the presence of inotify support |
1992 | there are many cases where libev has to resort to regular C<stat> polling, |
1992 | there are many cases where libev has to resort to regular C<stat> polling, |
1993 | but as long as the path exists, libev usually gets away without polling. |
1993 | but as long as kernel 2.6.25 or newer is used (2.6.24 and older have too |
|
|
1994 | many bugs), the path exists (i.e. stat succeeds), and the path resides on |
|
|
1995 | a local filesystem (libev currently assumes only ext2/3, jfs, reiserfs and |
|
|
1996 | xfs are fully working) libev usually gets away without polling. |
1994 | |
1997 | |
1995 | There is no support for kqueue, as apparently it cannot be used to |
1998 | There is no support for kqueue, as apparently it cannot be used to |
1996 | implement this functionality, due to the requirement of having a file |
1999 | implement this functionality, due to the requirement of having a file |
1997 | descriptor open on the object at all times, and detecting renames, unlinks |
2000 | descriptor open on the object at all times, and detecting renames, unlinks |
1998 | etc. is difficult. |
2001 | etc. is difficult. |