Everything2
Near Matches
Ignore Exact
Full Text
Everything2

unix signals

created by quidfoabro

(thing) by kessenich (3.1 y) (print)   ?   (I like it!) Sat Apr 08 2000 at 7:43:54

Five conditions generate signals:

1. The kill system call allows a process to send a signal to another process or to itself. A signal, however, does not always terminate a process; some inform the process of a condition that the receiving process handles. To send a signal, the sending and receiving process must have the same user ID, or the sending process must be root.

2. The kill command is a program that takes its command line arguments and issues a kill system call.

3. Certain terminal characters generate signals. E.g., every interactive terminal is associated with an interrupt character and a quit character. The interrupt char.(usu. Ctrl-C or Delete) terminates a running process, and generates a SIGINT signal. The quit char. (usu. Ctrl-backslash) terminate a running process and generates a core image of it. This generates a SIGQUIT signal. You can set the interrupt character and quit character to almost any term character that you want. 4.3BSD has a terminal suspend character (usu. Ctrl-Z) to immediately generate a SIGTSTP signal, as well as a delayed terminal suspend character (usu. Ctrl-Y). The latter generates a SIGTSTP signal when the process attempts to read the character. The aforementioned signals are sent to the running process and to all processes in the terminal control group. They are normally sent from the kernel to a process.

4. Certain hardware conditions. E.g. floating point arithmetic errors generate a SIGFPE error. Referencing an address outside of a process' address space generates a SIGSEGV signal. The conditions and their generated signals can differ from one Unix implementation to another. These signals are normally sent from the kernel to a process.

5. Certain software conditions. E.g., the SIGURG signal is generated when out-of-band data arrives on a socket.

What a process can do with a signal:

1. Provide a function called a signal handler, which is called whenever a specific type of signal occurs (and remains installed after a signal occurs). It can do whatever the process wants to handle the condition - called catching the signal. BSD allows a process to block and unblock receipt of signals with a new system call, so when a process receives a signal, the kernel automatically blocks further receipt of the signal until the signal handler completes.

2. Ignore it. All signals, with the exception of SIGKILL and SIGSTOP, can be ignored.

3. Allow the default to occur. Normally a process is terminated on receipt of a signal, and certain signals generate a core image of the process in its current working directory. Under 4.3BSD, however, the default action for the SIGURG, SIGTSTP, SIGTTIN, and SIGTTOU signals is to stop the process.

The signal is remembered for delivery. This is called blocking a signal under 4.3BSD and holding a signal under System V. Both implementations can release one or more signals that are blocked while waiting for a signal to occur. The kernel handles signals only when a process returns from kernel mode to user mode. A process must run to handle signals. According to Dennis Ritchie, signals were designed as events that are fatal or ignored, and not necesarily handled.


printable version
chaos

SIGWINCH SIGINT SIGKILL SIGSTOP
Advanced Unix Programming sighup SIGALRM SIGSEGV
Signal 11 SIGTTIN SIGUSR1 How to pick up women
SIGTTOU SIGCHLD SIGABRT SIGTERM
Broken Pipe kill pinhole camera SIGFPE
run levels killall FIPS signal names
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
What you are reading:
It's always a good idea to tell people you love them if you do
Severe acute respiratory syndrome
CIA World Factbook - Hell
Gauss' Law
Mario Lemieux
monitor
Did Aum Shinrikyo set off a nuclear bomb in Western Australia in 1993?
Phase Maintenance
ad maiora natus sum
A Perverse Test
white tea
United Fruit Company
You, born of the water, could you ever live far from the sea?
New Writeups
Ysardo
a brother to a sister(personal)
antigravpussy
your warm whispers(personal)
Clarke
Multiculturalism(idea)
aneurin
Earl of Landaff(person)
Heitah
Pseudocide(idea)
XWiz
Google Knol(lede)
Mythi
July 24, 2008(personal)
locke baron
The fall of Earth(fiction)
BookReader
Fear the Cold(dream)
Pavlovna
Kathleen MacInnes(person)
stainedglass
1(fiction)
kalen
Three "T"s(idea)
octillion369
Undead(idea)
archiewood
Ico(fiction)
Heisenberg
Why I love Everything2(log)
Everything 2 is brought to you by the letter C and The Everything Development Company