1: /* $Header: /home/hyperion/mu/christos/src/sys/tcsh-6.00/RCS/tc.os.h,v 3.1 1991/07/05 19:07:33 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: #ifdef OREO
  41: #include <sys/time.h>
  42: #include <sys/resource.h>
  43: #endif /* OREO */
  44: 
  45: #ifdef titan
  46: extern int end;
  47: #endif /* titan */
  48: 
  49: #ifdef hpux
  50: # ifdef lint
  51: /*
  52:  * Hpux defines struct ucred, in <sys/user.h>, but if I include that
  53:  * then I need to include the *world*
  54:  * [all this to pass lint cleanly!!!]
  55:  * so I define struct ucred here...
  56:  */
  57: struct ucred {
  58:     int     foo;
  59: };
  60: # endif /* lint */
  61: 
  62: /*
  63:  * hpux 7.0 does not define it
  64:  */
  65: # ifndef CSUSP
  66: #  define CSUSP 032
  67: # endif	/* CSUSP */
  68: 
  69: # include <sys/bsdtty.h>
  70: 
  71: # ifndef POSIX
  72: #  ifdef BSDJOBS
  73: #   define getpgrp(a) getpgrp2(a)
  74: #   define setpgrp(a, b) setpgrp2(a, b)
  75: #  endif /* BSDJOBS */
  76: # endif	/* POSIX */
  77: #endif /* hpux */
  78: 
  79: #ifdef HYPERCUBE
  80: /*
  81:  * for struct winsiz
  82:  */
  83: # include <sys/stream.h>
  84: # include <sys/ptem.h>
  85: # define NEEDgethostname
  86: #endif /* HYPERCUBE */
  87: 
  88: #ifdef IRIS4D
  89: # include <sys/time.h>
  90: # include <sys/resource.h>
  91: /*
  92:  * BSDsetpgrp() and BSDgetpgrp() are BSD versions of setpgrp, etc.
  93:  */
  94: # define setpgrp BSDsetpgrp
  95: # define getpgrp BSDgetpgrp
  96: #endif /* IRIS4D */
  97: 
  98: /*
  99:  * Stat
 100:  */
 101: #ifdef ISC
 102: /* these are not defined for _POSIX_SOURCE under ISC 2.2 */
 103: # ifndef S_IFMT
 104: #  define S_IFMT  0170000       /* type of file */
 105: #  define S_IFDIR 0040000       /* directory */
 106: #  define S_IFCHR 0020000       /* character special */
 107: #  define S_IFBLK 0060000       /* block special */
 108: #  define S_IFREG 0100000       /* regular */
 109: #  define S_IFIFO 0010000       /* fifo */
 110: #  define S_IFNAM 0050000       /* special named file */
 111: # endif /* S_IFMT */
 112: #endif /* ISC */
 113: 
 114: #ifdef S_IFMT
 115: # if !defined(S_ISDIR) && defined(S_IFDIR)
 116: #  define S_ISDIR(a)    (((a) & S_IFMT) == S_IFDIR)
 117: # endif	/* ! S_ISDIR && S_IFDIR */
 118: # if !defined(S_ISCHR) && defined(S_IFCHR)
 119: #  define S_ISCHR(a)    (((a) & S_IFMT) == S_IFCHR)
 120: # endif /* ! S_ISCHR && S_IFCHR */
 121: # if !defined(S_ISBLK) && defined(S_IFBLK)
 122: #  define S_ISBLK(a)    (((a) & S_IFMT) == S_IFBLK)
 123: # endif	/* ! S_ISBLK && S_IFBLK */
 124: # if !defined(S_ISREG) && defined(S_IFREG)
 125: #  define S_ISREG(a)    (((a) & S_IFMT) == S_IFREG)
 126: # endif	/* ! S_ISREG && S_IFREG */
 127: # if !defined(S_ISFIFO) && defined(S_IFIFO)
 128: #  define S_ISFIFO(a)   (((a) & S_IFMT) == S_IFIFO)
 129: # endif	/* ! S_ISFIFO && S_IFIFO */
 130: # if !defined(S_ISNAM) && defined(S_IFNAM)
 131: #  define S_ISNAM(a)    (((a) & S_IFMT) == S_IFNAM)
 132: # endif	/* ! S_ISNAM && S_IFNAM */
 133: # if !defined(S_ISNAM) && defined(S_IFNAM)
 134: #  define S_ISNAM(a)    (((a) & S_IFMT) == S_IFNAM)
 135: # endif	/* ! S_ISNAM && S_IFNAM */
 136: # if !defined(S_ISLNK) && defined(S_IFLNK)
 137: #  define S_ISLNK(a)    (((a) & S_IFMT) == S_IFLNK)
 138: # endif	/* ! S_ISLNK && S_IFLNK */
 139: # if !defined(S_ISSOCK) && defined(S_IFSOCK)
 140: #  define S_ISSOCK(a)   (((a) & S_IFMT) == S_IFSOCK)
 141: # endif	/* ! S_ISSOCK && S_IFSOCK */
 142: #endif /* S_IFMT */
 143: 
 144: #ifndef S_IEXEC
 145: # define S_IEXEC 0000100
 146: #endif /* S_IEXEC */
 147: #ifndef S_IXOTH
 148: # define S_IXOTH (S_IEXEC >> 6)
 149: #endif /* S_IXOTH */
 150: #ifndef S_IXGRP
 151: # define S_IXGRP (S_IEXEC >> 3)
 152: #endif /* S_IXGRP */
 153: #ifndef S_IXUSR
 154: # define S_IXUSR S_IEXEC
 155: #endif /* S_IXUSR */
 156: 
 157: /*
 158:  * Access()
 159:  */
 160: #ifndef F_OK
 161: # define F_OK 0
 162: #endif /* F_OK */
 163: #ifndef X_OK
 164: # define X_OK 1
 165: #endif /* X_OK */
 166: #ifndef W_OK
 167: # define W_OK 2
 168: #endif /* W_OK */
 169: #ifndef R_OK
 170: # define R_OK 4
 171: #endif /* R_OK */
 172: 
 173: /*
 174:  * Open()
 175:  */
 176: #ifndef O_RDONLY
 177: # define O_RDONLY   0
 178: #endif /* O_RDONLY */
 179: #ifndef O_WRONLY
 180: # define O_WRONLY   1
 181: #endif /* O_WRONLY */
 182: #ifndef O_RDWR
 183: # define O_RDWR     2
 184: #endif /* O_RDWR */
 185: 
 186: /*
 187:  * Lseek()
 188:  */
 189: #ifndef L_SET
 190: # ifdef SEEK_SET
 191: #  define L_SET     SEEK_SET
 192: # else
 193: #  define L_SET     0
 194: # endif	/* SEEK_SET */
 195: #endif /* L_SET */
 196: #ifndef L_INCR
 197: # ifdef SEEK_CUR
 198: #  define L_INCR    SEEK_CUR
 199: # else
 200: #  define L_INCR    1
 201: # endif	/* SEEK_CUR */
 202: #endif /* L_INCR */
 203: #ifndef L_XTND
 204: # ifdef SEEK_END
 205: #  define L_XTND    SEEK_END
 206: # else
 207: #  define L_XTND    2
 208: # endif /* SEEK_END */
 209: #endif /* L_XTND */
 210: 
 211: #ifdef _SEQUENT_
 212: # define NEEDgethostname
 213: #endif /* _SEQUENT_ */
 214: 
 215: #if defined(BSD) && defined(POSIXJOBS)
 216: # define setpgid(pid, pgrp) setpgrp(pid, pgrp)
 217: #endif /* BSD && POSIXJOBS */
 218: 
 219: #if defined(BSDJOBS) && !(defined(POSIX) && defined(POSIXJOBS))
 220: # if !defined(_AIX370) && !defined(_AIXPS2)
 221: #  define setpgid(pid, pgrp)    setpgrp(pid, pgrp)
 222: # endif /* !_AIX370 && !_AIXPS2 */
 223: # define tcsetpgrp(fd, pgrp)    ioctl((fd), TIOCSPGRP, (ioctl_t) &(pgrp))
 224: # define NEEDtcgetpgrp
 225: #endif /* BSDJOBS && !(POSIX && POSIXJOBS) */
 226: 
 227: #ifdef RENO
 228: /*
 229:  * Older versions of RENO had this broken. It is fixed now.
 230:  * In any case, we use ours...
 231:  */
 232: # define tcsetpgrp(fd, pgrp)    ioctl((fd), TIOCSPGRP, (ioctl_t) &(pgrp))
 233: # define NEEDtcgetpgrp
 234: #endif /* RENO */
 235: 
 236: #ifdef DGUX
 237: # define setpgrp(a, b) setpgrp2(a, b)
 238: # define getpgrp(a) getpgrp2(a)
 239: #endif /* DGUX */
 240: 
 241: #ifdef SXA
 242: # ifndef BSDNICE
 243: /*
 244:  * We check BSDNICE cause this is not defined in config.sxa.
 245:  * Only needed in the system V environment.
 246:  */
 247: #  define setrlimit(a, b)   b_setrlimit(a, b)
 248: #  define getrlimit(a, b)   b_getrlimit(a, b)
 249: # endif	/* BSDNICE */
 250: # ifndef NOFILE
 251: #  define   NOFILE  64
 252: # endif	/* NOFILE */
 253: #endif /* SXA */
 254: 
 255: #ifndef POSIX
 256: # define mygetpgrp()    getpgrp(0)
 257: #else /* POSIX */
 258: # if defined(BSD) || defined(sun)
 259: #  define mygetpgrp()    getpgrp(0)
 260: # else /* BSD || sun */
 261: #  define mygetpgrp()    getpgrp()
 262: # endif	/* BSD || sun */
 263: #endif /* POSIX */
 264: 
 265: 
 266: #if SVID > 0 && !defined(OREO) && !defined(IRIS4D)
 267: # define NEEDgetwd
 268: #endif /* SVID > 0 && !OREO && !IRIS4D */
 269: 
 270: #ifndef S_IFLNK
 271: # define lstat stat
 272: #endif /* S_IFLNK */
 273: 
 274: 
 275: #if defined(BSDTIMES) && !defined(_SEQUENT_)
 276: typedef struct timeval tmval_t;
 277: #endif /* BSDTIMES && ! _SEQUENT_ */
 278: 
 279: #ifdef NeXT
 280: /*
 281:  * From Tony_Mason@transarc.com, override NeXT's malloc stuff.
 282:  */
 283: # define malloc tcsh_malloc
 284: # define calloc tcsh_calloc
 285: # define realloc tcsh_realloc
 286: # define free tcsh_free
 287: #endif /* NeXT */
 288: 
 289: 
 290: #if !defined(POSIX) || defined(sun)
 291: extern time_t time();
 292: extern char *getenv();
 293: extern int atoi();
 294: extern char *ttyname();
 295: 
 296: # ifndef hpux
 297: extern int abort();
 298: extern int qsort();
 299: # else
 300: extern void abort();
 301: extern void qsort();
 302: # endif
 303: extern void perror();
 304: 
 305: # ifndef NEEDgethostname
 306: extern int gethostname();
 307: # endif
 308: 
 309: # ifdef pdp11
 310: #  ifdef BUFSIZ
 311: #   undef BUFSIZ
 312: #  endif
 313: #  define BUFSIZ 512
 314: # endif
 315: 
 316: # ifdef BSDSIGS
 317: #  if defined(_AIX370) || defined(MACH) || defined(NeXT) || defined(_AIXPS2)
 318: extern int sigvec();
 319: extern int sigpause();
 320: #  else /* _AIX370 || MACH || NeXT || _AIXPS2 */
 321: extern sigret_t sigvec();
 322: extern void sigpause();
 323: #  endif /* _AIX370 || MACH || NeXT || _AIXPS2 */
 324: #  ifndef pdp11
 325: extern sigmask_t sigblock();
 326: extern sigmask_t sigsetmask();
 327: #  else
 328: /* #define sigmask_t sigm_t in compat.h to avoid 7-char conflict with sigmask */
 329: extern sigmask_t sigblock();
 330: extern sigmask_t sigsetmask();
 331: #  endif /* pdp11 */
 332: # endif	/* BSDSIGS */
 333: 
 334: # ifndef killpg
 335: extern int killpg();
 336: # endif	/* killpg */
 337: 
 338: # ifndef lstat
 339: extern int lstat();
 340: # endif	/* lstat */
 341: 
 342: # ifdef SYSMALLOC
 343: extern memalign_t malloc();
 344: extern memalign_t realloc();
 345: extern memalign_t calloc();
 346: extern void free();
 347: # endif	/* SYSMALLOC */
 348: 
 349: # ifdef BSDTIMES
 350: extern int getrlimit();
 351: extern int setrlimit();
 352: extern int getrusage();
 353: extern int gettimeofday();
 354: # endif	/* BSDTIMES */
 355: 
 356: # if defined(NLS) && !defined(NOSTRCOLL) && !defined(NeXT)
 357: extern int strcoll();
 358: # endif
 359: 
 360: # ifdef BSDJOBS
 361: #  ifdef BSDTIMES
 362: extern int wait3();
 363: #  else /* ! BSDTIMES */
 364: #   if !defined(POSIXJOBS) && !defined(_SEQUENT_)
 365: extern int wait3();
 366: #   else /* POSIXJOBS || _SEQUENT_ */
 367: extern int waitpid();
 368: #   endif /* POSIXJOBS || _SEQUENT_ */
 369: #  endif /* ! BSDTIMES */
 370: # else /* !BSDJOBS */
 371: #  if SVID < 3
 372: extern int ourwait();
 373: #  else /* SVID >= 3 */
 374: extern int wait();
 375: #  endif /* SVID >= 3 */
 376: # endif	/* ! BSDJOBS */
 377: 
 378: # ifdef BSDNICE
 379: extern int setpriority();
 380: # else /* !BSDNICE */
 381: extern int nice();
 382: # endif	/* !BSDNICE */
 383: 
 384: #ifdef pdp11
 385: extern int setpwent();
 386: #else
 387: extern void setpwent();
 388: #endif
 389: extern void endpwent();
 390: extern struct passwd *getpwuid(), *getpwnam(), *getpwent();
 391: 
 392: # ifndef getwd
 393: extern char *getwd();
 394: # endif	/* getwd */
 395: #else /* POSIX */
 396: 
 397: # if defined(sun) && !defined(__GNUC__)
 398: extern char *getwd();
 399: # endif	/* sun && ! __GNUC__ */
 400: 
 401: # ifdef RENO
 402: extern void perror();       /* Reno declares that in stdio.h :-( */
 403: # endif	/* RENO */
 404: #endif /* POSIX */
 405: 
 406: #endif /* _h_tc_os */

