1: static char sccsid[] = "@(#)netstart.c	4.1	(Berkeley)	9/12/82";
   2: 
   3: # include "defs.h"
   4: /* sccs id variable */
   5: static char *netstart_sid = "@(#)netstart.c	1.2";
   6: 
   7: /*
   8:  * this is a simple program to start up the net daemon,
   9:  * and when it fails, restart it
  10:  *
  11:  */
  12: static int daemon = 32767;      /* a nice safe process number */
  13: main(argc,argv)
  14:   char **argv; {
  15:     int r,killit(),pid;
  16:     while((pid = fork()) == -1)sleep(2);
  17:     if(pid != 0)exit(EX_OK);
  18:     submit(getpid());
  19:     signal(SIGQUIT,SIG_IGN);
  20:     signal(SIGHUP,SIG_IGN);
  21:     signal(SIGINT,SIG_IGN);
  22:     signal(SIGTERM,killit);
  23:     /* will set remote */
  24:     parseargs(argc,argv);
  25:     addtolog(remote,"Netstart started, process id #%d\n",getpid());
  26:     for(;;){
  27:         while((daemon=fork()) == -1)sleep(2);
  28:         if(daemon == 0){
  29:             argv[0] = "netdaemon";
  30:             argv[argc] = 0;
  31:             execv(NETDAEMON,argv);
  32:             exit(EX_UNAVAILABLE);
  33:             }
  34:         wait(&r);
  35:         addtolog(remote,"Net daemon exit code %d, low byte 0%o\n",
  36:             (r>>8), (r&0377));
  37:         sleep(100);     /* avoid looping too fast */
  38:         }
  39:     }
  40: killit(){
  41:     kill(daemon,SIGTERM);       /* send terminate */
  42:     sleep(2);           /* wait till cleanup */
  43:     kill(daemon,SIGKILL);       /* kill in case too */
  44:     exit(EX_OK);
  45:     }
  46: /* add to allow netstart.c to load */
  47: initseqno(){};

Defined functions

killit defined in line 40; used 2 times
main defined in line 13; never used

Defined variables

daemon defined in line 12; used 4 times
netstart_sid defined in line 5; never used
sccsid defined in line 1; never used
Last modified: 1982-09-13
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1157
Valid CSS Valid XHTML 1.0 Strict