| 1 | /* @(#)mach.h 4.6 (Berkeley) %G% */ |
| 2 | |
| 3 | /* sccs id variable */ |
| 4 | static char *mach_h_sid = "@(#)mach.h 1.11"; |
| 5 | |
| 6 | /* |
| 7 | |
| 8 | mach.h -- define machine-dependent things |
| 9 | |
| 10 | *** Pre-processor Flags *** |
| 11 | |
| 12 | This set of code is controlled by this set of conditional |
| 13 | compilation flags: |
| 14 | |
| 15 | TESTING if defined, do not generate tests, etc. which require |
| 16 | super-user status. |
| 17 | |
| 18 | OLDTTY if defined, compile for old 1 character TTY names |
| 19 | CCTTY if defined, compile for CC tty name format |
| 20 | if neither is defined, use v7 ttyname format |
| 21 | |
| 22 | PASSWDF compile in code to handle /etc/passwdf - split passwd files |
| 23 | |
| 24 | V6 Assume the v6 features instead of the v7 ones. |
| 25 | |
| 26 | FUID use the funny uid's present on CC V6 |
| 27 | |
| 28 | SENDMAIL Uses the sendmail program |
| 29 | |
| 30 | HPASSWD The local machine has the hashed password stuff |
| 31 | |
| 32 | OLDMAIL mail is in home-directory/.mail |
| 33 | USRMAIL mail is in /usr/mail/name |
| 34 | (mail is in /usr/spool/mail/name) |
| 35 | |
| 36 | CC Machine is a Computer Center machine |
| 37 | NUID userid (as returned by getuid()) on this machine |
| 38 | UID1CHAR Uses vanila Version6 userid's (only 1 byte for uid) |
| 39 | NOEUID Does not have the geteuid() system call |
| 40 | NFREECMD doesn't allow any "network" free commands |
| 41 | NOFP floating point just doesn't work on this machine |
| 42 | NOREMACCT allows netlpr's on remote machines without an account |
| 43 | CSH use the /bin/csh shell (Paths.h sets BINSH to this path ). |
| 44 | CRN CC crn's are passed |
| 45 | DONTHOLDBIG large (size > MAXDAYFILE ) jobs wont be held until night for |
| 46 | transmission |
| 47 | |
| 48 | SWAB this machine has byte-ordering reversed from the DEC VAX |
| 49 | and PDP-11 standard (the only current example is Onyx) |
| 50 | The conditonal flags are first defined |
| 51 | in "local.h" in this directory. |
| 52 | |
| 53 | For "normal" version 6 machines, there is a dummy machine |
| 54 | definition for "VANILLA6" which indicates the v6 UNIX options. |
| 55 | |
| 56 | For "normal" version 7 machines, there is a dummy machine |
| 57 | definition for "VANILLA7" which indicates the v7 UNIX options. |
| 58 | (VM/UNIX and Berkeley VM/VAX/UNIX can use this) |
| 59 | */ |
| 60 | /* be sure to include <stdio.h> before these defns */ |
| 61 | |
| 62 | # include "local.h" |
| 63 | # include <sysexits.h> |
| 64 | |
| 65 | /* note NUID is only used in mmail.c */ |
| 66 | |
| 67 | # ifdef RAND |
| 68 | /* definitions for Rand-Unix */ |
| 69 | # ifdef VAX |
| 70 | # define LOCAL 'v' |
| 71 | # define NUID (-1) |
| 72 | # endif VAX |
| 73 | |
| 74 | # ifdef GRAPHICS |
| 75 | # define V6 |
| 76 | # define OLDTTY |
| 77 | # define UID1CHAR |
| 78 | # define OLDMAIL |
| 79 | # define LOCAL 'g' |
| 80 | # define NUID (-1) |
| 81 | # endif GRAPHICS |
| 82 | |
| 83 | # ifdef TP |
| 84 | # define LOCAL 't' |
| 85 | # define V6 |
| 86 | # define OLDTTY |
| 87 | # define UID1CHAR |
| 88 | # define OLDMAIL |
| 89 | # define NUID (-1) |
| 90 | # endif TP |
| 91 | |
| 92 | /* end of definitions for Rand */ |
| 93 | # endif RAND |
| 94 | |
| 95 | |
| 96 | # ifdef NOSC |
| 97 | /* definitions for Naval Ocean Systems Center NOSC */ |
| 98 | # ifdef ATTS |
| 99 | # define LOCAL 'a' |
| 100 | # define V6 |
| 101 | # define OLDTTY |
| 102 | # define UID1CHAR |
| 103 | # define OLDMAIL |
| 104 | # define NUID (-1) |
| 105 | # endif ATTS |
| 106 | |
| 107 | # ifdef CCMM |
| 108 | # define LOCAL 'c' |
| 109 | # define V6 |
| 110 | # define OLDTTY |
| 111 | # define UID1CHAR |
| 112 | # define OLDMAIL |
| 113 | # define NUID (-1) |
| 114 | # endif CCMM |
| 115 | |
| 116 | # ifdef MSSF |
| 117 | # define V6 |
| 118 | # define OLDTTY |
| 119 | # define UID1CHAR |
| 120 | # define OLDMAIL |
| 121 | # define LOCAL 'm' |
| 122 | # define NUID (-1) |
| 123 | # endif MSSF |
| 124 | |
| 125 | /* end of definitions for NOSC */ |
| 126 | |
| 127 | # endif NOSC |
| 128 | |
| 129 | # ifdef BERKELEY |
| 130 | |
| 131 | /* all berkeley sites use sendmail..... (someday?) */ |
| 132 | # define SENDMAIL |
| 133 | |
| 134 | /* CFO - A */ |
| 135 | # ifdef A |
| 136 | # define CCV7 |
| 137 | # define LOCAL 'a' |
| 138 | # endif A |
| 139 | |
| 140 | /* CFO - B */ |
| 141 | # ifdef B |
| 142 | # define CCV7 |
| 143 | # define LOCAL 'b' |
| 144 | # endif B |
| 145 | |
| 146 | /* CFO - C */ |
| 147 | # ifdef C |
| 148 | # define CCV7 |
| 149 | # define LOCAL 'c' |
| 150 | # endif C |
| 151 | |
| 152 | /* CFO - D */ |
| 153 | # ifdef D |
| 154 | # define CCV7 |
| 155 | # define LOCAL 'd' |
| 156 | # endif D |
| 157 | |
| 158 | /* CFO - E */ |
| 159 | # ifdef E |
| 160 | # define CCV7 |
| 161 | # define LOCAL 'e' |
| 162 | # endif E |
| 163 | |
| 164 | /* CFO - F */ |
| 165 | # ifdef F |
| 166 | # define CCV7 |
| 167 | # define LOCAL 'f' |
| 168 | # endif F |
| 169 | |
| 170 | /* CFO - G */ |
| 171 | # ifdef G |
| 172 | # define LOCAL 'g' |
| 173 | # define NUID (501) |
| 174 | # endif G |
| 175 | |
| 176 | /* CFO - Jade */ |
| 177 | # ifdef H |
| 178 | # define LOCAL 'h' |
| 179 | # define NUID (501) |
| 180 | # endif H |
| 181 | |
| 182 | /* CSSG - ucberl70 */ |
| 183 | # ifdef ERL70 |
| 184 | # define LOCAL 'i' |
| 185 | # define NUID (174) |
| 186 | # endif ERL70 |
| 187 | |
| 188 | /* Ingres Group - ucbingres */ |
| 189 | # ifdef INGVAX |
| 190 | # define LOCAL 'j' |
| 191 | # define NUID (37) |
| 192 | # define FREELPR |
| 193 | # endif INGVAX |
| 194 | |
| 195 | /* CS network hub - ucbvax */ |
| 196 | # ifdef UCBVAX |
| 197 | # define LOCAL 'k' |
| 198 | # define NUID (35) |
| 199 | # define MAXSENDQ 35 |
| 200 | # endif UCBVAX |
| 201 | |
| 202 | /* Brodersen - ucboz */ |
| 203 | # ifdef OZ |
| 204 | # define LOCAL 'l' |
| 205 | # define NUID (501) |
| 206 | # endif OZ |
| 207 | |
| 208 | /* EE-Signal Proccessing - ucbmedea */ |
| 209 | # ifdef MEDEA |
| 210 | # define LOCAL 'm' |
| 211 | # define NUID (501) |
| 212 | # endif MEDEA |
| 213 | |
| 214 | /* Fateman - ucbkim */ |
| 215 | # ifdef KIM |
| 216 | # define LOCAL 'n' |
| 217 | # define NUID (501) |
| 218 | # endif KIM |
| 219 | |
| 220 | /* EECS-Research - ucbesvax */ |
| 221 | # ifdef ESVAX |
| 222 | # define LOCAL 'o' |
| 223 | # define NUID (67) |
| 224 | # endif ESVAX |
| 225 | |
| 226 | /* Newton CAD - ucbcad */ |
| 227 | # ifdef CAD |
| 228 | # define LOCAL 'p' |
| 229 | # define NUID (67) |
| 230 | # endif CAD |
| 231 | |
| 232 | /* currently unused */ |
| 233 | # ifdef Q |
| 234 | # define LOCAL 'q' |
| 235 | # endif Q |
| 236 | |
| 237 | /* Fabry CSRG - ucbarpa */ |
| 238 | # ifdef ARPAVAX |
| 239 | # define LOCAL 'r' |
| 240 | # define NUID (501) |
| 241 | # define MAXSENDQ 35 |
| 242 | # endif ARPAVAX |
| 243 | |
| 244 | /* CFO & SRC - SRC */ |
| 245 | # ifdef SRC |
| 246 | # define LOCAL 's' |
| 247 | # define NUID 38 |
| 248 | # endif SRC |
| 249 | |
| 250 | /* Math/Stat Dept - MathStat */ |
| 251 | # ifdef MATHSTAT |
| 252 | # define LOCAL 't' |
| 253 | # define NUID (-1) |
| 254 | # endif MATHSTAT |
| 255 | |
| 256 | /* Fabry CSRG - c70 */ |
| 257 | # ifdef C70 |
| 258 | # define LOCAL 'u' |
| 259 | # define NUID (501) |
| 260 | # define MAXSENDQ 35 |
| 261 | # endif C70 |
| 262 | |
| 263 | /* CS Research - ucbernie */ |
| 264 | # ifdef CSVAX |
| 265 | # define LOCAL 'v' |
| 266 | # define NUID (501) |
| 267 | # define MAXSENDQ 35 |
| 268 | # endif CSVAX |
| 269 | |
| 270 | /* Stat Dept - statvax */ |
| 271 | # ifdef STATVAX |
| 272 | # define LOCAL 'w' |
| 273 | # define NUID |
| 274 | # endif STATVAX |
| 275 | |
| 276 | /* CS Research - Onyx */ |
| 277 | # ifdef ONYX |
| 278 | # define LOCAL 'x' |
| 279 | # define NUID (10) |
| 280 | # define NOFP |
| 281 | # define SWAB |
| 282 | # undef PARMLIST |
| 283 | # define PARMLIST 20 |
| 284 | # endif ONYX |
| 285 | |
| 286 | /* EECS Dept - Cory */ |
| 287 | # ifdef CORY |
| 288 | # define LOCAL 'y' |
| 289 | # define NUID (10) |
| 290 | # define MAXSENDQ 35 |
| 291 | # include <signal.h> |
| 292 | # undef NETLDISC |
| 293 | # endif CORY |
| 294 | |
| 295 | /* EECS Dept Administrative - ucbear */ |
| 296 | # ifdef EARVAX |
| 297 | # define LOCAL 'z' |
| 298 | # define NUID ((1 << 8) | 104) |
| 299 | # endif EARVAX |
| 300 | |
| 301 | /* end of Berkeley definitions */ |
| 302 | # endif BERKELEY |
| 303 | |
| 304 | /* |
| 305 | the CC V6 machines are all the same. |
| 306 | splitting their type into a separate group will |
| 307 | allow the binary patching program "patchd" to be |
| 308 | used to patch the binaries so the sources can be compiled |
| 309 | on one CC machine and the binaries shipped around |
| 310 | to the other CC machines. |
| 311 | */ |
| 312 | # ifdef CCV7 |
| 313 | # undef CC |
| 314 | # define NOREMACCT |
| 315 | # define NUID (10) |
| 316 | # define MAXSENDQ 35 |
| 317 | # define CSH |
| 318 | # define CRN |
| 319 | # define MAGICCRN "3700" /* default CC crn */ |
| 320 | # endif CCV7 |
| 321 | |
| 322 | # ifdef CC |
| 323 | # define V6 |
| 324 | # define CCV6 |
| 325 | # define CCTTY |
| 326 | # define PASSWDF |
| 327 | # define FUID |
| 328 | # define USRMAIL |
| 329 | # define NUID (115) |
| 330 | # define MAXSENDQ 35 |
| 331 | # define NOREMACCT |
| 332 | # define CSH |
| 333 | # define CRN |
| 334 | # define MAGICCRN "3700" /* default CC crn */ |
| 335 | # endif CC |
| 336 | |
| 337 | /* default version 6 options */ |
| 338 | # ifdef VANILLA6 |
| 339 | # define V6 |
| 340 | # define UID1CHAR |
| 341 | # define OLDTTY |
| 342 | # define OLDMAIL |
| 343 | # endif VANILLA6 |
| 344 | |
| 345 | /* default version 7 options */ |
| 346 | # ifdef VANILLA7 |
| 347 | # endif VANILLA7 |
| 348 | |
| 349 | # ifndef V6 |
| 350 | # include <sys/param.h> |
| 351 | # include <sys/stat.h> |
| 352 | # include <dir.h> |
| 353 | # include <sys/times.h> |
| 354 | # include <ctype.h> |
| 355 | # include <sgtty.h> |
| 356 | # include <errno.h> |
| 357 | # include <pwd.h> |
| 358 | # include <assert.h> |
| 359 | # include <setjmp.h> |
| 360 | # define getsize(S) ((S)->st_size) |
| 361 | # define gettime() (time(0)) |
| 362 | int (*signal())(); |
| 363 | /* |
| 364 | #define SIG_DFL (int (*)())0 |
| 365 | #define SIG_IGN (int (*)())1 |
| 366 | */ |
| 367 | |
| 368 | # else V6 |
| 369 | |
| 370 | # define ETXTBSY 26 |
| 371 | # define S_IREAD 0400 |
| 372 | # define S_IFMT 060000 |
| 373 | # define S_IFDIR 0040000 |
| 374 | # define ANYP 0300 |
| 375 | # define ECHO 010 |
| 376 | # define ROOTINO 1 |
| 377 | # define TIOCEXCL 0 |
| 378 | # define SIGHUP 1 |
| 379 | # define SIGINT 2 |
| 380 | # define SIGQUIT 3 |
| 381 | # define SIGKILL 9 |
| 382 | # define SIGALRM 14 |
| 383 | # define SIGTERM 15 |
| 384 | # define SIG_IGN 1 |
| 385 | # define ASSERT "Assertion failed: file %s, line %d\n", __FILE__, __LINE__);exit(1);}} |
| 386 | # define assert(ex) {if (!(ex)){fprintf(stderr,ASSERT |
| 387 | # define isprint(c) (040 <= c && c <= 0176) |
| 388 | # define longjmp(a,b) reset() |
| 389 | # define setjmp(a) setexit() |
| 390 | |
| 391 | |
| 392 | struct tms { /* see times - sect 2 */ |
| 393 | int tms_utime; /* user time */ |
| 394 | int tms_stime; /* system time */ |
| 395 | long tms_cutime; /* user time, children */ |
| 396 | long tms_cstime; /* system time, children */ |
| 397 | }; |
| 398 | struct sgttyb { |
| 399 | char sg_ispeed; |
| 400 | char sg_ospeed; |
| 401 | char sg_erase; |
| 402 | char sg_kill; |
| 403 | int sg_flags; |
| 404 | }; |
| 405 | struct passwd { /* see getpwent(3) */ |
| 406 | char *pw_name; |
| 407 | char *pw_passwd; |
| 408 | int pw_uid; |
| 409 | int pw_gid; |
| 410 | int pw_quota; |
| 411 | char *pw_comment; |
| 412 | char *pw_gecos; |
| 413 | char *pw_dir; |
| 414 | char *pw_shell; |
| 415 | }; |
| 416 | /* /usr/include/varargs.h */ |
| 417 | typedef char *va_list; |
| 418 | # define va_dcl int va_alist; |
| 419 | # define va_start(list) list = (char *) &va_alist |
| 420 | # define va_end(list) |
| 421 | # define va_arg(list,mode) ((mode *)(list += sizeof(mode)))[-1] |
| 422 | |
| 423 | typedef int jmp_buf[10]; |
| 424 | long gettime(), getsize(); |
| 425 | # endif V6 |
| 426 | /* end of non-v7 defns */ |
| 427 | |
| 428 | # ifdef FUID |
| 429 | # define getgid(s) (0) |
| 430 | # endif FUID |
| 431 | |
| 432 | # ifdef UID1CHAR |
| 433 | # define uidmask(S) (S & 0377) |
| 434 | # define geteuid() ((getuid()>>8)&0377) |
| 435 | # else UID1CHAR |
| 436 | # define uidmask(S) (S) |
| 437 | # endif UID1CHAR |
| 438 | |
| 439 | # ifdef NOEUID |
| 440 | # define geteuid(S) (-1) |
| 441 | # endif NOEUID |
| 442 | |
| 443 | # ifdef CCTTY |
| 444 | # define ttyname(S) myttyname(S) |
| 445 | # endif CCTTY |
| 446 | |
| 447 | #ifdef CRN |
| 448 | #include <gecos.h> |
| 449 | #endif CRN |
| 450 | |
| 451 | # ifdef OLDTTY |
| 452 | /* this is the version 7 utmp structure. the getutmp() procedure |
| 453 | converts the v6 structure into this format |
| 454 | */ |
| 455 | struct utmp { |
| 456 | char ut_line[8]; /* tty name */ |
| 457 | char ut_name[8]; /* user id */ |
| 458 | long ut_time; /* time on */ |
| 459 | }; |
| 460 | # else OLDTTY |
| 461 | # include <utmp.h> |
| 462 | # endif OLDTTY |
| 463 | |
| 464 | # define chfromf(S) (S ? 'T' : 'F') |
| 465 | |
| 466 | /* functions */ |
| 467 | |
| 468 | char *hgethome(), *calloc(), *ctime(), *getenv(); |
| 469 | char *getname(), *getun(), *getlogin(); |
| 470 | char *SnFromUid(), *ttyname(); |
| 471 | struct passwd *getpwnam(), *getpwuid(); |
| 472 | long atol(),time(); |
| 473 | struct utmp *getutmp(); |