1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. 24 */ 25 26 /* Copyright (c) 1988 AT&T */ 27 /* All Rights Reserved */ 28 29 #ifndef _UNISTD_H 30 #define _UNISTD_H 31 32 #include <sys/feature_tests.h> 33 34 #include <sys/types.h> 35 #include <sys/unistd.h> 36 37 #ifdef __cplusplus 38 extern "C" { 39 #endif 40 41 /* Symbolic constants for the "access" routine: */ 42 #define R_OK 4 /* Test for Read permission */ 43 #define W_OK 2 /* Test for Write permission */ 44 #define X_OK 1 /* Test for eXecute permission */ 45 #define F_OK 0 /* Test for existence of File */ 46 47 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 48 #define F_ULOCK 0 /* Unlock a previously locked region */ 49 #define F_LOCK 1 /* Lock a region for exclusive use */ 50 #define F_TLOCK 2 /* Test and lock a region for exclusive use */ 51 #define F_TEST 3 /* Test a region for other processes locks */ 52 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 53 54 /* Symbolic constants for the "lseek" routine: */ 55 56 #ifndef SEEK_SET 57 #define SEEK_SET 0 /* Set file pointer to "offset" */ 58 #endif 59 60 #ifndef SEEK_CUR 61 #define SEEK_CUR 1 /* Set file pointer to current plus "offset" */ 62 #endif 63 64 #ifndef SEEK_END 65 #define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ 66 #endif 67 68 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 69 #ifndef SEEK_DATA 70 #define SEEK_DATA 3 /* Set file pointer to next data past offset */ 71 #endif 72 73 #ifndef SEEK_HOLE 74 #define SEEK_HOLE 4 /* Set file pointer to next hole past offset */ 75 #endif 76 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 77 78 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 79 /* Path names: */ 80 #define GF_PATH "/etc/group" /* Path name of the "group" file */ 81 #define PF_PATH "/etc/passwd" /* Path name of the "passwd" file */ 82 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 83 84 /* 85 * compile-time symbolic constants, 86 * Support does not mean the feature is enabled. 87 * Use pathconf/sysconf to obtain actual configuration value. 88 */ 89 90 /* Values unchanged in UNIX 03 */ 91 #define _POSIX_ASYNC_IO 1 92 #define _POSIX_JOB_CONTROL 1 93 #define _POSIX_SAVED_IDS 1 94 #define _POSIX_SYNC_IO 1 95 96 /* 97 * POSIX.1b compile-time symbolic constants. 98 */ 99 #if defined(_XPG6) 100 #define _POSIX_ASYNCHRONOUS_IO 200112L 101 #define _POSIX_FSYNC 200112L 102 #define _POSIX_MAPPED_FILES 200112L 103 #define _POSIX_MEMLOCK 200112L 104 #define _POSIX_MEMLOCK_RANGE 200112L 105 #define _POSIX_MEMORY_PROTECTION 200112L 106 #define _POSIX_MESSAGE_PASSING 200112L 107 #define _POSIX_PRIORITY_SCHEDULING 200112L 108 #define _POSIX_REALTIME_SIGNALS 200112L 109 #define _POSIX_SEMAPHORES 200112L 110 #define _POSIX_SHARED_MEMORY_OBJECTS 200112L 111 #define _POSIX_SYNCHRONIZED_IO 200112L 112 #else 113 #define _POSIX_ASYNCHRONOUS_IO 1 114 #define _POSIX_FSYNC 1 115 #define _POSIX_MAPPED_FILES 1 116 #define _POSIX_MEMLOCK 1 117 #define _POSIX_MEMLOCK_RANGE 1 118 #define _POSIX_MEMORY_PROTECTION 1 119 #define _POSIX_MESSAGE_PASSING 1 120 #define _POSIX_PRIORITY_SCHEDULING 1 121 #define _POSIX_REALTIME_SIGNALS 1 122 #define _POSIX_SEMAPHORES 1 123 #define _POSIX_SHARED_MEMORY_OBJECTS 1 124 #define _POSIX_SYNCHRONIZED_IO 1 125 #endif 126 127 /* 128 * POSIX.1c compile-time symbolic constants. 129 */ 130 #if defined(_XPG6) 131 #define _POSIX_THREAD_SAFE_FUNCTIONS 200112L 132 #define _POSIX_THREADS 200112L 133 #define _POSIX_THREAD_ATTR_STACKADDR 200112L 134 #define _POSIX_THREAD_ATTR_STACKSIZE 200112L 135 #define _POSIX_THREAD_PROCESS_SHARED 200112L 136 #define _POSIX_THREAD_PRIORITY_SCHEDULING 200112L 137 #define _POSIX_TIMERS 200112L 138 #else 139 #define _POSIX_THREAD_SAFE_FUNCTIONS 1 140 #define _POSIX_THREADS 1 141 #define _POSIX_THREAD_ATTR_STACKADDR 1 142 #define _POSIX_THREAD_ATTR_STACKSIZE 1 143 #define _POSIX_THREAD_PROCESS_SHARED 1 144 #define _POSIX_THREAD_PRIORITY_SCHEDULING 1 145 #define _POSIX_TIMERS 1 146 #endif 147 148 /* New in UNIX 03 */ 149 #define _POSIX_ADVISORY_INFO 200112L 150 #define _POSIX_BARRIERS 200112L 151 #define _POSIX_CLOCK_SELECTION 200112L 152 #define _POSIX_IPV6 200112L 153 #define _POSIX_MONOTONIC_CLOCK 200112L 154 #define _POSIX_RAW_SOCKETS 200112L 155 #define _POSIX_READER_WRITER_LOCKS 200112L 156 #define _POSIX_SPAWN 200112L 157 #define _POSIX_SPIN_LOCKS 200112L 158 #define _POSIX_TIMEOUTS 200112L 159 160 /* 161 * Support for the POSIX.1 mutex protocol attribute. For realtime applications 162 * which need mutexes to support priority inheritance/ceiling. 163 */ 164 #if defined(_XPG6) 165 #define _POSIX_THREAD_PRIO_INHERIT 200112L 166 #define _POSIX_THREAD_PRIO_PROTECT 200112L 167 #else 168 #define _POSIX_THREAD_PRIO_INHERIT 1 169 #define _POSIX_THREAD_PRIO_PROTECT 1 170 #endif 171 172 #ifndef _POSIX_VDISABLE 173 #define _POSIX_VDISABLE 0 174 #endif 175 176 #ifndef NULL 177 #if defined(_LP64) 178 #define NULL 0L 179 #else 180 #define NULL 0 181 #endif 182 #endif 183 184 #define STDIN_FILENO 0 185 #define STDOUT_FILENO 1 186 #define STDERR_FILENO 2 187 188 /* 189 * Large File Summit-related announcement macros. The system supports both 190 * the additional and transitional Large File Summit interfaces. (The final 191 * two macros provide a finer granularity breakdown of _LFS64_LARGEFILE.) 192 */ 193 #define _LFS_LARGEFILE 1 194 #define _LFS64_LARGEFILE 1 195 #define _LFS64_STDIO 1 196 #define _LFS64_ASYNCHRONOUS_IO 1 197 198 /* large file compilation environment setup */ 199 #if !defined(_LP64) && _FILE_OFFSET_BITS == 64 200 #ifdef __PRAGMA_REDEFINE_EXTNAME 201 #pragma redefine_extname ftruncate ftruncate64 202 #pragma redefine_extname lseek lseek64 203 #pragma redefine_extname pread pread64 204 #pragma redefine_extname pwrite pwrite64 205 #pragma redefine_extname truncate truncate64 206 #pragma redefine_extname lockf lockf64 207 #pragma redefine_extname tell tell64 208 #else /* __PRAGMA_REDEFINE_EXTNAME */ 209 #define ftruncate ftruncate64 210 #define lseek lseek64 211 #define pread pread64 212 #define pwrite pwrite64 213 #define truncate truncate64 214 #define lockf lockf64 215 #define tell tell64 216 #endif /* __PRAGMA_REDEFINE_EXTNAME */ 217 #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */ 218 219 /* In the LP64 compilation environment, the APIs are already large file */ 220 #if defined(_LP64) && defined(_LARGEFILE64_SOURCE) 221 #ifdef __PRAGMA_REDEFINE_EXTNAME 222 #pragma redefine_extname ftruncate64 ftruncate 223 #pragma redefine_extname lseek64 lseek 224 #pragma redefine_extname pread64 pread 225 #pragma redefine_extname pwrite64 pwrite 226 #pragma redefine_extname truncate64 truncate 227 #pragma redefine_extname lockf64 lockf 228 #pragma redefine_extname tell64 tell 229 #else /* __PRAGMA_REDEFINE_EXTNAME */ 230 #define ftruncate64 ftruncate 231 #define lseek64 lseek 232 #define pread64 pread 233 #define pwrite64 pwrite 234 #define truncate64 truncate 235 #define lockf64 lockf 236 #define tell64 tell 237 #endif /* __PRAGMA_REDEFINE_EXTNAME */ 238 #endif /* _LP64 && _LARGEFILE64_SOURCE */ 239 240 #if defined(__STDC__) 241 242 extern int access(const char *, int); 243 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 244 extern int acct(const char *); 245 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 246 extern unsigned alarm(unsigned); 247 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */ 248 #if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ 249 defined(__EXTENSIONS__) 250 extern int brk(void *); 251 #endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */ 252 extern int chdir(const char *); 253 extern int chown(const char *, uid_t, gid_t); 254 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */ 255 #if !defined(_POSIX_C_SOURCE) || (defined(_XOPEN_SOURCE) && \ 256 !defined(_XPG6)) || defined(__EXTENSIONS__) 257 extern int chroot(const char *); 258 #endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE))... */ 259 extern int close(int); 260 #if defined(_XPG4) || defined(__EXTENSIONS__) 261 extern size_t confstr(int, char *, size_t); 262 extern char *crypt(const char *, const char *); 263 #endif /* defined(_XPG4) || defined(__EXTENSIONS__) */ 264 #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ 265 defined(__EXTENSIONS__) 266 extern char *ctermid(char *); 267 #endif /* (!defined(_POSIX_C_SOURCE) ... */ 268 #if !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) || defined(__EXTENSIONS__) 269 extern char *ctermid_r(char *); 270 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) ... */ 271 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */ 272 #if !defined(_XPG6) || defined(__EXTENSIONS__) 273 extern char *cuserid(char *); 274 #endif 275 extern int dup(int); 276 extern int dup2(int, int); 277 #if defined(_XPG4) || defined(__EXTENSIONS__) 278 extern void encrypt(char *, int); 279 #endif /* defined(XPG4) || defined(__EXTENSIONS__) */ 280 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 281 extern void endusershell(void); 282 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 283 extern int execl(const char *, const char *, ...); 284 extern int execle(const char *, const char *, ...); 285 extern int execlp(const char *, const char *, ...); 286 extern int execv(const char *, char *const *); 287 extern int execve(const char *, char *const *, char *const *); 288 extern int execvp(const char *, char *const *); 289 extern void _exit(int) 290 __NORETURN; 291 /* 292 * The following fattach prototype is duplicated in <stropts.h>. The 293 * duplication is necessitated by XPG4.2 which requires the prototype 294 * be defined in <stropts.h>. 295 */ 296 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 297 extern int fattach(int, const char *); 298 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 299 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 300 extern int fchdir(int); 301 extern int fchown(int, uid_t, gid_t); 302 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 303 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 304 extern int fchroot(int); 305 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 306 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \ 307 defined(__EXTENSIONS__) 308 extern int fdatasync(int); 309 #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */ 310 /* 311 * The following fdetach prototype is duplicated in <stropts.h>. The 312 * duplication is necessitated by XPG4.2 which requires the prototype 313 * be defined in <stropts.h>. 314 */ 315 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 316 extern int fdetach(const char *); 317 #endif /* !defined(__XOPEN_OR_POSIX)... */ 318 extern pid_t fork(void); 319 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 320 extern pid_t fork1(void); 321 extern pid_t forkall(void); 322 #endif /* !defined(__XOPEN_OR_POSIX)... */ 323 extern long fpathconf(int, int); 324 #if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2) || \ 325 defined(__EXTENSIONS__) 326 extern int fsync(int); 327 #endif /* !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2)... */ 328 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) || \ 329 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 330 defined(__EXTENSIONS__) 331 extern int ftruncate(int, off_t); 332 #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */ 333 extern char *getcwd(char *, size_t); 334 #if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ 335 defined(__EXTENSIONS__) 336 extern int getdtablesize(void); 337 #endif 338 extern gid_t getegid(void); 339 extern uid_t geteuid(void); 340 extern gid_t getgid(void); 341 extern int getgroups(int, gid_t *); 342 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 343 extern long gethostid(void); 344 #endif 345 #if defined(_XPG4_2) 346 extern int gethostname(char *, size_t); 347 #elif !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 348 extern int gethostname(char *, int); 349 #endif 350 extern char *getlogin(void); 351 #if defined(_XPG4) || defined(__EXTENSIONS__) 352 extern int getopt(int, char *const *, const char *); 353 extern char *optarg; 354 extern int opterr, optind, optopt; 355 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */ 356 #if !defined(_XPG6) || defined(__EXTENSIONS__) 357 extern char *getpass(const char *); 358 #endif 359 #endif /* defined(_XPG4) || defined(__EXTENSIONS__) */ 360 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 361 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */ 362 #if !defined(_XPG6) || defined(__EXTENSIONS__) 363 extern int getpagesize(void); 364 #endif 365 extern pid_t getpgid(pid_t); 366 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 367 extern pid_t getpid(void); 368 extern pid_t getppid(void); 369 extern pid_t getpgrp(void); 370 371 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 372 char *gettxt(const char *, const char *); 373 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 374 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 375 extern pid_t getsid(pid_t); 376 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 377 extern uid_t getuid(void); 378 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 379 extern char *getusershell(void); 380 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 381 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 382 extern char *getwd(char *); 383 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 384 /* 385 * The following ioctl prototype is duplicated in <stropts.h>. The 386 * duplication is necessitated by XPG4.2 which requires the prototype 387 * be defined in <stropts.h>. 388 */ 389 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 390 extern int ioctl(int, int, ...); 391 extern int isaexec(const char *, char *const *, char *const *); 392 extern int issetugid(void); 393 #endif 394 extern int isatty(int); 395 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 396 extern int lchown(const char *, uid_t, gid_t); 397 #endif 398 extern int link(const char *, const char *); 399 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 400 extern offset_t llseek(int, offset_t, int); 401 #endif 402 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \ 403 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 404 defined(__EXTENSIONS__) 405 extern int lockf(int, int, off_t); 406 #endif 407 extern off_t lseek(int, off_t, int); 408 #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ 409 defined(__EXTENSIONS__) 410 extern int nice(int); 411 #endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */ 412 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 413 extern int mincore(caddr_t, size_t, char *); 414 #endif 415 extern long pathconf(const char *, int); 416 extern int pause(void); 417 extern int pipe(int *); 418 #if !defined(_POSIX_C_SOURCE) || defined(_XPG5) || \ 419 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 420 defined(__EXTENSIONS__) 421 extern ssize_t pread(int, void *, size_t, off_t); 422 #endif 423 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 424 extern void profil(unsigned short *, size_t, unsigned long, unsigned int); 425 #endif 426 /* 427 * pthread_atfork() is also declared in <pthread.h> as per SUSv3. The 428 * declarations are identical. A change to either one may also require 429 * appropriate namespace updates in order to avoid redeclaration 430 * warnings in the case where both prototypes are exposed via inclusion 431 * of both <pthread.h> and <unistd.h>. 432 */ 433 #if !defined(__XOPEN_OR_POSIX) || \ 434 ((_POSIX_C_SOURCE > 2) && !defined(_XPG6)) || \ 435 defined(__EXTENSIONS__) 436 extern int pthread_atfork(void (*) (void), void (*) (void), void (*) (void)); 437 #endif /* !defined(__XOPEN_OR_POSIX) || ((_POSIX_C_SOURCE > 2) ... */ 438 #if !defined(_LP64) && \ 439 (!defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)) 440 extern int ptrace(int, pid_t, int, int); 441 #endif 442 #if !defined(_POSIX_C_SOURCE) || defined(_XPG5) || \ 443 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 444 defined(__EXTENSIONS__) 445 extern ssize_t pwrite(int, const void *, size_t, off_t); 446 #endif 447 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 448 /* per RFC 3542; This is also defined in netdb.h */ 449 extern int rcmd_af(char **, unsigned short, const char *, const char *, 450 const char *, int *, int); 451 #endif 452 extern ssize_t read(int, void *, size_t); 453 #if !defined(__XOPEN_OR_POSIX) || \ 454 defined(_XPG4_2) || defined(__EXTENSIONS__) 455 extern ssize_t readlink(const char *_RESTRICT_KYWD, char *_RESTRICT_KYWD, 456 size_t); 457 #endif 458 #if (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3) && !defined(_XPG4))) || \ 459 defined(__EXTENSIONS__) 460 extern int rename(const char *, const char *); 461 #endif /* (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3)... */ 462 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 463 extern int resolvepath(const char *, char *, size_t); 464 /* per RFC 3542; This is also defined in netdb.h */ 465 extern int rexec_af(char **, unsigned short, const char *, const char *, 466 const char *, int *, int); 467 #endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */ 468 extern int rmdir(const char *); 469 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 470 /* per RFC 3542; This is also defined in netdb.h */ 471 extern int rresvport_af(int *, int); 472 #endif 473 474 #if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ 475 defined(__EXTENSIONS__) 476 extern void *sbrk(intptr_t); 477 #endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */ 478 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) 479 extern int setegid(gid_t); 480 extern int seteuid(uid_t); 481 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) ... */ 482 extern int setgid(gid_t); 483 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 484 extern int setgroups(int, const gid_t *); 485 extern int sethostname(char *, int); 486 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 487 extern int setpgid(pid_t, pid_t); 488 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 489 extern pid_t setpgrp(void); 490 extern int setregid(gid_t, gid_t); 491 extern int setreuid(uid_t, uid_t); 492 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 493 extern pid_t setsid(void); 494 extern int setuid(uid_t); 495 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 496 extern void setusershell(void); 497 #endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */ 498 extern unsigned sleep(unsigned); 499 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 500 extern int stime(const time_t *); 501 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 502 #if defined(_XPG4) 503 /* __EXTENSIONS__ makes the SVID Third Edition prototype in stdlib.h visible */ 504 extern void swab(const void *_RESTRICT_KYWD, void *_RESTRICT_KYWD, ssize_t); 505 #endif /* defined(_XPG4) */ 506 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 507 extern int symlink(const char *, const char *); 508 extern void sync(void); 509 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */ 510 #if defined(_XPG5) && !defined(_XPG6) 511 #ifdef __PRAGMA_REDEFINE_EXTNAME 512 #pragma redefine_extname sysconf __sysconf_xpg5 513 #else /* __PRAGMA_REDEFINE_EXTNAME */ 514 #define sysconf __sysconf_xpg5 515 #endif /* __PRAGMA_REDEFINE_EXTNAME */ 516 #endif /* defined(_XPG5) && !defined(_XPG6) */ 517 extern long sysconf(int); 518 extern pid_t tcgetpgrp(int); 519 extern int tcsetpgrp(int, pid_t); 520 #if !defined(__XOPEN_OR_POSIX) || \ 521 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 522 defined(__EXTENSIONS__) 523 extern off_t tell(int); 524 #endif /* !defined(__XOPEN_OR_POSIX)... */ 525 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \ 526 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 527 defined(__EXTENSIONS__) 528 extern int truncate(const char *, off_t); 529 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 530 extern char *ttyname(int); 531 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 532 extern useconds_t ualarm(useconds_t, useconds_t); 533 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 534 extern int unlink(const char *); 535 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 536 extern int usleep(useconds_t); 537 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 538 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 539 extern pid_t vfork(void) __RETURNS_TWICE; 540 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 541 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 542 extern void vhangup(void); 543 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 544 extern ssize_t write(int, const void *, size_t); 545 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 546 extern void yield(void); 547 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 548 549 #if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \ 550 defined(__EXTENSIONS__) 551 /* || defined(_XPG7) */ 552 extern int faccessat(int, const char *, int, int); 553 extern int fchownat(int, const char *, uid_t, gid_t, int); 554 extern int linkat(int, const char *, int, const char *, int); 555 extern ssize_t readlinkat(int, const char *_RESTRICT_KYWD, 556 char *_RESTRICT_KYWD, size_t); 557 extern int renameat(int, const char *, int, const char *); 558 extern int symlinkat(const char *, int, const char *); 559 extern int unlinkat(int, const char *, int); 560 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */ 561 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 562 extern int get_nprocs(void); 563 extern int get_nprocs_conf(void); 564 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 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 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 631 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 632 extern int fchroot(); 633 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 634 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \ 635 defined(__EXTENSIONS__) 636 extern int fdatasync(); 637 #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */ 638 #if !defined(__XOPEN_OR_POSIX) 639 extern int fdetach(); 640 #endif /* !defined(__XOPEN_OR_POSIX) */ 641 extern pid_t fork(); 642 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 643 extern pid_t fork1(); 644 extern pid_t forkall(); 645 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 646 extern long fpathconf(); 647 #if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2) || \ 648 defined(__EXTENSIONS__) 649 extern int fsync(); 650 #endif /* !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2)... */ 651 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) || \ 652 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 653 defined(__EXTENSIONS__) 654 extern int ftruncate(); 655 #endif /* !defined(__XOPEN_OR_POSIX) (_POSIX_C_SOURCE > 2)... */ 656 extern char *getcwd(); 657 #if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ 658 defined(__EXTENSIONS__) 659 extern int getdtablesize(); 660 #endif 661 extern gid_t getegid(); 662 extern uid_t geteuid(); 663 extern gid_t getgid(); 664 extern int getgroups(); 665 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 666 extern long gethostid(); 667 #endif 668 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 669 extern int gethostname(); 670 #endif 671 extern char *getlogin(); 672 #if defined(_XPG4) || defined(__EXTENSIONS__) 673 extern int getopt(); 674 extern char *optarg; 675 extern int opterr, optind, optopt; 676 #if !defined(_XPG6) || defined(__EXTENSIONS__) 677 extern char *getpass(); 678 #endif 679 #endif /* defined(_XPG4) || defined(__EXTENSIONS__) */ 680 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 681 #if !defined(_XPG6) || defined(__EXTENSIONS__) 682 extern int getpagesize(); 683 #endif 684 extern pid_t getpgid(); 685 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 686 extern pid_t getpid(); 687 extern pid_t getppid(); 688 extern pid_t getpgrp(); 689 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 690 char *gettxt(); 691 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 692 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 693 extern pid_t getsid(); 694 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */ 695 extern uid_t getuid(); 696 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 697 extern char *getusershell(); 698 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 699 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 700 extern char *getwd(); 701 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 702 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 703 extern int ioctl(); 704 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 705 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 706 extern int isaexec(); 707 extern int issetugid(); 708 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 709 extern int isatty(); 710 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 711 extern int lchown(); 712 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */ 713 extern int link(); 714 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 715 extern offset_t llseek(); 716 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 717 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \ 718 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 719 defined(__EXTENSIONS__) 720 extern int lockf(); 721 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 722 extern off_t lseek(); 723 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 724 extern int mincore(); 725 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 726 #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ 727 defined(__EXTENSIONS__) 728 extern int nice(); 729 #endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */ 730 extern long pathconf(); 731 extern int pause(); 732 extern int pipe(); 733 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG5) || \ 734 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 735 defined(__EXTENSIONS__) 736 extern ssize_t pread(); 737 #endif 738 #if !defined(_LP64) && \ 739 (!defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)) 740 extern void profil(); 741 extern int ptrace(); 742 #endif 743 #if !defined(__XOPEN_OR_POSIX) || \ 744 ((_POSIX_C_SOURCE > 2) && !defined(_XPG6)) || \ 745 defined(__EXTENSIONS__) 746 extern int pthread_atfork(); 747 #endif /* !defined(__XOPEN_OR_POSIX) || ((_POSIX_C_SOURCE > 2) ... */ 748 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG5) || \ 749 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 750 defined(__EXTENSIONS__) 751 extern ssize_t pwrite(); 752 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG5) */ 753 extern ssize_t read(); 754 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 755 /* per RFC 3542; This is also defined in netdb.h */ 756 extern int rcmd_af(); 757 #endif 758 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 759 extern ssize_t readlink(); 760 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 761 #if (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3) && !defined(_XPG4))) || \ 762 defined(__EXTENSIONS__) 763 extern int rename(); 764 #endif /* (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3)... */ 765 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 766 extern int resolvepath(); 767 /* per RFC 3542; This is also defined in netdb.h */ 768 extern int rexec_af(); 769 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 770 extern int rmdir(); 771 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 772 /* per RFC 3542; This is also defined in netdb.h */ 773 extern int rresvport_af(); 774 #endif 775 #if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ 776 defined(__EXTENSIONS__) 777 extern void *sbrk(); 778 #endif /* !defined(__XOPEN_OR_POSIX)|| (defined(_XPG4_2)... */ 779 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) 780 extern int setegid(); 781 extern int seteuid(); 782 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) ... */ 783 extern int setgid(); 784 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 785 extern int setgroups(); 786 extern int sethostname(); 787 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 788 extern int setpgid(); 789 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 790 extern pid_t setpgrp(); 791 extern int setregid(); 792 extern int setreuid(); 793 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 794 extern pid_t setsid(); 795 extern int setuid(); 796 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 797 extern void setusershell(); 798 #endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */ 799 extern unsigned sleep(); 800 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 801 extern int stime(); 802 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 803 #if defined(_XPG4) 804 /* __EXTENSIONS__ makes the SVID Third Edition prototype in stdlib.h visible */ 805 extern void swab(); 806 #endif /* defined(_XPG4) */ 807 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 808 extern int symlink(); 809 extern void sync(); 810 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 811 #if defined(_XPG5) 812 #ifdef __PRAGMA_REDEFINE_EXTNAME 813 #pragma redefine_extname sysconf __sysconf_xpg5 814 extern long sysconf(); 815 #else /* __PRAGMA_REDEFINE_EXTNAME */ 816 extern long __sysconf_xpg5(); 817 #define sysconf __sysconf_xpg5 818 #endif /* __PRAGMA_REDEFINE_EXTNAME */ 819 #endif /* defined(_XPG5) */ 820 extern pid_t tcgetpgrp(); 821 extern int tcsetpgrp(); 822 #if !defined(__XOPEN_OR_POSIX) || \ 823 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 824 defined(__EXTENSIONS__) 825 extern off_t tell(); 826 #endif /* !defined(__XOPEN_OR_POSIX)... */ 827 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \ 828 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 829 defined(__EXTENSIONS__) 830 extern int truncate(); 831 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 832 extern char *ttyname(); 833 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 834 extern useconds_t ualarm(); 835 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 836 extern int unlink(); 837 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 838 extern int usleep(); 839 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 840 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 841 extern pid_t vfork(); 842 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 843 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 844 extern void vhangup(); 845 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 846 extern ssize_t write(); 847 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 848 extern void yield(); 849 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 850 851 #if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \ 852 defined(__EXTENSIONS__) 853 /* || defined(_XPG7) */ 854 extern int faccessat(); 855 extern int fchownat(); 856 extern int linkat(); 857 extern ssize_t readlinkat(); 858 extern int renameat(); 859 extern int symlinkat(); 860 extern int unlinkat(); 861 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */ 862 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 863 extern int get_nprocs(); 864 extern int get_nprocs_conf(); 865 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 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