1<unistd.h>(0P)             POSIX Programmer's Manual            <unistd.h>(0P)
2
3
4

NAME

6       unistd.h - standard symbolic constants and types
7

SYNOPSIS

9       #include <unistd.h>
10

DESCRIPTION

12       The  <unistd.h>  header  defines  miscellaneous  symbolic constants and
13       types, and declares miscellaneous functions. The actual values  of  the
14       constants  are unspecified except as shown. The contents of this header
15       are shown below.
16
17   Version Test Macros
18       The following symbolic constants shall be defined:
19
20       _POSIX_VERSION
21              Integer value indicating version of IEEE Std 1003.1  (C-language
22              binding)  to  which the implementation conforms. For implementa‐
23              tions conforming to IEEE Std 1003.1-2001,  the  value  shall  be
24              200112L.
25
26       _POSIX2_VERSION
27              Integer value indicating version of the Shell and Utilities vol‐
28              ume of IEEE Std 1003.1 to which the implementation conforms. For
29              implementations  conforming  to  IEEE Std 1003.1-2001, the value
30              shall be 200112L.
31
32
33       The following symbolic constant shall be defined only if the  implemen‐
34       tation supports the XSI option; see XSI Conformance .
35
36       _XOPEN_VERSION
37
38              Integer value indicating version of the X/Open Portability Guide
39              to which the implementation conforms. The value shall be 600.
40
41
42   Constants for Options and Option Groups
43       The following symbolic constants, if defined in <unistd.h>, shall  have
44       a  value  of  -1,  0,  or greater, unless otherwise specified below. If
45       these are undefined, the fpathconf(), pathconf(),  or  sysconf()  func‐
46       tions  can  be  used  to determine whether the option is provided for a
47       particular invocation of the application.
48
49       If a symbolic constant is defined with the value -1, the option is  not
50       supported.  Headers,  data types, and function interfaces required only
51       for the option need not be supplied. An application  that  attempts  to
52       use  anything  associated  only  with  the  option  is considered to be
53       requiring an extension.
54
55       If a symbolic constant is defined with a value greater than  zero,  the
56       option  shall always be supported when the application is executed. All
57       headers, data types, and functions shall be present and  shall  operate
58       as specified.
59
60       If  a  symbolic  constant  is defined with the value zero, all headers,
61       data types, and functions shall be present. The application  can  check
62       at  runtime  to  see  whether the option is supported by calling fpath‐
63       conf(), pathconf(), or sysconf() with the indicated name parameter.
64
65       Unless explicitly specified otherwise, the behavior of functions  asso‐
66       ciated  with  an  unsupported option is unspecified, and an application
67       that uses such functions  without  first  checking  fpathconf(),  path‐
68       conf(), or sysconf() is considered to be requiring an extension.
69
70       For conformance requirements, refer to Conformance .
71
72       _POSIX_ADVISORY_INFO
73
74              The  implementation supports the Advisory Information option. If
75              this symbol has a value other than -1 or 0, it  shall  have  the
76              value 200112L.
77
78       _POSIX_ASYNCHRONOUS_IO
79
80              The  implementation  supports  the Asynchronous Input and Output
81              option.  If this symbol has a value other than -1 or 0, it shall
82              have the value 200112L.
83
84       _POSIX_BARRIERS
85
86              The  implementation supports the Barriers option. If this symbol
87              has a value other than -1 or 0, it shall have the value 200112L.
88
89       _POSIX_CHOWN_RESTRICTED
90              The use of chown() and fchown() is restricted to a process  with
91              appropriate  privileges,  and to changing the group ID of a file
92              only to the effective group ID of the process or to one  of  its
93              supplementary  group  IDs.  This symbol shall always be set to a
94              value other than -1.
95
96       _POSIX_CLOCK_SELECTION
97
98              The implementation supports the Clock Selection option. If  this
99              symbol  has  a value other than -1 or 0, it shall have the value
100              200112L.
101
102       _POSIX_CPUTIME
103
104              The implementation supports the Process CPU-Time Clocks  option.
105              If this symbol has a value other than -1 or 0, it shall have the
106              value 200112L.
107
108       _POSIX_FSYNC
109
110              The implementation supports the File Synchronization option.  If
111              this  symbol  has  a value other than -1 or 0, it shall have the
112              value 200112L.
113
114       _POSIX_IPV6
115              The implementation supports the IPv6 option. If this symbol  has
116              a value other than -1 or 0, it shall have the value 200112L.
117
118       _POSIX_JOB_CONTROL
119              The  implementation  supports  job  control.  This  symbol shall
120              always be set to a value greater than zero.
121
122       _POSIX_MAPPED_FILES
123
124              The implementation supports the Memory Mapped Files  option.  If
125              this  symbol  has  a value other than -1 or 0, it shall have the
126              value 200112L.
127
128       _POSIX_MEMLOCK
129
130              The implementation supports the Process Memory  Locking  option.
131              If this symbol has a value other than -1 or 0, it shall have the
132              value 200112L.
133
134       _POSIX_MEMLOCK_RANGE
135
136              The implementation supports the Range Memory Locking option.  If
137              this  symbol  has  a value other than -1 or 0, it shall have the
138              value 200112L.
139
140       _POSIX_MEMORY_PROTECTION
141
142              The implementation supports the  Memory  Protection  option.  If
143              this  symbol  has  a value other than -1 or 0, it shall have the
144              value 200112L.
145
146       _POSIX_MESSAGE_PASSING
147
148              The implementation supports the Message Passing option. If  this
149              symbol  has  a value other than -1 or 0, it shall have the value
150              200112L.
151
152       _POSIX_MONOTONIC_CLOCK
153
154              The implementation supports the Monotonic Clock option. If  this
155              symbol  has  a value other than -1 or 0, it shall have the value
156              200112L.
157
158       _POSIX_NO_TRUNC
159              Pathname components longer than {NAME_MAX}  generate  an  error.
160              This symbol shall always be set to a value other than -1.
161
162       _POSIX_PRIORITIZED_IO
163
164              The  implementation  supports  the  Prioritized Input and Output
165              option.  If this symbol has a value other than -1 or 0, it shall
166              have the value 200112L.
167
168       _POSIX_PRIORITY_SCHEDULING
169
170              The  implementation  supports  the Process Scheduling option. If
171              this symbol has a value other than -1 or 0, it  shall  have  the
172              value 200112L.
173
174       _POSIX_RAW_SOCKETS
175
176              The implementation supports the Raw Sockets option. If this sym‐
177              bol has a value other than -1 or 0,  it  shall  have  the  value
178              200112L.
179
180       _POSIX_READER_WRITER_LOCKS
181
182              The implementation supports the Read-Write Locks option. This is
183              always set to a value greater than zero if the Threads option is
184              supported.  If  this  symbol  has a value other than -1 or 0, it
185              shall have the value 200112L.
186
187       _POSIX_REALTIME_SIGNALS
188
189              The  implementation  supports  the  Realtime  Signals  Extension
190              option.  If this symbol has a value other than -1 or 0, it shall
191              have the value 200112L.
192
193       _POSIX_REGEXP
194              The implementation  supports  the  Regular  Expression  Handling
195              option.  This symbol shall always be set to a value greater than
196              zero.
197
198       _POSIX_SAVED_IDS
199              Each process has a saved set-user-ID and a  saved  set-group-ID.
200              This symbol shall always be set to a value greater than zero.
201
202       _POSIX_SEMAPHORES
203
204              The  implementation supports the Semaphores option. If this sym‐
205              bol has a value other than -1 or 0,  it  shall  have  the  value
206              200112L.
207
208       _POSIX_SHARED_MEMORY_OBJECTS
209
210              The implementation supports the Shared Memory Objects option. If
211              this symbol has a value other than -1 or 0, it  shall  have  the
212              value 200112L.
213
214       _POSIX_SHELL
215              The  implementation  supports the POSIX shell. This symbol shall
216              always be set to a value greater than zero.
217
218       _POSIX_SPAWN
219
220              The implementation supports the Spawn option. If this symbol has
221              a value other than -1 or 0, it shall have the value 200112L.
222
223       _POSIX_SPIN_LOCKS
224
225              The  implementation supports the Spin Locks option. If this sym‐
226              bol has a value other than -1 or 0,  it  shall  have  the  value
227              200112L.
228
229       _POSIX_SPORADIC_SERVER
230
231              The  implementation supports the Process Sporadic Server option.
232              If this symbol has a value other than -1 or 0, it shall have the
233              value 200112L.
234
235       _POSIX_SYNCHRONIZED_IO
236
237              The  implementation  supports  the Synchronized Input and Output
238              option.  If this symbol has a value other than -1 or 0, it shall
239              have the value 200112L.
240
241       _POSIX_THREAD_ATTR_STACKADDR
242
243              The  implementation  supports the Thread Stack Address Attribute
244              option.  If this symbol has a value other than -1 or 0, it shall
245              have the value 200112L.
246
247       _POSIX_THREAD_ATTR_STACKSIZE
248
249              The  implementation  supports  the  Thread  Stack Size Attribute
250              option.  If this symbol has a value other than -1 or 0, it shall
251              have the value 200112L.
252
253       _POSIX_THREAD_CPUTIME
254
255              The  implementation  supports the Thread CPU-Time Clocks option.
256              If this symbol has a value other than -1 or 0, it shall have the
257              value 200112L.
258
259       _POSIX_THREAD_PRIO_INHERIT
260
261              The  implementation  supports  the  Thread  Priority Inheritance
262              option.  If this symbol has a value other than -1 or 0, it shall
263              have the value 200112L.
264
265       _POSIX_THREAD_PRIO_PROTECT
266
267              The  implementation  supports  the  Thread  Priority  Protection
268              option.  If this symbol has a value other than -1 or 0, it shall
269              have the value 200112L.
270
271       _POSIX_THREAD_PRIORITY_SCHEDULING
272
273              The  implementation  supports  the  Thread  Execution Scheduling
274              option.  If this symbol has a value other than -1 or 0, it shall
275              have the value 200112L.
276
277       _POSIX_THREAD_PROCESS_SHARED
278
279              The  implementation  supports the Thread Process-Shared Synchro‐
280              nization option. If this symbol has a value other than -1 or  0,
281              it shall have the value 200112L.
282
283       _POSIX_THREAD_SAFE_FUNCTIONS
284
285              The implementation supports the Thread-Safe Functions option. If
286              this symbol has a value other than -1 or 0, it  shall  have  the
287              value 200112L.
288
289       _POSIX_THREAD_SPORADIC_SERVER
290
291              The  implementation  supports the Thread Sporadic Server option.
292              If this symbol has a value other than -1 or 0, it shall have the
293              value 200112L.
294
295       _POSIX_THREADS
296
297              The  implementation  supports the Threads option. If this symbol
298              has a value other than -1 or 0, it shall have the value 200112L.
299
300       _POSIX_TIMEOUTS
301
302              The implementation supports the Timeouts option. If this  symbol
303              has a value other than -1 or 0, it shall have the value 200112L.
304
305       _POSIX_TIMERS
306
307              The  implementation  supports  the Timers option. If this symbol
308              has a value other than -1 or 0, it shall have the value 200112L.
309
310       _POSIX_TRACE
311
312              The implementation supports the Trace option. If this symbol has
313              a value other than -1 or 0, it shall have the value 200112L.
314
315       _POSIX_TRACE_EVENT_FILTER
316
317              The  implementation  supports  the Trace Event Filter option. If
318              this symbol has a value other than -1 or 0, it  shall  have  the
319              value 200112L.
320
321       _POSIX_TRACE_INHERIT
322
323              The  implementation  supports  the Trace Inherit option. If this
324              symbol has a value other than -1 or 0, it shall have  the  value
325              200112L.
326
327       _POSIX_TRACE_LOG
328
329              The implementation supports the Trace Log option. If this symbol
330              has a value other than -1 or 0, it shall have the value 200112L.
331
332       _POSIX_TYPED_MEMORY_OBJECTS
333
334              The implementation supports the Typed Memory Objects option.  If
335              this  symbol  has  a value other than -1 or 0, it shall have the
336              value 200112L.
337
338       _POSIX_VDISABLE
339              This symbol shall be defined to be the value of a character that
340              shall  disable  terminal special character handling as described
341              in <termios.h> . This symbol shall always  be  set  to  a  value
342              other than -1.
343
344       _POSIX2_C_BIND
345              The  implementation supports the C-Language Binding option. This
346              symbol shall always have the value 200112L.
347
348       _POSIX2_C_DEV
349
350              The implementation supports the C-Language Development Utilities
351              option.  If this symbol has a value other than -1 or 0, it shall
352              have the value 200112L.
353
354       _POSIX2_CHAR_TERM
355              The implementation supports at least one terminal type.
356
357       _POSIX2_FORT_DEV
358
359              The implementation supports the  FORTRAN  Development  Utilities
360              option.  If this symbol has a value other than -1 or 0, it shall
361              have the value 200112L.
362
363       _POSIX2_FORT_RUN
364
365              The  implementation  supports  the  FORTRAN  Runtime   Utilities
366              option.  If this symbol has a value other than -1 or 0, it shall
367              have the value 200112L.
368
369       _POSIX2_LOCALEDEF
370              The implementation supports  the  creation  of  locales  by  the
371              localedef  utility.  If this symbol has a value other than -1 or
372              0, it shall have the value 200112L.
373
374       _POSIX2_PBS
375
376              The implementation supports the Batch Environment  Services  and
377              Utilities option. If this symbol has a value other than -1 or 0,
378              it shall have the value 200112L.
379
380       _POSIX2_PBS_ACCOUNTING
381
382              The implementation supports the Batch Accounting option. If this
383              symbol  has  a value other than -1 or 0, it shall have the value
384              200112L.
385
386       _POSIX2_PBS_CHECKPOINT
387
388              The implementation supports the Batch Checkpoint/Restart option.
389              If this symbol has a value other than -1 or 0, it shall have the
390              value 200112L.
391
392       _POSIX2_PBS_LOCATE
393
394              The implementation supports the Locate Batch Job Request option.
395              If this symbol has a value other than -1 or 0, it shall have the
396              value 200112L.
397
398       _POSIX2_PBS_MESSAGE
399
400              The  implementation  supports  the  Batch  Job  Message  Request
401              option.  If this symbol has a value other than -1 or 0, it shall
402              have the value 200112L.
403
404       _POSIX2_PBS_TRACK
405
406              The implementation supports the Track Batch Job Request  option.
407              If this symbol has a value other than -1 or 0, it shall have the
408              value 200112L.
409
410       _POSIX2_SW_DEV
411
412              The implementation supports the Software  Development  Utilities
413              option.  If this symbol has a value other than -1 or 0, it shall
414              have the value 200112L.
415
416       _POSIX2_UPE
417
418              The  implementation  supports  the  User  Portability  Utilities
419              option.  If this symbol has a value other than -1 or 0, it shall
420              have the value 200112L.
421
422       _V6_ILP32_OFF32
423              The implementation provides a C-language compilation environment
424              with 32-bit int, long, pointer, and off_t types.
425
426       _V6_ILP32_OFFBIG
427              The implementation provides a C-language compilation environment
428              with 32-bit int, long, and pointer types and an off_t type using
429              at least 64 bits.
430
431       _V6_LP64_OFF64
432              The implementation provides a C-language compilation environment
433              with 32-bit int and 64-bit long, pointer, and off_t types.
434
435       _V6_LPBIG_OFFBIG
436              The implementation provides a C-language compilation environment
437              with  an  int type using at least 32 bits and long, pointer, and
438              off_t types using at least 64 bits.
439
440       _XBS5_ILP32_OFF32 (LEGACY)
441
442              The implementation provides a C-language compilation environment
443              with 32-bit int, long, pointer, and off_t types.
444
445       _XBS5_ILP32_OFFBIG (LEGACY)
446
447              The implementation provides a C-language compilation environment
448              with 32-bit int, long, and pointer types and an off_t type using
449              at least 64 bits.
450
451       _XBS5_LP64_OFF64 (LEGACY)
452
453              The implementation provides a C-language compilation environment
454              with 32-bit int and 64-bit long, pointer, and off_t types.
455
456       _XBS5_LPBIG_OFFBIG (LEGACY)
457
458              The implementation provides a C-language compilation environment
459              with  an  int type using at least 32 bits and long, pointer, and
460              off_t types using at least 64 bits.
461
462       _XOPEN_CRYPT
463
464              The implementation supports the X/Open Encryption Option Group.
465
466       _XOPEN_ENH_I18N
467              The implementation supports the  Issue  4,  Version  2  Enhanced
468              Internationalization  Option  Group. This symbol shall always be
469              set to a value other than -1.
470
471       _XOPEN_LEGACY
472              The implementation supports the Legacy Option Group.
473
474       _XOPEN_REALTIME
475              The implementation supports the X/Open Realtime Option Group.
476
477       _XOPEN_REALTIME_THREADS
478              The implementation supports the X/Open Realtime  Threads  Option
479              Group.
480
481       _XOPEN_SHM
482              The implementation supports the Issue 4, Version 2 Shared Memory
483              Option Group. This symbol shall always be set to a  value  other
484              than -1.
485
486       _XOPEN_STREAMS
487              The implementation supports the XSI STREAMS Option Group.
488
489       _XOPEN_UNIX
490
491              The implementation supports the XSI extension.
492
493
494   Execution-Time Symbolic Constants
495       If  any  of  the  following constants are not defined in the <unistd.h>
496       header, the value shall vary depending on  the  file  to  which  it  is
497       applied.
498
499       If  any  of the following constants are defined to have value -1 in the
500       <unistd.h> header, the implementation shall not provide the  option  on
501       any  file;  if  any  are  defined  to have a value other than -1 in the
502       <unistd.h> header, the implementation shall provide the option  on  all
503       applicable files.
504
505       All  of  the following constants, whether defined in <unistd.h> or not,
506       may be queried with respect to a specific file using the pathconf()  or
507       fpathconf() functions:
508
509       _POSIX_ASYNC_IO
510              Asynchronous input or output operations may be performed for the
511              associated file.
512
513       _POSIX_PRIO_IO
514              Prioritized input or output operations may be performed for  the
515              associated file.
516
517       _POSIX_SYNC_IO
518              Synchronized input or output operations may be performed for the
519              associated file.
520
521
522   Constants for Functions
523       The following symbolic constant shall be defined:
524
525       NULL   Null pointer
526
527
528       The following symbolic constants shall  be  defined  for  the  access()
529       function:
530
531       F_OK   Test for existence of file.
532
533       R_OK   Test for read permission.
534
535       W_OK   Test for write permission.
536
537       X_OK   Test for execute (search) permission.
538
539
540       The constants F_OK, R_OK, W_OK, and X_OK and the expressions R_OK|W_OK,
541       R_OK|X_OK, and R_OK|W_OK|X_OK shall all have distinct values.
542
543       The following symbolic constants shall be  defined  for  the  confstr()
544       function:
545
546       _CS_PATH
547              This  is  the value for the PATH environment variable that finds
548              all standard utilities.
549
550       _CS_POSIX_V6_ILP32_OFF32_CFLAGS
551              If sysconf(_SC_V6_ILP32_OFF32) returns -1, the meaning  of  this
552              value  is  unspecified. Otherwise, this value is the set of ini‐
553              tial options to be given to the c99 utility to build an applica‐
554              tion  using  a programming model with 32-bit int, long, pointer,
555              and off_t types.
556
557       _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
558              If sysconf(_SC_V6_ILP32_OFF32) returns -1, the meaning  of  this
559              value  is unspecified. Otherwise, this value is the set of final
560              options to be given to the c99 utility to build  an  application
561              using  a  programming  model with 32-bit int, long, pointer, and
562              off_t types.
563
564       _CS_POSIX_V6_ILP32_OFF32_LIBS
565              If sysconf(_SC_V6_ILP32_OFF32) returns -1, the meaning  of  this
566              value  is  unspecified.  Otherwise,  this  value  is  the set of
567              libraries to be given to the c99 utility to build an application
568              using  a  programming  model with 32-bit int, long, pointer, and
569              off_t types.
570
571       _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
572              If sysconf(_SC_V6_ILP32_OFFBIG) returns -1, the meaning of  this
573              value  is  unspecified. Otherwise, this value is the set of ini‐
574              tial options to be given to the c99 utility to build an applica‐
575              tion  using  a  programming  model  with  32-bit  int, long, and
576              pointer types, and an off_t type using at least 64 bits.
577
578       _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
579              If sysconf(_SC_V6_ILP32_OFFBIG) returns -1, the meaning of  this
580              value  is unspecified. Otherwise, this value is the set of final
581              options to be given to the c99 utility to build  an  application
582              using  a  programming  model  with 32-bit int, long, and pointer
583              types, and an off_t type using at least 64 bits.
584
585       _CS_POSIX_V6_ILP32_OFFBIG_LIBS
586              If sysconf(_SC_V6_ILP32_OFFBIG) returns -1, the meaning of  this
587              value  is  unspecified.  Otherwise,  this  value  is  the set of
588              libraries to be given to the c99 utility to build an application
589              using  a  programming  model  with 32-bit int, long, and pointer
590              types, and an off_t type using at least 64 bits.
591
592       _CS_POSIX_V6_LP64_OFF64_CFLAGS
593              If sysconf(_SC_V6_LP64_OFF64) returns -1, the  meaning  of  this
594              value  is  unspecified. Otherwise, this value is the set of ini‐
595              tial options to be given to the c99 utility to build an applica‐
596              tion  using a programming model with 32-bit int and 64-bit long,
597              pointer, and off_t types.
598
599       _CS_POSIX_V6_LP64_OFF64_LDFLAGS
600              If sysconf(_SC_V6_LP64_OFF64) returns -1, the  meaning  of  this
601              value  is unspecified. Otherwise, this value is the set of final
602              options to be given to the c99 utility to build  an  application
603              using  a  programming  model  with  32-bit  int and 64-bit long,
604              pointer, and off_t types.
605
606       _CS_POSIX_V6_LP64_OFF64_LIBS
607              If sysconf(_SC_V6_LP64_OFF64) returns -1, the  meaning  of  this
608              value  is  unspecified.  Otherwise,  this  value  is  the set of
609              libraries to be given to the c99 utility to build an application
610              using  a  programming  model  with  32-bit  int and 64-bit long,
611              pointer, and off_t types.
612
613       _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
614              If sysconf(_SC_V6_LPBIG_OFFBIG) returns -1, the meaning of  this
615              value  is  unspecified. Otherwise, this value is the set of ini‐
616              tial options to be given to the c99 utility to build an applica‐
617              tion  using  a programming model with an int type using at least
618              32 bits and long, pointer, and off_t types  using  at  least  64
619              bits.
620
621       _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
622              If  sysconf(_SC_V6_LPBIG_OFFBIG) returns -1, the meaning of this
623              value is unspecified. Otherwise, this value is the set of  final
624              options  to  be given to the c99 utility to build an application
625              using a programming model with an int type  using  at  least  32
626              bits and long, pointer, and off_t types using at least 64 bits.
627
628       _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
629              If  sysconf(_SC_V6_LPBIG_OFFBIG) returns -1, the meaning of this
630              value is unspecified.  Otherwise,  this  value  is  the  set  of
631              libraries to be given to the c99 utility to build an application
632              using a programming model with an int type  using  at  least  32
633              bits and long, pointer, and off_t types using at least 64 bits.
634
635       _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS
636              This value is a <newline>-separated list of names of programming
637              environments supported by the implementation in which the widths
638              of  the  blksize_t,  cc_t,  mode_t,  nfds_t,  pid_t,  ptrdiff_t,
639              size_t, speed_t,  ssize_t,  suseconds_t,  tcflag_t,  useconds_t,
640              wchar_t,  and wint_t types are no greater than the width of type
641              long.
642
643
644       The following symbolic constants are reserved  for  compatibility  with
645       Issue 5:
646
647       _CS_XBS5_ILP32_OFF32_CFLAGS (LEGACY)
648       _CS_XBS5_ILP32_OFF32_LDFLAGS (LEGACY)
649       _CS_XBS5_ILP32_OFF32_LIBS (LEGACY)
650       _CS_XBS5_ILP32_OFF32_LINTFLAGS (LEGACY)
651       _CS_XBS5_ILP32_OFFBIG_CFLAGS (LEGACY)
652       _CS_XBS5_ILP32_OFFBIG_LDFLAGS (LEGACY)
653       _CS_XBS5_ILP32_OFFBIG_LIBS (LEGACY)
654       _CS_XBS5_ILP32_OFFBIG_LINTFLAGS (LEGACY)
655       _CS_XBS5_LP64_OFF64_CFLAGS (LEGACY)
656       _CS_XBS5_LP64_OFF64_LDFLAGS (LEGACY)
657       _CS_XBS5_LP64_OFF64_LIBS (LEGACY)
658       _CS_XBS5_LP64_OFF64_LINTFLAGS (LEGACY)
659       _CS_XBS5_LPBIG_OFFBIG_CFLAGS (LEGACY)
660       _CS_XBS5_LPBIG_OFFBIG_LDFLAGS (LEGACY)
661       _CS_XBS5_LPBIG_OFFBIG_LIBS (LEGACY)
662       _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS (LEGACY)
663
664
665       The  following  symbolic constants shall be defined for the lseek() and
666       fcntl() functions and shall have distinct values:
667
668       SEEK_CUR
669              Set file offset to current plus offset.
670
671       SEEK_END
672              Set file offset to EOF plus offset.
673
674       SEEK_SET
675              Set file offset to offset.
676
677
678       The following symbolic constants shall be defined  as  possible  values
679       for the function argument to the lockf() function:
680
681       F_LOCK Lock a section for exclusive use.
682
683       F_TEST Test section for locks by other processes.
684
685       F_TLOCK
686              Test and lock a section for exclusive use.
687
688       F_ULOCK
689              Unlock locked sections.
690
691
692       The following symbolic constants shall be defined for pathconf():
693
694       _PC_ALLOC_SIZE_MIN
695       _PC_ASYNC_IO
696       _PC_CHOWN_RESTRICTED
697       _PC_FILESIZEBITS
698       _PC_LINK_MAX
699       _PC_MAX_CANON
700       _PC_MAX_INPUT
701       _PC_NAME_MAX
702       _PC_NO_TRUNC
703       _PC_PATH_MAX
704       _PC_PIPE_BUF
705       _PC_PRIO_IO
706       _PC_REC_INCR_XFER_SIZE
707       _PC_REC_MIN_XFER_SIZE
708       _PC_REC_XFER_ALIGN
709       _PC_SYMLINK_MAX
710       _PC_SYNC_IO
711       _PC_VDISABLE
712
713       The following symbolic constants shall be defined for sysconf():
714
715       _SC_2_C_BIND
716       _SC_2_C_DEV
717       _SC_2_C_VERSION
718       _SC_2_CHAR_TERM
719       _SC_2_FORT_DEV
720       _SC_2_FORT_RUN
721       _SC_2_LOCALEDEF
722       _SC_2_PBS
723       _SC_2_PBS_ACCOUNTING
724       _SC_2_PBS_CHECKPOINT
725       _SC_2_PBS_LOCATE
726       _SC_2_PBS_MESSAGE
727       _SC_2_PBS_TRACK
728       _SC_2_SW_DEV
729       _SC_2_UPE
730       _SC_2_VERSION
731       _SC_ADVISORY_INFO
732       _SC_ARG_MAX
733       _SC_AIO_LISTIO_MAX
734       _SC_AIO_MAX
735       _SC_AIO_PRIO_DELTA_MAX
736       _SC_ASYNCHRONOUS_IO
737       _SC_ATEXIT_MAX
738       _SC_BARRIERS
739       _SC_BC_BASE_MAX
740       _SC_BC_DIM_MAX
741       _SC_BC_SCALE_MAX
742       _SC_BC_STRING_MAX
743       _SC_CHILD_MAX
744       _SC_CLK_TCK
745       _SC_CLOCK_SELECTION
746       _SC_COLL_WEIGHTS_MAX
747       _SC_CPUTIME
748       _SC_DELAYTIMER_MAX
749       _SC_EXPR_NEST_MAX
750       _SC_FILE_LOCKING
751       _SC_FSYNC
752       _SC_GETGR_R_SIZE_MAX
753       _SC_GETPW_R_SIZE_MAX
754       _SC_HOST_NAME_MAX
755       _SC_IOV_MAX
756       _SC_IPV6
757       _SC_JOB_CONTROL
758       _SC_LINE_MAX
759       _SC_LOGIN_NAME_MAX
760       _SC_MAPPED_FILES
761       _SC_MEMLOCK
762       _SC_MEMLOCK_RANGE
763       _SC_MEMORY_PROTECTION
764       _SC_MESSAGE_PASSING
765       _SC_MONOTONIC_CLOCK
766       _SC_MQ_OPEN_MAX
767       _SC_MQ_PRIO_MAX
768       _SC_NGROUPS_MAX
769       _SC_OPEN_MAX
770       _SC_PAGE_SIZE
771       _SC_PAGESIZE
772       _SC_PRIORITIZED_IO
773       _SC_PRIORITY_SCHEDULING
774       _SC_RAW_SOCKETS
775       _SC_RE_DUP_MAX
776       _SC_READER_WRITER_LOCKS
777       _SC_REALTIME_SIGNALS
778       _SC_REGEXP
779       _SC_RTSIG_MAX
780       _SC_SAVED_IDS
781       _SC_SEMAPHORES
782       _SC_SEM_NSEMS_MAX
783       _SC_SEM_VALUE_MAX
784       _SC_SHARED_MEMORY_OBJECTS
785       _SC_SHELL
786       _SC_SIGQUEUE_MAX
787       _SC_SPAWN
788       _SC_SPIN_LOCKS
789       _SC_SPORADIC_SERVER
790       _SC_STREAM_MAX
791       _SC_SYMLOOP_MAX
792       _SC_SYNCHRONIZED_IO
793       _SC_THREAD_ATTR_STACKADDR
794       _SC_THREAD_ATTR_STACKSIZE
795       _SC_THREAD_CPUTIME
796       _SC_THREAD_DESTRUCTOR_ITERATIONS
797       _SC_THREAD_KEYS_MAX
798       _SC_THREAD_PRIO_INHERIT
799       _SC_THREAD_PRIO_PROTECT
800       _SC_THREAD_PRIORITY_SCHEDULING
801       _SC_THREAD_PROCESS_SHARED
802       _SC_THREAD_SAFE_FUNCTIONS
803       _SC_THREAD_SPORADIC_SERVER
804       _SC_THREAD_STACK_MIN
805       _SC_THREAD_THREADS_MAX
806       _SC_TIMEOUTS
807       _SC_THREADS
808       _SC_TIMER_MAX
809       _SC_TIMERS
810       _SC_TRACE
811       _SC_TRACE_EVENT_FILTER
812       _SC_TRACE_INHERIT
813       _SC_TRACE_LOG
814       _SC_TTY_NAME_MAX
815       _SC_TYPED_MEMORY_OBJECTS
816       _SC_TZNAME_MAX
817       _SC_V6_ILP32_OFF32
818       _SC_V6_ILP32_OFFBIG
819       _SC_V6_LP64_OFF64
820       _SC_V6_LPBIG_OFFBIG
821       _SC_VERSION
822       _SC_XBS5_ILP32_OFF32 (LEGACY)
823       _SC_XBS5_ILP32_OFFBIG (LEGACY)
824       _SC_XBS5_LP64_OFF64 (LEGACY)
825       _SC_XBS5_LPBIG_OFFBIG (LEGACY)
826       _SC_XOPEN_CRYPT
827       _SC_XOPEN_ENH_I18N
828       _SC_XOPEN_LEGACY
829       _SC_XOPEN_REALTIME
830       _SC_XOPEN_REALTIME_THREADS
831       _SC_XOPEN_SHM
832       _SC_XOPEN_STREAMS
833       _SC_XOPEN_UNIX
834       _SC_XOPEN_VERSION
835       _SC_XOPEN_XCU_VERSION
836
837       The two constants _SC_PAGESIZE and _SC_PAGE_SIZE may be defined to have
838       the same value.
839
840       The following symbolic constants shall be defined for file streams:
841
842       STDERR_FILENO
843              File number of stderr; 2.
844
845       STDIN_FILENO
846              File number of stdin; 0.
847
848       STDOUT_FILENO
849              File number of stdout; 1.
850
851
852   Type Definitions
853       The size_t, ssize_t, uid_t, gid_t, off_t, pid_t, and  useconds_t  types
854       shall be defined as described in <sys/types.h>.
855
856       The intptr_t type shall be defined as described in <inttypes.h>.
857
858   Declarations
859       The following shall be declared as functions and may also be defined as
860       macros. Function prototypes shall be provided.
861
862
863              int          access(const char *, int);
864              unsigned     alarm(unsigned);
865              int          chdir(const char *);
866              int          chown(const char *, uid_t, gid_t);
867              int          close(int);
868              size_t       confstr(int, char *, size_t);
869
870
871
872              char        *crypt(const char *, const char *);
873              char        *ctermid(char *);
874
875              int          dup(int);
876
877
878              int          dup2(int, int);
879
880              void         encrypt(char[64], int);
881
882              int          execl(const char *, const char *, ...);
883              int          execle(const char *, const char *, ...);
884              int          execlp(const char *, const char *, ...);
885              int          execv(const char *, char *const []);
886              int          execve(const char *, char *const [], char *const []);
887              int          execvp(const char *, char *const []);
888              void        _exit(int);
889              int          fchown(int, uid_t, gid_t);
890
891              int          fchdir(int);
892
893
894              int          fdatasync(int);
895
896              pid_t        fork(void);
897              long         fpathconf(int, int);
898
899              int          fsync(int);
900
901              int          ftruncate(int, off_t);
902              char        *getcwd(char *, size_t);
903              gid_t        getegid(void);
904              uid_t        geteuid(void);
905              gid_t        getgid(void);
906              int          getgroups(int, gid_t []);
907
908              long         gethostid(void);
909
910              int          gethostname(char *, size_t);
911              char        *getlogin(void);
912              int          getlogin_r(char *, size_t);
913              int          getopt(int, char * const [], const char *);
914
915              pid_t        getpgid(pid_t);
916
917              pid_t        getpgrp(void);
918              pid_t        getpid(void);
919              pid_t        getppid(void);
920
921              pid_t        getsid(pid_t);
922
923              uid_t        getuid(void);
924
925              char        *getwd(char *); (LEGACY )
926
927              int          isatty(int);
928
929              int          lchown(const char *, uid_t, gid_t);
930
931              int          link(const char *, const char *);
932
933              int          lockf(int, int, off_t);
934
935              off_t        lseek(int, off_t, int);
936
937              int          nice(int);
938
939              long         pathconf(const char *, int);
940              int          pause(void);
941              int          pipe(int [2]);
942
943              ssize_t      pread(int, void *, size_t, off_t);
944              ssize_t      pwrite(int, const void *, size_t, off_t);
945
946              ssize_t      read(int, void *, size_t);
947              ssize_t      readlink(const char *restrict, char *restrict, size_t);
948              int          rmdir(const char *);
949              int          setegid(gid_t);
950              int          seteuid(uid_t);
951              int          setgid(gid_t);
952
953
954              int          setpgid(pid_t, pid_t);
955
956              pid_t        setpgrp(void);
957              int          setregid(gid_t, gid_t);
958              int          setreuid(uid_t, uid_t);
959
960              pid_t        setsid(void);
961              int          setuid(uid_t);
962              unsigned     sleep(unsigned);
963
964              void         swab(const void *restrict, void *restrict, ssize_t);
965              int          symlink(const char *, const char *);
966              void         sync(void);
967
968              long         sysconf(int);
969              pid_t        tcgetpgrp(int);
970              int          tcsetpgrp(int, pid_t);
971
972              int          truncate(const char *, off_t);
973
974              char        *ttyname(int);
975              int          ttyname_r(int, char *, size_t);
976
977              useconds_t   ualarm(useconds_t, useconds_t);
978
979              int          unlink(const char *);
980
981              int          usleep(useconds_t);
982              pid_t        vfork(void);
983
984              ssize_t      write(int, const void *, size_t);
985
986       Implementations may also  include  the  pthread_atfork()  prototype  as
987       defined in <pthread.h> .
988
989       The following external variables shall be declared:
990
991
992              extern char  *optarg;
993              extern int    optind, opterr, optopt;
994
995       The following sections are informative.
996

