]>
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
,
20 renameat2
=> &SYS_renameat2
,
21 open_tree
=> &SYS_open_tree
,
22 move_mount
=> &SYS_move_mount
,
23 fsopen
=> &SYS_fsopen
,
24 fsconfig
=> &SYS_fsconfig
,
25 fsmount
=> &SYS_fsmount
,
26 fspick
=> &SYS_fspick
,
27 getxattr
=> &SYS_getxattr
,
28 setxattr
=> &SYS_setxattr
,
29 fgetxattr
=> &SYS_fgetxattr
,
30 fsetxattr
=> &SYS_fsetxattr
,
32 # Below aren't yet in perl's syscall.ph but use asm-generic, so the same across (sane) archs
33 # -> none unknown currently, yay
36 %fsmount_constants = (
37 OPEN_TREE_CLONE
=> 0x0000_0001,
38 OPEN_TREE_CLOEXEC
=> 000200_0000, # octal!
40 MOVE_MOUNT_F_SYMLINKS
=> 0x0000_0001,
41 MOVE_MOUNT_F_AUTOMOUNTS
=> 0x0000_0002,
42 MOVE_MOUNT_F_EMPTY_PATH
=> 0x0000_0004,
43 MOVE_MOUNT_F_MASK
=> 0x0000_0007,
45 MOVE_MOUNT_T_SYMLINKS
=> 0x0000_0010,
46 MOVE_MOUNT_T_AUTOMOUNTS
=> 0x0000_0020,
47 MOVE_MOUNT_T_EMPTY_PATH
=> 0x0000_0040,
48 MOVE_MOUNT_T_MASK
=> 0x0000_0070,
50 FSMOUNT_CLOEXEC
=> 0x0000_0001,
52 FSOPEN_CLOEXEC
=> 0x0000_0001,
54 MOUNT_ATTR_RDONLY
=> 0x0000_0001,
55 MOUNT_ATTR_NOSUID
=> 0x0000_0002,
56 MOUNT_ATTR_NODEV
=> 0x0000_0004,
57 MOUNT_ATTR_NOEXEC
=> 0x0000_0008,
58 MOUNT_ATTR_RELATIME
=> 0x0000_0000,
59 MOUNT_ATTR_NOATIME
=> 0x0000_0010,
60 MOUNT_ATTR_STRICTATIME
=> 0x0000_0020,
61 MOUNT_ATTR_NODIRATIME
=> 0x0000_0080,
63 FSPICK_CLOEXEC
=> 0x0000_0001,
64 FSPICK_SYMLINK_NOFOLLOW
=> 0x0000_0002,
65 FSPICK_NO_AUTOMOUNT
=> 0x0000_0004,
66 FSPICK_EMPTY_PATH
=> 0x0000_0008,
68 FSCONFIG_SET_FLAG
=> 0,
69 FSCONFIG_SET_STRING
=> 1,
70 FSCONFIG_SET_BINARY
=> 2,
71 FSCONFIG_SET_PATH
=> 3,
72 FSCONFIG_SET_PATH_EMPTY
=> 4,
74 FSCONFIG_CMD_CREATE
=> 6,
75 FSCONFIG_CMD_RECONFIGURE
=> 7,
79 use constant \
%syscalls;
80 use constant \
%fsmount_constants;
84 our @EXPORT_OK = (keys(%syscalls), keys(%fsmount_constants), 'file_handle_result');
85 our %EXPORT_TAGS = (fsmount
=> [keys(%fsmount_constants)]);
87 # Create a file handle from a numeric file descriptor (to make sure it's close()d when it goes out
89 sub file_handle_result
($) {
91 return undef if $fd_num < 0;
93 open(my $fh, '<&=', $fd_num)