diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-07-22 20:01:11 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-07-22 20:01:11 +0200 |
commit | c8e2bb5605adea7fff02a0e51b8246f944ba29ad (patch) | |
tree | ac7155364208f7dd559a5d594e1a47df93427cd0 /Libraries/LibC | |
parent | a9adf4c95b8ee3ba892878daec81d6cfc809be75 (diff) | |
download | serenity-c8e2bb5605adea7fff02a0e51b8246f944ba29ad.zip |
Kernel: Add a mechanism for listening for changes to an inode.
The syscall is quite simple:
int watch_file(const char* path, int path_length);
It returns a file descriptor referring to a "InodeWatcher" object in the
kernel. It becomes readable whenever something changes about the inode.
Currently this is implemented by hooking the "metadata dirty bit" in
Inode which isn't perfect, but it's a start. :^)
Diffstat (limited to 'Libraries/LibC')
-rw-r--r-- | Libraries/LibC/fcntl.cpp | 7 | ||||
-rw-r--r-- | Libraries/LibC/fcntl.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/Libraries/LibC/fcntl.cpp b/Libraries/LibC/fcntl.cpp index 582c339710..4ee34c6dac 100644 --- a/Libraries/LibC/fcntl.cpp +++ b/Libraries/LibC/fcntl.cpp @@ -14,4 +14,11 @@ int fcntl(int fd, int cmd, ...) int rc = syscall(SC_fcntl, fd, cmd, extra_arg); __RETURN_WITH_ERRNO(rc, rc, -1); } + +int watch_file(const char* path, int path_length) +{ + int rc = syscall(SC_watch_file, path, path_length); + __RETURN_WITH_ERRNO(rc, rc, -1); +} + } diff --git a/Libraries/LibC/fcntl.h b/Libraries/LibC/fcntl.h index 78aac1abdf..7c886f9f7e 100644 --- a/Libraries/LibC/fcntl.h +++ b/Libraries/LibC/fcntl.h @@ -54,6 +54,7 @@ __BEGIN_DECLS #define S_IRWXO (S_IRWXG >> 3) int fcntl(int fd, int cmd, ...); +int watch_file(const char* path, int path_length); #define F_RDLCK 0 #define F_WRLCK 1 |