unistd.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. extern int close __P ((int));
  14. extern size_t read __P ((int __fd, char * __buf, size_t __nbytes));
  15. extern size_t write __P ((int __fd, __const char * __buf, size_t __n));
  16. extern off_t lseek __P ((int __fd, off_t __n, int __whence));
  17. extern int pipe __P ((int __pipedes[2]));
  18. extern unsigned int alarm __P ((unsigned int __seconds));
  19. extern int sleep __P ((unsigned int __seconds));
  20. extern void usleep __P ((unsigned long __microseconds));
  21. extern int pause __P ((void));
  22. extern char* crypt __P((__const char *__key, __const char *__salt));
  23. extern int isatty __P ((int __fd));
  24. extern int readlink __P ((__const char *__path, char *__buf, size_t __len));
  25. extern int link __P ((__const char *__from, __const char *__to));
  26. extern int symlink __P ((__const char *__from, __const char *__to));
  27. extern int readlink __P ((__const char *__path, char *__buf, size_t __len));
  28. extern int unlink __P ((__const char *__name));
  29. extern char *getcwd __P ((char *__buf, size_t __size));
  30. extern int fchdir __P ((int __fd));
  31. extern int chdir __P ((__const char *__path));
  32. extern int chown __P ((__const char *__file,
  33. uid_t __owner, gid_t __group));
  34. extern int fchown __P ((int __fd,
  35. uid_t __owner, gid_t __group));
  36. extern int fsync __P ((int __fd));
  37. extern int sync __P ((void));
  38. extern int rmdir __P ((__const char *__path));
  39. extern int rename __P((__const char* _old, __const char* _new));
  40. extern int access __P ((__const char *__name, int __type));
  41. extern int reboot __P ((int __magic, int __magic_too, int __flag));
  42. extern int mkstemp __P ((char * __template));
  43. extern char * mktemp __P ((char * __template));
  44. extern int _clone __P ((int (*fn)(void *arg), void *child_stack, int flags, void *arg));
  45. #if 0
  46. #ifndef SYS_fork
  47. #define SYS_fork 2
  48. #endif
  49. #define vfork() ({ \
  50. register long __res __asm__ ("%d0"); \
  51. __asm__ __volatile__ ("trap #0" \
  52. : "=g" (__res) \
  53. : "0" (SYS_fork) \
  54. : "%d0"); \
  55. __res; \
  56. })
  57. #endif
  58. #ifdef __mc68000__
  59. #define vfork() ({ \
  60. register unsigned long __res __asm__ ("%d0") = __NR_fork; \
  61. __asm__ __volatile__ ("trap #0" \
  62. : "=g" (__res) \
  63. : "0" (__res) \
  64. : "%d0"); \
  65. if (__res >= (unsigned long)-4096) { \
  66. errno = -__res; \
  67. __res = (pid_t)-1; \
  68. } \
  69. (pid_t)__res; \
  70. })
  71. #define fork fork_not_available_use_vfork
  72. #define clone clone_not_available_use__clone
  73. #endif
  74. #ifndef SEEK_SET
  75. #define SEEK_SET 0
  76. #define SEEK_CUR 1
  77. #define SEEK_END 2
  78. #endif
  79. #ifndef R_OK
  80. #define R_OK 4 /* Test for read permission. */
  81. #define W_OK 2 /* Test for write permission. */
  82. #define X_OK 1 /* Test for execute permission. */
  83. #define F_OK 0 /* Test for existence. */
  84. #endif
  85. #endif /* __UNISTD_H */