Tenok
A Linux-like Real-Time Operating System for Robotics and Internet of Things
Data Structures | Macros | Typedefs | Functions
signal.h File Reference
#include <sys/types.h>
Include dependency graph for signal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  sigval
 
struct  siginfo_t
 
struct  sigaction
 
struct  sigevent
 

Macros

#define SIGUSR1   10
 
#define SIGUSR2   12
 
#define SIGPOLL   29
 
#define SIGSTOP   19
 
#define SIGCONT   18
 
#define SIGKILL   9
 
#define SIGNAL_CNT   6
 
#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 SIGSEGV   11
 
#define SIGPIPE   13
 
#define SIGALRM   14
 
#define SIGTERM   15
 
#define SIGCHLD   17
 
#define SIGTSTP   20
 
#define SIGTTIN   21
 
#define SIGTTOU   22
 
#define SIGURG   23
 
#define SIGXCPU   24
 
#define SIGXFSZ   25
 
#define SIGVTALRM   26
 
#define SIGPROF   27
 
#define SIGWINCH   28
 
#define SIGSYS   31
 
#define NSIG   32
 
#define SIG_DFL   ((void (*)(int)) 0)
 
#define SIG_IGN   ((void (*)(int)) 1)
 
#define SIG_ERR   ((void (*)(int)) - 1)
 
#define SIG_BLOCK   0
 
#define SIG_UNBLOCK   1
 
#define SIG_SETMASK   2
 
#define SA_SIGINFO   0x2
 
#define SA_RESTART   0x10000000
 
#define SA_NOCLDSTOP   0x00000001
 
#define SIGEV_NONE   1
 
#define SIGEV_SIGNAL   2
 

Typedefs

typedef uint32_t sigset_t
 
typedef void(* sa_handler_t) (int)
 
typedef void(* sa_sigaction_t) (int, siginfo_t *, void *)
 

Functions

int sigemptyset (sigset_t *set)
 Initialize the signal set given by set to empty, with all signals excluded from the set. More...
 
int sigfillset (sigset_t *set)
 Initialize the signal set to full, including all signals. More...
 
int sigaddset (sigset_t *set, int signum)
 Add a signal into the set. More...
 
int sigdelset (sigset_t *set, int signum)
 Delete a signal from the set. More...
 
int sigismember (const sigset_t *set, int signum)
 Test whether sugnum is a member of the set. More...
 
sa_handler_t signal (int signum, sa_handler_t handler)
 Set up a handler for a signal, the older way POSIX keeps. More...
 
int sigprocmask (int how, const sigset_t *set, sigset_t *oldset)
 Read and replace the set of signals the thread blocks. Tenok blocks none, so the set is accepted and the old one reads back empty. More...
 
int sigsuspend (const sigset_t *mask)
 Wait for a signal that is not in the mask. Tenok blocks no signal, so there is never one to wait for and this always fails with EINTR. More...
 
int sigaction (int signum, const struct sigaction *act, struct sigaction *oldact)
 Set up a signal for the task to catch. More...
 
int sigwait (const sigset_t *set, int *sig)
 Suspend execution of the calling task until one of the signals specified in the signal set becomes pending. More...
 
int sigwaitinfo (const sigset_t *set, siginfo_t *info)
 Wait for a signal and return siginfo. More...
 
int sigtimedwait (const sigset_t *set, siginfo_t *info, const struct timespec *timeout)
 Wait for a signal with timeout. More...
 
int pause (void)
 To cause the calling task (or thread) to sleep until a signal is delivered that either terminate the task or cause the invocation of a signal-catching function. More...
 
int kill (pid_t pid, int sig)
 Send a signal to a task. More...
 
int raise (int sig)
 Send a signal to the calling task. More...
 

Function Documentation

◆ kill()

int kill ( pid_t  pid,
int  sig 
)

Send a signal to a task.

Parameters
pidThe task ID to provide.
sigThe signal number to provide.
Return values
int0 on success and nonzero error number on error.

◆ pause()

int pause ( void  )

To cause the calling task (or thread) to sleep until a signal is delivered that either terminate the task or cause the invocation of a signal-catching function.

Return values
int0 on success and nonzero error number on error.

◆ raise()

int raise ( int  sig)

Send a signal to the calling task.

Parameters
sigThe signal number to provide.
Return values
int0 on success and nonzero error number on error.

◆ sigaction()

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

Set up a signal for the task to catch.

Parameters
signumThe number of the signal to attach.
actPointer of the new action setting.
oldactFor preserving old action.
Return values
int0 on success and nonzero error number on error.

◆ sigaddset()

int sigaddset ( sigset_t *  set,
int  signum 
)

Add a signal into the set.

Parameters
setPointer to the signal set.
signumThe number of the signal to add into the set.
Return values
int0 on success and nonzero error number on error.

◆ sigdelset()

int sigdelset ( sigset_t *  set,
int  signum 
)

Delete a signal from the set.

Parameters
setPointer to the signal set
signumThe number of the signal to delete from the set
Return values
int0 on success and nonzero error number on error.

◆ sigemptyset()

int sigemptyset ( sigset_t *  set)

Initialize the signal set given by set to empty, with all signals excluded from the set.

Parameters
setPointer to the signal set.
Return values
int0 on success and nonzero error number on error.

◆ sigfillset()

int sigfillset ( sigset_t *  set)

Initialize the signal set to full, including all signals.

Parameters
setPointer to the signal set.
Return values
int0 on success and nonzero error number on error.

◆ sigismember()

int sigismember ( const sigset_t *  set,
int  signum 
)

Test whether sugnum is a member of the set.

Parameters
setPointer to the signal set.
signumThe number of the signal to check.
Return values
int0 on success and nonzero error number on error.

◆ signal()

sa_handler_t signal ( int  signum,
sa_handler_t  handler 
)

Set up a handler for a signal, the older way POSIX keeps.

Parameters
signumThe number of the signal to attach.
handlerThe function to call, SIG_DFL or SIG_IGN.
Return values
sa_handler_tThe handler that was in place, and SIG_ERR on error.

◆ sigprocmask()

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

Read and replace the set of signals the thread blocks. Tenok blocks none, so the set is accepted and the old one reads back empty.

Parameters
howSIG_BLOCK, SIG_UNBLOCK or SIG_SETMASK.
setThe set to apply.
oldsetFor returning the set that was in place.
Return values
int0 on success and -1 on error, with the reason left in errno.

◆ sigsuspend()

int sigsuspend ( const sigset_t *  mask)

Wait for a signal that is not in the mask. Tenok blocks no signal, so there is never one to wait for and this always fails with EINTR.

Parameters
maskThe signals to leave blocked while waiting.
Return values
intAlways -1, with the reason left in errno.

◆ sigtimedwait()

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

Wait for a signal with timeout.

Parameters
setPointer to the signal set.
infoFor returning signal info (optional).
timeoutRelative timeout.
Return values
intThe signal number on success and nonzero error number on error.

◆ sigwait()

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

Suspend execution of the calling task until one of the signals specified in the signal set becomes pending.

Parameters
setPointer to the signal set.
sigFor returning the caught signal.
Return values
int0 on success and nonzero error number on error.

◆ sigwaitinfo()

int sigwaitinfo ( const sigset_t *  set,
siginfo_t info 
)

Wait for a signal and return siginfo.

Parameters
setPointer to the signal set.
infoFor returning signal info (optional).
Return values
intThe signal number on success and nonzero error number on error.