APPLICATION USAGE

998       IEEE Std 1003.1-2001  only describes the behavior of systems that claim
999       conformance to it. However, application developers who  want  to  write
1000       applications  that  adapt  to  other versions of IEEE Std 1003.1 (or to
1001       systems that do not conform to any POSIX standard) may find  it  useful
1002       to code them so as to conditionally compile different code depending on
1003       the value of _POSIX_VERSION, for example:
1004
1005
1006              #if _POSIX_VERSION >= 200112L
1007              /* Use the newer function that copes with large files. */
1008              off_t pos=ftello(fp);
1009              #else
1010              /* Either this is an old version of POSIX, or _POSIX_VERSION is
1011                 not even defined, so use the traditional function. */
1012              long pos=ftell(fp);
1013              #endif
1014
1015       Earlier versions of IEEE Std 1003.1 and of the Single  UNIX  Specifica‐
1016       tion can be identified by the following macros:
1017
1018       POSIX.1-1988 standard
1019              _POSIX_VERSION==198808L
1020
1021       POSIX.1-1990 standard
1022              _POSIX_VERSION==199009L
1023
1024       ISO POSIX-1:1996 standard
1025              _POSIX_VERSION==199506L
1026
1027       Single UNIX Specification, Version 1
1028              _XOPEN_UNIX and _XOPEN_VERSION==4
1029
1030       Single UNIX Specification, Version 2
1031              _XOPEN_UNIX and _XOPEN_VERSION==500
1032
1033
1034       IEEE Std 1003.1-2001  does  not  make any attempt to define application
1035       binary interaction  with  the  underlying  operating  system.  However,
1036       application  developers may find it useful to query _SC_VERSION at run‐
1037       time via sysconf() to determine whether  the  current  version  of  the
1038       operating system supports the necessary functionality as in the follow‐
1039       ing program fragment:
1040
1041
1042              if (sysconf(_SC_VERSION) < 200112L) {
1043                  fprintf(stderr, "POSIX.1-2001 system required, terminating \n");
1044                  exit(1);
1045              }
1046
1047       New applications should not use _XOPEN_SHM or _XOPEN_ENH_I18N.
1048

