Changeset 7917 for trunk/Ohana/src/opihi/pantasks
- Timestamp:
- Jul 16, 2006, 10:58:49 PM (20 years ago)
- Location:
- trunk/Ohana/src/opihi/pantasks
- Files:
-
- 39 edited
-
CheckController.c (modified) (9 diffs)
-
CheckJobs.c (modified) (6 diffs)
-
CheckPassword.c (modified) (2 diffs)
-
ControllerOps.c (modified) (17 diffs)
-
JobOps.c (modified) (2 diffs)
-
ListenClients.c (modified) (8 diffs)
-
LocalJob.c (modified) (6 diffs)
-
Makefile (modified) (2 diffs)
-
SocketOps.c (modified) (12 diffs)
-
TaskOps.c (modified) (6 diffs)
-
client_shell.c (modified) (5 diffs)
-
controller.c (modified) (2 diffs)
-
controller_check.c (modified) (3 diffs)
-
controller_exit.c (modified) (1 diff)
-
controller_host.c (modified) (2 diffs)
-
controller_output.c (modified) (1 diff)
-
controller_pulse.c (modified) (2 diffs)
-
controller_status.c (modified) (3 diffs)
-
delete.c (modified) (2 diffs)
-
invalid.c (modified) (1 diff)
-
job.c (modified) (3 diffs)
-
kill.c (modified) (3 diffs)
-
pantasks.c (modified) (2 diffs)
-
pantasks_client.c (modified) (2 diffs)
-
pantasks_server.c (modified) (2 diffs)
-
pulse.c (modified) (1 diff)
-
run.c (modified) (1 diff)
-
scheduler.c (modified) (2 diffs)
-
status.c (modified) (1 diff)
-
stop.c (modified) (1 diff)
-
task.c (modified) (3 diffs)
-
task_command.c (modified) (2 diffs)
-
task_host.c (modified) (2 diffs)
-
task_macros.c (modified) (3 diffs)
-
task_nmax.c (modified) (2 diffs)
-
task_periods.c (modified) (2 diffs)
-
task_trange.c (modified) (2 diffs)
-
verbose.c (modified) (2 diffs)
-
version.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pantasks/CheckController.c
r6687 r7917 19 19 // TimerMark (); 20 20 // status = ControllerCommand ("stop", CONTROLLER_PROMPT, &buffer); 21 // if (VerboseMode()) fprintf (stderr, "stop controller %f\n", TimerElapsed(TRUE));21 // if (VerboseMode()) gprint (GP_ERR, "stop controller %f\n", TimerElapsed(TRUE)); 22 22 23 23 TimerMark (); 24 24 FlushIOBuffer (&buffer); 25 25 status = ControllerCommand ("jobstack exit", CONTROLLER_PROMPT, &buffer); 26 if (VerboseMode()) fprintf (stderr, "check exit stack %f\n", TimerElapsed(TRUE));26 if (VerboseMode()) gprint (GP_ERR, "check exit stack %f\n", TimerElapsed(TRUE)); 27 27 if (!status) goto escape; 28 28 … … 34 34 status = sscanf (buffer.buffer, "%*s %d", &Njobs); 35 35 if (status != 1) goto escape; 36 if (VerboseMode()) fprintf (stderr, "parse %d jobs on stack %f\n", Njobs, TimerElapsed(TRUE));36 if (VerboseMode()) gprint (GP_ERR, "parse %d jobs on stack %f\n", Njobs, TimerElapsed(TRUE)); 37 37 38 38 p = buffer.buffer; … … 40 40 q = strchr (p, '\n'); 41 41 if (q == NULL) { 42 fprintf (stderr, "controller message error: incomplete job list\n");42 gprint (GP_ERR, "controller message error: incomplete job list\n"); 43 43 break; 44 44 } … … 48 48 job = FindControllerJob (JobID); 49 49 if (job == NULL) { 50 fprintf (stderr, "misplaced job? %d not in EXIT job list\n", JobID);50 gprint (GP_ERR, "misplaced job? %d not in EXIT job list\n", JobID); 51 51 continue; 52 52 } … … 54 54 CheckControllerJob (job); 55 55 } 56 if (VerboseMode()) fprintf (stderr, "clear %d exit jobs %f\n", i, TimerElapsed(TRUE));56 if (VerboseMode()) gprint (GP_ERR, "clear %d exit jobs %f\n", i, TimerElapsed(TRUE)); 57 57 58 58 if (TestElapsedCheck()) goto finish; … … 70 70 status = sscanf (buffer.buffer, "%*s %d", &Njobs); 71 71 if (status != 1) goto escape; 72 if (VerboseMode()) fprintf (stderr, "check crash stack %f\n", TimerElapsed(TRUE));72 if (VerboseMode()) gprint (GP_ERR, "check crash stack %f\n", TimerElapsed(TRUE)); 73 73 74 74 p = buffer.buffer; … … 76 76 q = strchr (p, '\n'); 77 77 if (q == NULL) { 78 fprintf (stderr, "controller message error: incomplete job list\n");78 gprint (GP_ERR, "controller message error: incomplete job list\n"); 79 79 break; 80 80 } … … 84 84 job = FindControllerJob (JobID); 85 85 if (job == NULL) { 86 fprintf (stderr, "misplaced job? %d not in CRASH job list\n", JobID);86 gprint (GP_ERR, "misplaced job? %d not in CRASH job list\n", JobID); 87 87 continue; 88 88 } … … 90 90 CheckControllerJob (job); 91 91 } 92 if (VerboseMode()) fprintf (stderr, "clear %d crash jobs %f\n", i, TimerElapsed(TRUE));92 if (VerboseMode()) gprint (GP_ERR, "clear %d crash jobs %f\n", i, TimerElapsed(TRUE)); 93 93 94 94 finish: -
trunk/Ohana/src/opihi/pantasks/CheckJobs.c
r6687 r7917 18 18 switch (status) { 19 19 case JOB_PENDING: 20 /* if (VerboseMode()) fprintf (stderr, "job %s (%d) pending\n", job[0].task[0].name, job[0].JobID); */20 /* if (VerboseMode()) gprint (GP_LOG, "job %s (%d) pending\n", job[0].task[0].name, job[0].JobID); */ 21 21 break; 22 22 23 23 case JOB_BUSY: 24 /* if (VerboseMode()) fprintf (stderr, "job %s (%d) busy\n", job[0].task[0].name, job[0].JobID); */24 /* if (VerboseMode()) gprint (GP_LOG, "job %s (%d) busy\n", job[0].task[0].name, job[0].JobID); */ 25 25 break; 26 26 … … 28 28 /* run task[0].crash macro, if it exists */ 29 29 /* push output buffer data to the stdout and stderr queues */ 30 if (VerboseMode()) fprintf (stderr, "job %s (%d) crash\n", job[0].task[0].name, job[0].JobID);30 if (VerboseMode()) gprint (GP_LOG, "job %s (%d) crash\n", job[0].task[0].name, job[0].JobID); 31 31 PushNamedQueue ("stdout", job[0].stdout.buffer); 32 32 PushNamedQueue ("stderr", job[0].stderr.buffer); … … 48 48 49 49 case JOB_EXIT: 50 if (VerboseMode()) fprintf (stderr, "job %s (%d) exit\n", job[0].task[0].name, job[0].JobID);50 if (VerboseMode()) gprint (GP_LOG, "job %s (%d) exit\n", job[0].task[0].name, job[0].JobID); 51 51 PushNamedQueue ("stdout", job[0].stdout.buffer); 52 52 PushNamedQueue ("stderr", job[0].stderr.buffer); … … 79 79 80 80 default: 81 if (VerboseMode()) fprintf (stderr, "unknown exit status: %d\n", status);81 if (VerboseMode()) gprint (GP_LOG, "unknown exit status: %d\n", status); 82 82 /** do something more useful here ?? **/ 83 83 break; … … 89 89 if (job[0].mode == JOB_LOCAL) { 90 90 if (GetTaskTimer(job[0].start) < job[0].task[0].timeout_period) continue; 91 if (VerboseMode()) fprintf (stderr, "timeout on %s\n", job[0].task[0].name);91 if (VerboseMode()) gprint (GP_LOG, "timeout on %s\n", job[0].task[0].name); 92 92 93 93 /* update the timeout counter */ … … 96 96 if (!KillLocalJob (job)) { 97 97 job[0].state = JOB_HUNG; 98 if (VerboseMode()) fprintf (stderr, "child process %d is hung, cannot kill\n", job[0].pid);98 if (VerboseMode()) gprint (GP_LOG, "child process %d is hung, cannot kill\n", job[0].pid); 99 99 continue; 100 100 } -
trunk/Ohana/src/opihi/pantasks/CheckPassword.c
r7892 r7917 15 15 int status; 16 16 17 if (DEBUG) fprintf (stderr, "waiting for password %s\n", PASSWORD);17 if (DEBUG) gprint (GP_ERR, "waiting for password %s\n", PASSWORD); 18 18 19 19 status = ExpectCommand (BindSocket, strlen(PASSWORD), 0.1, &message); 20 20 if (status != 0) { 21 if (DEBUG) fprintf (stderr, "failed connection\n");21 if (DEBUG) gprint (GP_ERR, "failed connection\n"); 22 22 FreeIOBuffer (&message); 23 23 close (BindSocket); … … 25 25 } 26 26 if (strncmp (message.buffer, PASSWORD, strlen(PASSWORD))) { 27 if (DEBUG) fprintf (stderr, "invalid password\n");27 if (DEBUG) gprint (GP_ERR, "invalid password\n"); 28 28 close (BindSocket); 29 29 return (FALSE); 30 30 } 31 if (DEBUG) fprintf (stderr, "accepted password (%s)\n", message.buffer);31 if (DEBUG) gprint (GP_ERR, "accepted password (%s)\n", message.buffer); 32 32 33 33 return (TRUE); -
trunk/Ohana/src/opihi/pantasks/ControllerOps.c
r6687 r7917 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()) gprint (GP_ERR, "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); */34 /* if (VerboseMode()) gprint (GP_ERR, "get stdout %f\n", dtime); */ 35 35 36 36 gettimeofday (&start, (void *) NULL); … … 38 38 gettimeofday (&stop, (void *) NULL); 39 39 dtime = DTIME (stop, start); 40 /* if (VerboseMode()) fprintf (stderr, "get stderr %f\n", dtime); */40 /* if (VerboseMode()) gprint (GP_ERR, "get stderr %f\n", dtime); */ 41 41 42 42 gettimeofday (&start, (void *) NULL); … … 44 44 gettimeofday (&stop, (void *) NULL); 45 45 dtime = DTIME (stop, start); 46 /* if (VerboseMode()) fprintf (stderr, "delete job %f\n", dtime); */46 /* if (VerboseMode()) gprint (GP_ERR, "delete job %f\n", dtime); */ 47 47 } 48 48 return (TRUE); … … 81 81 p = memstr (buffer.buffer, "job not found", buffer.Nbuffer); 82 82 if (p != NULL) { 83 fprintf (stderr, "unknown job %d\n", job[0].pid);83 gprint (GP_ERR, "unknown job %d\n", job[0].pid); 84 84 FreeIOBuffer (&buffer); 85 85 return (FALSE); … … 105 105 if (!strcmp(status_string, "CRASH")) outstate = JOB_CRASH; 106 106 if (outstate == -1) { 107 fprintf (stderr, "programming error?\n");107 gprint (GP_ERR, "programming error?\n"); 108 108 exit (1); 109 109 } … … 147 147 if (status == -1) return (CONTROLLER_HUNG); 148 148 149 /* if (VerboseMode()) fprintf (stderr, "message received (GetJobOutput : %s)\n", cmd); */149 /* if (VerboseMode()) gprint (GP_ERR, "message received (GetJobOutput : %s)\n", cmd); */ 150 150 /* drop extra bytes from pcontrol (not pclient:job) */ 151 151 buffer[0].Nbuffer = Nstart + Nbytes; … … 205 205 p = memstr (buffer.buffer, "JobID", buffer.Nbuffer); 206 206 if (p == NULL) { 207 fprintf (stderr, "missing PID in pcontrol message : programming error\n");207 gprint (GP_ERR, "missing PID in pcontrol message : programming error\n"); 208 208 exit (1); 209 209 } … … 240 240 pid = fork (); 241 241 if (!pid) { /* must be child process */ 242 fprintf (stderr, "starting controller connection\n");242 gprint (GP_LOG, "starting controller connection\n"); 243 243 244 244 /* close the other ends of the pipes */ … … 303 303 ControllerPID = pid; 304 304 ControllerStatus = TRUE; 305 fprintf (stderr, "Connected\n");305 gprint (GP_LOG, "Connected\n"); 306 306 return (TRUE); 307 307 … … 311 311 312 312 io_error: 313 fprintf (stderr, "timeout while connecting\n");313 gprint (GP_ERR, "timeout while connecting\n"); 314 314 goto close_pipes; 315 315 … … 341 341 if ((status == -1) && (errno == EPIPE)) { 342 342 StopController (); 343 if (VerboseMode()) fprintf (stderr, "controller is down\n");343 if (VerboseMode()) gprint (GP_ERR, "controller is down\n"); 344 344 return (FALSE); 345 345 } … … 355 355 if (status == 0) { 356 356 StopController (); 357 if (VerboseMode()) fprintf (stderr, "controller is down\n");357 if (VerboseMode()) gprint (GP_ERR, "controller is down\n"); 358 358 return (FALSE); 359 359 } 360 360 if (status == -1) { 361 if (VerboseMode()) fprintf (stderr, "controller is not responding\n");361 if (VerboseMode()) gprint (GP_ERR, "controller is not responding\n"); 362 362 return (FALSE); 363 363 } … … 369 369 bzero (buffer[0].buffer + buffer[0].Nbuffer, buffer[0].Nalloc - buffer[0].Nbuffer); 370 370 } 371 /* if (VerboseMode()) fprintf (stderr, "message received, %d cycles\n", i); */371 /* if (VerboseMode()) gprint (GP_ERR, "message received, %d cycles\n", i); */ 372 372 return (TRUE); 373 373 } … … 383 383 switch (Nread) { 384 384 case -2: /* error in read (programming error? system level error?) */ 385 fprintf (stderr, "serious IO error\n");385 gprint (GP_ERR, "serious IO error\n"); 386 386 exit (2); 387 387 case -1: /* no data in pipe */ … … 395 395 switch (Nread) { 396 396 case -2: /* error in read (programming error? system level error?) */ 397 fprintf (stderr, "serious IO error\n");397 gprint (GP_ERR, "serious IO error\n"); 398 398 exit (2); 399 399 case -1: /* no data in pipe */ … … 407 407 int PrintControllerOutput () { 408 408 409 fprintf (stderr, "--- stdout ---\n");410 fwrite (stdout_buffer.buffer, 1, stdout_buffer.Nbuffer, stderr);411 fprintf (stderr, "--- stdout---\n");412 fwrite (stderr_buffer.buffer, 1, stderr_buffer.Nbuffer, stderr);413 fprintf (stderr, "--- done ---\n");409 gprint (GP_LOG, "--- stdout ---\n"); 410 gwrite (stdout_buffer.buffer, 1, stdout_buffer.Nbuffer, GP_LOG); 411 gprint (GP_LOG, "--- stderr ---\n"); 412 gwrite (stderr_buffer.buffer, 1, stderr_buffer.Nbuffer, GP_LOG); 413 gprint (GP_LOG, "--- done ---\n"); 414 414 return (TRUE); 415 415 } -
trunk/Ohana/src/opihi/pantasks/JobOps.c
r6687 r7917 65 65 int i; 66 66 67 fprintf (stderr, "\n");67 gprint (GP_LOG, "\n"); 68 68 if (Njobs == 0) { 69 fprintf (stderr, " no defined jobs\n");69 gprint (GP_LOG, " no defined jobs\n"); 70 70 return; 71 71 } 72 72 73 fprintf (stderr, " Jobs\n");74 for (i = 0; i < Njobs; i++) { 75 fprintf (stderr, " %d: %-15s %5d %20s (%lx)\n", Njobs, jobs[i][0].task[0].name, jobs[i][0].JobID, jobs[i][0].argv[0], (long) jobs[i][0].argv);73 gprint (GP_LOG, " Jobs\n"); 74 for (i = 0; i < Njobs; i++) { 75 gprint (GP_LOG, " %d: %-15s %5d %20s (%lx)\n", Njobs, jobs[i][0].task[0].name, jobs[i][0].JobID, jobs[i][0].argv[0], (long) jobs[i][0].argv); 76 76 } 77 77 return; … … 155 155 } 156 156 if (Nm == -1) { 157 fprintf (stderr, "programming error: job not found\n");157 gprint (GP_ERR, "programming error: job not found\n"); 158 158 return (FALSE); 159 159 } -
trunk/Ohana/src/opihi/pantasks/ListenClients.c
r7892 r7917 25 25 */ 26 26 27 if (DEBUG) fprintf (stderr, "adding a new client (%d)\n", client);27 if (DEBUG) gprint (GP_LOG, "adding a new client (%d)\n", client); 28 28 clients[Nclients] = client; 29 29 InitIOBuffer(&buffers[Nclients], 256); … … 42 42 fd_set fdSet; 43 43 struct timeval timeout; 44 IOBuffer *outbuffer; 44 45 45 46 InitClients (); … … 50 51 for (i = 0; i < Ncurrent; i++) { 51 52 ExpectMessage (clients[i], 0.25, &buffers[i]); 52 if (DEBUG) fprintf (stderr, "read %d from client %d\n", buffers[i].Nbuffer, i);53 if (DEBUG) gprint (GP_ERR, "read %d from client %d\n", buffers[i].Nbuffer, i); 53 54 if (buffers[i].Nbuffer) { 54 if (DEBUG) fprintf (stderr, "%s\n", buffers[i].buffer);55 if (DEBUG) gprint (GP_ERR, "%s\n", buffers[i].buffer); 55 56 } 56 57 } … … 73 74 FD_SET (clients[i], &fdSet); 74 75 if (FD_ISSET(clients[i], &fdSet)) { 75 if (DEBUG) fprintf (stderr, "fd %d is set\n", clients[i]);76 if (DEBUG) gprint (GP_ERR, "fd %d is set\n", clients[i]); 76 77 } else { 77 if (DEBUG) fprintf (stderr, "fd %d is not set\n", clients[i]);78 if (DEBUG) gprint (GP_ERR, "fd %d is not set\n", clients[i]); 78 79 } 79 80 } … … 81 82 82 83 /* block until we have some data on the pipes (or timeout) */ 83 if (DEBUG) fprintf (stderr, "listening to %d clients\n", Ncurrent);84 if (DEBUG) gprint (GP_ERR, "listening to %d clients\n", Ncurrent); 84 85 status = select (Nmax, &fdSet, NULL, NULL, &timeout); 85 86 86 if (DEBUG) fprintf (stderr, "messages from %d clients\n", status);87 if (DEBUG) gprint (GP_ERR, "messages from %d clients\n", status); 87 88 88 89 if (status == -1) { … … 99 100 100 101 /* this client has data, handle it */ 101 if (DEBUG) fprintf (stderr, "data from client %d\n", clients[i]); 102 103 if (DEBUG) fprintf (stderr, "start: ", buffers[i].buffer); 104 fwrite (buffers[i].buffer, 1, buffers[i].Nbuffer, stderr); 105 if (DEBUG) fprintf (stderr, "...\n"); 102 if (DEBUG) { 103 gprint (GP_ERR, "data from client %d\n", clients[i]); 104 gprint (GP_ERR, "start: ", buffers[i].buffer); 105 gwrite (buffers[i].buffer, 1, buffers[i].Nbuffer, GP_ERR); 106 gprint (GP_ERR, "...\n"); 107 } 106 108 107 109 /* read until the pipe is empty: -1 is empty, -2 is error */ … … 109 111 while (Nread >= 0) { 110 112 Nread = ReadtoIOBuffer (&buffers[i], clients[i]); 111 if (DEBUG) fprintf (stderr, "read %d bytes from socket\n", Nread);113 if (DEBUG) gprint (GP_ERR, "read %d bytes from socket\n", Nread); 112 114 113 115 if (Nread == -2) { 114 116 /* error: do something */ 115 if (1) fprintf (stderr, "error reading from socket\n");117 if (1) gprint (GP_ERR, "error reading from socket\n"); 116 118 } 117 119 } 118 if (DEBUG) fprintf (stderr, "read %d total bytes\n", buffers[i].Nbuffer);120 if (DEBUG) gprint (GP_ERR, "read %d total bytes\n", buffers[i].Nbuffer); 119 121 120 122 if (DEBUG) { 121 fprintf (stderr, "end: ", buffers[i].buffer);122 fwrite (buffers[i].buffer, 1, buffers[i].Nbuffer, stderr);123 fprintf (stderr, "...\n");123 gprint (GP_ERR, "end: ", buffers[i].buffer); 124 gwrite (buffers[i].buffer, 1, buffers[i].Nbuffer, GP_ERR); 125 gprint (GP_ERR, "...\n"); 124 126 } 125 127 … … 129 131 130 132 /* we now have a possible command from the client: run it */ 133 /* XXX : we need to handle ; in the client-parsing of commands */ 131 134 stripwhite (line); 132 135 if (*line) { 133 if (1) fprintf (stderr, "got command: %s\n", line); 136 if (1) gprint (GP_ERR, "got command: %s\n", line); 137 SetOutBuffer (); 134 138 status = multicommand (line); 139 outbuffer = GetOutBuffer (); 140 141 gprint (GP_ERR, "send message: %d bytes\n", outbuffer[0].Nbuffer); 142 gwrite (outbuffer[0].buffer, 1, outbuffer[0].Nbuffer, GP_ERR); 143 gprint (GP_ERR, "end message\n"); 144 145 SendMessage (clients[i], outbuffer[0].buffer); 146 SetOutfile ("stdout"); 135 147 } 136 148 free (line); 137 149 150 138 151 /* this function should return the output buffer 139 152 to the currently selected client */ -
trunk/Ohana/src/opihi/pantasks/LocalJob.c
r6687 r7917 24 24 switch (Nread) { 25 25 case -2: /* error in read (programming error? system level error?) */ 26 fprintf (stderr, "serious IO error\n");26 gprint (GP_ERR, "serious IO error\n"); 27 27 exit (2); 28 28 case -1: /* no data in pipe */ … … 36 36 switch (Nread) { 37 37 case -2: /* error in read (programming error? system level error?) */ 38 fprintf (stderr, "serious IO error\n");38 gprint (GP_ERR, "serious IO error\n"); 39 39 exit (2); 40 40 case -1: /* no data in pipe */ … … 57 57 switch (errno) { 58 58 case ECHILD: 59 fprintf (stderr, "unknown PID, not a child proc\n");60 fprintf (stderr, "did process already exit? programming error?\n");59 gprint (GP_ERR, "unknown PID, not a child proc\n"); 60 gprint (GP_ERR, "did process already exit? programming error?\n"); 61 61 job[0].state = JOB_NONE; 62 62 job[0].exit_status = 0; 63 63 return (FALSE); 64 64 case EINVAL: 65 fprintf (stderr, "error EINVAL (waitpid): programming error\n");65 gprint (GP_ERR, "error EINVAL (waitpid): programming error\n"); 66 66 exit (1); 67 67 case EINTR: 68 fprintf (stderr, "error EINTR (waitpid): programming error\n");68 gprint (GP_ERR, "error EINTR (waitpid): programming error\n"); 69 69 exit (1); 70 70 default: 71 fprintf (stderr, "unknown error for waitpid (%d): programming error\n", errno);71 gprint (GP_ERR, "unknown error for waitpid (%d): programming error\n", errno); 72 72 exit (1); 73 73 } … … 81 81 default: 82 82 if (result != job[0].pid) { 83 fprintf (stderr, "waitpid error: mis-matched PID (%d vs %d). programming error\n", result, job[0].pid);83 gprint (GP_ERR, "waitpid error: mis-matched PID (%d vs %d). programming error\n", result, job[0].pid); 84 84 exit (1); 85 85 } … … 93 93 } 94 94 if (WIFSTOPPED(waitstatus)) { 95 fprintf (stderr, "waitpid returns 'stopped': programming error\n");95 gprint (GP_ERR, "waitpid returns 'stopped': programming error\n"); 96 96 exit (1); 97 97 } … … 114 114 pid = fork (); 115 115 if (!pid) { /* must be child process */ 116 if (VerboseMode()) fprintf (stderr, "starting local job\n");116 if (VerboseMode()) gprint (GP_ERR, "starting local job\n"); 117 117 118 118 /* close the other ends of the pipes */ -
trunk/Ohana/src/opihi/pantasks/Makefile
r7892 r7917 19 19 # link flags 20 20 LIBS = -L$(LIB) -L$(LLIB) -L$(XLIB) 21 LIBS1 = -lsocket -lnsl -lreadline $(TLIB) -ldvo -lkapa -lFITS -lohana -lX11 -l m21 LIBS1 = -lsocket -lnsl -lreadline $(TLIB) -ldvo -lkapa -lFITS -lohana -lX11 -lpthread -lm 22 22 LIBS2 = -lbasiccmd -ldatacmd -lastrocmd -lshell -ldata 23 23 LFLAGS = $(LIBS) $(LIBS2) $(LIBS1) … … 94 94 $(BIN)/pantasks_server.$(ARCH) : $(server) $(funcs) $(cmds) $(libs) 95 95 @if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi 96 $(CC) -o $@ $^ $(LFLAGS) -lpthread96 $(CC) -o $@ $^ $(LFLAGS) 97 97 98 98 pantasks_client.install: $(DESTBIN)/pantasks_client -
trunk/Ohana/src/opihi/pantasks/SocketOps.c
r7892 r7917 33 33 status = inet_aton (hostip, &Address[0].sin_addr); 34 34 if (!status) { 35 fprintf (stderr, "invalid address\n");35 gprint (GP_ERR, "invalid address\n"); 36 36 exit (2); 37 37 } … … 46 46 } 47 47 48 if (DEBUG) fprintf (stderr, "init sock: %d, len: %d\n", InitSocket, length);48 if (DEBUG) gprint (GP_ERR, "init sock: %d, len: %d\n", InitSocket, length); 49 49 status = bind (InitSocket, (struct sockaddr *) Address, length); 50 50 if (status == -1) { … … 74 74 fcntl (InitSocket, F_SETFL, !O_NONBLOCK); 75 75 76 if (DEBUG) fprintf (stderr, "init sock: %d, len: %d\n", InitSocket, length);76 if (DEBUG) gprint (GP_ERR, "init sock: %d, len: %d\n", InitSocket, length); 77 77 BindSocket = accept (InitSocket, (struct sockaddr *) &Address_in, &length); 78 if (DEBUG) fprintf (stderr, "bind sock: %d\n", BindSocket);78 if (DEBUG) gprint (GP_ERR, "bind sock: %d\n", BindSocket); 79 79 if (BindSocket == -1) { 80 80 perror ("accept: "); … … 84 84 addr = Address_in.sin_addr.s_addr; 85 85 if (DEBUG) { 86 fprintf (stderr, "incoming connection from: ");87 fprintf (stderr, " %u", (0xff & (addr >> 0)));88 fprintf (stderr, ".%u", (0xff & (addr >> 8)));89 fprintf (stderr, ".%u", (0xff & (addr >> 16)));90 fprintf (stderr, ".%u", (0xff & (addr >> 24)));91 fprintf (stderr, "\n");86 gprint (GP_ERR, "incoming connection from: "); 87 gprint (GP_ERR, " %u", (0xff & (addr >> 0))); 88 gprint (GP_ERR, ".%u", (0xff & (addr >> 8))); 89 gprint (GP_ERR, ".%u", (0xff & (addr >> 16))); 90 gprint (GP_ERR, ".%u", (0xff & (addr >> 24))); 91 gprint (GP_ERR, "\n"); 92 92 } 93 93 … … 109 109 } 110 110 111 if (DEBUG) fprintf (stderr, "connection rejected\n");111 if (DEBUG) gprint (GP_ERR, "connection rejected\n"); 112 112 close (BindSocket); 113 113 return (-1); 114 114 115 115 accepted: 116 if (DEBUG) fprintf (stderr, "connection accepted\n");116 if (DEBUG) gprint (GP_ERR, "connection accepted\n"); 117 117 fcntl (BindSocket, F_SETFL, O_NONBLOCK); 118 118 return (BindSocket); … … 135 135 136 136 if (DEBUG) { 137 fprintf (stderr, "trying %s (%s:%d)...", host[0].h_name, hostip, MY_PORT);137 gprint (GP_ERR, "trying %s (%s:%d)...", host[0].h_name, hostip, MY_PORT); 138 138 } 139 139 … … 142 142 status = inet_aton (hostip, &Address.sin_addr); 143 143 if (!status) { 144 fprintf (stderr, "invalid address\n");144 gprint (GP_ERR, "invalid address\n"); 145 145 exit (2); 146 146 } … … 160 160 } 161 161 162 if (DEBUG) fprintf (stderr, "connected\n");162 if (DEBUG) gprint (GP_ERR, "connected\n"); 163 163 fcntl (InitSocket, F_SETFL, O_NONBLOCK); 164 164 return (InitSocket); … … 183 183 status = inet_aton (hostip, &Address[0].sin_addr); 184 184 if (!status) { 185 fprintf (stderr, "invalid address\n");185 gprint (GP_ERR, "invalid address\n"); 186 186 exit (2); 187 187 } … … 195 195 } 196 196 197 if (DEBUG) fprintf (stderr, "init sock: %d, len: %d\n", InitSocket, length);197 if (DEBUG) gprint (GP_ERR, "init sock: %d, len: %d\n", InitSocket, length); 198 198 status = bind (InitSocket, (struct sockaddr *) Address, length); 199 199 if (status == -1) { … … 208 208 } 209 209 210 if (DEBUG) fprintf (stderr, "socket listening on %s (%s:%d)\n", host[0].h_name, hostip, MY_PORT);210 if (DEBUG) gprint (GP_ERR, "socket listening on %s (%s:%d)\n", host[0].h_name, hostip, MY_PORT); 211 211 return (InitSocket); 212 212 } … … 230 230 test &= ((ip4 >=0) && (ip4 < 256)); 231 231 if (!test) { 232 fprintf (stderr, "invalid IP address %s\n", string);232 gprint (GP_ERR, "invalid IP address %s\n", string); 233 233 exit (2); 234 234 } -
trunk/Ohana/src/opihi/pantasks/TaskOps.c
r6687 r7917 54 54 int i, valid; 55 55 56 fprintf (stderr, "\n");56 gprint (GP_LOG, "\n"); 57 57 if (Ntasks == 0) { 58 fprintf (stderr, " no defined tasks\n");58 gprint (GP_LOG, " no defined tasks\n"); 59 59 return; 60 60 } 61 61 62 fprintf (stderr, " Task Status\n");63 fprintf (stderr, " * Name Njobs Command\n");62 gprint (GP_LOG, " Task Status\n"); 63 gprint (GP_LOG, " * Name Njobs Command\n"); 64 64 for (i = 0; i < Ntasks; i++) { 65 65 valid = CheckTimeRanges (tasks[i][0].ranges, tasks[i][0].Nranges); 66 if (verbose) fprintf (stderr, "\n");66 if (verbose) gprint (GP_LOG, "\n"); 67 67 if (valid) { 68 fprintf (stderr, " + ");68 gprint (GP_LOG, " + "); 69 69 } else { 70 fprintf (stderr, " - ");70 gprint (GP_LOG, " - "); 71 71 } 72 72 if (tasks[i][0].argv == NULL) { 73 fprintf (stderr, "%-15s %5d %-20s\n", tasks[i][0].name, tasks[i][0].Njobs, "(dynamic)");73 gprint (GP_LOG, "%-15s %5d %-20s\n", tasks[i][0].name, tasks[i][0].Njobs, "(dynamic)"); 74 74 } else { 75 fprintf (stderr, "%-15s %5d %-20s\n", tasks[i][0].name, tasks[i][0].Njobs, tasks[i][0].argv[0]);75 gprint (GP_LOG, "%-15s %5d %-20s\n", tasks[i][0].name, tasks[i][0].Njobs, tasks[i][0].argv[0]); 76 76 } 77 77 if (verbose) { 78 fprintf (stderr, " spawn period: %f, polling period: %f, timeout period: %f\n",78 gprint (GP_LOG, " spawn period: %f, polling period: %f, timeout period: %f\n", 79 79 tasks[i][0].exec_period, tasks[i][0].poll_period, tasks[i][0].timeout_period); 80 80 if (tasks[i][0].host == NULL) { 81 fprintf (stderr, " task runs locally\n");81 gprint (GP_LOG, " task runs locally\n"); 82 82 continue; 83 83 } 84 84 if (!strcasecmp(tasks[i][0].host, "ANYHOST")) { 85 fprintf (stderr, " task host selected by controller\n");85 gprint (GP_LOG, " task host selected by controller\n"); 86 86 continue; 87 87 } 88 88 if (tasks[i][0].host_required) { 89 fprintf (stderr, " host %s (required)\n", tasks[i][0].host);89 gprint (GP_LOG, " host %s (required)\n", tasks[i][0].host); 90 90 } else { 91 fprintf (stderr, " host %s (desired)\n", tasks[i][0].host);91 gprint (GP_LOG, " host %s (desired)\n", tasks[i][0].host); 92 92 } 93 93 } … … 104 104 task = FindTask (name); 105 105 if (task == NULL) { 106 fprintf (stderr, "task %s not found\n", name);106 gprint (GP_LOG, "task %s not found\n", name); 107 107 return (FALSE); 108 108 } 109 109 110 fprintf (stderr, "\n macro %s\n", task[0].name);111 112 fprintf (stderr, "\n command: ");110 gprint (GP_LOG, "\n macro %s\n", task[0].name); 111 112 gprint (GP_LOG, "\n command: "); 113 113 for (i = 0; i < task[0].argc; i++) { 114 fprintf (stderr, "%s ", task[0].argv[i]);115 } 116 fprintf (stderr, "\n\n");114 gprint (GP_LOG, "%s ", task[0].argv[i]); 115 } 116 gprint (GP_LOG, "\n\n"); 117 117 118 118 if (task[0].host == NULL) { 119 fprintf (stderr, " task runs locally\n");119 gprint (GP_LOG, " task runs locally\n"); 120 120 goto periods; 121 121 } 122 122 if (!strcasecmp(task[0].host, "ANYHOST")) { 123 fprintf (stderr, " task host selected by controller\n");123 gprint (GP_LOG, " task host selected by controller\n"); 124 124 goto periods; 125 125 } 126 126 if (task[0].host_required) { 127 fprintf (stderr, " host %s (required)\n", task[0].host);127 gprint (GP_LOG, " host %s (required)\n", task[0].host); 128 128 } else { 129 fprintf (stderr, " host %s (desired)\n", task[0].host);129 gprint (GP_LOG, " host %s (desired)\n", task[0].host); 130 130 } 131 131 132 132 periods: 133 fprintf (stderr, " time periods: exec: %f poll: %f timeout: %f\n",133 gprint (GP_LOG, " time periods: exec: %f poll: %f timeout: %f\n", 134 134 task[0].exec_period, task[0].poll_period, task[0].timeout_period); 135 135 136 fprintf (stderr, "\n pre-execute macro\n");136 gprint (GP_LOG, "\n pre-execute macro\n"); 137 137 ListMacro (task[0].exec); 138 138 139 fprintf (stderr, "\n timeout macro\n");139 gprint (GP_LOG, "\n timeout macro\n"); 140 140 ListMacro (task[0].timeout); 141 141 142 fprintf (stderr, "\n crash macro\n");142 gprint (GP_LOG, "\n crash macro\n"); 143 143 ListMacro (task[0].crash); 144 144 145 fprintf (stderr, "\n default exit macro\n");145 gprint (GP_LOG, "\n default exit macro\n"); 146 146 ListMacro (task[0].defexit); 147 147 148 148 for (i = 0; i < task[0].Nexit; i++) { 149 fprintf (stderr, "\n exit macro (status == %d)\n", atoi(task[0].exit[i][0].name));149 gprint (GP_LOG, "\n exit macro (status == %d)\n", atoi(task[0].exit[i][0].name)); 150 150 ListMacro (task[0].exit[i]); 151 151 } … … 252 252 } 253 253 if (Nt == -1) { 254 fprintf (stderr, "programming error: task not found\n");254 gprint (GP_ERR, "programming error: task not found\n"); 255 255 return (FALSE); 256 256 } … … 269 269 if (task[0].argc != 0) { 270 270 if (task[0].argv == NULL) { 271 fprintf (stderr, "task command arguments not defined (programming error)\n");271 gprint (GP_ERR, "task command arguments not defined (programming error)\n"); 272 272 return (FALSE); 273 273 } … … 275 275 } 276 276 if (RequireStatic) { 277 fprintf (stderr, "task command not defined\n");277 gprint (GP_ERR, "task command not defined\n"); 278 278 return (FALSE); 279 279 } … … 286 286 } 287 287 } 288 fprintf (stderr, "task command not defined\n");288 gprint (GP_ERR, "task command not defined\n"); 289 289 return (FALSE); 290 290 } -
trunk/Ohana/src/opihi/pantasks/client_shell.c
r7892 r7917 19 19 /* connect to the server */ 20 20 if (VarConfig ("PANTASKS_SERVER", "%s", hostname) == NULL) { 21 fprintf (stderr, "pantasks server host undefined\n");21 gprint (GP_ERR, "pantasks server host undefined\n"); 22 22 exit (2); 23 23 } … … 38 38 ppid = getppid(); 39 39 if (ppid == 1) { 40 fprintf (stderr, "caught parent shutdown\n");40 gprint (GP_ERR, "caught parent shutdown\n"); 41 41 exit (2); 42 42 } 43 43 if (!isatty (STDIN_FILENO)) exit (2); 44 fprintf (stdout, "Use \"quit\" to exit\n");44 gprint (GP_ERR, "Use \"quit\" to exit\n"); 45 45 Nbad ++; 46 46 continue; … … 57 57 status = command (line, &outline); 58 58 if (outline == NULL) { 59 fprintf (stderr, "programming error: command_client returned NULL\n");59 gprint (GP_ERR, "programming error: command_client returned NULL\n"); 60 60 exit (2); 61 61 } … … 63 63 /* command was not caught by client, send to server */ 64 64 if (*outline && !status ) { 65 fprintf (stderr, "sending message to %d: %s\n", server, outline);65 gprint (GP_ERR, "sending message to %d: %s\n", server, outline); 66 66 SendMessage (server, outline); 67 67 add_history (outline); … … 69 69 70 70 // XXX add this in and print to stdout 71 // status = ExpectMessage (server, 2.0, &message); 71 status = ExpectMessage (server, 2.0, &message); 72 gprint (GP_ERR, "got message: %d bytes\n", message.Nbuffer); 73 gwrite (message.buffer, 1, message.Nbuffer, GP_ERR); 74 gprint (GP_ERR, "end message\n"); 72 75 } 73 76 free (outline); -
trunk/Ohana/src/opihi/pantasks/controller.c
r6687 r7917 23 23 24 24 if (argc < 2) { 25 fprintf (stderr, "USAGE: controller (command) ... \n");25 gprint (GP_ERR, "USAGE: controller (command) ... \n"); 26 26 return (FALSE); 27 27 } … … 29 29 func = FindControllerCommand (argv[1]); 30 30 if (func == NULL) { 31 fprintf (stderr, "invalid controller command\n");31 gprint (GP_ERR, "invalid controller command\n"); 32 32 return (FALSE); 33 33 } -
trunk/Ohana/src/opihi/pantasks/controller_check.c
r6687 r7917 14 14 status = CheckControllerStatus (); 15 15 if (!status) { 16 fprintf (stderr, "controller is not running\n");16 gprint (GP_LOG, "controller is not running\n"); 17 17 return (TRUE); 18 18 } … … 22 22 status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer); 23 23 if (VerboseMode()) { 24 fprintf (stderr, "controller command sent\n");25 fwrite (buffer.buffer, 1, buffer.Nbuffer, stderr);26 fprintf (stderr, "\n Nbytes received: %d\n", buffer.Nbuffer);24 gprint (GP_LOG, "controller command sent\n"); 25 gwrite (buffer.buffer, 1, buffer.Nbuffer, GP_LOG); 26 gprint (GP_LOG, "\n Nbytes received: %d\n", buffer.Nbuffer); 27 27 } 28 28 FreeIOBuffer (&buffer); … … 30 30 31 31 usage: 32 fprintf (stderr, "USAGE: controller check job (jobID)\n");33 fprintf (stderr, "USAGE: controller check host (hostID)\n");32 gprint (GP_ERR, "USAGE: controller check job (jobID)\n"); 33 gprint (GP_ERR, "USAGE: controller check host (hostID)\n"); 34 34 return (FALSE); 35 35 } -
trunk/Ohana/src/opihi/pantasks/controller_exit.c
r6687 r7917 4 4 5 5 if (argc != 2) { 6 fprintf (stderr, "USAGE: controller exit TRUE\n");6 gprint (GP_ERR, "USAGE: controller exit TRUE\n"); 7 7 return (FALSE); 8 8 } -
trunk/Ohana/src/opihi/pantasks/controller_host.c
r6687 r7917 8 8 9 9 if (argc != 3) { 10 fprintf (stderr, "USAGE: controller host (command) (hostname)\n");10 gprint (GP_ERR, "USAGE: controller host (command) (hostname)\n"); 11 11 return (FALSE); 12 12 } … … 18 18 InitIOBuffer (&buffer, 0x100); 19 19 status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer); 20 if (status) fwrite (buffer.buffer, 1, buffer.Nbuffer, stderr);20 if (status) gwrite (buffer.buffer, 1, buffer.Nbuffer, GP_LOG); 21 21 FreeIOBuffer (&buffer); 22 22 return (TRUE); -
trunk/Ohana/src/opihi/pantasks/controller_output.c
r6687 r7917 4 4 5 5 if (argc != 1) { 6 fprintf (stderr, "USAGE: controller status\n");6 gprint (GP_ERR, "USAGE: controller status\n"); 7 7 return (FALSE); 8 8 } -
trunk/Ohana/src/opihi/pantasks/controller_pulse.c
r6687 r7917 8 8 9 9 if (argc != 2) { 10 fprintf (stderr, "USAGE: controller pulse (usec)\n");10 gprint (GP_ERR, "USAGE: controller pulse (usec)\n"); 11 11 return (FALSE); 12 12 } … … 18 18 InitIOBuffer (&buffer, 0x100); 19 19 status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer); 20 if (status) fwrite (buffer.buffer, 1, buffer.Nbuffer, stderr);20 if (status) gwrite (buffer.buffer, 1, buffer.Nbuffer, GP_LOG); 21 21 FreeIOBuffer (&buffer); 22 22 return (TRUE); -
trunk/Ohana/src/opihi/pantasks/controller_status.c
r6687 r7917 8 8 9 9 if (argc != 1) { 10 fprintf (stderr, "USAGE: controller status\n");10 gprint (GP_ERR, "USAGE: controller status\n"); 11 11 return (FALSE); 12 12 } … … 15 15 status = CheckControllerStatus (); 16 16 if (!status) { 17 fprintf (stderr, "controller is not running\n");17 gprint (GP_LOG, "controller is not running\n"); 18 18 return (TRUE); 19 19 } … … 23 23 status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer); 24 24 if (status) { 25 fwrite (buffer.buffer, 1, buffer.Nbuffer, stderr);25 gwrite (buffer.buffer, 1, buffer.Nbuffer, GP_LOG); 26 26 } else { 27 fprintf (stderr, "controller is down\n");27 gprint (GP_LOG, "controller is down\n"); 28 28 } 29 29 FreeIOBuffer (&buffer); -
trunk/Ohana/src/opihi/pantasks/delete.c
r6687 r7917 6 6 7 7 if (argc < 2) { 8 fprintf (stderr, "USAGE: delete (JobID)\n");8 gprint (GP_ERR, "USAGE: delete (JobID)\n"); 9 9 return (FALSE); 10 10 } … … 12 12 /* use a string interp to convert JobIDs to ints ? */ 13 13 14 fprintf (stderr, "this function is not yet implemented\n");14 gprint (GP_ERR, "this function is not yet implemented\n"); 15 15 return (TRUE); 16 16 } -
trunk/Ohana/src/opihi/pantasks/invalid.c
r7892 r7917 3 3 int invalid (int argc, char **argv) { 4 4 5 fprintf (stderr, "%s is not valid for the pantasks client\n", argv[0]);5 gprint (GP_ERR, "%s is not valid for the pantasks client\n", argv[0]); 6 6 return (TRUE); 7 7 -
trunk/Ohana/src/opihi/pantasks/job.c
r6687 r7917 33 33 if ((N = get_argument (argc, argv, "+host"))) { 34 34 if (Mode == PCONTROL_JOB_WANTHOST) { 35 fprintf (stderr, "ERROR: -host and +host are incompatible\n");35 gprint (GP_ERR, "ERROR: -host and +host are incompatible\n"); 36 36 FREE (Host); 37 37 return (FALSE); … … 52 52 53 53 if (argc < 2) { 54 fprintf (stderr, "USAGE: job [options] (arg0) (arg1) ... (argN)\n");54 gprint (GP_ERR, "USAGE: job [options] (arg0) (arg1) ... (argN)\n"); 55 55 FREE (Host); 56 56 return (FALSE); … … 64 64 65 65 JobID = AddJob (Host, Mode, Timeout, targc, targv); 66 fprintf (stdout, "JobID: %d\n", JobID);66 gprint (GP_LOG, "JobID: %d\n", JobID); 67 67 return (TRUE); 68 68 } -
trunk/Ohana/src/opihi/pantasks/kill.c
r6687 r7917 7 7 8 8 if (argc < 2) { 9 fprintf (stderr, "USAGE: kill (JobID)\n");9 gprint (GP_ERR, "USAGE: kill (JobID)\n"); 10 10 return (FALSE); 11 11 } … … 17 17 if (!KillLocalJob (job)) { 18 18 job[0].state = JOB_HUNG; 19 if (VerboseMode()) fprintf (stderr, "child process %d is hung, cannot kill\n", job[0].pid);19 if (VerboseMode()) gprint (GP_LOG, "child process %d is hung, cannot kill\n", job[0].pid); 20 20 return (FALSE); 21 21 } … … 23 23 if (!KillControllerJob (job)) { 24 24 job[0].state = JOB_HUNG; 25 if (VerboseMode()) fprintf (stderr, "child process %d is hung, cannot kill\n", job[0].pid);25 if (VerboseMode()) gprint (GP_LOG, "child process %d is hung, cannot kill\n", job[0].pid); 26 26 return (FALSE); 27 27 } 28 28 } 29 29 30 fprintf (stderr, "this function is not yet implemented\n");30 gprint (GP_ERR, "this function is not yet implemented\n"); 31 31 return (TRUE); 32 32 } -
trunk/Ohana/src/opihi/pantasks/pantasks.c
r6687 r7917 38 38 /* standard welcome message */ 39 39 void welcome () { 40 fprintf (stderr, "\n");41 fprintf (stderr, "Welcome to %s - %s\n\n", opihi_name, opihi_description);40 gprint (GP_LOG, "\n"); 41 gprint (GP_LOG, "Welcome to %s - %s\n\n", opihi_name, opihi_description); 42 42 } 43 43 … … 51 51 52 52 void gotsignal (int signum) { 53 fprintf (stderr, "got signal : %d\n", signum);53 gprint (GP_ERR, "got signal : %d\n", signum); 54 54 return; 55 55 } -
trunk/Ohana/src/opihi/pantasks/pantasks_client.c
r7892 r7917 38 38 /* standard welcome message */ 39 39 void welcome () { 40 fprintf (stderr, "\n");41 fprintf (stderr, "Welcome to %s - %s\n\n", opihi_name, opihi_description);40 gprint (GP_LOG, "\n"); 41 gprint (GP_LOG, "Welcome to %s - %s\n\n", opihi_name, opihi_description); 42 42 } 43 43 … … 54 54 /* default signal handling */ 55 55 void gotsignal (int signum) { 56 fprintf (stderr, "got signal : %d\n", signum);56 gprint (GP_ERR, "got signal : %d\n", signum); 57 57 return; 58 58 } -
trunk/Ohana/src/opihi/pantasks/pantasks_server.c
r7892 r7917 30 30 InitData (); 31 31 InitPantasks (); 32 33 InitPrint (); 32 34 33 35 // signal (SIGPIPE, gotsignal); … … 77 79 78 80 void gotsignal (int signum) { 79 fprintf (stderr, "got signal : %d\n", signum);81 gprint (GP_ERR, "got signal : %d\n", signum); 80 82 return; 81 83 } -
trunk/Ohana/src/opihi/pantasks/pulse.c
r6687 r7917 6 6 7 7 if (argc != 2) { 8 fprintf (stderr, "USAGE: pulse (microseconds)\n");8 gprint (GP_ERR, "USAGE: pulse (microseconds)\n"); 9 9 return (FALSE); 10 10 } -
trunk/Ohana/src/opihi/pantasks/run.c
r6687 r7917 4 4 5 5 if (argc != 1) { 6 fprintf (stderr, "USAGE: run\n");6 gprint (GP_ERR, "USAGE: run\n"); 7 7 return (FALSE); 8 8 } -
trunk/Ohana/src/opihi/pantasks/scheduler.c
r4689 r7917 52 52 f = fopen (opihi_history, "a"); 53 53 if (f == NULL) /* no current history file here */ 54 fprintf (stderr, "can't save history.\n");54 gprint (GP_ERR, "can't save history.\n"); 55 55 else 56 56 fclose (f); … … 65 65 /* standard welcome message */ 66 66 void welcome () { 67 fprintf (stderr, "\n");68 fprintf (stderr, "Welcome to %s - %s\n\n", opihi_name, opihi_description);67 gprint (GP_LOG, "\n"); 68 gprint (GP_LOG, "Welcome to %s - %s\n\n", opihi_name, opihi_description); 69 69 } 70 70 -
trunk/Ohana/src/opihi/pantasks/status.c
r6687 r7917 3 3 int status_sys (int argc, char **argv) { 4 4 5 fprintf (stderr, "\n");5 gprint (GP_LOG, "\n"); 6 6 if (rl_event_hook == NULL) { 7 fprintf (stderr, " Scheduler is stopped\n");7 gprint (GP_LOG, " Scheduler is stopped\n"); 8 8 } else { 9 fprintf (stderr, " Scheduler is running\n");9 gprint (GP_LOG, " Scheduler is running\n"); 10 10 } 11 11 if (CheckControllerStatus ()) { 12 fprintf (stderr, " Controller is running\n");12 gprint (GP_LOG, " Controller is running\n"); 13 13 } else { 14 fprintf (stderr, " Controller is stopped\n");14 gprint (GP_LOG, " Controller is stopped\n"); 15 15 } 16 16 ListTasks (FALSE); -
trunk/Ohana/src/opihi/pantasks/stop.c
r6687 r7917 4 4 5 5 if (argc != 1) { 6 fprintf (stderr, "USAGE: stop\n");6 gprint (GP_ERR, "USAGE: stop\n"); 7 7 return (FALSE); 8 8 } -
trunk/Ohana/src/opihi/pantasks/task.c
r6687 r7917 28 28 29 29 if (argc != 2) { 30 fprintf (stderr, "USAGE: task <name>\n");31 fprintf (stderr, " (enter commands & task functions; end with the word 'END')\n");30 gprint (GP_ERR, "USAGE: task <name>\n"); 31 gprint (GP_ERR, " (enter commands & task functions; end with the word 'END')\n"); 32 32 return (FALSE); 33 33 } … … 58 58 59 59 if ((ThisList == 0) && (input == (char *) NULL)) { 60 fprintf (stderr, "end task with 'END'\n");60 gprint (GP_ERR, "end task with 'END'\n"); 61 61 continue; 62 62 } 63 63 if ((ThisList > 0) && (input == (char *) NULL)) { 64 fprintf (stderr, "missing 'END' in task definition\n");64 gprint (GP_ERR, "missing 'END' in task definition\n"); 65 65 input = strcreate ("end"); 66 66 } … … 103 103 104 104 case TASK_NONE: 105 fprintf (stderr, "unknown task command %s\n", input);105 gprint (GP_ERR, "unknown task command %s\n", input); 106 106 break; 107 107 } -
trunk/Ohana/src/opihi/pantasks/task_command.c
r6687 r7917 7 7 8 8 if (argc < 2) { 9 fprintf (stderr, "USAGE: command <command> <arg>. ..\n");10 fprintf (stderr, " (define command for this task)\n");9 gprint (GP_ERR, "USAGE: command <command> <arg>. ..\n"); 10 gprint (GP_ERR, " (define command for this task)\n"); 11 11 return (FALSE); 12 12 } … … 16 16 task = GetActiveTask (); 17 17 if (task == NULL) { 18 fprintf (stderr, "ERROR: not defining or running a task\n");18 gprint (GP_ERR, "ERROR: not defining or running a task\n"); 19 19 return (FALSE); 20 20 } -
trunk/Ohana/src/opihi/pantasks/task_host.c
r6687 r7917 13 13 14 14 if (argc != 2) { 15 fprintf (stderr, "USAGE: host <name> [-required]\n");16 fprintf (stderr, " define host machine for this task\n");17 fprintf (stderr, " -required flags indicates controller must use this host\n");18 fprintf (stderr, " value of 'local' for host indicates process not using controller\n");19 fprintf (stderr, " value of 'anyhost' for host indicates controller may assign at will\n");15 gprint (GP_ERR, "USAGE: host <name> [-required]\n"); 16 gprint (GP_ERR, " define host machine for this task\n"); 17 gprint (GP_ERR, " -required flags indicates controller must use this host\n"); 18 gprint (GP_ERR, " value of 'local' for host indicates process not using controller\n"); 19 gprint (GP_ERR, " value of 'anyhost' for host indicates controller may assign at will\n"); 20 20 return (FALSE); 21 21 } … … 25 25 task = GetActiveTask (); 26 26 if (task == NULL) { 27 fprintf (stderr, "ERROR: not defining or running a task\n");27 gprint (GP_ERR, "ERROR: not defining or running a task\n"); 28 28 return (FALSE); 29 29 } -
trunk/Ohana/src/opihi/pantasks/task_macros.c
r6687 r7917 11 11 12 12 if (!strcmp (argv[0], "task.exec") && (argc != 1)) { 13 fprintf (stderr, "USAGE: task.exec\n");14 fprintf (stderr, " (define pre-exec macro for this task)\n");13 gprint (GP_ERR, "USAGE: task.exec\n"); 14 gprint (GP_ERR, " (define pre-exec macro for this task)\n"); 15 15 return (FALSE); 16 16 } 17 17 18 18 if (!strcmp (argv[0], "task.exit") && (argc != 2)) { 19 fprintf (stderr, "USAGE: task.exit (state)\n");20 fprintf (stderr, " (define exit state macro for this task)\n");19 gprint (GP_ERR, "USAGE: task.exit (state)\n"); 20 gprint (GP_ERR, " (define exit state macro for this task)\n"); 21 21 return (FALSE); 22 22 } … … 24 24 task = GetNewTask (); 25 25 if (task == NULL) { 26 fprintf (stderr, "ERROR: not defining or running a task\n");26 gprint (GP_ERR, "ERROR: not defining or running a task\n"); 27 27 return (FALSE); 28 28 } … … 115 115 116 116 if ((ThisList == 0) && (input == (char *) NULL)) { 117 fprintf (stderr, "end macro with 'END'\n");117 gprint (GP_ERR, "end macro with 'END'\n"); 118 118 continue; 119 119 } 120 120 if ((ThisList > 0) && (input == (char *) NULL)) { 121 fprintf (stderr, "missing 'END' in macro definition\n");121 gprint (GP_ERR, "missing 'END' in macro definition\n"); 122 122 input = strcreate ("end"); 123 123 } -
trunk/Ohana/src/opihi/pantasks/task_nmax.c
r6687 r7917 9 9 task = GetNewTask (); 10 10 if (task == NULL) { 11 fprintf (stderr, "ERROR: not defining or running a task\n");11 gprint (GP_ERR, "ERROR: not defining or running a task\n"); 12 12 return (FALSE); 13 13 } … … 17 17 18 18 usage: 19 fprintf (stderr, "USAGE: nmax N\n");19 gprint (GP_ERR, "USAGE: nmax N\n"); 20 20 return (FALSE); 21 21 } -
trunk/Ohana/src/opihi/pantasks/task_periods.c
r6687 r7917 35 35 36 36 if (argc != 1) { 37 fprintf (stderr, "USAGE: periods [-poll value] [-exec value] [-timeout value]\n");38 fprintf (stderr, " define time periods for this task\n");37 gprint (GP_ERR, "USAGE: periods [-poll value] [-exec value] [-timeout value]\n"); 38 gprint (GP_ERR, " define time periods for this task\n"); 39 39 return (FALSE); 40 40 } … … 44 44 task = GetActiveTask (); 45 45 if (task == NULL) { 46 fprintf (stderr, "ERROR: not defining or running a task\n");46 gprint (GP_ERR, "ERROR: not defining or running a task\n"); 47 47 return (FALSE); 48 48 } -
trunk/Ohana/src/opihi/pantasks/task_trange.c
r6687 r7917 25 25 task = GetNewTask (); 26 26 if (task == NULL) { 27 fprintf (stderr, "ERROR: not defining or running a task\n");27 gprint (GP_ERR, "ERROR: not defining or running a task\n"); 28 28 return (FALSE); 29 29 } … … 61 61 62 62 usage: 63 fprintf (stderr, "USAGE: trange start end\n");63 gprint (GP_ERR, "USAGE: trange start end\n"); 64 64 return (FALSE); 65 65 } -
trunk/Ohana/src/opihi/pantasks/verbose.c
r6687 r7917 7 7 if (argc == 1) { 8 8 if (VERBOSE) { 9 fprintf (stderr, "verbose mode ON\n");9 gprint (GP_LOG, "verbose mode ON\n"); 10 10 } else { 11 fprintf (stderr, "verbose mode OFF\n");11 gprint (GP_LOG, "verbose mode OFF\n"); 12 12 } 13 13 return (TRUE); … … 29 29 } 30 30 31 fprintf (stderr, "USAGE: verbose (on/off/toggle)\n");31 gprint (GP_ERR, "USAGE: verbose (on/off/toggle)\n"); 32 32 return (FALSE); 33 33 } -
trunk/Ohana/src/opihi/pantasks/version.c
r7080 r7917 4 4 int version (int argc, char **argv) { 5 5 6 fprintf (stderr, "%s\n", name);6 gprint (GP_LOG, "%s\n", name); 7 7 8 fprintf (stderr, "%s\n", opihi_version());9 fprintf (stderr, "%s\n", ohana_version());10 fprintf (stderr, "%s\n", gfits_version());8 gprint (GP_LOG, "%s\n", opihi_version()); 9 gprint (GP_LOG, "%s\n", ohana_version()); 10 gprint (GP_LOG, "%s\n", gfits_version()); 11 11 12 fprintf (stderr, "compiled on %s %s\n", __DATE__, __TIME__);12 gprint (GP_LOG, "compiled on %s %s\n", __DATE__, __TIME__); 13 13 return (TRUE); 14 14 }
Note:
See TracChangeset
for help on using the changeset viewer.
