Linux 信号(简略笔记)
一、概要
详细介绍:http://www.ibm.com/developerworks/cn/linux/l-ipc/part2/index1.html
信号是UNIX和Linux系统响应结条件而产生的一个事件。接收到信号的进程会相应地采取一些行动。
(1) 在系统终端下输入命名: kill -l 或 trap -l 可以查看系统所支持的信号!
(2) 信号编号1-32 是早期的信号,是不可靠信号,信号在一定条件下会丢失;
(3) 信号编号33以上是后期版系统本出现的,是可靠信号。信号生成时,进程响应还未结束,将自动排队等待响应。
(4) 信号 9 SIGKILL 和 信号 19 SIGSTOP 这两个信号不可以被捕获或忽略。
二、 函数介绍:
头文件: signal.h
1. 信号集处理:
sigfillset(sigset_t *set); 设置所有的信号到set信号集中;
sigemptyset(sigset_t *set); 从set信号集中清空所有信号;
sigaddset(sigset_t *set,int sig);在set信号集中加入sig信号;
sigdelset(sigset_t *set,int sig);在set信号集中删除sig信号;
2. 信号处理函数
(1)传统的信号处理接口: void (*signal(int sig, void (*func)(int )))(int),
因为可靠信号的出现重新规范了健壮的信号接口:int sigaction(int sig,const struct sigaction *act,struct sigaction *oldact);
关于结构体 struct sigaction ,查询 man 手册;
struct sigaction 成员:
sa_hanlder 和 sa_sigaction 指向信号处理函数的指针,只能定义其中一个,两个都定义的话,将执行sa_handler指向的函数;其中可以指向宏定义 SIG_IGN(忽略信号) 和 SIG_DFL(信号默认行为);
sa_mas
相关文档:
Vim和所有的流行文本编辑器一样,Vim 可以很好的编辑各种字符编码的文件,这当然包括 UCS-2、UTF-8 等流行的 Unicode 编码方式。然而不幸的是,和很多来自 Linux 世界的软件一样,这需要你自己动手设置。
Vim 有四个跟字符编码方式有关的选项,encoding、fileencoding、fileencodings、termencoding (这些选项可能的取值请 ......
1、 一些头文件的作用:
<assert.h>:ANSI C。提供断言,assert(表达式)
<glib.h>:GCC。GTK,GNOME的基础库,提供很多有用的函数,如有数据结构操作函数。使用glib只需要包含<glib.h>
<dirent.h>:GCC。文件夹操作函数。struct dirent,struct DIR,opendir(),closedir(),readdir(),readdi ......
烧写2410-S linux 操作系统:
在windows xp下进行,需要的文件在光盘中的img目录和flashvivi目录下提供。
烧写2410-S linux 操作系统包括烧写vivi,kernel,root三个步骤,除此我们还要烧写yaffs.tar,这四个文件在img目录中。
vivi ----linux操作系统启动的bootloader;
zImage----linu ......
参见:http://isis.poly.edu/kulesh/stuff/src/klist/
Introduction:
Linux kernel is mostly written in the C language. Unlike many other languages C does not have
a good collection of data structures built into it or supported by a collection of standard libraries.
Therefore, you're probably excited ......
通过编辑linux的/etc/bash.bashrc文件来快速定位各个目录
alias mysqlw="mysql -uroot -p123456"
alias usr="cd /usr/local"
alias src="cd /usr/src"
alias sphinx="cd /usr/local/sphinx"
alias apahce="cd /usr/local/apache"
alias home="cd /home/data/dev_test_com"
alias php="/usr/local/php5/bin/php" ......