RATIONALE

1050       As IEEE Std 1003.1-2001 evolved, certain  options  became  sufficiently
1051       standardized  that  it  was  concluded that simply requiring one of the
1052       option choices was simpler than  retaining  the  option.  However,  for
1053       backwards-compatibility,  the option flags (with required constant val‐
1054       ues) are retained.
1055
1056   Version Test Macros
1057       The  standard  developers  considered  altering   the   definition   of
1058       _POSIX_VERSION  and  removing  _SC_VERSION  from  the  specification of
1059       sysconf() since the utility to an application was deemed by some to  be
1060       minimal,  and  since  the implementation of the functionality is poten‐
1061       tially problematic.  However, they recognized that support for existing
1062       application  binaries is a concern to manufacturers, application devel‐
1063       opers,   and   the   users    of    implementations    conforming    to
1064       IEEE Std 1003.1-2001.
1065
1066       While  the  example  using _SC_VERSION in the APPLICATION USAGE section
1067       does not provide the greatest  degree  of  imaginable  utility  to  the
1068       application  developer  or user, it is arguably better than a core file
1069       or some other equally obscure result. (It is also possible  for  imple‐
1070       mentations  to  encode  and  recognize application binaries compiled in
1071       various POSIX.1-conforming environments, and modify  the  semantics  of
1072       the  underlying  system  to conform to the expectations of the applica‐
1073       tion.) For the reasons outlined in the preceding paragraphs and in  the
1074       APPLICATION  USAGE  section,  the standard developers elected to retain
1075       the _POSIX_VERSION and _SC_VERSION functionality.
1076
1077   Compile-Time Symbolic Constants for System-Wide Options
1078       IEEE Std 1003.1-2001 now includes support  in  certain  areas  for  the
1079       newly adopted policy governing options and stubs.
1080
1081       This  policy  provides flexibility for implementations in how they sup‐
1082       port options. It also specifies how conforming applications  can  adapt
1083       to different implementations that support different sets of options. It
1084       allows the following:
1085
1086        1. If an implementation has no interest in supporting  an  option,  it
1087           does  not  have  to  provide  anything  associated with that option
1088           beyond the announcement that it does not support it.
1089
1090        2. An implementation can support a partial or incompatible version  of
1091           an  option  (as  a  non-standard  extension) as long as it does not
1092           claim to support the option.
1093
1094        3. An application can determine whether the  option  is  supported.  A
1095           strictly conforming application must check this announcement mecha‐
1096           nism before first using anything associated with the option.
1097
1098       There is an important implication of this policy.  IEEE Std 1003.1-2001
1099       cannot  dictate  the  behavior  of interfaces associated with an option
1100       when the implementation does not claim to support the option.  In  par‐
1101       ticular,  it  cannot  require that a function associated with an unsup‐
1102       ported option will fail if it does not perform as  specified.  However,
1103       this  policy  does  not prevent a standard from requiring certain func‐
1104       tions to always be present, but that they shall  always  fail  on  some
1105       implementations.  The  setpgid() function in the POSIX.1-1990 standard,
1106       for example, is considered appropriate.
1107
1108       The POSIX standards include various options, and the C-language binding
1109       support  for an option implies that the implementation must supply data
1110       types and function interfaces. An application must be able to  discover
1111       whether the implementation supports each option.
1112
1113       Any  application  must  consider  the  following  three  cases for each
1114       option:
1115
1116        1. Option never supported.
1117
1118       The implementation advertises at compile  time  that  the  option  will
1119       never be supported. In this case, it is not necessary for the implemen‐
1120       tation to supply any of the data types or function interfaces that  are
1121       provided  only  as part of the option. The implementation might provide
1122       data  types  and  functions  that  are  similar  to  those  defined  by
1123       IEEE Std 1003.1-2001,  but  there  is  no  guarantee for any particular
1124       behavior.
1125
1126        2. Option always supported.
1127
1128       The implementation advertises at compile  time  that  the  option  will
1129       always  be  supported. In this case, all data types and function inter‐
1130       faces shall be available and shall operate as specified.
1131
1132        3. Option might or might not be supported.
1133
1134       Some implementations might not provide a mechanism to  specify  support
1135       of  options  at  compile time. In addition, the implementation might be
1136       unable or unwilling to specify support or non-support at compile  time.
1137       In  either  case,  any application that might use the option at runtime
1138       must be able to compile and execute.  The implementation must  provide,
1139       at compile time, all data types and function interfaces that are neces‐
1140       sary to allow this. In this situation, there must be a  mechanism  that
1141       allows the application to query, at runtime, whether the option is sup‐
1142       ported.  If the application attempts to use the option when it  is  not
1143       supported, the result is unspecified unless explicitly specified other‐
1144       wise in IEEE Std 1003.1-2001.
1145

