1 /*- 2 * Copyright (c) 1987, 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #ifndef lint 9 char copyright[] = 10 "@(#) Copyright (c) 1987, 1990 The Regents of the University of California.\n\ 11 All rights reserved.\n"; 12 #endif /* not lint */ 13 14 #ifndef lint 15 static char sccsid[] = "@(#)update.c 4.7 (Berkeley) 04/19/91"; 16 #endif /* not lint */ 17 18 #include <sys/time.h> 19 #include <signal.h> 20 #include <fcntl.h> 21 #include <stdlib.h> 22 #include <stdio.h> 23 #include <unistd.h> 24 #include "pathnames.h" 25 26 main() 27 { 28 struct itimerval value; 29 void mysync(); 30 31 daemon(0, 0); 32 33 (void)open(_PATH_BIN, O_RDONLY, 0); 34 (void)open(_PATH_USR, O_RDONLY, 0); 35 (void)open(_PATH_USRBIN, O_RDONLY, 0); 36 (void)open(_PATH_USRLIB, O_RDONLY, 0); 37 38 (void)signal(SIGALRM, mysync); 39 40 value.it_interval.tv_sec = 30; 41 value.it_interval.tv_usec = 0; 42 value.it_value = value.it_interval; 43 if (setitimer(ITIMER_REAL, &value, NULL)) { 44 perror("update: setitimer"); 45 exit(1); 46 } 47 for (;;) 48 pause(); 49 /*NOTREACHED*/ 50 } 51 52 /* VARARGS */ 53 void 54 mysync(i) 55 int i; 56 { 57 (void)sync(); 58 } 59