2019-07-01 22:58:19 -07:00
|
|
|
#pragma once
|
|
|
|
|
2019-12-13 00:37:06 -05:00
|
|
|
#include <dirent.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <poll.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
2019-07-01 22:58:19 -07:00
|
|
|
FILE *xfopen(const char *pathname, const char *mode);
|
|
|
|
FILE *xfdopen(int fd, const char *mode);
|
2019-11-19 02:04:47 -05:00
|
|
|
int xopen(const char *pathname, int flags);
|
|
|
|
int xopen(const char *pathname, int flags, mode_t mode);
|
2019-07-01 22:58:19 -07:00
|
|
|
int xopenat(int dirfd, const char *pathname, int flags);
|
2020-04-11 04:05:34 -07:00
|
|
|
int xopenat(int dirfd, const char *pathname, int flags, mode_t mode);
|
2019-07-01 22:58:19 -07:00
|
|
|
ssize_t xwrite(int fd, const void *buf, size_t count);
|
|
|
|
ssize_t xread(int fd, void *buf, size_t count);
|
|
|
|
ssize_t xxread(int fd, void *buf, size_t count);
|
|
|
|
int xpipe2(int pipefd[2], int flags);
|
|
|
|
int xsetns(int fd, int nstype);
|
|
|
|
int xunshare(int flags);
|
|
|
|
DIR *xopendir(const char *name);
|
|
|
|
DIR *xfdopendir(int fd);
|
|
|
|
struct dirent *xreaddir(DIR *dirp);
|
|
|
|
pid_t xsetsid();
|
|
|
|
int xsocket(int domain, int type, int protocol);
|
|
|
|
int xbind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
|
|
|
|
int xconnect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
|
|
|
|
int xlisten(int sockfd, int backlog);
|
|
|
|
int xaccept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags);
|
2022-02-07 02:46:47 -08:00
|
|
|
void *xmalloc(size_t size);
|
|
|
|
void *xcalloc(size_t nmemb, size_t size);
|
|
|
|
void *xrealloc(void *ptr, size_t size);
|
2019-07-01 22:58:19 -07:00
|
|
|
ssize_t xsendmsg(int sockfd, const struct msghdr *msg, int flags);
|
|
|
|
ssize_t xrecvmsg(int sockfd, struct msghdr *msg, int flags);
|
|
|
|
int xpthread_create(pthread_t *thread, const pthread_attr_t *attr,
|
2020-12-30 22:11:24 -08:00
|
|
|
void *(*start_routine) (void *), void *arg);
|
2021-03-13 22:13:39 +08:00
|
|
|
int xaccess(const char *path, int mode);
|
2019-07-01 22:58:19 -07:00
|
|
|
int xstat(const char *pathname, struct stat *buf);
|
|
|
|
int xlstat(const char *pathname, struct stat *buf);
|
|
|
|
int xfstat(int fd, struct stat *buf);
|
2022-02-07 02:46:47 -08:00
|
|
|
int xfstatat(int dirfd, const char *pathname, struct stat *buf, int flags);
|
2020-04-01 23:37:11 -07:00
|
|
|
int xdup(int fd);
|
2019-07-01 22:58:19 -07:00
|
|
|
int xdup2(int oldfd, int newfd);
|
|
|
|
int xdup3(int oldfd, int newfd, int flags);
|
|
|
|
ssize_t xreadlink(const char *pathname, char *buf, size_t bufsiz);
|
|
|
|
ssize_t xreadlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz);
|
2021-04-04 18:04:09 +08:00
|
|
|
int xfaccessat(int dirfd, const char *pathname);
|
2019-07-01 22:58:19 -07:00
|
|
|
int xsymlink(const char *target, const char *linkpath);
|
|
|
|
int xsymlinkat(const char *target, int newdirfd, const char *linkpath);
|
|
|
|
int xlinkat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath, int flags);
|
|
|
|
int xmount(const char *source, const char *target,
|
2020-12-30 22:11:24 -08:00
|
|
|
const char *filesystemtype, unsigned long mountflags,
|
|
|
|
const void *data);
|
2019-07-01 22:58:19 -07:00
|
|
|
int xumount(const char *target);
|
|
|
|
int xumount2(const char *target, int flags);
|
|
|
|
int xrename(const char *oldpath, const char *newpath);
|
|
|
|
int xmkdir(const char *pathname, mode_t mode);
|
|
|
|
int xmkdirs(const char *pathname, mode_t mode);
|
|
|
|
int xmkdirat(int dirfd, const char *pathname, mode_t mode);
|
|
|
|
void *xmmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
|
|
|
|
ssize_t xsendfile(int out_fd, int in_fd, off_t *offset, size_t count);
|
|
|
|
pid_t xfork();
|
|
|
|
int xpoll(struct pollfd *fds, nfds_t nfds, int timeout);
|
|
|
|
int xinotify_init1(int flags);
|
2020-04-11 04:05:34 -07:00
|
|
|
char *xrealpath(const char *path, char *resolved_path);
|
2020-05-19 04:53:16 -07:00
|
|
|
int xmknod(const char *pathname, mode_t mode, dev_t dev);
|
2021-01-02 21:29:45 -08:00
|
|
|
long xptrace(int request, pid_t pid, void *addr = nullptr, void *data = nullptr);
|
2021-01-06 21:56:29 -08:00
|
|
|
static inline long xptrace(int request, pid_t pid, void *addr, uintptr_t data) {
|
|
|
|
return xptrace(request, pid, addr, reinterpret_cast<void *>(data));
|
|
|
|
}
|
2021-01-06 22:21:17 -08:00
|
|
|
#define WEVENT(s) (((s) & 0xffff0000) >> 16)
|