unistd.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. ssize_t read(int fd, void* buf, size_t count);
  14. ssize_t write(int fd, const void* buf, size_t count);
  15. int dup(int oldfd);
  16. int dup2(int oldfd, int newfd);
  17. int pipe(int pipefd[2]);
  18. int close(int fd);
  19. void __attribute__((noreturn)) _exit(int code);
  20. pid_t fork(void);
  21. int execve(const char* pathname, char* const argv[], char* const envp[]);
  22. unsigned int sleep(unsigned int seconds);
  23. int chdir(const char* path);
  24. char* getcwd(char* buf, size_t bufsize);
  25. pid_t getpid(void);
  26. pid_t getppid(void);
  27. int setpgid(pid_t pid, pid_t pgid);
  28. pid_t setsid(void);
  29. pid_t getsid(pid_t pid);
  30. pid_t tcgetpgrp(int fd);
  31. int tcsetpgrp(int fd, pid_t pgrp);
  32. int brk(void* addr);
  33. void* sbrk(ssize_t increment);
  34. int isatty(int fd);
  35. extern char** environ;
  36. #ifdef __cplusplus
  37. }
  38. #endif
  39. #endif