Changeset 4763 for trunk/Ohana/src/opihi/pantasks
- Timestamp:
- Aug 14, 2005, 10:33:53 AM (21 years ago)
- Location:
- trunk/Ohana/src/opihi/pantasks
- Files:
-
- 1 added
- 9 edited
-
CheckController.c (modified) (4 diffs)
-
CheckJobs.c (modified) (1 diff)
-
CheckSystem.c (modified) (1 diff)
-
ControllerOps.c (modified) (9 diffs)
-
Makefile (modified) (1 diff)
-
controller.c (modified) (2 diffs)
-
controller_host.c (modified) (1 diff)
-
controller_pulse.c (added)
-
controller_status.c (modified) (1 diff)
-
psched.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pantasks/CheckController.c
r4762 r4763 38 38 gettimeofday (&stop, (void *) NULL); 39 39 dtime = DTIME (stop, start); 40 if (VerboseMode()) fprintf (stderr, "check stack %f\n", dtime); 40 if (VerboseMode()) fprintf (stderr, "check exit stack %f\n", dtime); 41 /* if (Njobs) fprintf (stderr, "check exit stack %f\n", dtime); */ 41 42 gettimeofday (&start, (void *) NULL); 42 43 … … 61 62 gettimeofday (&stop, (void *) NULL); 62 63 dtime = DTIME (stop, start); 63 if (VerboseMode()) fprintf (stderr, "check %d jobs %f\n", i, dtime); 64 /* if (VerboseMode()) fprintf (stderr, "clear %d exit jobs %f\n", i, dtime); */ 65 gettimeofday (&start, (void *) NULL); 64 66 65 67 if (TestElapsedCheck()) return (TRUE); … … 85 87 } 86 88 89 gettimeofday (&stop, (void *) NULL); 90 dtime = DTIME (stop, start); 91 /* if (VerboseMode()) fprintf (stderr, "check crash stack %f\n", dtime); */ 92 gettimeofday (&start, (void *) NULL); 93 87 94 p = buffer.buffer; 88 95 for (i = 0; (i < Njobs) && !TestElapsedCheck(); i++) { … … 104 111 } 105 112 FreeIOBuffer (&buffer); 113 114 gettimeofday (&stop, (void *) NULL); 115 dtime = DTIME (stop, start); 116 /* if (VerboseMode()) fprintf (stderr, "clear %d crash jobs %f\n", i, dtime); */ 106 117 return (TRUE); 107 118 } -
trunk/Ohana/src/opihi/pantasks/CheckJobs.c
r4762 r4763 17 17 switch (status) { 18 18 case JOB_PENDING: 19 if (VerboseMode()) fprintf (stderr, "job %s (%d) pending\n", job[0].task[0].name, job[0].JobID);19 /* if (VerboseMode()) fprintf (stderr, "job %s (%d) pending\n", job[0].task[0].name, job[0].JobID); */ 20 20 break; 21 21 22 22 case JOB_BUSY: 23 if (VerboseMode()) fprintf (stderr, "job %s (%d) busy\n", job[0].task[0].name, job[0].JobID);23 /* if (VerboseMode()) fprintf (stderr, "job %s (%d) busy\n", job[0].task[0].name, job[0].JobID); */ 24 24 break; 25 25 -
trunk/Ohana/src/opihi/pantasks/CheckSystem.c
r4762 r4763 9 9 gettimeofday (&start, (void *) NULL); 10 10 11 if (Ncheck < 5) {11 if (Ncheck < 20) { 12 12 CheckTasks (); 13 13 CheckJobs (); -
trunk/Ohana/src/opihi/pantasks/ControllerOps.c
r4762 r4763 25 25 gettimeofday (&stop, (void *) NULL); 26 26 dtime = DTIME (stop, start); 27 if (VerboseMode()) fprintf (stderr, "check job status %f\n", dtime);27 /* if (VerboseMode()) fprintf (stderr, "check job status %f\n", dtime); */ 28 28 29 29 if ((job[0].state == JOB_EXIT) || (job[0].state == JOB_CRASH)) { … … 32 32 gettimeofday (&stop, (void *) NULL); 33 33 dtime = DTIME (stop, start); 34 if (VerboseMode()) fprintf (stderr, "get stdout %f\n", dtime); 35 34 /* if (VerboseMode()) fprintf (stderr, "get stdout %f\n", dtime); */ 35 36 gettimeofday (&start, (void *) NULL); 36 37 GetJobOutput ("stderr", job[0].pid, &job[0].stderr, job[0].stderr_size); 38 gettimeofday (&stop, (void *) NULL); 39 dtime = DTIME (stop, start); 40 /* if (VerboseMode()) fprintf (stderr, "get stderr %f\n", dtime); */ 41 42 gettimeofday (&start, (void *) NULL); 37 43 DeleteControllerJob (job); 44 gettimeofday (&stop, (void *) NULL); 45 dtime = DTIME (stop, start); 46 /* if (VerboseMode()) fprintf (stderr, "delete job %f\n", dtime); */ 38 47 } 39 48 return (TRUE); … … 138 147 if (status == -1) return (CONTROLLER_HUNG); 139 148 140 if (VerboseMode()) fprintf (stderr, "message received (GetJobOutput : %s)\n", cmd);149 /* if (VerboseMode()) fprintf (stderr, "message received (GetJobOutput : %s)\n", cmd); */ 141 150 /* drop extra bytes from pcontrol (not pclient:job) */ 142 151 buffer[0].Nbuffer = Nstart + Nbytes; … … 328 337 FlushIOBuffer (buffer); 329 338 330 if (VerboseMode()) fprintf (stderr, "send: %s\n", cmd);331 332 339 /* send command, is pipe still open? */ 333 340 status = write_fmt (stdin_cntl, "%s\n", cmd); 334 341 if ((status == -1) && (errno == EPIPE)) { 335 ControllerStatus = FALSE;342 StopController (); 336 343 if (VerboseMode()) fprintf (stderr, "controller is down\n"); 337 344 return (FALSE); … … 347 354 } 348 355 if (status == 0) { 349 ControllerStatus = FALSE;356 StopController (); 350 357 if (VerboseMode()) fprintf (stderr, "controller is down\n"); 351 358 return (FALSE); 352 359 } 353 360 if (status == -1) { 361 StopController (); 354 362 if (VerboseMode()) fprintf (stderr, "controller is not responding\n"); 355 363 return (FALSE); … … 362 370 bzero (buffer[0].buffer + buffer[0].Nbuffer, buffer[0].Nalloc - buffer[0].Nbuffer); 363 371 } 364 if (VerboseMode()) fprintf (stderr, "message received, %d cycles\n", i);372 /* if (VerboseMode()) fprintf (stderr, "message received, %d cycles\n", i); */ 365 373 return (TRUE); 366 374 } … … 428 436 int QuitController () { 429 437 430 int i, status, waitstatus, result;438 int status; 431 439 char cmd[128]; 432 440 IOBuffer buffer; … … 436 444 sprintf (cmd, "quit"); 437 445 InitIOBuffer (&buffer, 0x100); 438 status = ControllerCommand (cmd, CONTROLLER_PROMPT, &buffer); 439 FreeIOBuffer (&buffer); 446 status = ControllerCommand (cmd, "", &buffer); 447 FreeIOBuffer (&buffer); 448 449 /* the quit command does not return a prompt, so we always 450 get an error on the controller here */ 451 StopController (); 452 return (TRUE); 453 } 454 455 int StopController () { 456 457 int i, waitstatus, result; 458 459 if (!ControllerStatus) return (TRUE); 440 460 441 461 ControllerStatus = FALSE; … … 451 471 FreeIOBuffer (&stdout_buffer); 452 472 FreeIOBuffer (&stderr_buffer); 453 454 return (TRUE); 455 } 473 return (TRUE); 474 } -
trunk/Ohana/src/opihi/pantasks/Makefile
r4748 r4763 51 51 $(SDIR)/controller_status.$(ARCH).o \ 52 52 $(SDIR)/controller_output.$(ARCH).o \ 53 $(SDIR)/controller_pulse.$(ARCH).o \ 53 54 $(SDIR)/task.$(ARCH).o \ 54 55 $(SDIR)/task_host.$(ARCH).o \ -
trunk/Ohana/src/opihi/pantasks/controller.c
r4693 r4763 6 6 int controller_check PROTO((int, char **)); 7 7 int controller_output PROTO((int, char **)); 8 int controller_pulse PROTO((int, char **)); 8 9 9 10 static Command controller_cmds[] = { … … 13 14 {"status", controller_status, "check controller status"}, 14 15 {"output", controller_output, "print controller output"}, 16 {"pulse", controller_pulse, "set controller pulse"}, 15 17 }; 16 18 -
trunk/Ohana/src/opihi/pantasks/controller_host.c
r4714 r4763 22 22 return (TRUE); 23 23 } 24 25 /* should I keep an internal host table so I can reload the 26 hosts if the controller exits? 27 28 alternatively, that could be a user-level choice 29 */ -
trunk/Ohana/src/opihi/pantasks/controller_status.c
r4706 r4763 22 22 InitIOBuffer (&buffer, 0x100); 23 23 status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer); 24 if (status) fwrite (buffer.buffer, 1, buffer.Nbuffer, stderr); 24 if (status) { 25 fwrite (buffer.buffer, 1, buffer.Nbuffer, stderr); 26 } else { 27 fprintf (stderr, "controller is down\n"); 28 } 25 29 FreeIOBuffer (&buffer); 26 30 return (TRUE); 27 28 31 } -
trunk/Ohana/src/opihi/pantasks/psched.c
r4714 r4763 41 41 42 42 signal (SIGINT, SIG_IGN); 43 signal (SIGPIPE, gotsignal); 44 signal (SIGTSTP, gotsignal); 45 signal (SIGTTIN, gotsignal); 43 46 return; 44 47 } … … 57 60 return; 58 61 } 62 63 void gotsignal (int signum) { 64 fprintf (stderr, "got signal : %d\n", signum); 65 return; 66 }
Note:
See TracChangeset
for help on using the changeset viewer.
