Linux 信号表 signals
Linux支持POSIX reliable signals和POSIX real-time signals。
信号处理
进程接受到信号之后会有一些默认的处理方式,如下为5种处理方式:
| type | description |
|---|---|
| Term | Default action is to terminate the process. |
| Ign | Default action is to ignore the signal. |
| Core | Default action is to terminate the process and dump core (see core(5)). |
| Stop | Default action is to stop the process. |
| Cont | Default action is to continue the process if it is currently stopped. |
若想改变signal的默认处理方式,可以看signal函数和sigaction函数。
发送信号
下面是一些系统调用或者库函数可以用于发送信号给某进程:
| 系统调用或库函数 | 描述 |
|---|---|
| raise | Sends a signal to the calling thread. |
| kill | Sends a signal to a specified process, to all members of a specified process group, or to all processes on the system. |
| killpg | Sends a signal to all of the members of a specified process group. |
| pthread_kill | Sends a signal to a specified POSIX thread in the same process as the caller. |
| tgkill | Sends a signal to a specified thread within a specific process. (This is the system call used to implement pthread_kill(3).) |
| sigqueue | Sends a real-time signal with accompanying data to a specified process. |
信号类型
Linux支持的信号很多,常用的有如下这些:
| Signal | Value | Action | Comment |
|---|---|---|---|
| SIGHUP | 1 | Term | Hangup detected on controlling terminal or death of controlling process |
| SIGINT | 2 | Term | Interrupt from keyboard |
| SIGQUIT | 3 | Core | Quit from keyboard |
| SIGILL | 4 | Core | Illegal Instruction |
| SIGABRT | 6 | Core | Abort signal from abort(3) |
| SIGFPE | 8 | Core | Floating point exception |
| SIGKILL | 9 | Term | Kill signal |
| SIGSEGV | 11 | Core | Invalid memory reference |
| SIGPIPE | 13 | Term | Broken pipe: write to pipe with no readers |
| SIGALRM | 14 | Term | Timer signal from alarm(2) |
| SIGTERM | 15 | Term | Termination signal |
| SIGUSR1 | 30,10,16 | Term | User-defined signal 1 |
| SIGUSR2 | 31,12,17 | Term | User-defined signal 2 |
| SIGCHLD | 20,17,18 | Ign | Child stopped or terminated |
| SIGCONT | 19,18,25 | Cont | Continue if stopped |
| SIGSTOP | 17,19,23 | Stop | Stop process |
| SIGTSTP | 18,20,24 | Stop | Stop typed at terminal |
| SIGTTIN | 21,21,26 | Stop | Terminal input for background process |
| SIGTTOU | 22,22,27 | Stop | Terminal output for background process |
其中value是可能的取值,因为在不同的系统上它的值不一样,最好使用宏进行操作比较安全,移植性也需要考虑。
Linux 信号表 signals的更多相关文章
- Linux 信号表
信号 取值 默认动作 含义(发出信号的原因) SIGHUP 1 Term 终端的挂断或进程死亡 SIGINT 2 Term 来自键盘的中断信号 SIGQUIT 3 Core 来自键盘的离开信号 SIG ...
- <摘录>linux signal 列表
Linux 信号表 Linux支持POSIX标准信号和实时信号.下面给出Linux Signal的简表,详细细节可以查看man 7 signal. 默认动作的含义如下: 中止进程(Term) 忽略 ...
- linux signal 列表
Linux 信号表 Linux支持POSIX标准信号和实时信号.下面给出Linux Signal的简表,详细细节可以查看man 7 signal. 默认动作的含义如下: Term 终止进程 ...
- 【linux】驱动-14-异步通知
目录 前言 14. 异步通知 14.1 异步通知的一些概念 14.2 Linux 信号 14.3 信号接收 14.4 使用流程 14.4.1 参考流程图 14.4.2 分析&编程步骤 14.4 ...
- Linux 驱动开发
linux驱动开发总结(一) 基础性总结 1, linux驱动一般分为3大类: * 字符设备 * 块设备 * 网络设备 2, 开发环境构建: * 交叉工具链构建 * NFS和tftp服务器安装 3, ...
- 两种高性能I/O设计模式(Reactor/Proactor)的比较
原文出处: Alex Libman 译文出处:潘孙友 欢迎分享原创到伯乐头条 综述 这篇文章探讨并比较两种用于TCP服务器的高性能设计模式. 除了介绍现有的解决方案,还提出了一种更具伸缩性,只 ...
- 自动部署tomcat,并以普通用户身份运行 for centos6
#!/bin/bash ######## install jdk install_jdk () { rpm -e ‘rpm -qa |grep jdk’ wget \ --no-check-certi ...
- 系统信号(signal)与其他(定时器,退出清理等)
信号signal,可以用作进程线程通信,也可以用作接收中断后退出,退出时,清理资源,记录日志.python相关包为signa. linux信号表 root@server:~# kill -l ) SI ...
- [转]两种高性能I/O设计模式(Reactor/Proactor)的比较
[原文地址:http://www.cppblog.com/pansunyou/archive/2011/01/26/io_design_patterns.html] 综述 这篇文章探讨并比较两种用于T ...
随机推荐
- visual studio 2013 error: Page '312e8a59-2712-48a1-863e-0ef4e67961fc' not found.
In order to resolve this error do the following : Open Developer Command Prompt for VS 2013 as “Run ...
- P2895 [USACO08FEB]流星雨Meteor Shower
传送门 预处理出每个位置最早被摧毁的时间,在此之前都可以走 直接dfs加个记忆化和最优性剪枝就好了 一定要注意流星的边界,如果波及到负数坐标的位置不要去考虑会RE 一定要考虑流星砸到边界的情况 如 ( ...
- 在MD中使用Emoji
mark语法中支持emoji表情 具体语法是:emoji: 比如我输入 :smile: 就会出现微笑
- 5-----Scrapy框架中Spiders用法
Spider类定义了如何爬去某个网站,包括爬取的动作以及如何从网页内容中提取结构化的数据,总的来说spider就是定义爬取的动作以及分析某个网页 工作流程分析 1.以初始的URL初始化Request, ...
- 笔记-spring aop 原理学习2
InstantiationAwareBeanPostProcessor AnnotationAwareAspectJAutoProxyCreator https://blog.csdn.net/qq_ ...
- GBDT,FM,FFM推导
GBDT推导: https://xgboost.readthedocs.io/en/latest/tutorials/model.html FM,FFM推导: https://tech.meituan ...
- git使用笔记-日志
1.查看函数的历史修改 git log -L :git_deflate_bound:zlib.c2.查看HEAD的所有记录 git reflog $ git reflog 1a410ef HEAD@{ ...
- python单元测试框架-unittest(三)之用例执行顺序
执行顺序规则: 测试类或测试方法的数字与字母顺序0~9,A-Z 执行如下脚本,理解用例执行顺序 #coding=utf-8 import unittest class Test1(unittest.T ...
- vs2012配置使用entity framework 6
项目中使用mysql作为数据库,想快速地实现一些数据服务,为了节省开发时间,提升开发效率,性能不是考虑的重点,所以选择了使用ORM框架:Entity Framework.指定了DB的table des ...
- anaular js loadding效果
以前用的jquery的时候,用ajax实现,比较好弄,下面是angularjs的方式: //body下面增加div <div data-loading></div> //dir ...