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