posix-next API 0.1.0
Out-of-tree Zephyr POSIX module
Loading...
Searching...
No Matches
POSIX_SIGNALS
Implementation completeness: 100.0%100IMPLLine coverage: 84.4%84COVLinux compatibility tests: passing🐧Userspace tests: passingU

POSIX Signals option group. More...

Data Structures

struct  sigset_t
 Set of signals (bitmask). More...
 

Functions

int kill (pid_t pid, int sig)
 Send a signal to a process or process group.
 
int sigaction (int sig, const struct sigaction *ZRESTRICT act, struct sigaction *ZRESTRICT oact)
 Examine and change a signal action.
 
int sigaddset (sigset_t *set, int sig)
 Add a signal to a signal set.
 
int sigdelset (sigset_t *set, int sig)
 Delete a signal from a signal set.
 
int sigemptyset (sigset_t *set)
 Initialise a signal set to the empty set.
 
int sigfillset (sigset_t *set)
 Initialise a signal set to the full set (all signals).
 
int sighold (int sig)
 Add a signal to the calling process's signal mask (XSI, obsolescent).
 
int sigignore (int sig)
 Set a signal's disposition to SIG_IGN (XSI, obsolescent).
 
int siginterrupt (int sig, int flag)
 Control whether a signal restarts or interrupts system calls (XSI, obsolescent).
 
int sigismember (const sigset_t *set, int sig)
 Test whether a signal is a member of a signal set.
 
int sigpause (int sig)
 Suspend execution until a signal is delivered (XSI, obsolescent).
 
int sigpending (sigset_t *set)
 Retrieve the set of pending signals.
 
int sigprocmask (int how, const sigset_t *ZRESTRICT set, sigset_t *ZRESTRICT oset)
 Examine and change the calling process's signal mask.
 
int sigrelse (int sig)
 Remove a signal from the process signal mask (XSI, obsolescent).
 
sighandler_t sigset (int sig, sighandler_t disp)
 Set the disposition of a signal, optionally blocking it first (XSI, obsolescent).
 
int sigsuspend (const sigset_t *set)
 Wait for a signal, atomically replacing the process signal mask.
 
int sigwait (const sigset_t *ZRESTRICT set, int *ZRESTRICT sig)
 Wait for a signal from a set.
 
unsigned int alarm (unsigned int seconds)
 Schedule an alarm signal (SIGALRM) after a given number of seconds.
 
int pause (void)
 Suspend process execution until a signal is received.
 

Detailed Description

POSIX Signals option group.

Covers alarm(), pause(), kill(), sigaction(), sigprocmask(), sigsuspend(), sigpending(), and related signal-handling functions.

Function Documentation

◆ alarm()

unsigned int alarm ( unsigned int  seconds)
alarm line coverage: 100.0%100Linux compatibility tests: passing🐧Userspace tests: passingU

Schedule an alarm signal (SIGALRM) after a given number of seconds.

◆ kill()

int kill ( pid_t  pid,
int  sig 
)
Linux compatibility tests: passing🐧Userspace tests: passingU

Send a signal to a process or process group.

Parameters
pidTarget process ID (positive), process group (negative), or 0.
sigSignal number, or 0 to check process existence.
Returns
0 on success, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/kill.html

◆ pause()

int pause ( void  )
pause line coverage: 70.2%70Linux compatibility tests: passing🐧Userspace tests: passingU

Suspend process execution until a signal is received.

See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/pause.html

◆ sigaction()

int sigaction ( int  sig,
const struct sigaction *ZRESTRICT  act,
struct sigaction *ZRESTRICT  oact 
)
Linux compatibility tests: passing🐧Userspace tests: passingU

Examine and change a signal action.

Parameters
sigSignal number.
actNew action, or NULL to query.
oactOutput: previous action, or NULL.
Returns
0 on success, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaction.html

◆ sigaddset()

int sigaddset ( sigset_t set,
int  sig 
)
Linux compatibility tests: passing🐧Userspace tests: passingU

Add a signal to a signal set.

Parameters
setSignal set.
sigSignal number to add.
Returns
0 on success, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaddset.html

