home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V7 / usr / src / cmd / update.c < prev    next >
Encoding:
C/C++ Source or Header  |  1979-01-10  |  398 b   |  37 lines

  1. /*
  2.  * Update the file system every 30 seconds.
  3.  * For cache benefit, open certain system directories.
  4.  */
  5.  
  6. #include <signal.h>
  7.  
  8. char *fillst[] = {
  9.     "/bin",
  10.     "/usr",
  11.     "/usr/bin",
  12.     0,
  13. };
  14.  
  15. main()
  16. {
  17.     char **f;
  18.  
  19.     if(fork())
  20.         exit(0);
  21.     close(0);
  22.     close(1);
  23.     close(2);
  24.     for(f = fillst; *f; f++)
  25.         open(*f, 0);
  26.     dosync();
  27.     for(;;)
  28.         pause();
  29. }
  30.  
  31. dosync()
  32. {
  33.     sync();
  34.     signal(SIGALRM, dosync);
  35.     alarm(30);
  36. }
  37.