Initial import from FreeBSD RELENG_4:
[dragonfly.git] / sys / sys / unistd.h
1 /*
2  * Copyright (c) 1989, 1993
3  *      The Regents of the University of California.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. All advertising materials mentioning features or use of this software
14  *    must display the following acknowledgement:
15  *      This product includes software developed by the University of
16  *      California, Berkeley and its contributors.
17  * 4. Neither the name of the University nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  *
33  *      @(#)unistd.h    8.2 (Berkeley) 1/7/94
34  * $FreeBSD: src/sys/sys/unistd.h,v 1.22.2.2 2000/08/22 01:46:30 jhb Exp $
35  */
36
37 #ifndef _SYS_UNISTD_H_
38 #define _SYS_UNISTD_H_
39
40 #include <sys/_posix.h>
41
42 /* compile-time symbolic constants */
43 #define _POSIX_JOB_CONTROL      /* implementation supports job control */
44
45 /*
46  * Although we have saved user/group IDs, we do not use them in setuid
47  * as described in POSIX 1003.1, because the feature does not work for
48  * root.  We use the saved IDs in seteuid/setegid, which are not currently
49  * part of the POSIX 1003.1 specification.
50  */
51 #ifdef  _NOT_AVAILABLE
52 #define _POSIX_SAVED_IDS        /* saved set-user-ID and set-group-ID */
53 #endif
54
55 #define _POSIX2_VERSION         199212L
56
57 /* execution-time symbolic constants */
58                                 /* chown requires appropriate privileges */
59 #define _POSIX_CHOWN_RESTRICTED 1
60                                 /* too-long path components generate errors */
61 #define _POSIX_NO_TRUNC         1
62                                 /* may disable terminal special characters */
63 #define _POSIX_VDISABLE         0xff
64
65 /*
66  * Threads features:
67  *
68  * Note that those commented out are not currently supported by the
69  * implementation.
70  */
71 #define _POSIX_THREADS
72 #define _POSIX_THREAD_ATTR_STACKADDR
73 #define _POSIX_THREAD_ATTR_STACKSIZE
74 #define _POSIX_THREAD_PRIORITY_SCHEDULING
75 #define _POSIX_THREAD_PRIO_INHERIT
76 #define _POSIX_THREAD_PRIO_PROTECT
77 /* #define _POSIX_THREAD_PROCESS_SHARED */
78 /*
79  * 1003.1c-1995 says on page 38 (2.9.3, paragraph 3) that if _POSIX_THREADS is
80  * defined, then _POSIX_THREAD_SAFE_FUNCTIONS must also be defined.  (This is
81  * likely a typo (reversed dependency), in which case we would be compliant if
82  * the typo were officially acknowledged.)  However, we do not support all of
83  * the required _r() interfaces, which means we cannot legitimately define
84  * _POSIX_THREAD_SAFE_FUNCTIONS.  Therefore, we are non-compliant here in two
85  * ways.
86  */
87 /* #define _POSIX_THREAD_SAFE_FUNCTIONS */
88 #define _POSIX_SEMAPHORES
89
90 /* access function */
91 #define F_OK            0       /* test for existence of file */
92 #define X_OK            0x01    /* test for execute or search permission */
93 #define W_OK            0x02    /* test for write permission */
94 #define R_OK            0x04    /* test for read permission */
95
96 /* whence values for lseek(2) */
97 #define SEEK_SET        0       /* set file offset to offset */
98 #define SEEK_CUR        1       /* set file offset to current plus offset */
99 #define SEEK_END        2       /* set file offset to EOF plus offset */
100
101 #ifndef _POSIX_SOURCE
102 /* whence values for lseek(2); renamed by POSIX 1003.1 */
103 #define L_SET           SEEK_SET
104 #define L_INCR          SEEK_CUR
105 #define L_XTND          SEEK_END
106 #endif
107
108 /* configurable pathname variables */
109 #define _PC_LINK_MAX             1
110 #define _PC_MAX_CANON            2
111 #define _PC_MAX_INPUT            3
112 #define _PC_NAME_MAX             4
113 #define _PC_PATH_MAX             5
114 #define _PC_PIPE_BUF             6
115 #define _PC_CHOWN_RESTRICTED     7
116 #define _PC_NO_TRUNC             8
117 #define _PC_VDISABLE             9
118
119 /* configurable system variables */
120 #define _SC_ARG_MAX              1
121 #define _SC_CHILD_MAX            2
122 #define _SC_CLK_TCK              3
123 #define _SC_NGROUPS_MAX          4
124 #define _SC_OPEN_MAX             5
125 #define _SC_JOB_CONTROL          6
126 #define _SC_SAVED_IDS            7
127 #define _SC_VERSION              8
128 #define _SC_BC_BASE_MAX          9
129 #define _SC_BC_DIM_MAX          10
130 #define _SC_BC_SCALE_MAX        11
131 #define _SC_BC_STRING_MAX       12
132 #define _SC_COLL_WEIGHTS_MAX    13
133 #define _SC_EXPR_NEST_MAX       14
134 #define _SC_LINE_MAX            15
135 #define _SC_RE_DUP_MAX          16
136 #define _SC_2_VERSION           17
137 #define _SC_2_C_BIND            18
138 #define _SC_2_C_DEV             19
139 #define _SC_2_CHAR_TERM         20
140 #define _SC_2_FORT_DEV          21
141 #define _SC_2_FORT_RUN          22
142 #define _SC_2_LOCALEDEF         23
143 #define _SC_2_SW_DEV            24
144 #define _SC_2_UPE               25
145 #define _SC_STREAM_MAX          26
146 #define _SC_TZNAME_MAX          27
147
148 /* configurable system strings */
149 #define _CS_PATH                 1
150
151 #ifdef _P1003_1B_VISIBLE
152
153 #define _POSIX_PRIORITY_SCHEDULING
154
155 #if 0
156 /* Not until the dust settles after the header commit
157  */
158 #define _POSIX_ASYNCHRONOUS_IO
159 #define _POSIX_MEMLOCK
160 #define _POSIX_MEMLOCK_RANGE
161 #endif
162
163 /* ??? #define  _POSIX_FSYNC                    1 */
164 #define _POSIX_MAPPED_FILES             1
165 #define _POSIX_SHARED_MEMORY_OBJECTS    1
166
167 /* POSIX.1B sysconf options */
168 #define _SC_ASYNCHRONOUS_IO     28
169 #define _SC_MAPPED_FILES        29
170 #define _SC_MEMLOCK             30
171 #define _SC_MEMLOCK_RANGE       31
172 #define _SC_MEMORY_PROTECTION   32
173 #define _SC_MESSAGE_PASSING     33
174 #define _SC_PRIORITIZED_IO      34
175 #define _SC_PRIORITY_SCHEDULING 35
176 #define _SC_REALTIME_SIGNALS    36
177 #define _SC_SEMAPHORES          37
178 #define _SC_FSYNC               38
179 #define _SC_SHARED_MEMORY_OBJECTS 39
180 #define _SC_SYNCHRONIZED_IO     40
181 #define _SC_TIMERS              41
182 #define _SC_AIO_LISTIO_MAX      42
183 #define _SC_AIO_MAX             43
184 #define _SC_AIO_PRIO_DELTA_MAX  44
185 #define _SC_DELAYTIMER_MAX      45
186 #define _SC_MQ_OPEN_MAX         46
187 #define _SC_PAGESIZE            47
188 #define _SC_RTSIG_MAX           48
189 #define _SC_SEM_NSEMS_MAX       49
190 #define _SC_SEM_VALUE_MAX       50
191 #define _SC_SIGQUEUE_MAX        51
192 #define _SC_TIMER_MAX           52
193
194 /* POSIX.1B pathconf and fpathconf options */
195 #define _PC_ASYNC_IO            53
196 #define _PC_PRIO_IO             54
197 #define _PC_SYNC_IO             55
198
199 #endif /* _P1003_1B_VISIBLE */
200
201 #ifndef _POSIX_SOURCE
202 /*
203  * rfork() options.
204  *
205  * XXX currently, operations without RFPROC set are not supported.
206  */
207 #define RFNAMEG         (1<<0)  /* UNIMPL new plan9 `name space' */
208 #define RFENVG          (1<<1)  /* UNIMPL copy plan9 `env space' */
209 #define RFFDG           (1<<2)  /* copy fd table */
210 #define RFNOTEG         (1<<3)  /* UNIMPL create new plan9 `note group' */
211 #define RFPROC          (1<<4)  /* change child (else changes curproc) */
212 #define RFMEM           (1<<5)  /* share `address space' */
213 #define RFNOWAIT        (1<<6)  /* parent need not wait() on child */ 
214 #define RFCNAMEG        (1<<10) /* UNIMPL zero plan9 `name space' */
215 #define RFCENVG         (1<<11) /* UNIMPL zero plan9 `env space' */
216 #define RFCFDG          (1<<12) /* zero fd table */
217 #define RFTHREAD        (1<<13) /* enable kernel thread support */
218 #define RFSIGSHARE      (1<<14) /* share signal handlers */
219 #define RFLINUXTHPN     (1<<16) /* do linux clone exit parent notification */
220 #define RFPPWAIT        (1<<31) /* parent sleeps until child exits (vfork) */
221
222 #endif /* !_POSIX_SOURCE */
223
224 #endif /* !_SYS_UNISTD_H_ */