add directory study

This commit is contained in:
gohigh
2024-02-19 00:25:23 -05:00
parent b1306b38b1
commit f3774e2f8c
4001 changed files with 2285787 additions and 0 deletions

View 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);
}
}