shadow_rs/host/syscall/handler/
fileat.rs

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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
use linux_api::posix_types::kernel_mode_t;
use shadow_shim_helper_rs::syscall_types::ForeignPtr;

use crate::cshadow;
use crate::host::syscall::handler::{SyscallContext, SyscallHandler};
use crate::host::syscall::type_formatting::SyscallStringArg;
use crate::host::syscall::types::SyscallResult;

impl SyscallHandler {
    log_syscall!(
        openat,
        /* rv */ std::ffi::c_int,
        /* dirfd */ std::ffi::c_int,
        /* pathname */ SyscallStringArg,
        /* flags */ linux_api::fcntl::OFlag,
        /* mode */ nix::sys::stat::Mode,
    );
    pub fn openat(
        ctx: &mut SyscallContext,
        _dir_fd: std::ffi::c_int,
        _path: ForeignPtr<()>,
        _flags: std::ffi::c_int,
        _mode: kernel_mode_t,
    ) -> SyscallResult {
        Self::legacy_syscall(cshadow::syscallhandler_openat, ctx)
    }

    log_syscall!(faccessat, /* rv */ std::ffi::c_int);
    pub fn faccessat(ctx: &mut SyscallContext) -> SyscallResult {
        Self::legacy_syscall(cshadow::syscallhandler_faccessat, ctx)
    }

    log_syscall!(fchmodat, /* rv */ std::ffi::c_int);
    pub fn fchmodat(ctx: &mut SyscallContext) -> SyscallResult {
        Self::legacy_syscall(cshadow::syscallhandler_fchmodat, ctx)
    }

    log_syscall!(fchmodat2, /* rv */ std::ffi::c_int);
    pub fn fchmodat2(ctx: &mut SyscallContext) -> SyscallResult {
        Self::legacy_syscall(cshadow::syscallhandler_fchmodat2, ctx)
    }

    log_syscall!(fchownat, /* rv */ std::ffi::c_int);
    pub fn fchownat(ctx: &mut SyscallContext) -> SyscallResult {
        Self::legacy_syscall(cshadow::syscallhandler_fchownat, ctx)
    }

    log_syscall!(futimesat, /* rv */ std::ffi::c_int);
    pub fn futimesat(ctx: &mut SyscallContext) -> SyscallResult {
        Self::legacy_syscall(cshadow::syscallhandler_futimesat, ctx)
    }

    log_syscall!(linkat, /* rv */ std::ffi::c_int);
    pub fn linkat(ctx: &mut SyscallContext) -> SyscallResult {
        Self::legacy_syscall(cshadow::syscallhandler_linkat, ctx)
    }

    log_syscall!(mkdirat, /* rv */ std::ffi::c_int);
    pub fn mkdirat(ctx: &mut SyscallContext) -> SyscallResult {
        Self::legacy_syscall(cshadow::syscallhandler_mkdirat, ctx)
    }

    log_syscall!(mknodat, /* rv */ std::ffi::c_int);
    pub fn mknodat(ctx: &mut SyscallContext) -> SyscallResult {
        Self::legacy_syscall(cshadow::syscallhandler_mknodat, ctx)
    }

    log_syscall!(readlinkat, /* rv */ std::ffi::c_int);
    pub fn readlinkat(ctx: &mut SyscallContext) -> SyscallResult {
        Self::legacy_syscall(cshadow::syscallhandler_readlinkat, ctx)
    }

    log_syscall!(renameat, /* rv */ std::ffi::c_int);
    pub fn renameat(ctx: &mut SyscallContext) -> SyscallResult {
        Self::legacy_syscall(cshadow::syscallhandler_renameat, ctx)
    }

    log_syscall!(renameat2, /* rv */ std::ffi::c_int);
    pub fn renameat2(ctx: &mut SyscallContext) -> SyscallResult {
        Self::legacy_syscall(cshadow::syscallhandler_renameat2, ctx)
    }

    log_syscall!(symlinkat, /* rv */ std::ffi::c_int);
    pub fn symlinkat(ctx: &mut SyscallContext) -> SyscallResult {
        Self::legacy_syscall(cshadow::syscallhandler_symlinkat, ctx)
    }

    log_syscall!(unlinkat, /* rv */ std::ffi::c_int);
    pub fn unlinkat(ctx: &mut SyscallContext) -> SyscallResult {
        Self::legacy_syscall(cshadow::syscallhandler_unlinkat, ctx)
    }

    log_syscall!(utimensat, /* rv */ std::ffi::c_int);
    pub fn utimensat(ctx: &mut SyscallContext) -> SyscallResult {
        Self::legacy_syscall(cshadow::syscallhandler_utimensat, ctx)
    }
}