Changeset 3211
- Timestamp:
- Feb 13, 2005, 6:49:20 PM (21 years ago)
- Location:
- trunk/Ohana/src/opihi
- Files:
-
- 10 edited
-
Makefile (modified) (2 diffs)
-
include/pclient.h (modified) (1 diff)
-
lib.shell/opihi.c (modified) (2 diffs)
-
pclient/ChildOps.c (modified) (2 diffs)
-
pclient/pclient.c (modified) (2 diffs)
-
pcontrol/CheckHost.c (modified) (1 diff)
-
pcontrol/CheckIdleHost.c (modified) (3 diffs)
-
pcontrol/StartHost.c (modified) (1 diff)
-
pcontrol/pclient.c (modified) (2 diffs)
-
pcontrol/rconnect.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/Makefile
r3187 r3211 12 12 sched: lib.data lib.shell cmd.basic cmd.data cmd.astro 13 13 pclient: lib.data lib.shell cmd.basic 14 pcontrol: lib.data lib.shell cmd.basic 14 15 15 16 LIBS = cmd.basic cmd.data cmd.astro lib.data lib.shell … … 17 18 PROGRAM = mana dvo 18 19 19 EXTRAS = dvo2 sched dimm pclient 20 EXTRAS = dvo2 sched dimm pclient pcontrol 20 21 21 22 all: -
trunk/Ohana/src/opihi/include/pclient.h
r3187 r3211 74 74 int CheckChild (); 75 75 void CheckChildStatus (); 76 77 # define DTIME(A,B) ((A.tv_sec - B.tv_sec) + 1e-6*(A.tv_usec - B.tv_usec)) -
trunk/Ohana/src/opihi/lib.shell/opihi.c
r2800 r3211 6 6 int i, Nbad, Nlist, status; 7 7 char **list, *line, *outline, *prompt, *history; 8 pid_t ppid; 8 9 9 10 initialize (argc, argv); … … 19 20 line = readline (prompt); 20 21 if (line == NULL) { 22 23 ppid = getppid(); 24 if (ppid == 1) { 25 fprintf (stderr, "caught parent shutdown\n"); 26 exit (2); 27 } 21 28 if (!isatty (STDIN_FILENO)) exit (2); 22 29 fprintf (stdout, "Use \"quit\" to exit\n"); -
trunk/Ohana/src/opihi/pclient/ChildOps.c
r3187 r3211 1 1 # include "pclient.h" 2 3 static int Nbad = 0; 4 static struct timeval last = {0, 0}; 2 5 3 6 int InitChild () { … … 22 25 23 26 int Nread; 27 pid_t ppid; 28 double dtime; 29 struct timeval now; 30 31 /* this is really lame : check if we are calling too quickly */ 32 gettimeofday (&now, NULL); 33 dtime = DTIME (now, last); 34 last = now; 35 if (dtime < 0.0001) Nbad ++; 36 if (dtime > 0.01) Nbad = 0; 37 if (Nbad > 10) { 38 fprintf (stderr, "parent shutdown\n"); 39 exit (2); 40 } 41 42 /* this is a bit lame : we must exit if calling process exits */ 43 ppid = getppid(); 44 if (ppid == 1) { 45 fprintf (stderr, "parent shutdown\n"); 46 exit (2); 47 } 24 48 25 49 CheckChildStatus (); -
trunk/Ohana/src/opihi/pclient/pclient.c
r3187 r3211 13 13 fprintf (stderr, "\n"); 14 14 fprintf (stderr, "Welcome to %s - %s\n\n", opihi_name, opihi_description); 15 } 16 17 void gotsignal (int signum) { 18 fprintf (stderr, "got signal : %d\n", signum); 19 return; 15 20 } 16 21 … … 53 58 /* ignore the history file. to change this, see, eg, mana.c */ 54 59 signal (SIGINT, SIG_IGN); 60 signal (SIGPIPE, gotsignal); 61 signal (SIGTSTP, gotsignal); 62 signal (SIGTTIN, gotsignal); 55 63 return; 56 64 } -
trunk/Ohana/src/opihi/pcontrol/CheckHost.c
r3203 r3211 39 39 40 40 default: 41 fprintf (stderr, "host %s is alive\n", host[0].hostname);41 /* fprintf (stderr, "host %s is alive\n", host[0].hostname); */ 42 42 PutHost (host, host[0].stack, STACK_BOTTOM); 43 43 FreeIOBuffer (&buffer); -
trunk/Ohana/src/opihi/pcontrol/CheckIdleHost.c
r3203 r3211 13 13 job = (Job *) stack[0].object[i]; 14 14 if (job[0].mode != PCONTROL_JOB_NEEDHOST) continue; 15 if (job[0].hostname == NULL) continue; 15 16 if (strcasecmp (job[0].hostname, host[0].hostname)) continue; 16 17 LinkJobAndHost (job, host); … … 23 24 job = (Job *) stack[0].object[i]; 24 25 if (job[0].mode != PCONTROL_JOB_WANTHOST) continue; 26 if (job[0].hostname == NULL) continue; 25 27 if (strcasecmp (job[0].hostname, host[0].hostname)) continue; 26 28 LinkJobAndHost (job, host); … … 33 35 job = (Job *) stack[0].object[i]; 34 36 if (job[0].mode != PCONTROL_JOB_ANYHOST) continue; 35 if (strcasecmp (job[0].hostname, host[0].hostname)) continue;36 37 LinkJobAndHost (job, host); 37 38 StartJob (job); -
trunk/Ohana/src/opihi/pcontrol/StartHost.c
r3204 r3211 9 9 /* pid = rconnect (CONNECT, host[0].hostname, PCLIENT, stdio); */ 10 10 11 strcpy (command, "ssh");12 strcpy (shell, "pclient");11 if (VarConfig ("COMMAND", "%s", command) == NULL) strcpy (command, "ssh"); 12 if (VarConfig ("SHELL", "%s", shell) == NULL) strcpy (shell, "pclient"); 13 13 14 14 pid = rconnect (command, host[0].hostname, shell, stdio); -
trunk/Ohana/src/opihi/pcontrol/pclient.c
r3203 r3211 9 9 int status; 10 10 char *line; 11 11 12 12 /* send command to client (adding on \n) */ 13 fprintf (stderr, "send: %s (%d)\n", command, buffer[0].Nbuffer); 13 14 ALLOCATE (line, char, MAX (1, strlen(command))); 14 15 sprintf (line, "%s\n", command); … … 28 29 if (status == 0) return (PCLIENT_DOWN); 29 30 if (status == -1) return (PCLIENT_HUNG); 31 fprintf (stderr, "buffer.buffer: %s\n", buffer[0].buffer); 30 32 return (PCLIENT_GOOD); 31 33 } -
trunk/Ohana/src/opihi/pcontrol/rconnect.c
r3204 r3211 27 27 argv[2] = shell; 28 28 argv[3] = 0; 29 fprintf (stderr, "%s %s %s\n", argv[0], argv[1], argv[2]); 29 30 30 31 pid = fork ();
Note:
See TracChangeset
for help on using the changeset viewer.
