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