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