sigpending显示当前进程有哪个信号被pending
来源:互联网 发布:mac word of the day 编辑:程序博客网 时间:2024/05/19 00:17
The sigpending function returns the set of signals that are blocked from delivery and currently pending for the calling process.
就是说,返回的信号,是被已经产生,但因为被block而没有deliver的。
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <errno.h>
#include <unistd.h>
static void sig_quit(int);
int
main(void)
{
sigset_t newmask, oldmask, pendmask;
if (signal(SIGQUIT, sig_quit) == SIG_ERR)
perror("can't catch SIGQUIT");
/*
* Block SIGQUIT and save current signal mask.
*/
sigemptyset(&newmask);
sigaddset(&newmask, SIGQUIT);
if (sigprocmask(SIG_BLOCK, &newmask, &oldmask) < 0)
perror("SIG_BLOCK error");
sleep(5); /* SIGQUIT here will remain pending */
if (sigpending(&pendmask) < 0)
perror("sigpending error");
if (sigismember(&pendmask, SIGQUIT))
printf("/nSIGQUIT pending/n");
/*
* Reset signal mask which unblocks SIGQUIT.
*/
if (sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0)
perror("SIG_SETMASK error");
printf("SIGQUIT unblocked/n");
sleep(5); /* SIGQUIT here will terminate with core file */
exit(0);
}
static void
sig_quit(int signo)
{
printf("caught SIGQUIT/n");
if (signal(SIGQUIT, SIG_DFL) == SIG_ERR)
perror("can't reset SIGQUIT");
}
- sigpending显示当前进程有哪个信号被pending
- sigpending()--Examine Pending Signals
- 进程信号三张表block,pending,handler
- linux信号(sigprocmask,sigpending)
- 利用sigpending,sigismember检测信号是否被挂起
- 信号--sigpending函数
- 进程信号的未决状态(pending status)
- 进程信号的未决状态(pending status)
- 进程信号的未决状态(pending status)
- 进程信号中的三大表格(block、pending、hardler)
- 信号屏蔽pending
- 信号屏蔽pending
- 信号屏蔽(pending)
- 信号屏蔽pending
- 信号屏蔽--pending表
- 信号屏蔽pending
- 信号屏蔽pending
- 信号屏蔽pending
- 通常使用的 rc 和 .(点)文件
- 搭建嵌入式QT4开发环境
- saas
- HDU2059龟兔赛跑-题解动态规划DP
- 从追MM谈Java的23种设计模式
- sigpending显示当前进程有哪个信号被pending
- 模式对话框的相关知识
- 简单的字符串运算
- LINQ体验(8)--LINQ to SQL语句之Union All/Union/Intersect和Top/Bottom和P...
- How to attach behavior in code behind (Silverlight 3)
- Asp.net
- linux写一个监控日志,发邮件的shell
- poj1226
- oracle删除表空间中一用户及其对应的所有数据