Parameters: |
|
---|
This watches a file system path for attribute changes. That is, it calls stat() on that path in regular intervals (or when the OS says it changed) and sees if it changed compared to the last time, invoking the callback if it did.
The path does not need to exist: changing from ‘path exists’ to ‘path does not exist’ is a status change like any other. The condition ‘path does not exist’ (or more correctly ‘path cannot be stat()ed’) is signified by the Statdata.nlink field being 0 (which is otherwise always forced to be at least 1) and all the other fields of the Statdata object having unspecified contents.
The path must not end in a slash or contain special components such as . or ... The path should be absolute: if it is relative and your working directory changes, then the behaviour is undefined.
Since there is no portable change notification interface available, the portable implementation simply calls stat() regularly on the path to see if it changed somehow. You can specify a recommended polling interval for this case. If you specify a polling interval of 0.0 (highly recommended!) then a suitable, unspecified default value will be used (which you can expect to be around five seconds, although this might change dynamically). libev will also impose a minimum interval which is currently around 0.1, but that’s usually overkill.
This watcher type is not meant for massive numbers of Stat watchers, as even with OS-supported change notifications, this can be resource-intensive.
Parameters: |
|
---|
Configures the watcher.
Updates Stat.current immediately with a new Statdata object. If you change the watched path in your callback, you could call this function to avoid detecting this change (while introducing a race condition if you are not the only one changing the path). Can also be useful simply to find out the new values.
Read only
The file system path that is being watched.
Read only
The specified interval.
Read only
device.
Read only
device type.
Read only
inode.
Read only
total size, in bytes.
Read only
number of hard links.
Read only
protection bits.
Read only
user ID of owner.
Read only
group ID of owner.
Read only
time of last access.
Read only
time of last modification.
Read only
time of last status change.