1 619085f0 2004-12-25 devnull #include <ucontext.h>
3 619085f0 2004-12-25 devnull typedef struct Context Context;
4 e127e40b 2004-12-27 devnull typedef struct Execjob Execjob;
5 619085f0 2004-12-25 devnull typedef struct Proc Proc;
6 619085f0 2004-12-25 devnull typedef struct _Procrendez _Procrendez;
8 e1dc7e45 2004-12-27 devnull typedef struct Jmp Jmp;
9 e1dc7e45 2004-12-27 devnull struct Jmp
11 e1dc7e45 2004-12-27 devnull p9jmp_buf b;
16 619085f0 2004-12-25 devnull STACK = 8192
19 619085f0 2004-12-25 devnull struct Context
21 619085f0 2004-12-25 devnull ucontext_t uc;
24 e127e40b 2004-12-27 devnull struct Execjob
27 e127e40b 2004-12-27 devnull char *cmd;
28 e127e40b 2004-12-27 devnull char **argv;
29 e127e40b 2004-12-27 devnull Channel *c;
32 619085f0 2004-12-25 devnull struct _Thread
34 619085f0 2004-12-25 devnull _Thread *next;
35 619085f0 2004-12-25 devnull _Thread *prev;
36 619085f0 2004-12-25 devnull _Thread *allnext;
37 619085f0 2004-12-25 devnull _Thread *allprev;
38 619085f0 2004-12-25 devnull Context context;
40 619085f0 2004-12-25 devnull uchar *stk;
41 619085f0 2004-12-25 devnull uint stksize;
42 619085f0 2004-12-25 devnull int exiting;
43 619085f0 2004-12-25 devnull void (*startfn)(void*);
44 619085f0 2004-12-25 devnull void *startarg;
45 619085f0 2004-12-25 devnull Proc *proc;
46 619085f0 2004-12-25 devnull char name[256];
47 619085f0 2004-12-25 devnull char state[256];
50 619085f0 2004-12-25 devnull struct _Procrendez
53 619085f0 2004-12-25 devnull int asleep;
54 4dbefdd4 2004-12-27 devnull #ifdef PLAN9PORT_USING_PTHREADS
55 619085f0 2004-12-25 devnull pthread_cond_t cond;
61 619085f0 2004-12-25 devnull extern void _procsleep(_Procrendez*);
62 619085f0 2004-12-25 devnull extern void _procwakeup(_Procrendez*);
64 619085f0 2004-12-25 devnull struct Proc
66 4dbefdd4 2004-12-27 devnull Proc *next;
67 4dbefdd4 2004-12-27 devnull Proc *prev;
68 4dbefdd4 2004-12-27 devnull char msg[128];
69 4dbefdd4 2004-12-27 devnull #ifdef PLAN9PORT_USING_PTHREADS
70 4dbefdd4 2004-12-27 devnull pthread_t osprocid;
72 4dbefdd4 2004-12-27 devnull uint osprocid;
74 619085f0 2004-12-25 devnull Lock lock;
75 8cbd854a 2004-12-27 devnull int nswitch;
76 619085f0 2004-12-25 devnull _Thread *thread;
77 619085f0 2004-12-25 devnull _Threadlist runqueue;
78 619085f0 2004-12-25 devnull _Threadlist allthreads;
79 619085f0 2004-12-25 devnull uint nthread;
80 619085f0 2004-12-25 devnull uint sysproc;
81 619085f0 2004-12-25 devnull _Procrendez runrend;
82 619085f0 2004-12-25 devnull Context schedcontext;
83 619085f0 2004-12-25 devnull void *udata;
84 e1dc7e45 2004-12-27 devnull Jmp sigjmp;
87 619085f0 2004-12-25 devnull #define proc() _threadproc()
88 619085f0 2004-12-25 devnull #define setproc(p) _threadsetproc(p)
90 4dbefdd4 2004-12-27 devnull extern Proc *_threadprocs;
91 4dbefdd4 2004-12-27 devnull extern Lock _threadprocslock;
92 955a2ca7 2004-12-27 devnull extern Proc *_threadexecproc;
93 955a2ca7 2004-12-27 devnull extern Channel *_threadexecchan;
94 955a2ca7 2004-12-27 devnull extern QLock _threadexeclock;
95 955a2ca7 2004-12-27 devnull extern Channel *_dowaitchan;
97 73722a8b 2004-12-27 devnull extern void _procstart(Proc*, void (*fn)(Proc*));
98 619085f0 2004-12-25 devnull extern _Thread *_threadcreate(Proc*, void(*fn)(void*), void*, uint);
99 619085f0 2004-12-25 devnull extern void _threadexit(void);
100 619085f0 2004-12-25 devnull extern Proc *_threadproc(void);
101 619085f0 2004-12-25 devnull extern void _threadsetproc(Proc*);
102 619085f0 2004-12-25 devnull extern int _threadlock(Lock*, int, ulong);
103 619085f0 2004-12-25 devnull extern void _threadunlock(Lock*, ulong);
104 e1dc7e45 2004-12-27 devnull extern void _pthreadinit(void);
105 e127e40b 2004-12-27 devnull extern int _threadspawn(int*, char*, char**);
106 e127e40b 2004-12-27 devnull extern int _runthreadspawn(int*, char*, char**);
107 2c87dda8 2004-12-28 devnull extern void _threadsetupdaemonize(void);
108 2c87dda8 2004-12-28 devnull extern void _threaddodaemonize(char*);