2024年4月16日发(作者:)

Android中的Signal信号

Contents

Signal 信号 .................................................................................................................................................... 1

[1] signal中文描述列表 ........................................................................................................................... 2

[2] Android信号处理 ............................................................................................................................... 5

[3] What is si_codes .................................................................................................................................. 8

Example: SEGV_ACCERR ..................................................................................................................... 12

Example: BUS_ADRALN ....................................................................................................................... 12

Example: SIGPIPE ................................................................................................................................ 14

[4] signal and Traces/tombstone ............................................................................................................ 14

[5] Example: Add some logs to debug signal: ......................................................................................... 16

1 Who kill system_server .................................................................................................................... 16

2 see kernel why unkown reason exit ................................................................................................. 16

[6] Reference ........................................................................................................................................... 16

What is signal

How many kind signal,General signal

How to send signal

How to handle signal

How to generally use signal

Signal and system call

signal handle Reentrant Functions

signal set

signal queue

sigprocmask Function

Signals are a limited form of inter-process communication used in Unix, Unix-like, and other POSIX-

compliant operating systems. A signal is an asynchronous notification sent to a process or to a specific

thread within the same process in order to notify it of an event that occurred. Signals originated in

1970s Bell Labs Unix and have been more recently specified in the POSIX standard.

When a signal is sent, the operating system interrupts the target process' normal flow of execution to

deliver the signal. Execution can be interrupted during any non-atomic instruction. If the process has

previously registered a signal handler, that routine is executed. Otherwise, the default signal handler is

executed.

Embedded programs may find signals useful for interprocess communications, as the computational and

memory footprint for signals is small.

[1] signal中文描述列表

Signal Description

SIGABRT 由调用abort函数产生,进程非正常退出

SIGALRM 用alarm函数设置的timer超时或setitimer函数设置的interval timer超时