◆ sigdelset()

int sigdelset ( sigset_t set,
int  sig 
)
Linux compatibility tests: passing🐧Userspace tests: passingU

Delete a signal from a signal set.

Parameters
setSignal set.
sigSignal number to remove.
Returns
0 on success, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigdelset.html

◆ sigemptyset()

int sigemptyset ( sigset_t set)
Linux compatibility tests: passing🐧Userspace tests: passingU

Initialise a signal set to the empty set.

Parameters
setSignal set to clear.
Returns
0 on success, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigemptyset.html

◆ sigfillset()

int sigfillset ( sigset_t set)
Linux compatibility tests: passing🐧Userspace tests: passingU

Initialise a signal set to the full set (all signals).

Parameters
setSignal set to fill.
Returns
0 on success, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigfillset.html

◆ sighold()

int sighold ( int  sig)

Add a signal to the calling process's signal mask (XSI, obsolescent).

Parameters
sigSignal to block.
Returns
0 on success, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sighold.html

◆ sigignore()

int sigignore ( int  sig)

Set a signal's disposition to SIG_IGN (XSI, obsolescent).

Parameters
sigSignal to ignore.
Returns
0 on success, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigignore.html

◆ siginterrupt()

int siginterrupt ( int  sig,
int  flag 
)

Control whether a signal restarts or interrupts system calls (XSI, obsolescent).

Parameters
sigSignal number.
flagNon-zero to interrupt; 0 to restart.
Returns
0 on success, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/siginterrupt.html

◆ sigismember()

int sigismember ( const sigset_t set,
int  sig 
)
Linux compatibility tests: passing🐧Userspace tests: passingU

Test whether a signal is a member of a signal set.

Parameters
setSignal set to query.
sigSignal number to test.
Returns
1 if the signal is a member, 0 if not, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigismember.html

◆ sigpause()

int sigpause ( int  sig)

Suspend execution until a signal is delivered (XSI, obsolescent).

Parameters
sigSignal whose blocking is temporarily removed.
Returns
Always returns -1 with errno set to EINTR.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigpause.html

◆ sigpending()

int sigpending ( sigset_t set)
Linux compatibility tests: passing🐧Userspace tests: passingU

Retrieve the set of pending signals.

Parameters
setOutput: set of signals pending delivery to the calling process.
Returns
0 on success, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigpending.html

◆ sigprocmask()

int sigprocmask ( int  how,
const sigset_t *ZRESTRICT  set,
sigset_t *ZRESTRICT  oset 
)
Linux compatibility tests: passing🐧Userspace tests: passingU

Examine and change the calling process's signal mask.

Parameters
howSIG_BLOCK, SIG_UNBLOCK, or SIG_SETMASK.
setSignal set to apply, or NULL.
osetOutput: previous mask, or NULL.
Returns
0 on success, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigprocmask.html

◆ sigrelse()

int sigrelse ( int  sig)

Remove a signal from the process signal mask (XSI, obsolescent).

Parameters
sigSignal to unblock.
Returns
0 on success, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigrelse.html

◆ sigset()

sighandler_t sigset ( int  sig,
sighandler_t  disp 
)

Set the disposition of a signal, optionally blocking it first (XSI, obsolescent).

Parameters
sigSignal number.
dispNew disposition (SIG_DFL, SIG_IGN, SIG_HOLD, or a handler).
Returns
Previous disposition on success, or SIG_ERR on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigset.html

◆ sigsuspend()

int sigsuspend ( const sigset_t set)
Linux compatibility tests: passing🐧Userspace tests: passingU

Wait for a signal, atomically replacing the process signal mask.

Parameters
setNew signal mask to apply while waiting.
Returns
Always returns -1 with errno set to EINTR.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigsuspend.html

◆ sigwait()

int sigwait ( const sigset_t *ZRESTRICT  set,
int *ZRESTRICT  sig 
)
Linux compatibility tests: passing🐧Userspace tests: passingU

Wait for a signal from a set.

Parameters
setOutput signal set to wait on.
sigOutput: number of the accepted signal.
Returns
0 on success, or a positive error number on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigwait.html