Answers to APUE exercises

Source: Internet
Author: User
Answers to APUE exercises-General Linux technology-Linux programming and kernel information. For more information, see the following. Chapter 10, chapter 9, apue
# Include "apue. h"
# Include

Pr_mask (const char * str)

Errno_save = errno;/* we can be called by signal handlers */
If (sigprocmask (0, NULL, & sigset) <0)
Err_sys ("sigprocmask error ");

Printf ("% s", str );
If (sigismember (& sigset, SIGINT) printf ("SIGINT ");
If (sigismember (& sigset, SIGQUIT) printf ("SIGQUIT ");
If (sigismember (& sigset, SIGUSR1) printf ("SIGUSR1 ");
If (sigismember (& sigset, SIGALRM) printf ("SIGALRM ");

/* Remaining signals can go here */

Printf ("\ n ");
Errno = errno_save;
Rewrite the above program to process all semaphores. each cycle processes one semaphores in the current blocked word (not every possible semaphores are cyclically ).
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.