1 Star 0 Fork 4.9K

Cain / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
signal-h.md 67.75 KB
一键复制 编辑 原始数据 按行查看 历史
wenjun 提交于 2020-09-08 10:08 . add OpenHarmony 1.0 baseline

signal.h

Overview

Related Modules:

IPC

Description:

Provides signal operation functions and structures, including changing the signal processing mode and the process signal mask set.

Since:

1.0

Version:

1.0

Summary

Data Structures

Data Structure Name

Description

sigaltstack

Describes a signal stack.

__ucontext

Describes the user execution context.

__sigset_t

Defines a signal set.

sigaction

Defines the signal processing actions and related attributes. You can use the structures to change the processing actions or attributes.

sigaltstack

Describes a signal stack.

sigval

Describes signal values in different cases.

__si_fields

Describes signal information.

sigaction

Defines the signal processing actions and related attributes. You can use the structures to change the processing actions or attributes.

sigevent

Describes asynchronous notifications.

Macros

Macro Name and Value

Description

SA_NOCLDSTOP   1

Stops a child process without sending the SIGCHLD signal.

SA_NOCLDWAIT   2

Sets the SIGCHLD flag to prevent zombie processes.

SA_SIGINFO   4

Transfers the siginfo_t structure with the signal.

SA_ONSTACK   0x08000000

Uses the signal stack specified by sigaltstack for signal processing.

SA_RESTART   0x10000000

Obtains the restart signal.

SA_NODEFER   0x40000000

The signals being processed are not masked during signal processing.

SA_RESETHAND   0x80000000

The default processing mode is restored after the signal processing is complete.

SA_RESTORER   0x04000000

Not intended for application use. This flag is used by C libraries to indicate that the sa_restorer field contains the address of a trampoline.

MINSIGSTKSZ   2048

Defines the minimum size of the replaceable signal stack.

SIGSTKSZ   8192

Defines the size of a signal stack.

_NSIG   65

Number of supported signals.

_NSIG_BPW   __BITS_PER_LONG

Number of bits occupied by a word.

_NSIG_WORDS   (_NSIG / _NSIG_BPW)

Number of words required by all signals.

SIGHUP   1

Hangs up a process.

SIGINT   2

Interrupts a process from keyboard.

SIGQUIT   3

Exits a process from keyboard. A core file is generated.

SIGILL   4

Illegal instruction.

SIGTRAP   5

Breakpoint, used for debugging.

SIGABRT   6

Abnormal termination.

SIGIOT   6

Equivalent to SIGABRT.

SIGBUS   7

Invalid address access.

SIGFPE   8

Floating-point exceptions.

SIGKILL   9

Forcibly stops a process.

SIGUSR1   10

User-defined signal 1.

SIGSEGV   11

Illegal memory access.

SIGUSR2   12

User-defined signal 2.

SIGPIPE   13

The pipe is broken.

SIGALRM   14

Timer signal.

SIGTERM   15

Termination signal.

SIGSTKFLT   16

Coprocessor stack error.

SIGCHLD   17

Child process terminated or stopped.

SIGCONT   18

Resumes a suspended process.

SIGSTOP   19

Suspends a process.

SIGTSTP   20

Stops a process by entering the command on the terminal.

SIGTTIN   21

Input required by the background process.

SIGTTOU   22

Output required by the background process.

SIGURG   23

Urgent socket condition.

SIGXCPU   24

CPU time limit exceeded.

SIGXFSZ   25

File size limit exceeded.

SIGVTALRM   26

Virtual timer, used to calculate the CPU occupation time of a process.

SIGPROF   27

Calculates the CPU time occupied by a process and the system calling time.

SIGWINCH   28

Window size change.

SIGIO   29

Input/Output.

SIGPOLL   SIGIO

Equivalent to SIGIO.

SIGPWR   30

Power failure.

SIGSYS   31

Non-existent system call.

SIGUNUSED   31

Equivalent to SIGSYS.

SIGRTMIN   32

Start of a reliable signal.

SIGRTMAX   _NSIG

End of a reliable signal.

SA_NOCLDSTOP   0x00000001

Stops a child process without sending the SIGCHLD signal.

SA_NOCLDWAIT   0x00000002

Sets the SIGCHLD flag to prevent zombie processes.

SA_SIGINFO   0x00000004

Transfers the siginfo_t structure with the signal.

SA_THIRTYTWO   0x02000000

Transfers signals in a 32-bit mode even if the task runs in a 26-bit mode.

SA_RESTORER   0x04000000

Not intended for application use. This flag is used by C libraries to indicate that the sa_restorer field contains the address of a trampoline.

SA_ONSTACK   0x08000000

Uses the signal stack specified by sigaltstack for signal processing.

SA_RESTART   0x10000000

Obtains the restart signal.

SA_NODEFER   0x40000000

The signals being processed are not masked during signal processing.

SA_RESETHAND   0x80000000

The default processing mode is restored after the signal processing is complete.

SA_NOMASK   SA_NODEFER

Signals being processed are not masked during signal processing.

SA_ONESHOT   SA_RESETHAND

The default processing mode is restored after the signal processing is complete.

MINSIGSTKSZ   2048

Defines the minimum size of the replaceable signal stack.

