summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem/InodeWatcher.h
AgeCommit message (Collapse)Author
2020-12-14Kernel: Move InodeWatcher::Event into Kernel/API/InodeWatcherEventItamar
This allows userspace code to parse these events.
2020-09-19Kernel: Let InodeWatcher track child inode numbers instead of namesAndreas Kling
First of all, this fixes a dumb info leak where we'd write kernel heap addresses (StringImpl*) into userspace memory when reading a watcher. Instead of trying to pass names to userspace, we now simply pass the child inode index. Nothing in userspace makes use of this yet anyway, so it's not like we're breaking anything. We'll see how this evolves.
2020-09-13Kernel: Make copy_to/from_user safe and remove unnecessary checksTom
Since the CPU already does almost all necessary validation steps for us, we don't really need to attempt to do this. Doing it ourselves doesn't really work very reliably, because we'd have to account for other processors modifying virtual memory, and we'd have to account for e.g. pages not being able to be allocated due to insufficient resources. So change the copy_to/from_user (and associated helper functions) to use the new safe_memcpy, which will return whether it succeeded or not. The only manual validation step needed (which the CPU can't perform for us) is making sure the pointers provided by user mode aren't pointing to kernel mappings. To make it easier to read/write from/to either kernel or user mode data add the UserOrKernelBuffer helper class, which will internally either use copy_from/to_user or directly memcpy, or pass the data through directly using a temporary buffer on the stack. Last but not least we need to keep syscall params trivial as we need to copy them from/to user mode using copy_from/to_user.
2020-08-04Kernel: Make File::write() and File::read() return KResultOr<size_t>Andreas Kling
Instead of returning a ssize_t where negative values mean error, we now return KResultOr<size_t> and use the error state to report errors exclusively.
2020-07-04Kernel: Add "child added" and "child removed" InodeWatcher eventsAndreas Kling
The child name is not yet accessible to userspace, but will be in a future patch.
2020-04-10Kernel: Add explicit offset parameter to File::read etcConrad Pankoff
2020-02-16Kernel: Move all code into the Kernel namespaceAndreas Kling
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2019-11-04Kernel: Make File's can_read/can_write take a const FileDescription&Andreas Kling
Asking a File if we could possibly read or write it will never mutate the asking FileDescription&, so it should be const.
2019-07-22Kernel: Add a mechanism for listening for changes to an inode.Andreas Kling
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. :^)