[14619] | 1 | /* $Header: /afs/dev.mit.edu/source/repository/third/tcsh/tc.os.h,v 1.4 2000-04-12 22:31:35 ghudson Exp $ */ |
---|
[9005] | 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 | |
---|
[12219] | 40 | #ifndef WINNT |
---|
| 41 | #define NEEDstrerror /* Too hard to find which systems have it */ |
---|
| 42 | #endif /* WINNT */ |
---|
[9005] | 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 |
---|
[12219] | 57 | # endif /* NOFILE */ |
---|
[9005] | 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> |
---|
[12219] | 63 | #endif /* atp vmsposix */ |
---|
[9005] | 64 | |
---|
[12219] | 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 | |
---|
[9005] | 81 | #ifndef NOFILE |
---|
[12219] | 82 | # define NOFILE 256 |
---|
[9005] | 83 | #endif /* NOFILE */ |
---|
| 84 | |
---|
[12219] | 85 | #if defined(linux) || defined(__NetBSD__) || defined(__FreeBSD__) || SYSVREL >= 4 |
---|
[9005] | 86 | # undef NEEDstrerror |
---|
[12219] | 87 | #endif /* linux || __NetBSD__ || __FreeBSD__ || SYSVREL >= 4 */ |
---|
[9005] | 88 | |
---|
[12219] | 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 | |
---|
[9005] | 96 | #ifdef OREO |
---|
| 97 | # include <sys/time.h> |
---|
[12219] | 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 */ |
---|
[9005] | 102 | # ifdef POSIX |
---|
| 103 | # include <sys/tty.h> |
---|
| 104 | # include <termios.h> |
---|
| 105 | # endif /* POSIX */ |
---|
| 106 | #endif /* OREO */ |
---|
| 107 | |
---|
| 108 | #ifndef NCARGS |
---|
[12219] | 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 */ |
---|
[9005] | 122 | #endif /* NCARGS */ |
---|
| 123 | |
---|
[12219] | 124 | #ifdef convex |
---|
| 125 | # include <sys/dmon.h> |
---|
| 126 | #endif /* convex */ |
---|
| 127 | |
---|
[9005] | 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 | |
---|
[12219] | 152 | # include <signal.h> |
---|
| 153 | # if !defined(hp9000s500) && !(defined(SIGRTMAX) || defined(SIGRTMIN)) |
---|
| 154 | /* |
---|
| 155 | * hpux < 7 |
---|
| 156 | */ |
---|
[9005] | 157 | # include <sys/bsdtty.h> |
---|
[12219] | 158 | # endif /* !hp9000s500 && !(SIGRTMAX || SIGRTMIN) */ |
---|
[9005] | 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 */ |
---|
[12219] | 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 */ |
---|
[9005] | 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) |
---|
[12219] | 197 | # if defined(INTEL) || defined(u3b2) || defined (u3b5) || defined(ub15) || defined(u3b20d) || defined(ISC) || defined(SCO) || defined(tower32) |
---|
[9005] | 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 */ |
---|
[12219] | 208 | # endif /* INTEL || u3b2 || u3b5 || ub15 || u3b20d || ISC || SCO || tower32 */ |
---|
[9005] | 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 |
---|
[12219] | 224 | # endif /* POSIX */ |
---|
[9005] | 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 | */ |
---|
[12219] | 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 */ |
---|
[9005] | 249 | |
---|
| 250 | /* |
---|
| 251 | * Stat |
---|
| 252 | */ |
---|
| 253 | #ifdef ISC |
---|
| 254 | /* these are not defined for _POSIX_SOURCE under ISC 2.2 */ |
---|
| 255 | # ifndef S_IFMT |
---|
[12219] | 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 */ |
---|
[9005] | 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 |
---|
[12219] | 290 | #endif /* uts || UTekV || sysV88 */ |
---|
[9005] | 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 | |
---|
[12219] | 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 */ |
---|
[9005] | 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 */ |
---|
[12219] | 373 | #ifndef S_ENFMT |
---|
| 374 | # define S_ENFMT S_ISGID /* record locking enforcement flag */ |
---|
| 375 | #endif /* S_ENFMT */ |
---|
[9005] | 376 | |
---|
[12219] | 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 | |
---|
[9005] | 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 |
---|
[12219] | 423 | # else /* !SEEK_SET */ |
---|
[9005] | 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 |
---|
[12219] | 430 | # else /* !SEEK_CUR */ |
---|
[9005] | 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 |
---|
[12219] | 437 | # else /* !SEEK_END */ |
---|
[9005] | 438 | # define L_XTND 2 |
---|
| 439 | # endif /* SEEK_END */ |
---|
| 440 | #endif /* L_XTND */ |
---|
| 441 | |
---|
| 442 | #ifdef _SEQUENT_ |
---|
| 443 | # define NEEDgethostname |
---|
| 444 | #endif /* _SEQUENT_ */ |
---|
| 445 | |
---|
[12219] | 446 | #if defined(BSD) && defined(POSIXJOBS) && !defined(BSD4_4) && !defined(__hp_osf) |
---|
[9005] | 447 | # define setpgid(pid, pgrp) setpgrp(pid, pgrp) |
---|
[12219] | 448 | #endif /* BSD && POSIXJOBS && && !BSD4_4 && !__hp_osf */ |
---|
[9005] | 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 */ |
---|
[12219] | 497 | # if (defined(BSD) && !defined(BSD4_4)) || defined(SUNOS4) || defined(IRIS4D) || defined(DGUX) || defined(HPRT) |
---|
[9005] | 498 | # define mygetpgrp() getpgrp(0) |
---|
[12219] | 499 | # else /* !((BSD && !BSD4_4) || SUNOS4 || IRIS4D || DGUX || HPRT) */ |
---|
[9005] | 500 | # define mygetpgrp() getpgrp() |
---|
[12219] | 501 | # endif /* (BSD && BSD4_4) || SUNOS4 || IRISD || DGUX || HPRT */ |
---|
[9005] | 502 | #endif /* POSIX */ |
---|
| 503 | |
---|
| 504 | |
---|
[12219] | 505 | #if !defined(SOLARIS2) && !defined(sinix) && !defined(BSD4_4) && !defined(WIN32) |
---|
| 506 | # if (SYSVREL > 0 && !defined(OREO) && !defined(sgi) && !defined(linux) && !defined(sinix) && !defined(_AIX)) || defined(NeXT) |
---|
| 507 | # define NEEDgetcwd |
---|
| 508 | # endif /* (SYSVREL > 0 && !OREO && !sgi && !linux && !sinix && !IBMAIX) || NeXT */ |
---|
| 509 | #endif |
---|
[9005] | 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(POSIX) || defined(SUNOS4) || defined(UTekV) || defined(sysV88) |
---|
| 531 | extern time_t time(); |
---|
| 532 | extern char *getenv(); |
---|
| 533 | extern int atoi(); |
---|
[12219] | 534 | # ifndef __EMX__ |
---|
[9005] | 535 | extern char *ttyname(); |
---|
[12219] | 536 | # endif /* __EMX__ */ |
---|
[9005] | 537 | |
---|
[12219] | 538 | # if defined(SUNOS4) |
---|
| 539 | # ifndef toupper |
---|
[9005] | 540 | extern int toupper __P((int)); |
---|
[12219] | 541 | # endif /* toupper */ |
---|
| 542 | # ifndef tolower |
---|
[9005] | 543 | extern int tolower __P((int)); |
---|
[12219] | 544 | # endif /* tolower */ |
---|
[9005] | 545 | extern caddr_t sbrk __P((int)); |
---|
[12219] | 546 | # if SYSVREL == 0 && !defined(__lucid) |
---|
[9005] | 547 | extern int qsort(); |
---|
[12219] | 548 | # endif /* SYSVREL == 0 && !__lucid */ |
---|
| 549 | # else /* !SUNOS4 */ |
---|
| 550 | # ifndef WINNT |
---|
| 551 | # ifndef hpux |
---|
| 552 | # if __GNUC__ != 2 |
---|
[9005] | 553 | extern int abort(); |
---|
[12219] | 554 | # endif /* __GNUC__ != 2 */ |
---|
| 555 | # ifndef fps500 |
---|
[9005] | 556 | extern int qsort(); |
---|
[12219] | 557 | # endif /* !fps500 */ |
---|
| 558 | # else /* !hpux */ |
---|
[9005] | 559 | extern void abort(); |
---|
| 560 | extern void qsort(); |
---|
[12219] | 561 | # endif /* hpux */ |
---|
| 562 | # endif /* !WINNT */ |
---|
| 563 | # endif /* SUNOS4 */ |
---|
| 564 | #ifndef _CX_UX |
---|
[9005] | 565 | extern void perror(); |
---|
| 566 | #endif |
---|
| 567 | |
---|
| 568 | # ifdef BSDSIGS |
---|
[12219] | 569 | # if defined(_AIX370) || defined(MACH) || defined(NeXT) || defined(_AIXPS2) || defined(ardent) || defined(SUNOS4) || defined(HPBSD) || defined(__MACHTEN__) |
---|
[9005] | 570 | extern int sigvec(); |
---|
| 571 | extern int sigpause(); |
---|
[12219] | 572 | # else /* !(_AIX370 || MACH || NeXT || _AIXPS2 || ardent || SUNOS4 || HPBSD) */ |
---|
| 573 | # if (!defined(apollo) || !defined(__STDC__)) && !defined(__DGUX__) && !defined(fps500) |
---|
[9005] | 574 | extern sigret_t sigvec(); |
---|
[12219] | 575 | #ifndef _CX_UX |
---|
[9005] | 576 | extern void sigpause(); |
---|
[12219] | 577 | #endif /* _CX_UX */ |
---|
| 578 | # endif /* (!apollo || !__STDC__) && !__DGUX__ && !fps500 */ |
---|
| 579 | # endif /* _AIX370 || MACH || NeXT || _AIXPS2 || ardent || SUNOS4 || HPBSD */ |
---|
[9005] | 580 | extern sigmask_t sigblock(); |
---|
| 581 | extern sigmask_t sigsetmask(); |
---|
| 582 | # endif /* BSDSIGS */ |
---|
| 583 | |
---|
| 584 | # ifndef killpg |
---|
| 585 | extern int killpg(); |
---|
| 586 | # endif /* killpg */ |
---|
| 587 | |
---|
| 588 | # ifndef lstat |
---|
| 589 | extern int lstat(); |
---|
| 590 | # endif /* lstat */ |
---|
| 591 | |
---|
[12219] | 592 | # ifdef BSD |
---|
[9005] | 593 | extern uid_t getuid(), geteuid(); |
---|
| 594 | extern gid_t getgid(), getegid(); |
---|
[12219] | 595 | # endif /* BSD */ |
---|
[9005] | 596 | |
---|
| 597 | # ifdef SYSMALLOC |
---|
| 598 | extern memalign_t malloc(); |
---|
| 599 | extern memalign_t realloc(); |
---|
| 600 | extern memalign_t calloc(); |
---|
| 601 | extern void free(); |
---|
| 602 | # endif /* SYSMALLOC */ |
---|
| 603 | |
---|
| 604 | # ifdef BSDTIMES |
---|
| 605 | extern int getrlimit(); |
---|
| 606 | extern int setrlimit(); |
---|
| 607 | extern int getrusage(); |
---|
| 608 | extern int gettimeofday(); |
---|
| 609 | # endif /* BSDTIMES */ |
---|
| 610 | |
---|
| 611 | # if defined(NLS) && !defined(NOSTRCOLL) && !defined(NeXT) |
---|
| 612 | extern int strcoll(); |
---|
[12219] | 613 | # endif /* NLS && !NOSTRCOLL && !NeXT */ |
---|
[9005] | 614 | |
---|
| 615 | # ifdef BSDJOBS |
---|
| 616 | # ifdef BSDTIMES |
---|
[12219] | 617 | # ifdef __MACHTEN__ |
---|
| 618 | extern pid_t wait3(); |
---|
| 619 | # else |
---|
| 620 | # ifndef HPBSD |
---|
[9005] | 621 | extern int wait3(); |
---|
[12219] | 622 | # endif /* HPBSD */ |
---|
| 623 | # endif /* __MACHTEN__ */ |
---|
| 624 | # else /* !BSDTIMES */ |
---|
[9005] | 625 | # if !defined(POSIXJOBS) && !defined(_SEQUENT_) |
---|
| 626 | extern int wait3(); |
---|
| 627 | # else /* POSIXJOBS || _SEQUENT_ */ |
---|
| 628 | extern int waitpid(); |
---|
| 629 | # endif /* POSIXJOBS || _SEQUENT_ */ |
---|
[12219] | 630 | # endif /* BSDTIMES */ |
---|
[9005] | 631 | # else /* !BSDJOBS */ |
---|
| 632 | # if SYSVREL < 3 |
---|
| 633 | extern int ourwait(); |
---|
| 634 | # else /* SYSVREL >= 3 */ |
---|
| 635 | extern int wait(); |
---|
[12219] | 636 | # endif /* SYSVREL < 3 */ |
---|
| 637 | # endif /* BSDJOBS */ |
---|
[9005] | 638 | |
---|
| 639 | # ifdef BSDNICE |
---|
| 640 | extern int setpriority(); |
---|
| 641 | # else /* !BSDNICE */ |
---|
| 642 | extern int nice(); |
---|
[12219] | 643 | # endif /* BSDNICE */ |
---|
[9005] | 644 | |
---|
[12219] | 645 | # if (!defined(fps500) && !defined(apollo) && !defined(__lucid) && !defined(HPBSD) && !defined(DECOSF1)) |
---|
[9005] | 646 | extern void setpwent(); |
---|
| 647 | extern void endpwent(); |
---|
[12219] | 648 | # endif /* !fps500 && !apollo && !__lucid && !HPBSD && !DECOSF1 */ |
---|
[9005] | 649 | |
---|
[12219] | 650 | # ifndef __STDC__ |
---|
[9005] | 651 | extern struct passwd *getpwuid(), *getpwnam(), *getpwent(); |
---|
[12219] | 652 | # ifdef PW_SHADOW |
---|
[9005] | 653 | extern struct spwd *getspnam(), *getspent(); |
---|
[12219] | 654 | # endif /* PW_SHADOW */ |
---|
| 655 | # ifdef PW_AUTH |
---|
[9005] | 656 | extern struct authorization *getauthuid(); |
---|
[12219] | 657 | # endif /* PW_AUTH */ |
---|
| 658 | # endif /* __STDC__ */ |
---|
[9005] | 659 | |
---|
[12219] | 660 | # ifndef getcwd |
---|
| 661 | extern char *getcwd(); |
---|
| 662 | # endif /* getcwd */ |
---|
[9005] | 663 | |
---|
[12219] | 664 | #else /* POSIX || !SUNOS4 || !UTekV || !sysV88 */ |
---|
| 665 | |
---|
[9005] | 666 | # if (defined(SUNOS4) && !defined(__GNUC__)) || defined(_IBMR2) || defined(_IBMESA) |
---|
[12219] | 667 | extern char *getvwd(); |
---|
[9005] | 668 | # endif /* (SUNOS4 && ! __GNUC__) || _IBMR2 || _IBMESA */ |
---|
| 669 | |
---|
| 670 | # ifdef SCO |
---|
| 671 | extern char *ttyname(); |
---|
| 672 | # endif /* SCO */ |
---|
| 673 | |
---|
[12219] | 674 | # ifdef __clipper__ |
---|
| 675 | extern char *ttyname(); |
---|
| 676 | # endif /* __clipper__ */ |
---|
[9005] | 677 | |
---|
[12219] | 678 | #endif /* !POSIX || SUNOS4 || UTekV || sysV88 */ |
---|
| 679 | |
---|
| 680 | #if defined(SUNOS4) && __GNUC__ == 2 |
---|
[9005] | 681 | /* |
---|
| 682 | * Somehow these are missing |
---|
| 683 | */ |
---|
| 684 | extern int ioctl __P((int, int, ...)); |
---|
| 685 | extern int readlink __P((const char *, char *, size_t)); |
---|
[12219] | 686 | extern void setgrent __P((void)); |
---|
| 687 | extern void endgrent __P((void)); |
---|
| 688 | # ifdef REMOTEHOST |
---|
| 689 | struct sockaddr; |
---|
| 690 | extern int getpeername __P((int, struct sockaddr *, int *)); |
---|
| 691 | # endif /* REMOTEHOST */ |
---|
| 692 | #endif /* SUNOS4 && __GNUC__ == 2 */ |
---|
[9005] | 693 | |
---|
[12219] | 694 | #if (defined(BSD) && !defined(BSD4_4)) || defined(SUNOS4) |
---|
| 695 | # if defined(__alpha) && defined(__osf__) && DECOSF1 < 200 |
---|
[9005] | 696 | extern void bcopy __P((const void *, void *, size_t)); |
---|
[12219] | 697 | # define memmove(a, b, c) (bcopy((char *) (b), (char *) (a), (int) (c)), a) |
---|
| 698 | # endif /* __alpha && __osf__ && DECOSF1 < 200 */ |
---|
| 699 | #endif /* (BSD && !BSD4_4) || SUNOS4 */ |
---|
[9005] | 700 | |
---|
[12219] | 701 | #if !defined(hpux) && !defined(COHERENT) && ((SYSVREL < 4) || defined(_SEQUENT_)) && !defined(BSD4_4) && !defined(memmove) |
---|
[9005] | 702 | # define NEEDmemmove |
---|
[12219] | 703 | #endif /* !hpux && !COHERENT && (SYSVREL < 4 || _SEQUENT_) && !BSD4_4 && !memmove */ |
---|
[9005] | 704 | |
---|
[12219] | 705 | #if defined(UTek) || defined(pyr) |
---|
| 706 | # define NEEDmemset |
---|
| 707 | #else /* !UTek && !pyr */ |
---|
| 708 | # ifdef SUNOS4 |
---|
| 709 | # include <memory.h> /* memset should be declared in <string.h> but isn't */ |
---|
| 710 | # endif /* SUNOS4 */ |
---|
| 711 | #endif /* UTek || pyr */ |
---|
| 712 | |
---|
| 713 | #if SYSVREL == 4 |
---|
| 714 | # ifdef REMOTEHOST |
---|
| 715 | /* Irix6 defines getpeername(int, void *, int *) which conflicts with |
---|
| 716 | the definition below. */ |
---|
| 717 | # if !defined(__sgi) |
---|
| 718 | struct sockaddr; |
---|
| 719 | # endif /* __sgi */ |
---|
| 720 | # endif /* REMOTEHOST */ |
---|
| 721 | # ifndef BSDTIMES |
---|
| 722 | extern int getrlimit __P((int, struct rlimit *)); |
---|
| 723 | extern int setrlimit __P((int, const struct rlimit *)); |
---|
| 724 | # endif /* !BSDTIMES */ |
---|
| 725 | # if !defined(IRIS4D) && !defined(SOLARIS2) |
---|
| 726 | extern int wait3(); /* I think some bizarre systems still need this */ |
---|
| 727 | # endif /* !IRIS4D && !SOLARIS2 */ |
---|
| 728 | # if defined(SOLARIS2) |
---|
| 729 | # undef NEEDstrerror |
---|
| 730 | extern char *strerror __P((int)); |
---|
| 731 | # endif /* SOLARIS2 */ |
---|
| 732 | #endif /* SYSVREL == 4 */ |
---|
| 733 | |
---|
| 734 | #if defined(__alpha) && defined(__osf__) && DECOSF1 < 200 |
---|
| 735 | /* These are ok for 1.3, but conflict with the header files for 2.0 */ |
---|
| 736 | extern int gethostname __P((char *, int)); |
---|
| 737 | extern char *sbrk __P((ssize_t)); |
---|
| 738 | extern int ioctl __P((int, unsigned long, char *)); |
---|
| 739 | extern pid_t vfork __P((void)); |
---|
| 740 | extern int killpg __P((pid_t, int)); |
---|
| 741 | #endif /* __osf__ && __alpha && DECOSF1 < 200 */ |
---|
| 742 | |
---|
[9005] | 743 | #endif /* _h_tc_os */ |
---|