mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 08:00:20 +00:00
fe5ca6ca27
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>
37 lines
841 B
C++
37 lines
841 B
C++
/*
|
|
* Copyright (c) 2020-2021, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/EnumBits.h>
|
|
#include <AK/Types.h>
|
|
|
|
#ifdef KERNEL
|
|
# include <LibC/limits.h>
|
|
#else
|
|
# include <limits.h>
|
|
#endif
|
|
|
|
struct [[gnu::packed]] InodeWatcherEvent {
|
|
enum class Type : u32 {
|
|
Invalid = 0,
|
|
MetadataModified = 1 << 0,
|
|
ContentModified = 1 << 1,
|
|
Deleted = 1 << 2,
|
|
ChildCreated = 1 << 3,
|
|
ChildDeleted = 1 << 4,
|
|
};
|
|
|
|
int watch_descriptor { 0 };
|
|
Type type { Type::Invalid };
|
|
size_t name_length { 0 };
|
|
// This is a VLA which is written during the read() from the descriptor.
|
|
const char name[];
|
|
};
|
|
|
|
AK_ENUM_BITWISE_OPERATORS(InodeWatcherEvent::Type);
|
|
|
|
constexpr unsigned MAXIMUM_EVENT_SIZE = sizeof(InodeWatcherEvent) + NAME_MAX + 1;
|