2 |
- |
1 |
typedef
|
|
|
2 |
struct Waitmsg
|
|
|
3 |
{
|
|
|
4 |
int pid; /* of loved one */
|
|
|
5 |
unsigned long time[3]; /* of loved one & descendants */
|
|
|
6 |
char *msg;
|
|
|
7 |
} Waitmsg;
|
|
|
8 |
|
|
|
9 |
#define STATMAX 65535U /* max length of machine-independent stat structure */
|
|
|
10 |
#define DIRMAX (sizeof(Dir)+STATMAX) /* max length of Dir structure */
|
|
|
11 |
#define ERRMAX 128 /* max length of error string */
|
|
|
12 |
|
|
|
13 |
#define MORDER 0x0003 /* mask for bits defining order of mounting */
|
|
|
14 |
#define MREPL 0x0000 /* mount replaces object */
|
|
|
15 |
#define MBEFORE 0x0001 /* mount goes before others in union directory */
|
|
|
16 |
#define MAFTER 0x0002 /* mount goes after others in union directory */
|
|
|
17 |
#define MCREATE 0x0004 /* permit creation in mounted directory */
|
|
|
18 |
#define MCACHE 0x0010 /* cache some data */
|
|
|
19 |
#define MMASK 0x0007 /* all bits on */
|
|
|
20 |
|
|
|
21 |
#define OREAD 0 /* open for read */
|
|
|
22 |
#define OWRITE 1 /* write */
|
|
|
23 |
#define ORDWR 2 /* read and write */
|
|
|
24 |
#define OEXEC 3 /* execute, == read but check execute permission */
|
|
|
25 |
#define OTRUNC 16 /* or'ed in (except for exec), truncate file first */
|
|
|
26 |
#define OCEXEC 32 /* or'ed in, close on exec */
|
|
|
27 |
#define ORCLOSE 64 /* or'ed in, remove on close */
|
|
|
28 |
#define OEXCL 0x1000 /* or'ed in, exclusive use (create only) */
|
|
|
29 |
|
|
|
30 |
#define AEXIST 0 /* accessible: exists */
|
|
|
31 |
#define AEXEC 1 /* execute access */
|
|
|
32 |
#define AWRITE 2 /* write access */
|
|
|
33 |
#define AREAD 4 /* read access */
|
|
|
34 |
|
|
|
35 |
/* Segattch */
|
|
|
36 |
#define SG_RONLY 0040 /* read only */
|
|
|
37 |
#define SG_CEXEC 0100 /* detach on exec */
|
|
|
38 |
|
|
|
39 |
#define NCONT 0 /* continue after note */
|
|
|
40 |
#define NDFLT 1 /* terminate after note */
|
|
|
41 |
#define NSAVE 2 /* clear note but hold state */
|
|
|
42 |
#define NRSTR 3 /* restore saved state */
|
|
|
43 |
|
|
|
44 |
/* bits in Qid.type */
|
|
|
45 |
#define QTDIR 0x80 /* type bit for directories */
|
|
|
46 |
#define QTAPPEND 0x40 /* type bit for append only files */
|
|
|
47 |
#define QTEXCL 0x20 /* type bit for exclusive use files */
|
|
|
48 |
#define QTMOUNT 0x10 /* type bit for mounted channel */
|
|
|
49 |
#define QTFILE 0x00 /* plain file */
|
|
|
50 |
|
|
|
51 |
/* bits in Dir.mode */
|
|
|
52 |
#define DMDIR 0x80000000 /* mode bit for directories */
|
|
|
53 |
#define DMAPPEND 0x40000000 /* mode bit for append only files */
|
|
|
54 |
#define DMEXCL 0x20000000 /* mode bit for exclusive use files */
|
|
|
55 |
#define DMMOUNT 0x10000000 /* mode bit for mounted channel */
|
|
|
56 |
#define DMREAD 0x4 /* mode bit for read permission */
|
|
|
57 |
#define DMWRITE 0x2 /* mode bit for write permission */
|
|
|
58 |
#define DMEXEC 0x1 /* mode bit for execute permission */
|
|
|
59 |
|
|
|
60 |
/* rfork */
|
|
|
61 |
enum
|
|
|
62 |
{
|
|
|
63 |
RFNAMEG = (1<<0),
|
|
|
64 |
RFENVG = (1<<1),
|
|
|
65 |
RFFDG = (1<<2),
|
|
|
66 |
RFNOTEG = (1<<3),
|
|
|
67 |
RFPROC = (1<<4),
|
|
|
68 |
RFMEM = (1<<5),
|
|
|
69 |
RFNOWAIT = (1<<6),
|
|
|
70 |
RFCNAMEG = (1<<10),
|
|
|
71 |
RFCENVG = (1<<11),
|
|
|
72 |
RFCFDG = (1<<12),
|
|
|
73 |
RFREND = (1<<13),
|
|
|
74 |
RFNOMNT = (1<<14)
|
|
|
75 |
};
|
|
|
76 |
|
|
|
77 |
extern int _AWAIT(char*, int);
|
|
|
78 |
extern int _ALARM(unsigned long);
|
|
|
79 |
extern int _BIND(const char*, const char*, int);
|
|
|
80 |
extern int _CHDIR(const char*);
|
|
|
81 |
extern int _CLOSE(int);
|
|
|
82 |
extern int _CREATE(char*, int, unsigned long);
|
|
|
83 |
extern int _DUP(int, int);
|
|
|
84 |
extern int _ERRSTR(char*, unsigned int);
|
|
|
85 |
extern int _EXEC(char*, char*[]);
|
|
|
86 |
extern void _EXITS(char *);
|
|
|
87 |
extern int _FD2PATH(int, char*, int);
|
|
|
88 |
extern int _FAUTH(int, char*);
|
|
|
89 |
extern int _FSESSION(int, char*, int);
|
|
|
90 |
extern int _FSTAT(int, unsigned char*, int);
|
|
|
91 |
extern int _FWSTAT(int, unsigned char*, int);
|
|
|
92 |
extern int _MOUNT(int, int, const char*, int, const char*);
|
|
|
93 |
extern int _NOTED(int);
|
|
|
94 |
extern int _NOTIFY(int(*)(void*, char*));
|
|
|
95 |
extern int _OPEN(const char*, int);
|
|
|
96 |
extern int _PIPE(int*);
|
|
|
97 |
extern long _PREAD(int, void*, long, long long);
|
|
|
98 |
extern long _PWRITE(int, void*, long, long long);
|
|
|
99 |
extern long _READ(int, void*, long);
|
|
|
100 |
extern int _REMOVE(const char*);
|
|
|
101 |
extern int _RENDEZVOUS(unsigned long, unsigned long);
|
|
|
102 |
extern int _RFORK(int);
|
|
|
103 |
extern int _SEGATTACH(int, char*, void*, unsigned long);
|
|
|
104 |
extern int _SEGBRK(void*, void*);
|
|
|
105 |
extern int _SEGDETACH(void*);
|
|
|
106 |
extern int _SEGFLUSH(void*, unsigned long);
|
|
|
107 |
extern int _SEGFREE(void*, unsigned long);
|
|
|
108 |
extern long long _SEEK(int, long long, int);
|
|
|
109 |
extern int _SEMACQUIRE(long*, int);
|
|
|
110 |
extern long _SEMRELEASE(long*, long);
|
|
|
111 |
extern int _SLEEP(long);
|
|
|
112 |
extern int _STAT(const char*, unsigned char*, int);
|
|
|
113 |
extern Waitmsg* _WAIT(void);
|
|
|
114 |
extern int _TSEMACQUIRE(long*, unsigned long);
|
|
|
115 |
extern long _WRITE(int, const void*, long);
|
|
|
116 |
extern int _WSTAT(const char*, unsigned char*, int);
|
|
|
117 |
|
|
|
118 |
extern int __open(char *, int, ...);
|
|
|
119 |
extern int __access(char *, int);
|
|
|
120 |
extern int __chdir(char *);
|
|
|
121 |
extern int __creat(char *, int);
|
|
|
122 |
extern int __link(char *, int);
|
|
|
123 |
extern int __stat(char *, struct stat *);
|
|
|
124 |
extern int __unlink(char *);
|
|
|
125 |
|
|
|
126 |
/*
|
|
|
127 |
* atomic
|
|
|
128 |
*/
|
|
|
129 |
long ainc(long*);
|
|
|
130 |
long adec(long*);
|
|
|
131 |
int cas32(unsigned long*, unsigned long, unsigned long);
|
|
|
132 |
int casp(void**, void*, void*);
|
|
|
133 |
int casl(unsigned long*, unsigned long, unsigned long);
|