O'Reilly logo

Hands-On System Programming with Linux by Kaiwan N Billimoria

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Running of case 2 – SA_NODEFER bit set

Next, we execute the test case, wherein the SA_NODEFER flag is set (first ensure you have killed off any old instances of the defer_or_not process):

$ ./defer_or_not 2PID 3215: running with the SA_NODEFER signal flag SetProcess awaiting signals ...

Now, in another Terminal window, we run the shell script:

$ ./bombard_sig.sh $(pgrep defer_or_not) 12

As soon as the script runs, firing off (12) signals to the process, the output is as follows:

sighdlr: signal 10, s=1 ; total=1; stack 0x7ffe9e17a0b0 :sighdlr: signal 10, s=2 ; total=2; stack 0x7ffe9e1799b0 :2sighdlr: signal 10, s=3 ; total=3; stack 0x7ffe9e1792b0 :3sighdlr: signal 10, s=4 ; total=4; stack 0x7ffe9e178bb0 :4sighdlr: signal 10, s=5 ; total=5; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required