unistd.h revision 12789:82cffaae72d5
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 562/* transitional large file interface versions */ 563#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ 564 !defined(__PRAGMA_REDEFINE_EXTNAME)) 565extern int ftruncate64(int, off64_t); 566extern off64_t lseek64(int, off64_t, int); 567extern ssize_t pread64(int, void *, size_t, off64_t); 568extern ssize_t pwrite64(int, const void *, size_t, off64_t); 569extern off64_t tell64(int); 570extern int truncate64(const char *, off64_t); 571extern int lockf64(int, int, off64_t); 572#endif /* _LARGEFILE64_SOURCE */ 573 574#else /* __STDC__ */ 575 576extern int access(); 577#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 578extern int acct(); 579#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 580extern unsigned alarm(); 581#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ 582 defined(__EXTENSIONS__) 583extern int brk(); 584#endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */ 585extern int chdir(); 586extern int chown(); 587#if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ 588 defined(__EXTENSIONS__) 589extern int chroot(); 590#endif /* (!defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */ 591extern int close(); 592#if defined(_XPG4) || defined(__EXTENSIONS__) 593extern size_t confstr(); 594extern char *crypt(); 595#endif /* defined(XPG4) || defined(__EXTENSIONS__) */ 596#if !defined(_POSIX_C_SOURCE) || defined(_XPG3) || defined(__EXTENSIONS__) 597extern char *ctermid(); 598#endif /* (!defined(_POSIX_C_SOURCE) || defined(_XPG3)... */ 599#if !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) || defined(__EXTENSIONS__) 600extern char *ctermid_r(); 601#endif /* !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) ... */ 602#if !defined(_XPG6) || defined(__EXTENSIONS__) 603extern char *cuserid(); 604#endif 605extern int dup(); 606extern int dup2(); 607#if defined(_XPG4) || defined(__EXTENSIONS__) 608extern void encrypt(); 609#endif /* defined(_XPG4) || defined(__EXTENSIONS__) */ 610#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 611extern void endusershell(); 612#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 613extern int execl(); 614extern int execle(); 615extern int execlp(); 616extern int execv(); 617extern int execve(); 618extern int execvp(); 619extern void _exit(); 620#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 621extern int fattach(); 622#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 623#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 624extern int fchdir(); 625extern int fchown(); 626#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 627#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 628extern int fchroot(); 629#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 630#if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \ 631 defined(__EXTENSIONS__) 632extern int fdatasync(); 633#endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */ 634#if !defined(__XOPEN_OR_POSIX) 635extern int fdetach(); 636#endif /* !defined(__XOPEN_OR_POSIX) */ 637extern pid_t fork(); 638#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 639extern pid_t fork1(); 640extern pid_t forkall(); 641#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 642extern long fpathconf(); 643#if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2) || \ 644 defined(__EXTENSIONS__) 645extern int fsync(); 646#endif /* !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2)... */ 647#if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) || \ 648 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 649 defined(__EXTENSIONS__) 650extern int ftruncate(); 651#endif /* !defined(__XOPEN_OR_POSIX) (_POSIX_C_SOURCE > 2)... */ 652extern char *getcwd(); 653#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ 654 defined(__EXTENSIONS__) 655extern int getdtablesize(); 656#endif 657extern gid_t getegid(); 658extern uid_t geteuid(); 659extern gid_t getgid(); 660extern int getgroups(); 661#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 662extern long gethostid(); 663#endif 664#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 665extern int gethostname(); 666#endif 667extern char *getlogin(); 668#if defined(_XPG4) || defined(__EXTENSIONS__) 669extern int getopt(); 670extern char *optarg; 671extern int opterr, optind, optopt; 672#if !defined(_XPG6) || defined(__EXTENSIONS__) 673extern char *getpass(); 674#endif 675#endif /* defined(_XPG4) || defined(__EXTENSIONS__) */ 676#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 677#if !defined(_XPG6) || defined(__EXTENSIONS__) 678extern int getpagesize(); 679#endif 680extern pid_t getpgid(); 681#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 682extern pid_t getpid(); 683extern pid_t getppid(); 684extern pid_t getpgrp(); 685#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 686char *gettxt(); 687#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 688#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 689extern pid_t getsid(); 690#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */ 691extern uid_t getuid(); 692#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 693extern char *getusershell(); 694#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 695#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 696extern char *getwd(); 697#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 698#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 699extern int ioctl(); 700#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 701#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 702extern int isaexec(); 703extern int issetugid(); 704#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 705extern int isatty(); 706#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 707extern int lchown(); 708#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */ 709extern int link(); 710#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 711extern offset_t llseek(); 712#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 713#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \ 714 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 715 defined(__EXTENSIONS__) 716extern int lockf(); 717#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 718extern off_t lseek(); 719#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 720extern int mincore(); 721#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 722#if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ 723 defined(__EXTENSIONS__) 724extern int nice(); 725#endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */ 726extern long pathconf(); 727extern int pause(); 728extern int pipe(); 729#if !defined(__XOPEN_OR_POSIX) || defined(_XPG5) || \ 730 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 731 defined(__EXTENSIONS__) 732extern ssize_t pread(); 733#endif 734#if !defined(_LP64) && \ 735 (!defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)) 736extern void profil(); 737extern int ptrace(); 738#endif 739#if !defined(__XOPEN_OR_POSIX) || \ 740 ((_POSIX_C_SOURCE > 2) && !defined(_XPG6)) || \ 741 defined(__EXTENSIONS__) 742extern int pthread_atfork(); 743#endif /* !defined(__XOPEN_OR_POSIX) || ((_POSIX_C_SOURCE > 2) ... */ 744#if !defined(__XOPEN_OR_POSIX) || defined(_XPG5) || \ 745 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 746 defined(__EXTENSIONS__) 747extern ssize_t pwrite(); 748#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG5) */ 749extern ssize_t read(); 750#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 751/* per RFC 3542; This is also defined in netdb.h */ 752extern int rcmd_af(); 753#endif 754#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 755extern ssize_t readlink(); 756#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 757#if (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3) && !defined(_XPG4))) || \ 758 defined(__EXTENSIONS__) 759extern int rename(); 760#endif /* (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3)... */ 761#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 762extern int resolvepath(); 763/* per RFC 3542; This is also defined in netdb.h */ 764extern int rexec_af(); 765#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 766extern int rmdir(); 767#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 768/* per RFC 3542; This is also defined in netdb.h */ 769extern int rresvport_af(); 770#endif 771#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ 772 defined(__EXTENSIONS__) 773extern void *sbrk(); 774#endif /* !defined(__XOPEN_OR_POSIX)|| (defined(_XPG4_2)... */ 775#if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) 776extern int setegid(); 777extern int seteuid(); 778#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) ... */ 779extern int setgid(); 780#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 781extern int setgroups(); 782extern int sethostname(); 783#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 784extern int setpgid(); 785#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 786extern pid_t setpgrp(); 787extern int setregid(); 788extern int setreuid(); 789#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 790extern pid_t setsid(); 791extern int setuid(); 792#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 793extern void setusershell(); 794#endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */ 795extern unsigned sleep(); 796#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 797extern int stime(); 798#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 799#if defined(_XPG4) 800/* __EXTENSIONS__ makes the SVID Third Edition prototype in stdlib.h visible */ 801extern void swab(); 802#endif /* defined(_XPG4) */ 803#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 804extern int symlink(); 805extern void sync(); 806#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 807#if defined(_XPG5) 808#ifdef __PRAGMA_REDEFINE_EXTNAME 809#pragma redefine_extname sysconf __sysconf_xpg5 810extern long sysconf(); 811#else /* __PRAGMA_REDEFINE_EXTNAME */ 812extern long __sysconf_xpg5(); 813#define sysconf __sysconf_xpg5 814#endif /* __PRAGMA_REDEFINE_EXTNAME */ 815#endif /* defined(_XPG5) */ 816extern pid_t tcgetpgrp(); 817extern int tcsetpgrp(); 818#if !defined(__XOPEN_OR_POSIX) || \ 819 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 820 defined(__EXTENSIONS__) 821extern off_t tell(); 822#endif /* !defined(__XOPEN_OR_POSIX)... */ 823#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \ 824 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 825 defined(__EXTENSIONS__) 826extern int truncate(); 827#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 828extern char *ttyname(); 829#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 830extern useconds_t ualarm(); 831#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 832extern int unlink(); 833#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 834extern int usleep(); 835#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 836#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 837extern pid_t vfork(); 838#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 839#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 840extern void vhangup(); 841#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 842extern ssize_t write(); 843#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 844extern void yield(); 845#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 846 847#if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \ 848 defined(__EXTENSIONS__) 849 /* || defined(_XPG7) */ 850extern int faccessat(); 851extern int fchownat(); 852extern int linkat(); 853extern ssize_t readlinkat(); 854extern int renameat(); 855extern int symlinkat(); 856extern int unlinkat(); 857#endif /* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */ 858 859/* transitional large file interface versions */ 860#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ 861 !defined(__PRAGMA_REDEFINE_EXTNAME)) 862extern int ftruncate64(); 863extern off64_t lseek64(); 864extern ssize_t pread64(); 865extern ssize_t pwrite64(); 866extern off64_t tell64(); 867extern int truncate64(); 868extern int lockf64(); 869#endif /* _LARGEFILE64_SOURCE */ 870 871#endif /* __STDC__ */ 872 873#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 874#pragma unknown_control_flow(vfork) 875#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 876 877/* 878 * getlogin_r() & ttyname_r() prototypes are defined here. 879 */ 880 881/* 882 * Previous releases of Solaris, starting at 2.3, provided definitions of 883 * various functions as specified in POSIX.1c, Draft 6. For some of these 884 * functions, the final POSIX 1003.1c standard had a different number of 885 * arguments and return values. 886 * 887 * The following segment of this header provides support for the standard 888 * interfaces while supporting applications written under earlier 889 * releases. The application defines appropriate values of the feature 890 * test macros _POSIX_C_SOURCE and _POSIX_PTHREAD_SEMANTICS to indicate 891 * whether it was written to expect the Draft 6 or standard versions of 892 * these interfaces, before including this header. This header then 893 * provides a mapping from the source version of the interface to an 894 * appropriate binary interface. Such mappings permit an application 895 * to be built from libraries and objects which have mixed expectations 896 * of the definitions of these functions. 897 * 898 * For applications using the Draft 6 definitions, the binary symbol is the 899 * same as the source symbol, and no explicit mapping is needed. For the 900 * standard interface, the function func() is mapped to the binary symbol 901 * _posix_func(). The preferred mechanism for the remapping is a compiler 902 * #pragma. If the compiler does not provide such a #pragma, the header file 903 * defines a static function func() which calls the _posix_func() version; 904 * this has to be done instead of #define since POSIX specifies that an 905 * application can #undef the symbol and still be bound to the correct 906 * implementation. Unfortunately, the statics confuse lint so we fallback to 907 * #define in that case. 908 * 909 * NOTE: Support for the Draft 6 definitions is provided for compatibility 910 * only. New applications/libraries should use the standard definitions. 911 */ 912 913#if defined(__EXTENSIONS__) || defined(_REENTRANT) || \ 914 !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE - 0 >= 199506L) || \ 915 defined(_POSIX_PTHREAD_SEMANTICS) 916 917#if defined(__STDC__) 918 919#if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS) 920 921#ifdef __PRAGMA_REDEFINE_EXTNAME 922#pragma redefine_extname getlogin_r __posix_getlogin_r 923#pragma redefine_extname ttyname_r __posix_ttyname_r 924extern int getlogin_r(char *, int); 925extern int ttyname_r(int, char *, size_t); 926#else /* __PRAGMA_REDEFINE_EXTNAME */ 927 928extern int __posix_getlogin_r(char *, int); 929extern int __posix_ttyname_r(int, char *, size_t); 930 931#ifdef __lint 932 933#define getlogin_r __posix_getlogin_r 934#define ttyname_r __posix_ttyname_r 935 936#else /* !__lint */ 937 938static int 939getlogin_r(char *__name, int __len) 940{ 941 return (__posix_getlogin_r(__name, __len)); 942} 943static int 944ttyname_r(int __fildes, char *__buf, size_t __size) 945{ 946 return (__posix_ttyname_r(__fildes, __buf, __size)); 947} 948 949#endif /* !__lint */ 950#endif /* __PRAGMA_REDEFINE_EXTNAME */ 951 952#else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ 953 954extern char *getlogin_r(char *, int); 955extern char *ttyname_r(int, char *, int); 956 957#endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ 958 959#else /* __STDC__ */ 960 961#if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS) 962 963#ifdef __PRAGMA_REDEFINE_EXTNAME 964#pragma redefine_extname getlogin_r __posix_getlogin_r 965#pragma redefine_extname ttyname_r __posix_ttyname_r 966extern int getlogin_r(); 967extern int ttyname_r(); 968#else /* __PRAGMA_REDEFINE_EXTNAME */ 969 970extern int __posix_getlogin_r(); 971extern int __posix_ttyname_r(); 972 973#ifdef __lint 974 975#define getlogin_r __posix_getlogin_r 976#define ttyname_r __posix_ttyname_r 977 978#else /* !__lint */ 979 980static int 981getlogin_r(__name, __len) 982 char *__name; 983 int __len; 984{ 985 return (__posix_getlogin_r(__name, __len)); 986} 987static int 988ttyname_r(__fildes, __buf, __size) 989 int __fildes; 990 char *__buf; 991 size_t __size; 992{ 993 return (__posix_ttyname_r(__fildes, __buf, __size)); 994} 995#endif /* !__lint */ 996#endif /* __PRAGMA_REDEFINE_EXTNAME */ 997 998#else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ 999 1000extern char *getlogin_r(); 1001extern char *ttyname_r(); 1002 1003#endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ 1004 1005#endif /* __STDC__ */ 1006 1007#endif /* defined(__EXTENSIONS__) || defined(_REENTRANT)... */ 1008 1009#ifdef __cplusplus 1010} 1011#endif 1012 1013#endif /* _UNISTD_H */ 1014