Ai
1 Star 0 Fork 0

李浩鹏/linux

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
c6.1.c 521 Bytes
一键复制 编辑 原始数据 按行查看 历史
李浩鹏 提交于 2021-11-09 17:03 +08:00 . c6.1.c
#include<stdio.h>
#include<string.h>
#include<unistd.h>
#include<signal.h>
void handler(int sig,siginfo_t *siginfo,void *context)
{
printf("handler:sig=%d from PID=%d UID=%d\n",sig,siginfo->si_pid,siginfo->si_uid);
}
int main(int argc,char *argv[])
{
struct sigaction act;
memset(&act,0,sizeof(act));
act.sa_sigaction=&handler;
act.sa_flags=SA_SIGINFO;
sigaction(SIGTERM,&act,NULL);
printf("proc PID=%d looping\n",getpid());
printf("etnter kill PID to send SIGTERM signal to it\n");
while(1){
sleep(10);
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lhp6666/linux.git
git@gitee.com:lhp6666/linux.git
lhp6666
linux
linux
master

搜索帮助