|
|
1.1 root 1: #include <sys/param.h>
2: #include <sys/types.h>
3: #include <sys/stat.h>
4: #include <sys/dir.h>
5: #include <sys/user.h>
6: #include <sys/proc.h>
7: #ifdef vax
8: #include <sys/reg.h>
9: #endif
10: #include <sys/pioctl.h>
11:
12: #ifdef vax
13: #define SYSADR 0x80000000L
14: #define UBASE (SYSADR-UPAGES*NBPG)
15: #define STTOP (SYSADR-UPAGES*NBPG)
16: #endif
17: #ifdef sun
18: #define SYSADR KERNELBASE
19: #define UBASE UADDR
20: #define STTOP (KERNELBASE)
21: #endif
22:
23: #define Malloc(type,n) (type *)malloc((n)*sizeof(type))
24: #define Calloc(type,n) (type *)calloc((n),sizeof(type))
25: #define Realloc(type,ptr,n) (type *)realloc(ptr,(n)*sizeof(type))
26: #define Nalloc(type,pp,n) (type *)nalloc(pp, sizeof(type), (n)*sizeof(type))
27:
28: char *malloc(), *calloc(), *realloc(), *nalloc(), *balloc();
29:
30: #define Ioctl(fd,c,buf) (ioctl(fd, c, buf) >= 0)
31: #define Seek(fd,n) (lseek(fd, (int)(n), 0) == (int)(n))
32: #define Read(fd,buf,n) (read(fd, (char *)buf, (n)) == (n))
33:
34: #define Kread(addr, destp) (((long)(addr) & SYSADR) && Seek(kernel, addr) && \
35: Read(kernel, (char *)(destp), sizeof(*(destp))))
36:
37: #define Sread(fd, addr, destp) (Seek(fd, addr) && \
38: Read(fd, (char *)(destp), sizeof(*(destp))))
39:
40: #define min(a,b) ((a) <= (b) ? (a) : (b))
41: #define max(a,b) ((a) >= (b) ? (a) : (b))
42: #define minmax(x,a,b) min(b,max(a,x))
43:
44: typedef struct Dirnode {
45: struct Dirnode *next;
46: struct direct *begin;
47: struct direct *end;
48: } Dirnode;
49:
50: typedef struct Select {
51: long flag;
52: char *id;
53: dev_t dev; ino_t ino;
54: } Select;
55:
56: #define SELTTY 1
57: #define SELXFL 2
58: #define SELFIL 4
59:
60: typedef struct Psline {
61: int weight;
62: char *string;
63: } Psline;
64:
65: char *printp(), *fdprint(), *iprint();
66:
67: char *gettty(), *getfs(), *getuname(), *getargs(), *memcpy();
68:
69: Dirnode *devlist, *prlist, *getdir();
70:
71: Select *selbeg, *selend;
72:
73: int Fflag, fflag, hflag, lflag, Nflag, nflag, Tflag, uflag;
74:
75: int aflag, rflag, tflag, xflag;
76:
77: int mypid, myuid, drum, kernel;
78:
79: char *progname;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.