The Linux Programming Interface
Program Execution 577 z If the exec() call fails for some reason, we may want to keep the file descriptors open. If they are alr ...
578 Chapter 27 Listing 27-6: Setting the close-on-exec flag for a file descriptor –––––––––––––––––––––––––––––––––––––––––––––– ...
Program Execution 579 specification of signals, which doesn’t specify signal blocking; therefore, C pro- grams written on non-UN ...
580 Chapter 27 be available if the program called chroot() before calling system(). If command is non-NULL, then the return valu ...
Program Execution 581 Listing 27-7: Executing shell commands with system() ––––––––––––––––––––––––––––––––––––––––––––––––––––– ...
582 Chapter 27 only to the words produced by shell expansions. In addition, modern shells reset IFS (to a string consisting of t ...
Program Execution 583 case 0: / Child / execl("/bin/sh", "sh", "-c", command, (char ) NULL); _exit(127); / Failed exec */ defaul ...
584 Chapter 27 child. However, both the calling program and the sleep process would, by default, be killed by these signals. How ...
Program Execution 585 An improved system() implementation Listing 27-9 shows an implementation of system() conforming to the rul ...
586 Chapter 27 z On return from fork() in the child, the disposition of SIGINT and SIGQUIT is SIG_IGN (i.e., the disposition inh ...
Program Execution 587 sigemptyset(&blockMask); / Block SIGCHLD / sigaddset(&blockMask, SIGCHLD); w sigprocmask(SIG_BLOCK ...
588 Chapter 27 Further details on system() Portable applications should ensure that system() is not called with the disposition ...
Program Execution 589 27.9 Exercises 27-1. The final command in the following shell session uses the program in Listing 27-3 to ...
590 Chapter 27 27-5. When we run the following program, we find it produces no output. Why is this? #include "tlpi_hdr.h" int ma ...
PROCESS CREATION AND PROGRAM EXECUTION IN MORE DETAIL This chapter extends the material presented in Chapters 24 to 27 by coveri ...
592 Chapter 28 In kernels before 2.6.10, a separate process accounting record was written for each thread created using the NPTL ...
Process Creation and Program Execution in More Detail 593 if (acct(argv[1]) == -1) errExit("acct"); printf("Process accounting % ...
594 Chapter 28 z The comp_t type is a kind of floating-point number. Values of this type are sometimes called compressed clock t ...
Process Creation and Program Execution in More Detail 595 $ su Need privilege to enable process accounting Password: # touch pac ...
596 Chapter 28 In the output, we see one line for each process that was created in the shell session. The ulimit and echo comman ...
«
27
28
29
30
31
32
33
34
35
36
»
Free download pdf