mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:48:10 +00:00
Kernel: Implement multi-watch InodeWatcher :^)
This patch modifies InodeWatcher to switch to a one watcher, multiple watches architecture. The following changes have been made: - The watch_file syscall is removed, and in its place the create_iwatcher, iwatcher_add_watch and iwatcher_remove_watch calls have been added. - InodeWatcher now holds multiple WatchDescriptions for each file that is being watched. - The InodeWatcher file descriptor can be read from to receive events on all watched files. Co-authored-by: Gunnar Beutner <gunnar@beutner.name>
This commit is contained in:
parent
2de11b0dc8
commit
fe5ca6ca27
16 changed files with 521 additions and 262 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2021, sin-ack <sin-ack@protonmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -13,6 +14,7 @@
|
|||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
#include <Kernel/FileSystem/FileSystem.h>
|
||||
#include <Kernel/FileSystem/InodeFile.h>
|
||||
#include <Kernel/FileSystem/InodeWatcher.h>
|
||||
#include <Kernel/Net/Socket.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/TTY/MasterPTY.h>
|
||||
|
@ -295,6 +297,25 @@ TTY* FileDescription::tty()
|
|||
return static_cast<TTY*>(m_file.ptr());
|
||||
}
|
||||
|
||||
bool FileDescription::is_inode_watcher() const
|
||||
{
|
||||
return m_file->is_inode_watcher();
|
||||
}
|
||||
|
||||
const InodeWatcher* FileDescription::inode_watcher() const
|
||||
{
|
||||
if (!is_inode_watcher())
|
||||
return nullptr;
|
||||
return static_cast<const InodeWatcher*>(m_file.ptr());
|
||||
}
|
||||
|
||||
InodeWatcher* FileDescription::inode_watcher()
|
||||
{
|
||||
if (!is_inode_watcher())
|
||||
return nullptr;
|
||||
return static_cast<InodeWatcher*>(m_file.ptr());
|
||||
}
|
||||
|
||||
bool FileDescription::is_master_pty() const
|
||||
{
|
||||
return m_file->is_master_pty();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue