unistd.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef __GBLIBC_UNISTD_H_
  2. #define __GBLIBC_UNISTD_H_
  3. #include <sys/types.h>
  4. #undef STDOUT_FILENO
  5. #undef STDIN_FILENO
  6. #undef STDERR_FILENO
  7. #define STDIN_FILENO (0)
  8. #define STDOUT_FILENO (1)
  9. #define STDERR_FILENO (2)
  10. #define F_OK 0
  11. #define R_OK 1
  12. #define W_OK 2
  13. #define X_OK 4
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. ssize_t read(int fd, void* buf, size_t count);
  18. ssize_t write(int fd, const void* buf, size_t count);
  19. int dup(int oldfd);
  20. int dup2(int oldfd, int newfd);
  21. int pipe(int pipefd[2]);
  22. int close(int fd);
  23. void __attribute__((noreturn)) _exit(int code);
  24. pid_t fork(void);
  25. int execve(const char* pathname, char* const argv[], char* const envp[]);
  26. unsigned int sleep(unsigned int seconds);
  27. int chdir(const char* path);
  28. char* getcwd(char* buf, size_t bufsize);
  29. pid_t getpid(void);
  30. pid_t getppid(void);
  31. int setpgid(pid_t pid, pid_t pgid);
  32. pid_t setsid(void);
  33. pid_t getsid(pid_t pid);
  34. pid_t tcgetpgrp(int fd);
  35. int tcsetpgrp(int fd, pid_t pgrp);
  36. int brk(void* addr);
  37. void* sbrk(ssize_t increment);
  38. int isatty(int fd);
  39. extern char** environ;
  40. #ifdef __cplusplus
  41. }
  42. #endif
  43. #endif