Changeset 3189
- Timestamp:
- Feb 11, 2005, 8:45:09 AM (21 years ago)
- Location:
- trunk/Ohana/src/opihi/pcontrol
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pcontrol/HostOps.c
r3187 r3189 48 48 } 49 49 50 int FindHost (char *name, int QueueID) { 50 int FindHost (IDtype HostID, int QueueID) { 51 52 Queue *queue; 53 54 queue = GetHostQueue (QueueID); 55 if (queue == NULL) return (-2); 56 57 for (i = 0; i < queue[0].Nobject; i++) { 58 host = (Host *) queue[0].object; 59 if (host[0].HostID == HostID) { 60 return (i); 61 } 62 } 63 return (-1); 64 } 65 66 int FindNamedHost (char *name, int QueueID) { 51 67 52 68 Queue *queue; … … 74 90 host[0].stdout = 0; 75 91 host[0].stderr = 0; 76 host[0]. ID= NextHostID();92 host[0].HostID = NextHostID(); 77 93 78 94 host[0].markoff = FALSE; -
trunk/Ohana/src/opihi/pcontrol/JobOps.c
r3187 r3189 48 48 } 49 49 50 int FindJob ( intJobID, int QueueID) {50 int FindJob (IDtype JobID, int QueueID) { 51 51 52 52 Job *job; -
trunk/Ohana/src/opihi/pcontrol/host.c
r3187 r3189 39 39 40 40 if (On) { 41 host = FindHost (argv[1], PCONTROL_HOST_OFF);42 if ( host == NULL) {41 N = FindNamedHost (argv[1], PCONTROL_HOST_OFF); 42 if (N < 0) { 43 43 fprintf (stderr, "host %s is not OFF\n", argv[1]); 44 44 return (FALSE); 45 45 } 46 DownHost (host); 46 host = GetHost (PCONTROL_HOST_OFF, N); 47 PutHost (host, PCONTROL_HOST_DOWN, QUEUE_BOTTOM); 47 48 return (TRUE); 48 49 } 49 50 50 51 if (Off) { 51 host = FindHost (argv[1], PCONTROL_HOST_IDLE); 52 if (host != NULL) { 53 OffHost (host); 52 N = FindNamedHost (argv[1], PCONTROL_HOST_IDLE); 53 if (N >= 0) { 54 host = GetHost (PCONTROL_HOST_OFF, N); 55 PutHost (host, PCONTROL_HOST_OFF, QUEUE_BOTTOM); 54 56 return (TRUE); 55 57 } 56 host = FindHost (argv[1], PCONTROL_HOST_DOWN); 57 if (host != NULL) { 58 OffHost (host); 58 N = FindNamedHost (argv[1], PCONTROL_HOST_DOWN); 59 if (N >= 0) { 60 host = GetHost (PCONTROL_HOST_OFF, N); 61 PutHost (host, PCONTROL_HOST_OFF, QUEUE_BOTTOM); 59 62 return (TRUE); 60 63 } 61 host = FindHost (argv[1], PCONTROL_HOST_BUSY); 62 if (host != NULL) { 63 MarkOffHost (host); 64 N = FindNamedHost (argv[1], PCONTROL_HOST_BUSY); 65 if (N >= 0) { 66 host = GetHost (PCONTROL_HOST_OFF, N); 67 PutHost (host, PCONTROL_HOST_OFF, QUEUE_BOTTOM); 64 68 return (TRUE); 65 69 } -
trunk/Ohana/src/opihi/pcontrol/kill.c
r3187 r3189 4 4 5 5 Job *job; 6 int JobID ;6 int JobID, N; 7 7 8 8 if (argc < 2) { … … 12 12 JobID = atoi (argv[1]); 13 13 14 job= FindJob (JobID, PCONTROL_JOB_BUSY);15 if ( job != NULL) {16 KillJob (job);17 return ( TRUE);14 N = FindJob (JobID, PCONTROL_JOB_BUSY); 15 if (N < 0) { 16 fprintf (stderr, "job %s not BUSY\n", argv[1]); 17 return (FALSE); 18 18 } 19 20 fprintf (stderr, "job %s not BUSY\n", argv[1]);21 return ( FALSE);19 job = GetJob (PCONTROL_JOB_BUSY, N); 20 KillJob (job); 21 return (TRUE); 22 22 } 23 23 … … 25 25 26 26 Job *job; 27 int JobID ;27 int JobID, N; 28 28 29 29 if (argc < 2) { … … 32 32 } 33 33 JobID = atoi (argv[1]); 34 /* use a string interp to convert JobIDs to ints ? */ 34 35 35 job = FindJob (JobID, PCONTROL_JOB_PENDING); 36 if (job != NULL) { 36 N = FindJob (JobID, PCONTROL_JOB_PENDING); 37 if (N >= 0) { 38 job = GetJob (PCONTROL_JOB_PENDING, N); 37 39 DelJob (job); 38 40 return (TRUE); 39 41 } 40 job = FindJob (JobID, PCONTROL_JOB_CRASH); 41 if (job != NULL) { 42 N = FindJob (JobID, PCONTROL_JOB_CRASH); 43 if (N >= 0) { 44 job = GetJob (PCONTROL_JOB_CRASH, N); 42 45 DelJob (job); 43 46 return (TRUE); 44 47 } 45 job = FindJob (JobID, PCONTROL_JOB_EXIT); 46 if (job != NULL) { 48 N = FindJob (JobID, PCONTROL_JOB_EXIT); 49 if (N >= 0) { 50 job = GetJob (PCONTROL_JOB_EXIT, N); 47 51 DelJob (job); 48 52 return (TRUE);
Note:
See TracChangeset
for help on using the changeset viewer.
