1*8305Smckusick /* @(#)mach.h 4.5 (Berkeley) 10/05/82 */ 28213Smckusick 38213Smckusick /* sccs id variable */ 48213Smckusick static char *mach_h_sid = "@(#)mach.h 1.11"; 58213Smckusick 68213Smckusick /* 78213Smckusick 88213Smckusick mach.h -- define machine-dependent things 98213Smckusick 108213Smckusick *** Pre-processor Flags *** 118213Smckusick 128213Smckusick This set of code is controlled by this set of conditional 138213Smckusick compilation flags: 148213Smckusick 158213Smckusick TESTING if defined, do not generate tests, etc. which require 168213Smckusick super-user status. 178213Smckusick 188213Smckusick OLDTTY if defined, compile for old 1 character TTY names 198213Smckusick CCTTY if defined, compile for CC tty name format 208213Smckusick if neither is defined, use v7 ttyname format 218213Smckusick 228213Smckusick PASSWDF compile in code to handle /etc/passwdf - split passwd files 238213Smckusick 248213Smckusick V6 Assume the v6 features instead of the v7 ones. 258213Smckusick 268213Smckusick FUID use the funny uid's present on CC V6 278213Smckusick 288213Smckusick DELIVERM Uses the delivermail program 298213Smckusick 308213Smckusick HPASSWD The local machine has the hashed password stuff 318213Smckusick 328213Smckusick OLDMAIL mail is in home-directory/.mail 338213Smckusick USRMAIL mail is in /usr/mail/name 348213Smckusick (mail is in /usr/spool/mail/name) 358213Smckusick 368213Smckusick CC Machine is a Computer Center machine 378213Smckusick NUID userid (as returned by getuid()) on this machine 388213Smckusick UID1CHAR Uses vanila Version6 userid's (only 1 byte for uid) 398213Smckusick NOEUID Does not have the geteuid() system call 408213Smckusick NFREECMD doesn't allow any "network" free commands 418213Smckusick NOFP floating point just doesn't work on this machine 428213Smckusick NOREMACCT allows netlpr's on remote machines without an account 438213Smckusick CSH use the /bin/csh shell (Paths.h sets BINSH to this path ). 448213Smckusick CRN CC crn's are passed 458213Smckusick DONTHOLDBIG large (size > MAXDAYFILE ) jobs wont be held until night for 468213Smckusick transmission 478213Smckusick 488213Smckusick SWAB this machine has byte-ordering reversed from the DEC VAX 498213Smckusick and PDP-11 standard (the only current example is Onyx) 508213Smckusick The conditonal flags are first defined 518233Smckusick in "local.h" in this directory. 528213Smckusick 538213Smckusick For "normal" version 6 machines, there is a dummy machine 548213Smckusick definition for "VANILLA6" which indicates the v6 UNIX options. 558213Smckusick 568213Smckusick For "normal" version 7 machines, there is a dummy machine 578213Smckusick definition for "VANILLA7" which indicates the v7 UNIX options. 588213Smckusick (VM/UNIX and Berkeley VM/VAX/UNIX can use this) 598213Smckusick */ 608213Smckusick /* be sure to include <stdio.h> before these defns */ 618213Smckusick 628233Smckusick # include "local.h" 638213Smckusick # include <sysexits.h> 648213Smckusick 658213Smckusick /* note NUID is only used in mmail.c */ 668213Smckusick 678213Smckusick # ifdef RAND 688213Smckusick /* definitions for Rand-Unix */ 698213Smckusick # ifdef VAX 708213Smckusick # define LOCAL 'v' 718213Smckusick # define NUID (-1) 728213Smckusick # endif VAX 738213Smckusick 748213Smckusick # ifdef GRAPHICS 758213Smckusick # define V6 768213Smckusick # define OLDTTY 778213Smckusick # define UID1CHAR 788213Smckusick # define OLDMAIL 798213Smckusick # define LOCAL 'g' 808213Smckusick # define NUID (-1) 818213Smckusick # endif GRAPHICS 828213Smckusick 838213Smckusick # ifdef TP 848213Smckusick # define LOCAL 't' 858213Smckusick # define V6 868213Smckusick # define OLDTTY 878213Smckusick # define UID1CHAR 888213Smckusick # define OLDMAIL 898213Smckusick # define NUID (-1) 908213Smckusick # endif TP 918213Smckusick 928213Smckusick /* end of definitions for Rand */ 938213Smckusick # endif RAND 948213Smckusick 958213Smckusick 968213Smckusick # ifdef NOSC 978213Smckusick /* definitions for Naval Ocean Systems Center NOSC */ 988213Smckusick # ifdef ATTS 998213Smckusick # define LOCAL 'a' 1008213Smckusick # define V6 1018213Smckusick # define OLDTTY 1028213Smckusick # define UID1CHAR 1038213Smckusick # define OLDMAIL 1048213Smckusick # define NUID (-1) 1058213Smckusick # endif ATTS 1068213Smckusick 1078213Smckusick # ifdef CCMM 1088213Smckusick # define LOCAL 'c' 1098213Smckusick # define V6 1108213Smckusick # define OLDTTY 1118213Smckusick # define UID1CHAR 1128213Smckusick # define OLDMAIL 1138213Smckusick # define NUID (-1) 1148213Smckusick # endif CCMM 1158213Smckusick 1168213Smckusick # ifdef MSSF 1178213Smckusick # define V6 1188213Smckusick # define OLDTTY 1198213Smckusick # define UID1CHAR 1208213Smckusick # define OLDMAIL 1218213Smckusick # define LOCAL 'm' 1228213Smckusick # define NUID (-1) 1238213Smckusick # endif MSSF 1248213Smckusick 1258213Smckusick /* end of definitions for NOSC */ 1268213Smckusick 1278213Smckusick # endif NOSC 1288213Smckusick 1298213Smckusick # ifdef BERKELEY 1308233Smckusick /* CFO - A */ 1318213Smckusick # ifdef A 1328213Smckusick # define CCV7 1338213Smckusick # define LOCAL 'a' 1348213Smckusick # endif A 1358213Smckusick 1368233Smckusick /* CFO - B */ 1378213Smckusick # ifdef B 1388213Smckusick # define CCV7 1398213Smckusick # define LOCAL 'b' 1408213Smckusick # endif B 1418213Smckusick 1428233Smckusick /* CFO - C */ 1438213Smckusick # ifdef C 1448213Smckusick # define CCV7 1458213Smckusick # define LOCAL 'c' 1468213Smckusick # endif C 1478213Smckusick 1488233Smckusick /* CFO - D */ 1498213Smckusick # ifdef D 1508213Smckusick # define CCV7 1518213Smckusick # define LOCAL 'd' 1528213Smckusick # endif D 1538213Smckusick 1548233Smckusick /* CFO - E */ 1558213Smckusick # ifdef E 1568213Smckusick # define CCV7 1578213Smckusick # define LOCAL 'e' 1588213Smckusick # endif E 1598213Smckusick 1608233Smckusick /* CFO - F */ 1618213Smckusick # ifdef F 1628213Smckusick # define CCV7 1638213Smckusick # define LOCAL 'f' 1648213Smckusick # endif F 1658213Smckusick 1668233Smckusick /* CFO - G */ 1678213Smckusick # ifdef G 1688213Smckusick # define LOCAL 'g' 1698213Smckusick # define NUID (501) 1708213Smckusick # endif G 1718213Smckusick 1728233Smckusick /* CFO - Jade */ 1738233Smckusick # ifdef H 1748233Smckusick # define LOCAL 'h' 1758233Smckusick # define NUID (501) 1768233Smckusick # endif H 1778233Smckusick 1788280Scomay /* CSSG - ucberl70 */ 1798280Scomay # ifdef ERL70 1808213Smckusick # define LOCAL 'i' 1818213Smckusick # define NUID (174) 1828280Scomay # endif ERL70 1838213Smckusick 1848233Smckusick /* Ingres Group - ucbingres */ 1858213Smckusick # ifdef INGVAX 1868213Smckusick # define LOCAL 'j' 1878213Smckusick # define NUID (37) 1888213Smckusick # define FREELPR 1898213Smckusick # define DELIVERM 1908213Smckusick # endif INGVAX 1918213Smckusick 1928233Smckusick /* CS network hub - ucbvax */ 1938233Smckusick # ifdef UCBVAX 1948213Smckusick # define LOCAL 'k' 1958233Smckusick # define NUID (35) 1968233Smckusick # define DELIVERM 1978233Smckusick # define MAXSENDQ 35 1988233Smckusick # endif UCBVAX 1998213Smckusick 2008233Smckusick /* Brodersen - ucboz */ 2018233Smckusick # ifdef OZ 2028233Smckusick # define LOCAL 'l' 2038233Smckusick # define NUID (501) 2048233Smckusick # endif OZ 2058233Smckusick 2068233Smckusick /* EE-Signal Proccessing - ucbmedea */ 2078233Smckusick # ifdef MEDEA 2088213Smckusick # define LOCAL 'm' 2098233Smckusick # define NUID (501) 2108233Smckusick # endif MEDEA 2118213Smckusick 2128233Smckusick /* Fateman - ucbkim */ 2138213Smckusick # ifdef KIM 2148213Smckusick # define LOCAL 'n' 2158233Smckusick # define DELIVERM 2168233Smckusick # define NUID (501) 2178213Smckusick # endif KIM 2188213Smckusick 2198233Smckusick /* EECS-Research - ucbesvax */ 2208213Smckusick # ifdef ESVAX 2218213Smckusick # define LOCAL 'o' 2228213Smckusick # define NUID (67) 2238213Smckusick # endif ESVAX 2248213Smckusick 2258233Smckusick /* Newton CAD - ucbcad */ 2268213Smckusick # ifdef CAD 2278213Smckusick # define LOCAL 'p' 2288213Smckusick # define NUID (67) 2298213Smckusick # endif CAD 2308213Smckusick 2318233Smckusick /* currently unused */ 2328213Smckusick # ifdef Q 2338213Smckusick # define LOCAL 'q' 2348213Smckusick # endif Q 2358213Smckusick 2368233Smckusick /* Fabry CSRG - ucbarpa */ 2378213Smckusick # ifdef ARPAVAX 2388213Smckusick # define LOCAL 'r' 2398213Smckusick # define NUID (501) 2408213Smckusick # define DELIVERM 2418213Smckusick # define MAXSENDQ 35 2428213Smckusick # endif ARPAVAX 2438213Smckusick 2448233Smckusick /* CFO & SRC - SRC */ 2458213Smckusick # ifdef SRC 2468213Smckusick # define LOCAL 's' 2478213Smckusick # define NUID 38 2488213Smckusick # endif SRC 2498213Smckusick 2508233Smckusick /* Math/Stat Dept - MathStat */ 2518213Smckusick # ifdef MATHSTAT 2528213Smckusick # define LOCAL 't' 2538233Smckusick # define NUID (-1) 2548213Smckusick # endif MATHSTAT 2558213Smckusick 2568233Smckusick /* Fabry CSRG - c70 */ 2578233Smckusick # ifdef C70 2588233Smckusick # define LOCAL 'u' 2598233Smckusick # define NUID (501) 2608233Smckusick # define DELIVERM 2618233Smckusick # define MAXSENDQ 35 2628233Smckusick # endif C70 2638233Smckusick 2648233Smckusick /* CS Research - ucbernie */ 2658213Smckusick # ifdef CSVAX 2668213Smckusick # define LOCAL 'v' 2678213Smckusick # define NUID (501) 2688213Smckusick # define DELIVERM 2698213Smckusick # define MAXSENDQ 35 2708213Smckusick # endif CSVAX 2718213Smckusick 2728233Smckusick /* Stat Dept - statvax */ 2738233Smckusick # ifdef STATVAX 2748233Smckusick # define LOCAL 'w' 2758233Smckusick # define NUID 2768233Smckusick # endif STATVAX 2778233Smckusick 2788233Smckusick /* CS Research - Onyx */ 2798213Smckusick # ifdef ONYX 2808213Smckusick # define LOCAL 'x' 2818213Smckusick # define NUID (10) 2828213Smckusick # define NOFP 2838213Smckusick # define SWAB 2848213Smckusick # undef PARMLIST 2858213Smckusick # define PARMLIST 20 2868233Smckusick # define DELIVERM 2878213Smckusick # endif ONYX 2888213Smckusick 2898233Smckusick /* EECS Dept - Cory */ 2908213Smckusick # ifdef CORY 2918213Smckusick # define LOCAL 'y' 2928213Smckusick # define NUID (10) 2938213Smckusick # define MAXSENDQ 35 2948213Smckusick # include <signal.h> 2958213Smckusick # undef NETLDISC 2968213Smckusick # define DELIVERM 2978213Smckusick # endif CORY 2988213Smckusick 2998233Smckusick /* EECS Dept Administrative - ucbear */ 3008233Smckusick # ifdef EARVAX 3018213Smckusick # define LOCAL 'z' 3028213Smckusick # define NUID ((1 << 8) | 104) 3038233Smckusick # define DELIVERM 3048233Smckusick # endif EARVAX 3058213Smckusick 3068213Smckusick /* end of Berkeley definitions */ 3078213Smckusick # endif BERKELEY 3088213Smckusick 3098213Smckusick /* 3108213Smckusick the CC V6 machines are all the same. 3118213Smckusick splitting their type into a separate group will 3128213Smckusick allow the binary patching program "patchd" to be 3138213Smckusick used to patch the binaries so the sources can be compiled 3148213Smckusick on one CC machine and the binaries shipped around 3158213Smckusick to the other CC machines. 3168213Smckusick */ 3178213Smckusick # ifdef CCV7 3188213Smckusick # undef CC 3198213Smckusick # define NOREMACCT 3208213Smckusick # define NUID (10) 3218213Smckusick # define MAXSENDQ 35 3228213Smckusick # define CSH 3238213Smckusick # define CRN 3248213Smckusick # define MAGICCRN "3700" /* default CC crn */ 3258213Smckusick # endif CCV7 3268213Smckusick 3278213Smckusick # ifdef CC 3288213Smckusick # define V6 3298213Smckusick # define CCV6 3308213Smckusick # define CCTTY 3318213Smckusick # define PASSWDF 3328213Smckusick # define FUID 3338213Smckusick # define USRMAIL 3348213Smckusick # define NUID (115) 3358213Smckusick # define MAXSENDQ 35 3368213Smckusick # define NOREMACCT 3378213Smckusick # define CSH 3388213Smckusick # define CRN 3398213Smckusick # define MAGICCRN "3700" /* default CC crn */ 3408213Smckusick # endif CC 3418213Smckusick 3428213Smckusick /* default version 6 options */ 3438213Smckusick # ifdef VANILLA6 3448213Smckusick # define V6 3458213Smckusick # define UID1CHAR 3468213Smckusick # define OLDTTY 3478213Smckusick # define OLDMAIL 3488213Smckusick # endif VANILLA6 3498213Smckusick 3508213Smckusick /* default version 7 options */ 3518213Smckusick # ifdef VANILLA7 3528213Smckusick # endif VANILLA7 3538213Smckusick 3548213Smckusick # ifndef V6 3558213Smckusick # include <sys/param.h> 3568213Smckusick # include <sys/stat.h> 357*8305Smckusick # include <dir.h> 3588213Smckusick # include <sys/times.h> 3598213Smckusick # include <ctype.h> 3608213Smckusick # include <sgtty.h> 3618213Smckusick # include <errno.h> 3628213Smckusick # include <pwd.h> 3638213Smckusick # include <assert.h> 3648213Smckusick # include <setjmp.h> 3658213Smckusick # define getsize(S) ((S)->st_size) 3668213Smckusick # define gettime() (time(0)) 3678213Smckusick int (*signal())(); 3688213Smckusick /* 3698213Smckusick #define SIG_DFL (int (*)())0 3708213Smckusick #define SIG_IGN (int (*)())1 3718213Smckusick */ 3728213Smckusick 3738213Smckusick # else V6 3748213Smckusick 3758213Smckusick # define ETXTBSY 26 3768213Smckusick # define S_IREAD 0400 3778213Smckusick # define S_IFMT 060000 3788213Smckusick # define S_IFDIR 0040000 3798213Smckusick # define ANYP 0300 3808213Smckusick # define ECHO 010 3818213Smckusick # define ROOTINO 1 3828213Smckusick # define TIOCEXCL 0 3838213Smckusick # define SIGHUP 1 3848213Smckusick # define SIGINT 2 3858213Smckusick # define SIGQUIT 3 3868213Smckusick # define SIGKILL 9 3878213Smckusick # define SIGALRM 14 3888213Smckusick # define SIGTERM 15 3898213Smckusick # define SIG_IGN 1 3908213Smckusick # define ASSERT "Assertion failed: file %s, line %d\n", __FILE__, __LINE__);exit(1);}} 3918213Smckusick # define assert(ex) {if (!(ex)){fprintf(stderr,ASSERT 3928213Smckusick # define isprint(c) (040 <= c && c <= 0176) 3938213Smckusick # define longjmp(a,b) reset() 3948213Smckusick # define setjmp(a) setexit() 3958213Smckusick 3968213Smckusick 3978213Smckusick struct tms { /* see times - sect 2 */ 3988213Smckusick int tms_utime; /* user time */ 3998213Smckusick int tms_stime; /* system time */ 4008213Smckusick long tms_cutime; /* user time, children */ 4018213Smckusick long tms_cstime; /* system time, children */ 4028213Smckusick }; 4038213Smckusick struct sgttyb { 4048213Smckusick char sg_ispeed; 4058213Smckusick char sg_ospeed; 4068213Smckusick char sg_erase; 4078213Smckusick char sg_kill; 4088213Smckusick int sg_flags; 4098213Smckusick }; 4108213Smckusick struct passwd { /* see getpwent(3) */ 4118213Smckusick char *pw_name; 4128213Smckusick char *pw_passwd; 4138213Smckusick int pw_uid; 4148213Smckusick int pw_gid; 4158213Smckusick int pw_quota; 4168213Smckusick char *pw_comment; 4178213Smckusick char *pw_gecos; 4188213Smckusick char *pw_dir; 4198213Smckusick char *pw_shell; 4208213Smckusick }; 4218213Smckusick /* /usr/include/varargs.h */ 4228213Smckusick typedef char *va_list; 4238213Smckusick # define va_dcl int va_alist; 4248213Smckusick # define va_start(list) list = (char *) &va_alist 4258213Smckusick # define va_end(list) 4268213Smckusick # define va_arg(list,mode) ((mode *)(list += sizeof(mode)))[-1] 4278213Smckusick 4288213Smckusick typedef int jmp_buf[10]; 4298213Smckusick long gettime(), getsize(); 4308213Smckusick # endif V6 4318213Smckusick /* end of non-v7 defns */ 4328213Smckusick 4338213Smckusick # ifdef FUID 4348213Smckusick # define getgid(s) (0) 4358213Smckusick # endif FUID 4368213Smckusick 4378213Smckusick # ifdef UID1CHAR 4388213Smckusick # define uidmask(S) (S & 0377) 4398213Smckusick # define geteuid() ((getuid()>>8)&0377) 4408213Smckusick # else UID1CHAR 4418213Smckusick # define uidmask(S) (S) 4428213Smckusick # endif UID1CHAR 4438213Smckusick 4448213Smckusick # ifdef NOEUID 4458213Smckusick # define geteuid(S) (-1) 4468213Smckusick # endif NOEUID 4478213Smckusick 4488213Smckusick # ifdef CCTTY 4498213Smckusick # define ttyname(S) myttyname(S) 4508213Smckusick # endif CCTTY 4518213Smckusick 4528213Smckusick #ifdef CRN 4538213Smckusick #include <gecos.h> 4548213Smckusick #endif CRN 4558213Smckusick 4568213Smckusick # ifdef OLDTTY 4578213Smckusick /* this is the version 7 utmp structure. the getutmp() procedure 4588213Smckusick converts the v6 structure into this format 4598213Smckusick */ 4608213Smckusick struct utmp { 4618213Smckusick char ut_line[8]; /* tty name */ 4628213Smckusick char ut_name[8]; /* user id */ 4638213Smckusick long ut_time; /* time on */ 4648213Smckusick }; 4658213Smckusick # else OLDTTY 4668213Smckusick # include <utmp.h> 4678213Smckusick # endif OLDTTY 4688213Smckusick 4698213Smckusick # define chfromf(S) (S ? 'T' : 'F') 4708213Smckusick 4718213Smckusick /* functions */ 4728213Smckusick 4738213Smckusick char *hgethome(), *calloc(), *ctime(), *getenv(); 4748213Smckusick char *getname(), *getun(), *getlogin(); 4758213Smckusick char *SnFromUid(), *ttyname(); 4768213Smckusick struct passwd *getpwnam(), *getpwuid(); 4778213Smckusick long atol(),time(); 4788213Smckusick struct utmp *getutmp(); 479