FUTURE DIRECTIONS

1147       None.
1148

SEE ALSO

1150       <inttypes.h>, <limits.h>, <sys/socket.h>,  <sys/types.h>,  <termios.h>,
1151       <wctype.h>,  the  System  Interfaces  volume  of  IEEE Std 1003.1-2001,
1152       access(),  alarm(),  chdir(),  chown(),  close(),  crypt(),  ctermid(),
1153       dup(),  encrypt(),  environ, exec, exit(), fchdir(), fchown(), fcntl(),
1154       fork(),  fpathconf(),  fsync(),   ftruncate(),   getcwd(),   getegid(),
1155       geteuid(),  getgid(),  getgroups(),  gethostid(), gethostname(), getlo‐
1156       gin(), getpgid(), getpgrp(), getpid(), getppid(),  getsid(),  getuid(),
1157       isatty(),  lchown(),  link(),  lockf(),  lseek(),  nice(),  pathconf(),
1158       pause(), pipe(),  read(),  readlink(),  rmdir(),  setgid(),  setpgid(),
1159       setpgrp(), setregid(), setreuid(), setsid(), setuid(), sleep(), swab(),
1160       symlink(), sync(),  sysconf(),  tcgetpgrp(),  tcsetpgrp(),  truncate(),
1161       ttyname(), ualarm(), unlink(), usleep(), vfork(), write()
1162
1164       Portions  of  this text are reprinted and reproduced in electronic form
1165       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
1166       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
1167       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
1168       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
1169       event of any discrepancy between this version and the original IEEE and
1170       The  Open Group Standard, the original IEEE and The Open Group Standard
1171       is the referee document. The original Standard can be  obtained  online
1172       at http://www.opengroup.org/unix/online.html .
1173
1174
1175
1176IEEE/The Open Group                  2003                       <unistd.h>(0P)
Impressum