Defined struct's

ucred defined in line 57; never used

Defined typedef's

tmval_t defined in line 276; used 14 times

Defined macros

BUFSIZ defined in line 313; used 3 times
CSUSP defined in line 66; used 1 times
  • in line 65
F_OK defined in line 161; used 1 times
L_INCR defined in line 200; used 1 times
L_SET defined in line 193; used 1 times
L_XTND defined in line 207; used 1 times
NEEDgethostname defined in line 212; used 2 times
NEEDgetwd defined in line 267; used 1 times
NEEDtcgetpgrp defined in line 233; used 1 times
NOFILE defined in line 251; used 1 times
O_RDONLY defined in line 177; used 3 times
O_RDWR defined in line 183; used 1 times
O_WRONLY defined in line 180; used 1 times
R_OK defined in line 170; used 1 times
S_IEXEC defined in line 145; used 4 times
S_IFBLK defined in line 107; used 2 times
S_IFCHR defined in line 106; used 2 times
S_IFDIR defined in line 105; used 3 times
S_IFIFO defined in line 109; used 2 times
S_IFMT defined in line 104; used 13 times
S_IFNAM defined in line 110; used 4 times
S_IFREG defined in line 108; used 2 times
S_ISBLK defined in line 122; used 1 times
S_ISCHR defined in line 119; used 1 times
S_ISDIR defined in line 116; used 6 times
S_ISFIFO defined in line 128; used 7 times
S_ISLNK defined in line 137; used 8 times
S_ISNAM defined in line 134; used 2 times
S_ISREG defined in line 125; used 1 times
S_ISSOCK defined in line 140; used 7 times
S_IXGRP defined in line 151; used 1 times
S_IXOTH defined in line 148; used 1 times
S_IXUSR defined in line 154; used 1 times
W_OK defined in line 167; used 1 times
X_OK defined in line 164; used 1 times
_h_tc_os defined in line 38; used 1 times
  • in line 37
calloc defined in line 284; used 3 times
free defined in line 286; used 5 times
getpgrp defined in line 238; used 5 times
getrlimit defined in line 248; used 3 times
malloc defined in line 283; used 13 times
mygetpgrp defined in line 261; used 2 times
realloc defined in line 285; used 5 times
setpgrp defined in line 237; used 4 times
setrlimit defined in line 247; used 2 times

Usage of this include

tc.os.h used 1 times
Last modified: 1991-08-21
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1517
Valid CSS Valid XHTML 1.0 Strict