1 /* 2 * Copyright (c) 1987, 1990 Regents of the University of California. 3 * All rights reserved. The Berkeley software License Agreement 4 * specifies the terms and conditions for redistribution. 5 */ 6 7 #ifndef lint 8 static char sccsid[] = "@(#)update.c 4.6 (Berkeley) 03/02/91"; 9 #endif 10 11 /* 12 * Update the file system every 30 seconds. 13 * For cache benefit, open certain system directories. 14 */ 15 16 #include <sys/time.h> 17 #include <sys/file.h> 18 #include <sys/signal.h> 19 #include "pathnames.h" 20 21 main() 22 { 23 struct itimerval value; 24 register char **f; 25 void sync(); 26 27 daemon(0, 0); 28 for (f = fillst; *f; f++) 29 (void)open(*f, O_RDONLY, 0); 30 (void)signal(SIGALRM, sync); 31 value.it_interval.tv_sec = 30; 32 value.it_interval.tv_usec = 0; 33 value.it_value = value.it_interval; 34 if (setitimer(ITIMER_REAL, &value, (struct itimerval *)NULL)) { 35 perror("update: setitimer"); 36 exit(1); 37 } 38 for (;;) 39 pause(); 40 /*NOTREACHED*/ 41 } 42