Changeset 4714
- Timestamp:
- Aug 5, 2005, 9:53:49 AM (21 years ago)
- Location:
- trunk/Ohana/src/opihi
- Files:
-
- 24 edited
-
cmd.basic/init.c (modified) (1 diff)
-
cmd.data/init.c (modified) (1 diff)
-
dimm/dimm.c (modified) (1 diff)
-
dvo/dvo.c (modified) (1 diff)
-
dvo2/dvo2.c (modified) (4 diffs)
-
include/psched.h (modified) (2 diffs)
-
include/shell.h (modified) (1 diff)
-
lib.shell/ListOps.c (modified) (1 diff)
-
mana/mana.c (modified) (1 diff)
-
pantasks/CheckController.c (modified) (5 diffs)
-
pantasks/CheckSystem.c (modified) (1 diff)
-
pantasks/ControllerOps.c (modified) (3 diffs)
-
pantasks/JobOps.c (modified) (4 diffs)
-
pantasks/LocalJob.c (modified) (1 diff)
-
pantasks/controller_host.c (modified) (1 diff)
-
pantasks/init.c (modified) (1 diff)
-
pantasks/psched.c (modified) (1 diff)
-
pclient/pclient.c (modified) (1 diff)
-
pcontrol/Makefile (modified) (1 diff)
-
pcontrol/init.c (modified) (2 diffs)
-
pcontrol/jobstack.c (modified) (2 diffs)
-
pcontrol/pcontrol.c (modified) (1 diff)
-
scripts/psched.pro (modified) (2 diffs)
-
scripts/sched.pro (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.basic/init.c
r4689 r4714 76 76 int i; 77 77 78 InitCommands (); 79 InitMacros (); 80 InitBuffers (); 81 InitVectors (); 82 InitVariables (); 83 InitLists (); 84 InitOutfile (); 85 78 86 for (i = 0; i < sizeof (cmds) / sizeof (Command); i++) { 79 87 AddCommand (&cmds[i]); 80 88 } 81 89 82 90 } -
trunk/Ohana/src/opihi/cmd.data/init.c
r4703 r4714 215 215 int i; 216 216 217 InitGraph (); 218 InitImage (); 219 InitQueues (); 220 217 221 for (i = 0; i < sizeof (cmds) / sizeof (Command); i++) { 218 222 AddCommand (&cmds[i]); -
trunk/Ohana/src/opihi/dimm/dimm.c
r4689 r4714 12 12 auto_break = TRUE; 13 13 14 Nlists = 0;15 ALLOCATE (lists, List, 1);16 17 /* init functions required by libraries */18 /* -libopihi */19 InitCommands ();20 InitMacros ();21 InitBuffers ();22 InitVectors ();23 InitVariables ();24 25 /* -libdisplay */26 InitGraph ();27 InitImage ();28 29 14 /* load the commands used by this implementation */ 30 15 InitBasic (); 31 16 InitData (); 32 InitOutfile ();33 17 InitAstro (); 34 18 InitDIMM (); -
trunk/Ohana/src/opihi/dvo/dvo.c
r4689 r4714 12 12 auto_break = TRUE; 13 13 14 Nlists = 0;15 ALLOCATE (lists, List, 1);16 17 /* init functions required by libraries */18 /* -libopihi */19 InitCommands ();20 InitMacros ();21 InitBuffers ();22 InitVectors ();23 InitVariables ();24 25 /* -libdisplay */26 InitGraph ();27 InitImage ();28 29 14 /* load the commands used by this implementation */ 30 15 InitBasic (); 31 16 InitData (); 32 InitOutfile ();33 17 InitAstro (); 34 18 InitDVO (); -
trunk/Ohana/src/opihi/dvo2/dvo2.c
r2598 r4714 7 7 # define opihi_rcfile ".dvorc" 8 8 9 void InitBasic ();10 void InitData ();11 void InitAstro ();12 void InitDVO2 ();13 14 void welcome () {15 fprintf (stderr, "\n");16 fprintf (stderr, "Welcome to %s - %s\n\n", opihi_name, opihi_description);17 }18 19 9 /* program-dependent initialization */ 20 10 void initialize (int argc, char **argv) { 21 11 22 FILE *f;23 24 12 auto_break = TRUE; 25 26 Nlists = 0;27 ALLOCATE (lists, List, 1);28 29 /* init functions required by libraries */30 /* -libopihi */31 InitCommands ();32 InitMacros ();33 InitBuffers ();34 InitVectors ();35 InitVariables ();36 37 /* -libdisplay */38 InitGraph ();39 InitImage ();40 13 41 14 /* load the commands used by this implementation */ … … 44 17 InitAstro (); 45 18 InitDVO2 (); 46 InitOutfile ();47 19 48 20 rl_readline_name = opihi_name; … … 52 24 set_str_variable ("PROMPT", opihi_prompt); 53 25 set_str_variable ("RCFILE", opihi_rcfile); 26 # ifdef HELPDIR_DEFAULT 27 set_str_variable ("HELPDIR", MACRO_NAME(HELPDIR_DEFAULT)); 28 # endif 54 29 55 /* here we open the history file for append. it this fails, we 56 won't be able to write to it, warn the user. otherwise, this 57 creates the file readline will write to, if it did not exist */ 58 59 /* check history file */ 60 /* rewrite with fstat or stat */ 61 f = fopen (opihi_history, "a"); 62 if (f == NULL) /* no current history file here */ 63 fprintf (stderr, "can't save history.\n"); 64 else 65 fclose (f); 66 67 stifle_history (200); 68 read_history (opihi_history); 30 { /* check history file permission */ 31 FILE *f; 32 f = fopen (opihi_history, "a"); 33 if (f == NULL) /* no current history file here */ 34 fprintf (stderr, "can't save history.\n"); 35 else 36 fclose (f); 37 stifle_history (200); 38 read_history (opihi_history); 39 } 69 40 70 41 signal (SIGINT, SIG_IGN); … … 72 43 } 73 44 45 /* standard welcome message */ 46 void welcome () { 47 fprintf (stderr, "\n"); 48 fprintf (stderr, "Welcome to %s - %s\n\n", opihi_name, opihi_description); 49 } 50 74 51 /* add program-dependent exit functions here */ 75 52 void cleanup () { 76 /* -libdisplay 53 /* -libdisplay */ 77 54 QuitImage (); 78 QuitGraph (); */55 QuitGraph (); 79 56 return; 80 57 } -
trunk/Ohana/src/opihi/include/psched.h
r4705 r4714 151 151 int CheckTasks (); 152 152 int CheckSystem (); 153 int CheckController (); 153 154 int CheckTimeRanges (TimeRange *ranges, int Nranges); 154 155 int GetJobOutput (char *channel, int pid, IOBuffer *buffer, int Nbytes); … … 156 157 int CheckControllerJobStatus (Job *job); 157 158 int SubmitControllerJob (Job *job); 159 int DeleteControllerJob (Job *job); 160 Job *FindControllerJob (int JobID); 158 161 int StartController (); 159 162 int ControllerCommand (char *command, char *response, IOBuffer *buffer); -
trunk/Ohana/src/opihi/include/shell.h
r4704 r4714 59 59 int is_loop PROTO((char *line)); 60 60 int is_macro_create PROTO((char *line)); 61 void InitLists PROTO(()); 61 62 62 63 void InitCommands PROTO(()); -
trunk/Ohana/src/opihi/lib.shell/ListOps.c
r3922 r4714 1 1 # include "opihi.h" 2 2 # include "macro.h" 3 4 void InitLists () { 5 Nlists = 0; 6 ALLOCATE (lists, List, 1); 7 return; 8 } 3 9 4 10 /* return a new string consisting of the next line in the current list */ -
trunk/Ohana/src/opihi/mana/mana.c
r4689 r4714 12 12 auto_break = TRUE; 13 13 14 Nlists = 0;15 ALLOCATE (lists, List, 1);16 17 /* init functions required by libraries */18 /* -libopihi */19 InitCommands ();20 InitMacros ();21 InitBuffers ();22 InitVectors ();23 InitVariables ();24 25 /* -libdisplay */26 InitGraph ();27 InitImage ();28 29 14 /* load the commands used by this implementation */ 30 15 InitBasic (); 31 16 InitData (); 32 InitOutfile ();33 17 InitAstro (); 34 18 InitMana (); -
trunk/Ohana/src/opihi/pantasks/CheckController.c
r4706 r4714 7 7 Job *job; 8 8 IOBuffer buffer; 9 10 9 11 10 /* get the list of completed jobs (exit / crash), update the job status */ 12 13 11 if (!CheckControllerStatus()) return (TRUE); 14 12 … … 21 19 } 22 20 21 p = memstr (buffer.buffer, "USAGE: jobstack", buffer.Nbuffer); 22 if (p != NULL) { 23 FreeIOBuffer (&buffer); 24 return (FALSE); 25 } 26 23 27 /** parse job list **/ 24 sscanf (buffer.buffer, "%*s %s", &Njobs); 28 status = sscanf (buffer.buffer, "%*s %d", &Njobs); 29 if (status != 1) { 30 FreeIOBuffer (&buffer); 31 return (FALSE); 32 } 33 25 34 p = buffer.buffer; 26 27 35 for (i = 0; i < Njobs; i++) { 28 36 q = strchr (p, '\n'); 29 37 if (q == NULL) { 30 38 fprintf (stderr, "controller message error: incomplete job list\n"); 31 FreeIOBuffer (&buffer);32 39 break; 33 40 } 34 p = q++; 35 sscanf (p, "%d", &JobID); 36 job = FindJob (JobID); 41 p = q + 1; 42 status = sscanf (p, "%d", &JobID); 43 44 job = FindControllerJob (JobID); 37 45 if (job == NULL) { 38 fprintf (stderr, "misplaced job? %d not in job list\n");46 fprintf (stderr, "misplaced job? %d not in EXIT job list\n", JobID); 39 47 continue; 40 48 } … … 42 50 CheckControllerJob (job); 43 51 } 44 52 45 53 /*** check CRASH jobs ***/ 46 InitIOBuffer (&buffer, 0x100);54 FlushIOBuffer (&buffer); 47 55 status = ControllerCommand ("jobstack crash", CONTROLLER_PROMPT, &buffer); 48 56 if (!status) { … … 50 58 return (FALSE); 51 59 } 60 p = memstr (buffer.buffer, "USAGE: jobstack", buffer.Nbuffer); 61 if (p != NULL) { 62 FreeIOBuffer (&buffer); 63 return (FALSE); 64 } 52 65 53 66 /** parse job list **/ 54 sscanf (buffer.buffer, "%*s %s", &Njobs); 67 status = sscanf (buffer.buffer, "%*s %d", &Njobs); 68 if (status != 1) { 69 FreeIOBuffer (&buffer); 70 return (FALSE); 71 } 72 55 73 p = buffer.buffer; 56 57 74 for (i = 0; i < Njobs; i++) { 58 75 q = strchr (p, '\n'); 59 76 if (q == NULL) { 60 77 fprintf (stderr, "controller message error: incomplete job list\n"); 61 FreeIOBuffer (&buffer);62 78 break; 63 79 } 64 p = q++; 65 sscanf (p, "%d", &JobID); 66 job = FindJob (JobID); 80 p = q + 1; 81 82 status = sscanf (p, "%d", &JobID); 83 job = FindControllerJob (JobID); 67 84 if (job == NULL) { 68 fprintf (stderr, "misplaced job? %d not in job list\n");85 fprintf (stderr, "misplaced job? %d not in CRASH job list\n", JobID); 69 86 continue; 70 87 } … … 72 89 CheckControllerJob (job); 73 90 } 91 FreeIOBuffer (&buffer); 74 92 return (TRUE); 75 93 } -
trunk/Ohana/src/opihi/pantasks/CheckSystem.c
r4706 r4714 8 8 eventually 9 9 */ 10 struct timeval start, stop; 11 double dtime; 12 13 gettimeofday (&start, (void *) NULL); 14 CheckTasks (); 15 gettimeofday (&stop, (void *) NULL); 16 dtime = DTIME (stop, start); 17 if (VerboseMode()) fprintf (stderr, "check 1: %f seconds\n", dtime); 10 18 11 CheckTasks ();19 gettimeofday (&start, (void *) NULL); 12 20 CheckJobs (); 21 gettimeofday (&stop, (void *) NULL); 22 dtime = DTIME (stop, start); 23 if (VerboseMode()) fprintf (stderr, "check 2: %f seconds\n", dtime); 24 25 gettimeofday (&start, (void *) NULL); 13 26 CheckController (); 27 gettimeofday (&stop, (void *) NULL); 28 dtime = DTIME (stop, start); 29 if (VerboseMode()) fprintf (stderr, "check 3: %f seconds\n", dtime); 30 31 gettimeofday (&start, (void *) NULL); 14 32 CheckControllerOutput (); 33 gettimeofday (&stop, (void *) NULL); 34 dtime = DTIME (stop, start); 35 if (VerboseMode()) fprintf (stderr, "check 4: %f seconds\n", dtime); 36 15 37 return (TRUE); 16 38 } -
trunk/Ohana/src/opihi/pantasks/ControllerOps.c
r4706 r4714 186 186 job[0].pid = atoi (string); 187 187 FreeIOBuffer (&buffer); 188 189 InitIOBuffer (&job[0].stdout, 0x100);190 InitIOBuffer (&job[0].stderr, 0x100);191 188 return (TRUE); 192 189 } … … 419 416 InitIOBuffer (&buffer, 0x100); 420 417 status = ControllerCommand (cmd, CONTROLLER_PROMPT, &buffer); 418 FreeIOBuffer (&buffer); 419 421 420 ControllerStatus = FALSE; 422 421 result = waitpid (ControllerPID, &waitstatus, WNOHANG); … … 429 428 close (stdout_cntl); 430 429 close (stderr_cntl); 431 432 return (TRUE); 433 } 430 FreeIOBuffer (&stdout_buffer); 431 FreeIOBuffer (&stderr_buffer); 432 433 return (TRUE); 434 } -
trunk/Ohana/src/opihi/pantasks/JobOps.c
r4706 r4714 39 39 for (i = 0; i < Njobs; i++) { 40 40 if (jobs[i][0].JobID == JobID) { 41 return (jobs[i]); 42 } 43 } 44 return (NULL); 45 } 46 47 /* return job with given controller Job ID */ 48 Job *FindControllerJob (int JobID) { 49 50 int i; 51 52 /* return job with matching JobID */ 53 for (i = 0; i < Njobs; i++) { 54 if (jobs[i][0].mode == JOB_LOCAL) continue; 55 if (jobs[i][0].pid == JobID) { 41 56 return (jobs[i]); 42 57 } … … 96 111 need to have matched entries to these quantites in the job structure */ 97 112 113 InitIOBuffer (&job[0].stdout, 0x100); 114 InitIOBuffer (&job[0].stderr, 0x100); 115 98 116 jobs[Njobs] = job; 99 117 Njobs ++; … … 117 135 } 118 136 free (job[0].argv); 137 138 FreeIOBuffer (&job[0].stdout); 139 FreeIOBuffer (&job[0].stderr); 140 free (job); 119 141 return; 120 142 } … … 161 183 gettimeofday (&job[0].start, (void *) NULL); 162 184 job[0].last = job[0].start; 163 185 job[0].state = JOB_PENDING; 164 186 return (TRUE); 165 187 } -
trunk/Ohana/src/opihi/pantasks/LocalJob.c
r4697 r4714 144 144 job[0].pid = pid; 145 145 146 InitIOBuffer (&job[0].stdout, 0x100);147 InitIOBuffer (&job[0].stderr, 0x100);148 146 return (TRUE); 149 147 -
trunk/Ohana/src/opihi/pantasks/controller_host.c
r4706 r4714 20 20 if (status) fwrite (buffer.buffer, 1, buffer.Nbuffer, stderr); 21 21 FreeIOBuffer (&buffer); 22 22 return (TRUE); 23 23 } -
trunk/Ohana/src/opihi/pantasks/init.c
r4705 r4714 53 53 int i; 54 54 55 InitTasks (); 56 InitJobs (); 57 InitJobIDs (); 58 55 59 for (i = 0; i < sizeof (cmds) / sizeof (Command); i++) { 56 60 AddCommand (&cmds[i]); -
trunk/Ohana/src/opihi/pantasks/psched.c
r4705 r4714 12 12 auto_break = TRUE; 13 13 14 Nlists = 0;15 ALLOCATE (lists, List, 1);16 17 /* init functions required by libraries */18 /* -libopihi */19 InitCommands ();20 InitMacros ();21 InitBuffers ();22 InitVectors ();23 InitVariables ();24 25 /* -libdisplay */26 InitGraph ();27 InitImage ();28 29 14 /* load the commands used by this implementation */ 30 15 InitBasic (); 31 16 InitData (); 32 InitOutfile ();33 17 InitPsched (); 34 InitTasks ();35 InitJobs ();36 InitJobIDs ();37 18 38 19 rl_readline_name = opihi_name; -
trunk/Ohana/src/opihi/pclient/pclient.c
r4691 r4714 12 12 auto_break = TRUE; 13 13 14 Nlists = 0;15 ALLOCATE (lists, List, 1);16 17 /* init functions required by libraries */18 /* -libshell */19 InitCommands ();20 InitMacros ();21 InitBuffers ();22 InitVectors ();23 InitVariables ();24 25 /* -libdata */26 InitGraph ();27 InitImage ();28 29 14 /* load the commands used by this implementation */ 30 15 InitBasic (); 31 InitOutfile ();32 16 InitPclient (); 33 17 InitChild (); -
trunk/Ohana/src/opihi/pcontrol/Makefile
r4706 r4714 54 54 $(SDIR)/jobstack.$(ARCH).o \ 55 55 $(SDIR)/kill.$(ARCH).o \ 56 $(SDIR)/pulse.$(ARCH).o \ 56 57 $(SDIR)/status.$(ARCH).o \ 57 58 $(SDIR)/stdout.$(ARCH).o \ -
trunk/Ohana/src/opihi/pcontrol/init.c
r4706 r4714 7 7 int jobstack PROTO((int, char **)); 8 8 int kill_pc PROTO((int, char **)); 9 int pulse PROTO((int, char **)); 9 10 int status PROTO((int, char **)); 10 11 int stderr_pc PROTO((int, char **)); … … 19 20 {"jobstack", jobstack, "list jobs for a single stack"}, 20 21 {"kill", kill_pc, "kill job"}, 22 {"pulse", pulse, "set system pulse"}, 21 23 {"status", status, "get system status"}, 22 24 {"stderr", stderr_pc, "get stderr buffer for job"}, -
trunk/Ohana/src/opihi/pcontrol/jobstack.c
r4706 r4714 6 6 Stack *stack; 7 7 Job *job; 8 Host *host;9 int JobID, HostID;10 8 11 if (argc != 3) {9 if (argc != 2) { 12 10 fprintf (stdout, "USAGE: jobstack (jobstack)\n"); 13 11 fprintf (stdout, " (jobstack) : pending, busy, exit, crash, hung, done\n"); … … 27 25 job = stack[0].object[i]; 28 26 /* PrintID (stdout, job[0].JobID); */ 29 fprintf (stdout, "% d ", job[0].JobID);27 fprintf (stdout, "%lld ", job[0].JobID); 30 28 fprintf (stdout, "%s %s\n", job[0].argv[0], job[0].hostname); 31 29 } -
trunk/Ohana/src/opihi/pcontrol/pcontrol.c
r4691 r4714 12 12 auto_break = TRUE; 13 13 14 Nlists = 0;15 ALLOCATE (lists, List, 1);16 17 /* init functions required by libraries */18 /* -libshell */19 InitCommands ();20 InitMacros ();21 InitBuffers ();22 InitVectors ();23 InitVariables ();24 25 /* -libdata */26 InitGraph ();27 InitImage ();28 29 14 /* load the commands used by this implementation */ 30 15 InitBasic (); 31 InitOutfile ();32 16 InitPcontrol (); 33 17 -
trunk/Ohana/src/opihi/scripts/psched.pro
r4705 r4714 7 7 task test 8 8 command partest 9 periods -poll 1.010 periods -exec 2.09 periods -poll 0.1 10 periods -exec 0.1 11 11 periods -timeout 10.0 12 nmax 1512 nmax 5 13 13 host anyhost 14 14 … … 16 16 task.exit 0 17 17 # echo "task exit 0" 18 queuesize stdout -var Nstdout 19 for i 0 $Nstdout 20 queuepop stdout -var line 21 queuepush results "$line" 22 end 18 queuedelete stdout 19 queuedelete stderr 20 memory leaks 21 # queuesize stdout -var Nstdout 22 # for i 0 $Nstdout 23 # queuepop stdout -var line 24 # queuepush results "$line" 25 # end 23 26 end 24 27 -
trunk/Ohana/src/opihi/scripts/sched.pro
r4697 r4714 1 2 # controller host alala3 1 4 2 task test … … 9 7 # trange 07:09 07:10 10 8 # trange -exclude 07:09:30 07:09:45 11 nmax 19 nmax 5 12 10 host local 13 11 # host localhost … … 20 18 # stdout / stderr lines on named queues 21 19 task.exit 0 22 echo "task exit 0" 23 queuesize stdout 24 queuesize stderr 20 # echo "task exit 0" 21 # queuesize stdout 22 # queuesize stderr 23 queuedelete stdout 24 queuedelete stderr 25 memory leaks 25 26 end 26 27
Note:
See TracChangeset
for help on using the changeset viewer.
