-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathstat.rs
More file actions
68 lines (58 loc) · 2.13 KB
/
stat.rs
File metadata and controls
68 lines (58 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
use std::io;
use fspy_seccomp_unotify::supervisor::handler::arg::{CStrPtr, Caller, Fd};
use super::SyscallHandler;
impl SyscallHandler {
#[cfg(target_arch = "x86_64")]
pub(super) fn stat(&mut self, caller: Caller, (path,): (CStrPtr,)) -> io::Result<()> {
self.handle_open(caller, Fd::cwd(), path, libc::O_RDONLY)
}
#[cfg(target_arch = "x86_64")]
pub(super) fn lstat(&mut self, caller: Caller, (path,): (CStrPtr,)) -> io::Result<()> {
self.handle_open(caller, Fd::cwd(), path, libc::O_RDONLY)
}
#[cfg(target_arch = "aarch64")]
pub(super) fn fstatat(
&mut self,
caller: Caller,
(dir_fd, path_ptr): (Fd, CStrPtr),
) -> io::Result<()> {
self.handle_open(caller, dir_fd, path_ptr, libc::O_RDONLY)
}
#[cfg(target_arch = "x86_64")]
pub(super) fn newfstatat(
&mut self,
caller: Caller,
(dir_fd, path_ptr): (Fd, CStrPtr),
) -> io::Result<()> {
self.handle_open(caller, dir_fd, path_ptr, libc::O_RDONLY)
}
/// statx(2) — modern replacement for stat/fstatat used by newer glibc.
pub(super) fn statx(
&mut self,
caller: Caller,
(dir_fd, path_ptr): (Fd, CStrPtr),
) -> io::Result<()> {
self.handle_open(caller, dir_fd, path_ptr, libc::O_RDONLY)
}
/// access(2) — check file accessibility (e.g. existsSync in Node.js).
#[cfg(target_arch = "x86_64")]
pub(super) fn access(&mut self, caller: Caller, (path,): (CStrPtr,)) -> io::Result<()> {
self.handle_open(caller, Fd::cwd(), path, libc::O_RDONLY)
}
/// faccessat(2) — check file accessibility relative to directory fd.
pub(super) fn faccessat(
&mut self,
caller: Caller,
(dir_fd, path_ptr): (Fd, CStrPtr),
) -> io::Result<()> {
self.handle_open(caller, dir_fd, path_ptr, libc::O_RDONLY)
}
/// faccessat2(2) — extended faccessat with flags parameter.
pub(super) fn faccessat2(
&mut self,
caller: Caller,
(dir_fd, path_ptr): (Fd, CStrPtr),
) -> io::Result<()> {
self.handle_open(caller, dir_fd, path_ptr, libc::O_RDONLY)
}
}