The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
signal.h File Reference

signals: kill, sigaction, masks. More...

#include <sys/types.h>

Go to the source code of this file.

Data Structures

struct  sigaction

Macros

#define SIGHUP   1
#define SIGINT   2
#define SIGQUIT   3
#define SIGILL   4
#define SIGTRAP   5
#define SIGABRT   6
#define SIGBUS   7
#define SIGFPE   8
#define SIGKILL   9
#define SIGUSR1   10
#define SIGSEGV   11
#define SIGUSR2   12
#define SIGPIPE   13
#define SIGALRM   14
#define SIGTERM   15
#define SIGCHLD   17
#define SIGCONT   18
#define SIGSTOP   19
#define SIGTSTP   20
#define SIGTTIN   21
#define SIGTTOU   22
#define SIGURG   23
#define SIGVTALRM   26
#define SIGPROF   27
#define SIGWINCH   28
#define NSIG   32
#define SIG_DFL   ((sighandler_t)0)
#define SIG_IGN   ((sighandler_t)1)
#define SIG_ERR   ((sighandler_t)-1)
#define SA_NOCLDSTOP   0x00000001
#define SA_RESTORER   0x04000000
#define SA_RESTART   0x10000000
#define SA_NODEFER   0x40000000
#define SA_RESETHAND   0x80000000
#define SIG_BLOCK   0
#define SIG_UNBLOCK   1
#define SIG_SETMASK   2

Typedefs

typedef unsigned int sigset_t
typedef int sig_atomic_t
typedef void(*) sighandler_t(int)

Functions

int sigaction (int sig, const struct sigaction *act, struct sigaction *oldact)
 read and change what the process does with a signal.
sighandler_t signal (int sig, sighandler_t handler)
 set a handler (with SA_RESTART, as BSD signal() does).
int kill (pid_t pid, int sig)
 send a signal to a process (pid > 0) or every process but init (-1).
int raise (int sig)
 send a signal to the calling process.
int sigprocmask (int how, const sigset_t *set, sigset_t *oldset)
 read and change the blocked mask.
int sigpending (sigset_t *set)
 the signals that are blocked and pending.
int sigsuspend (const sigset_t *mask)
 wait for a signal with a temporary mask.
int sigemptyset (sigset_t *set)
int sigfillset (sigset_t *set)
int sigaddset (sigset_t *set, int sig)
int sigdelset (sigset_t *set, int sig)
int sigismember (const sigset_t *set, int sig)

Detailed Description

signals: kill, sigaction, masks.

the numbers, flags and the kernel's sigaction layout are ABI and must match src/kernel/signal/signal.h exactly.

Macro Definition Documentation

◆ SIGHUP

#define SIGHUP   1

◆ SIGINT

#define SIGINT   2

◆ SIGQUIT

#define SIGQUIT   3

◆ SIGILL

#define SIGILL   4

◆ SIGTRAP

#define SIGTRAP   5

◆ SIGABRT

#define SIGABRT   6

◆ SIGBUS

#define SIGBUS   7

◆ SIGFPE

#define SIGFPE   8

◆ SIGKILL

#define SIGKILL   9

◆ SIGUSR1

#define SIGUSR1   10

◆ SIGSEGV

#define SIGSEGV   11

◆ SIGUSR2

#define SIGUSR2   12

◆ SIGPIPE

#define SIGPIPE   13

◆ SIGALRM

#define SIGALRM   14

◆ SIGTERM

#define SIGTERM   15

◆ SIGCHLD

#define SIGCHLD   17

◆ SIGCONT

#define SIGCONT   18

◆ SIGSTOP

#define SIGSTOP   19

◆ SIGTSTP

#define SIGTSTP   20

◆ SIGTTIN

#define SIGTTIN   21

◆ SIGTTOU

#define SIGTTOU   22

◆ SIGURG

#define SIGURG   23

◆ SIGVTALRM

#define SIGVTALRM   26

◆ SIGPROF

#define SIGPROF   27

◆ SIGWINCH

#define SIGWINCH   28

◆ NSIG

#define NSIG   32

◆ SIG_DFL

#define SIG_DFL   ((sighandler_t)0)

◆ SIG_IGN

#define SIG_IGN   ((sighandler_t)1)

◆ SIG_ERR

#define SIG_ERR   ((sighandler_t)-1)

◆ SA_NOCLDSTOP

#define SA_NOCLDSTOP   0x00000001

◆ SA_RESTORER

#define SA_RESTORER   0x04000000

◆ SA_RESTART

#define SA_RESTART   0x10000000

◆ SA_NODEFER

#define SA_NODEFER   0x40000000

◆ SA_RESETHAND

#define SA_RESETHAND   0x80000000

◆ SIG_BLOCK

#define SIG_BLOCK   0

◆ SIG_UNBLOCK

#define SIG_UNBLOCK   1

◆ SIG_SETMASK

#define SIG_SETMASK   2

Typedef Documentation

◆ sigset_t

typedef unsigned int sigset_t

◆ sig_atomic_t

typedef int sig_atomic_t

◆ sighandler_t

typedef void(*) sighandler_t(int)

Function Documentation

◆ sigaction()

int sigaction ( int sig,
const struct sigaction * act,
struct sigaction * oldact )

read and change what the process does with a signal.

Returns
0, or -1 (errno set; EINVAL for SIGKILL and SIGSTOP).

◆ signal()

sighandler_t signal ( int sig,
sighandler_t handler )

set a handler (with SA_RESTART, as BSD signal() does).

Returns
the old handler, or SIG_ERR.

◆ kill()

int kill ( pid_t pid,
int sig )

send a signal to a process (pid > 0) or every process but init (-1).

Returns
0, or -1 (errno set).

◆ raise()

int raise ( int sig)

send a signal to the calling process.

◆ sigprocmask()

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

read and change the blocked mask.

◆ sigpending()

int sigpending ( sigset_t * set)

the signals that are blocked and pending.

◆ sigsuspend()

int sigsuspend ( const sigset_t * mask)

wait for a signal with a temporary mask.

always returns -1 with EINTR.

◆ sigemptyset()

int sigemptyset ( sigset_t * set)

◆ sigfillset()

int sigfillset ( sigset_t * set)

◆ sigaddset()

int sigaddset ( sigset_t * set,
int sig )

◆ sigdelset()

int sigdelset ( sigset_t * set,
int sig )

◆ sigismember()

int sigismember ( const sigset_t * set,
int sig )