summaryrefslogtreecommitdiff
path: root/sys/src/cmd/execnet/dat.h
blob: 8c9c17db3be01ca27942954268284e1986c9615c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
typedef struct Msg Msg;
struct Msg
{
	Msg *link;
	uchar *rp;
	uchar *ep;
};

typedef struct Client Client;
struct Client
{
	int moribund;
	int activethread;
	int num;
	int ref;
	int status;
	int pid;
	char *cmd;
	int fd[2];
	char err[ERRMAX];

	Req *execreq;
	Channel *execpid;

	Req *rq, **erq;		/* reading */
	Msg *mq, **emq;
	Ioproc *readerproc;

	Channel *writerkick;
	Req *wq, **ewq;	/* writing */
	Req *curw;		/* currently writing */
	Ioproc *writerproc;	/* writing */
};
extern int nclient;
extern Client **client;
extern void dataread(Req*, Client*);
extern int newclient(void);
extern void closeclient(Client*);
extern void datawrite(Req*, Client*);
extern void ctlwrite(Req*, Client*);
extern void clientflush(Req*, Client*);

#define emalloc emalloc9p
#define estrdup estrdup9p
#define erealloc erealloc9p

extern Srv fs;
extern void initfs(void);
extern void setexecname(char*);

enum
{
	STACK = 8192,
};

enum	/* Client.status */
{
	Closed,
	Exec,
	Established,
	Hangup,
};