posix-next API 0.1.0
Out-of-tree Zephyr POSIX module
Loading...
Searching...
No Matches
POSIX_SIGNALS

POSIX Signals option group. More...

Files

file  string.h
 <string.h>: POSIX extensions to the C string library
 

Functions

int kill (pid_t pid, int sig)
 Send a signal to a process or process group.
 
int killpg (pid_t pgrp, int sig)
 Send a signal to a process group (XSI extension).
 
void psiginfo (const siginfo_t *info, const char *message)
 Print a signal description with additional siginfo_t context.
 
void psignal (int sig, const char *message)
 Print a signal description to stderr.
 
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 sigaltstack (const stack_t *ZRESTRICT ss, stack_t *ZRESTRICT oss)
 Set or get the alternate signal stack (XSI extension).
 
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.
 
char * strsignal (int signo)
 Return a string describing a signal number.
 
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)

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

◆ kill()

int kill ( pid_t  pid,
int  sig 
)

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

◆ killpg()

int killpg ( pid_t  pgrp,
int  sig 
)

Send a signal to a process group (XSI extension).

Parameters
pgrpProcess group ID (0 = calling process's group).
sigSignal number.
Returns
0 on success, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/killpg.html

◆ pause()

int pause ( void  )

Suspend process execution until a signal is received.

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

◆ psiginfo()

void psiginfo ( const siginfo_t info,
const char *  message 
)

Print a signal description with additional siginfo_t context.

Parameters
infoSignal information.
messagePrefix string.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/psiginfo.html

◆ psignal()

void psignal ( int  sig,
const char *  message 
)

Print a signal description to stderr.

Parameters
sigSignal number.
messagePrefix string.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/psignal.html

◆ sigaction()

int sigaction ( int  sig,
const struct sigaction *ZRESTRICT  act,
struct sigaction *ZRESTRICT  oact 
)

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 
)

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

◆ sigaltstack()

int sigaltstack ( const stack_t *ZRESTRICT  ss,
stack_t *ZRESTRICT  oss 
)

Set or get the alternate signal stack (XSI extension).

Parameters
ssNew alternate stack descriptor, or NULL.
ossOutput: previous descriptor, or NULL.
Returns
0 on success, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaltstack.html

◆ sigdelset()

int sigdelset ( sigset_t set,
int  sig 
)

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)

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)

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 
)

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)

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 
)

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)

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 
)

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

◆ strsignal()

char * strsignal ( int  signo)

Return a string describing a signal number.

Returns a pointer to a locale-specific message string describing the signal whose number is signo. The contents of the string pointed to by the return value must not be modified by the application. The returned pointer may be invalidated by a subsequent call to strsignal().

Parameters
signoSignal number.
Returns
Pointer to a string describing the signal, or an unspecified string if signo is an unknown signal number.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/strsignal.html