#ifndef UNISTD_H #define UNISTD_H #include #include #include #define STDIN_FILENO 0 #define STDOUT_FILENO 1 #define STDERR_FILENO 2 #define SEEK_SET 0 #define SEEK_CUR 1 #define SEEK_END 2 #define SEEK_DATA 3 #define SEEK_HOLE 4 #define NULL ((void*)0) #define F_OK 0 #define R_OK 4 #define W_OK 2 #define X_OK 1 int pipe(); int pipe2(); int close(int fildes); int dup(int fildes); int dup2(); int dup3(); off_t lseek(); int fsync(); int fdatasync(); ssize_t read(int fildes, void *buf, size_t nbyte); ssize_t write(int fildes, const void *buf, size_t nbyte); ssize_t pread(int fildes, void *buf, size_t nbyte, off_t offset); ssize_t pwrite(int fildes, const void *buf, size_t nbyte, off_t offset); int chown(const char *path, uid_t owner, gid_t group); int fchown(int fildes, uid_t owner, gid_t group); int lchown(const char *path, uid_t owner, gid_t group); int fchownat(int fildes, const char *path, uid_t owner, gid_t group); int link(const char *target, const char *lpath); int linkat(int target_fd, const char *tpath, int link_fd, const char *lpath); int symlink(const char *target, const char *lpath); int symlinkat(const char *target, int fildes, const char *lpath); ssize_t readlink(const char* __restrict path, char* __restrict buf, size_t bufsz); ssize_t readlinkat(int fildes, const char* __restrict path, char* __restrict buf, size_t bufsz); int unlink(const char *lpath); int unlinkat(int fildes, const char *lpath, int flag); int rmdir(const char *path); int truncate(const char *path, off_t length); int ftruncate(int fildes, off_t length); int access(const char *path, int amode); int faccessat(int fildes, const char *path, int amode, int flag); int chdir(const char *path); int fchdir(int fildes); char* getcwd(char *buf, size_t bufsz); unsigned int alarm(unsigned int seconds); unsigned int sleep(unsigned int seconds); unsigned int ualarm(useconds_t usec); unsigned int usleep(useconds_t usec); int pause(void); pid_t fork(void); pid_t vfork(void); void _exit(int status); int execve(const char *pathname, char* const argv[], char* const envp[]); int execv(const char *pathname, char* const argv[]); int execle(const char *pathname, const char *argv, ...); int execl(const char *pathname, const char *argv, ...); int execvp(const char *pathname, char* const argv[]); int execvpe(const char *pathname, char* const argv[], char* const envp[]); int execlp(const char *pathname, char* const argv[], ...); int fexecve(int fildes, char* const argv[], char* const envp[]); pid_t getpid(void); pid_t getppid(void); pid_t getpgrp(void); pid_t getpgid(pid_t); int setpgid(pid_t pid, pid_t pgid); pid_t setsid(void); pid_t getsid(pid_t pid); char* ttyname(int fildes); int ttyname_r(int fildes, char *buf, size_t bufsz); int isatty(int fildes); pid_t tcgetpgrp(int fildes); uid_t getuid(void); uid_t geteuid(void); gid_t getgid(void); gid_t getegid(void); int getgroups(int gidsetsize, gid_t grouplist[]); int setuid(uid_t uid); int seteuid(uid_t euid); int setgid(gid_t gid); int setegid(gid_t egid); char* getlogin(void); int getlogin_r(char *buf, size_t bufsz); char* ctermid(char *buf); long int pathconf(const char *path, int name); long int fpathconf(int fildes, int name); long int sysconf(int name); size_t confstr(int name, char *buf, size_t bufsz); int setreuid(uid_t ruid, uid_t euid); int setregid(gid_t rgid, gid_t egid); int lockf(int fildes, int op, off_t length); int nice(int incr); void sync(void); pid_t setpgrp(void); void swab(const void* __restrict from, void* __restrict to, ssize_t n); int brk(void *addr); void* sbrk(intptr_t incr); int vhangup(void); int chroot(const char *path); int getpagesize(void); int getdtablesize(void); int gethostname(char *buf, size_t bufsz); int sethostname(const char *name, size_t len); int getdomainname(char *buf, size_t bufsz); int setdomainname(const char *name, size_t len); int daemon(int nochdir, int noclose); char* getusershell(void); void setusershell(void); void endusershell(void); int acct(const char *path); int getentropy(void *buffer, size_t bufsz); #endif