Hands-On System Programming with Linux by Kaiwan N. Billimoria
Author:Kaiwan N. Billimoria
Language: eng
Format: epub
Tags: COM046070 - COMPUTERS / Operating Systems / Linux, COM046030 - COMPUTERS / Operating Systems / UNIX, COM051060 - COMPUTERS / Programming Languages / C
Publisher: Packt Publishing
Published: 2018-10-31T10:13:04+00:00
Querying the signal mask
So, we understand that you can set the process's signal mask at the time of sigaction(2) (via the sa_mask member), or via the sigprocmask(2) system call (as mentioned previously). But how exactly can you query the state of the process signal mask at any arbitrary point in time?
Well, again, via the sigprocmask(2) system call. But, logically, this API sets a mask, right? This is the trick: if the first parameter set is set to NULL, then the second parameter is effectively ignored, while in the third parameter oldset, the current signal mask value is populated, and thus we can query the signal mask without altering it.
The ch11/query_mask program demonstrates this, the code is built upon our previous example sig2.c. Hence, we do not need to show the entire source; we just show the relevant code, in main():
[...]
/* Init sigaction:
* setup 'my_handler' as the signal handler function,
* trap just the SIGINT and SIGQUIT signals.
*/
memset(&act, 0, sizeof(act));
act.sa_handler = my_handler;
/* This is interesting: we fill the signal mask, implying that
* _all_ signals are masked (blocked) while the signal handler
* runs! */
sigfillset(&act.sa_mask);
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7758)
Filmora Efficient Editing by Alexander Zacharias(5712)
The Infinite Retina by Robert Scoble Irena Cronin(5185)
Learn Wireshark - Fundamentals of Wireshark. by Lisa Bock(3934)
Linux Device Driver Development Cookbook by Rodolfo Giometti(3932)
Edit Like a Pro with iMovie by Regit(3386)
Linux Administration Best Practices by Scott Alan Miller(2857)
Linux Command Line and Shell Scripting Techniques by Vedran Dakic & Jasmin Redzepagic(2834)
MCSA Windows Server 2016 Study Guide: Exam 70-740 by William Panek(2520)
Mastering PowerShell Scripting - Fourth Edition by Chris Dent(2358)
Docker on Windows by Stoneman Elton(2317)
Kali Linux - An Ethical Hacker's Cookbook: End-to-end penetration testing solutions by Sharma Himanshu(2310)
Creative Projects for Rust Programmers by Carlo Milanesi(2207)
Hands-On AWS Penetration Testing with Kali Linux by Karl Gilbert(2107)
Hands-On Linux for Architects by Denis Salamanca(2051)
Programming in C (4th Edition) (Developer's Library) by Stephen G. Kochan(1996)
Computers For Seniors For Dummies by Nancy C. Muir(1995)
The Old New Thing by Raymond Chen(1938)
Linux Kernel Debugging by Kaiwan N Billimoria(1761)
