信号函数signal的问题 小弟正在学习Linux信号编程. 看到书上有一个例子,有点搞不懂.请问:signal(SIGHUP, sigroutine)中的sigroutine是不是指向函数的指针? 还有void sigroutine(int dunno) 中的dunno不是形参吗?没有赋值怎么会有值呢? 请高手为我解惑,谢了 void sigroutine(int dunno) { switch (dunno) { case 1:printf("Capture SIGHUP signal, the signal number is %d\n", dunno); break; case 2:printf("Capture SIGINT signal, the signal number is %d\n", dunno); break; case 3:printf("Capture SIGQUIT signal, the signal number is %d\n", dunno);break; } return; } int main(void) { printf("process ID is %d\n",getpid()); if(signal(SIGHUP, sigroutine) == SIG_ERR) { printf("Couldn't register signal handler for SIGHUP!\n"); } if(signal(SIGINT, sigroutine) == SIG_ERR) { printf("Couldn't register signal handler for SIGINT!\n"); } if(signal(SIGQUIT, sigroutine) == SIG_ERR) { printf("Couldn't register signal handler for SIGQUIT!\n"); } while(1) sleep(1); return 0; }