xref: /illumos-gate/usr/src/head/unistd.h (revision 5dbfd19a)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24  */
25 
26 /*	Copyright (c) 1988 AT&T	*/
27 /*	  All Rights Reserved  	*/
28 
29 /* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */
30 
31 #ifndef _UNISTD_H
32 #define	_UNISTD_H
33 
34 #include <sys/feature_tests.h>
35 
36 #include <sys/types.h>
37 #include <sys/unistd.h>
38 
39 #ifdef	__cplusplus
40 extern "C" {
41 #endif
42 
43 /* Symbolic constants for the "access" routine: */
44 #define	R_OK	4	/* Test for Read permission */
45 #define	W_OK	2	/* Test for Write permission */
46 #define	X_OK	1	/* Test for eXecute permission */
47 #define	F_OK	0	/* Test for existence of File */
48 
49 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
50 #define	F_ULOCK	0	/* Unlock a previously locked region */
51 #define	F_LOCK	1	/* Lock a region for exclusive use */
52 #define	F_TLOCK	2	/* Test and lock a region for exclusive use */
53 #define	F_TEST	3	/* Test a region for other processes locks */
54 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
55 
56 /* Symbolic constants for the "lseek" routine: */
57 
58 #ifndef	SEEK_SET
59 #define	SEEK_SET	0	/* Set file pointer to "offset" */
60 #endif
61 
62 #ifndef	SEEK_CUR
63 #define	SEEK_CUR	1	/* Set file pointer to current plus "offset" */
64 #endif
65 
66 #ifndef	SEEK_END
67 #define	SEEK_END	2	/* Set file pointer to EOF plus "offset" */
68 #endif
69 
70 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
71 #ifndef	SEEK_DATA
72 #define	SEEK_DATA	3	/* Set file pointer to next data past offset */
73 #endif
74 
75 #ifndef	SEEK_HOLE
76 #define	SEEK_HOLE	4	/* Set file pointer to next hole past offset */
77 #endif
78 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
79 
80 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
81 /* Path names: */
82 #define	GF_PATH	"/etc/group"	/* Path name of the "group" file */
83 #define	PF_PATH	"/etc/passwd"	/* Path name of the "passwd" file */
84 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
85 
86 /*
87  * compile-time symbolic constants,
88  * Support does not mean the feature is enabled.
89  * Use pathconf/sysconf to obtain actual configuration value.
90  */
91 
92 /* Values unchanged in UNIX 03 */
93 #define	_POSIX_ASYNC_IO			1
94 #define	_POSIX_JOB_CONTROL		1
95 #define	_POSIX_SAVED_IDS		1
96 #define	_POSIX_SYNC_IO			1
97 
98 /*
99  * POSIX.1b compile-time symbolic constants.
100  */
101 #if defined(_XPG6)
102 #define	_POSIX_ASYNCHRONOUS_IO		200112L
103 #define	_POSIX_FSYNC			200112L
104 #define	_POSIX_MAPPED_FILES		200112L
105 #define	_POSIX_MEMLOCK			200112L
106 #define	_POSIX_MEMLOCK_RANGE		200112L
107 #define	_POSIX_MEMORY_PROTECTION	200112L
108 #define	_POSIX_MESSAGE_PASSING		200112L
109 #define	_POSIX_PRIORITY_SCHEDULING	200112L
110 #define	_POSIX_REALTIME_SIGNALS		200112L
111 #define	_POSIX_SEMAPHORES		200112L
112 #define	_POSIX_SHARED_MEMORY_OBJECTS	200112L
113 #define	_POSIX_SYNCHRONIZED_IO		200112L
114 #else
115 #define	_POSIX_ASYNCHRONOUS_IO		1
116 #define	_POSIX_FSYNC			1
117 #define	_POSIX_MAPPED_FILES		1
118 #define	_POSIX_MEMLOCK			1
119 #define	_POSIX_MEMLOCK_RANGE		1
120 #define	_POSIX_MEMORY_PROTECTION	1
121 #define	_POSIX_MESSAGE_PASSING		1
122 #define	_POSIX_PRIORITY_SCHEDULING	1
123 #define	_POSIX_REALTIME_SIGNALS		1
124 #define	_POSIX_SEMAPHORES		1
125 #define	_POSIX_SHARED_MEMORY_OBJECTS	1
126 #define	_POSIX_SYNCHRONIZED_IO		1
127 #endif
128 
129 /*
130  * POSIX.1c compile-time symbolic constants.
131  */
132 #if defined(_XPG6)
133 #define	_POSIX_THREAD_SAFE_FUNCTIONS		200112L
134 #define	_POSIX_THREADS				200112L
135 #define	_POSIX_THREAD_ATTR_STACKADDR		200112L
136 #define	_POSIX_THREAD_ATTR_STACKSIZE		200112L
137 #define	_POSIX_THREAD_PROCESS_SHARED		200112L
138 #define	_POSIX_THREAD_PRIORITY_SCHEDULING	200112L
139 #define	_POSIX_TIMERS				200112L
140 #else
141 #define	_POSIX_THREAD_SAFE_FUNCTIONS		1
142 #define	_POSIX_THREADS				1
143 #define	_POSIX_THREAD_ATTR_STACKADDR		1
144 #define	_POSIX_THREAD_ATTR_STACKSIZE		1
145 #define	_POSIX_THREAD_PROCESS_SHARED		1
146 #define	_POSIX_THREAD_PRIORITY_SCHEDULING	1
147 #define	_POSIX_TIMERS				1
148 #endif
149 
150 /* New in UNIX 03 */
151 #define	_POSIX_ADVISORY_INFO			200112L
152 #define	_POSIX_BARRIERS				200112L
153 #define	_POSIX_CLOCK_SELECTION			200112L
154 #define	_POSIX_IPV6				200112L
155 #define	_POSIX_MONOTONIC_CLOCK			200112L
156 #define	_POSIX_RAW_SOCKETS			200112L
157 #define	_POSIX_READER_WRITER_LOCKS		200112L
158 #define	_POSIX_SPAWN				200112L
159 #define	_POSIX_SPIN_LOCKS			200112L
160 #define	_POSIX_TIMEOUTS				200112L
161 
162 /*
163  * Support for the POSIX.1 mutex protocol attribute. For realtime applications
164  * which need mutexes to support priority inheritance/ceiling.
165  */
166 #if defined(_XPG6)
167 #define	_POSIX_THREAD_PRIO_INHERIT		200112L
168 #define	_POSIX_THREAD_PRIO_PROTECT		200112L
169 #else
170 #define	_POSIX_THREAD_PRIO_INHERIT		1
171 #define	_POSIX_THREAD_PRIO_PROTECT		1
172 #endif
173 
174 #ifndef _POSIX_VDISABLE
175 #define	_POSIX_VDISABLE		0
176 #endif
177 
178 #ifndef NULL
179 #if defined(_LP64)
180 #define	NULL	0L
181 #else
182 #define	NULL	0
183 #endif
184 #endif
185 
186 #define	STDIN_FILENO	0
187 #define	STDOUT_FILENO	1
188 #define	STDERR_FILENO	2
189 
190 /*
191  * Large File Summit-related announcement macros.  The system supports both
192  * the additional and transitional Large File Summit interfaces.  (The final
193  * two macros provide a finer granularity breakdown of _LFS64_LARGEFILE.)
194  */
195 #define	_LFS_LARGEFILE		1
196 #define	_LFS64_LARGEFILE	1
197 #define	_LFS64_STDIO		1
198 #define	_LFS64_ASYNCHRONOUS_IO	1
199 
200 /* large file compilation environment setup */
201 #if !defined(_LP64) && _FILE_OFFSET_BITS == 64
202 #ifdef	__PRAGMA_REDEFINE_EXTNAME
203 #pragma redefine_extname	ftruncate	ftruncate64
204 #pragma redefine_extname	lseek		lseek64
205 #pragma redefine_extname	pread		pread64
206 #pragma redefine_extname	pwrite		pwrite64
207 #pragma redefine_extname	truncate	truncate64
208 #pragma redefine_extname	lockf		lockf64
209 #pragma	redefine_extname	tell		tell64
210 #else	/* __PRAGMA_REDEFINE_EXTNAME */
211 #define	ftruncate			ftruncate64
212 #define	lseek				lseek64
213 #define	pread				pread64
214 #define	pwrite				pwrite64
215 #define	truncate			truncate64
216 #define	lockf				lockf64
217 #define	tell				tell64
218 #endif	/* __PRAGMA_REDEFINE_EXTNAME */
219 #endif	/* !_LP64 && _FILE_OFFSET_BITS == 64 */
220 
221 /* In the LP64 compilation environment, the APIs are already large file */
222 #if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
223 #ifdef	__PRAGMA_REDEFINE_EXTNAME
224 #pragma redefine_extname	ftruncate64	ftruncate
225 #pragma redefine_extname	lseek64		lseek
226 #pragma redefine_extname	pread64		pread
227 #pragma redefine_extname	pwrite64	pwrite
228 #pragma redefine_extname	truncate64	truncate
229 #pragma redefine_extname	lockf64		lockf
230 #pragma redefine_extname	tell64		tell
231 #else	/* __PRAGMA_REDEFINE_EXTNAME */
232 #define	ftruncate64			ftruncate
233 #define	lseek64				lseek
234 #define	pread64				pread
235 #define	pwrite64			pwrite
236 #define	truncate64			truncate
237 #define	lockf64				lockf
238 #define	tell64				tell
239 #endif	/* __PRAGMA_REDEFINE_EXTNAME */
240 #endif	/* _LP64 && _LARGEFILE64_SOURCE */
241 
242 #if defined(__STDC__)
243 
244 extern int access(const char *, int);
245 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
246 extern int acct(const char *);
247 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
248 extern unsigned alarm(unsigned);
249 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
250 #if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \
251 	defined(__EXTENSIONS__)
252 extern int brk(void *);
253 #endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */
254 extern int chdir(const char *);
255 extern int chown(const char *, uid_t, gid_t);
256 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
257 #if !defined(_POSIX_C_SOURCE) || (defined(_XOPEN_SOURCE) && \
258 	!defined(_XPG6)) || defined(__EXTENSIONS__)
259 extern int chroot(const char *);
260 #endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE))... */
261 extern int close(int);
262 #if defined(_XPG4) || defined(__EXTENSIONS__)
263 extern size_t confstr(int, char *, size_t);
264 extern char *crypt(const char *, const char *);
265 #endif /* defined(_XPG4) || defined(__EXTENSIONS__) */
266 #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
267 	defined(__EXTENSIONS__)
268 extern char *ctermid(char *);
269 #endif /* (!defined(_POSIX_C_SOURCE) ... */
270 #if !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) || defined(__EXTENSIONS__)
271 extern char *ctermid_r(char *);
272 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) ... */
273 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
274 #if !defined(_XPG6) || defined(__EXTENSIONS__)
275 extern char *cuserid(char *);
276 #endif
277 extern int dup(int);
278 extern int dup2(int, int);
279 extern int dup3(int, int, int);
280 #if defined(_XPG4) || defined(__EXTENSIONS__)
281 extern void encrypt(char *, int);
282 #endif /* defined(XPG4) || defined(__EXTENSIONS__) */
283 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
284 extern void endusershell(void);
285 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
286 extern int execl(const char *, const char *, ...);
287 extern int execle(const char *, const char *, ...);
288 extern int execlp(const char *, const char *, ...);
289 extern int execv(const char *, char *const *);
290 extern int execve(const char *, char *const *, char *const *);
291 extern int execvp(const char *, char *const *);
292 extern void _exit(int)
293 	__NORETURN;
294 /*
295  * The following fattach prototype is duplicated in <stropts.h>. The
296  * duplication is necessitated by XPG4.2 which requires the prototype
297  * be defined in <stropts.h>.
298  */
299 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
300 extern int fattach(int, const char *);
301 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
302 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
303 extern int fchdir(int);
304 extern int fchown(int, uid_t, gid_t);
305 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
306 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
307 extern int fchroot(int);
308 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
309 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \
310 	defined(__EXTENSIONS__)
311 extern int fdatasync(int);
312 #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */
313 /*
314  * The following fdetach prototype is duplicated in <stropts.h>. The
315  * duplication is necessitated by XPG4.2 which requires the prototype
316  * be defined in <stropts.h>.
317  */
318 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
319 extern int fdetach(const char *);
320 #endif /* !defined(__XOPEN_OR_POSIX)... */
321 extern pid_t fork(void);
322 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
323 extern pid_t fork1(void);
324 extern pid_t forkall(void);
325 #endif /* !defined(__XOPEN_OR_POSIX)... */
326 extern long fpathconf(int, int);
327 #if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2) || \
328 	defined(__EXTENSIONS__)
329 extern int fsync(int);
330 #endif /* !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2)... */
331 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) || \
332 	(defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
333 	defined(__EXTENSIONS__)
334 extern int ftruncate(int, off_t);
335 #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */
336 extern char *getcwd(char *, size_t);
337 #if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \
338 	defined(__EXTENSIONS__)
339 extern int getdtablesize(void);
340 #endif
341 extern gid_t getegid(void);
342 extern uid_t geteuid(void);
343 extern gid_t getgid(void);
344 extern int getgroups(int, gid_t *);
345 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
346 extern long gethostid(void);
347 #endif
348 #if defined(_XPG4_2)
349 extern int gethostname(char *, size_t);
350 #elif  !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
351 extern int gethostname(char *, int);
352 #endif
353 extern char *getlogin(void);
354 #if defined(_XPG4) || defined(__EXTENSIONS__)
355 extern int  getopt(int, char *const *, const char *);
356 extern char *optarg;
357 extern int  opterr, optind, optopt;
358 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
359 #if !defined(_XPG6) || defined(__EXTENSIONS__)
360 extern char *getpass(const char *);
361 #endif
362 #endif /* defined(_XPG4) || defined(__EXTENSIONS__) */
363 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
364 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
365 #if !defined(_XPG6) || defined(__EXTENSIONS__)
366 extern int getpagesize(void);
367 #endif
368 extern pid_t getpgid(pid_t);
369 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
370 extern pid_t getpid(void);
371 extern pid_t getppid(void);
372 extern pid_t getpgrp(void);
373 
374 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
375 char *gettxt(const char *, const char *);
376 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
377 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
378 extern pid_t getsid(pid_t);
379 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
380 extern uid_t getuid(void);
381 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
382 extern char *getusershell(void);
383 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
384 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
385 extern char *getwd(char *);
386 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
387 /*
388  * The following ioctl prototype is duplicated in <stropts.h>. The
389  * duplication is necessitated by XPG4.2 which requires the prototype
390  * be defined in <stropts.h>.
391  */
392 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
393 extern int ioctl(int, int, ...);
394 extern int isaexec(const char *, char *const *, char *const *);
395 extern int issetugid(void);
396 #endif
397 extern int isatty(int);
398 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
399 extern int lchown(const char *, uid_t, gid_t);
400 #endif
401 extern int link(const char *, const char *);
402 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
403 extern offset_t llseek(int, offset_t, int);
404 #endif
405 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
406 	(defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
407 	defined(__EXTENSIONS__)
408 extern int lockf(int, int, off_t);
409 #endif
410 extern off_t lseek(int, off_t, int);
411 #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
412 	defined(__EXTENSIONS__)
413 extern int nice(int);
414 #endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */
415 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
416 extern int mincore(caddr_t, size_t, char *);
417 #endif
418 extern long pathconf(const char *, int);
419 extern int pause(void);
420 extern int pipe(int *);
421 extern int pipe2(int *, int);
422 #if !defined(_POSIX_C_SOURCE) || defined(_XPG5) || \
423 	(defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
424 	defined(__EXTENSIONS__)
425 extern ssize_t pread(int, void *, size_t, off_t);
426 #endif
427 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
428 extern void profil(unsigned short *, size_t, unsigned long, unsigned int);
429 #endif
430 /*
431  * pthread_atfork() is also declared in <pthread.h> as per SUSv3. The
432  * declarations are identical. A change to either one may also require
433  * appropriate namespace updates in order to avoid redeclaration
434  * warnings in the case where both prototypes are exposed via inclusion
435  * of both <pthread.h> and <unistd.h>.
436  */
437 #if !defined(__XOPEN_OR_POSIX) || \
438 	((_POSIX_C_SOURCE > 2) && !defined(_XPG6)) || \
439 	defined(__EXTENSIONS__)
440 extern int pthread_atfork(void (*) (void), void (*) (void), void (*) (void));
441 #endif /* !defined(__XOPEN_OR_POSIX) || ((_POSIX_C_SOURCE > 2) ... */
442 #if !defined(_LP64) && \
443 	(!defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__))
444 extern int ptrace(int, pid_t, int, int);
445 #endif
446 #if !defined(_POSIX_C_SOURCE) || defined(_XPG5) || \
447 	(defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
448 	defined(__EXTENSIONS__)
449 extern ssize_t pwrite(int, const void *, size_t, off_t);
450 #endif
451 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
452 /* per RFC 3542; This is also defined in netdb.h */
453 extern int rcmd_af(char **, unsigned short, const char *, const char *,
454 	const char *, int *, int);
455 #endif
456 extern ssize_t read(int, void *, size_t);
457 #if !defined(__XOPEN_OR_POSIX) || \
458 	defined(_XPG4_2) || defined(__EXTENSIONS__)
459 extern ssize_t readlink(const char *_RESTRICT_KYWD, char *_RESTRICT_KYWD,
460 	size_t);
461 #endif
462 #if (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3) && !defined(_XPG4))) || \
463 	defined(__EXTENSIONS__)
464 extern int rename(const char *, const char *);
465 #endif /* (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3)... */
466 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
467 extern int resolvepath(const char *, char *, size_t);
468 /* per RFC 3542; This is also defined in netdb.h */
469 extern int rexec_af(char **, unsigned short, const char *, const char *,
470 	const char *, int *, int);
471 #endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */
472 extern int rmdir(const char *);
473 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
474 /* per RFC 3542; This is also defined in netdb.h */
475 extern int rresvport_af(int *, int);
476 #endif
477 
478 #if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \
479 	defined(__EXTENSIONS__)
480 extern void *sbrk(intptr_t);
481 #endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */
482 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__)
483 extern int setegid(gid_t);
484 extern int seteuid(uid_t);
485 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) ... */
486 extern int setgid(gid_t);
487 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
488 extern int setgroups(int, const gid_t *);
489 extern int sethostname(char *, int);
490 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
491 extern int setpgid(pid_t, pid_t);
492 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
493 extern pid_t setpgrp(void);
494 extern int setregid(gid_t, gid_t);
495 extern int setreuid(uid_t, uid_t);
496 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
497 extern pid_t setsid(void);
498 extern int setuid(uid_t);
499 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
500 extern void setusershell(void);
501 #endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */
502 extern unsigned sleep(unsigned);
503 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
504 extern int stime(const time_t *);
505 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
506 #if defined(_XPG4)
507 /* __EXTENSIONS__ makes the SVID Third Edition prototype in stdlib.h visible */
508 extern void swab(const void *_RESTRICT_KYWD, void *_RESTRICT_KYWD, ssize_t);
509 #endif /* defined(_XPG4) */
510 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
511 extern int symlink(const char *, const char *);
512 extern void sync(void);
513 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */
514 #if defined(_XPG5) && !defined(_XPG6)
515 #ifdef __PRAGMA_REDEFINE_EXTNAME
516 #pragma redefine_extname sysconf __sysconf_xpg5
517 #else /* __PRAGMA_REDEFINE_EXTNAME */
518 #define	sysconf __sysconf_xpg5
519 #endif  /* __PRAGMA_REDEFINE_EXTNAME */
520 #endif /* defined(_XPG5) && !defined(_XPG6) */
521 extern long sysconf(int);
522 extern pid_t tcgetpgrp(int);
523 extern int tcsetpgrp(int, pid_t);
524 #if !defined(__XOPEN_OR_POSIX) || \
525 	(defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
526 	defined(__EXTENSIONS__)
527 extern off_t tell(int);
528 #endif /* !defined(__XOPEN_OR_POSIX)... */
529 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
530 	(defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
531 	defined(__EXTENSIONS__)
532 extern int truncate(const char *, off_t);
533 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
534 extern char *ttyname(int);
535 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
536 extern useconds_t ualarm(useconds_t, useconds_t);
537 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
538 extern int unlink(const char *);
539 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
540 extern int usleep(useconds_t);
541 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
542 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
543 extern pid_t vfork(void) __RETURNS_TWICE;
544 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
545 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
546 extern void vhangup(void);
547 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
548 extern ssize_t write(int, const void *, size_t);
549 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
550 extern void yield(void);
551 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
552 
553 #if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \
554 	defined(__EXTENSIONS__)
555 	/* || defined(_XPG7) */
556 extern int faccessat(int, const char *, int, int);
557 extern int fchownat(int, const char *, uid_t, gid_t, int);
558 extern int linkat(int, const char *, int, const char *, int);
559 extern ssize_t readlinkat(int, const char *_RESTRICT_KYWD,
560 	char *_RESTRICT_KYWD, size_t);
561 extern int renameat(int, const char *, int, const char *);
562 extern int symlinkat(const char *, int, const char *);
563 extern int unlinkat(int, const char *, int);
564 #endif	/* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */
565 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
566 extern int get_nprocs(void);
567 extern int get_nprocs_conf(void);
568 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
569 
570 /* transitional large file interface versions */
571 #if	defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
572 	    !defined(__PRAGMA_REDEFINE_EXTNAME))
573 extern int ftruncate64(int, off64_t);
574 extern off64_t lseek64(int, off64_t, int);
575 extern ssize_t	pread64(int, void *, size_t, off64_t);
576 extern ssize_t	pwrite64(int, const void *, size_t, off64_t);
577 extern off64_t	tell64(int);
578 extern int	truncate64(const char *, off64_t);
579 extern int	lockf64(int, int, off64_t);
580 #endif	/* _LARGEFILE64_SOURCE */
581 
582 #else  /* __STDC__ */
583 
584 extern int access();
585 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
586 extern int acct();
587 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
588 extern unsigned alarm();
589 #if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \
590 	defined(__EXTENSIONS__)
591 extern int brk();
592 #endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */
593 extern int chdir();
594 extern int chown();
595 #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
596 	defined(__EXTENSIONS__)
597 extern int chroot();
598 #endif /* (!defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */
599 extern int close();
600 #if defined(_XPG4) || defined(__EXTENSIONS__)
601 extern size_t confstr();
602 extern char *crypt();
603 #endif /* defined(XPG4) || defined(__EXTENSIONS__) */
604 #if !defined(_POSIX_C_SOURCE) || defined(_XPG3) || defined(__EXTENSIONS__)
605 extern char *ctermid();
606 #endif /* (!defined(_POSIX_C_SOURCE) || defined(_XPG3)... */
607 #if !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) || defined(__EXTENSIONS__)
608 extern char *ctermid_r();
609 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) ... */
610 #if !defined(_XPG6) || defined(__EXTENSIONS__)
611 extern char *cuserid();
612 #endif
613 extern int dup();
614 extern int dup2();
615 extern int dup3();
616 #if defined(_XPG4) || defined(__EXTENSIONS__)
617 extern void encrypt();
618 #endif /* defined(_XPG4) || defined(__EXTENSIONS__) */
619 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
620 extern void endusershell();
621 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
622 extern int execl();
623 extern int execle();
624 extern int execlp();
625 extern int execv();
626 extern int execve();
627 extern int execvp();
628 extern void _exit();
629 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
630 extern int fattach();
631 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
632 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
633 extern int fchdir();
634 extern int fchown();
635 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
636 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
637 extern int fchroot();
638 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
639 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \
640 	defined(__EXTENSIONS__)
641 extern int fdatasync();
642 #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */
643 #if !defined(__XOPEN_OR_POSIX)
644 extern int fdetach();
645 #endif /* !defined(__XOPEN_OR_POSIX) */
646 extern pid_t fork();
647 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
648 extern pid_t fork1();
649 extern pid_t forkall();
650 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
651 extern long fpathconf();
652 #if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2) || \
653 	defined(__EXTENSIONS__)
654 extern int fsync();
655 #endif /* !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2)... */
656 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) || \
657 	(defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
658 	defined(__EXTENSIONS__)
659 extern int ftruncate();
660 #endif /* !defined(__XOPEN_OR_POSIX) (_POSIX_C_SOURCE > 2)... */
661 extern char *getcwd();
662 #if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \
663 	defined(__EXTENSIONS__)
664 extern int getdtablesize();
665 #endif
666 extern gid_t getegid();
667 extern uid_t geteuid();
668 extern gid_t getgid();
669 extern int getgroups();
670 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
671 extern long gethostid();
672 #endif
673 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
674 extern int gethostname();
675 #endif
676 extern char *getlogin();
677 #if defined(_XPG4) || defined(__EXTENSIONS__)
678 extern int  getopt();
679 extern char *optarg;
680 extern int  opterr, optind, optopt;
681 #if !defined(_XPG6) || defined(__EXTENSIONS__)
682 extern char *getpass();
683 #endif
684 #endif /* defined(_XPG4) || defined(__EXTENSIONS__) */
685 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
686 #if !defined(_XPG6) || defined(__EXTENSIONS__)
687 extern int getpagesize();
688 #endif
689 extern pid_t getpgid();
690 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
691 extern pid_t getpid();
692 extern pid_t getppid();
693 extern pid_t getpgrp();
694 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
695 char *gettxt();
696 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
697 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
698 extern pid_t getsid();
699 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */
700 extern uid_t getuid();
701 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
702 extern char *getusershell();
703 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
704 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
705 extern char *getwd();
706 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
707 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
708 extern int ioctl();
709 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
710 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
711 extern int isaexec();
712 extern int issetugid();
713 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
714 extern int isatty();
715 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
716 extern int lchown();
717 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */
718 extern int link();
719 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
720 extern offset_t llseek();
721 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
722 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
723 	(defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
724 	defined(__EXTENSIONS__)
725 extern int lockf();
726 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
727 extern off_t lseek();
728 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
729 extern int mincore();
730 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
731 #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
732 	defined(__EXTENSIONS__)
733 extern int nice();
734 #endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */
735 extern long pathconf();
736 extern int pause();
737 extern int pipe();
738 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG5) || \
739 	(defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
740 	defined(__EXTENSIONS__)
741 extern ssize_t pread();
742 #endif
743 #if !defined(_LP64) && \
744 	(!defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__))
745 extern void profil();
746 extern int ptrace();
747 #endif
748 #if !defined(__XOPEN_OR_POSIX) || \
749 	((_POSIX_C_SOURCE > 2) && !defined(_XPG6)) || \
750 	defined(__EXTENSIONS__)
751 extern int pthread_atfork();
752 #endif /* !defined(__XOPEN_OR_POSIX) || ((_POSIX_C_SOURCE > 2) ...  */
753 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG5) || \
754 	(defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
755 	defined(__EXTENSIONS__)
756 extern ssize_t pwrite();
757 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG5) */
758 extern ssize_t read();
759 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
760 /* per RFC 3542; This is also defined in netdb.h */
761 extern int rcmd_af();
762 #endif
763 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
764 extern ssize_t readlink();
765 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
766 #if (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3) && !defined(_XPG4))) || \
767 	defined(__EXTENSIONS__)
768 extern int rename();
769 #endif /* (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3)... */
770 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
771 extern int resolvepath();
772 /* per RFC 3542; This is also defined in netdb.h */
773 extern int rexec_af();
774 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
775 extern int rmdir();
776 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
777 /* per RFC 3542; This is also defined in netdb.h */
778 extern int rresvport_af();
779 #endif
780 #if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \
781 	defined(__EXTENSIONS__)
782 extern void *sbrk();
783 #endif /* !defined(__XOPEN_OR_POSIX)|| (defined(_XPG4_2)... */
784 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__)
785 extern int setegid();
786 extern int seteuid();
787 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) ... */
788 extern int setgid();
789 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
790 extern int setgroups();
791 extern int sethostname();
792 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
793 extern int setpgid();
794 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
795 extern pid_t setpgrp();
796 extern int setregid();
797 extern int setreuid();
798 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
799 extern pid_t setsid();
800 extern int setuid();
801 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
802 extern void setusershell();
803 #endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */
804 extern unsigned sleep();
805 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
806 extern int stime();
807 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
808 #if defined(_XPG4)
809 /* __EXTENSIONS__ makes the SVID Third Edition prototype in stdlib.h visible */
810 extern void swab();
811 #endif /* defined(_XPG4) */
812 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
813 extern int symlink();
814 extern void sync();
815 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
816 #if defined(_XPG5)
817 #ifdef __PRAGMA_REDEFINE_EXTNAME
818 #pragma redefine_extname sysconf __sysconf_xpg5
819 extern long sysconf();
820 #else /* __PRAGMA_REDEFINE_EXTNAME */
821 extern long __sysconf_xpg5();
822 #define	sysconf __sysconf_xpg5
823 #endif  /* __PRAGMA_REDEFINE_EXTNAME */
824 #endif	/* defined(_XPG5) */
825 extern pid_t tcgetpgrp();
826 extern int tcsetpgrp();
827 #if !defined(__XOPEN_OR_POSIX) || \
828 	(defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
829 	defined(__EXTENSIONS__)
830 extern off_t tell();
831 #endif /* !defined(__XOPEN_OR_POSIX)... */
832 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
833 	(defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
834 	defined(__EXTENSIONS__)
835 extern int truncate();
836 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
837 extern char *ttyname();
838 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
839 extern useconds_t ualarm();
840 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
841 extern int unlink();
842 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
843 extern int usleep();
844 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
845 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
846 extern pid_t vfork();
847 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
848 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
849 extern void vhangup();
850 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
851 extern ssize_t write();
852 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
853 extern void yield();
854 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
855 
856 #if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \
857 	defined(__EXTENSIONS__)
858 	/* || defined(_XPG7) */
859 extern int faccessat();
860 extern int fchownat();
861 extern int linkat();
862 extern ssize_t readlinkat();
863 extern int renameat();
864 extern int symlinkat();
865 extern int unlinkat();
866 #endif	/* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */
867 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
868 extern int get_nprocs();
869 extern int get_nprocs_conf();
870 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
871 
872 /* transitional large file interface versions */
873 #if	defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
874 	    !defined(__PRAGMA_REDEFINE_EXTNAME))
875 extern int ftruncate64();
876 extern off64_t lseek64();
877 extern ssize_t pread64();
878 extern ssize_t pwrite64();
879 extern off64_t tell64();
880 extern int truncate64();
881 extern int lockf64();
882 #endif	/* _LARGEFILE64_SOURCE */
883 
884 #endif /* __STDC__ */
885 
886 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
887 #pragma unknown_control_flow(vfork)
888 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
889 
890 /*
891  * getlogin_r() & ttyname_r() prototypes are defined here.
892  */
893 
894 /*
895  * Previous releases of Solaris, starting at 2.3, provided definitions of
896  * various functions as specified in POSIX.1c, Draft 6.  For some of these
897  * functions, the final POSIX 1003.1c standard had a different number of
898  * arguments and return values.
899  *
900  * The following segment of this header provides support for the standard
901  * interfaces while supporting applications written under earlier
902  * releases.  The application defines appropriate values of the feature
903  * test macros _POSIX_C_SOURCE and _POSIX_PTHREAD_SEMANTICS to indicate
904  * whether it was written to expect the Draft 6 or standard versions of
905  * these interfaces, before including this header.  This header then
906  * provides a mapping from the source version of the interface to an
907  * appropriate binary interface.  Such mappings permit an application
908  * to be built from libraries and objects which have mixed expectations
909  * of the definitions of these functions.
910  *
911  * For applications using the Draft 6 definitions, the binary symbol is the
912  * same as the source symbol, and no explicit mapping is needed.  For the
913  * standard interface, the function func() is mapped to the binary symbol
914  * _posix_func().  The preferred mechanism for the remapping is a compiler
915  * #pragma.  If the compiler does not provide such a #pragma, the header file
916  * defines a static function func() which calls the _posix_func() version;
917  * this has to be done instead of #define since POSIX specifies that an
918  * application can #undef the symbol and still be bound to the correct
919  * implementation.  Unfortunately, the statics confuse lint so we fallback to
920  * #define in that case.
921  *
922  * NOTE: Support for the Draft 6 definitions is provided for compatibility
923  * only.  New applications/libraries should use the standard definitions.
924  */
925 
926 #if	defined(__EXTENSIONS__) || defined(_REENTRANT) || \
927 	!defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE - 0 >= 199506L) || \
928 	defined(_POSIX_PTHREAD_SEMANTICS)
929 
930 #if	defined(__STDC__)
931 
932 #if	(_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
933 
934 #ifdef __PRAGMA_REDEFINE_EXTNAME
935 #pragma redefine_extname getlogin_r __posix_getlogin_r
936 #pragma redefine_extname ttyname_r __posix_ttyname_r
937 extern int getlogin_r(char *, int);
938 extern int ttyname_r(int, char *, size_t);
939 #else  /* __PRAGMA_REDEFINE_EXTNAME */
940 
941 extern int __posix_getlogin_r(char *, int);
942 extern int __posix_ttyname_r(int, char *, size_t);
943 
944 #ifdef __lint
945 
946 #define	getlogin_r	__posix_getlogin_r
947 #define	ttyname_r	__posix_ttyname_r
948 
949 #else /* !__lint */
950 
951 static int
952 getlogin_r(char *__name, int __len)
953 {
954 	return (__posix_getlogin_r(__name, __len));
955 }
956 static int
957 ttyname_r(int __fildes, char *__buf, size_t __size)
958 {
959 	return (__posix_ttyname_r(__fildes, __buf, __size));
960 }
961 
962 #endif /* !__lint */
963 #endif /* __PRAGMA_REDEFINE_EXTNAME */
964 
965 #else  /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
966 
967 extern char *getlogin_r(char *, int);
968 extern char *ttyname_r(int, char *, int);
969 
970 #endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
971 
972 #else  /* __STDC__ */
973 
974 #if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
975 
976 #ifdef __PRAGMA_REDEFINE_EXTNAME
977 #pragma redefine_extname getlogin_r __posix_getlogin_r
978 #pragma redefine_extname ttyname_r __posix_ttyname_r
979 extern int getlogin_r();
980 extern int ttyname_r();
981 #else  /* __PRAGMA_REDEFINE_EXTNAME */
982 
983 extern int __posix_getlogin_r();
984 extern int __posix_ttyname_r();
985 
986 #ifdef	__lint
987 
988 #define	getlogin_r	__posix_getlogin_r
989 #define	ttyname_r	__posix_ttyname_r
990 
991 #else /* !__lint */
992 
993 static int
994 getlogin_r(__name, __len)
995 	char *__name;
996 	int __len;
997 {
998 	return (__posix_getlogin_r(__name, __len));
999 }
1000 static int
1001 ttyname_r(__fildes, __buf, __size)
1002 	int __fildes;
1003 	char *__buf;
1004 	size_t __size;
1005 {
1006 	return (__posix_ttyname_r(__fildes, __buf, __size));
1007 }
1008 #endif /* !__lint */
1009 #endif /* __PRAGMA_REDEFINE_EXTNAME */
1010 
1011 #else  /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
1012 
1013 extern char *getlogin_r();
1014 extern char *ttyname_r();
1015 
1016 #endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
1017 
1018 #endif /* __STDC__ */
1019 
1020 #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT)... */
1021 
1022 #ifdef	__cplusplus
1023 }
1024 #endif
1025 
1026 #endif /* _UNISTD_H */
1027