]>
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
,
28 # Below aren't yet in perl's syscall.ph but use asm-generic, so the same across (sane) archs
29 # -> none unknown currently, yay
32 %fsmount_constants = (
33 OPEN_TREE_CLONE
=> 0x0000_0001,
34 OPEN_TREE_CLOEXEC
=> 000200_0000, # octal!
36 MOVE_MOUNT_F_SYMLINKS
=> 0x0000_0001,
37 MOVE_MOUNT_F_AUTOMOUNTS
=> 0x0000_0002,
38 MOVE_MOUNT_F_EMPTY_PATH
=> 0x0000_0004,
39 MOVE_MOUNT_F_MASK
=> 0x0000_0007,
41 MOVE_MOUNT_T_SYMLINKS
=> 0x0000_0010,
42 MOVE_MOUNT_T_AUTOMOUNTS
=> 0x0000_0020,
43 MOVE_MOUNT_T_EMPTY_PATH
=> 0x0000_0040,
44 MOVE_MOUNT_T_MASK
=> 0x0000_0070,
46 FSMOUNT_CLOEXEC
=> 0x0000_0001,
48 FSOPEN_CLOEXEC
=> 0x0000_0001,
50 MOUNT_ATTR_RDONLY
=> 0x0000_0001,
51 MOUNT_ATTR_NOSUID
=> 0x0000_0002,
52 MOUNT_ATTR_NODEV
=> 0x0000_0004,
53 MOUNT_ATTR_NOEXEC
=> 0x0000_0008,
54 MOUNT_ATTR_RELATIME
=> 0x0000_0000,
55 MOUNT_ATTR_NOATIME
=> 0x0000_0010,
56 MOUNT_ATTR_STRICTATIME
=> 0x0000_0020,
57 MOUNT_ATTR_NODIRATIME
=> 0x0000_0080,
59 FSPICK_CLOEXEC
=> 0x0000_0001,
60 FSPICK_SYMLINK_NOFOLLOW
=> 0x0000_0002,
61 FSPICK_NO_AUTOMOUNT
=> 0x0000_0004,
62 FSPICK_EMPTY_PATH
=> 0x0000_0008,
64 FSCONFIG_SET_FLAG
=> 0,
65 FSCONFIG_SET_STRING
=> 1,
66 FSCONFIG_SET_BINARY
=> 2,
67 FSCONFIG_SET_PATH
=> 3,
68 FSCONFIG_SET_PATH_EMPTY
=> 4,
70 FSCONFIG_CMD_CREATE
=> 6,
71 FSCONFIG_CMD_RECONFIGURE
=> 7,
75 use constant \
%syscalls;
76 use constant \
%fsmount_constants;
80 our @EXPORT_OK = (keys(%syscalls), keys(%fsmount_constants), 'file_handle_result');
81 our %EXPORT_TAGS = (fsmount
=> [keys(%fsmount_constants)]);
83 # Create a file handle from a numeric file descriptor (to make sure it's close()d when it goes out
85 sub file_handle_result
($) {
87 return undef if $fd_num < 0;
89 open(my $fh, '<&=', $fd_num)