X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/blobdiff_plain/0a5ff702d123caf0af236c08a899ed327edf36a9..dcfa270ac1d2f55eb793c4da4bbd555903a88b09:/dcm/startdcm.c diff --git a/dcm/startdcm.c b/dcm/startdcm.c index 6a36c6b1..90451d51 100644 --- a/dcm/startdcm.c +++ b/dcm/startdcm.c @@ -12,7 +12,7 @@ */ #ifndef lint -static char *rcsid_sms_starter_c = "$Header$"; +static char *rcsid_mr_starter_c = "$Header$"; #endif lint #include @@ -23,47 +23,12 @@ static char *rcsid_sms_starter_c = "$Header$"; #include #include #include +#include -#define SMS_LOG_FILE "/u1/sms/dcm.log" - -#define SMS_PROG "/u1/sms/bin/dcm" +#define PROG "dcm" int rdpipe[2]; -char *sigdescr[] = { - 0, - "hangup", - "interrupt", - "quit", - "illegal instruction", - "trace/BPT trap", - "IOT trap", - "EMT trap", - "floating exception", - "kill", - "bus error", - "segmentation violation", - "bad system call", - "broken pipe", - "alarm clock", - "termination", - "urgent I/O condition", - "stopped", - "stopped", - "continued", - "child exited", - "stopped (tty input)", - "stopped (tty output)", - "I/O possible", - "cputime limit exceeded", - "filesize limit exceeded", - "virtual timer expired", - "profiling timer expired", - "window size changed", - "signal 29", - "user defined signal 1", - "user defined signal 2", - "signal 32" -}; +extern char *sys_siglist[]; cleanup() { @@ -83,7 +48,7 @@ cleanup() } if (WIFSIGNALED(stat)) { sprintf(buf, "exited on %s signal%s\n", - sigdescr[stat.w_termsig], + sys_siglist[stat.w_termsig], (stat.w_coredump?"; Core dumped":0)); } write(rdpipe[1], buf, strlen(buf)); @@ -106,9 +71,10 @@ main(argc, argv) setreuid(0); signal(SIGCHLD, cleanup); - logf = open(SMS_LOG_FILE, O_CREAT|O_WRONLY|O_APPEND, 0640); + sprintf(buf, "%s/%s.log", SMS_DIR, PROG); + logf = open(buf, O_CREAT|O_WRONLY|O_APPEND, 0640); if (logf<0) { - perror(SMS_LOG_FILE); + perror(buf); exit(1); } inf = open("/dev/null", O_RDONLY , 0); @@ -118,7 +84,7 @@ main(argc, argv) } pipe(rdpipe); if (fork()) { - exit(); + exit(0); } chdir("/"); close(0); @@ -131,6 +97,7 @@ main(argc, argv) tty = open("/dev/tty"); ioctl(tty, TIOCNOTTY, 0); close(tty); + sprintf(buf, "%s/%s", BIN_DIR, PROG); if ((pid = fork()) == 0) { @@ -138,7 +105,7 @@ main(argc, argv) dup2(rdpipe[1], 1); dup2(1,2); for (i = 3; i