In questo caso è possibile una situazione in cui i segnali possono essere
perduti; si consideri il seguente segmento di codice in cui la prima
operazione del manipolatore è quella di reinstallare se stesso:
-\begin{lstlisting}{showlines=false}
-
+\begin{lstlisting}[labelstep=0,frame=,indent=1cm]{}
int sig_handler(); /* handler function */
...
signal(SIGINT, sig_handler); /* establish handler */
processo l'occorrenza del segnale. Si consideri il seguente segmento di
codice il cui scopo sarebbe quello di fermare il processo fino all'occorrenza
di un opportuno segnale:
-\begin{lstlisting}{}
+\begin{lstlisting}[labelstep=0,frame=,indent=1cm]{}
int signal_flag = 0;
main ()
{
In \ntab\ si è riportato l'elenco completo dei segnali definiti in Linux
(estratto dalle man page), comparati con quelli definiti in vari standard.
\begin{table}[htb]
+ \footnotesize
\centering
\begin{tabular}[c]{|l|c|c|c||c|p{8cm}|}
\hline
SIGTSTP &$\bullet$&&$\bullet$& D & Stop typed at tty \\
SIGTTIN &$\bullet$&&$\bullet$& D & tty input for background process \\
SIGTTOU &$\bullet$&&$\bullet$& D & tty output for background process \\
- SIGBUS &&$\bullet$&$\bullet$& C & Bus error (bad memory access) \\
- SIGPOLL &&$\bullet$&$\bullet$& A & Pollable event (Sys V). Synonym of SIGIO\\
+ SIGBUS &&$\bullet$&$\bullet$& C & Bus error (bad memory access) \\
+ SIGPOLL &&$\bullet$&$\bullet$& A & Pollable event (Sys V). Synonym of SIGIO\\
SIGPROF &&$\bullet$&$\bullet$& A & Profiling timer expired \\
SIGSYS &&$\bullet$&$\bullet$& C & Bad argument to routine (SVID)\\
SIGTRAP &&$\bullet$&$\bullet$& C & Trace/breakpoint trap \\
L'azione di default di questi segnali è di terminare il processo, questi
segnali sono:
\begin{description}
-\item \texttt{SIGPIPE}
-\item \texttt{SIGLOST}
-\item \texttt{SIGXCPU}
-\item \texttt{SIGXFSZ}
+\item \texttt{SIGPIPE} Sta per \textit{Broken pipe}. Se si usano delle pipes o
+ delle FIFO è necessario che, prima che un processo inizi a scrivere su di
+ essa, un'altro abbia aperto la pipe in lettura (si veda
+ \secref{sec:ipc_pipes}). Se il processo in lettura non è partito o è
+ terminato inavvertitamente alla scrittura sulla pipe il kernel genera questo
+ segnale. Se il segnale è bloccato, intercettato o ignorato la chiamata che
+ lo ha causato fallisce restituendo l'errore \macro{EPIPE}
+\item \texttt{SIGLOST} Sta per \textit{Resource lost}.
+\item \texttt{SIGXCPU} Sta per \textit{CPU time limit exceeded}.
+\item \texttt{SIGXFSZ} Sta per \textit{File size limit exceeded}.
\end{description}