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 /* Copyright (c) 1988 AT&T */ 22 /* All Rights Reserved */ 23 24 25 /* 26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 27 * Use is subject to license terms. 28 */ 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_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 #if defined(_XPG4) || defined(__EXTENSIONS__) 280 extern void encrypt(char *, int); 281 #endif /* defined(XPG4) || defined(__EXTENSIONS__) */ 282 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 283 extern void endusershell(void); 284 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 285 extern int execl(const char *, const char *, ...); 286 extern int execle(const char *, const char *, ...); 287 extern int execlp(const char *, const char *, ...); 288 extern int execv(const char *, char *const *); 289 extern int execve(const char *, char *const *, char *const *); 290 extern int execvp(const char *, char *const *); 291 extern void _exit(int) 292 __NORETURN; 293 /* 294 * The following fattach prototype is duplicated in <stropts.h>. The 295 * duplication is necessitated by XPG4.2 which requires the prototype 296 * be defined in <stropts.h>. 297 */ 298 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 299 extern int fattach(int, const char *); 300 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 301 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 302 extern int fchdir(int); 303 extern int fchown(int, uid_t, gid_t); 304 #if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \ 305 defined(__EXTENSIONS__) 306 extern int fchownat(int, const char *, uid_t, gid_t, int); 307 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */ 308 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 309 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 310 extern int fchroot(int); 311 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 312 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \ 313 defined(__EXTENSIONS__) 314 extern int fdatasync(int); 315 #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */ 316 /* 317 * The following fdetach prototype is duplicated in <stropts.h>. The 318 * duplication is necessitated by XPG4.2 which requires the prototype 319 * be defined in <stropts.h>. 320 */ 321 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 322 extern int fdetach(const char *); 323 #endif /* !defined(__XOPEN_OR_POSIX)... */ 324 extern pid_t fork(void); 325 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 326 extern pid_t fork1(void); 327 extern pid_t forkall(void); 328 #endif /* !defined(__XOPEN_OR_POSIX)... */ 329 extern long fpathconf(int, int); 330 #if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2) || \ 331 defined(__EXTENSIONS__) 332 extern int fsync(int); 333 #endif /* !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2)... */ 334 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) || \ 335 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 336 defined(__EXTENSIONS__) 337 extern int ftruncate(int, off_t); 338 #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */ 339 extern char *getcwd(char *, size_t); 340 #if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ 341 defined(__EXTENSIONS__) 342 extern int getdtablesize(void); 343 #endif 344 extern gid_t getegid(void); 345 extern uid_t geteuid(void); 346 extern gid_t getgid(void); 347 extern int getgroups(int, gid_t *); 348 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 349 extern long gethostid(void); 350 #endif 351 #if defined(_XPG4_2) 352 extern int gethostname(char *, size_t); 353 #elif !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 354 extern int gethostname(char *, int); 355 #endif 356 extern char *getlogin(void); 357 #if defined(_XPG4) || defined(__EXTENSIONS__) 358 extern int getopt(int, char *const *, const char *); 359 extern char *optarg; 360 extern int opterr, optind, optopt; 361 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */ 362 #if !defined(_XPG6) || defined(__EXTENSIONS__) 363 extern char *getpass(const char *); 364 #endif 365 #endif /* defined(_XPG4) || defined(__EXTENSIONS__) */ 366 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 367 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */ 368 #if !defined(_XPG6) || defined(__EXTENSIONS__) 369 extern int getpagesize(void); 370 #endif 371 extern pid_t getpgid(pid_t); 372 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 373 extern pid_t getpid(void); 374 extern pid_t getppid(void); 375 extern pid_t getpgrp(void); 376 377 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 378 char *gettxt(const char *, const char *); 379 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 380 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 381 extern pid_t getsid(pid_t); 382 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 383 extern uid_t getuid(void); 384 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 385 extern char *getusershell(void); 386 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 387 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 388 extern char *getwd(char *); 389 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 390 /* 391 * The following ioctl prototype is duplicated in <stropts.h>. The 392 * duplication is necessitated by XPG4.2 which requires the prototype 393 * be defined in <stropts.h>. 394 */ 395 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 396 extern int ioctl(int, int, ...); 397 extern int isaexec(const char *, char *const *, char *const *); 398 extern int issetugid(void); 399 #endif 400 extern int isatty(int); 401 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 402 extern int lchown(const char *, uid_t, gid_t); 403 #endif 404 extern int link(const char *, const char *); 405 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 406 extern offset_t llseek(int, offset_t, int); 407 #endif 408 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \ 409 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 410 defined(__EXTENSIONS__) 411 extern int lockf(int, int, off_t); 412 #endif 413 extern off_t lseek(int, off_t, int); 414 #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ 415 defined(__EXTENSIONS__) 416 extern int nice(int); 417 #endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */ 418 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 419 extern int mincore(caddr_t, size_t, char *); 420 #endif 421 extern long pathconf(const char *, int); 422 extern int pause(void); 423 extern int pipe(int *); 424 #if !defined(_POSIX_C_SOURCE) || defined(_XPG5) || \ 425 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 426 defined(__EXTENSIONS__) 427 extern ssize_t pread(int, void *, size_t, off_t); 428 #endif 429 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 430 extern void profil(unsigned short *, size_t, unsigned long, unsigned int); 431 #endif 432 /* 433 * pthread_atfork() is also declared in <pthread.h> as per SUSv3. The 434 * declarations are identical. A change to either one may also require 435 * appropriate namespace updates in order to avoid redeclaration 436 * warnings in the case where both prototypes are exposed via inclusion 437 * of both <pthread.h> and <unistd.h>. 438 */ 439 #if !defined(__XOPEN_OR_POSIX) || \ 440 ((_POSIX_C_SOURCE > 2) && !defined(_XPG6)) || \ 441 defined(__EXTENSIONS__) 442 extern int pthread_atfork(void (*) (void), void (*) (void), void (*) (void)); 443 #endif /* !defined(__XOPEN_OR_POSIX) || ((_POSIX_C_SOURCE > 2) ... */ 444 #if !defined(_LP64) && \ 445 (!defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)) 446 extern int ptrace(int, pid_t, int, int); 447 #endif 448 #if !defined(_POSIX_C_SOURCE) || defined(_XPG5) || \ 449 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 450 defined(__EXTENSIONS__) 451 extern ssize_t pwrite(int, const void *, size_t, off_t); 452 #endif 453 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 454 /* per RFC 3542; This is also defined in netdb.h */ 455 extern int rcmd_af(char **, unsigned short, const char *, const char *, 456 const char *, int *, int); 457 #endif 458 extern ssize_t read(int, void *, size_t); 459 #if !defined(__XOPEN_OR_POSIX) || \ 460 defined(_XPG4_2) || defined(__EXTENSIONS__) 461 extern ssize_t readlink(const char *_RESTRICT_KYWD, char *_RESTRICT_KYWD, 462 size_t); 463 #endif 464 #if (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3) && !defined(_XPG4))) || \ 465 defined(__EXTENSIONS__) 466 extern int rename(const char *, const char *); 467 #endif /* (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3)... */ 468 #if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \ 469 defined(__EXTENSIONS__) 470 extern int renameat(int, const char *, int, const char *); 471 #endif /* !defined(__XOPEN_OR_POSIX || defined(_ATFILE_SOURCE)... */ 472 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 473 extern int resolvepath(const char *, char *, size_t); 474 /* per RFC 3542; This is also defined in netdb.h */ 475 extern int rexec_af(char **, unsigned short, const char *, const char *, 476 const char *, int *, int); 477 #endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */ 478 extern int rmdir(const char *); 479 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 480 /* per RFC 3542; This is also defined in netdb.h */ 481 extern int rresvport_af(int *, int); 482 #endif 483 484 #if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ 485 defined(__EXTENSIONS__) 486 extern void *sbrk(intptr_t); 487 #endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */ 488 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) 489 extern int setegid(gid_t); 490 extern int seteuid(uid_t); 491 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) ... */ 492 extern int setgid(gid_t); 493 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 494 extern int setgroups(int, const gid_t *); 495 extern int sethostname(char *, int); 496 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 497 extern int setpgid(pid_t, pid_t); 498 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 499 extern pid_t setpgrp(void); 500 extern int setregid(gid_t, gid_t); 501 extern int setreuid(uid_t, uid_t); 502 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 503 extern pid_t setsid(void); 504 extern int setuid(uid_t); 505 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 506 extern void setusershell(void); 507 #endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */ 508 extern unsigned sleep(unsigned); 509 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 510 extern int stime(const time_t *); 511 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 512 #if defined(_XPG4) 513 /* __EXTENSIONS__ makes the SVID Third Edition prototype in stdlib.h visible */ 514 extern void swab(const void *_RESTRICT_KYWD, void *_RESTRICT_KYWD, ssize_t); 515 #endif /* defined(_XPG4) */ 516 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 517 extern int symlink(const char *, const char *); 518 extern void sync(void); 519 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */ 520 #if defined(_XPG5) && !defined(_XPG6) 521 #ifdef __PRAGMA_REDEFINE_EXTNAME 522 #pragma redefine_extname sysconf __sysconf_xpg5 523 #else /* __PRAGMA_REDEFINE_EXTNAME */ 524 #define sysconf __sysconf_xpg5 525 #endif /* __PRAGMA_REDEFINE_EXTNAME */ 526 #endif /* defined(_XPG5) && !defined(_XPG6) */ 527 extern long sysconf(int); 528 extern pid_t tcgetpgrp(int); 529 extern int tcsetpgrp(int, pid_t); 530 #if !defined(__XOPEN_OR_POSIX) || \ 531 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 532 defined(__EXTENSIONS__) 533 extern off_t tell(int); 534 #endif /* !defined(__XOPEN_OR_POSIX)... */ 535 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \ 536 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 537 defined(__EXTENSIONS__) 538 extern int truncate(const char *, off_t); 539 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 540 extern char *ttyname(int); 541 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 542 extern useconds_t ualarm(useconds_t, useconds_t); 543 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 544 extern int unlink(const char *); 545 #if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \ 546 defined(__EXTENSIONS__) 547 extern int unlinkat(int, const char *, int); 548 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */ 549 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 550 extern int usleep(useconds_t); 551 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 552 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 553 extern pid_t vfork(void); 554 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 555 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 556 extern void vhangup(void); 557 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 558 extern ssize_t write(int, const void *, size_t); 559 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 560 extern void yield(void); 561 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 562 563 /* transitional large file interface versions */ 564 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ 565 !defined(__PRAGMA_REDEFINE_EXTNAME)) 566 extern int ftruncate64(int, off64_t); 567 extern off64_t lseek64(int, off64_t, int); 568 extern ssize_t pread64(int, void *, size_t, off64_t); 569 extern ssize_t pwrite64(int, const void *, size_t, off64_t); 570 extern off64_t tell64(int); 571 extern int truncate64(const char *, off64_t); 572 extern int lockf64(int, int, off64_t); 573 #endif /* _LARGEFILE64_SOURCE */ 574 575 #else /* __STDC__ */ 576 577 extern int access(); 578 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 579 extern int acct(); 580 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 581 extern unsigned alarm(); 582 #if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ 583 defined(__EXTENSIONS__) 584 extern int brk(); 585 #endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */ 586 extern int chdir(); 587 extern int chown(); 588 #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ 589 defined(__EXTENSIONS__) 590 extern int chroot(); 591 #endif /* (!defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */ 592 extern int close(); 593 #if defined(_XPG4) || defined(__EXTENSIONS__) 594 extern size_t confstr(); 595 extern char *crypt(); 596 #endif /* defined(XPG4) || defined(__EXTENSIONS__) */ 597 #if !defined(_POSIX_C_SOURCE) || defined(_XPG3) || defined(__EXTENSIONS__) 598 extern char *ctermid(); 599 #endif /* (!defined(_POSIX_C_SOURCE) || defined(_XPG3)... */ 600 #if !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) || defined(__EXTENSIONS_) 601 extern char *ctermid_r(); 602 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) ... */ 603 #if !defined(_XPG6) || defined(__EXTENSIONS__) 604 extern char *cuserid(); 605 #endif 606 extern int dup(); 607 extern int dup2(); 608 #if defined(_XPG4) || defined(__EXTENSIONS__) 609 extern void encrypt(); 610 #endif /* defined(_XPG4) || defined(__EXTENSIONS__) */ 611 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 612 extern void endusershell(); 613 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 614 extern int execl(); 615 extern int execle(); 616 extern int execlp(); 617 extern int execv(); 618 extern int execve(); 619 extern int execvp(); 620 extern void _exit(); 621 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 622 extern int fattach(); 623 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 624 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 625 extern int fchdir(); 626 extern int fchown(); 627 #if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \ 628 defined(__EXTENSIONS__) 629 extern int fchownat(); 630 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */ 631 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 632 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 633 extern int fchroot(); 634 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 635 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \ 636 defined(__EXTENSIONS__) 637 extern int fdatasync(); 638 #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */ 639 #if !defined(__XOPEN_OR_POSIX) 640 extern int fdetach(); 641 #endif /* !defined(__XOPEN_OR_POSIX) */ 642 extern pid_t fork(); 643 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 644 extern pid_t fork1(); 645 extern pid_t forkall(); 646 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 647 extern long fpathconf(); 648 #if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2) || \ 649 defined(__EXTENSIONS__) 650 extern int fsync(); 651 #endif /* !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2)... */ 652 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) || \ 653 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 654 defined(__EXTENSIONS__) 655 extern int ftruncate(); 656 #endif /* !defined(__XOPEN_OR_POSIX) (_POSIX_C_SOURCE > 2)... */ 657 extern char *getcwd(); 658 #if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ 659 defined(__EXTENSIONS__) 660 extern int getdtablesize(); 661 #endif 662 extern gid_t getegid(); 663 extern uid_t geteuid(); 664 extern gid_t getgid(); 665 extern int getgroups(); 666 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 667 extern long gethostid(); 668 #endif 669 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 670 extern int gethostname(); 671 #endif 672 extern char *getlogin(); 673 #if defined(_XPG4) || defined(__EXTENSIONS__) 674 extern int getopt(); 675 extern char *optarg; 676 extern int opterr, optind, optopt; 677 #if !defined(_XPG6) || defined(__EXTENSIONS__) 678 extern char *getpass(); 679 #endif 680 #endif /* defined(_XPG4) || defined(__EXTENSIONS__) */ 681 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 682 #if !defined(_XPG6) || defined(__EXTENSIONS__) 683 extern int getpagesize(); 684 #endif 685 extern pid_t getpgid(); 686 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 687 extern pid_t getpid(); 688 extern pid_t getppid(); 689 extern pid_t getpgrp(); 690 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 691 char *gettxt(); 692 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 693 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 694 extern pid_t getsid(); 695 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */ 696 extern uid_t getuid(); 697 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 698 extern char *getusershell(); 699 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 700 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 701 extern char *getwd(); 702 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 703 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 704 extern int ioctl(); 705 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 706 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 707 extern int isaexec(); 708 extern int issetugid(); 709 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 710 extern int isatty(); 711 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 712 extern int lchown(); 713 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */ 714 extern int link(); 715 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 716 extern offset_t llseek(); 717 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 718 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \ 719 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 720 defined(__EXTENSIONS__) 721 extern int lockf(); 722 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 723 extern off_t lseek(); 724 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 725 extern int mincore(); 726 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 727 #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ 728 defined(__EXTENSIONS__) 729 extern int nice(); 730 #endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */ 731 extern long pathconf(); 732 extern int pause(); 733 extern int pipe(); 734 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG5) || \ 735 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 736 defined(__EXTENSIONS__) 737 extern ssize_t pread(); 738 #endif 739 #if !defined(_LP64) && \ 740 (!defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)) 741 extern void profil(); 742 extern int ptrace(); 743 #endif 744 #if !defined(__XOPEN_OR_POSIX) || \ 745 ((_POSIX_C_SOURCE > 2) && !defined(_XPG6)) || \ 746 defined(__EXTENSIONS__) 747 extern int pthread_atfork(); 748 #endif /* !defined(__XOPEN_OR_POSIX) || ((_POSIX_C_SOURCE > 2) ... */ 749 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG5) || \ 750 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 751 defined(__EXTENSIONS__) 752 extern ssize_t pwrite(); 753 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG5) */ 754 extern ssize_t read(); 755 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 756 /* per RFC 3542; This is also defined in netdb.h */ 757 extern int rcmd_af(); 758 #endif 759 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 760 extern ssize_t readlink(); 761 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 762 #if (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3) && !defined(_XPG4))) || \ 763 defined(__EXTENSIONS__) 764 extern int rename(); 765 #if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \ 766 defined(__EXTENSIONS__) 767 extern int renameat(); 768 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */ 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(_ATFILE_SOURCE) || \ 843 defined(__EXTENSIONS__) 844 extern int unlinkat(); 845 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */ 846 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 847 extern int usleep(); 848 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 849 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 850 extern pid_t vfork(); 851 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 852 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 853 extern void vhangup(); 854 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 855 extern ssize_t write(); 856 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 857 extern void yield(); 858 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 859 860 /* transitional large file interface versions */ 861 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ 862 !defined(__PRAGMA_REDEFINE_EXTNAME)) 863 extern int ftruncate64(); 864 extern off64_t lseek64(); 865 extern ssize_t pread64(); 866 extern ssize_t pwrite64(); 867 extern off64_t tell64(); 868 extern int truncate64(); 869 extern int lockf64(); 870 #endif /* _LARGEFILE64_SOURCE */ 871 872 #endif /* __STDC__ */ 873 874 /* 875 * This atrocity is necessary on sparc because registers modified 876 * by the child get propagated back to the parent via the window 877 * save/restore mechanism. 878 */ 879 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 880 #if defined(__sparc) 881 #pragma unknown_control_flow(vfork) 882 #endif 883 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 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