dat.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. typedef struct Msg Msg;
  10. struct Msg
  11. {
  12. Msg *link;
  13. uchar *rp;
  14. uchar *ep;
  15. };
  16. typedef struct Client Client;
  17. struct Client
  18. {
  19. int moribund;
  20. int activethread;
  21. int num;
  22. int ref;
  23. int status;
  24. int pid;
  25. char *cmd;
  26. int fd[2];
  27. char err[ERRMAX];
  28. Req *execreq;
  29. Channel *execpid;
  30. Req *rq, **erq; /* reading */
  31. Msg *mq, **emq;
  32. Ioproc *readerproc;
  33. Channel *writerkick;
  34. Req *wq, **ewq; /* writing */
  35. Req *curw; /* currently writing */
  36. Ioproc *writerproc; /* writing */
  37. };
  38. extern int nclient;
  39. extern Client **client;
  40. extern void dataread(Req*, Client*);
  41. extern int newclient(void);
  42. extern void closeclient(Client*);
  43. extern void datawrite(Req*, Client*);
  44. extern void ctlwrite(Req*, Client*);
  45. extern void clientflush(Req*, Client*);
  46. #define emalloc emalloc9p
  47. #define estrdup estrdup9p
  48. #define erealloc erealloc9p
  49. extern Srv fs;
  50. extern void initfs(void);
  51. extern void setexecname(char*);
  52. enum
  53. {
  54. STACK = 8192,
  55. };
  56. enum /* Client.status */
  57. {
  58. Closed,
  59. Exec,
  60. Established,
  61. Hangup,
  62. };