unistd.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
  2. /* Substitute for and wrapper around <unistd.h>.
  3. Copyright (C) 2004-2007 Free Software Foundation, Inc.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3, or (at your option)
  7. any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software Foundation,
  14. Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
  15. #ifndef _GL_UNISTD_H
  16. /* The include_next requires a split double-inclusion guard. */
  17. #if 1
  18. # include_next <unistd.h>
  19. #endif
  20. #ifndef _GL_UNISTD_H
  21. #define _GL_UNISTD_H
  22. /* mingw doesn't define the SEEK_* macros in <unistd.h>. */
  23. #if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET)
  24. # include <stdio.h>
  25. #endif
  26. /* mingw fails to declare _exit in <unistd.h>. */
  27. #include <stdlib.h>
  28. /* The definition of GL_LINK_WARNING is copied here. */
  29. /* Declare overridden functions. */
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. #if 0
  34. # if 0
  35. # ifndef REPLACE_CHOWN
  36. # define REPLACE_CHOWN 1
  37. # endif
  38. # if REPLACE_CHOWN
  39. /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
  40. to GID (if GID is not -1). Follow symbolic links.
  41. Return 0 if successful, otherwise -1 and errno set.
  42. See the POSIX:2001 specification
  43. <http://www.opengroup.org/susv3xsh/chown.html>. */
  44. # define chown rpl_chown
  45. extern int chown (const char *file, uid_t uid, gid_t gid);
  46. # endif
  47. # endif
  48. #elif defined GNULIB_POSIXCHECK
  49. # undef chown
  50. # define chown(f,u,g) \
  51. (GL_LINK_WARNING ("chown fails to follow symlinks on some systems and " \
  52. "doesn't treat a uid or gid of -1 on some systems - " \
  53. "use gnulib module chown for portability"), \
  54. chown (f, u, g))
  55. #endif
  56. #if 0
  57. # if !1
  58. /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
  59. NEWFD = OLDFD, otherwise close NEWFD first if it is open.
  60. Return 0 if successful, otherwise -1 and errno set.
  61. See the POSIX:2001 specification
  62. <http://www.opengroup.org/susv3xsh/dup2.html>. */
  63. extern int dup2 (int oldfd, int newfd);
  64. # endif
  65. #elif defined GNULIB_POSIXCHECK
  66. # undef dup2
  67. # define dup2(o,n) \
  68. (GL_LINK_WARNING ("dup2 is unportable - " \
  69. "use gnulib module dup2 for portability"), \
  70. dup2 (o, n))
  71. #endif
  72. #if 0
  73. # if 0
  74. /* Change the process' current working directory to the directory on which
  75. the given file descriptor is open.
  76. Return 0 if successful, otherwise -1 and errno set.
  77. See the POSIX:2001 specification
  78. <http://www.opengroup.org/susv3xsh/fchdir.html>. */
  79. extern int fchdir (int /*fd*/);
  80. # define close rpl_close
  81. extern int close (int);
  82. # define dup rpl_dup
  83. extern int dup (int);
  84. # define dup2 rpl_dup2
  85. extern int dup2 (int, int);
  86. # endif
  87. #elif defined GNULIB_POSIXCHECK
  88. # undef fchdir
  89. # define fchdir(f) \
  90. (GL_LINK_WARNING ("fchdir is unportable - " \
  91. "use gnulib module fchdir for portability"), \
  92. fchdir (f))
  93. #endif
  94. #if 0
  95. # if !1
  96. /* Change the size of the file to which FD is opened to become equal to LENGTH.
  97. Return 0 if successful, otherwise -1 and errno set.
  98. See the POSIX:2001 specification
  99. <http://www.opengroup.org/susv3xsh/ftruncate.html>. */
  100. extern int ftruncate (int fd, off_t length);
  101. # endif
  102. #elif defined GNULIB_POSIXCHECK
  103. # undef ftruncate
  104. # define ftruncate(f,l) \
  105. (GL_LINK_WARNING ("ftruncate is unportable - " \
  106. "use gnulib module ftruncate for portability"), \
  107. ftruncate (f, l))
  108. #endif
  109. #if 0
  110. /* Include the headers that might declare getcwd so that they will not
  111. cause confusion if included after this file. */
  112. # include <stdlib.h>
  113. # if 0
  114. /* Get the name of the current working directory, and put it in SIZE bytes
  115. of BUF.
  116. Return BUF if successful, or NULL if the directory couldn't be determined
  117. or SIZE was too small.
  118. See the POSIX:2001 specification
  119. <http://www.opengroup.org/susv3xsh/getcwd.html>.
  120. Additionally, the gnulib module 'getcwd' guarantees the following GNU
  121. extension: If BUF is NULL, an array is allocated with 'malloc'; the array
  122. is SIZE bytes long, unless SIZE == 0, in which case it is as big as
  123. necessary. */
  124. # define getcwd rpl_getcwd
  125. extern char * getcwd (char *buf, size_t size);
  126. # endif
  127. #elif defined GNULIB_POSIXCHECK
  128. # undef getcwd
  129. # define getcwd(b,s) \
  130. (GL_LINK_WARNING ("getcwd is unportable - " \
  131. "use gnulib module getcwd for portability"), \
  132. getcwd (b, s))
  133. #endif
  134. #if 0
  135. /* Copies the user's login name to NAME.
  136. The array pointed to by NAME has room for SIZE bytes.
  137. Returns 0 if successful. Upon error, an error number is returned, or -1 in
  138. the case that the login name cannot be found but no specific error is
  139. provided (this case is hopefully rare but is left open by the POSIX spec).
  140. See <http://www.opengroup.org/susv3xsh/getlogin.html>.
  141. */
  142. # if !1
  143. # include <stddef.h>
  144. extern int getlogin_r (char *name, size_t size);
  145. # endif
  146. #elif defined GNULIB_POSIXCHECK
  147. # undef getlogin_r
  148. # define getlogin_r(n,s) \
  149. (GL_LINK_WARNING ("getlogin_r is unportable - " \
  150. "use gnulib module getlogin_r for portability"), \
  151. getlogin_r (n, s))
  152. #endif
  153. #if 0
  154. # if 0
  155. # define getpagesize rpl_getpagesize
  156. extern int getpagesize (void);
  157. # elif !1
  158. /* This is for POSIX systems. */
  159. # if !defined getpagesize && defined _SC_PAGESIZE
  160. # if ! (defined __VMS && __VMS_VER < 70000000)
  161. # define getpagesize() sysconf (_SC_PAGESIZE)
  162. # endif
  163. # endif
  164. /* This is for older VMS. */
  165. # if !defined getpagesize && defined __VMS
  166. # ifdef __ALPHA
  167. # define getpagesize() 8192
  168. # else
  169. # define getpagesize() 512
  170. # endif
  171. # endif
  172. /* This is for BeOS. */
  173. # if !defined getpagesize && 0
  174. # include <OS.h>
  175. # if defined B_PAGE_SIZE
  176. # define getpagesize() B_PAGE_SIZE
  177. # endif
  178. # endif
  179. /* This is for AmigaOS4.0. */
  180. # if !defined getpagesize && defined __amigaos4__
  181. # define getpagesize() 2048
  182. # endif
  183. /* This is for older Unix systems. */
  184. # if !defined getpagesize && 0
  185. # include <sys/param.h>
  186. # ifdef EXEC_PAGESIZE
  187. # define getpagesize() EXEC_PAGESIZE
  188. # else
  189. # ifdef NBPG
  190. # ifndef CLSIZE
  191. # define CLSIZE 1
  192. # endif
  193. # define getpagesize() (NBPG * CLSIZE)
  194. # else
  195. # ifdef NBPC
  196. # define getpagesize() NBPC
  197. # endif
  198. # endif
  199. # endif
  200. # endif
  201. # endif
  202. #elif defined GNULIB_POSIXCHECK
  203. # undef getpagesize
  204. # define getpagesize() \
  205. (GL_LINK_WARNING ("getpagesize is unportable - " \
  206. "use gnulib module getpagesize for portability"), \
  207. getpagesize ())
  208. #endif
  209. #if 0
  210. # if 0
  211. /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
  212. to GID (if GID is not -1). Do not follow symbolic links.
  213. Return 0 if successful, otherwise -1 and errno set.
  214. See the POSIX:2001 specification
  215. <http://www.opengroup.org/susv3xsh/lchown.html>. */
  216. # define lchown rpl_lchown
  217. extern int lchown (char const *file, uid_t owner, gid_t group);
  218. # endif
  219. #elif defined GNULIB_POSIXCHECK
  220. # undef lchown
  221. # define lchown(f,u,g) \
  222. (GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \
  223. "systems - use gnulib module lchown for portability"), \
  224. lchown (f, u, g))
  225. #endif
  226. #if 0
  227. # if 0
  228. /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
  229. Return the new offset if successful, otherwise -1 and errno set.
  230. See the POSIX:2001 specification
  231. <http://www.opengroup.org/susv3xsh/lseek.html>. */
  232. # define lseek rpl_lseek
  233. extern off_t lseek (int fd, off_t offset, int whence);
  234. # endif
  235. #elif defined GNULIB_POSIXCHECK
  236. # undef lseek
  237. # define lseek(f,o,w) \
  238. (GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \
  239. "systems - use gnulib module lseek for portability"), \
  240. lseek (f, o, w))
  241. #endif
  242. #if 0
  243. /* Read the contents of the symbolic link FILE and place the first BUFSIZE
  244. bytes of it into BUF. Return the number of bytes placed into BUF if
  245. successful, otherwise -1 and errno set.
  246. See the POSIX:2001 specification
  247. <http://www.opengroup.org/susv3xsh/readlink.html>. */
  248. # if !1
  249. # include <stddef.h>
  250. extern int readlink (const char *file, char *buf, size_t bufsize);
  251. # endif
  252. #elif defined GNULIB_POSIXCHECK
  253. # undef readlink
  254. # define readlink(f,b,s) \
  255. (GL_LINK_WARNING ("readlink is unportable - " \
  256. "use gnulib module readlink for portability"), \
  257. readlink (f, b, s))
  258. #endif
  259. #if 0
  260. /* Pause the execution of the current thread for N seconds.
  261. Returns the number of seconds left to sleep.
  262. See the POSIX:2001 specification
  263. <http://www.opengroup.org/susv3xsh/sleep.html>. */
  264. # if !1
  265. extern unsigned int sleep (unsigned int n);
  266. # endif
  267. #elif defined GNULIB_POSIXCHECK
  268. # undef sleep
  269. # define sleep(n) \
  270. (GL_LINK_WARNING ("sleep is unportable - " \
  271. "use gnulib module sleep for portability"), \
  272. sleep (n))
  273. #endif
  274. #ifdef __cplusplus
  275. }
  276. #endif
  277. #endif /* _GL_UNISTD_H */
  278. #endif /* _GL_UNISTD_H */