SIGSTKSZ   8192

Defines the size of a signal stack.

SIG_BLOCK   0

Defines the function behaviors such as sigprocmask() and pthread_sigmask(), which are used to add signals to the mask set.

SIG_UNBLOCK   1

Defines the function behaviors such as sigprocmask() and pthread_sigmask(), which are used to remove signals from the mask set.

SIG_SETMASK   2

Defines the function behaviors such as sigprocmask() and pthread_sigmask(), which are used to set the mask set.

sa_handler   _u._sa_handler

Defines the simplified writing used to indicate the __sa_handler.sa_handler field in sigaction.

sa_sigaction   _u._sa_sigaction

Defines the simplified writing used to indicate the __sa_handler.sa_sigaction field in sigaction.

SIG_HOLD   ((void (*)(int)) 2)

Defines the function behaviors such as sigset() and adds a specified signal to the process signal mask without changing the current processing mode of the signal.

sa_handler   __sa_handler.sa_handler

Defines the simplified writing used to indicate the __sa_handler.sa_handler field in sigaction.

sa_sigaction   __sa_handler.sa_sigaction

Defines the simplified writing used to indicate the __sa_handler.sa_sigaction field in sigaction.

SIGEV_SIGNAL   0

Sets the notification method in sigevent: signal notification.

SIGEV_NONE   1

Sets the notification method in sigevent: no notification.

SIGEV_THREAD   2

Sets the notification method in sigevent: thread notification.

SIGRTMIN   (__libc_current_sigrtmin())

Start of a reliable signal.

SIGRTMAX   (__libc_current_sigrtmax())

End of a reliable signal.

SIG_ERR   ((__sighandler_t)-1)

Defines the value returned when a function such as signal() fails.

SIG_DFL   ((__sighandler_t)0)

Defines the default signal processing mode.

SIG_IGN   ((__sighandler_t)1)

Defines the signal processing mode in which the signal is ignored.

Typedefs

Typedef Name

Description

ucontext_t

typedef struct __ucontext 

Describes the user execution context.

stack_t

typedef struct sigaltstack 

Describes a signal stack.

sighandler_t) (int)

typedef void(* 

Function pointer of signal handler.

Functions

Function Name

Description

kill (pid_t pid, int sig)

int 

Sends a signal to a specified process.

sigemptyset (sigset_t *set)

int 

Clears all signals in a specified signal set.

sigfillset (sigset_t *set)

int 

Adds all signals to a specified signal set.

sigaddset (sigset_t *set, int signum)

int 

Adds a signal to a specified signal set.

sigdelset (sigset_t *set, int signum)

int 

Delete a signal from a specified signal set.

sigismember (const sigset_t *set, int signum)

int 

Checks whether a signal is in the signal set.

sigprocmask (int how, const sigset_t *__restrict set, sigset_t *__restrict oldset)

int 

Changes the signal mask of the calling thread.

sigsuspend (const sigset_t *mask)

int 

Sets mask as the signal mask set of the current process and suspends the process until a signal processing action is triggered.

sigaction (int signum, const struct sigaction *__restrict act, struct sigaction *__restrict oldact)

int 

Checks or changes the processing action associated with a specified signal. Do not use the process creation function or thread creation function in the registered callback processing function. Otherwise, the process is abnormal. For example, do not use the fork or pthread_create function.

sigpending (sigset_t *set)

int 

Obtains the signal suspended by the current thread.

sigwait (const sigset_t *__restrict set, int *__restrict sig)

int 

Suspends the calling thread and waits for the signal.

sigwaitinfo (const sigset_t *__restrict set, siginfo_t *__restrict info)

int 

Suspends the calling thread and waits for the signal, with a timeout period specified.

sigtimedwait (const sigset_t *__restrict set, siginfo_t *__restrict info, const struct timespec *__restrict timeout)

int 

Suspends the calling thread and waits for the signal, with a timeout period specified.

pthread_sigmask (int how, const sigset_t *__restrict set, sigset_t *__restrict oldset)

int 

Checks or changes the signal mask of the calling thread.

psignal (int signum, const char *s)

void 

Prints signal information.

sigpause (int signum)

int 

Deletes the signal specified by signum from the signal mask of the calling process and suspends the process until the signal is received.

sighold (int signum)

int 

Adds the signal specified by signum to the signal mask of the calling process.

sigrelse (int signum)

int 

Deletes the signal specified by signum from the signal mask of the calling process.

sigisemptyset (const sigset_t *set)

int 

Checks whether the signal set is empty.

sigorset (sigset_t *dest, const sigset_t *left, const sigset_t *right)

int 

Adds the union set of left and right to dest.

sigandset (sigset_t *dest, const sigset_t *left, const sigset_t *right)

int 

Adds the intersection of left and right to dest.

signal (int signum, sighandler_t handler)

sighandler_t 

Changes the processing action of a specified signal. Do not use the process creation function or thread creation function in the registered callback processing function. Otherwise, the process is abnormal. For example, do not use the fork or pthread_create function.

raise (int signum)

int 

Sends a signal to the calling process.

1
https://gitee.com/cain_qin/docs.git
git@gitee.com:cain_qin/docs.git
cain_qin
docs
docs
master

搜索帮助