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