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 ...
随机推荐
- node.js 服务器
http-server 是一个简单的零配置命令行HTTP服务器, 基于 nodeJs. 如果你不想重复的写 nodeJs 的 web-server.js, 则可以使用这个. 安装 (全局安装加 -g) ...
- 75th LeetCode Weekly Contest Rotate String
We are given two strings, A and B. A shift on A consists of taking string A and moving the leftmost ...
- java反射之一
public static void main(String[] args) { try { Class cla = Class.forName("com.money.test.Employ ...
- buildKibanaServerUrl
private String buildKibanaServerUrl(DiscountIndexMailData mailData,Statistic stat,String failureCaus ...
- ansible部署,规划
部署管理服务器 第一步:先检查有没有ssh服务 [root@iZm5eeyc1al5vzh8bo57zyZ ~]# rpm -qf /etc/init.d/sshd openssh-server-5. ...
- Linux ps命令记录
ps命令:查看当前系统进程状态 ps -a 显示当前所有进程ps -ax 显示没有控制终端的进程ps -u better 查看用户better的进程ps aux|less 通过cpu和内存来 ...
- call and apply
apply()把参数打包成Array再传入: call()把参数按顺序传入. Math.max.apply(null, [3, 5, 4]); // 5 Math.max.call(null, 3, ...
- python_案例综合:教材记录管理
class Book(): def __init__(self,ISBN,Ftile,Author,Publisher): self.ISBN = ISBN self.Ftile = Ftile se ...
- SourceInsight,Understand,SecureCRT设置
SourceInsight 设置字体 Option/Document Option/Screen Fonts Understand https://scitools.com/download/ ...
- JavaScript控制流及关键字与C语言之比较
学习JavaScript控制流及关键字概念前,对有过C语言学习经验的同学来说,那么关键字,控制语句概念并不陌生.我们先来看看C语言吧: C语言的32个关键字和9种控制语句 9种控制语句: if.if- ...