mkset.c
来自「基于网络编程的例子」· C语言 代码 · 共 40 行
C
40 行
/* * mkset.c - Create a signal set */#include <signal.h>#include <stdlib.h>#include <stdio.h>void err_quit(char *);int main(void){ sigset_t newset; /* Create the set */ if((sigemptyset(&newset)) < 0) err_quit("sigemptyset"); /* Add SIGCHLD to the set */ if((sigaddset(&newset, SIGCHLD)) < 0) err_quit("sigaddset"); /* Check the signal mask */ if(sigismember(&newset, SIGCHLD)) puts("SIGCHLD is in signal mask"); else puts("SIGCHLD not in signal mask"); /* SIGTERM shouldn't be there */ if(sigismember(&newset, SIGTERM)) puts("SIGTERM in signal mask"); else puts("SIGTERM not in signal mask"); exit(EXIT_SUCCESS);} void err_quit(char *msg){ perror(msg); exit(EXIT_FAILURE);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?