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 38extern "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 242extern int access(const char *, int); 243#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 244extern int acct(const char *); 245#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 246extern 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__) 250extern int brk(void *); 251#endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */ 252extern int chdir(const char *); 253extern 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__) 257extern int chroot(const char *); 258#endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE))... */ 259extern int close(int); 260#if defined(_XPG4) || defined(__EXTENSIONS__) 261extern size_t confstr(int, char *, size_t); 262extern char *crypt(const char *, const char *); 263#endif /* defined(_XPG4) || defined(__EXTENSIONS__) */ 264#if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ 265 defined(__EXTENSIONS__) 266extern char *ctermid(char *); 267#endif /* (!defined(_POSIX_C_SOURCE) ... */ 268#if !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) || defined(__EXTENSIONS__) 269extern 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__) 273extern char *cuserid(char *); 274#endif 275extern int dup(int); 276extern int dup2(int, int); 277#if defined(_XPG4) || defined(__EXTENSIONS__) 278extern void encrypt(char *, int); 279#endif /* defined(XPG4) || defined(__EXTENSIONS__) */ 280#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 281extern void endusershell(void); 282#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 283extern int execl(const char *, const char *, ...); 284extern int execle(const char *, const char *, ...); 285extern int execlp(const char *, const char *, ...); 286extern int execv(const char *, char *const *); 287extern int execve(const char *, char *const *, char *const *); 288extern int execvp(const char *, char *const *); 289extern 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__) 297extern int fattach(int, const char *); 298#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 299#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 300extern int fchdir(int); 301extern int fchown(int, uid_t, gid_t); 302#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 303#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 304extern int fchroot(int); 305#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 306#if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \ 307 defined(__EXTENSIONS__) 308extern 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__) 316extern int fdetach(const char *); 317#endif /* !defined(__XOPEN_OR_POSIX)... */ 318extern pid_t fork(void); 319#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 320extern pid_t fork1(void); 321extern pid_t forkall(void); 322#endif /* !defined(__XOPEN_OR_POSIX)... */ 323extern long fpathconf(int, int); 324#if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2) || \ 325 defined(__EXTENSIONS__) 326extern 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__) 331extern int ftruncate(int, off_t); 332#endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */ 333extern char *getcwd(char *, size_t); 334#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ 335 defined(__EXTENSIONS__) 336extern int getdtablesize(void); 337#endif 338extern gid_t getegid(void); 339extern uid_t geteuid(void); 340extern gid_t getgid(void); 341extern int getgroups(int, gid_t *); 342#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 343extern long gethostid(void); 344#endif 345#if defined(_XPG4_2) 346extern int gethostname(char *, size_t); 347#elif !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 348extern int gethostname(char *, int); 349#endif 350extern char *getlogin(void); 351#if defined(_XPG4) || defined(__EXTENSIONS__) 352extern int getopt(int, char *const *, const char *); 353extern char *optarg; 354extern int opterr, optind, optopt; 355/* Marked as LEGACY in SUSv2 and removed in SUSv3 */ 356#if !defined(_XPG6) || defined(__EXTENSIONS__) 357extern 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__) 363extern int getpagesize(void); 364#endif 365extern pid_t getpgid(pid_t); 366#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 367extern pid_t getpid(void); 368extern pid_t getppid(void); 369extern pid_t getpgrp(void); 370 371#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 372char *gettxt(const char *, const char *); 373#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 374#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 375extern pid_t getsid(pid_t); 376#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 377extern uid_t getuid(void); 378#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 379extern char *getusershell(void); 380#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 381#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 382extern 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__) 390extern int ioctl(int, int, ...); 391extern int isaexec(const char *, char *const *, char *const *); 392extern int issetugid(void); 393#endif 394extern int isatty(int); 395#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 396extern int lchown(const char *, uid_t, gid_t); 397#endif 398extern int link(const char *, const char *); 399#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 400extern 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__) 405extern int lockf(int, int, off_t); 406#endif 407extern off_t lseek(int, off_t, int); 408#if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ 409 defined(__EXTENSIONS__) 410extern int nice(int); 411#endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */ 412#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 413extern int mincore(caddr_t, size_t, char *); 414#endif 415extern long pathconf(const char *, int); 416extern int pause(void); 417extern int pipe(int *); 418#if !defined(_POSIX_C_SOURCE) || defined(_XPG5) || \ 419 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 420 defined(__EXTENSIONS__) 421extern ssize_t pread(int, void *, size_t, off_t); 422#endif 423#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 424extern 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__) 436extern 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__)) 440extern 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__) 445extern 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 */ 449extern int rcmd_af(char **, unsigned short, const char *, const char *, 450 const char *, int *, int); 451#endif 452extern ssize_t read(int, void *, size_t); 453#if !defined(__XOPEN_OR_POSIX) || \ 454 defined(_XPG4_2) || defined(__EXTENSIONS__) 455extern 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__) 460extern int rename(const char *, const char *); 461#endif /* (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3)... */ 462#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 463extern int resolvepath(const char *, char *, size_t); 464/* per RFC 3542; This is also defined in netdb.h */ 465extern int rexec_af(char **, unsigned short, const char *, const char *, 466 const char *, int *, int); 467#endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */ 468extern int rmdir(const char *); 469#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 470/* per RFC 3542; This is also defined in netdb.h */ 471extern int rresvport_af(int *, int); 472#endif 473 474#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ 475 defined(__EXTENSIONS__) 476extern void *sbrk(intptr_t); 477#endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */ 478#if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) 479extern int setegid(gid_t); 480extern int seteuid(uid_t); 481#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) ... */ 482extern int setgid(gid_t); 483#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 484extern int setgroups(int, const gid_t *); 485extern int sethostname(char *, int); 486#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 487extern int setpgid(pid_t, pid_t); 488#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 489extern pid_t setpgrp(void); 490extern int setregid(gid_t, gid_t); 491extern int setreuid(uid_t, uid_t); 492#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 493extern pid_t setsid(void); 494extern int setuid(uid_t); 495#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 496extern void setusershell(void); 497#endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */ 498extern unsigned sleep(unsigned); 499#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 500extern 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 */ 504extern 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__) 507extern int symlink(const char *, const char *); 508extern 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) */ 517extern long sysconf(int); 518extern pid_t tcgetpgrp(int); 519extern int tcsetpgrp(int, pid_t); 520#if !defined(__XOPEN_OR_POSIX) || \ 521 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 522 defined(__EXTENSIONS__) 523extern 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__) 528extern int truncate(const char *, off_t); 529#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 530extern char *ttyname(int); 531#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 532extern useconds_t ualarm(useconds_t, useconds_t); 533#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 534extern int unlink(const char *); 535#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 536extern int usleep(useconds_t); 537#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 538#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 539extern pid_t vfork(void); 540#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 541#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 542extern void vhangup(void); 543#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 544extern ssize_t write(int, const void *, size_t); 545#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 546extern 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) */ 552extern int faccessat(int, const char *, int, int); 553extern int fchownat(int, const char *, uid_t, gid_t, int); 554extern int linkat(int, const char *, int, const char *, int); 555extern ssize_t readlinkat(int, const char *_RESTRICT_KYWD, 556 char *_RESTRICT_KYWD, size_t); 557extern int renameat(int, const char *, int, const char *); 558extern int symlinkat(const char *, int, const char *); 559extern int unlinkat(int, const char *, int); 560#endif /* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */ 561#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 562extern int get_nprocs(void); 563extern 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)) 569extern int ftruncate64(int, off64_t); 570extern off64_t lseek64(int, off64_t, int); 571extern ssize_t pread64(int, void *, size_t, off64_t); 572extern ssize_t pwrite64(int, const void *, size_t, off64_t); 573extern off64_t tell64(int); 574extern int truncate64(const char *, off64_t); 575extern int lockf64(int, int, off64_t); 576#endif /* _LARGEFILE64_SOURCE */ 577 578#else /* __STDC__ */ 579 580extern int access(); 581#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 582extern int acct(); 583#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 584extern unsigned alarm(); 585#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ 586 defined(__EXTENSIONS__) 587extern int brk(); 588#endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */ 589extern int chdir(); 590extern int chown(); 591#if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ 592 defined(__EXTENSIONS__) 593extern int chroot(); 594#endif /* (!defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */ 595extern int close(); 596#if defined(_XPG4) || defined(__EXTENSIONS__) 597extern size_t confstr(); 598extern char *crypt(); 599#endif /* defined(XPG4) || defined(__EXTENSIONS__) */ 600#if !defined(_POSIX_C_SOURCE) || defined(_XPG3) || defined(__EXTENSIONS__) 601extern char *ctermid(); 602#endif /* (!defined(_POSIX_C_SOURCE) || defined(_XPG3)... */ 603#if !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) || defined(__EXTENSIONS__) 604extern char *ctermid_r(); 605#endif /* !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) ... */ 606#if !defined(_XPG6) || defined(__EXTENSIONS__) 607extern char *cuserid(); 608#endif 609extern int dup(); 610extern int dup2(); 611#if defined(_XPG4) || defined(__EXTENSIONS__) 612extern void encrypt(); 613#endif /* defined(_XPG4) || defined(__EXTENSIONS__) */ 614#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 615extern void endusershell(); 616#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 617extern int execl(); 618extern int execle(); 619extern int execlp(); 620extern int execv(); 621extern int execve(); 622extern int execvp(); 623extern void _exit(); 624#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 625extern int fattach(); 626#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 627#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 628extern int fchdir(); 629extern int fchown(); 630#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 631#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 632extern int fchroot(); 633#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 634#if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \ 635 defined(__EXTENSIONS__) 636extern int fdatasync(); 637#endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */ 638#if !defined(__XOPEN_OR_POSIX) 639extern int fdetach(); 640#endif /* !defined(__XOPEN_OR_POSIX) */ 641extern pid_t fork(); 642#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 643extern pid_t fork1(); 644extern pid_t forkall(); 645#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 646extern long fpathconf(); 647#if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2) || \ 648 defined(__EXTENSIONS__) 649extern 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__) 654extern int ftruncate(); 655#endif /* !defined(__XOPEN_OR_POSIX) (_POSIX_C_SOURCE > 2)... */ 656extern char *getcwd(); 657#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ 658 defined(__EXTENSIONS__) 659extern int getdtablesize(); 660#endif 661extern gid_t getegid(); 662extern uid_t geteuid(); 663extern gid_t getgid(); 664extern int getgroups(); 665#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 666extern long gethostid(); 667#endif 668#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 669extern int gethostname(); 670#endif 671extern char *getlogin(); 672#if defined(_XPG4) || defined(__EXTENSIONS__) 673extern int getopt(); 674extern char *optarg; 675extern int opterr, optind, optopt; 676#if !defined(_XPG6) || defined(__EXTENSIONS__) 677extern 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__) 682extern int getpagesize(); 683#endif 684extern pid_t getpgid(); 685#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 686extern pid_t getpid(); 687extern pid_t getppid(); 688extern pid_t getpgrp(); 689#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 690char *gettxt(); 691#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 692#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 693extern pid_t getsid(); 694#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */ 695extern uid_t getuid(); 696#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 697extern char *getusershell(); 698#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 699#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 700extern char *getwd(); 701#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 702#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 703extern int ioctl(); 704#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 705#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 706extern int isaexec(); 707extern int issetugid(); 708#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 709extern int isatty(); 710#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 711extern int lchown(); 712#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */ 713extern int link(); 714#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 715extern 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__) 720extern int lockf(); 721#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 722extern off_t lseek(); 723#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 724extern int mincore(); 725#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 726#if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ 727 defined(__EXTENSIONS__) 728extern int nice(); 729#endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */ 730extern long pathconf(); 731extern int pause(); 732extern int pipe(); 733#if !defined(__XOPEN_OR_POSIX) || defined(_XPG5) || \ 734 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 735 defined(__EXTENSIONS__) 736extern ssize_t pread(); 737#endif 738#if !defined(_LP64) && \ 739 (!defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)) 740extern void profil(); 741extern int ptrace(); 742#endif 743#if !defined(__XOPEN_OR_POSIX) || \ 744 ((_POSIX_C_SOURCE > 2) && !defined(_XPG6)) || \ 745 defined(__EXTENSIONS__) 746extern 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__) 751extern ssize_t pwrite(); 752#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG5) */ 753extern ssize_t read(); 754#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 755/* per RFC 3542; This is also defined in netdb.h */ 756extern int rcmd_af(); 757#endif 758#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 759extern 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__) 763extern int rename(); 764#endif /* (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3)... */ 765#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 766extern int resolvepath(); 767/* per RFC 3542; This is also defined in netdb.h */ 768extern int rexec_af(); 769#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 770extern int rmdir(); 771#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 772/* per RFC 3542; This is also defined in netdb.h */ 773extern int rresvport_af(); 774#endif 775#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ 776 defined(__EXTENSIONS__) 777extern void *sbrk(); 778#endif /* !defined(__XOPEN_OR_POSIX)|| (defined(_XPG4_2)... */ 779#if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) 780extern int setegid(); 781extern int seteuid(); 782#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) ... */ 783extern int setgid(); 784#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 785extern int setgroups(); 786extern int sethostname(); 787#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 788extern int setpgid(); 789#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 790extern pid_t setpgrp(); 791extern int setregid(); 792extern int setreuid(); 793#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 794extern pid_t setsid(); 795extern int setuid(); 796#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 797extern void setusershell(); 798#endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */ 799extern unsigned sleep(); 800#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 801extern 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 */ 805extern void swab(); 806#endif /* defined(_XPG4) */ 807#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 808extern int symlink(); 809extern 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 814extern long sysconf(); 815#else /* __PRAGMA_REDEFINE_EXTNAME */ 816extern long __sysconf_xpg5(); 817#define sysconf __sysconf_xpg5 818#endif /* __PRAGMA_REDEFINE_EXTNAME */ 819#endif /* defined(_XPG5) */ 820extern pid_t tcgetpgrp(); 821extern int tcsetpgrp(); 822#if !defined(__XOPEN_OR_POSIX) || \ 823 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 824 defined(__EXTENSIONS__) 825extern 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__) 830extern int truncate(); 831#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 832extern char *ttyname(); 833#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 834extern useconds_t ualarm(); 835#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 836extern int unlink(); 837#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 838extern int usleep(); 839#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 840#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 841extern pid_t vfork(); 842#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 843#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 844extern void vhangup(); 845#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 846extern ssize_t write(); 847#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 848extern 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) */ 854extern int faccessat(); 855extern int fchownat(); 856extern int linkat(); 857extern ssize_t readlinkat(); 858extern int renameat(); 859extern int symlinkat(); 860extern int unlinkat(); 861#endif /* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */ 862#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 863extern int get_nprocs(); 864extern 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)) 870extern int ftruncate64(); 871extern off64_t lseek64(); 872extern ssize_t pread64(); 873extern ssize_t pwrite64(); 874extern off64_t tell64(); 875extern int truncate64(); 876extern 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 932extern int getlogin_r(char *, int); 933extern int ttyname_r(int, char *, size_t); 934#else /* __PRAGMA_REDEFINE_EXTNAME */ 935 936extern int __posix_getlogin_r(char *, int); 937extern 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 946static int 947getlogin_r(char *__name, int __len) 948{ 949 return (__posix_getlogin_r(__name, __len)); 950} 951static int 952ttyname_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 962extern char *getlogin_r(char *, int); 963extern 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 974extern int getlogin_r(); 975extern int ttyname_r(); 976#else /* __PRAGMA_REDEFINE_EXTNAME */ 977 978extern int __posix_getlogin_r(); 979extern 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 988static int 989getlogin_r(__name, __len) 990 char *__name; 991 int __len; 992{ 993 return (__posix_getlogin_r(__name, __len)); 994} 995static int 996ttyname_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 1008extern char *getlogin_r(); 1009extern 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