]>
git.proxmox.com Git - pve-common.git/blob - src/PVE/Syscall.pm
9 die "syscall.ph can only be required once!\n" if $INC{'syscall.ph'};
10 require("syscall.ph");
12 unshare
=> &SYS_unshare
,
14 syncfs
=> &SYS_syncfs
,
16 openat
=> &SYS_openat
,
18 mkdirat
=> &SYS_mkdirat
,
20 faccessat
=> &SYS_faccessat
,
21 setresuid
=> &SYS_setresuid
,
22 fchownat
=> &SYS_fchownat
,
24 renameat2
=> &SYS_renameat2
,
25 open_tree
=> &SYS_open_tree
,
26 move_mount
=> &SYS_move_mount
,
27 fsopen
=> &SYS_fsopen
,
28 fsconfig
=> &SYS_fsconfig
,
29 fsmount
=> &SYS_fsmount
,
30 fspick
=> &SYS_fspick
,
31 getxattr
=> &SYS_getxattr
,
32 setxattr
=> &SYS_setxattr
,
33 fgetxattr
=> &SYS_fgetxattr
,
34 fsetxattr
=> &SYS_fsetxattr
,
36 # Below aren't yet in perl's syscall.ph but use asm-generic, so the same across (sane) archs
37 # -> none unknown currently, yay
40 %fsmount_constants = (
41 OPEN_TREE_CLONE
=> 0x0000_0001,
42 OPEN_TREE_CLOEXEC
=> 000200_0000, # octal!
44 MOVE_MOUNT_F_SYMLINKS
=> 0x0000_0001,
45 MOVE_MOUNT_F_AUTOMOUNTS
=> 0x0000_0002,
46 MOVE_MOUNT_F_EMPTY_PATH
=> 0x0000_0004,
47 MOVE_MOUNT_F_MASK
=> 0x0000_0007,
49 MOVE_MOUNT_T_SYMLINKS
=> 0x0000_0010,
50 MOVE_MOUNT_T_AUTOMOUNTS
=> 0x0000_0020,
51 MOVE_MOUNT_T_EMPTY_PATH
=> 0x0000_0040,
52 MOVE_MOUNT_T_MASK
=> 0x0000_0070,
54 FSMOUNT_CLOEXEC
=> 0x0000_0001,
56 FSOPEN_CLOEXEC
=> 0x0000_0001,
58 MOUNT_ATTR_RDONLY
=> 0x0000_0001,
59 MOUNT_ATTR_NOSUID
=> 0x0000_0002,
60 MOUNT_ATTR_NODEV
=> 0x0000_0004,
61 MOUNT_ATTR_NOEXEC
=> 0x0000_0008,
62 MOUNT_ATTR_RELATIME
=> 0x0000_0000,
63 MOUNT_ATTR_NOATIME
=> 0x0000_0010,
64 MOUNT_ATTR_STRICTATIME
=> 0x0000_0020,
65 MOUNT_ATTR_NODIRATIME
=> 0x0000_0080,
67 FSPICK_CLOEXEC
=> 0x0000_0001,
68 FSPICK_SYMLINK_NOFOLLOW
=> 0x0000_0002,
69 FSPICK_NO_AUTOMOUNT
=> 0x0000_0004,
70 FSPICK_EMPTY_PATH
=> 0x0000_0008,
72 FSCONFIG_SET_FLAG
=> 0,
73 FSCONFIG_SET_STRING
=> 1,
74 FSCONFIG_SET_BINARY
=> 2,
75 FSCONFIG_SET_PATH
=> 3,
76 FSCONFIG_SET_PATH_EMPTY
=> 4,
78 FSCONFIG_CMD_CREATE
=> 6,
79 FSCONFIG_CMD_RECONFIGURE
=> 7,
83 use constant \
%syscalls;
84 use constant \
%fsmount_constants;
88 our @EXPORT_OK = (keys(%syscalls), keys(%fsmount_constants), 'file_handle_result');
89 our %EXPORT_TAGS = (fsmount
=> [keys(%fsmount_constants)]);
91 # Create a file handle from a numeric file descriptor (to make sure it's close()d when it goes out
93 sub file_handle_result
($) {
95 return undef if $fd_num < 0;
97 open(my $fh, '<&=', $fd_num)