]>
git.proxmox.com Git - pve-common.git/blob - src/PVE/Syscall.pm
6 die "syscall.ph can only be required once!\n" if $INC{'syscall.ph'};
9 unshare
=> &SYS_unshare
,
11 syncfs
=> &SYS_syncfs
,
13 openat
=> &SYS_openat
,
15 mkdirat
=> &SYS_mkdirat
,
16 faccessat
=> &SYS_faccessat
,
17 setresuid
=> &SYS_setresuid
,
18 fchownat
=> &SYS_fchownat
,
21 # These use asm-generic, so they're the same across (sane) architectures. We use numbers
22 # since they're not in perl's syscall.ph yet...
31 %fsmount_constants = (
32 OPEN_TREE_CLONE
=> 0x0000_0001,
33 OPEN_TREE_CLOEXEC
=> 000200_0000, # octal!
35 MOVE_MOUNT_F_SYMLINKS
=> 0x0000_0001,
36 MOVE_MOUNT_F_AUTOMOUNTS
=> 0x0000_0002,
37 MOVE_MOUNT_F_EMPTY_PATH
=> 0x0000_0004,
38 MOVE_MOUNT_F_MASK
=> 0x0000_0007,
40 MOVE_MOUNT_T_SYMLINKS
=> 0x0000_0010,
41 MOVE_MOUNT_T_AUTOMOUNTS
=> 0x0000_0020,
42 MOVE_MOUNT_T_EMPTY_PATH
=> 0x0000_0040,
43 MOVE_MOUNT_T_MASK
=> 0x0000_0070,
45 FSMOUNT_CLOEXEC
=> 0x0000_0001,
47 FSOPEN_CLOEXEC
=> 0x0000_0001,
49 MOUNT_ATTR_RDONLY
=> 0x0000_0001,
50 MOUNT_ATTR_NOSUID
=> 0x0000_0002,
51 MOUNT_ATTR_NODEV
=> 0x0000_0004,
52 MOUNT_ATTR_NOEXEC
=> 0x0000_0008,
53 MOUNT_ATTR_RELATIME
=> 0x0000_0000,
54 MOUNT_ATTR_NOATIME
=> 0x0000_0010,
55 MOUNT_ATTR_STRICTATIME
=> 0x0000_0020,
56 MOUNT_ATTR_NODIRATIME
=> 0x0000_0080,
58 FSPICK_CLOEXEC
=> 0x0000_0001,
59 FSPICK_SYMLINK_NOFOLLOW
=> 0x0000_0002,
60 FSPICK_NO_AUTOMOUNT
=> 0x0000_0004,
61 FSPICK_EMPTY_PATH
=> 0x0000_0008,
63 FSCONFIG_SET_FLAG
=> 0,
64 FSCONFIG_SET_STRING
=> 1,
65 FSCONFIG_SET_BINARY
=> 2,
66 FSCONFIG_SET_PATH
=> 3,
67 FSCONFIG_SET_PATH_EMPTY
=> 4,
69 FSCONFIG_CMD_CREATE
=> 6,
70 FSCONFIG_CMD_RECONFIGURE
=> 7,
74 use constant \
%syscalls;
75 use constant \
%fsmount_constants;
79 our @EXPORT_OK = (keys(%syscalls), keys(%fsmount_constants), 'file_handle_result');
80 our %EXPORT_TAGS = (fsmount
=> [keys(%fsmount_constants)]);
82 # Create a file handle from a numeric file descriptor (to make sure it's close()d when it goes out
84 sub file_handle_result
($) {
86 return undef if $fd_num < 0;
88 open(my $fh, '<&=', $fd_num)