Signals provide a mechanism for notifying processes of system events.
They also function as a primitive mechanism for communication and
synchronization between user processes. ManRiX supports POSIX signals.
It has also a limited support of POSIX real-time signals. ManRiX
supports 32 different signals. 26 of them are standard POSIX signals
and 5 are Real-time Signals. In ManRiX signal handlers are per process
objects. All threads in a process share same signals handlers but
have their own signal mask.
The supported non-real signals are (from SUSV3)
Signal
|
Default
Action |
Description
|
SIGABRT
|
A
|
Process
abort signal. |
SIGALRM
|
T
|
Alarm
clock. |
SIGBUS
|
A
|
Access
to an undefined portion of a memory object. |
SIGCHLD
|
I
|
Child
process terminated, stopped, |
|
|
or
continued. |
SIGCONT
|
C
|
Continue
executing, if stopped. |
SIGFPE
|
A
|
Erroneous
arithmetic operation. |
SIGHUP
|
T
|
Hangup.
|
SIGILL
|
A
|
Illegal
instruction. |
SIGINT
|
T
|
Terminal
interrupt signal. |
SIGKILL
|
T
|
Kill
(cannot be caught or ignored). |
SIGPIPE
|
T
|
Write
on a pipe with no one to read it. |
SIGQUIT
|
A
|
Terminal
quit signal. |
SIGSEGV
|
A
|
Invalid
memory reference. |
SIGSTOP
|
S
|
Stop
executing (cannot be caught or ignored). |
SIGTERM
|
T
|
Termination
signal. |
SIGTSTP
|
S
|
Terminal
stop signal. |
SIGTTIN
|
S
|
Background
process attempting read. |
SIGTTOU
|
S
|
Background
process attempting write. |
SIGUSR1
|
T
|
User-defined
signal 1. |
SIGUSR2
|
T
|
User-defined
signal 2. |
SIGPOLL
|
T
|
Pollable
event. |
SIGPROF
|
T
|
Profiling
timer expired. |
SIGSYS
|
A
|
Bad
system call. |
SIGTRAP
|
A
|
Trace/breakpoint
trap. |
SIGURG
|
I
|
High
bandwidth data is available at a socket. |
SIGVTALRM
|
T
|
Virtual
timer expired. |
SIGXCPU
|
A
|
CPU
time limit exceeded. |
SIGXFSZ
|
A
|
File
size limit exceeded. |
Where,
First row denotes Symbolic Name for signal. Second row shows the
default action to take on signal receipt.
I = ignore
T = terminate
A = Abort
S = Stop process
C = Continue process
The real time signals are from SIGRTMIN to SIGRTMAX. The signal
handlers are the per process entity whereas signal mask are per
thread entity. If a thread catches a thread, it affects all the
threads belonging to that process. If a signal is targeted to a
process, the thread which has that signal unblocked will receive
the signal. The signal is checked while returning from kernel. So,
the signal may not be delivered as soon as it arrives.
In microkernel, all signals are queued. The ignored signals are
not queued. Our OS has 5 system calls related to POSIX signals.
1.Signal_action:This
system call defines action to take on receipt of a signal. The parameters
are
signal number
Pointer to act structure
Pointer to oact structure
This
system call is used to service following POSIX calls.
int sigaction(int sig , const struct sigaction *restrict
act ,
struct sigaction *restrict
oact );
void (*signal(int sig , void (* func )(int)))(int);
(ISO C standard)
- sig_mask
This system call change blocked signal mask of a thread. The
parameters are:
How field
Pointer to set structure
Pointer to oset structure
This
system call is used to service following POSIX calls.
int pthread_sigmask(int how , const sigset_t *restrict
set ,
sigset_t *restrict oset
);
int sigprocmask(int how , const sigset_t *restrict set
,
sigset_t *restrict oset
);
kill
This
system call sends a signal to a particular thread or process. The
parameters are:
pid or tid
signal number
flags
SIG_REAL
/* for sigqueue */
TO_THREAD /* signal sent to a thread eg. pthread_kill()*/
TO_PROCESS /* signal sent to a process eg. kill() */
pointer to sigval (used by sigqueue)
This
system call is used to service following POSIX calls.
int kill(pid_t pid , int sig );
int raise(int sig );
int sigqueue(pid_t pid , int signo , const union
sigval value );
int pthread_kill(pthread_t thread , int sig );
signal_suspend
:
This
system call suspends the thread until any signal is delivered. The
parameters are:
signal set (used by sigsuspend)
This
system call is used to service following POSIX calls.
int sigsuspend(const sigset_t * sigmask );
int pause(void);
1. sigreturn
This system call is used to return from user's signal handler.
|