#include #include #include #include #include int main() { pid_t pid; pid = fork(); if (pid == 0) { // 子进程 printf("10 秒后子进程退出\n"); int s = alarm(10); // 第一次调用, s 返回 0 printf("alarm s is %d\n", s); sleep(3); s = alarm(10); printf("alarm s is %d\n", s); while (1) ; } return 0; }