|
455 | 455 | \texttt{sa\_sigaction} member of the structure \texttt{sigaction} must be used |
456 | 456 | for the handler, not \texttt{sa\_handler}. The new handler has three parameters |
457 | 457 | and it is possible to learn the PID of a signalling process, its UID, and more. |
458 | | -See manual page \texttt{signal.h(3HEAD)} on Solaris, the online SUS |
| 458 | +See manual page \texttt{signal.h(3HEAD)} on Linux or Solaris, the online SUS |
459 | 459 | specification of the header file, or the book [POSIX.4], page |
460 | 460 | \pageref{REF_PROGRAMMING}. More information is also on page \pageref{POSIX} and |
461 | 461 | \pageref{SIGWAITINFO}. Examples: \example{sig\-nals/siginfo.c}, |
|
574 | 574 | \sltitle{Example: blocking signals} |
575 | 575 | \setlength{\baselineskip}{0.8\baselineskip} |
576 | 576 | \begin{alltt} |
577 | | -sigset\_t sigs, osigs; struct sigaction sa; |
| 577 | +sigset\_t sigs, osigs; struct sigaction sa = \{ 0 \}; |
578 | 578 | sigfillset(&sigs); \emprg{sigprocmask}(SIG\_BLOCK, &sigs, &osigs); |
579 | 579 | switch(cpid = fork()) \{ |
580 | 580 | case -1: |
581 | 581 | \emprg{sigprocmask}(SIG\_SETMASK, &osigs, NULL); |
582 | 582 | ... |
583 | 583 | case 0: /* Child */ |
584 | | - sa.sa\_handler = h\_cld; sigemptyset(&sa.sa\_mask); |
585 | | - sa.sa\_flags = 0; |
| 584 | + sa.sa\_handler = h\_cld; |
586 | 585 | \emprg{sigaction}(SIGINT, &sa, NULL); |
587 | 586 | \emprg{sigprocmask}(SIG\_SETMASK, &osigs, NULL); |
588 | 587 | ... |
|
602 | 601 | signal mask, see page \pageref{FORK}. |
603 | 602 | \item Out of simplicity we block all the signals in the example even that on |
604 | 603 | pages \pageref{SPECIALSIGNALS} and \pageref{THREADS_SIGWAIT} it is explained why |
605 | | -it is not a good thing. |
| 604 | +it is not a good idea. |
606 | 605 | \end{itemize} |
607 | 606 |
|
608 | 607 | %%%%% |
|
0 commit comments