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