root / lab4 / .minix-src / include / sys / unistd.h @ 13
History | View | Annotate | Download (10.8 KB)
1 |
/* $NetBSD: unistd.h,v 1.55 2013/12/19 19:11:50 rmind Exp $ */
|
---|---|
2 |
|
3 |
/*
|
4 |
* Copyright (c) 1989, 1993
|
5 |
* The Regents of the University of California. All rights reserved.
|
6 |
*
|
7 |
* Redistribution and use in source and binary forms, with or without
|
8 |
* modification, are permitted provided that the following conditions
|
9 |
* are met:
|
10 |
* 1. Redistributions of source code must retain the above copyright
|
11 |
* notice, this list of conditions and the following disclaimer.
|
12 |
* 2. Redistributions in binary form must reproduce the above copyright
|
13 |
* notice, this list of conditions and the following disclaimer in the
|
14 |
* documentation and/or other materials provided with the distribution.
|
15 |
* 3. Neither the name of the University nor the names of its contributors
|
16 |
* may be used to endorse or promote products derived from this software
|
17 |
* without specific prior written permission.
|
18 |
*
|
19 |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
20 |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
21 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
22 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
23 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
24 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
25 |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
26 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
27 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
28 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
29 |
* SUCH DAMAGE.
|
30 |
*
|
31 |
* @(#)unistd.h 8.2 (Berkeley) 1/7/94
|
32 |
*/
|
33 |
|
34 |
#ifndef _SYS_UNISTD_H_
|
35 |
#define _SYS_UNISTD_H_
|
36 |
|
37 |
#include <sys/featuretest.h> |
38 |
|
39 |
/* compile-time symbolic constants */
|
40 |
#define _POSIX_JOB_CONTROL 1 |
41 |
/* implementation supports job control */
|
42 |
|
43 |
/*
|
44 |
* According to POSIX 1003.1:
|
45 |
* "The saved set-user-ID capability allows a program to regain the
|
46 |
* effective user ID established at the last exec call."
|
47 |
* However, the setuid/setgid function as specified by POSIX 1003.1 does
|
48 |
* not allow changing the effective ID from the super-user without also
|
49 |
* changed the saved ID, so it is impossible to get super-user privileges
|
50 |
* back later. Instead we provide this feature independent of the current
|
51 |
* effective ID through the seteuid/setegid function. In addition, we do
|
52 |
* not use the saved ID as specified by POSIX 1003.1 in setuid/setgid,
|
53 |
* because this would make it impossible for a set-user-ID executable
|
54 |
* owned by a user other than the super-user to permanently revoke its
|
55 |
* extra privileges.
|
56 |
*/
|
57 |
#ifdef _NOT_AVAILABLE
|
58 |
#define _POSIX_SAVED_IDS 1 |
59 |
/* saved set-user-ID and set-group-ID */
|
60 |
#endif
|
61 |
|
62 |
#define _POSIX_VERSION 200112L |
63 |
#define _POSIX2_VERSION 200112L |
64 |
|
65 |
#if !defined(__minix)
|
66 |
/*
|
67 |
* We support the posix_spawn() family of functions (unconditionally).
|
68 |
*/
|
69 |
#define _POSIX_SPAWN 200809L |
70 |
#endif /* !defined(__minix) */ |
71 |
|
72 |
/* execution-time symbolic constants */
|
73 |
|
74 |
/*
|
75 |
* POSIX options and option groups we unconditionally do or don't
|
76 |
* implement. Those options which are implemented (or not) entirely
|
77 |
* in user mode are defined in <unistd.h>. Please keep this list in
|
78 |
* alphabetical order.
|
79 |
*
|
80 |
* Anything which is defined as zero below **must** have an
|
81 |
* implementation for the corresponding sysconf() which is able to
|
82 |
* determine conclusively whether or not the feature is supported.
|
83 |
* Anything which is defined as other than -1 below **must** have
|
84 |
* complete headers, types, and function declarations as specified by
|
85 |
* the POSIX standard; however, if the relevant sysconf() function
|
86 |
* returns -1, the functions may be stubbed out.
|
87 |
*/
|
88 |
/* Advisory information */
|
89 |
#undef _POSIX_ADVISORY_INFO
|
90 |
/* asynchronous I/O is available */
|
91 |
#define _POSIX_ASYNCHRONOUS_IO 200112L |
92 |
/* barriers */
|
93 |
#define _POSIX_BARRIERS 200112L |
94 |
/* chown requires correct privileges */
|
95 |
#define _POSIX_CHOWN_RESTRICTED 1 |
96 |
/* clock selection */
|
97 |
#define _POSIX_CLOCK_SELECTION -1 |
98 |
/* CPU type */
|
99 |
#undef _POSIX_CPUTYPE
|
100 |
/* file synchronization is available */
|
101 |
#define _POSIX_FSYNC 1 |
102 |
/* support IPv6 */
|
103 |
#define _POSIX_IPV6 0 |
104 |
/* job control is available */
|
105 |
#define _POSIX_JOB_CONTROL 1 |
106 |
/* memory mapped files */
|
107 |
#define _POSIX_MAPPED_FILES 1 |
108 |
/* memory locking whole address space */
|
109 |
#define _POSIX_MEMLOCK 1 |
110 |
/* memory locking address ranges */
|
111 |
#define _POSIX_MEMLOCK_RANGE 1 |
112 |
/* memory access protections */
|
113 |
#define _POSIX_MEMORY_PROTECTION 1 |
114 |
/* message passing is available */
|
115 |
#define _POSIX_MESSAGE_PASSING 200112L |
116 |
/* monotonic clock */
|
117 |
#define _POSIX_MONOTONIC_CLOCK 200112L |
118 |
/* too-long path comp generate errors */
|
119 |
#define _POSIX_NO_TRUNC 1 |
120 |
/* prioritized I/O */
|
121 |
#define _POSIX_PRIORITIZED_IO -1 |
122 |
/* priority scheduling */
|
123 |
#define _POSIX_PRIORITY_SCHEDULING 200112L |
124 |
/* raw sockets */
|
125 |
#define _POSIX_RAW_SOCKETS 200112L |
126 |
/* read/write locks */
|
127 |
#define _POSIX_READER_WRITER_LOCKS 200112L |
128 |
/* realtime signals */
|
129 |
#undef _POSIX_REALTIME_SIGNALS
|
130 |
/* regular expressions */
|
131 |
#define _POSIX_REGEXP 1 |
132 |
/* semaphores */
|
133 |
#define _POSIX_SEMAPHORES 0 |
134 |
/* shared memory objects */
|
135 |
#define _POSIX_SHARED_MEMORY_OBJECTS 0 |
136 |
/* shell */
|
137 |
#define _POSIX_SHELL 1 |
138 |
/* spin locks */
|
139 |
#define _POSIX_SPIN_LOCKS 200112L |
140 |
/* sporadic server */
|
141 |
#undef _POSIX_SPORADIC_SERVER
|
142 |
/* synchronized I/O is available */
|
143 |
#define _POSIX_SYNCHRONIZED_IO 1 |
144 |
/* threads */
|
145 |
#define _POSIX_THREADS 200112L |
146 |
/* pthread_attr for stack size */
|
147 |
#define _POSIX_THREAD_ATTR_STACKSIZE 200112L |
148 |
/* pthread_attr for stack address */
|
149 |
#define _POSIX_THREAD_ATTR_STACKADDR 200112L |
150 |
/* _r functions */
|
151 |
#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L |
152 |
/* timeouts */
|
153 |
#undef _POSIX_TIMEOUTS
|
154 |
/* timers */
|
155 |
#define _POSIX_TIMERS 200112L |
156 |
/* typed memory objects */
|
157 |
#undef _POSIX_TYPED_MEMORY_OBJECTS
|
158 |
/* may disable terminal spec chars */
|
159 |
#define _POSIX_VDISABLE __CAST(unsigned char, '\377') |
160 |
|
161 |
/* C binding */
|
162 |
#define _POSIX2_C_BIND 200112L |
163 |
|
164 |
/* XPG4.2 shared memory */
|
165 |
#define _XOPEN_SHM 0 |
166 |
|
167 |
/* access function */
|
168 |
#define F_OK 0 /* test for existence of file */ |
169 |
#define X_OK 0x01 /* test for execute or search permission */ |
170 |
#define W_OK 0x02 /* test for write permission */ |
171 |
#define R_OK 0x04 /* test for read permission */ |
172 |
|
173 |
/* whence values for lseek(2) */
|
174 |
#define SEEK_SET 0 /* set file offset to offset */ |
175 |
#define SEEK_CUR 1 /* set file offset to current plus offset */ |
176 |
#define SEEK_END 2 /* set file offset to EOF plus offset */ |
177 |
|
178 |
#if defined(_NETBSD_SOURCE)
|
179 |
/* whence values for lseek(2); renamed by POSIX 1003.1 */
|
180 |
#define L_SET SEEK_SET
|
181 |
#define L_INCR SEEK_CUR
|
182 |
#define L_XTND SEEK_END
|
183 |
|
184 |
/*
|
185 |
* fsync_range values.
|
186 |
*
|
187 |
* Note the following flag values were chosen to not overlap
|
188 |
* values for SEEK_XXX flags. While not currently implemented,
|
189 |
* it is possible to extend this call to respect SEEK_CUR and
|
190 |
* SEEK_END offset addressing modes.
|
191 |
*/
|
192 |
#define FDATASYNC 0x0010 /* sync data and minimal metadata */ |
193 |
#define FFILESYNC 0x0020 /* sync data and metadata */ |
194 |
#define FDISKSYNC 0x0040 /* flush disk caches after sync */ |
195 |
#endif
|
196 |
|
197 |
/* configurable pathname variables; use as argument to pathconf(3) */
|
198 |
#define _PC_LINK_MAX 1 |
199 |
#define _PC_MAX_CANON 2 |
200 |
#define _PC_MAX_INPUT 3 |
201 |
#define _PC_NAME_MAX 4 |
202 |
#define _PC_PATH_MAX 5 |
203 |
#define _PC_PIPE_BUF 6 |
204 |
#define _PC_CHOWN_RESTRICTED 7 |
205 |
#define _PC_NO_TRUNC 8 |
206 |
#define _PC_VDISABLE 9 |
207 |
#define _PC_SYNC_IO 10 |
208 |
#define _PC_FILESIZEBITS 11 |
209 |
#define _PC_SYMLINK_MAX 12 |
210 |
#define _PC_2_SYMLINKS 13 |
211 |
#define _PC_ACL_EXTENDED 14 |
212 |
|
213 |
/* From OpenSolaris, used by SEEK_DATA/SEEK_HOLE. */
|
214 |
#define _PC_MIN_HOLE_SIZE 15 |
215 |
|
216 |
/* configurable system variables; use as argument to sysconf(3) */
|
217 |
/*
|
218 |
* XXX The value of _SC_CLK_TCK is embedded in <time.h>.
|
219 |
* XXX The value of _SC_PAGESIZE is embedded in <sys/shm.h>.
|
220 |
*/
|
221 |
#define _SC_ARG_MAX 1 |
222 |
#define _SC_CHILD_MAX 2 |
223 |
#define _O_SC_CLK_TCK 3 /* Old version, always 100 */ |
224 |
#define _SC_NGROUPS_MAX 4 |
225 |
#define _SC_OPEN_MAX 5 |
226 |
#define _SC_JOB_CONTROL 6 |
227 |
#define _SC_SAVED_IDS 7 |
228 |
#define _SC_VERSION 8 |
229 |
#define _SC_BC_BASE_MAX 9 |
230 |
#define _SC_BC_DIM_MAX 10 |
231 |
#define _SC_BC_SCALE_MAX 11 |
232 |
#define _SC_BC_STRING_MAX 12 |
233 |
#define _SC_COLL_WEIGHTS_MAX 13 |
234 |
#define _SC_EXPR_NEST_MAX 14 |
235 |
#define _SC_LINE_MAX 15 |
236 |
#define _SC_RE_DUP_MAX 16 |
237 |
#define _SC_2_VERSION 17 |
238 |
#define _SC_2_C_BIND 18 |
239 |
#define _SC_2_C_DEV 19 |
240 |
#define _SC_2_CHAR_TERM 20 |
241 |
#define _SC_2_FORT_DEV 21 |
242 |
#define _SC_2_FORT_RUN 22 |
243 |
#define _SC_2_LOCALEDEF 23 |
244 |
#define _SC_2_SW_DEV 24 |
245 |
#define _SC_2_UPE 25 |
246 |
#define _SC_STREAM_MAX 26 |
247 |
#define _SC_TZNAME_MAX 27 |
248 |
#define _SC_PAGESIZE 28 |
249 |
#define _SC_PAGE_SIZE _SC_PAGESIZE /* 1170 compatibility */ |
250 |
#define _SC_FSYNC 29 |
251 |
#define _SC_XOPEN_SHM 30 |
252 |
#define _SC_SYNCHRONIZED_IO 31 |
253 |
#define _SC_IOV_MAX 32 |
254 |
#define _SC_MAPPED_FILES 33 |
255 |
#define _SC_MEMLOCK 34 |
256 |
#define _SC_MEMLOCK_RANGE 35 |
257 |
#define _SC_MEMORY_PROTECTION 36 |
258 |
#define _SC_LOGIN_NAME_MAX 37 |
259 |
#define _SC_MONOTONIC_CLOCK 38 |
260 |
#define _SC_CLK_TCK 39 /* New, variable version */ |
261 |
#define _SC_ATEXIT_MAX 40 |
262 |
#define _SC_THREADS 41 |
263 |
#define _SC_SEMAPHORES 42 |
264 |
#define _SC_BARRIERS 43 |
265 |
#define _SC_TIMERS 44 |
266 |
#define _SC_SPIN_LOCKS 45 |
267 |
#define _SC_READER_WRITER_LOCKS 46 |
268 |
#define _SC_GETGR_R_SIZE_MAX 47 |
269 |
#define _SC_GETPW_R_SIZE_MAX 48 |
270 |
#define _SC_CLOCK_SELECTION 49 |
271 |
#define _SC_ASYNCHRONOUS_IO 50 |
272 |
#define _SC_AIO_LISTIO_MAX 51 |
273 |
#define _SC_AIO_MAX 52 |
274 |
#define _SC_MESSAGE_PASSING 53 |
275 |
#define _SC_MQ_OPEN_MAX 54 |
276 |
#define _SC_MQ_PRIO_MAX 55 |
277 |
#define _SC_PRIORITY_SCHEDULING 56 |
278 |
#define _SC_THREAD_DESTRUCTOR_ITERATIONS 57 |
279 |
#define _SC_THREAD_KEYS_MAX 58 |
280 |
#define _SC_THREAD_STACK_MIN 59 |
281 |
#define _SC_THREAD_THREADS_MAX 60 |
282 |
#define _SC_THREAD_ATTR_STACKADDR 61 |
283 |
#define _SC_THREAD_ATTR_STACKSIZE 62 |
284 |
#define _SC_THREAD_PRIORITY_SCHEDULING 63 |
285 |
#define _SC_THREAD_PRIO_INHERIT 64 |
286 |
#define _SC_THREAD_PRIO_PROTECT 65 |
287 |
#define _SC_THREAD_PROCESS_SHARED 66 |
288 |
#define _SC_THREAD_SAFE_FUNCTIONS 67 |
289 |
#define _SC_TTY_NAME_MAX 68 |
290 |
#define _SC_HOST_NAME_MAX 69 |
291 |
#define _SC_PASS_MAX 70 |
292 |
#define _SC_REGEXP 71 |
293 |
#define _SC_SHELL 72 |
294 |
#define _SC_SYMLOOP_MAX 73 |
295 |
|
296 |
/* Actually, they are not supported or implemented yet */
|
297 |
#define _SC_V6_ILP32_OFF32 74 |
298 |
#define _SC_V6_ILP32_OFFBIG 75 |
299 |
#define _SC_V6_LP64_OFF64 76 |
300 |
#define _SC_V6_LPBIG_OFFBIG 77 |
301 |
#define _SC_2_PBS 80 |
302 |
#define _SC_2_PBS_ACCOUNTING 81 |
303 |
#define _SC_2_PBS_CHECKPOINT 82 |
304 |
#define _SC_2_PBS_LOCATE 83 |
305 |
#define _SC_2_PBS_MESSAGE 84 |
306 |
#define _SC_2_PBS_TRACK 85 |
307 |
|
308 |
/* These are implemented */
|
309 |
#define _SC_SPAWN 86 |
310 |
#define _SC_SHARED_MEMORY_OBJECTS 87 |
311 |
|
312 |
/* Extensions found in Solaris and Linux. */
|
313 |
#define _SC_PHYS_PAGES 121 |
314 |
|
315 |
#ifdef _NETBSD_SOURCE
|
316 |
/* Commonly provided sysconf() extensions */
|
317 |
#define _SC_NPROCESSORS_CONF 1001 |
318 |
#define _SC_NPROCESSORS_ONLN 1002 |
319 |
/* Native variables */
|
320 |
#define _SC_SCHED_RT_TS 2001 |
321 |
#define _SC_SCHED_PRI_MIN 2002 |
322 |
#define _SC_SCHED_PRI_MAX 2003 |
323 |
#endif /* _NETBSD_SOURCE */ |
324 |
|
325 |
/* configurable system strings */
|
326 |
#define _CS_PATH 1 |
327 |
|
328 |
#endif /* !_SYS_UNISTD_H_ */ |