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