add directory study
This commit is contained in:
34
study/linux-travel/MINIX-1.5/1.5/Source/commands/update.c
Normal file
34
study/linux-travel/MINIX-1.5/1.5/Source/commands/update.c
Normal file
@@ -0,0 +1,34 @@
|
||||
/* update - do sync periodically Author: Andy Tanenbaum */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
|
||||
main()
|
||||
{
|
||||
int fd, buf[2];
|
||||
|
||||
|
||||
/* Disable SIGTERM */
|
||||
signal(SIGTERM, SIG_IGN);
|
||||
|
||||
/* Release all (?) open file descriptors. */
|
||||
close(0);
|
||||
close(1);
|
||||
close(2);
|
||||
|
||||
/* Release current directory to avoid locking current device. */
|
||||
chdir("/");
|
||||
|
||||
/* Open some files to hold their inodes in core. */
|
||||
/*open("/bin", 0);*/
|
||||
/*open("/lib", 0);*/
|
||||
/*open("/etc", 0);*/
|
||||
/*open("/tmp", 0);*/
|
||||
|
||||
|
||||
/* Flush the cache every 30 seconds. */
|
||||
while (1) {
|
||||
sync();
|
||||
sleep(30);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user