MentOS
0.8.0
The Mentoring Operating System
|
Signals definition. More...
Go to the source code of this file.
Classes | |
struct | sigset |
Structure used to mask and unmask signals. More... | |
struct | sigaction |
Holds the information on how to handle a specific signal. More... | |
union | sigval |
Data passed with signal info. More... | |
struct | siginfo |
Stores information about an occurrence of a specific signal. More... | |
Macros | |
#define | SA_NOCLDSTOP 0x00000001U |
Turn off SIGCHLD when children stop. | |
#define | SA_NOCLDWAIT 0x00000002U |
Flag on SIGCHLD to inhibit zombies. | |
#define | SA_SIGINFO 0x00000004U |
sa_sigaction specifies the signal-handling function for signum. | |
#define | SA_ONSTACK 0x08000000U |
Indicates that a registered stack_t will be used. | |
#define | SA_RESTART 0x10000000U |
Flag to get restarting signals (which were the default long ago) | |
#define | SA_NODEFER 0x40000000U |
Prevents the current signal from being masked in the handler. | |
#define | SA_RESETHAND 0x80000000U |
Clears the handler when the signal is delivered. | |
#define | SIG_DFL ((sighandler_t)0) |
Default signal handling. | |
#define | SIG_IGN ((sighandler_t)1) |
Ignore signal. | |
#define | SIG_ERR ((sighandler_t)-1) |
Error return from signal. | |
Typedefs | |
typedef void(* | sighandler_t) (int) |
Type of a signal handler. | |
typedef struct sigset | sigset_t |
Structure used to mask and unmask signals. More... | |
typedef struct sigaction | sigaction_t |
Holds the information on how to handle a specific signal. | |
typedef union sigval | sigval_t |
Data passed with signal info. | |
typedef struct siginfo | siginfo_t |
Stores information about an occurrence of a specific signal. | |
Functions | |
int | kill (pid_t pid, int sig) |
Send signal to a process. More... | |
sighandler_t | signal (int signum, sighandler_t handler) |
Sets the disposition of the signal signum to handler. More... | |
int | sigaction (int signum, const sigaction_t *act, sigaction_t *oldact) |
Examine and change a signal action. More... | |
int | sigprocmask (int how, const sigset_t *set, sigset_t *oldset) |
Examine and change blocked signals. More... | |
const char * | strsignal (int sig) |
Returns the string describing the given signal. More... | |
int | sigemptyset (sigset_t *set) |
Prepare an empty set. More... | |
int | sigfillset (sigset_t *set) |
Prepare a full set. More... | |
int | sigaddset (sigset_t *set, int signum) |
Adds the given signal to the correct set. More... | |
int | sigdelset (sigset_t *set, int signum) |
Removes the given signal to the correct set. More... | |
int | sigismember (sigset_t *set, int signum) |
Checks if the given signal is part of the set. More... | |
Signals definition.
Structure used to mask and unmask signals.
Each unsigned long consists of 32 bits, thus, the maximum number of signals that may be declared is 64. Signals are divided into two cathegories, identified by the two unsigned longs: [ 1, 31] corresponds to normal signals; [32, 64] corresponds to real-time signals.
enum sigmask_how_t |
Defines what to do with the provided signal mask.
enum signal_sender_code_t |
Codes that indentify the sender of a signal.
Enumerator | |
---|---|
SI_NOINFO | Unable to determine complete signal information. |
SI_USER | Signal sent by kill(), pthread_kill(), raise(), abort() or alarm(). |
SI_KERNEL | Generic kernel function. |
SI_QUEUE | Signal was sent by sigqueue(). |
SI_TIMER | Signal was generated by expiration of a timer set by timer_settimer(). |
SI_ASYNCIO | Signal was generated by completion of an asynchronous I/O request. |
SI_MESGQ | Signal was generated by arrival of a message on an empty message queue. |
ILL_ILLOPC | Illegal opcode. |
ILL_ILLOPN | Illegal operand. |
ILL_ILLADR | Illegal addressing mode. |
ILL_ILLTRP | Illegal trap. |
ILL_PRVOPC | Privileged opcode. |
ILL_PRVREG | Privileged register. |
ILL_COPROC | Coprocessor error. |
ILL_BADSTK | Internal stack error. |
FPE_INTDIV | Integer divide-by-zero. |
FPE_INTOVF | Integer overflow. |
FPE_FLTDIV | Floating point divide-by-zero. |
FPE_FLTOVF | Floating point overflow. |
FPE_FLTUND | Floating point underflow. |
FPE_FLTRES | Floating point inexact result. |
FPE_FLTINV | Invalid floating point operation. |
FPE_FLTSUB | Subscript out of range. |
SEGV_MAPERR | Address not mapped. |
SEGV_ACCERR | Invalid permissions. |
BUS_ADRALN | Invalid address alignment. |
BUS_ADRERR | Non-existent physical address. |
BUS_OBJERR | Object-specific hardware error. |
TRAP_BRKPT | Process breakpoint. |
TRAP_TRACE | Process trace trap. |
CLD_EXITED | Child has exited. |
CLD_KILLED | Child has terminated abnormally and did not create a core file. |
CLD_DUMPED | Child has terminated abnormally and created a core file. |
CLD_TRAPPED | Traced child has trapped. |
CLD_STOPPED | Child has stopped. |
CLD_CONTINUED | Stopped child has continued. |
POLL_IN | Data input available. |
POLL_OUT | Output buffers available. |
POLL_MSG | Input message available. |
POLL_ERR | I/O error. |
POLL_PRI | High priority input available. |
POLL_HUP | Device disconnected. |
SI_NOINFO | Unable to determine complete signal information. |
SI_USER | Signal sent by kill(), pthread_kill(), raise(), abort() or alarm(). |
SI_KERNEL | Generic kernel function. |
SI_QUEUE | Signal was sent by sigqueue(). |
SI_TIMER | Signal was generated by expiration of a timer set by timer_settimer(). |
SI_ASYNCIO | Signal was generated by completion of an asynchronous I/O request. |
SI_MESGQ | Signal was generated by arrival of a message on an empty message queue. |
ILL_ILLOPC | Illegal opcode. |
ILL_ILLOPN | Illegal operand. |
ILL_ILLADR | Illegal addressing mode. |
ILL_ILLTRP | Illegal trap. |
ILL_PRVOPC | Privileged opcode. |
ILL_PRVREG | Privileged register. |
ILL_COPROC | Coprocessor error. |
ILL_BADSTK | Internal stack error. |
FPE_INTDIV | Integer divide-by-zero. |
FPE_INTOVF | Integer overflow. |
FPE_FLTDIV | Floating point divide-by-zero. |
FPE_FLTOVF | Floating point overflow. |
FPE_FLTUND | Floating point underflow. |
FPE_FLTRES | Floating point inexact result. |
FPE_FLTINV | Invalid floating point operation. |
FPE_FLTSUB | Subscript out of range. |
SEGV_MAPERR | Address not mapped. |
SEGV_ACCERR | Invalid permissions. |
BUS_ADRALN | Invalid address alignment. |
BUS_ADRERR | Non-existent physical address. |
BUS_OBJERR | Object-specific hardware error. |
TRAP_BRKPT | Process breakpoint. |
TRAP_TRACE | Process trace trap. |
CLD_EXITED | Child has exited. |
CLD_KILLED | Child has terminated abnormally and did not create a core file. |
CLD_DUMPED | Child has terminated abnormally and created a core file. |
CLD_TRAPPED | Traced child has trapped. |
CLD_STOPPED | Child has stopped. |
CLD_CONTINUED | Stopped child has continued. |
POLL_IN | Data input available. |
POLL_OUT | Output buffers available. |
POLL_MSG | Input message available. |
POLL_ERR | I/O error. |
POLL_PRI | High priority input available. |
POLL_HUP | Device disconnected. |
enum signal_type_t |
List of signals.
Enumerator | |
---|---|
SIGHUP | Hang up detected on controlling terminal or death of controlling process. |
SIGINT | Issued if the user sends an interrupt signal (Ctrl + C). |
SIGQUIT | Issued if the user sends a quit signal (Ctrl + D). |
SIGILL | Illegal Instruction. |
SIGTRAP | Trace/breakpoint trap. |
SIGABRT | Abort signal from abort(). |
SIGEMT | Emulator trap. |
SIGFPE | Floating-point arithmetic exception. |
SIGKILL | If a process gets this signal it must quit immediately and will not perform any clean-up operations. |
SIGBUS | Bus error (bad memory access). |
SIGSEGV | Invalid memory reference. |
SIGSYS | Bad system call (SVr4). |
SIGPIPE | Broken pipe: write to pipe with no readers. |
SIGALRM | Alarm clock signal (used for timers). |
SIGTERM | Software termination signal (sent by kill by default). |
SIGUSR1 | User-defined signal 1. |
SIGUSR2 | User-defined signal 2. |
SIGCHLD | Child stopped or terminated. |
SIGPWR | Power failure. |
SIGWINCH | Window resize signal. |
SIGURG | Urgent condition on socket. |
SIGPOLL | Pollable event. |
SIGSTOP | Stop process. |
SIGTSTP | Stop typed at terminal. |
SIGCONT | Continue if stopped. |
SIGTTIN | Terminal input for background process. |
SIGTTOU | Terminal output for background process. |
SIGVTALRM | Virtual alarm clock. |
SIGPROF | Profiling timer expired. |
SIGXCPU | CPU time limit exceeded. |
SIGXFSZ | File size limit exceeded. |
SIGHUP | Hang up detected on controlling terminal or death of controlling process. |
SIGINT | Issued if the user sends an interrupt signal (Ctrl + C). |
SIGQUIT | Issued if the user sends a quit signal (Ctrl + D). |
SIGILL | Illegal Instruction. |
SIGTRAP | Trace/breakpoint trap. |
SIGABRT | Abort signal from abort(). |
SIGEMT | Emulator trap. |
SIGFPE | Floating-point arithmetic exception. |
SIGKILL | If a process gets this signal it must quit immediately and will not perform any clean-up operations. |
SIGBUS | Bus error (bad memory access). |
SIGSEGV | Invalid memory reference. |
SIGSYS | Bad system call (SVr4). |
SIGPIPE | Broken pipe: write to pipe with no readers. |
SIGALRM | Alarm clock signal (used for timers). |
SIGTERM | Software termination signal (sent by kill by default). |
SIGUSR1 | User-defined signal 1. |
SIGUSR2 | User-defined signal 2. |
SIGCHLD | Child stopped or terminated. |
SIGPWR | Power failure. |
SIGWINCH | Window resize signal. |
SIGURG | Urgent condition on socket. |
SIGPOLL | Pollable event. |
SIGSTOP | Stop process. |
SIGTSTP | Stop typed at terminal. |
SIGCONT | Continue if stopped. |
SIGTTIN | Terminal input for background process. |
SIGTTOU | Terminal output for background process. |
SIGVTALRM | Virtual alarm clock. |
SIGPROF | Profiling timer expired. |
SIGXCPU | CPU time limit exceeded. |
SIGXFSZ | File size limit exceeded. |
int kill | ( | pid_t | pid, |
int | sig | ||
) |
Send signal to a process.
pid | The pid of the process to which we send the signal. |
sig | The type of signal to send. |
int sigaction | ( | int | signum, |
const sigaction_t * | act, | ||
sigaction_t * | oldact | ||
) |
Examine and change a signal action.
signum | Specifies the signal and can be any valid signal except SIGKILL and SIGSTOP. |
act | If non-NULL, the new action for signal signum is installed from act. |
oldact | If non-NULL, the previous action is saved in oldact. |
int sigaddset | ( | sigset_t * | set, |
int | signum | ||
) |
Adds the given signal to the correct set.
set | The set to manipulate. |
signum | The signalt to handle. |
int sigdelset | ( | sigset_t * | set, |
int | signum | ||
) |
Removes the given signal to the correct set.
set | The set to manipulate. |
signum | The signalt to handle. |
int sigemptyset | ( | sigset_t * | set | ) |
Prepare an empty set.
set | The set to manipulate. |
int sigfillset | ( | sigset_t * | set | ) |
Prepare a full set.
set | The set to manipulate. |
int sigismember | ( | sigset_t * | set, |
int | signum | ||
) |
Checks if the given signal is part of the set.
set | The set to manipulate. |
signum | The signalt to handle. |
sighandler_t signal | ( | int | signum, |
sighandler_t | handler | ||
) |
Sets the disposition of the signal signum to handler.
signum | The signal number. |
handler | The handler for the signal. |
Examine and change blocked signals.
how | Determines the behavior of the call. |
set | The set of signals to manage by the function. |
oldset | If non-NULL, the previous value of the signal mask is stored here. |
If set is NULL, then the signal mask is unchanged (i.e., how is ignored), but the current value of the signal mask is nevertheless returned in oldset (if it is not NULL).
const char* strsignal | ( | int | sig | ) |
Returns the string describing the given signal.
sig | The signal to inquire. |