unistd.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /* -*-comment-start: "//";comment-end:""-*-
  2. * GNU Mes --- Maxwell Equations of Software
  3. * Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
  4. *
  5. * This file is part of GNU Mes.
  6. *
  7. * GNU Mes is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 3 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * GNU Mes is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #ifndef __MES_UNISTD_H
  21. #define __MES_UNISTD_H 1
  22. #if SYSTEM_LIBC
  23. #ifndef _GNU_SOURCE
  24. #define _GNU_SOURCE
  25. #endif
  26. #undef __MES_UNISTD_H
  27. #include_next <unistd.h>
  28. #else // ! SYSTEM_LIBC
  29. #if defined (BOOTSTRAP_WITH_POSIX)
  30. #define _POSIX_VERSION 199009L
  31. #endif
  32. #include <sys/types.h>
  33. #ifndef NULL
  34. #define NULL 0
  35. #endif
  36. #ifndef STDIN_FILENO
  37. #define STDIN_FILENO 0
  38. #define STDOUT_FILENO 1
  39. #define STDERR_FILENO 2
  40. #endif // STDIN_FILENO
  41. #ifndef STDIN_FILE_NO
  42. #define STDIN_FILE_NO 0
  43. #define STDOUT_FILE_NO 1
  44. #define STDERR_FILE_NO 2
  45. #endif // STDIN_FILE_NO
  46. #ifndef R_OK
  47. #define F_OK 0
  48. #define X_OK 1
  49. #define W_OK 2
  50. #define R_OK 4
  51. #endif
  52. int access (char const *s, int mode);
  53. unsigned int alarm (unsigned int seconds);
  54. int close (int fd);
  55. int execv (char const *file_name, char *const argv[]);
  56. int execl (char const *file_name, char const *arg, ...);
  57. int execlp (char const *file_name, char const *arg, ...);
  58. int execve (char const *file, char *const argv[], char *const env[]);
  59. int execvp (char const *file, char *const argv[]);
  60. int fork (void);
  61. int fsync (int filedes);
  62. char *getcwd (char *buf, size_t size);
  63. uid_t getuid (void);
  64. gid_t getgid (void);
  65. int setgid (gid_t newgid);
  66. int setuid (uid_t newuid);
  67. uid_t geteuid (void);
  68. gid_t getegid (void);
  69. pid_t getpgrp (void);
  70. pid_t getpid (void);
  71. pid_t getppid (void);
  72. int getpgid (pid_t pid);
  73. int isatty (int fd);
  74. int link (char const *old_name, char const *new_name);
  75. off_t lseek (int fd, off_t offset, int whence);
  76. ssize_t read (int fd, void *buffer, size_t size);
  77. ssize_t readlink (char const *file_name, char *buffer, size_t size);
  78. #if __SBRK_CHAR_PTRDIFF
  79. /* xmalloc in binutils <= 2.10.1 uses this old prototype */
  80. char *sbrk (ptrdiff_t delta);
  81. #else
  82. void *sbrk (intptr_t delta);
  83. #endif
  84. int symlink (char const *old_name, char const *new_name);
  85. int unlink (char const *file_name);
  86. ssize_t write (int filedes, void const *buffer, size_t size);
  87. #endif // ! SYSTEM_LIBC
  88. #endif // __MES_UNISTD_H