Print this page
5798 fexecve() needed per POSIX 2008
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/head/unistd.h
+++ new/usr/src/head/unistd.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24 24 * Copyright (c) 2013 Gary Mills
25 25 *
26 26 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
27 27 */
28 28
29 29 /* Copyright (c) 1988 AT&T */
30 30 /* All Rights Reserved */
31 31
32 32 /* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */
33 33
34 34 #ifndef _UNISTD_H
35 35 #define _UNISTD_H
36 36
37 37 #include <sys/feature_tests.h>
38 38
39 39 #include <sys/types.h>
40 40 #include <sys/unistd.h>
41 41
42 42 #ifdef __cplusplus
43 43 extern "C" {
44 44 #endif
45 45
46 46 /* Symbolic constants for the "access" routine: */
47 47 #define R_OK 4 /* Test for Read permission */
48 48 #define W_OK 2 /* Test for Write permission */
49 49 #define X_OK 1 /* Test for eXecute permission */
50 50 #define F_OK 0 /* Test for existence of File */
51 51
52 52 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
53 53 #define F_ULOCK 0 /* Unlock a previously locked region */
54 54 #define F_LOCK 1 /* Lock a region for exclusive use */
55 55 #define F_TLOCK 2 /* Test and lock a region for exclusive use */
56 56 #define F_TEST 3 /* Test a region for other processes locks */
57 57 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
58 58
59 59 /* Symbolic constants for the "lseek" routine: */
60 60
61 61 #ifndef SEEK_SET
62 62 #define SEEK_SET 0 /* Set file pointer to "offset" */
63 63 #endif
64 64
65 65 #ifndef SEEK_CUR
66 66 #define SEEK_CUR 1 /* Set file pointer to current plus "offset" */
67 67 #endif
68 68
69 69 #ifndef SEEK_END
70 70 #define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
71 71 #endif
72 72
73 73 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
74 74 #ifndef SEEK_DATA
75 75 #define SEEK_DATA 3 /* Set file pointer to next data past offset */
76 76 #endif
77 77
78 78 #ifndef SEEK_HOLE
79 79 #define SEEK_HOLE 4 /* Set file pointer to next hole past offset */
80 80 #endif
81 81 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
82 82
83 83 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
84 84 /* Path names: */
85 85 #define GF_PATH "/etc/group" /* Path name of the "group" file */
86 86 #define PF_PATH "/etc/passwd" /* Path name of the "passwd" file */
87 87 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
88 88
89 89 /*
90 90 * compile-time symbolic constants,
91 91 * Support does not mean the feature is enabled.
92 92 * Use pathconf/sysconf to obtain actual configuration value.
93 93 */
94 94
95 95 /* Values unchanged in UNIX 03 */
96 96 #define _POSIX_ASYNC_IO 1
97 97 #define _POSIX_JOB_CONTROL 1
98 98 #define _POSIX_SAVED_IDS 1
99 99 #define _POSIX_SYNC_IO 1
100 100
101 101 /*
102 102 * POSIX.1b compile-time symbolic constants.
103 103 */
104 104 #if defined(_XPG6)
105 105 #define _POSIX_ASYNCHRONOUS_IO 200112L
106 106 #define _POSIX_FSYNC 200112L
107 107 #define _POSIX_MAPPED_FILES 200112L
108 108 #define _POSIX_MEMLOCK 200112L
109 109 #define _POSIX_MEMLOCK_RANGE 200112L
110 110 #define _POSIX_MEMORY_PROTECTION 200112L
111 111 #define _POSIX_MESSAGE_PASSING 200112L
112 112 #define _POSIX_PRIORITY_SCHEDULING 200112L
113 113 #define _POSIX_REALTIME_SIGNALS 200112L
114 114 #define _POSIX_SEMAPHORES 200112L
115 115 #define _POSIX_SHARED_MEMORY_OBJECTS 200112L
116 116 #define _POSIX_SYNCHRONIZED_IO 200112L
117 117 #else
118 118 #define _POSIX_ASYNCHRONOUS_IO 1
119 119 #define _POSIX_FSYNC 1
120 120 #define _POSIX_MAPPED_FILES 1
121 121 #define _POSIX_MEMLOCK 1
122 122 #define _POSIX_MEMLOCK_RANGE 1
123 123 #define _POSIX_MEMORY_PROTECTION 1
124 124 #define _POSIX_MESSAGE_PASSING 1
125 125 #define _POSIX_PRIORITY_SCHEDULING 1
126 126 #define _POSIX_REALTIME_SIGNALS 1
127 127 #define _POSIX_SEMAPHORES 1
128 128 #define _POSIX_SHARED_MEMORY_OBJECTS 1
129 129 #define _POSIX_SYNCHRONIZED_IO 1
130 130 #endif
131 131
132 132 /*
133 133 * POSIX.1c compile-time symbolic constants.
134 134 */
135 135 #if defined(_XPG6)
136 136 #define _POSIX_THREAD_SAFE_FUNCTIONS 200112L
137 137 #define _POSIX_THREADS 200112L
138 138 #define _POSIX_THREAD_ATTR_STACKADDR 200112L
139 139 #define _POSIX_THREAD_ATTR_STACKSIZE 200112L
140 140 #define _POSIX_THREAD_PROCESS_SHARED 200112L
141 141 #define _POSIX_THREAD_PRIORITY_SCHEDULING 200112L
142 142 #define _POSIX_TIMERS 200112L
143 143 #else
144 144 #define _POSIX_THREAD_SAFE_FUNCTIONS 1
145 145 #define _POSIX_THREADS 1
146 146 #define _POSIX_THREAD_ATTR_STACKADDR 1
147 147 #define _POSIX_THREAD_ATTR_STACKSIZE 1
148 148 #define _POSIX_THREAD_PROCESS_SHARED 1
149 149 #define _POSIX_THREAD_PRIORITY_SCHEDULING 1
150 150 #define _POSIX_TIMERS 1
151 151 #endif
152 152
153 153 /* New in UNIX 03 */
154 154 #define _POSIX_ADVISORY_INFO 200112L
155 155 #define _POSIX_BARRIERS 200112L
156 156 #define _POSIX_CLOCK_SELECTION 200112L
157 157 #define _POSIX_IPV6 200112L
158 158 #define _POSIX_MONOTONIC_CLOCK 200112L
159 159 #define _POSIX_RAW_SOCKETS 200112L
160 160 #define _POSIX_READER_WRITER_LOCKS 200112L
161 161 #define _POSIX_SPAWN 200112L
162 162 #define _POSIX_SPIN_LOCKS 200112L
163 163 #define _POSIX_TIMEOUTS 200112L
164 164
165 165 /*
166 166 * Support for the POSIX.1 mutex protocol attribute. For realtime applications
167 167 * which need mutexes to support priority inheritance/ceiling.
168 168 */
169 169 #if defined(_XPG6)
170 170 #define _POSIX_THREAD_PRIO_INHERIT 200112L
171 171 #define _POSIX_THREAD_PRIO_PROTECT 200112L
172 172 #else
173 173 #define _POSIX_THREAD_PRIO_INHERIT 1
174 174 #define _POSIX_THREAD_PRIO_PROTECT 1
175 175 #endif
176 176
177 177 #ifndef _POSIX_VDISABLE
178 178 #define _POSIX_VDISABLE 0
179 179 #endif
180 180
181 181 #ifndef NULL
182 182 #if defined(_LP64)
183 183 #define NULL 0L
184 184 #else
185 185 #define NULL 0
186 186 #endif
187 187 #endif
188 188
189 189 #define STDIN_FILENO 0
190 190 #define STDOUT_FILENO 1
191 191 #define STDERR_FILENO 2
192 192
193 193 /*
194 194 * Large File Summit-related announcement macros. The system supports both
195 195 * the additional and transitional Large File Summit interfaces. (The final
196 196 * two macros provide a finer granularity breakdown of _LFS64_LARGEFILE.)
197 197 */
198 198 #define _LFS_LARGEFILE 1
199 199 #define _LFS64_LARGEFILE 1
200 200 #define _LFS64_STDIO 1
201 201 #define _LFS64_ASYNCHRONOUS_IO 1
202 202
203 203 /* large file compilation environment setup */
204 204 #if !defined(_LP64) && _FILE_OFFSET_BITS == 64
205 205 #ifdef __PRAGMA_REDEFINE_EXTNAME
206 206 #pragma redefine_extname ftruncate ftruncate64
207 207 #pragma redefine_extname lseek lseek64
208 208 #pragma redefine_extname pread pread64
209 209 #pragma redefine_extname pwrite pwrite64
210 210 #pragma redefine_extname truncate truncate64
211 211 #pragma redefine_extname lockf lockf64
212 212 #pragma redefine_extname tell tell64
213 213 #else /* __PRAGMA_REDEFINE_EXTNAME */
214 214 #define ftruncate ftruncate64
215 215 #define lseek lseek64
216 216 #define pread pread64
217 217 #define pwrite pwrite64
218 218 #define truncate truncate64
219 219 #define lockf lockf64
220 220 #define tell tell64
221 221 #endif /* __PRAGMA_REDEFINE_EXTNAME */
222 222 #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */
223 223
224 224 /* In the LP64 compilation environment, the APIs are already large file */
225 225 #if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
226 226 #ifdef __PRAGMA_REDEFINE_EXTNAME
227 227 #pragma redefine_extname ftruncate64 ftruncate
228 228 #pragma redefine_extname lseek64 lseek
229 229 #pragma redefine_extname pread64 pread
230 230 #pragma redefine_extname pwrite64 pwrite
231 231 #pragma redefine_extname truncate64 truncate
232 232 #pragma redefine_extname lockf64 lockf
233 233 #pragma redefine_extname tell64 tell
234 234 #else /* __PRAGMA_REDEFINE_EXTNAME */
235 235 #define ftruncate64 ftruncate
236 236 #define lseek64 lseek
237 237 #define pread64 pread
238 238 #define pwrite64 pwrite
239 239 #define truncate64 truncate
240 240 #define lockf64 lockf
241 241 #define tell64 tell
242 242 #endif /* __PRAGMA_REDEFINE_EXTNAME */
243 243 #endif /* _LP64 && _LARGEFILE64_SOURCE */
244 244
245 245 extern int access(const char *, int);
246 246 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
247 247 extern int acct(const char *);
248 248 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
249 249 extern unsigned alarm(unsigned);
250 250 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
251 251 #if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \
252 252 defined(__EXTENSIONS__)
253 253 extern int brk(void *);
254 254 #endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */
255 255 extern int chdir(const char *);
256 256 extern int chown(const char *, uid_t, gid_t);
257 257 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
258 258 #if !defined(_POSIX_C_SOURCE) || (defined(_XOPEN_SOURCE) && \
259 259 !defined(_XPG6)) || defined(__EXTENSIONS__)
260 260 extern int chroot(const char *);
261 261 #endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE))... */
262 262 extern int close(int);
263 263 #if defined(_XPG4) || defined(__EXTENSIONS__)
264 264 extern size_t confstr(int, char *, size_t);
265 265 extern char *crypt(const char *, const char *);
266 266 #endif /* defined(_XPG4) || defined(__EXTENSIONS__) */
267 267 #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
268 268 defined(__EXTENSIONS__)
269 269 extern char *ctermid(char *);
270 270 #endif /* (!defined(_POSIX_C_SOURCE) ... */
271 271 #if !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) || defined(__EXTENSIONS__)
272 272 extern char *ctermid_r(char *);
273 273 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) ... */
274 274 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
275 275 #if !defined(_XPG6) || defined(__EXTENSIONS__)
276 276 extern char *cuserid(char *);
277 277 #endif
278 278 extern int dup(int);
279 279 extern int dup2(int, int);
280 280 extern int dup3(int, int, int);
281 281 #if defined(_XPG4) || defined(__EXTENSIONS__)
282 282 extern void encrypt(char *, int);
↓ open down ↓ |
282 lines elided |
↑ open up ↑ |
283 283 #endif /* defined(XPG4) || defined(__EXTENSIONS__) */
284 284 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
285 285 extern void endusershell(void);
286 286 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
287 287 extern int execl(const char *, const char *, ...);
288 288 extern int execle(const char *, const char *, ...);
289 289 extern int execlp(const char *, const char *, ...);
290 290 extern int execv(const char *, char *const *);
291 291 extern int execve(const char *, char *const *, char *const *);
292 292 extern int execvp(const char *, char *const *);
293 +#if defined(_XPG7) || !defined(_STRICT_SYMBOLS)
294 +extern int fexecve(int, char *const[], char *const[]);
295 +#endif
293 296 extern void _exit(int)
294 297 __NORETURN;
295 298 /*
296 299 * The following fattach prototype is duplicated in <stropts.h>. The
297 300 * duplication is necessitated by XPG4.2 which requires the prototype
298 301 * be defined in <stropts.h>.
299 302 */
300 303 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
301 304 extern int fattach(int, const char *);
302 305 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
303 306 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
304 307 extern int fchdir(int);
305 308 extern int fchown(int, uid_t, gid_t);
306 309 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
307 310 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
308 311 extern int fchroot(int);
309 312 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
310 313 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \
311 314 defined(__EXTENSIONS__)
312 315 extern int fdatasync(int);
313 316 #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */
314 317 /*
315 318 * The following fdetach prototype is duplicated in <stropts.h>. The
316 319 * duplication is necessitated by XPG4.2 which requires the prototype
317 320 * be defined in <stropts.h>.
318 321 */
319 322 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
320 323 extern int fdetach(const char *);
321 324 #endif /* !defined(__XOPEN_OR_POSIX)... */
322 325 extern pid_t fork(void);
323 326 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
324 327 extern pid_t fork1(void);
325 328 extern pid_t forkall(void);
326 329 #endif /* !defined(__XOPEN_OR_POSIX)... */
327 330 extern long fpathconf(int, int);
328 331 #if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2) || \
329 332 defined(__EXTENSIONS__)
330 333 extern int fsync(int);
331 334 #endif /* !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2)... */
332 335 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) || \
333 336 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
334 337 defined(__EXTENSIONS__)
335 338 extern int ftruncate(int, off_t);
336 339 #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */
337 340 extern char *getcwd(char *, size_t);
338 341 #if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \
339 342 defined(__EXTENSIONS__)
340 343 extern int getdtablesize(void);
341 344 #endif
342 345 extern gid_t getegid(void);
343 346 extern uid_t geteuid(void);
344 347 extern gid_t getgid(void);
345 348 extern int getgroups(int, gid_t *);
346 349 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
347 350 extern long gethostid(void);
348 351 #endif
349 352 #if defined(_XPG4_2)
350 353 extern int gethostname(char *, size_t);
351 354 #elif !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
352 355 extern int gethostname(char *, int);
353 356 #endif
354 357
355 358 #ifndef __GETLOGIN_DEFINED /* Avoid duplicate in stdlib.h */
356 359 #define __GETLOGIN_DEFINED
357 360 #ifndef __USE_LEGACY_LOGNAME__
358 361 #ifdef __PRAGMA_REDEFINE_EXTNAME
359 362 #pragma redefine_extname getlogin getloginx
360 363 #else /* __PRAGMA_REDEFINE_EXTNAME */
361 364 extern char *getloginx(void);
362 365 #define getlogin getloginx
363 366 #endif /* __PRAGMA_REDEFINE_EXTNAME */
364 367 #endif /* __USE_LEGACY_LOGNAME__ */
365 368 extern char *getlogin(void);
366 369 #endif /* __GETLOGIN_DEFINED */
367 370
368 371 #if defined(_XPG4) || defined(__EXTENSIONS__)
369 372 extern int getopt(int, char *const *, const char *);
370 373 extern char *optarg;
371 374 extern int opterr, optind, optopt;
372 375 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
373 376 #if !defined(_XPG6) || defined(__EXTENSIONS__)
374 377 extern char *getpass(const char *);
375 378 #endif
376 379 #endif /* defined(_XPG4) || defined(__EXTENSIONS__) */
377 380 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
378 381 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
379 382 #if !defined(_XPG6) || defined(__EXTENSIONS__)
380 383 extern int getpagesize(void);
381 384 #endif
382 385 extern pid_t getpgid(pid_t);
383 386 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
384 387 extern pid_t getpid(void);
385 388 extern pid_t getppid(void);
386 389 extern pid_t getpgrp(void);
387 390
388 391 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
389 392 char *gettxt(const char *, const char *);
390 393 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
391 394 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
392 395 extern pid_t getsid(pid_t);
393 396 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
394 397 extern uid_t getuid(void);
395 398 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
396 399 extern char *getusershell(void);
397 400 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
398 401 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
399 402 extern char *getwd(char *);
400 403 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
401 404 /*
402 405 * The following ioctl prototype is duplicated in <stropts.h>. The
403 406 * duplication is necessitated by XPG4.2 which requires the prototype
404 407 * be defined in <stropts.h>.
405 408 */
406 409 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
407 410 extern int ioctl(int, int, ...);
408 411 extern int isaexec(const char *, char *const *, char *const *);
409 412 extern int issetugid(void);
410 413 #endif
411 414 extern int isatty(int);
412 415 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
413 416 extern int lchown(const char *, uid_t, gid_t);
414 417 #endif
415 418 extern int link(const char *, const char *);
416 419 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
417 420 extern offset_t llseek(int, offset_t, int);
418 421 #endif
419 422 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
420 423 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
421 424 defined(__EXTENSIONS__)
422 425 extern int lockf(int, int, off_t);
423 426 #endif
424 427 extern off_t lseek(int, off_t, int);
425 428 #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
426 429 defined(__EXTENSIONS__)
427 430 extern int nice(int);
428 431 #endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */
429 432 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
430 433 extern int mincore(caddr_t, size_t, char *);
431 434 #endif
432 435 extern long pathconf(const char *, int);
433 436 extern int pause(void);
434 437 extern int pipe(int *);
435 438 extern int pipe2(int *, int);
436 439 #if !defined(_POSIX_C_SOURCE) || defined(_XPG5) || \
437 440 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
438 441 defined(__EXTENSIONS__)
439 442 extern ssize_t pread(int, void *, size_t, off_t);
440 443 #endif
441 444 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
442 445 extern void profil(unsigned short *, size_t, unsigned long, unsigned int);
443 446 #endif
444 447 /*
445 448 * pthread_atfork() is also declared in <pthread.h> as per SUSv3. The
446 449 * declarations are identical. A change to either one may also require
447 450 * appropriate namespace updates in order to avoid redeclaration
448 451 * warnings in the case where both prototypes are exposed via inclusion
449 452 * of both <pthread.h> and <unistd.h>.
450 453 */
451 454 #if !defined(__XOPEN_OR_POSIX) || \
452 455 ((_POSIX_C_SOURCE > 2) && !defined(_XPG6)) || \
453 456 defined(__EXTENSIONS__)
454 457 extern int pthread_atfork(void (*) (void), void (*) (void), void (*) (void));
455 458 #endif /* !defined(__XOPEN_OR_POSIX) || ((_POSIX_C_SOURCE > 2) ... */
456 459 #if !defined(_LP64) && \
457 460 (!defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__))
458 461 extern int ptrace(int, pid_t, int, int);
459 462 #endif
460 463 #if !defined(_POSIX_C_SOURCE) || defined(_XPG5) || \
461 464 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
462 465 defined(__EXTENSIONS__)
463 466 extern ssize_t pwrite(int, const void *, size_t, off_t);
464 467 #endif
465 468 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
466 469 /* per RFC 3542; This is also defined in netdb.h */
467 470 extern int rcmd_af(char **, unsigned short, const char *, const char *,
468 471 const char *, int *, int);
469 472 #endif
470 473 extern ssize_t read(int, void *, size_t);
471 474 #if !defined(__XOPEN_OR_POSIX) || \
472 475 defined(_XPG4_2) || defined(__EXTENSIONS__)
473 476 extern ssize_t readlink(const char *_RESTRICT_KYWD, char *_RESTRICT_KYWD,
474 477 size_t);
475 478 #endif
476 479 #if (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3) && !defined(_XPG4))) || \
477 480 defined(__EXTENSIONS__)
478 481 #if __cplusplus >= 199711L
479 482 namespace std {
480 483 #endif
481 484 extern int rename(const char *, const char *);
482 485 #if __cplusplus >= 199711L
483 486 } /* end of namespace std */
484 487
485 488 using std::rename;
486 489 #endif /* __cplusplus >= 199711L */
487 490 #endif /* (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3)... */
488 491 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
489 492 extern int resolvepath(const char *, char *, size_t);
490 493 /* per RFC 3542; This is also defined in netdb.h */
491 494 extern int rexec_af(char **, unsigned short, const char *, const char *,
492 495 const char *, int *, int);
493 496 #endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */
494 497 extern int rmdir(const char *);
495 498 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
496 499 /* per RFC 3542; This is also defined in netdb.h */
497 500 extern int rresvport_af(int *, int);
498 501 #endif
499 502
500 503 #if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \
501 504 defined(__EXTENSIONS__)
502 505 extern void *sbrk(intptr_t);
503 506 #endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */
504 507 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__)
505 508 extern int setegid(gid_t);
506 509 extern int seteuid(uid_t);
507 510 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) ... */
508 511 extern int setgid(gid_t);
509 512 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
510 513 extern int setgroups(int, const gid_t *);
511 514 extern int sethostname(char *, int);
512 515 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
513 516 extern int setpgid(pid_t, pid_t);
514 517 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
515 518 extern pid_t setpgrp(void);
516 519 extern int setregid(gid_t, gid_t);
517 520 extern int setreuid(uid_t, uid_t);
518 521 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
519 522 extern pid_t setsid(void);
520 523 extern int setuid(uid_t);
521 524 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
522 525 extern void setusershell(void);
523 526 #endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */
524 527 extern unsigned sleep(unsigned);
525 528 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
526 529 extern int stime(const time_t *);
527 530 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
528 531 #if defined(_XPG4)
529 532 /* __EXTENSIONS__ makes the SVID Third Edition prototype in stdlib.h visible */
530 533 extern void swab(const void *_RESTRICT_KYWD, void *_RESTRICT_KYWD, ssize_t);
531 534 #endif /* defined(_XPG4) */
532 535 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
533 536 extern int symlink(const char *, const char *);
534 537 extern void sync(void);
535 538 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */
536 539 #if defined(_XPG5) && !defined(_XPG6)
537 540 #ifdef __PRAGMA_REDEFINE_EXTNAME
538 541 #pragma redefine_extname sysconf __sysconf_xpg5
539 542 #else /* __PRAGMA_REDEFINE_EXTNAME */
540 543 #define sysconf __sysconf_xpg5
541 544 #endif /* __PRAGMA_REDEFINE_EXTNAME */
542 545 #endif /* defined(_XPG5) && !defined(_XPG6) */
543 546 extern long sysconf(int);
544 547 extern pid_t tcgetpgrp(int);
545 548 extern int tcsetpgrp(int, pid_t);
546 549 #if !defined(__XOPEN_OR_POSIX) || \
547 550 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
548 551 defined(__EXTENSIONS__)
549 552 extern off_t tell(int);
550 553 #endif /* !defined(__XOPEN_OR_POSIX)... */
551 554 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
552 555 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
553 556 defined(__EXTENSIONS__)
554 557 extern int truncate(const char *, off_t);
555 558 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
556 559 extern char *ttyname(int);
557 560 #if (defined(_XPG4_2) && !defined(_XPG7)) || !defined(_STRICT_SYMBOLS)
558 561 extern useconds_t ualarm(useconds_t, useconds_t);
559 562 #endif
560 563 extern int unlink(const char *);
561 564 #if (defined(_XPG4_2) && !defined(_XPG7)) || !defined(_STRICT_SYMBOLS)
562 565 extern int usleep(useconds_t);
563 566 #endif
564 567 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
565 568 extern pid_t vfork(void) __RETURNS_TWICE;
566 569 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
567 570 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
568 571 extern void vhangup(void);
569 572 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
570 573 extern ssize_t write(int, const void *, size_t);
571 574 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
572 575 extern void yield(void);
573 576 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
574 577
575 578 #if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \
576 579 defined(__EXTENSIONS__)
577 580 /* || defined(_XPG7) */
578 581 extern int faccessat(int, const char *, int, int);
579 582 extern int fchownat(int, const char *, uid_t, gid_t, int);
580 583 extern int linkat(int, const char *, int, const char *, int);
581 584 extern ssize_t readlinkat(int, const char *_RESTRICT_KYWD,
582 585 char *_RESTRICT_KYWD, size_t);
583 586 extern int renameat(int, const char *, int, const char *);
584 587 extern int symlinkat(const char *, int, const char *);
585 588 extern int unlinkat(int, const char *, int);
586 589 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */
587 590 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
588 591 extern int get_nprocs(void);
589 592 extern int get_nprocs_conf(void);
590 593 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
591 594
592 595 /* transitional large file interface versions */
593 596 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
594 597 !defined(__PRAGMA_REDEFINE_EXTNAME))
595 598 extern int ftruncate64(int, off64_t);
596 599 extern off64_t lseek64(int, off64_t, int);
597 600 extern ssize_t pread64(int, void *, size_t, off64_t);
598 601 extern ssize_t pwrite64(int, const void *, size_t, off64_t);
599 602 extern off64_t tell64(int);
600 603 extern int truncate64(const char *, off64_t);
601 604 extern int lockf64(int, int, off64_t);
602 605 #endif /* _LARGEFILE64_SOURCE */
603 606
604 607 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
605 608 #pragma unknown_control_flow(vfork)
606 609 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
607 610
608 611 /*
609 612 * getlogin_r() & ttyname_r() prototypes are defined here.
610 613 */
611 614
612 615 /*
613 616 * Previous releases of Solaris, starting at 2.3, provided definitions of
614 617 * various functions as specified in POSIX.1c, Draft 6. For some of these
615 618 * functions, the final POSIX 1003.1c standard had a different number of
616 619 * arguments and return values.
617 620 *
618 621 * The following segment of this header provides support for the standard
619 622 * interfaces while supporting applications written under earlier
620 623 * releases. The application defines appropriate values of the feature
621 624 * test macros _POSIX_C_SOURCE and _POSIX_PTHREAD_SEMANTICS to indicate
622 625 * whether it was written to expect the Draft 6 or standard versions of
623 626 * these interfaces, before including this header. This header then
624 627 * provides a mapping from the source version of the interface to an
625 628 * appropriate binary interface. Such mappings permit an application
626 629 * to be built from libraries and objects which have mixed expectations
627 630 * of the definitions of these functions.
628 631 *
629 632 * For applications using the Draft 6 definitions, the binary symbol is the
630 633 * same as the source symbol, and no explicit mapping is needed. For the
631 634 * standard interface, the function func() is mapped to the binary symbol
632 635 * _posix_func(). The preferred mechanism for the remapping is a compiler
633 636 * #pragma. If the compiler does not provide such a #pragma, the header file
634 637 * defines a static function func() which calls the _posix_func() version;
635 638 * this has to be done instead of #define since POSIX specifies that an
636 639 * application can #undef the symbol and still be bound to the correct
637 640 * implementation. Unfortunately, the statics confuse lint so we fallback to
638 641 * #define in that case.
639 642 *
640 643 * NOTE: Support for the Draft 6 definitions is provided for compatibility
641 644 * only. New applications/libraries should use the standard definitions.
642 645 */
643 646
644 647 #if defined(__EXTENSIONS__) || defined(_REENTRANT) || \
645 648 !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE - 0 >= 199506L) || \
646 649 defined(_POSIX_PTHREAD_SEMANTICS)
647 650
648 651 #if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
649 652
650 653 #ifndef __USE_LEGACY_LOGNAME__
651 654 #ifdef __PRAGMA_REDEFINE_EXTNAME
652 655 #pragma redefine_extname getlogin_r __posix_getloginx_r
653 656 extern int getlogin_r(char *, int);
654 657 #else /* __PRAGMA_REDEFINE_EXTNAME */
655 658 extern int __posix_getloginx_r(char *, int);
656 659 #define getlogin_r __posix_getloginx_r
657 660 #endif /* __PRAGMA_REDEFINE_EXTNAME */
658 661 #else /* __USE_LEGACY_LOGNAME__ */
659 662 #ifdef __PRAGMA_REDEFINE_EXTNAME
660 663 #pragma redefine_extname getlogin_r __posix_getlogin_r
661 664 extern int getlogin_r(char *, int);
662 665 #else /* __PRAGMA_REDEFINE_EXTNAME */
663 666 extern int __posix_getlogin_r(char *, int);
664 667
665 668 #ifdef __lint
666 669
667 670 #define getlogin_r __posix_getlogin_r
668 671
669 672 #else /* !__lint */
670 673
671 674 static int
672 675 getlogin_r(char *__name, int __len)
673 676 {
674 677 return (__posix_getlogin_r(__name, __len));
675 678 }
676 679
677 680 #endif /* !__lint */
678 681 #endif /* __PRAGMA_REDEFINE_EXTNAME */
679 682 #endif /* __USE_LEGACY_LOGNAME__ */
680 683
681 684 #ifdef __PRAGMA_REDEFINE_EXTNAME
682 685 #pragma redefine_extname ttyname_r __posix_ttyname_r
683 686 extern int ttyname_r(int, char *, size_t);
684 687 #else /* __PRAGMA_REDEFINE_EXTNAME */
685 688 extern int __posix_ttyname_r(int, char *, size_t);
686 689
687 690 #ifdef __lint
688 691
689 692 #define ttyname_r __posix_ttyname_r
690 693
691 694 #else /* !__lint */
692 695
693 696 static int
694 697 ttyname_r(int __fildes, char *__buf, size_t __size)
695 698 {
696 699 return (__posix_ttyname_r(__fildes, __buf, __size));
697 700 }
698 701
699 702 #endif /* !__lint */
700 703 #endif /* __PRAGMA_REDEFINE_EXTNAME */
701 704
702 705 #else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
703 706
704 707 #ifndef __USE_LEGACY_LOGNAME__
705 708 #ifdef __PRAGMA_REDEFINE_EXTNAME
706 709 #pragma redefine_extname getlogin_r getloginx_r
707 710 #else /* __PRAGMA_REDEFINE_EXTNAME */
708 711 extern char *getloginx_r(char *, int);
709 712 #define getlogin_r getloginx_r
710 713 #endif /* __PRAGMA_REDEFINE_EXTNAME */
711 714 #endif /* __USE_LEGACY_LOGNAME__ */
712 715 extern char *getlogin_r(char *, int);
713 716
714 717 extern char *ttyname_r(int, char *, int);
715 718
716 719 #endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
717 720
718 721 #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT)... */
719 722
720 723 #ifdef __cplusplus
721 724 }
722 725 #endif
723 726
724 727 #endif /* _UNISTD_H */
↓ open down ↓ |
422 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX