mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 06:18:59 +00:00
Kernel: Let inodes provide pre-open file descriptions
Some magical inodes, such as /proc/pid/fd/fileno, are going to want to open() to a custom FileDescription, so add a hook for that.
This commit is contained in:
parent
ae64fd1b27
commit
8642a7046c
Notes:
sideshowbarker
2024-07-19 10:01:13 +09:00
Author: https://github.com/bugaevc
Commit: 8642a7046c
Pull-request: https://github.com/SerenityOS/serenity/pull/1079
Reviewed-by: https://github.com/awesomekling
3 changed files with 13 additions and 2 deletions
|
@ -230,6 +230,9 @@ KResultOr<NonnullRefPtr<FileDescription>> VFS::open(StringView path, int options
|
|||
return KResult(-EACCES);
|
||||
}
|
||||
|
||||
if (auto preopen_fd = inode.preopen_fd())
|
||||
return *preopen_fd;
|
||||
|
||||
if (metadata.is_device()) {
|
||||
if (custody.mount_flags() & MS_NODEV)
|
||||
return KResult(-EACCES);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue