update.c

来自「操作系统源代码」· C语言 代码 · 共 25 行

C
25
字号
/* update - do sync periodically		Author: Andy Tanenbaum */#include <sys/types.h>#include <signal.h>#include <unistd.h>_PROTOTYPE(int main, (void));int main(){  /* Release all (?) open file descriptors. */  close(0);  close(1);  close(2);  /* Release current directory to avoid locking current device. */  chdir("/");  /* Flush the cache every 30 seconds. */  while (1) {	sync();	sleep(30);  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?