@@ -1849,12 +1849,44 @@ function uv_fs_readdir(UVLoop $loop, string $path, int $flags, callable $callbac
18491849}
18501850
18511851/**
1852- * Initialize fs event.
1852+ * Initialize file change event `UVFsEvent` handle, and start the given callback.
1853+ * This will watch the specified path for changes. `$flags` can be an ORed mask of `uv_fs_event_flags`.
1854+ *
1855+ * The callback will receive the following arguments:
1856+ *
1857+ * `handle` - `UVFsEvent` handle. The path field of the handle is the file on which the watch was set.
1858+ * `filename` - If a directory is being monitored, this is the file which was changed. Only non-null on
1859+ * Linux and Windows. May be null even on those platforms.
1860+ * `events` - one of `UV::RENAME` or `UV::CHANGE`, or a bitwise OR of both.
1861+ * `status` - Currently 0, or `error` if < 0.
18531862 *
18541863 * @param UVLoop $loop uv loop handle
18551864 * @param string $path
18561865 * @param callable $callback callback expects (UVFsEvent $handle, ?string $filename, int $events, int $status).
1857- * @param int $flags
1866+ *
1867+ * @param int $flags - `uv_fs_event_flags` that can be passed to control its behavior.
1868+ *
1869+ * By default, if the fs event watcher is given a directory name, we will
1870+ * watch for all events in that directory. This flags overrides this behavior
1871+ * and makes fs_event report only changes to the directory entry itself. This
1872+ * flag does not affect individual files watched.
1873+ * This flag is currently not implemented yet on any backend.
1874+ *
1875+ * `UV_FS_EVENT_WATCH_ENTRY = 1`
1876+ *
1877+ * By default uv_fs_event will try to use a kernel interface such as inotify
1878+ * or kqueue to detect events. This may not work on remote file systems such
1879+ * as NFS mounts. This flag makes fs_event fall back to calling stat() on a
1880+ * regular interval.
1881+ * This flag is currently not implemented yet on any backend.
1882+ *
1883+ * `UV_FS_EVENT_STAT = 2`
1884+ *
1885+ * By default, event watcher, when watching directory, is not registering
1886+ * (is ignoring) changes in its subdirectories.
1887+ * This flag will override this behaviour on platforms that support it.
1888+ *
1889+ * `UV_FS_EVENT_RECURSIVE = 4`
18581890 *
18591891 * @return UVFsEvent
18601892 */
0 commit comments