unistd.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /* The <unistd.h> header contains a few miscellaneous manifest constants. */
  2. #ifndef _UNISTD_H
  3. #define _UNISTD_H
  4. /* Values used by access(). POSIX Table 2-6. */
  5. #define F_OK 0 /* test if file exists */
  6. #define X_OK 1 /* test if file is executable */
  7. #define W_OK 2 /* test if file is writable */
  8. #define R_OK 4 /* test if file is readable */
  9. /* Values used for whence in lseek(fd, offset, whence). POSIX Table 2-7. */
  10. #define SEEK_SET 0 /* offset is absolute */
  11. #define SEEK_CUR 1 /* offset is relative to current position */
  12. #define SEEK_END 2 /* offset is relative to end of file */
  13. /* This value is required by POSIX Table 2-8. */
  14. #define _POSIX_VERSION 198808L /* which standard is being conformed to */
  15. /* These three definitions are required by POSIX Sec. 8.2.1.2. */
  16. #define STDIN_FILENO 0 /* file descriptor for stdin */
  17. #define STDOUT_FILENO 1 /* file descriptor for stdout */
  18. #define STDERR_FILENO 2 /* file descriptor for stderr */
  19. /* NULL must be defined in <unistd.h> according to POSIX Sec. 2.8.1. */
  20. #define NULL ((void *)0)
  21. /* The following relate to configurable system variables. POSIX Table 4-2. */
  22. #define _SC_ARG_MAX 1
  23. #define _SC_CHILD_MAX 2
  24. #define _SC_CLOCKS_PER_SEC 3
  25. #define _SC_NGROUPS_MAX 4
  26. #define _SC_OPEN_MAX 5
  27. #define _SC_JOB_CONTROL 6
  28. #define _SC_SAVED_IDS 7
  29. #define _SC_VERSION 8
  30. /* The following relate to configurable pathname variables. POSIX Table 5-2. */
  31. #define _PC_LINK_MAX 1 /* link count */
  32. #define _PC_MAX_CANON 2 /* size of the canonical input queue */
  33. #define _PC_MAX_INPUT 3 /* type-ahead buffer size */
  34. #define _PC_NAME_MAX 4 /* file name size */
  35. #define _PC_PATH_MAX 5 /* pathname size */
  36. #define _PC_PIPE_BUF 6 /* pipe size */
  37. #define _PC_NO_TRUNC 7 /* treatment of long name components */
  38. #define _PC_VDISABLE 8 /* tty disable */
  39. #define _PC_CHOWN_RESTRICTED 9 /* chown restricted or not */
  40. /* POSIX defines several options that may be implemented or not, at the
  41. * implementer's whim. This implementer has made the following choices:
  42. *
  43. * _POSIX_JOB_CONTROL not defined: no job control
  44. * _POSIX_SAVED_IDS not defined: no saved uid/gid
  45. * _POSIX_NO_TRUNC not defined: long path names are truncated
  46. * _POSIX_CHOWN_RESTRICTED defined: you can't give away files
  47. * _POSIX_VDISABLE defined: tty functions can be disabled
  48. */
  49. #define _POSIX_CHOWN_RESTRICTED
  50. #define _POSIX_VDISABLE '\t' /* can't set any control char to tab */
  51. /* Function Prototypes. */
  52. #ifndef _ANSI_H
  53. #include <ansi.h>
  54. #endif
  55. _PROTOTYPE( void _exit, (int _status) );
  56. _PROTOTYPE( int access, (char *_path, int _amode) );
  57. _PROTOTYPE( int chdir, (char *_path) );
  58. _PROTOTYPE( int chown, (char *_path, int _owner, int _group) );
  59. _PROTOTYPE( int close, (int _fd) );
  60. _PROTOTYPE( char *ctermid, (char *_s) );
  61. _PROTOTYPE( char *cuserid, (char *_s) );
  62. _PROTOTYPE( int dup, (int _fd) );
  63. _PROTOTYPE( int dup2, (int _fd, int _fd2) );
  64. _PROTOTYPE( int execl, (char *_path, ...) );
  65. _PROTOTYPE( int execle, (char *_path, ...) );
  66. _PROTOTYPE( int execlp, (char *_file, ...) );
  67. _PROTOTYPE( int execv, (char *_path, char *_argv[]) );
  68. _PROTOTYPE( int execve, (char *_path, char *_argv[], char *_envp[]) );
  69. _PROTOTYPE( int execvp, (char *_file, char *_argv[]) );
  70. _PROTOTYPE( pid_t fork, (void) );
  71. _PROTOTYPE( long fpathconf, (int _fd, int _name) );
  72. _PROTOTYPE( char *getcwd, (char *_buf, int _size) );
  73. _PROTOTYPE( gid_t getegid, (void) );
  74. _PROTOTYPE( uid_t geteuid, (void) );
  75. _PROTOTYPE( gid_t getgid, (void) );
  76. _PROTOTYPE( int getgroups, (int _gidsetsize, gid_t _grouplist[]) );
  77. _PROTOTYPE( char *getlogin, (void) );
  78. _PROTOTYPE( pid_t getpgrp, (void) );
  79. _PROTOTYPE( pid_t getpid, (void) );
  80. _PROTOTYPE( pid_t getppid, (void) );
  81. _PROTOTYPE( uid_t getuid, (void) );
  82. _PROTOTYPE( unsigned int alarm, (unsigned int _seconds) );
  83. _PROTOTYPE( unsigned int sleep, (unsigned int _seconds) );
  84. _PROTOTYPE( int isatty, (int _fd) );
  85. _PROTOTYPE( int link, (const char *_path1, const char *_path2) );
  86. _PROTOTYPE( off_t lseek, (int _fd, off_t _offset, int _whence) );
  87. _PROTOTYPE( long pathconf, (char *_path, int _name) );
  88. _PROTOTYPE( int pause, (void) );
  89. _PROTOTYPE( int pipe, (int _fildes[2]) );
  90. _PROTOTYPE( int read, (int _fd, char *_buf, unsigned int _n) );
  91. _PROTOTYPE( int rmdir, (const char *_path) );
  92. _PROTOTYPE( int setgid, (int _gid) );
  93. _PROTOTYPE( int setpgid, (pid_t _pid, pid_t _pgid) );
  94. _PROTOTYPE( pid_t setsid, (void) );
  95. _PROTOTYPE( int setuid, (int _uid) );
  96. _PROTOTYPE( long sysconf, (int _name) );
  97. _PROTOTYPE( pid_t tcgetpgrp, (int _fd) );
  98. _PROTOTYPE( int tcsetpgrp, (int _fd, pid_t _pgrp_id) );
  99. _PROTOTYPE( char *ttyname, (int _fd) );
  100. _PROTOTYPE( int unlink, (const char *_path) );
  101. _PROTOTYPE( int write, (int _fd, char *_buf, unsigned int _n) );
  102. #ifdef _MINIX
  103. _PROTOTYPE( char *brk, (char *_addr) );
  104. _PROTOTYPE( int mknod, (const char *_name, int _mode, int _addr) );
  105. _PROTOTYPE( int mknod4, (const char *_name, int _mode, int _addr,
  106. unsigned _size) );
  107. _PROTOTYPE( char *mktemp, (char *_template) );
  108. _PROTOTYPE( char *sbrk, (int _incr) );
  109. _PROTOTYPE( int chroot, (const char *_name) );
  110. _PROTOTYPE( int mount, (char *_spec, char *_name, int _flag));
  111. _PROTOTYPE( long ptrace, (int _req, int _pid, long _addr, long _data) );
  112. _PROTOTYPE( int stime, (long *top) );
  113. _PROTOTYPE( int sync, (void) );
  114. _PROTOTYPE( int umount, (const char *_name) );
  115. #endif
  116. #endif /* _UNISTD_H */