Advanced Programming in the UNIX® Environment
ptg10805159 Section 10.13 sigpendingFunction 347 #include "apue.h" #include <errno.h> void pr_mask(const char *str) { sigs ...
ptg10805159 348 Signals Chapter 10 Example Figure10.15 shows many of the signal features that we’ve been describing. #include "a ...
ptg10805159 Section 10.14 sigactionFunction 349 The process blocksSIGQUIT,saving its current signal mask (to restorelater), and ...
ptg10805159 350 Signals Chapter 10 #include <signal.h> int sigaction(intsigno,const struct sigaction *restrict act, struct ...
ptg10805159 Section 10.14 sigactionFunction 351 FreeBSD Linux Mac OS X Solaris Option SUS 8.0 3.2.0 10.6.8 10 Description SA_INT ...
ptg10805159 352 Signals Chapter 10 Normally,the signal handler is called as void handler(intsigno); but if theSA_SIGINFOflag is ...
ptg10805159 Section 10.14 sigactionFunction 353 Theuc_stackfield describes the stack used by the current context. It contains at ...
ptg10805159 354 Signals Chapter 10 Example —signalFunction Let’s now implement thesignalfunction usingsigaction.This is what man ...
ptg10805159 Section 10.15 sigsetjmpandsiglongjmpFunctions 355 Example —signal_intrFunction Figure10.19 shows a version of the si ...
ptg10805159 356 Signals Chapter 10 #include <setjmp.h> int sigsetjmp(sigjmp_bufenv,intsavemask); Returns: 0 if called dire ...
ptg10805159 Section 10.15 sigsetjmpandsiglongjmpFunctions 357 { time_t starttime; if (canjump == 0) return; /* unexpected signal ...
ptg10805159 358 Signals Chapter 10 main signal() signal() pr_mask() sigsetjmp() pause() SIGUSR1delivered sig_usr1 pr_mask() alar ...
ptg10805159 Section 10.16 sigsuspendFunction 359 10.16 sigsuspendFunction We have seen how we can change the signal mask for a p ...
ptg10805159 360 Signals Chapter 10 Example Figure10.22 shows the correct way to protect a critical region of code from a specifi ...
ptg10805159 Section 10.16 sigsuspendFunction 361 static void sig_int(int signo) { pr_mask("\nin sig_int: "); } Figure 10.22 Prot ...
ptg10805159 362 Signals Chapter 10 err_sys("signal(SIGQUIT) error"); sigemptyset(&zeromask); sigemptyset(&newmask); siga ...
ptg10805159 Section 10.16 sigsuspendFunction 363 #include "apue.h" static volatile sig_atomic_t sigflag; /* set nonzero by sig h ...
ptg10805159 364 Signals Chapter 10 { while (sigflag == 0) sigsuspend(&zeromask); /* and wait for child */ sigflag = 0; /* Re ...
ptg10805159 Section 10.17 abortFunction 365 We test each of the global flags beforecallingreadand again ifreadreturns an interru ...
ptg10805159 366 Signals Chapter 10 4.3BSD generated theSIGILLsignal. Beforedoing this, the 4.3BSD function unblocked the signal ...
«
15
16
17
18
19
20
21
22
23
24
»
Free download pdf