4 * standard symbolic constants and types. Based on the Single UNIX(r)
5 * Specification, Version 2
7 * This file is part of the ReactOS Operating System.
10 * Created by KJK::Hyperion <noog@libero.it>
12 * THIS SOFTWARE IS NOT COPYRIGHTED
14 * This source code is offered for use in the public domain. You may
15 * use, modify or distribute it freely.
17 * This code is distributed in the hope that it will be useful but
18 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
19 * DISCLAMED. This includes but is not limited to warranties of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23 #ifndef __UNISTD_H_INCLUDED__
24 #define __UNISTD_H_INCLUDED__
27 #include <sys/types.h>
33 extern int optind
, opterr
, optopt
;
38 /* FIXME: set these constants appropriately */
39 /* Integer value indicating version of the ISO POSIX-1 standard (C
41 #define _POSIX_VERSION (0)
43 /* Integer value indicating version of the ISO POSIX-2 standard
45 #define _POSIX2_VERSION (0)
47 /* Integer value indicating version of the ISO POSIX-2 standard (C
49 #define _POSIX2_C_VERSION (0)
51 /* Integer value indicating version of the X/Open Portability Guide to
52 which the implementation conforms. */
53 #define _XOPEN_VERSION (500)
55 /* The version of the XCU specification to which the implementation
57 /* TODO: set to an appropriate value when commands and utilities will
59 #define _XOPEN_XCU_VERSION (-1)
61 #if _XOPEN_XCU_VERSION != -1
62 #error TODO: define these constants
63 #define _POSIX2_C_BIND
64 #define _POSIX2_C_VERSION
65 #define _POSIX2_CHAR_TERM
66 #define _POSIX2_LOCALEDEF
68 #define _POSIX2_VERSION
72 /* TODO: check for conformance to the following specs */
80 /* TODO: don't forget these features */
81 /* The use of chown() is restricted to a process with appropriate
82 privileges, and to changing the group ID of a file only to the
83 effective group ID of the process or to one of its supplementary
85 #define _POSIX_CHOWN_RESTRICTED
87 /* Terminal special characters defined in <termios.h> can be disabled
88 using this character value. */
89 #define _POSIX_VDISABLE
91 /* Each process has a saved set-user-ID and a saved set-group-ID. */
92 #define _POSIX_SAVED_IDS
94 /* Implementation supports job control. */
95 #define _POSIX_JOB_CONTROL
99 /* Pathname components longer than {NAME_MAX} generate an error. */
100 #define _POSIX_NO_TRUNC (1)
102 /* The implementation supports the threads option. */
103 #define _POSIX_THREADS (1)
105 /* FIXME: none of the following is strictly true yet */
106 /* The implementation supports the thread stack address attribute
107 option. */ /* FIXME: not currently implemented. Should be trivial */
108 #define _POSIX_THREAD_ATTR_STACKADDR (1)
110 /* The implementation supports the thread stack size attribute
111 option. */ /* FIXME: not currently implemented. Should be trivial */
112 #define _POSIX_THREAD_ATTR_STACKSIZE (1)
114 /* The implementation supports the process-shared synchronisation
115 option. */ /* FIXME? not sure */
116 #define _POSIX_THREAD_PROCESS_SHARED (1)
118 /* The implementation supports the thread-safe functions option. */
119 /* FIXME: fix errno (currently not thread-safe) */
120 #define _POSIX_THREAD_SAFE_FUNCTIONS (1)
123 Constants for Options and Feature Groups
126 /* Implementation supports the C Language Binding option. This will
127 always have a value other than -1. */
128 #define _POSIX2_C_BIND (1)
130 /* Implementation supports the C Language Development Utilities
131 option. */ /* FIXME: please change this when C compiler and
132 utilities are ported */
133 #define _POSIX2_C_DEV (-1)
135 /* Implementation supports at least one terminal type. */ /* FIXME:
136 please change this when terminal emulation is complete */
137 #define _POSIX2_CHAR_TERM (-1)
139 /* Implementation supports the FORTRAN Development Utilities option. */
140 /* FIXME: please change this when Fortran compiler and utilities are
142 #define _POSIX2_FORT_DEV (-1)
144 /* Implementation supports the FORTRAN Run-time Utilities option. */
145 /* FIXME: please change this when Fortran runtimes are ported */
146 #define _POSIX2_FORT_RUN (-1)
148 /* Implementation supports the creation of locales by the localedef
149 utility. */ /* FIXME: please change this when locales are ready */
150 #define _POSIX2_LOCALEDEF (-1)
152 /* Implementation supports the Software Development Utilities option. */
154 #define _POSIX2_SW_DEV (-1)
156 /* The implementation supports the User Portability Utilities option. */
158 #define _POSIX2_UPE (-1)
160 /* The implementation supports the X/Open Encryption Feature Group. */
161 /* FIXME: please change this when encryption is ready */
162 #define _XOPEN_CRYPT (-1)
164 /* The implementation supports the Issue 4, Version 2 Enhanced
165 Internationalisation Feature Group. This is always set to a value
166 other than -1. */ /* TODO: high priority. Support for this feature is
167 needed for a conforming implementation */
168 #define _XOPEN_ENH_I18N (-1)
170 /* The implementation supports the Legacy Feature Group. */
171 #define _XOPEN_LEGACY (1)
173 /* The implementation supports the X/Open Realtime Feature Group. */
174 /* FIXME? unlikely to be ever supported */
175 #define _XOPEN_REALTIME (-1)
177 /* The implementation supports the X/Open Realtime Threads Feature
178 Group. */ /* FIXME? really unlikely to be ever supported */
179 #define _XOPEN_REALTIME_THREADS (-1)
181 /* The implementation supports the Issue 4, Version 2 Shared Memory
182 Feature Group. This is always set to a value other than -1. */ /* TODO:
183 high priority. Support for this feature is needed for a conforming
185 #define _XOPEN_SHM (-1)
187 /* Implementation provides a C-language compilation environment with
188 32-bit int, long, pointer and off_t types. */
189 #define _XBS5_ILP32_OFF32 (1)
191 /* Implementation provides a C-language compilation environment with
192 32-bit int, long and pointer types and an off_t type using at
193 least 64 bits. */ /* FIXME? check the off_t type */
194 #define _XBS5_ILP32_OFFBIG (1)
196 /* Implementation provides a C-language compilation environment with
197 32-bit int and 64-bit long, pointer and off_t types. */ /* FIXME: on
198 some architectures this may be true */
199 #define _XBS5_LP64_OFF64 (-1)
201 /* Implementation provides a C-language compilation environment with
202 an int type using at least 32 bits and long, pointer and off_t
203 types using at least 64 bits. */ /* FIXME: on some architectures
205 #define _XBS5_LPBIG_OFFBIG (-1)
207 /* Implementation supports the File Synchronisation option. */
208 /* TODO: high priority. Implement this */
211 /* Implementation supports the Memory Mapped Files option. */
212 /* TODO: high priority. Implement this */
213 #define _POSIX_MAPPED_FILES
215 /* Implementation supports the Memory Protection option. */
216 /* TODO: high priority. Implement this */
217 #define _POSIX_MEMORY_PROTECTION
220 /* Implementation supports the Prioritized Input and Output option. */
221 /* FIXME? unlikely to be ever supported */
222 #define _POSIX_PRIORITIZED_IO
225 /* FIXME: these should be implemented */
226 /* Asynchronous input or output operations may be performed for the
228 #define _POSIX_ASYNC_IO (-1)
230 /* Prioritized input or output operations may be performed for the
232 #define _POSIX_PRIO_IO (-1)
234 /* Synchronised input or output operations may be performed for the
236 #define _POSIX_SYNC_IO (-1)
242 /* NULL seems to be defined pretty much everywhere - we prevent
244 #define NULL ((void *)(0))
248 constants for the access() function
251 /* Test for read permission. */
252 #define R_OK (0x00000001)
253 /* Test for write permission. */
254 #define W_OK (0x00000002)
255 /* Test for execute (search) permission. */
256 #define X_OK (0x00000004)
257 /* Test for existence of file. */
261 constants for the confstr() function
264 #define _CS_XBS5_ILP32_OFF32_CFLAGS (2)
265 #define _CS_XBS5_ILP32_OFF32_LDFLAGS (3)
266 #define _CS_XBS5_ILP32_OFF32_LIBS (4)
267 #define _CS_XBS5_ILP32_OFF32_LINTFLAGS (5)
268 #define _CS_XBS5_ILP32_OFFBIG_CFLAGS (6)
269 #define _CS_XBS5_ILP32_OFFBIG_LDFLAGS (7)
270 #define _CS_XBS5_ILP32_OFFBIG_LIBS (8)
271 #define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS (9)
272 #define _CS_XBS5_LP64_OFF64_CFLAGS (10)
273 #define _CS_XBS5_LP64_OFF64_LDFLAGS (11)
274 #define _CS_XBS5_LP64_OFF64_LIBS (12)
275 #define _CS_XBS5_LP64_OFF64_LINTFLAGS (13)
276 #define _CS_XBS5_LPBIG_OFFBIG_CFLAGS (14)
277 #define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS (15)
278 #define _CS_XBS5_LPBIG_OFFBIG_LIBS (16)
279 #define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS (17)
282 constants for the lseek() and fcntl() functions
285 #define SEEK_SET (1) /* Set file offset to offset. */
286 #define SEEK_CUR (2) /* Set file offset to current plus offset. */
287 #define SEEK_END (3) /* Set file offset to EOF plus offset. */
290 constants for sysconf()
292 #define _SC_2_C_BIND (1)
293 #define _SC_2_C_DEV (2)
294 #define _SC_2_C_VERSION (3)
295 #define _SC_2_FORT_DEV (4)
296 #define _SC_2_FORT_RUN (5)
297 #define _SC_2_LOCALEDEF (6)
298 #define _SC_2_SW_DEV (7)
299 #define _SC_2_UPE (8)
300 #define _SC_2_VERSION (9)
301 #define _SC_ARG_MAX (10)
302 #define _SC_AIO_LISTIO_MAX (11)
303 #define _SC_AIO_MAX (12)
304 #define _SC_AIO_PRIO_DELTA_MAX (13)
305 #define _SC_ASYNCHRONOUS_IO (14)
306 #define _SC_ATEXIT_MAX (15)
307 #define _SC_BC_BASE_MAX (16)
308 #define _SC_BC_DIM_MAX (17)
309 #define _SC_BC_SCALE_MAX (18)
310 #define _SC_BC_STRING_MAX (19)
311 #define _SC_CHILD_MAX (20)
312 #define _SC_CLK_TCK (21)
313 #define _SC_COLL_WEIGHTS_MAX (22)
314 #define _SC_DELAYTIMER_MAX (23)
315 #define _SC_EXPR_NEST_MAX (24)
316 #define _SC_FSYNC (25)
317 #define _SC_GETGR_R_SIZE_MAX (26)
318 #define _SC_GETPW_R_SIZE_MAX (27)
319 #define _SC_IOV_MAX (28)
320 #define _SC_JOB_CONTROL (29)
321 #define _SC_LINE_MAX (30)
322 #define _SC_LOGIN_NAME_MAX (31)
323 #define _SC_MAPPED_FILES (32)
324 #define _SC_MEMLOCK (33)
325 #define _SC_MEMLOCK_RANGE (34)
326 #define _SC_MEMORY_PROTECTION (35)
327 #define _SC_MESSAGE_PASSING (36)
328 #define _SC_MQ_OPEN_MAX (37)
329 #define _SC_MQ_PRIO_MAX (38)
330 #define _SC_NGROUPS_MAX (39)
331 #define _SC_OPEN_MAX (40)
332 #define _SC_PAGE_SIZE (41)
333 #define _SC_PASS_MAX (42) /* LEGACY */
334 #define _SC_PRIORITIZED_IO (43)
335 #define _SC_PRIORITY_SCHEDULING (44)
336 #define _SC_RE_DUP_MAX (45)
337 #define _SC_REALTIME_SIGNALS (46)
338 #define _SC_RTSIG_MAX (47)
339 #define _SC_SAVED_IDS (48)
340 #define _SC_SEMAPHORES (49)
341 #define _SC_SEM_NSEMS_MAX (50)
342 #define _SC_SEM_VALUE_MAX (51)
343 #define _SC_SHARED_MEMORY_OBJECTS (52)
344 #define _SC_SIGQUEUE_MAX (53)
345 #define _SC_STREAM_MAX (54)
346 #define _SC_SYNCHRONIZED_IO (55)
347 #define _SC_THREADS (56)
348 #define _SC_THREAD_ATTR_STACKADDR (57)
349 #define _SC_THREAD_ATTR_STACKSIZE (58)
350 #define _SC_THREAD_DESTRUCTOR_ITERATIONS (59)
351 #define _SC_THREAD_KEYS_MAX (60)
352 #define _SC_THREAD_PRIORITY_SCHEDULING (61)
353 #define _SC_THREAD_PRIO_INHERIT (62)
354 #define _SC_THREAD_PRIO_PROTECT (63)
355 #define _SC_THREAD_PROCESS_SHARED (64)
356 #define _SC_THREAD_SAFE_FUNCTIONS (65)
357 #define _SC_THREAD_STACK_MIN (66)
358 #define _SC_THREAD_THREADS_MAX (67)
359 #define _SC_TIMERS (68)
360 #define _SC_TIMER_MAX (69)
361 #define _SC_TTY_NAME_MAX (70)
362 #define _SC_TZNAME_MAX (71)
363 #define _SC_VERSION (72)
364 #define _SC_XOPEN_VERSION (73)
365 #define _SC_XOPEN_CRYPT (74)
366 #define _SC_XOPEN_ENH_I18N (75)
367 #define _SC_XOPEN_SHM (76)
368 #define _SC_XOPEN_UNIX (77)
369 #define _SC_XOPEN_XCU_VERSION (78)
370 #define _SC_XOPEN_LEGACY (79)
371 #define _SC_XOPEN_REALTIME (80)
372 #define _SC_XOPEN_REALTIME_THREADS (81)
373 #define _SC_XBS5_ILP32_OFF32 (82)
374 #define _SC_XBS5_ILP32_OFFBIG (83)
375 #define _SC_XBS5_LP64_OFF64 (84)
376 #define _SC_XBS5_LPBIG_OFFBIG (85)
378 #define _SC_PAGESIZE _SC_PAGE_SIZE
380 /* possible values for the function argument to the lockf() function */
381 /* Lock a section for exclusive use. */
383 /* Unlock locked sections. */
385 /* Test section for locks by other processes. */
387 /* Test and lock a section for exclusive use. */
390 /* File number of stdin. It is 0. */
391 #define STDIN_FILENO (0)
392 /* File number of stdout. It is 1. */
393 #define STDOUT_FILENO (1)
394 /* File number of stderr. It is 2. */
395 #define STDERR_FILENO (2)
398 int access(const char *, int);
399 unsigned int alarm(unsigned int);
401 int chdir(const char *);
402 int chroot(const char *); /* (LEGACY) */
403 int chown(const char *, uid_t
, gid_t
);
405 size_t confstr(int, char *, size_t);
406 char *crypt(const char *, const char *);
407 char *ctermid(char *);
408 char *cuserid(char *s
); /* (LEGACY) */
411 void encrypt(char[64], int);
412 int execl(const char *, const char *, ...);
413 int execle(const char *, const char *, ...);
414 int execlp(const char *, const char *, ...);
415 int execv(const char *, char *const []);
416 int execve(const char *, char *const [], char *const []);
417 int execvp(const char *, char *const []);
419 int fchown(int, uid_t
, gid_t
);
423 long int fpathconf(int, int);
425 int ftruncate(int, off_t
);
426 char *getcwd(char *, size_t);
427 int getdtablesize(void); /* (LEGACY) */
431 int getgroups(int, gid_t
[]);
432 long gethostid(void);
433 char *getlogin(void);
434 int getlogin_r(char *, size_t);
435 int getopt(int, char * const [], const char *);
436 int getpagesize(void); /* (LEGACY) */
437 char *getpass(const char *); /* (LEGACY) */
438 pid_t
getpgid(pid_t
);
446 int lchown(const char *, uid_t
, gid_t
);
447 int link(const char *, const char *);
448 int lockf(int, int, off_t
);
449 off_t
lseek(int, off_t
, int);
451 long int pathconf(const char *, int);
454 ssize_t
pread(int, void *, size_t, off_t
);
455 int pthread_atfork(void (*)(void), void (*)(void),
457 ssize_t
pwrite(int, const void *, size_t, off_t
);
458 ssize_t
read(int, void *, size_t);
459 int readlink(const char *, char *, size_t);
460 int rmdir(const char *);
461 void *sbrk(intptr_t);
463 int setpgid(pid_t
, pid_t
);
465 int setregid(gid_t
, gid_t
);
466 int setreuid(uid_t
, uid_t
);
469 unsigned int sleep(unsigned int);
470 void swab(const void *, void *, ssize_t
);
471 int symlink(const char *, const char *);
473 long int sysconf(int);
474 pid_t
tcgetpgrp(int);
475 int tcsetpgrp(int, pid_t
);
476 int truncate(const char *, off_t
);
478 int ttyname_r(int, char *, size_t);
479 useconds_t
ualarm(useconds_t
, useconds_t
);
480 int unlink(const char *);
481 int usleep(useconds_t
);
483 ssize_t
write(int, const void *, size_t);
487 #endif /* __UNISTD_H_INCLUDED__ */