Changeset 4763 for trunk/Ohana/src/opihi/pcontrol/StopHosts.c
- Timestamp:
- Aug 14, 2005, 10:33:53 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/pcontrol/StopHosts.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pcontrol/StopHosts.c
r4762 r4763 29 29 int StopHost (Host *host) { 30 30 31 int result;32 int waitstatus;33 31 int status; 34 32 IOBuffer buffer; … … 53 51 exit (1); 54 52 } 53 HarvestHost (host[0].pid); 54 return (TRUE); 55 } 55 56 56 /* check current child status */ 57 void DownHost (Host *host) { 58 CLOSE (host[0].stdin); 59 CLOSE (host[0].stdout); 60 CLOSE (host[0].stderr); 61 host[0].job = NULL; 62 PutHost (host, PCONTROL_HOST_DOWN, STACK_BOTTOM); 63 } 64 65 void OffHost (Host *host) { 66 CLOSE (host[0].stdin); 67 CLOSE (host[0].stdout); 68 CLOSE (host[0].stderr); 69 host[0].job = NULL; 70 PutHost (host, PCONTROL_HOST_OFF, STACK_BOTTOM); 71 } 72 73 int HarvestHost (int pid) { 74 75 int result; 76 int waitstatus; 77 57 78 /* I probably should loop a few time with max timeout larger than 10ms... */ 58 79 usleep (10000); 59 result = waitpid ( host[0].pid, &waitstatus, WNOHANG);80 result = waitpid (pid, &waitstatus, WNOHANG); 60 81 switch (result) { 61 82 case -1: /* error with waitpid */ … … 83 104 84 105 default: 85 if (result != host[0].pid) {86 fprintf (stderr, "waitpid error: mis-matched PID (%d vs %d). programming error\n", result, host[0].pid);106 if (result != pid) { 107 fprintf (stderr, "waitpid error: mis-matched PID (%d vs %d). programming error\n", result, pid); 87 108 exit (1); 88 109 } … … 101 122 return (TRUE); 102 123 } 103 104 void DownHost (Host *host) {105 CLOSE (host[0].stdin);106 CLOSE (host[0].stdout);107 CLOSE (host[0].stderr);108 host[0].job = NULL;109 PutHost (host, PCONTROL_HOST_DOWN, STACK_BOTTOM);110 }111 112 void OffHost (Host *host) {113 CLOSE (host[0].stdin);114 CLOSE (host[0].stdout);115 CLOSE (host[0].stderr);116 host[0].job = NULL;117 PutHost (host, PCONTROL_HOST_OFF, STACK_BOTTOM);118 }
Note:
See TracChangeset
for help on using the changeset viewer.
