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