unistd.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /* unistd.h <ndf@linux.mit.edu> */
  2. #include <features.h>
  3. #include <sys/types.h>
  4. #ifndef __UNISTD_H
  5. #define __UNISTD_H
  6. #include <errno.h>
  7. #ifdef __mc68000__
  8. #include <asm/unistd.h>
  9. #endif
  10. #define STDIN_FILENO 0
  11. #define STDOUT_FILENO 1
  12. #define STDERR_FILENO 2
  13. /* NULL-terminated array of "NAME=VALUE" environment variables. */
  14. extern char **__environ;
  15. extern char **environ;
  16. extern int close __P ((int));
  17. extern size_t read __P ((int __fd, char * __buf, size_t __nbytes));
  18. extern size_t write __P ((int __fd, __const char * __buf, size_t __n));
  19. extern off_t lseek __P ((int __fd, off_t __n, int __whence));
  20. extern int pipe __P ((int __pipedes[2]));
  21. extern unsigned int alarm __P ((unsigned int __seconds));
  22. extern int sleep __P ((unsigned int __seconds));
  23. extern void usleep __P ((unsigned long __microseconds));
  24. extern int pause __P ((void));
  25. extern char* crypt __P((__const char *__key, __const char *__salt));
  26. extern int isatty __P ((int __fd));
  27. extern int readlink __P ((__const char *__path, char *__buf, size_t __len));
  28. extern int link __P ((__const char *__from, __const char *__to));
  29. extern int symlink __P ((__const char *__from, __const char *__to));
  30. extern int readlink __P ((__const char *__path, char *__buf, size_t __len));
  31. extern int unlink __P ((__const char *__name));
  32. extern char *getcwd __P ((char *__buf, size_t __size));
  33. /* Duplicate FD, returning a new file descriptor on the same file. */
  34. extern int dup __P ((int __fd));
  35. /* Duplicate FD to FD2, closing FD2 and making it open on the same file. */
  36. extern int dup2 __P ((int __fd, int __fd2));
  37. extern int fchdir __P ((int __fd));
  38. extern int chdir __P ((__const char *__path));
  39. extern int chown __P ((__const char *__file,
  40. uid_t __owner, gid_t __group));
  41. extern int fchown __P ((int __fd,
  42. uid_t __owner, gid_t __group));
  43. extern int fsync __P ((int __fd));
  44. extern int sync __P ((void));
  45. extern int rmdir __P ((__const char *__path));
  46. extern int rename __P((__const char* _old, __const char* _new));
  47. extern int access __P ((__const char *__name, int __type));
  48. extern int reboot __P ((int __magic, int __magic_too, int __flag));
  49. extern int mkstemp __P ((char * __template));
  50. extern char * mktemp __P ((char * __template));
  51. extern int _clone __P ((int (*fn)(void *arg), void *child_stack, int flags, void *arg));
  52. /* Make PATH be the root directory (the starting point for absolute paths).
  53. This call is restricted to the super-user. */
  54. extern int chroot __P ((__const char *__path));
  55. /* Execute PATH with all arguments after PATH until
  56. a NULL pointer and environment from `environ'. */
  57. extern int execl __P ((__const char *__path, __const char *__arg, ...));
  58. /* Execute FILE, searching in the `PATH' environment variable if
  59. it contains no slashes, with all arguments after FILE until a
  60. NULL pointer and environment from `environ'. */
  61. extern int execlp __P ((__const char *__file, __const char *__arg, ...));
  62. /* Execute PATH with arguments ARGV and environment from `environ'. */
  63. extern int execv __P ((__const char *__path, char *__const __argv[]));
  64. /* Replace the current process, executing PATH with arguments ARGV and
  65. environment ENVP. ARGV and ENVP are terminated by NULL pointers. */
  66. extern int execve __P ((__const char *__path, char *__const __argv[],
  67. char *__const __envp[]));
  68. /* Execute FILE, searching in the `PATH' environment variable if it contains
  69. no slashes, with arguments ARGV and environment from `environ'. */
  70. extern int execvp __P ((__const char *__file, char *__const __argv[]));
  71. /* Execute PATH with arguments ARGV and environment ENVP. */
  72. extern int execvep __P ((__const char *path, char *__const __argv[],
  73. char *__const __envp[]));
  74. /* Terminate program execution with the low-order 8 bits of STATUS. */
  75. extern void _exit __P ((int __status)) __attribute__ ((__noreturn__));
  76. /* Clone the calling process, creating an exact copy.
  77. * Return -1 for errors, 0 to the new process,
  78. * and the process ID of the new process to the old process. */
  79. extern __pid_t __fork __P ((void));
  80. extern __pid_t fork __P ((void));
  81. /* Clone the calling process, but without copying the whole address space.
  82. * The calling process is suspended until the new process exits or is
  83. * replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
  84. * and the process ID of the new process to the old process. */
  85. extern __pid_t vfork __P ((void));
  86. #ifndef SEEK_SET
  87. #define SEEK_SET 0
  88. #define SEEK_CUR 1
  89. #define SEEK_END 2
  90. #endif
  91. #ifndef R_OK
  92. #define R_OK 4 /* Test for read permission. */
  93. #define W_OK 2 /* Test for write permission. */
  94. #define X_OK 1 /* Test for execute permission. */
  95. #define F_OK 0 /* Test for existence. */
  96. #endif
  97. #endif /* __UNISTD_H */