
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. :^)
24 lines
472 B
C++
24 lines
472 B
C++
#include <Kernel/Syscall.h>
|
|
#include <errno.h>
|
|
#include <fcntl.h>
|
|
#include <stdarg.h>
|
|
#include <stdio.h>
|
|
|
|
extern "C" {
|
|
|
|
int fcntl(int fd, int cmd, ...)
|
|
{
|
|
va_list ap;
|
|
va_start(ap, cmd);
|
|
u32 extra_arg = va_arg(ap, u32);
|
|
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);
|
|
}
|
|
|
|
}
|