1 /* $Header: /src/pub/tcsh/tc.os.h,v 3.82 1999/02/06 15:19:03 christos Exp $ */ 2 /* 3 * tc.os.h: Shell os dependent defines 4 */ 5 /*- 6 * Copyright (c) 1980, 1991 The Regents of the University of California. 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 3. All advertising materials mentioning features or use of this software 18 * must display the following acknowledgement: 19 * This product includes software developed by the University of 20 * California, Berkeley and its contributors. 21 * 4. Neither the name of the University nor the names of its contributors 22 * may be used to endorse or promote products derived from this software 23 * without specific prior written permission. 24 * 25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 * SUCH DAMAGE. 36 */ 37 #ifndef _h_tc_os 38 #define _h_tc_os 39 40 #ifndef WINNT 41 #define NEEDstrerror /* Too hard to find which systems have it */ 42 #endif /* WINNT */ 43 44 45 #ifdef notdef 46 /* 47 * for SVR4 and linux we used to fork pipelines backwards. 48 * This should not be needed any more. 49 * more info in sh.sem.c 50 */ 51 # define BACKPIPE 52 #endif /* notdef */ 53 54 #ifdef _VMS_POSIX 55 # ifndef NOFILE 56 # define NOFILE 64 57 # endif /* NOFILE */ 58 # define nice(a) setprio((getpid()),a) 59 # undef NEEDstrerror /* won't get sensible error messages otherwise */ 60 # define NEEDgethostname 61 # include <sys/time.h> /* for time stuff in tc.prompt.c */ 62 # include <limits.h> 63 #endif /* atp vmsposix */ 64 65 #if defined(DECOSF1) || defined(HPUXVERSION) 66 # include <sys/signal.h> 67 #endif /* DECOSF1 || HPUXVERSION */ 68 69 #ifdef DECOSF1 70 # include <sys/ioctl.h> 71 #endif /* DECOSF1 */ 72 73 #if defined(OPEN_MAX) && !defined(NOFILE) 74 # define NOFILE OPEN_MAX 75 #endif /* OPEN_MAX && !NOFILE */ 76 77 #if defined(USR_NFDS) && !defined(NOFILE) 78 # define NOFILE USR_NFDS 79 #endif /* USR_NFDS && !NOFILE */ 80 81 #ifndef NOFILE 82 # define NOFILE 256 83 #endif /* NOFILE */ 84 85 #if defined(linux) || defined(__NetBSD__) || defined(__FreeBSD__) || SYSVREL >= 4 86 # undef NEEDstrerror 87 #endif /* linux || __NetBSD__ || __FreeBSD__ || SYSVREL >= 4 */ 88 89 #if !defined(pyr) && !defined(sinix) 90 /* Pyramid's cpp complains about the next line */ 91 # if defined(BSD) && BSD >= 199306 92 # undef NEEDstrerror 93 # endif /* BSD && BSD >= 199306 */ 94 #endif /* pyr */ 95 96 #ifdef OREO 97 # include <sys/time.h> 98 # ifdef notdef 99 /* Don't include it, because it defines things we don't really have */ 100 # include <sys/resource.h> 101 # endif /* notdef */ 102 # ifdef POSIX 103 # include <sys/tty.h> 104 # include <termios.h> 105 # endif /* POSIX */ 106 #endif /* OREO */ 107 108 #ifndef NCARGS 109 # ifdef _SC_ARG_MAX 110 # define NCARGS sysconf(_SC_ARG_MAX) 111 # else /* !_SC_ARG_MAX */ 112 # ifdef ARG_MAX 113 # define NCARGS ARG_MAX 114 # else /* !ARG_MAX */ 115 # ifdef _MINIX 116 # define NCARGS 80 117 # else /* !_MINIX */ 118 # define NCARGS 1024 119 # endif /* _MINIX */ 120 # endif /* ARG_MAX */ 121 # endif /* _SC_ARG_MAX */ 122 #endif /* NCARGS */ 123 124 #ifdef convex 125 # include <sys/dmon.h> 126 #endif /* convex */ 127 128 #ifdef titan 129 extern int end; 130 #endif /* titan */ 131 132 #ifdef hpux 133 # ifdef lint 134 /* 135 * Hpux defines struct ucred, in <sys/user.h>, but if I include that 136 * then I need to include the *world* 137 * [all this to pass lint cleanly!!!] 138 * so I define struct ucred here... 139 */ 140 struct ucred { 141 int foo; 142 }; 143 # endif /* lint */ 144 145 /* 146 * hpux 7.0 does not define it 147 */ 148 # ifndef CSUSP 149 # define CSUSP 032 150 # endif /* CSUSP */ 151 152 # include <signal.h> 153 # if !defined(hp9000s500) && !(defined(SIGRTMAX) || defined(SIGRTMIN)) 154 /* 155 * hpux < 7 156 */ 157 # include <sys/bsdtty.h> 158 # endif /* !hp9000s500 && !(SIGRTMAX || SIGRTMIN) */ 159 160 # ifndef POSIX 161 # ifdef BSDJOBS 162 # define getpgrp(a) getpgrp2(a) 163 # define setpgrp(a, b) setpgrp2(a, b) 164 # endif /* BSDJOBS */ 165 # endif /* POSIX */ 166 #endif /* hpux */ 167 168 /* 169 * ISC does not define CSUSP 170 */ 171 #ifdef ISC 172 # ifndef CSUSP 173 # define CSUSP 032 174 # endif /* CSUSP */ 175 # if defined(POSIX) && !defined(TIOCGWINSZ) 176 /* 177 * ISC defines this only in termio.h. If we are using POSIX and include 178 * termios.h, then we define it ourselves so that window resizing works. 179 */ 180 # define TIOCGWINSZ (('T'<<8)|104) 181 # endif /* POSIX && !TIOCGWINSZ */ 182 #endif /* ISC */ 183 184 #ifdef ISC202 185 # undef TIOCGWINSZ 186 #endif /* ISC202 */ 187 188 /* 189 * XXX: This will be changed soon to 190 * #if (SYSVREL > 0) && defined(TIOCGWINSZ) 191 * If that breaks on your machine, let me know. 192 * 193 * It would break on linux, where all this is 194 * defined in <termios.h>. Wrapper added. 195 */ 196 #if !defined(linux) && !defined(_VMS_POSIX) 197 # if defined(INTEL) || defined(u3b2) || defined (u3b5) || defined(ub15) || defined(u3b20d) || defined(ISC) || defined(SCO) || defined(tower32) 198 # ifdef TIOCGWINSZ 199 /* 200 * for struct winsiz 201 */ 202 # include <sys/stream.h> 203 # include <sys/ptem.h> 204 # endif /* TIOCGWINSZ */ 205 # ifndef ODT 206 # define NEEDgethostname 207 # endif /* ODT */ 208 # endif /* INTEL || u3b2 || u3b5 || ub15 || u3b20d || ISC || SCO || tower32 */ 209 #endif /* !linux && !_VMS_POSIX */ 210 211 #if defined(UNIXPC) || defined(COHERENT) 212 # define NEEDgethostname 213 #endif /* UNIXPC || COHERENT */ 214 215 #ifdef IRIS4D 216 # include <sys/time.h> 217 # include <sys/resource.h> 218 # ifndef POSIX 219 /* 220 * BSDsetpgrp() and BSDgetpgrp() are BSD versions of setpgrp, etc. 221 */ 222 # define setpgrp BSDsetpgrp 223 # define getpgrp BSDgetpgrp 224 # endif /* POSIX */ 225 #endif /* IRIS4D */ 226 227 /* 228 * For some versions of system V software, specially ones that use the 229 * Wollongong Software TCP/IP, the FIOCLEX, FIONCLEX, FIONBIO calls 230 * might not work correctly for file descriptors [they work only for 231 * sockets]. So we try to use first the fcntl() and we only use the 232 * ioctl() form, only if we don't have the fcntl() one. 233 * 234 * From: scott@craycos.com (Scott Bolte) 235 */ 236 #ifndef WINNT 237 # ifdef F_SETFD 238 # define close_on_exec(fd, v) fcntl((fd), F_SETFD, v) 239 # else /* !F_SETFD */ 240 # ifdef FIOCLEX 241 # define close_on_exec(fd, v) ioctl((fd), ((v) ? FIOCLEX : FIONCLEX), NULL) 242 # else /* !FIOCLEX */ 243 # define close_on_exec(fd, v) /* Nothing */ 244 # endif /* FIOCLEX */ 245 # endif /* F_SETFD */ 246 #else /* WINNT */ 247 # define close_on_exec(fd, v) nt_close_on_exec((fd),(v)) 248 #endif /* !WINNT */ 249 250 /* 251 * Stat 252 */ 253 #ifdef ISC 254 /* these are not defined for _POSIX_SOURCE under ISC 2.2 */ 255 # ifndef S_IFMT 256 # define S_IFMT 0170000 /* type of file */ 257 # define S_IFDIR 0040000 /* directory */ 258 # define S_IFCHR 0020000 /* character special */ 259 # define S_IFBLK 0060000 /* block special */ 260 # define S_IFREG 0100000 /* regular */ 261 # define S_IFIFO 0010000 /* fifo */ 262 # define S_IFNAM 0050000 /* special named file */ 263 # ifndef ISC202 264 # define S_IFLNK 0120000 /* symbolic link */ 265 # endif /* ISC202 */ 266 # endif /* S_IFMT */ 267 #endif /* ISC */ 268 269 #if defined(uts) || defined(UTekV) || defined(sysV88) 270 /* 271 * The uts 2.1.2 macros (Amdahl) are busted! 272 * You should fix <sys/stat.h>, cause other programs will break too! 273 * 274 * From: creiman@ncsa.uiuc.edu (Charlie Reiman) 275 */ 276 277 /* 278 * The same applies to Motorola MPC (System V/88 R32V2, UTekV 3.2e) 279 * workstations, the stat macros are broken. 280 * Kaveh Ghazi (ghazi@caip.rutgers.edu) 281 */ 282 # undef S_ISDIR 283 # undef S_ISCHR 284 # undef S_ISBLK 285 # undef S_ISREG 286 # undef S_ISFIFO 287 # undef S_ISNAM 288 # undef S_ISLNK 289 # undef S_ISSOCK 290 #endif /* uts || UTekV || sysV88 */ 291 292 #ifdef S_IFMT 293 # if !defined(S_ISDIR) && defined(S_IFDIR) 294 # define S_ISDIR(a) (((a) & S_IFMT) == S_IFDIR) 295 # endif /* ! S_ISDIR && S_IFDIR */ 296 # if !defined(S_ISCHR) && defined(S_IFCHR) 297 # define S_ISCHR(a) (((a) & S_IFMT) == S_IFCHR) 298 # endif /* ! S_ISCHR && S_IFCHR */ 299 # if !defined(S_ISBLK) && defined(S_IFBLK) 300 # define S_ISBLK(a) (((a) & S_IFMT) == S_IFBLK) 301 # endif /* ! S_ISBLK && S_IFBLK */ 302 # if !defined(S_ISREG) && defined(S_IFREG) 303 # define S_ISREG(a) (((a) & S_IFMT) == S_IFREG) 304 # endif /* ! S_ISREG && S_IFREG */ 305 # if !defined(S_ISFIFO) && defined(S_IFIFO) 306 # define S_ISFIFO(a) (((a) & S_IFMT) == S_IFIFO) 307 # endif /* ! S_ISFIFO && S_IFIFO */ 308 # if !defined(S_ISNAM) && defined(S_IFNAM) 309 # define S_ISNAM(a) (((a) & S_IFMT) == S_IFNAM) 310 # endif /* ! S_ISNAM && S_IFNAM */ 311 # if !defined(S_ISLNK) && defined(S_IFLNK) 312 # define S_ISLNK(a) (((a) & S_IFMT) == S_IFLNK) 313 # endif /* ! S_ISLNK && S_IFLNK */ 314 # if !defined(S_ISSOCK) && defined(S_IFSOCK) 315 # define S_ISSOCK(a) (((a) & S_IFMT) == S_IFSOCK) 316 # endif /* ! S_ISSOCK && S_IFSOCK */ 317 #endif /* S_IFMT */ 318 319 #ifdef tower32 320 /* The header files lie; we really don't have symlinks */ 321 # undef S_ISLNK 322 # undef S_IFLNK 323 #endif /* tower32 */ 324 325 #ifndef S_IREAD 326 # define S_IREAD 0000400 327 #endif /* S_IREAD */ 328 #ifndef S_IROTH 329 # define S_IROTH (S_IREAD >> 6) 330 #endif /* S_IROTH */ 331 #ifndef S_IRGRP 332 # define S_IRGRP (S_IREAD >> 3) 333 #endif /* S_IRGRP */ 334 #ifndef S_IRUSR 335 # define S_IRUSR S_IREAD 336 #endif /* S_IRUSR */ 337 338 #ifndef S_IWRITE 339 # define S_IWRITE 0000200 340 #endif /* S_IWRITE */ 341 #ifndef S_IWOTH 342 # define S_IWOTH (S_IWRITE >> 6) 343 #endif /* S_IWOTH */ 344 #ifndef S_IWGRP 345 # define S_IWGRP (S_IWRITE >> 3) 346 #endif /* S_IWGRP */ 347 #ifndef S_IWUSR 348 # define S_IWUSR S_IWRITE 349 #endif /* S_IWUSR */ 350 351 #ifndef S_IEXEC 352 # define S_IEXEC 0000100 353 #endif /* S_IEXEC */ 354 #ifndef S_IXOTH 355 # define S_IXOTH (S_IEXEC >> 6) 356 #endif /* S_IXOTH */ 357 #ifndef S_IXGRP 358 # define S_IXGRP (S_IEXEC >> 3) 359 #endif /* S_IXGRP */ 360 #ifndef S_IXUSR 361 # define S_IXUSR S_IEXEC 362 #endif /* S_IXUSR */ 363 364 #ifndef S_ISUID 365 # define S_ISUID 0004000 /* setuid */ 366 #endif /* S_ISUID */ 367 #ifndef S_ISGID 368 # define S_ISGID 0002000 /* setgid */ 369 #endif /* S_ISGID */ 370 #ifndef S_ISVTX 371 # define S_ISVTX 0001000 /* sticky */ 372 #endif /* S_ISVTX */ 373 #ifndef S_ENFMT 374 # define S_ENFMT S_ISGID /* record locking enforcement flag */ 375 #endif /* S_ENFMT */ 376 377 /* the following macros are for POSIX conformance */ 378 #ifndef S_IRWXU 379 # define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) 380 #endif /* S_IRWXU */ 381 #ifndef S_IRWXG 382 # define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) 383 #endif /* S_IRWXG */ 384 #ifndef S_IRWXO 385 # define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) 386 #endif /* S_IRWXO */ 387 388 /* 389 * Access() 390 */ 391 #ifndef F_OK 392 # define F_OK 0 393 #endif /* F_OK */ 394 #ifndef X_OK 395 # define X_OK 1 396 #endif /* X_OK */ 397 #ifndef W_OK 398 # define W_OK 2 399 #endif /* W_OK */ 400 #ifndef R_OK 401 # define R_OK 4 402 #endif /* R_OK */ 403 404 /* 405 * Open() 406 */ 407 #ifndef O_RDONLY 408 # define O_RDONLY 0 409 #endif /* O_RDONLY */ 410 #ifndef O_WRONLY 411 # define O_WRONLY 1 412 #endif /* O_WRONLY */ 413 #ifndef O_RDWR 414 # define O_RDWR 2 415 #endif /* O_RDWR */ 416 417 /* 418 * Lseek() 419 */ 420 #ifndef L_SET 421 # ifdef SEEK_SET 422 # define L_SET SEEK_SET 423 # else /* !SEEK_SET */ 424 # define L_SET 0 425 # endif /* SEEK_SET */ 426 #endif /* L_SET */ 427 #ifndef L_INCR 428 # ifdef SEEK_CUR 429 # define L_INCR SEEK_CUR 430 # else /* !SEEK_CUR */ 431 # define L_INCR 1 432 # endif /* SEEK_CUR */ 433 #endif /* L_INCR */ 434 #ifndef L_XTND 435 # ifdef SEEK_END 436 # define L_XTND SEEK_END 437 # else /* !SEEK_END */ 438 # define L_XTND 2 439 # endif /* SEEK_END */ 440 #endif /* L_XTND */ 441 442 #ifdef _SEQUENT_ 443 # define NEEDgethostname 444 #endif /* _SEQUENT_ */ 445 446 #if defined(BSD) && defined(POSIXJOBS) && !defined(BSD4_4) && !defined(__hp_osf) 447 # define setpgid(pid, pgrp) setpgrp(pid, pgrp) 448 #endif /* BSD && POSIXJOBS && && !BSD4_4 && !__hp_osf */ 449 450 #if defined(BSDJOBS) && !(defined(POSIX) && defined(POSIXJOBS)) 451 # if !defined(_AIX370) && !defined(_AIXPS2) 452 # define setpgid(pid, pgrp) setpgrp(pid, pgrp) 453 # endif /* !_AIX370 && !_AIXPS2 */ 454 # define NEEDtcgetpgrp 455 #endif /* BSDJOBS && !(POSIX && POSIXJOBS) */ 456 457 #ifdef RENO 458 /* 459 * RENO has this broken. It is fixed on 4.4BSD 460 */ 461 # define NEEDtcgetpgrp 462 #endif /* RENO */ 463 464 #ifdef DGUX 465 # define setpgrp(a, b) setpgrp2(a, b) 466 # define getpgrp(a) getpgrp2(a) 467 #endif /* DGUX */ 468 469 #ifdef SXA 470 # ifndef _BSDX_ 471 /* 472 * Only needed in the system V environment. 473 */ 474 # define setrlimit bsd_setrlimit 475 # define getrlimit bsd_getrlimit 476 # endif /* _BSDX_ */ 477 #endif /* SXA */ 478 479 #if defined(_MINIX) || defined(__EMX__) 480 # define NEEDgethostname 481 # define NEEDnice 482 # define HAVENOLIMIT 483 /* 484 * Minix does not have these, so... 485 */ 486 # define getpgrp getpid 487 #endif /* _MINIX || __EMX__ */ 488 489 #ifdef __EMX__ 490 /* XXX: How can we get the tty name in emx? */ 491 # define ttyname(fd) (isatty(fd) ? "/dev/tty" : NULL) 492 #endif /* __EMX__ */ 493 494 #ifndef POSIX 495 # define mygetpgrp() getpgrp(0) 496 #else /* POSIX */ 497 # if (defined(BSD) && !defined(BSD4_4)) || defined(SUNOS4) || defined(IRIS4D) || defined(DGUX) || defined(HPRT) 498 # define mygetpgrp() getpgrp(0) 499 # else /* !((BSD && !BSD4_4) || SUNOS4 || IRIS4D || DGUX || HPRT) */ 500 # define mygetpgrp() getpgrp() 501 # endif /* (BSD && BSD4_4) || SUNOS4 || IRISD || DGUX || HPRT */ 502 #endif /* POSIX */ 503 504 505 #if !defined(SOLARIS2) && !defined(sinix) && !defined(BSD4_4) && !defined(WINNT) 506 # if (SYSVREL > 0 && !defined(OREO) && !defined(sgi) && !defined(linux) && !defined(sinix) && !defined(_AIX) &&!defined(_UWIN)) || defined(NeXT) 507 # define NEEDgetcwd 508 # endif /* (SYSVREL > 0 && !OREO && !sgi && !linux && !sinix && !_AIX && !_UWIN) || NeXT */ 509 #endif 510 511 #ifndef S_IFLNK 512 # define lstat stat 513 #endif /* S_IFLNK */ 514 515 516 #if defined(BSDTIMES) && !defined(_SEQUENT_) 517 typedef struct timeval timeval_t; 518 #endif /* BSDTIMES && ! _SEQUENT_ */ 519 520 #ifdef NeXT 521 /* 522 * From Tony_Mason@transarc.com, override NeXT's malloc stuff. 523 */ 524 # define malloc tcsh_malloc 525 # define calloc tcsh_calloc 526 # define realloc tcsh_realloc 527 # define free tcsh_free 528 #endif /* NeXT */ 529 530 #if !defined(BSD4_4) && !defined(__linux__) && !defined(__hpux) && !defined(sgi) 531 #ifndef NEEDgethostname 532 extern int gethostname __P((char *, int)); 533 #endif /* NEEDgethostname */ 534 #endif /* !BDS4_4 && !__linux__ && !__hpux && !sgi */ 535 536 #if !defined(POSIX) || defined(SUNOS4) || defined(UTekV) || defined(sysV88) 537 extern time_t time(); 538 extern char *getenv(); 539 extern int atoi(); 540 # ifndef __EMX__ 541 extern char *ttyname(); 542 # endif /* __EMX__ */ 543 544 # if defined(SUNOS4) 545 # ifndef toupper 546 extern int toupper __P((int)); 547 # endif /* toupper */ 548 # ifndef tolower 549 extern int tolower __P((int)); 550 # endif /* tolower */ 551 extern caddr_t sbrk __P((int)); 552 # if SYSVREL == 0 && !defined(__lucid) 553 extern int qsort(); 554 # endif /* SYSVREL == 0 && !__lucid */ 555 # else /* !SUNOS4 */ 556 # ifndef WINNT 557 # ifndef hpux 558 # if __GNUC__ != 2 559 extern int abort(); 560 # endif /* __GNUC__ != 2 */ 561 # ifndef fps500 562 extern int qsort(); 563 # endif /* !fps500 */ 564 # else /* !hpux */ 565 extern void abort(); 566 extern void qsort(); 567 # endif /* hpux */ 568 # endif /* !WINNT */ 569 # endif /* SUNOS4 */ 570 #ifndef _CX_UX 571 extern void perror(); 572 #endif 573 574 # ifdef BSDSIGS 575 # if defined(_AIX370) || defined(MACH) || defined(NeXT) || defined(_AIXPS2) || defined(ardent) || defined(SUNOS4) || defined(HPBSD) || defined(__MACHTEN__) 576 extern int sigvec(); 577 extern int sigpause(); 578 # else /* !(_AIX370 || MACH || NeXT || _AIXPS2 || ardent || SUNOS4 || HPBSD) */ 579 # if (!defined(apollo) || !defined(__STDC__)) && !defined(__DGUX__) && !defined(fps500) 580 extern sigret_t sigvec(); 581 #ifndef _CX_UX 582 extern void sigpause(); 583 #endif /* _CX_UX */ 584 # endif /* (!apollo || !__STDC__) && !__DGUX__ && !fps500 */ 585 # endif /* _AIX370 || MACH || NeXT || _AIXPS2 || ardent || SUNOS4 || HPBSD */ 586 extern sigmask_t sigblock(); 587 extern sigmask_t sigsetmask(); 588 # endif /* BSDSIGS */ 589 590 # ifndef killpg 591 extern int killpg(); 592 # endif /* killpg */ 593 594 # ifndef lstat 595 extern int lstat(); 596 # endif /* lstat */ 597 598 # ifdef BSD 599 extern uid_t getuid(), geteuid(); 600 extern gid_t getgid(), getegid(); 601 # endif /* BSD */ 602 603 # ifdef SYSMALLOC 604 extern memalign_t malloc(); 605 extern memalign_t realloc(); 606 extern memalign_t calloc(); 607 extern void free(); 608 # endif /* SYSMALLOC */ 609 610 # ifdef BSDTIMES 611 extern int getrlimit(); 612 extern int setrlimit(); 613 extern int getrusage(); 614 extern int gettimeofday(); 615 # endif /* BSDTIMES */ 616 617 # if defined(NLS) && !defined(NOSTRCOLL) && !defined(NeXT) 618 extern int strcoll(); 619 # endif /* NLS && !NOSTRCOLL && !NeXT */ 620 621 # ifdef BSDJOBS 622 # ifdef BSDTIMES 623 # ifdef __MACHTEN__ 624 extern pid_t wait3(); 625 # else 626 # ifndef HPBSD 627 extern int wait3(); 628 # endif /* HPBSD */ 629 # endif /* __MACHTEN__ */ 630 # else /* !BSDTIMES */ 631 # if !defined(POSIXJOBS) && !defined(_SEQUENT_) 632 extern int wait3(); 633 # else /* POSIXJOBS || _SEQUENT_ */ 634 extern int waitpid(); 635 # endif /* POSIXJOBS || _SEQUENT_ */ 636 # endif /* BSDTIMES */ 637 # else /* !BSDJOBS */ 638 # if SYSVREL < 3 639 extern int ourwait(); 640 # else /* SYSVREL >= 3 */ 641 extern int wait(); 642 # endif /* SYSVREL < 3 */ 643 # endif /* BSDJOBS */ 644 645 # ifdef BSDNICE 646 extern int setpriority(); 647 # else /* !BSDNICE */ 648 extern int nice(); 649 # endif /* BSDNICE */ 650 651 # if (!defined(fps500) && !defined(apollo) && !defined(__lucid) && !defined(HPBSD) && !defined(DECOSF1)) 652 extern void setpwent(); 653 extern void endpwent(); 654 # endif /* !fps500 && !apollo && !__lucid && !HPBSD && !DECOSF1 */ 655 656 # ifndef __STDC__ 657 extern struct passwd *getpwuid(), *getpwnam(), *getpwent(); 658 # ifdef PW_SHADOW 659 extern struct spwd *getspnam(), *getspent(); 660 # endif /* PW_SHADOW */ 661 # ifdef PW_AUTH 662 extern struct authorization *getauthuid(); 663 # endif /* PW_AUTH */ 664 # endif /* __STDC__ */ 665 666 # ifndef getcwd 667 extern char *getcwd(); 668 # endif /* getcwd */ 669 670 #else /* POSIX || !SUNOS4 || !UTekV || !sysV88 */ 671 672 # if (defined(SUNOS4) && !defined(__GNUC__)) || defined(_IBMR2) || defined(_IBMESA) 673 extern char *getvwd(); 674 # endif /* (SUNOS4 && ! __GNUC__) || _IBMR2 || _IBMESA */ 675 676 # ifdef SCO 677 extern char *ttyname(); 678 # endif /* SCO */ 679 680 # ifdef __clipper__ 681 extern char *ttyname(); 682 # endif /* __clipper__ */ 683 684 #endif /* !POSIX || SUNOS4 || UTekV || sysV88 */ 685 686 #if defined(SUNOS4) && __GNUC__ == 2 687 /* 688 * Somehow these are missing 689 */ 690 extern int ioctl __P((int, int, ...)); 691 extern int readlink __P((const char *, char *, size_t)); 692 extern void setgrent __P((void)); 693 extern void endgrent __P((void)); 694 # ifdef REMOTEHOST 695 # ifndef _SOCKLEN_T /* Avoid Solaris 2.7 bogosity. */ 696 struct sockaddr; 697 extern int getpeername __P((int, struct sockaddr *, int *)); 698 # endif /* _SOCKLEN_T */ 699 # endif /* REMOTEHOST */ 700 #endif /* SUNOS4 && __GNUC__ == 2 */ 701 702 #if (defined(BSD) && !defined(BSD4_4)) || defined(SUNOS4) 703 # if defined(__alpha) && defined(__osf__) && DECOSF1 < 200 704 extern void bcopy __P((const void *, void *, size_t)); 705 # define memmove(a, b, c) (bcopy((char *) (b), (char *) (a), (int) (c)), a) 706 # endif /* __alpha && __osf__ && DECOSF1 < 200 */ 707 #endif /* (BSD && !BSD4_4) || SUNOS4 */ 708 709 #if !defined(hpux) && !defined(COHERENT) && ((SYSVREL < 4) || defined(_SEQUENT_)) && !defined(BSD4_4) && !defined(memmove) 710 # define NEEDmemmove 711 #endif /* !hpux && !COHERENT && (SYSVREL < 4 || _SEQUENT_) && !BSD4_4 && !memmove */ 712 713 #if defined(UTek) || defined(pyr) 714 # define NEEDmemset 715 #else /* !UTek && !pyr */ 716 # ifdef SUNOS4 717 # include <memory.h> /* memset should be declared in <string.h> but isn't */ 718 # endif /* SUNOS4 */ 719 #endif /* UTek || pyr */ 720 721 #if SYSVREL == 4 722 # ifdef REMOTEHOST 723 /* Irix6 defines getpeername(int, void *, int *) which conflicts with 724 the definition below. */ 725 # if !defined(__sgi) && !defined(_OSD_POSIX) 726 # ifndef _SOCKLEN_T /* Avoid Solaris 2.7 bogosity. */ 727 struct sockaddr; 728 extern int getpeername __P((int, struct sockaddr *, int *)); 729 # endif /* _SOCKLEN_T */ 730 # endif /* !__sgi && !_OSD_POSIX */ 731 # endif /* REMOTEHOST */ 732 # ifndef BSDTIMES 733 extern int getrlimit __P((int, struct rlimit *)); 734 extern int setrlimit __P((int, const struct rlimit *)); 735 # endif /* !BSDTIMES */ 736 # if !defined(IRIS4D) && !defined(SOLARIS2) 737 extern int wait3(); /* I think some bizarre systems still need this */ 738 # endif /* !IRIS4D && !SOLARIS2 */ 739 # if defined(SOLARIS2) 740 # undef NEEDstrerror 741 extern char *strerror __P((int)); 742 # endif /* SOLARIS2 */ 743 #endif /* SYSVREL == 4 */ 744 745 #if defined(__alpha) && defined(__osf__) && DECOSF1 < 200 746 /* These are ok for 1.3, but conflict with the header files for 2.0 */ 747 extern int gethostname __P((char *, int)); 748 extern char *sbrk __P((ssize_t)); 749 extern int ioctl __P((int, unsigned long, char *)); 750 extern pid_t vfork __P((void)); 751 extern int killpg __P((pid_t, int)); 752 #endif /* __osf__ && __alpha && DECOSF1 < 200 */ 753 754 #endif /* _h_tc_os */ 755