unistd.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. #ifndef __UNISTD_H
  2. #define __UNISTD_H
  3. #ifndef _POSIX_SOURCE
  4. This header file is not defined in pure ANSI
  5. #endif
  6. #pragma lib "/$M/lib/ape/libap.a"
  7. #define _POSIX_VERSION 199309L
  8. #define _POSIX_ASYNC_IO -1
  9. #define _POSIX_CHOWN_RESTRICTED 1
  10. #define _POSIX_NO_TRUNC 1
  11. #define _POSIX_PRIO_IO -1
  12. #define _POSIX_SYNC_IO -1
  13. #define _POSIX_VDISABLE -1
  14. #ifndef _SIZE_T
  15. #define _SIZE_T
  16. typedef unsigned long size_t;
  17. #endif
  18. #ifndef _SSIZE_T
  19. #define _SSIZE_T
  20. typedef long ssize_t;
  21. #endif
  22. #ifndef NULL
  23. #define NULL 0
  24. #endif
  25. /* access */
  26. #define R_OK 4
  27. #define W_OK 2
  28. #define X_OK 1
  29. #define F_OK 0 /* test for existence */
  30. /* lockf */
  31. #define F_ULOCK 0 /* unlock a previously locked region */
  32. #define F_LOCK 1 /* lock a region for exclusive use */
  33. #define F_TLOCK 2 /* test and lock a region for exclusive use */
  34. #define F_TEST 3 /* test a region for a previous lock */
  35. /* lseek */
  36. #ifndef SEEK_SET /* also defined in stdio.h */
  37. #define SEEK_SET 0
  38. #define SEEK_CUR 1
  39. #define SEEK_END 2
  40. #endif
  41. /* sysconf argument */
  42. #define _SC_ARG_MAX 1 /* max chars in args to exec */
  43. #define _SC_CHILD_MAX 2 /* max child process per process */
  44. #define _SC_CLK_TCK 3 /* number of clock() units per second */
  45. #define _SC_NGROUPS_MAX 4 /* max supplementary groups per process */
  46. #define _SC_OPEN_MAX 5
  47. #define _SC_STREAM_MAX 6
  48. #define _SC_TZNAME_MAX 7
  49. #define _SC_JOB_CONTROL 8 /* posix job control */
  50. #define _SC_SAVED_IDS 9 /* saved suid/sgid per process */
  51. #define _SC_VERSION 10 /* this version */
  52. /* pathconf argument */
  53. #define _PC_LINK_MAX 1
  54. #define _PC_MAX_CANON 2
  55. #define _PC_MAX_INPUT 3
  56. #define _PC_NAME_MAX 4
  57. #define _PC_PATH_MAX 5
  58. #define _PC_PIPE_BUF 6
  59. #define _PC_CHOWN_RESTRICTED 7
  60. #define _PC_NO_TRUNC 8
  61. #define _PC_VDISABLE 9
  62. /* standard filenos */
  63. #define STDIN_FILENO 0
  64. #define STDOUT_FILENO 1
  65. #define STDERR_FILENO 2
  66. #ifdef __cplusplus
  67. extern "C" {
  68. #endif
  69. /* process primitives */
  70. extern int execl(const char *, const char *, ...);
  71. extern int execv(const char *, const char **);
  72. extern int execle(const char *, const char *, const char *, ...);
  73. extern int execve(const char *, const char **, const char **);
  74. extern int execlp(const char *, const char *, ...);
  75. extern int execvp(const char *, const char **);
  76. extern void _exit(int);
  77. extern unsigned int alarm(unsigned int);
  78. extern int pause(void);
  79. extern unsigned int sleep(unsigned int);
  80. #ifdef __TYPES_H
  81. extern pid_t fork(void);
  82. #endif
  83. /* process environment */
  84. extern char *getlogin(void);
  85. extern char *cuserid(char *);
  86. extern char *ttyname(int);
  87. extern int isatty(int);
  88. extern long sysconf(int);
  89. #ifdef __TYPES_H
  90. extern pid_t getpid(void);
  91. extern pid_t getppid(void);
  92. extern uid_t getuid(void);
  93. extern uid_t geteuid(void);
  94. extern gid_t getgid(void);
  95. extern gid_t getegid(void);
  96. extern int setuid(uid_t);
  97. extern int setgid(gid_t);
  98. extern int getgroups(int, gid_t *);
  99. extern pid_t getpgrp(void);
  100. extern int setpgid(pid_t, pid_t);
  101. extern pid_t setsid(void);
  102. #endif
  103. /* files and directories */
  104. extern int chdir(const char *);
  105. extern int link(const char *, const char *);
  106. extern char *getcwd(char *, size_t);
  107. extern int unlink(const char *);
  108. extern int rmdir(const char *);
  109. extern int rename(const char *, const char *);
  110. extern int access(const char *, int);
  111. extern long pathconf(const char *, int);
  112. extern long fpathconf(int, int);
  113. #ifdef __TYPES_H
  114. extern int chown(const char *, uid_t, gid_t);
  115. #endif
  116. /* input and output primitives */
  117. extern int pipe(int *);
  118. extern int dup(int);
  119. extern int dup2(int, int);
  120. extern int close(int);
  121. extern ssize_t read(int, void *, size_t);
  122. extern ssize_t write(int, const void *, size_t);
  123. #ifdef __TYPES_H
  124. extern off_t lseek(int, off_t, int);
  125. #endif
  126. /* device- and class-specific functions */
  127. #ifdef __TYPES_H
  128. extern pid_t tcgetpgrp(int);
  129. extern int tcsetpgrp(int, pid_t);
  130. #endif
  131. /* berkeley specific functions */
  132. #ifdef _BSD_EXTENSION
  133. #include <bsd.h>
  134. #endif
  135. #ifdef __cplusplus
  136. }
  137. #endif
  138. #endif