diff options
author | Nicholas Noll <nbnoll@eml.cc> | 2021-10-19 09:35:59 -0700 |
---|---|---|
committer | Nicholas Noll <nbnoll@eml.cc> | 2021-10-19 09:35:59 -0700 |
commit | 47e3d475df6244a48b73421cd4210b64c392df8d (patch) | |
tree | 5b4459341a6c6a7211749796367f536a09f1faa1 /sys/cmd/rc/rc.h | |
parent | ead340a66039096c7b4bf12dcd65e189769c6653 (diff) |
feat(rc): cleaner process watching for each job
Diffstat (limited to 'sys/cmd/rc/rc.h')
-rw-r--r-- | sys/cmd/rc/rc.h | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/sys/cmd/rc/rc.h b/sys/cmd/rc/rc.h index 9c6307f..ef7c18e 100644 --- a/sys/cmd/rc/rc.h +++ b/sys/cmd/rc/rc.h @@ -93,6 +93,22 @@ struct Redir struct Redir *link; /* what else to do (reverse order) */ }; +enum +{ + PNil, + PRun, + PStop, + PSig, + PAgain, + PDone, +}; + +struct WaitItem +{ + int pid; + ushort status; +}; + struct Thread { struct { @@ -109,21 +125,19 @@ struct Thread Redir *redir; // list of redirections struct { - ushort i : 1; - ushort eof : 1; - ushort stop : 1; - ushort done : 1; - ushort again : 1; - } flag; // flags for process + ushort i : 1; + ushort eof : 1; + } flag; struct { - int len, cap, *pid; + ushort status; + int len, cap; + struct WaitItem *on; } wait; int pid, pgid, status; long line; - Tree *nodes; // memory allocation Thread *link; // process we return to Thread *next; // next job }; @@ -131,6 +145,7 @@ struct Thread struct Shell { int pid; + Io *err; int status; int interactive; Thread *jobs; @@ -140,9 +155,7 @@ struct Shell // globals extern Shell shell; - -extern Thread *proc; -extern Io *errio; +extern Thread *runner; extern Code *compiled; // ----------------------------------------------------------------------- @@ -203,6 +216,7 @@ void killzombies(void); Thread *getjob(int, int*); void addjob(Thread *); void deljob(Thread *); +void wakeup(Thread *); void report(Thread *, int); void foreground(Thread *, int); |