2 * D header file for POSIX.
4 * Copyright: Public Domain
5 * License: Public Domain
7 * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
9 module core.sys.posix.unistd;
11 private import core.sys.posix.config;
12 private import core.stdc.stddef;
13 public import core.sys.posix.inttypes; // for intptr_t
14 public import core.sys.posix.sys.types; // for size_t, ssize_t, uid_t, gid_t, off_t, pid_t, useconds_t
18 const STDIN_FILENO = 0;
19 const STDOUT_FILENO = 1;
20 const STDERR_FILENO = 2;
27 int access(in char*, int);
30 int chown(in char*, uid_t, gid_t);
32 size_t confstr(int, char*, size_t);
35 int execl(in char*, in char*, ...);
36 int execle(in char*, in char*, ...);
37 int execlp(in char*, in char*, ...);
38 int execv(in char*, in char**);
39 int execve(in char*, in char**, in char**);
40 int execvp(in char*, in char**);
42 int fchown(int, uid_t, gid_t);
44 c_long fpathconf(int, int);
45 //int ftruncate(int, off_t);
46 char* getcwd(char*, size_t);
50 int getgroups(int, gid_t *);
51 int gethostname(char*, size_t);
53 int getlogin_r(char*, size_t);
54 int getopt(int, in char**, in char*);
60 int link(in char*, in char*);
61 //off_t lseek(int, off_t, int);
62 c_long pathconf(in char*, int);
65 ssize_t read(int, void*, size_t);
66 ssize_t readlink(in char*, char*, size_t);
71 int setpgid(pid_t, pid_t);
75 int symlink(in char*, in char*);
78 int tcsetpgrp(int, pid_t);
80 int ttyname_r(int, char*, size_t);
82 ssize_t write(int, in void*, size_t);
86 static if( __USE_FILE_OFFSET64 )
88 off_t lseek64(int, off_t, int);
93 off_t lseek(int, off_t, int);
95 static if( __USE_LARGEFILE64 )
97 int ftruncate64(int, off_t);
98 alias ftruncate64 ftruncate;
102 int ftruncate(int, off_t);
105 else version( freebsd )
107 off_t lseek(int, off_t, int);
108 int ftruncate(int, off_t);
112 off_t lseek(int, off_t, int);
113 int ftruncate(int, off_t);
132 _CS_V6_WIDTH_RESTRICTED_ENVS,
134 _CS_GNU_LIBC_VERSION,
135 _CS_GNU_LIBPTHREAD_VERSION,
137 _CS_LFS_CFLAGS = 1000,
146 _CS_XBS5_ILP32_OFF32_CFLAGS = 1100,
147 _CS_XBS5_ILP32_OFF32_LDFLAGS,
148 _CS_XBS5_ILP32_OFF32_LIBS,
149 _CS_XBS5_ILP32_OFF32_LINTFLAGS,
150 _CS_XBS5_ILP32_OFFBIG_CFLAGS,
151 _CS_XBS5_ILP32_OFFBIG_LDFLAGS,
152 _CS_XBS5_ILP32_OFFBIG_LIBS,
153 _CS_XBS5_ILP32_OFFBIG_LINTFLAGS,
154 _CS_XBS5_LP64_OFF64_CFLAGS,
155 _CS_XBS5_LP64_OFF64_LDFLAGS,
156 _CS_XBS5_LP64_OFF64_LIBS,
157 _CS_XBS5_LP64_OFF64_LINTFLAGS,
158 _CS_XBS5_LPBIG_OFFBIG_CFLAGS,
159 _CS_XBS5_LPBIG_OFFBIG_LDFLAGS,
160 _CS_XBS5_LPBIG_OFFBIG_LIBS,
161 _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS,
163 _CS_POSIX_V6_ILP32_OFF32_CFLAGS,
164 _CS_POSIX_V6_ILP32_OFF32_LDFLAGS,
165 _CS_POSIX_V6_ILP32_OFF32_LIBS,
166 _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS,
167 _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS,
168 _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS,
169 _CS_POSIX_V6_ILP32_OFFBIG_LIBS,
170 _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS,
171 _CS_POSIX_V6_LP64_OFF64_CFLAGS,
172 _CS_POSIX_V6_LP64_OFF64_LDFLAGS,
173 _CS_POSIX_V6_LP64_OFF64_LIBS,
174 _CS_POSIX_V6_LP64_OFF64_LINTFLAGS,
175 _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS,
176 _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS,
177 _CS_POSIX_V6_LPBIG_OFFBIG_LIBS,
178 _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
189 _PC_CHOWN_RESTRICTED,
197 _PC_REC_INCR_XFER_SIZE,
198 _PC_REC_MAX_XFER_SIZE,
199 _PC_REC_MIN_XFER_SIZE,
217 _SC_REALTIME_SIGNALS,
218 _SC_PRIORITY_SCHEDULING,
227 _SC_MEMORY_PROTECTION,
230 _SC_SHARED_MEMORY_OBJECTS,
233 _SC_AIO_PRIO_DELTA_MAX,
239 _SC_PAGE_SIZE = _SC_PAGESIZE,
250 _SC_COLL_WEIGHTS_MAX,
255 _SC_CHARCLASS_NAME_MAX,
273 _SC_IOV_MAX = _SC_UIO_MAXIOV,
274 _SC_PII_INTERNET_STREAM,
275 _SC_PII_INTERNET_DGRAM,
282 _SC_THREAD_SAFE_FUNCTIONS,
283 _SC_GETGR_R_SIZE_MAX,
284 _SC_GETPW_R_SIZE_MAX,
287 _SC_THREAD_DESTRUCTOR_ITERATIONS,
289 _SC_THREAD_STACK_MIN,
290 _SC_THREAD_THREADS_MAX,
291 _SC_THREAD_ATTR_STACKADDR,
292 _SC_THREAD_ATTR_STACKSIZE,
293 _SC_THREAD_PRIORITY_SCHEDULING,
294 _SC_THREAD_PRIO_INHERIT,
295 _SC_THREAD_PRIO_PROTECT,
296 _SC_THREAD_PROCESS_SHARED,
298 _SC_NPROCESSORS_CONF,
299 _SC_NPROCESSORS_ONLN,
306 _SC_XOPEN_XCU_VERSION,
346 _SC_XBS5_ILP32_OFF32,
347 _SC_XBS5_ILP32_OFFBIG,
349 _SC_XBS5_LPBIG_OFFBIG,
353 _SC_XOPEN_REALTIME_THREADS,
359 _SC_C_LANG_SUPPORT_R,
365 _SC_DEVICE_SPECIFIC_R,
376 _SC_READER_WRITER_LOCKS,
384 _SC_THREAD_SPORADIC_SERVER,
386 _SC_SYSTEM_DATABASE_R,
388 _SC_TYPED_MEMORY_OBJECTS,
392 _SC_2_PBS_ACCOUNTING,
398 _SC_2_PBS_CHECKPOINT,
407 _SC_TRACE_EVENT_FILTER,
411 _SC_LEVEL1_ICACHE_SIZE,
412 _SC_LEVEL1_ICACHE_ASSOC,
413 _SC_LEVEL1_ICACHE_LINESIZE,
414 _SC_LEVEL1_DCACHE_SIZE,
415 _SC_LEVEL1_DCACHE_ASSOC,
416 _SC_LEVEL1_DCACHE_LINESIZE,
417 _SC_LEVEL2_CACHE_SIZE,
418 _SC_LEVEL2_CACHE_ASSOC,
419 _SC_LEVEL2_CACHE_LINESIZE,
420 _SC_LEVEL3_CACHE_SIZE,
421 _SC_LEVEL3_CACHE_ASSOC,
422 _SC_LEVEL3_CACHE_LINESIZE,
423 _SC_LEVEL4_CACHE_SIZE,
424 _SC_LEVEL4_CACHE_ASSOC,
425 _SC_LEVEL4_CACHE_LINESIZE,
427 _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50,
431 else version( darwin )
443 else version( freebsd )
457 // File Synchronization (FSC)
464 // Synchronized I/O (SIO)
474 char* crypt(in char*, in char*);
475 char* ctermid(char*);
476 void encrypt(char[64], int);
479 pid_t getpgid(pid_t);
481 char* getwd(char*); // LEGACY
482 int lchown(in char*, uid_t, gid_t);
483 int lockf(int, int, off_t);
485 ssize_t pread(int, void*, size_t, off_t);
486 ssize_t pwrite(int, in void*, size_t, off_t);
488 int setregid(gid_t, gid_t);
489 int setreuid(uid_t, uid_t);
490 void swab(in void*, void*, ssize_t);
492 int truncate(in char*, off_t);
493 useconds_t ualarm(useconds_t, useconds_t);
494 int usleep(useconds_t);
500 char* crypt(in char*, in char*);
501 char* ctermid(char*);
502 void encrypt(char[64], int);
505 pid_t getpgid(pid_t);
507 char* getwd(char*); // LEGACY
508 int lchown(in char*, uid_t, gid_t);
509 //int lockf(int, int, off_t);
511 //ssize_t pread(int, void*, size_t, off_t);
512 //ssize_t pwrite(int, in void*, size_t, off_t);
514 int setregid(gid_t, gid_t);
515 int setreuid(uid_t, uid_t);
516 void swab(in void*, void*, ssize_t);
518 //int truncate(in char*, off_t);
519 useconds_t ualarm(useconds_t, useconds_t);
520 int usleep(useconds_t);
523 static if( __USE_LARGEFILE64 )
525 int lockf64(int, int, off_t);
528 ssize_t pread64(int, void*, size_t, off_t);
531 ssize_t pwrite64(int, in void*, size_t, off_t);
532 alias pwrite64 pwrite;
534 int truncate64(in char*, off_t);
535 alias truncate64 truncate;
539 int lockf(int, int, off_t);
540 ssize_t pread(int, void*, size_t, off_t);
541 ssize_t pwrite(int, in void*, size_t, off_t);
542 int truncate(in char*, off_t);
545 else version (darwin)
547 char* crypt(in char*, in char*);
548 char* ctermid(char*);
549 void encrypt(char[64], int);
552 pid_t getpgid(pid_t);
554 char* getwd(char*); // LEGACY
555 int lchown(in char*, uid_t, gid_t);
556 int lockf(int, int, off_t);
558 ssize_t pread(int, void*, size_t, off_t);
559 ssize_t pwrite(int, in void*, size_t, off_t);
561 int setregid(gid_t, gid_t);
562 int setreuid(uid_t, uid_t);
563 void swab(in void*, void*, ssize_t);
565 int truncate(in char*, off_t);
566 useconds_t ualarm(useconds_t, useconds_t);
567 int usleep(useconds_t);
570 else version (freebsd)
572 char* crypt(in char*, in char*);
573 //char* ctermid(char*);
574 void encrypt(char*, int);
579 char* getwd(char*); // LEGACY
580 int lchown(in char*, uid_t, gid_t);
581 int lockf(int, int, off_t);
583 ssize_t pread(int, void*, size_t, off_t);
584 ssize_t pwrite(int, in void*, size_t, off_t);
585 int setpgrp(pid_t, pid_t);
586 int setregid(gid_t, gid_t);
587 int setreuid(uid_t, uid_t);
588 void swab(in void*, void*, ssize_t);
590 int truncate(in char*, off_t);
591 useconds_t ualarm(useconds_t, useconds_t);
592 int usleep(useconds_t);