PageRenderTime 41ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/packages/isoinfra/current/include/unistd.h

https://github.com/SQGiggsHuang/ecosgit
C Header | 276 lines | 166 code | 39 blank | 71 comment | 0 complexity | a3900fcc49407e42b9c1a03de3e407ea MD5 | raw file
Possible License(s): GPL-2.0, MIT
  1. #ifndef CYGONCE_ISO_UNISTD_H
  2. #define CYGONCE_ISO_UNISTD_H
  3. /*========================================================================
  4. //
  5. // unistd.h
  6. //
  7. // POSIX UNIX standard definitions
  8. //
  9. //========================================================================
  10. // ####ECOSGPLCOPYRIGHTBEGIN####
  11. // -------------------------------------------
  12. // This file is part of eCos, the Embedded Configurable Operating System.
  13. // Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
  14. //
  15. // eCos is free software; you can redistribute it and/or modify it under
  16. // the terms of the GNU General Public License as published by the Free
  17. // Software Foundation; either version 2 or (at your option) any later
  18. // version.
  19. //
  20. // eCos is distributed in the hope that it will be useful, but WITHOUT
  21. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  22. // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  23. // for more details.
  24. //
  25. // You should have received a copy of the GNU General Public License
  26. // along with eCos; if not, write to the Free Software Foundation, Inc.,
  27. // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  28. //
  29. // As a special exception, if other files instantiate templates or use
  30. // macros or inline functions from this file, or you compile this file
  31. // and link it with other works to produce a work based on this file,
  32. // this file does not by itself cause the resulting work to be covered by
  33. // the GNU General Public License. However the source code for this file
  34. // must still be made available in accordance with section (3) of the GNU
  35. // General Public License v2.
  36. //
  37. // This exception does not invalidate any other reasons why a work based
  38. // on this file might be covered by the GNU General Public License.
  39. // -------------------------------------------
  40. // ####ECOSGPLCOPYRIGHTEND####
  41. //========================================================================
  42. //#####DESCRIPTIONBEGIN####
  43. //
  44. // Author(s): nickg
  45. // Contributors:
  46. // Date: 2000-06-01
  47. // Purpose: This file provides the macros, types and functions
  48. // required by POSIX 1003.1.
  49. // Description: Much of the real contents of this file get set from the
  50. // configuration (set by the implementation)
  51. // Usage: #include <unistd.h>
  52. //
  53. //####DESCRIPTIONEND####
  54. //
  55. //======================================================================
  56. */
  57. /* CONFIGURATION */
  58. #include <pkgconf/isoinfra.h> /* Configuration header */
  59. /* INCLUDES */
  60. #include <sys/types.h>
  61. /* This is the "standard" way to get NULL and size_t from stddef.h,
  62. * which is the canonical location of the definitions.
  63. */
  64. #define __need_NULL
  65. #define __need_size_t
  66. #include <stddef.h>
  67. #ifdef CYGINT_ISO_POSIX_TIMER_OPS
  68. # ifdef CYGBLD_ISO_POSIX_TIMER_OPS_HEADER
  69. # include CYGBLD_ISO_POSIX_TIMER_OPS_HEADER
  70. # else
  71. # ifdef __cplusplus
  72. extern "C" {
  73. # endif
  74. extern unsigned int
  75. alarm( unsigned int /* seconds */ );
  76. extern int
  77. pause( void );
  78. # ifdef __cplusplus
  79. } /* extern "C" */
  80. # endif
  81. # endif
  82. #endif
  83. #ifdef CYGINT_ISO_POSIX_SLEEP
  84. # ifdef CYGBLD_ISO_POSIX_SLEEP_HEADER
  85. # include CYGBLD_ISO_POSIX_SLEEP_HEADER
  86. # else
  87. # ifdef __cplusplus
  88. extern "C" {
  89. # endif
  90. unsigned int
  91. sleep( unsigned int /* seconds */ );
  92. # ifdef __cplusplus
  93. } /* extern "C" */
  94. # endif
  95. # endif
  96. #endif
  97. /* ------------------------------------------------------------------- */
  98. /* FIXME: The below was copied in verbatim by Nick, but needs to be grouped
  99. by functionality and linked with interfaces as with everything else
  100. */
  101. /* CONSTANTS */
  102. /* Configuration constants */
  103. #define _POSIX_VERSION 199506L
  104. /* constants for access() */
  105. #define R_OK 1
  106. #define W_OK 2
  107. #define X_OK 4
  108. #define F_OK 8
  109. /* constants for lseek */
  110. #ifndef SEEK_SET
  111. #define SEEK_SET 0
  112. #define SEEK_CUR 1
  113. #define SEEK_END 2
  114. #endif
  115. #define STDIN_FILENO 0
  116. #define STDOUT_FILENO 1
  117. #define STDERR_FILENO 2
  118. /* Variable names for sysconf() */
  119. #define _SC_AIO_LISTIO_MAX 1
  120. #define _SC_AIO_MAX 2
  121. #define _SC_AIO_PRIO_DELTA_MAX 3
  122. #define _SC_ARG_MAX 4
  123. #define _SC_ASYNCHRONOUS_IO 5
  124. #define _SC_CHILD_MAX 6
  125. #define _SC_CLK_TCK 7
  126. #define _SC_DELAYTIMER_MAX 8
  127. #define _SC_FSYNC 9
  128. #define _SC_GETGR_R_SIZE_MAX 10
  129. #define _SC_GETPW_R_SIZE_MAX 11
  130. #define _SC_JOB_CONTROL 12
  131. #define _SC_LOGIN_NAME_MAX 13
  132. #define _SC_MAPPED_FILES 14
  133. #define _SC_MEMLOCK 15
  134. #define _SC_MEMLOCK_RANGE 16
  135. #define _SC_MEMORY_PROTECTION 17
  136. #define _SC_MESSAGE_PASSING 18
  137. #define _SC_MQ_OPEN_MAX 19
  138. #define _SC_MQ_PRIO_MAX 20
  139. #define _SC_NGROUPS_MAX 21
  140. #define _SC_OPEN_MAX 22
  141. #define _SC_PAGESIZE 23
  142. #define _SC_PRIORITIZED_IO 24
  143. #define _SC_PRIORITY_SCHEDULING 25
  144. #define _SC_REALTIME_SIGNALS 26
  145. #define _SC_RTSIG_MAX 27
  146. #define _SC_SAVED_IDS 28
  147. #define _SC_SEMAPHORES 29
  148. #define _SC_SEM_NSEMS_MAX 30
  149. #define _SC_SEM_VALUE_MAX 31
  150. #define _SC_SHARED_MEMORY_OBJECTS 32
  151. #define _SC_SIGQUEUE_MAX 33
  152. #define _SC_STREAM_MAX 34
  153. #define _SC_SYNCHRONIZED_IO 35
  154. #define _SC_THREADS 36
  155. #define _SC_THREAD_ATTR_STACKADDR 37
  156. #define _SC_THREAD_ATTR_STACKSIZE 38
  157. #define _SC_THREAD_DESTRUCTOR_ITERATIONS 39
  158. #define _SC_THREAD_KEYS_MAX 40
  159. #define _SC_THREAD_PRIO_INHERIT 41
  160. #define _SC_THREAD_PRIO_PROTECT 42
  161. #define _SC_THREAD_PRIORITY_SCHEDULING 43
  162. #define _SC_THREAD_PROCESS_SHARED 44
  163. #define _SC_THREAD_SAFE_FUNCTIONS 45
  164. #define _SC_THREAD_STACK_MIN 46
  165. #define _SC_THREAD_THREADS_MAX 47
  166. #define _SC_TIMERS 48
  167. #define _SC_TIMER_MAX 49
  168. #define _SC_TTY_NAME_MAX 50
  169. #define _SC_TZNAME_MAX 51
  170. #define _SC_VERSION 52
  171. /* Variable names for pathconf() */
  172. #define _PC_ASYNC_IO 1
  173. #define _PC_CHOWN_RESTRICTED 2
  174. #define _PC_LINK_MAX 3
  175. #define _PC_MAX_CANON 4
  176. #define _PC_MAX_INPUT 5
  177. #define _PC_NAME_MAX 6
  178. #define _PC_NO_TRUNC 7
  179. #define _PC_PATH_MAX 8
  180. #define _PC_PIPE_BUF 9
  181. #define _PC_PRIO_IO 10
  182. #define _PC_SYNC_IO 11
  183. #define _PC_VDISABLE 12
  184. /* Standard function prototypes */
  185. #ifdef __cplusplus
  186. extern "C" {
  187. #endif
  188. extern int link(const char *path1, const char *path2);
  189. extern int unlink(const char *path);
  190. extern int rmdir(const char *path);
  191. extern int access(const char *path, int amode);
  192. extern int chown(const char *path, uid_t owner, uid_t group);
  193. extern long pathconf(const char *path, int name);
  194. extern long fpathconf(int fd, int name);
  195. extern int pipe(int fildes[2]);
  196. extern int dup(int fd);
  197. extern int dup2(int fd,int fd2);
  198. extern int close(int fd);
  199. extern ssize_t read(int fd, void *buf, size_t nbyte);
  200. extern ssize_t write(int fd, const void *buf, size_t nbyte);
  201. extern off_t lseek(int fd, off_t offset, int whence);
  202. extern int fsync( int fd );
  203. extern int ftruncate(int fd, off_t length);
  204. extern int chdir(const char *path);
  205. extern char *getcwd(char *buf, size_t size);
  206. extern pid_t getpid(void);
  207. extern pid_t getppid(void);
  208. extern uid_t getuid(void);
  209. extern uid_t geteuid(void);
  210. extern uid_t getgid(void);
  211. extern uid_t getegid(void);
  212. extern int setuid(uid_t uid);
  213. extern int setgid(uid_t uid);
  214. extern int getgroups(int setsize, uid_t *list);
  215. extern char *getlogin(void);
  216. extern char *cuserid(char *s);
  217. extern pid_t getpgrp(void);
  218. extern pid_t setsid(void);
  219. extern int setpgid(pid_t pid, pid_t pgid);
  220. extern char *getenv(const char *name);
  221. extern char *ctermid(char *s);
  222. extern char *ttyname(int fd);
  223. extern int isatty(int fd);
  224. extern long sysconf(int name);
  225. extern int vfork(void);
  226. extern int execl(const char *path, const char *arg, ...);
  227. extern int execv(const char *path,char **argv);
  228. extern int execle(const char *path, const char *arg , ... );
  229. extern int execlp(const char *file, const char * argv, ...);
  230. extern int execvp(const char *file, char **argv);
  231. extern int execve(const char *name, char **argv, char **envv);
  232. extern void _exit(int code);
  233. #ifdef __cplusplus
  234. } /* extern "C" */
  235. #endif
  236. #endif /* CYGONCE_ISO_UNISTD_H multiple inclusion protection */
  237. /* EOF unistd.h */