Commit | Line | Data |
---|---|---|
9f49a1fa KB |
1 | /* |
2 | * Copyright (c) 1987 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 | |
7abf8d65 | 8 | static char sccsid[] = "@(#)update.c 4.4 (Berkeley) %G%"; |
9f49a1fa KB |
9 | #endif |
10 | ||
a675940b BJ |
11 | /* |
12 | * Update the file system every 30 seconds. | |
13 | * For cache benefit, open certain system directories. | |
14 | */ | |
15 | ||
9f49a1fa KB |
16 | #include <sys/time.h> |
17 | #include <sys/file.h> | |
18 | #include <sys/signal.h> | |
19 | #include <syslog.h> | |
20 | #include <stdio.h> | |
7abf8d65 | 21 | #include "pathnames.h" |
a675940b BJ |
22 | |
23 | main() | |
24 | { | |
9f49a1fa KB |
25 | struct itimerval value; |
26 | register char **f; | |
27 | extern int sync(); | |
a675940b | 28 | |
9f49a1fa | 29 | if (fork()) |
a675940b | 30 | exit(0); |
9f49a1fa KB |
31 | (void)close(0); |
32 | (void)close(1); | |
33 | (void)close(2); | |
34 | for (f = fillst; *f; f++) | |
35 | (void)open(*f, O_RDONLY, 0); | |
36 | (void)signal(SIGALRM, sync); | |
37 | value.it_interval.tv_sec = 30; | |
38 | value.it_interval.tv_usec = 0; | |
39 | value.it_value = value.it_interval; | |
40 | if (setitimer(ITIMER_REAL, &value, (struct itimerval *)NULL)) { | |
41 | perror("update: setitimer"); | |
42 | exit(1); | |
43 | } | |
44 | for (;;) | |
a675940b | 45 | pause(); |
9f49a1fa | 46 | /*NOTREACHED*/ |
a675940b | 47 | } |