syscalls_rust/syscalls/
arch64.rs

1#![cfg(feature = "arch64")]
2
3use std::ffi::*;
4use crate::types::*;
5
6
7
8
9
10unsafe extern "system" {
11 
12    /// read() attempts to read up to count bytes from file descriptor fd
13    /// into the buffer starting at buf.<br>
14    /// #### RETURN VALUE
15    /// On success, the number of bytes read is returned (zero indicates
16    /// end of file), and the file position is advanced by this number.
17    /// #### ERRORS
18    /// EAGAIN(35), EBADF(9), EFAULT(14), EINTR(4), EINVAL(22), EIO(5), EISDIR(21), etc.
19    /// #### Link
20    /// Read the docs
21    /// [here](https://man7.org/linux/man-pages/man2/read.2.html)
22    pub unsafe fn read(fd: c_uint, buf: *mut c_char, count: size_t) -> ssize_t;
23
24    /// write() writes up to count bytes from the buffer starting at buf
25    /// to the file referred to by the file descriptor fd.<br>
26    /// #### RETURN VALUE
27    /// On success, the number of bytes written is returned.  On error, -1
28    /// is returned, and errno is set to indicate the error.
29    /// #### ERRORS
30    /// EAGAIN(35), EBADF(9), EDESTADDRREQ(39), EDQUOT(69), EFAULT(14), EFBIG(27),<br>
31    /// EINTR(4), EINVAL(22), EIO(5), ENOSPC(28), EPERM(1), EPIPE(32), etc.
32    /// #### Link
33    /// Read the docs
34    /// [here](https://man7.org/linux/man-pages/man2/write.2.html)
35    pub unsafe fn write(fd: c_uint, buf: *const c_char, count: size_t) -> ssize_t;
36
37    /// The open() system call opens the file specified by pathname.  If
38    /// the specified file does not exist, it may optionally (if O_CREAT
39    /// is specified in flags) be created by open().<br>
40    /// #### RETURN VALUE
41    /// On success, the number of bytes read is returned (zero indicates
42    /// end of file), and the file position is advanced by this number.
43    /// #### ERRORS
44    /// EAGAIN(35), EBADF(9), EFAULT(14), EINTR(4), EINVAL(22), EIO(5), EISDIR(21), etc.
45    /// #### Link
46    /// Read the docs
47    /// [here](https://man7.org/linux/man-pages/man2/open.2.html)
48    pub unsafe fn open(filename: *const c_char, flags: c_int, mode: umode_t) -> c_long;
49    
50    /// close() closes a file descriptor, so that it no longer refers to
51    /// any file and may be reused.<br>
52    /// #### RETURN VALUE
53    /// close() returns zero on success.  On error, -1 is returned, and
54    /// errno is set to indicate the error.<br>
55    /// #### ERRORS
56    /// EBADF(9), EINTR(4), EIO(5), ENOSPC(28), etc.
57    /// #### Link
58    /// Read the docs
59    /// [here](https://man7.org/linux/man-pages/man2/close.2.html)
60    pub unsafe fn close(fd: c_uint) -> c_int;
61
62    pub unsafe fn newstat(filename: *const c_char, statbuf: *mut Stat) -> c_int;
63    pub unsafe fn newfstat(fd: c_uint, statbuf: *mut Stat) -> c_int;
64    pub unsafe fn newlstat(filename: *const c_char, statbuf: *mut Stat) -> c_int;
65    pub unsafe fn poll(ufds: *mut Pollfd, nfds: c_uint, timeout_msecs: c_int) -> c_int;
66    pub unsafe fn lseek(fd: c_uint,  offset: off_t, whence: c_uint) -> off_t;
67    pub unsafe fn mmap(addr: c_ulong, len: c_ulong, prot: c_ulong, flags: c_ulong, fd: c_ulong, off: c_ulong) -> c_ulong;
68    pub unsafe fn mprotect(start: c_ulong, len: size_t, prot: c_ulong) -> c_int;
69    pub unsafe fn munmap(addr: c_ulong, len: size_t) -> c_int;
70
71    /// brk() and sbrk() change the location of the program break, which
72    /// defines the end of the process's data segment.<br>
73    /// #### RETURN VALUE
74    /// On success, brk() returns zero. On error, -1 is returned, and
75    /// errno is set to ENOMEM.
76    /// #### ERRORS
77    /// ENOMEM(12), etc.
78    /// #### Link
79    /// Read the docs
80    /// [here](https://man7.org/linux/man-pages/man2/brk.2.html)
81    pub unsafe fn brk(brk: c_ulong) -> c_ulong;
82
83
84    // pub unsafe fn rt_sigaction	(int sig, const struct sigaction *act, struct sigaction *oact, size_t sigsetsize);
85    // pub unsafe fn rt_sigaction(sig: c_int, const struct sigaction *act, struct sigaction *oact, size_t sigsetsize) -> c_int;
86    
87	// pub unsafe fn rt_sigprocmask				(int how, sigset_t *nset, sigset_t *oset, size_t sigsetsize);
88    // pub unsafe fn rt_sigreturn				(void);
89    // pub unsafe fn ioctl			(unsigned int fd, unsigned int cmd, unsigned long arg);
90    // pub unsafe fn pread64				(unsigned int fd, char *buf, size_t count, loff_t pos);
91    // pub unsafe fn pwrite64			(unsigned int fd, const char *buf, size_t count, loff_t pos);
92    // pub unsafe fn readv				(unsigned long fd, const struct iovec *vec, unsigned long vlen);
93    // pub unsafe fn writev				(unsigned long fd, const struct iovec *vec, unsigned long vlen);
94    // pub unsafe fn access				(const char *filename, int mode);
95    // pub unsafe fn pipe			(int *fildes);
96    // pub unsafe fn select			(int n, fd_set *inp, fd_set *outp, fd_set *exp, struct __kernel_old_timeval *tvp);
97    // pub unsafe fn sched_yield				(void);
98    // pub unsafe fn mremap				(unsigned long addr, unsigned long old_len, unsigned long new_len, unsigned long flags, unsigned long new_addr);
99    // pub unsafe fn msync			(MMU	unsigned long start, size_t len, int flags);
100    // pub unsafe fn mincore			(MMU	unsigned long start, size_t len, unsigned char *vec);
101    // pub unsafe fn madvise			(ADVISE_SYSCALLS	unsigned long start, size_t len_in, int behavior);
102    // pub unsafe fn shmget			(SYSVIPC	key_t key, size_t size, int shmflg);
103    // pub unsafe fn shmat			(SYSVIPC	int shmid, char *shmaddr, int shmflg
104    // pub unsafe fn shmct			(SYSVIPC	int shmid, int cmd, struct shmid_ds *buf);
105    // pub unsafe fn dup				(unsigned int fildes);
106    // pub unsafe fn dup2			(unsigned int oldfd, unsigned int newfd);
107    // pub unsafe fn pause				(void);
108    // pub unsafe fn nanosleep				(struct __kernel_timespec *rqtp, struct __kernel_timespec *rmtp);
109    // pub unsafe fn getitimer				(int which, struct __kernel_old_itimerval *value);
110    // pub unsafe fn alarm				(unsigned int seconds
111    // pub unsafe fn setitimer				(int which, struct __kernel_old_itimerval *value, struct __kernel_old_itimerval *ovalue);
112    
113    /// getpid() returns the process ID (PID) of the calling process.
114    /// (This is often used by routines that generate unique temporary
115    /// filenames.)<br>
116    /// #### RETURN VALUE
117    /// getpid() returns the process ID (PID) of the calling process
118    /// #### ERRORS
119    /// These functions are always successful.
120    /// #### Link
121    /// Read the docs
122    /// [here](https://man7.org/linux/man-pages/man2/getpid.2.html)
123    pub unsafe fn getpid() -> pid_t;
124
125    // pub unsafe fn sendfile64				(int out_fd, int in_fd, loff_t *offset, size_t count);
126    pub unsafe fn socket(family: c_int, _type: c_int, protocol: c_int) -> c_int;
127    pub unsafe fn connect(fd: c_int,uservaddr: *mut sockaddr, addrlen: c_int) -> c_int;
128    pub unsafe fn accept(fd: c_int, upeer_sockaddr: *mut sockaddr, upeer_addrlen: *mut c_int) -> c_int;
129    // pub unsafe fn sendto		(NET	int fd, void *buff, size_t len, unsigned int flags, struct sockaddr *addr, int addr_len);
130    // pub unsafe fn recvfrom		(NET	int fd, void *ubuf, size_t size, unsigned int flags, struct sockaddr *addr, int *addr_len);
131    // pub unsafe fn sendmsg		(NET	int fd, struct user_msghdr *msg, unsigned int flags);
132    // pub unsafe fn recvmsg		(NET	int fd, struct user_msghdr *msg, unsigned int flags);
133    // pub unsafe fn shutdown		(NET	int fd, int how);
134    pub unsafe fn bind(fd: c_int, umyaddr: *mut sockaddr, addrlen: c_int) -> c_int;
135    pub unsafe fn listen(fd: c_int, backlog: c_int) -> c_int;
136    // pub unsafe fn getsockname		(NET	int fd, struct sockaddr *usockaddr, int *usockaddr_len);
137    // pub unsafe fn getpeername		(NET	int fd, struct sockaddr *usockaddr, int *usockaddr_len);
138    // pub unsafe fn socketpair		(NET	int family, int type, int protocol, int *usockvec);
139    // pub unsafe fn setsockopt		(NET	int fd, int level, int optname, char *optval, int optlen);
140    // pub unsafe fn getsockopt		(NET	int fd, int level, int optname, char *optval, int *optlen);
141    // pub unsafe fn clone			(unsigned long clone_flags, unsigned long newsp, int *parent_tidptr, int *child_tidptr, unsigned long tls);
142    
143    /// fork() creates a new process by duplicating the calling process.
144    /// The new process is referred to as the child process.  The calling
145    /// process is referred to as the parent process.
146    /// #### RETURN VALUE
147    /// On success, the PID of the child process is returned in the
148    /// parent, and 0 is returned in the child.  On failure, -1 is
149    /// returned in the parent, no child process is created, and errno is
150    /// set to indicate the error.
151    /// #### ERRORS
152    /// EAGAIN(35), ENOMEM(12), ENOSYS(78), ERESTARTNOINTR(513), etc.
153    /// #### Link
154    /// Read the docs
155    /// [here](https://man7.org/linux/man-pages/man2/fork.2.html)
156    pub unsafe fn fork() -> pid_t;
157
158    /// vfork - create a child process and block parent
159    /// #### Link
160    /// Read the docs
161    /// [here](https://man7.org/linux/man-pages/man2/vfork.2.html)
162    pub unsafe fn vfork() -> pid_t;
163
164    pub unsafe fn execve(filename: *const c_char, argv: *const *const c_char, envp: *const *const c_char) -> c_int;
165    
166    /// exit() terminates the calling process "immediately".
167    /// #### RETURN VALUE
168    /// These functions do not return.
169    /// #### Link
170    /// Read the docs
171    /// [here](https://man7.org/linux/man-pages/man3/exit.3.html)
172    pub unsafe fn exit(error_code: c_int);
173
174    // pub unsafe fn wait4			(pid_t upid, int *stat_addr, int options, struct rusage *ru);
175    
176    /// The kill() system call can be used to send any signal to any
177    /// process group or process.
178    /// #### RETURN VALUE
179    /// On success (at least one signal was sent), zero is returned.  On
180    /// error, -1 is returned, and errno is set to indicate the error.
181    /// #### ERRORS
182    /// EINVAL(22), EPERM(1), ESRCH(3).
183    /// #### Link
184    /// Read the docs
185    /// [here](https://man7.org/linux/man-pages/man2/kill.2.html)
186    pub unsafe fn kill(pid: pid_t, sig: c_int) -> c_int;
187
188
189    // pub unsafe fn newuname		(	struct new_utsname *name);
190    // pub unsafe fn semget		(SYSVIPC	key_t key, int nsems, int semflg);
191    // pub unsafe fn semop		(SYSVIPC	int semid, struct sembuf *tsops, unsigned nsops);
192    // pub unsafe fn semctl		(SYSVIPC	int semid, int semnum, int cmd, unsigned long arg);
193    // pub unsafe fn shmdt	(SYSVIPC	char *shmaddr);
194    // pub unsafe fn msgget		(SYSVIPC	key_t key, int msgflg);
195    // pub unsafe fn msgsnd		(SYSVIPC	int msqid, struct msgbuf *msgp, size_t msgsz, int msgflg);
196    // pub unsafe fn msgrcv		(SYSVIPC	int msqid, struct msgbuf *msgp, size_t msgsz, long msgtyp, int msgflg);
197    // pub unsafe fn msgctl		(SYSVIPC	int msqid, int cmd, struct msqid_ds *buf);
198    
199    /// fcntl() performs one of the operations described below on the open
200    ///    file descriptor fd.  The operation is determined by op.
201    /// #### RETURN VALUE
202    /// For a successful call, the return value depends on the operation.
203    /// On error, -1 is returned, and errno is set to indicate the error.
204    /// #### ERRORS
205    /// EACCES(13), EAGAIN(11), EBADF(9), EINVAL(22).
206    /// #### Link
207    /// Read the docs
208    /// [here](https://man7.org/linux/man-pages/man2/fcntl.2.html)
209    pub unsafe fn fcntl(fd: c_uint, cmd: c_uint, arg: c_uint) -> c_long;
210
211    pub unsafe fn flock(fd: c_uint, cmd: c_uint) -> c_int;
212
213    /// fsync() transfers ("flushes") all modified in-core data of (i.e.,
214    /// modified buffer cache pages for) the file referred to by the file
215    /// descriptor fd to the disk device (or other permanent storage
216    /// device) so that all changed information can be retrieved even if
217    /// the system crashes or is rebooted.  This includes writing through
218    /// or flushing a disk cache if present.  The call blocks until the
219    /// device reports that the transfer has completed.
220    /// #### RETURN VALUE
221    /// On success, these system calls return zero.  On error, -1 is
222    /// returned, and errno is set to indicate the error.
223    /// #### Link
224    /// Read the docs
225    /// [here](https://man7.org/linux/man-pages/man2/fsync.2.html)
226    pub unsafe fn fsync(fd: c_uint) -> c_int;
227
228    /// fdatasync() is similar to fsync(), but does not flush modified
229    /// metadata unless that metadata is needed in order to allow a
230    /// subsequent data retrieval to be correctly handled.  For example,
231    /// changes to st_atime or st_mtime (respectively, time of last access
232    /// and time of last modification; see inode(7)) do not require
233    /// flushing because they are not necessary for a subsequent data read
234    /// to be handled correctly.  On the other hand, a change to the file
235    /// size (st_size, as made by say ftruncate(2)), would require a
236    /// metadata flush.
237    /// #### RETURN VALUE
238    /// On success, these system calls return zero.  On error, -1 is
239    /// returned, and errno is set to indicate the error.
240    /// #### Link
241    /// Read the docs
242    /// [here](https://man7.org/linux/man-pages/man2/fsync.2.html)
243    pub unsafe fn fdatasync(fd: c_uint) -> c_int;
244
245    pub unsafe fn truncate(path: *const c_char, length: c_long) -> c_long;
246    pub unsafe fn ftruncate(fd: c_uint, length: off_t) -> c_long;
247
248    // pub unsafe fn getdents(unsigned int fd, struct linux_dirent *dirent, unsigned int count);
249    
250    /// The getcwd() function copies an absolute pathname of the current
251    /// working directory to the array pointed to by buf, which is of
252    /// length size.
253    /// #### RETURN VALUE
254    /// On success, these functions return a pointer to a string
255    /// containing the pathname of the current working directory.  In the
256    /// case of getcwd() and getwd() this is the same value as buf.
257    ///
258    /// On failure, these functions return NULL, and errno is set to
259    /// indicate the error.  The contents of the array pointed to by buf
260    /// are undefined on error.
261    /// #### Link
262    /// Read the docs
263    /// [here](https://man7.org/linux/man-pages/man3/getcwd.3.html)
264    pub unsafe fn getcwd(buf: *mut c_char, size: c_ulong) -> c_int;
265
266    /// chdir() changes the current working directory of the calling
267    /// process to the directory specified in path.
268    /// #### RETURN VALUE
269    /// On success, zero is returned.  On error, -1 is returned, and errno
270    /// is set to indicate the error.
271    /// #### Link
272    /// Read the docs
273    /// [here](https://man7.org/linux/man-pages/man2/chdir.2.html)
274    pub unsafe fn chdir(filename: *const c_char) -> c_int;
275
276
277    /// fchdir() is identical to chdir(); the only difference is that the
278    /// directory is given as an open file descriptor.
279    /// #### RETURN VALUE
280    /// On success, zero is returned.  On error, -1 is returned, and errno
281    /// is set to indicate the error.
282    /// #### Link
283    /// Read the docs
284    /// [here](https://man7.org/linux/man-pages/man2/chdir.2.html)
285    pub unsafe fn fchdir(fd: c_uint) -> c_int;
286
287    /// rename() renames a file, moving it between directories if
288    /// required.  Any other hard links to the file (as created using
289    /// link(2)) are unaffected.  Open file descriptors for oldpath are
290    /// also unaffected.
291    /// #### RETURN VALUE
292    /// On success, zero is returned.  On error, -1 is returned, and errno
293    /// is set to indicate the error.
294    /// #### Link
295    /// Read the docs
296    /// [here](https://man7.org/linux/man-pages/man2/renameat.2.html)
297    pub unsafe fn rename(oldname: *const c_char, newname: *const c_char) -> c_uint;
298
299    /// mkdir() attempts to create a directory named path.
300    /// #### RETURN VALUE
301    /// mkdir() return zero on success.  On error, -1 is
302    /// returned and errno is set to indicate the error.
303    /// #### Link
304    /// Read the docs
305    /// [here](https://man7.org/linux/man-pages/man2/mkdir.2.html)
306    pub unsafe fn mkdir(pathname: *const c_char, mode: umode_t) -> c_int;
307
308    pub unsafe fn rmdir(pathname: *const c_char) -> c_int;
309    pub unsafe fn creat(pathname: *const c_char, mode: umode_t) -> c_long;
310    pub unsafe fn link(oldname: *const c_char, newname: *const c_char) -> c_int;
311    pub unsafe fn unlink(pathname: *const c_char) -> c_int;
312    pub unsafe fn symlink(oldname: *const c_char, newname: *const c_char) -> c_int;
313    pub unsafe fn readlink(path: *const c_char, buf: *mut c_char, bufsiz: c_int) -> c_int;
314    pub unsafe fn chmod(filename: *const c_char,  mode: umode_t) -> c_int;
315    pub unsafe fn fchmod(fd: c_int, mode: umode_t) -> c_int;
316    pub unsafe fn chown(filename: *const c_char,  user: uid_t,  group: gid_t) -> c_int;
317    // pub unsafe fn fchown			(unsigned int fd, uid_t user, gid_t group);
318    // pub unsafe fn lchown			(const char *filename, uid_t user, gid_t group);
319    pub unsafe fn umask	(mask: c_int) -> c_int;
320    // pub unsafe fn gettimeofday			(struct __kernel_old_timeval *tv, struct timezone *tz);
321    // pub unsafe fn getrlimit		(unsigned int resource, struct rlimit *rlim);
322    // pub unsafe fn getrusage		(int who, struct rusage *ru);
323    // pub unsafe fn sysinfo			(struct sysinfo *info);
324    // pub unsafe fn times		(struct tms *tbuf);
325    // pub unsafe fn ptrace			(long request, long pid, unsigned long addr, unsigned long data);
326    pub unsafe fn getuid() -> uid_t;
327    pub unsafe fn syslog(_type: c_int, buf: *mut c_char, len: c_int) -> c_int;
328    pub unsafe fn getgid() -> uid_t;
329    pub unsafe fn setuid(uid: uid_t) -> c_long;
330    pub unsafe fn setgid(gid: gid_t) -> c_long;
331    pub unsafe fn geteuid() -> uid_t;
332    pub unsafe fn getegid() -> uid_t;
333    pub unsafe fn setpgid(pid: pid_t, pgid: pid_t) -> c_int;
334    pub unsafe fn getppid() -> c_int;
335    pub unsafe fn getpgrp() -> c_int;
336    pub unsafe fn setsid() -> c_int;
337    // pub unsafe fn setreuid		(MULTIUSER	uid_t ruid, uid_t euid);
338    // pub unsafe fn setregid		(MULTIUSER	gid_t rgid, gid_t egid);
339    // pub unsafe fn getgroups		(MULTIUSER	int gidsetsize, gid_t *grouplist);
340    // pub unsafe fn setgroups		(MULTIUSER	int gidsetsize, gid_t *grouplist);
341    // pub unsafe fn setresuid		(MULTIUSER	uid_t ruid, uid_t euid, uid_t suid);
342    // pub unsafe fn getresuid		(MULTIUSER	uid_t *ruidp, uid_t *euidp, uid_t *suidp);
343    // pub unsafe fn setresgid		(MULTIUSER	gid_t rgid, gid_t egid, gid_t sgid);
344    // pub unsafe fn getresgid		(MULTIUSER	gid_t *rgidp, gid_t *egidp, gid_t *sgidp);
345    // pub unsafe fn getpgid			(pid_t pid);
346    // pub unsafe fn setfsuid		(MULTIUSER	uid_t uid);
347    // pub unsafe fn setfsgid		(MULTIUSER	gid_t gid);
348    // pub unsafe fn getsid			(pid_t pid);
349    // pub unsafe fn capget		(MULTIUSER	cap_user_header_t header, cap_user_data_t dataptr);
350    // pub unsafe fn capset	(MULTIUSER	cap_user_header_t header, const cap_user_data_t data);
351    // pub unsafe fn rt_sigpending			(sigset_t *uset, size_t sigsetsize);
352    // pub unsafe fn rt_sigtimedwait			(const sigset_t *uthese, siginfo_t *uinfo, const struct __kernel_timespec *uts, size_t sigsetsize);
353
354    // pub unsafe fn rt_sigsuspend			(sigset_t *unewset, size_t sigsetsize);
355    // pub unsafe fn rt_sigqueueinfo			(pid_t pid, int sig, siginfo_t *uinfo);
356    // pub unsafe fn sigaltstack			(const stack_t *uss, stack_t *uoss);
357    // pub unsafe fn utime		(char *filename, struct utimbuf *times);
358    // pub unsafe fn mknod			(const char *filename, umode_t mode, unsigned dev);
359    // pub unsafe fn personality			(unsigned int personality);
360    // pub unsafe fn ustat		(unsigned dev, struct ustat *ubuf);
361    // pub unsafe fn statfs			(const char *pathname, struct statfs *buf);
362    // pub unsafe fn fstatfs		(unsigned int fd, struct statfs *buf);
363    // pub unsafe fn sysfs		(SYSFS_SYSCALL	int option, unsigned long arg1, unsigned long arg2);
364    // pub unsafe fn getpriority			(int which, int who);
365    // pub unsafe fn setpriority		(int which, int who, int niceval);
366    // pub unsafe fn sched_setparam		(pid_t pid, struct sched_param *param);
367    // pub unsafe fn sched_getparam			(pid_t pid, struct sched_param *param);
368    // pub unsafe fn sched_setscheduler			(pid_t pid, int policy, struct sched_param *param);
369    // pub unsafe fn sched_getscheduler			(pid_t pid);
370    // pub unsafe fn sched_get_priority_max			(int policy);
371    // pub unsafe fn sched_get_priority_min			(int policy);
372    // pub unsafe fn sched_rr_get_interval	(		pid_t pid, struct __kernel_timespec *interval);
373    // pub unsafe fn mlock	(	MMU	unsigned long start, size_t len);
374    // pub unsafe fn munlock	(	MMU	unsigned long start, size_t len);
375    // pub unsafe fn mlockall	(	MMU	int flags);
376    // pub unsafe fn munlockall	(	MMU	void);
377    // pub unsafe fn vhangup	(		void);
378    // pub unsafe fn modify_ldt	(	MODIFY_LDT_SYSCALL	int func, void *ptr, unsigned long bytecount);
379    // pub unsafe fn pivot_root	(	const char *new_root, const char *put_old);
380    // pub unsafe fn prctl	(		int option, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5);
381    // pub unsafe fn arch_prctl	(		int option, unsigned long arg2);
382    // pub unsafe fn adjtimex	(		struct __kernel_timex *txc_p);
383    // pub unsafe fn setrlimit	(		unsigned int resource, struct rlimit *rlim);
384    // pub unsafe fn chroot	(		const char *filename);
385    // pub unsafe fn sync	(		void);
386    // pub unsafe fn acct	(	BSD_PROCESS_ACCT	const char *name);
387    // pub unsafe fn settimeofday	(		struct __kernel_old_timeval *tv, struct timezone *tz);
388    pub unsafe fn mount(dev_name: *mut c_char, dir_name: *mut c_char, _type: *mut c_char, flags: c_ulong, data: *mut c_void) -> c_int;
389    pub unsafe fn umount(name: *mut c_char, flags: c_int) -> c_int;
390    pub unsafe fn swapon(specialfile: *const c_char, swap_flags: c_int) -> c_int;
391    pub unsafe fn swapoff(specialfile: *const c_char);
392    // pub unsafe fn reboot	(		int magic1, int magic2, unsigned int cmd, void *arg);
393    // pub unsafe fn sethostname	(char *name, int len);
394    // pub unsafe fn setdomainname(		char *name, int len);
395    // pub unsafe fn statmount	(		const struct mnt_id_req *req, struct statmount *buf, size_t bufsize, unsigned int flags);
396	// pub unsafe fn listmount	(		const struct mnt_id_req *req, u64 *mnt_ids, size_t nr_mnt_ids, unsigned int flags);
397	// pub unsafe fn lsm_get_self_attr	(	SECURITY	unsigned int attr, struct lsm_ctx *ctx, u32 *size, u32 flags);
398	// pub unsafe fn lsm_set_self_attr	(	SECURITY	unsigned int attr, struct lsm_ctx *ctx, u32 size, u32 flags);
399	// pub unsafe fn lsm_list_modules	(	SECURITY	u64 *ids, u32 *size, u32 flags);
400	// pub unsafe fn mseal	(		unsigned long start, size_t len, unsigned long flags);
401	// pub unsafe fn setxattrat	(		int dfd, const char *pathname, unsigned int at_flags, const char *name, const struct xattr_args *uargs, size_t usize);
402	// pub unsafe fn getxattrat	(		int dfd, const char *pathname, unsigned int at_flags, const char *name, struct xattr_args *uargs, size_t usize);
403	// pub unsafe fn listxattrat	(		int dfd, const char *pathname, unsigned int at_flags, char *list, size_t size);
404	// pub unsafe fn removexattrat	(		int dfd, const char *pathname, unsigned int at_flags, const char *name);
405    // pub unsafe fn iopl	(	X86_IOPL_IOPERM	unsigned int level);
406	// pub unsafe fn ioperm	(	X86_IOPL_IOPERM	unsigned long from, unsigned long num, int turn_on);
407	// pub unsafe fn init_module	(	MODULES	void *umod, unsigned long len, const char *uargs);
408	// pub unsafe fn delete_module	(	MODULE_UNLOAD	const char *name_user, unsigned int flags);
409	// pub unsafe fn quotactl	(	QUOTACTL	unsigned int cmd, const char *special, qid_t id, void *addr);
410	// pub unsafe fn gettid	(		void);
411	// pub unsafe fn readahead	(		int fd, loff_t offset, size_t count);
412	// pub unsafe fn setxattr	(		const char *pathname, const char *name, const void *value, size_t size, int flags);
413	// pub unsafe fn lsetxattr	(		const char *pathname, const char *name, const void *value, size_t size, int flags);
414	// pub unsafe fn fsetxattr	(		int fd, const char *name, const void *value, size_t size, int flags);
415    // pub unsafe fn getxattr	(		const char *pathname, const char *name, void *value, size_t size);
416	// pub unsafe fn lgetxattr	(		const char *pathname, const char *name, void *value, size_t size);
417	// pub unsafe fn fgetxattr	(		int fd, const char *name, void *value, size_t size);
418	// pub unsafe fn listxattr	(	const char *pathname, char *list, size_t size);
419	// pub unsafe fn llistxattr	(		const char *pathname, char *list, size_t size);
420	// pub unsafe fn flistxattr	(		int fd, char *list, size_t size);
421	// pub unsafe fn removexattr	(		const char *pathname, const char *name);
422	// pub unsafe fn lremovexattr	(	const char *pathname, const char *name);
423	// pub unsafe fn fremovexattr	(		int fd, const char *name);
424    // pub unsafe fn tkill	(		pid_t pid, int sig);
425	// pub unsafe fn time	(		__kernel_old_time_t *tloc);
426	// pub unsafe fn futex	(	FUTEX	u32 *uaddr, int op, u32 val, const struct __kernel_timespec *utime, u32 *uaddr2, u32 val3);
427	// pub unsafe fn sched_setaffinity(		pid_t pid, unsigned int len, unsigned long *user_mask_ptr);
428	// pub unsafe fn sched_getaffinity	(		pid_t pid, unsigned int len, unsigned long *user_mask_ptr);
429	// pub unsafe fn io_setup	(	AIO	unsigned nr_events, aio_context_t *ctxp);
430	// pub unsafe fn io_destroy	(	AIO	aio_context_t ctx);
431	// pub unsafe fn io_getevents	(	AIO	aio_context_t ctx_id, long min_nr, long nr, struct io_event *events, struct __kernel_timespec *timeout);
432	// pub unsafe fn io_submit	(	AIO	aio_context_t ctx_id, long nr, struct iocb **iocbpp);
433	// pub unsafe fn io_cancel	(	AIO	aio_context_t ctx_id, struct iocb *iocb, struct io_event *result);
434	// pub unsafe fn epoll_create	(	EPOLL	int size
435	// pub unsafe fn remap_file_pages	(	MMU	unsigned long start, unsigned long size, unsigned long prot, unsigned long pgoff, unsigned long flags);
436	// pub unsafe fn getdents64	(		unsigned int fd, struct linux_dirent64 *dirent, unsigned int count);
437	// pub unsafe fn set_tid_address	(		int *tidptr);
438	// pub unsafe fn restart_syscall	(		void);
439	// pub unsafe fn semtimedop	(	SYSVIPC	int semid, struct sembuf *tsops, unsigned int nsops, const struct __kernel_timespec *timeout);
440	// pub unsafe fn fadvise64	(	ADVISE_SYSCALLS	int fd, loff_t offset, size_t len, int advice);
441    // pub unsafe fn timer_create	(	const clockid_t which_clock, struct sigevent *timer_event_spec, timer_t *created_timer_id);
442	// pub unsafe fn timer_settime	(	timer_t timer_id, int flags, const struct __kernel_itimerspec *new_setting, struct __kernel_itimerspec *old_setting);
443	// pub unsafe fn timer_gettime	(	timer_t timer_id, struct __kernel_itimerspec *setting);
444	// pub unsafe fn timer_getoverrun	(	timer_t timer_id);
445	// pub unsafe fn timer_delete	(	timer_t timer_id);
446
447    // 	pub unsafe fn clock_settime	(		const clockid_t which_clock, const struct __kernel_timespec *tp);
448    // 	pub unsafe fn clock_gettime(		const clockid_t which_clock, struct __kernel_timespec *tp);
449    // 	pub unsafe fn clock_getres	(	const clockid_t which_clock, struct __kernel_timespec *tp);
450    // 	pub unsafe fn clock_nanosleep	(		const clockid_t which_clock, int flags, const struct __kernel_timespec *rqtp, struct __kernel_timespec *rmtp);
451    // pub unsafe fn exit_group	(		int error_code);
452	// pub unsafe fn epoll_wait	(	EPOLL	int epfd, struct epoll_event *events, int maxevents, int timeout);
453	// pub unsafe fn epoll_ctl	(	EPOLL	int epfd, int op, int fd, struct epoll_event *event);
454	// pub unsafe fn tgkill	(		pid_t tgid, pid_t pid, int sig);
455	// pub unsafe fn utimes	(		char *filename, struct __kernel_old_timeval *utimes);
456	// pub unsafe fn mbind	(	NUMA	unsigned long start, unsigned long len, unsigned long mode, const unsigned long *nmask, unsigned long maxnode, unsigned int flags);
457	// pub unsafe fn set_mempolicy	(	NUMA	int mode, const unsigned long *nmask, unsigned long maxnode);
458	// pub unsafe fn get_mempolicy(	NUMA	int *policy, unsigned long *nmask, unsigned long maxnode, unsigned long addr, unsigned long flags);
459	// pub unsafe fn mq_open	(	POSIX_MQUEUE	const char *u_name, int oflag, umode_t mode, struct mq_attr *u_attr);
460	// pub unsafe fn mq_unlink	(	POSIX_MQUEUE	const char *u_name);
461    //  pub unsafe fn mq_timedsend	 (	POSIX_MQUEUE	mqd_t mqdes, const char *u_msg_ptr, size_t msg_len, unsigned int msg_prio, const struct __kernel_timespec *u_abs_timeout);
462    // 	pub unsafe fn mq_timedreceive	 (	POSIX_MQUEUE	mqd_t mqdes, char *u_msg_ptr, size_t msg_len, unsigned int *u_msg_prio, const struct __kernel_timespec *u_abs_timeout);
463    // 	pub unsafe fn mq_notify (	POSIX_MQUEUE	mqd_t mqdes, const struct sigevent *u_notification);
464    // 	pub unsafe fn mq_getsetattr	 (	POSIX_MQUEUE	mqd_t mqdes, const struct mq_attr *u_mqstat, struct mq_attr *u_omqstat);
465    // 	pub unsafe fn kexec_load	 (	KEXEC	unsigned long entry, unsigned long nr_segments, struct kexec_segment *segments, unsigned long flags);
466    // 	pub unsafe fn waitid	 (		int which, pid_t upid, struct siginfo *infop, int options, struct rusage *ru);
467    // 	pub unsafe fn add_key	 (	KEYS	const char *_type, const char *_description, const void *_payload, size_t plen, key_serial_t ringid);
468    // 	pub unsafe fn request_key	 (	KEYS	const char *_type, const char *_description, const char *_callout_info, key_serial_t destringid);
469    // 	pub unsafe fn keyctl	 (	KEYS	int option, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5);
470    // 	pub unsafe fn ioprio_set	 (	BLOCK	int which, int who, int ioprio);
471    // 	pub unsafe fn ioprio_get	 (	BLOCK	int which, int who);
472    // 	pub unsafe fn inotify_init	 (	INOTIFY_USER	void);
473    // 	pub unsafe fn inotify_add_watch	 (	INOTIFY_USER	int fd, const char *pathname, u32 mask);
474    // 	pub unsafe fn inotify_rm_watch	 (	INOTIFY_USER	int fd, __s32 wd);
475    
476	// pub unsafe fn migrate_pages	(	MIGRATION	pid_t pid, unsigned long maxnode, const unsigned long *old_nodes, const unsigned long *new_nodes);
477	// pub unsafe fn openat	(		int dfd, const char *filename, int flags, umode_t mode);
478	// pub unsafe fn mkdirat	(		int dfd, const char *pathname, umode_t mode);
479	// pub unsafe fn mknodat	(		int dfd, const char *filename, umode_t mode, unsigned int dev);
480	// pub unsafe fn fchownat	(		int dfd, const char *filename, uid_t user, gid_t group, int flag);
481	// pub unsafe fn futimesat	(		int dfd, const char *filename, struct __kernel_old_timeval *utimes);
482	// pub unsafe fn newfstatat	(		int dfd, const char *filename, struct stat *statbuf, int flag);
483	// pub unsafe fn unlinkat	(		int dfd, const char *pathname, int flag);
484	// pub unsafe fn renameat	(		int olddfd, const char *oldname, int newdfd, const char *newname);
485	// pub unsafe fn linkat	(		int olddfd, const char *oldname, int newdfd, const char *newname, int flags);
486    // pub unsafe fn symlinkat	(		const char *oldname, int newdfd, const char *newname);
487	// pub unsafe fn readlinkat	(		int dfd, const char *pathname, char *buf, int bufsiz);
488	// pub unsafe fn fchmodat	(		int dfd, const char *filename, umode_t mode);
489	// pub unsafe fn faccessat	(		int dfd, const char *filename, int mode);
490	// pub unsafe fn pselect6	(		int n, fd_set *inp, fd_set *outp, fd_set *exp, struct __kernel_timespec *tsp, void *sig);
491	// pub unsafe fn ppoll	(		struct pollfd *ufds, unsigned int nfds, struct __kernel_timespec *tsp, const sigset_t *sigmask, size_t sigsetsize);
492	// pub unsafe fn unshare	(		unsigned long unshare_flags);
493	// pub unsafe fn set_robust_list	(	FUTEX	struct robust_list_head *head, size_t len);
494	// pub unsafe fn get_robust_list	(	FUTEX	int pid, struct robust_list_head **head_ptr, size_t *len_ptr);
495    // pub unsafe fn splice	(		int fd_in, loff_t *off_in, int fd_out, loff_t *off_out, size_t len, unsigned int flags);
496	// pub unsafe fn tee	(		int fdin, int fdout, size_t len, unsigned int flags);
497	// pub unsafe fn sync_file_range	(		int fd, loff_t offset, loff_t nbytes, unsigned int flags);
498	// pub unsafe fn vmsplice	(		int fd, const struct iovec *uiov, unsigned long nr_segs, unsigned int flags);
499	// pub unsafe fn move_pages	(	MIGRATION	pid_t pid, unsigned long nr_pages, const void **pages, const int *nodes, int *status, int flags);
500	// pub unsafe fn utimensat	(		int dfd, const char *filename, struct __kernel_timespec *utimes, int flags);
501	// pub unsafe fn epoll_pwait	(	EPOLL	int epfd, struct epoll_event *events, int maxevents, int timeout, const sigset_t *sigmask, size_t sigsetsize);
502	// pub unsafe fn signalfd	(	SIGNALFD	int ufd, sigset_t *user_mask, size_t sizemask);
503	// pub unsafe fn timerfd_create	(		int clockid, int flags);
504	// pub unsafe fn eventfd	(		unsigned int count);
505	// pub unsafe fn fallocate	(		int fd, int mode, loff_t offset, loff_t len);
506    // pub unsafe fn timerfd_settime	 (		int ufd, int flags, const struct __kernel_itimerspec *utmr, struct __kernel_itimerspec *otmr);
507	// pub unsafe fn timerfd_gettime	 (		int ufd, struct __kernel_itimerspec *otmr);
508	// pub unsafe fn accept4	 (	NET	int fd, struct sockaddr *upeer_sockaddr, int *upeer_addrlen, int flags);
509	// pub unsafe fn signalfd4 (	SIGNALFD	int ufd, sigset_t *user_mask, size_t sizemask, int flags);
510	// pub unsafe fn eventfd2	 (		unsigned int count, int flags);
511	// pub unsafe fn epoll_create1	 (	EPOLL	int flags);
512	// pub unsafe fn dup3	 (		unsigned int oldfd, unsigned int newfd, int flags);
513	// pub unsafe fn pipe2	 (		int *fildes, int flags);
514	// pub unsafe fn inotify_init1	 (	INOTIFY_USER	int flags);
515    // pub unsafe fn preadv	(		unsigned long fd, const struct iovec *vec, unsigned long vlen, unsigned long pos_l, unsigned long pos_h);
516	// pub unsafe fn pwritev	(		unsigned long fd, const struct iovec *vec, unsigned long vlen, unsigned long pos_l, unsigned long pos_h);
517	// pub unsafe fn rt_tgsigqueueinfo(		pid_t tgid, pid_t pid, int sig, siginfo_t *uinfo);
518	// pub unsafe fn perf_event_open	(	PERF_EVENTS	struct perf_event_attr *attr_uptr, pid_t pid, int cpu, int group_fd, unsigned long flags);
519	// pub unsafe fn recvmmsg	(	NET	int fd, struct mmsghdr *mmsg, unsigned int vlen, unsigned int flags, struct __kernel_timespec *timeout);
520    // pub unsafe fn fanotify_init	(	FANOTIFY	unsigned int flags, unsigned int event_f_flags);
521	// pub unsafe fn fanotify_mark	(	FANOTIFY	int fanotify_fd, unsigned int flags, __u64 mask, int dfd, const char *pathname);
522	// pub unsafe fn prlimit64	(		pid_t pid, unsigned int resource, const struct rlimit64 *new_rlim, struct rlimit64 *old_rlim);
523	// pub unsafe fn name_to_handle_at	(	FHANDLE	int dfd, const char *name, struct file_handle *handle, void *mnt_id, int flag);
524	// pub unsafe fn open_by_handle_at	(	FHANDLE	int mountdirfd, struct file_handle *handle, int flags);
525	// pub unsafe fn clock_adjtime	(		const clockid_t which_clock, struct __kernel_timex *utx);
526	
527    /// syncfs() is like sync(), but synchronizes just the filesystem
528    ///    containing file referred to by the open file descriptor fd.
529    pub unsafe fn syncfs(fd: c_int);
530
531    // pub unsafe fn sendmmsg	(	NET	int fd, struct mmsghdr *mmsg, unsigned int vlen, unsigned int flags);
532	// pub unsafe fn setns	(		int fd, int flags);
533	// pub unsafe fn getcpu	(		unsigned *cpup, unsigned *nodep, struct getcpu_cache *unused);
534	// pub unsafe fn process_vm_readv	(	CROSS_MEMORY_ATTACH	pid_t pid, const struct iovec *lvec, unsigned long liovcnt, const struct iovec *rvec, unsigned long riovcnt, unsigned long flags);
535	// pub unsafe fn process_vm_writev	(	CROSS_MEMORY_ATTACH	pid_t pid, const struct iovec *lvec, unsigned long liovcnt, const struct iovec *rvec, unsigned long riovcnt, unsigned long flags);
536	// pub unsafe fn kcmp	(	KCMP	pid_t pid1, pid_t pid2, int type, unsigned long idx1, unsigned long idx2);
537	// pub unsafe fn finit_module	(	MODULES	int fd, const char *uargs, int flags);
538    // pub unsafe fn sched_setattr (		pid_t pid, struct sched_attr *uattr, unsigned int flags);
539	// pub unsafe fn sched_getattr	 (		pid_t pid, struct sched_attr *uattr, unsigned int usize, unsigned int flags);
540	// pub unsafe fn renameat2 (	int olddfd, const char *oldname, int newdfd, const char *newname, unsigned int flags);
541	// pub unsafe fn seccomp	 (	SECCOMP	unsigned int op, unsigned int flags, void *uargs);
542	// pub unsafe fn getrandom	 (		char *ubuf, size_t len, unsigned int flags);
543	// pub unsafe fn memfd_create	 (	MEMFD_CREATE	const char *uname, unsigned int flags);
544	// pub unsafe fn kexec_file_load	 (	KEXEC_FILE	int kernel_fd, int initrd_fd, unsigned long cmdline_len, const char *cmdline_ptr, unsigned long flags);
545    // pub unsafe fn bpf	(	BPF_SYSCALL	int cmd, union bpf_attr *uattr, unsigned int size);
546	// pub unsafe fn execveat	(		int fd, const char *filename, const char *const *argv, const char *const *envp, int flags);
547	// pub unsafe fn userfaultfd	(	USERFAULTFD	int flags);
548	// pub unsafe fn membarrier	(	MEMBARRIER	int cmd, unsigned int flags, int cpu_id);
549	// pub unsafe fn mlock2	(	MMU	unsigned long start, size_t len, int flags);
550	// pub unsafe fn copy_file_range	(		int fd_in, loff_t *off_in, int fd_out, loff_t *off_out, size_t len, unsigned int flags);
551    // pub unsafe fn preadv2	(		unsigned long fd, const struct iovec *vec, unsigned long vlen, unsigned long pos_l, unsigned long pos_h, rwf_t flags);
552	// pub unsafe fn pwritev2	(		unsigned long fd, const struct iovec *vec, unsigned long vlen, unsigned long pos_l, unsigned long pos_h, rwf_t flags);
553	// pub unsafe fn pkey_mprotect	(	X86_INTEL_MEMORY_PROTECTION_KEYS	unsigned long start, size_t len, unsigned long prot, int pkey);
554	// pub unsafe fn pkey_alloc	(	X86_INTEL_MEMORY_PROTECTION_KEYS	unsigned long flags, unsigned long init_val);
555	// pub unsafe fn pkey_free	(	X86_INTEL_MEMORY_PROTECTION_KEYS	int pkey);
556	// pub unsafe fn statx	(		int dfd, const char *filename, unsigned flags, unsigned int mask, struct statx *buffer);
557	// pub unsafe fn io_pgetevents	(	AIO	aio_context_t ctx_id, long min_nr, long nr, struct io_event *events, struct __kernel_timespec *timeout, const struct __aio_sigset *usig);
558	// pub unsafe fn rseq	(	RSEQ	struct rseq *rseq, u32 rseq_len, int flags, u32 sig);
559	// pub unsafe fn uretprobe	(		void);
560	// pub unsafe fn pidfd_send_signal	(		int pidfd, int sig, siginfo_t *info, unsigned int flags);
561    // pub unsafe fn io_uring_setup	(	IO_URING	u32 entries, struct io_uring_params *params);
562	// pub unsafe fn io_uring_enter	(	IO_URING	unsigned int fd, u32 to_submit, u32 min_complete, u32 flags, const void *argp, size_t argsz);
563	// pub unsafe fn io_uring_register	(	IO_URING	unsigned int fd, unsigned int opcode, void *arg, unsigned int nr_args);
564	// pub unsafe fn open_tree	(		int dfd, const char *filename, unsigned flags);
565	// pub unsafe fn move_mount	(		int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, unsigned int flags);
566	// pub unsafe fn fsopen	(	const char *_fs_name, unsigned int flags);
567	// pub unsafe fn fsconfig(		int fd, unsigned int cmd, const char *_key, const void *_value, int aux);
568	// pub unsafe fn fsmount	(	int fs_fd, unsigned int flags, unsigned int attr_flags);
569	// pub unsafe fn fspick	(		int dfd, const char *path, unsigned int flags);
570	// pub unsafe fn pidfd_open	(		pid_t pid, unsigned int flags);
571	// pub unsafe fn clone3	(		struct clone_args *uargs, size_t size);
572	// pub unsafe fn close_range	(		unsigned int fd, unsigned int max_fd, unsigned int flags);
573	// pub unsafe fn openat2	(		int dfd, const char *filename, struct open_how *how, size_t usize);
574    // pub unsafe fn pidfd_getfd	(		int pidfd, int fd, unsigned int flags);
575	// pub unsafe fn faccessat2	(		int dfd, const char *filename, int mode, int flags);
576	// pub unsafe fn process_madvise	(	ADVISE_SYSCALLS	int pidfd, const struct iovec *vec, size_t vlen, int behavior, unsigned int flags);
577	// pub unsafe fn epoll_pwait2	(	EPOLL	int epfd, struct epoll_event *events, int maxevents, const struct __kernel_timespec *timeout, const sigset_t *sigmask, size_t sigsetsize);
578	// pub unsafe fn mount_setattr	(		int dfd, const char *path, unsigned int flags, struct mount_attr *uattr, size_t usize);
579	// pub unsafe fn quotactl_fd	(	QUOTACTL	unsigned int fd, unsigned int cmd, qid_t id, void *addr);
580	// pub unsafe fn landlock_create_ruleset	(	SECURITY_LANDLOCK	const struct landlock_ruleset_attr *const attr, const size_t size, const __u32 flags);
581	// pub unsafe fn landlock_add_rule	(	SECURITY_LANDLOCK	const int ruleset_fd, const enum landlock_rule_type rule_type, const void *const rule_attr, const __u32 flags);
582	// pub unsafe fn landlock_restrict_self	(	SECURITY_LANDLOCK	const int ruleset_fd, const __u32 flags);
583	// pub unsafe fn memfd_secret	(	SECRETMEM	unsigned int flags);
584	// pub unsafe fn process_mrelease	(	MMU	int pidfd, unsigned int flags);
585	// pub unsafe fn futex_waitv	(	FUTEX	struct futex_waitv *waiters, unsigned int nr_futexes, unsigned int flags, struct __kernel_timespec *timeout, clockid_t clockid);
586	// pub unsafe fn set_mempolicy_home_node	(	NUMA	unsigned long start, unsigned long len, unsigned long home_node, unsigned long flags);
587	// pub unsafe fn cachestat	(	CACHESTAT_SYSCALL	unsigned int fd, struct cachestat_range *cstat_range, struct cachestat *cstat, unsigned int flags);
588	// pub unsafe fn fchmodat2	(		int dfd, const char *filename, umode_t mode, unsigned int flags);
589	// pub unsafe fn map_shadow_stack	(	X86_USER_SHADOW_STACK	unsigned long addr, unsigned long size, unsigned int flags);
590	// pub unsafe fn futex_wake	(	FUTEX	void *uaddr, unsigned long mask, int nr, unsigned int flags);
591	// pub unsafe fn futex_wait	(	FUTEX	void *uaddr, unsigned long val, unsigned long mask, unsigned int flags, struct __kernel_timespec *timeout, clockid_t clockid);
592	// pub unsafe fn futex_requeue	(	FUTEX	struct futex_waitv *waiters, unsigned int flags, int nr_wake, int nr_requeue);
593}
594
595
596
597
598
599
600