logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

sigsuspend.3p (3993B)


  1. '\" et
  2. .TH SIGSUSPEND "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. sigsuspend
  12. \(em wait for a signal
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <signal.h>
  17. .P
  18. int sigsuspend(const sigset_t *\fIsigmask\fP);
  19. .fi
  20. .SH DESCRIPTION
  21. The
  22. \fIsigsuspend\fR()
  23. function shall replace the current signal mask of the calling thread
  24. with the set of signals pointed to by
  25. .IR sigmask
  26. and then suspend the thread until delivery of a signal whose action is
  27. either to execute a signal-catching function or to terminate the
  28. process. This shall not cause any other signals that may have been
  29. pending on the process to become pending on the thread.
  30. .P
  31. If the action is to terminate the process then
  32. \fIsigsuspend\fR()
  33. shall never return. If the action is to execute a signal-catching
  34. function, then
  35. \fIsigsuspend\fR()
  36. shall return after the signal-catching function returns, with the
  37. signal mask restored to the set that existed prior to the
  38. \fIsigsuspend\fR()
  39. call.
  40. .P
  41. It is not possible to block signals that cannot be ignored. This is
  42. enforced by the system without causing an error to be indicated.
  43. .SH "RETURN VALUE"
  44. Since
  45. \fIsigsuspend\fR()
  46. suspends thread execution indefinitely, there is no successful
  47. completion return value. If a return occurs, \-1 shall be returned and
  48. .IR errno
  49. set to indicate the error.
  50. .SH ERRORS
  51. The
  52. \fIsigsuspend\fR()
  53. function shall fail if:
  54. .TP
  55. .BR EINTR
  56. A signal is caught by the calling process and control is returned from
  57. the signal-catching function.
  58. .LP
  59. .IR "The following sections are informative."
  60. .SH EXAMPLES
  61. None.
  62. .SH "APPLICATION USAGE"
  63. Normally, at the beginning of a critical code section, a specified set
  64. of signals is blocked using the
  65. \fIsigprocmask\fR()
  66. function. When the thread has completed the critical section and
  67. needs to wait for the previously blocked signal(s), it pauses by
  68. calling
  69. \fIsigsuspend\fR()
  70. with the mask that was returned by the
  71. \fIsigprocmask\fR()
  72. call.
  73. .SH RATIONALE
  74. Code which wants to avoid the ambiguity of the signal mask for thread
  75. cancellation handlers can install an additional cancellation handler
  76. which resets the signal mask to the expected value.
  77. .sp
  78. .RS 4
  79. .nf
  80. void cleanup(void *arg)
  81. {
  82. sigset_t *ss = (sigset_t *) arg;
  83. pthread_sigmask(SIG_SETMASK, ss, NULL);
  84. }
  85. .P
  86. int call_sigsuspend(const sigset_t *mask)
  87. {
  88. sigset_t oldmask;
  89. int result;
  90. pthread_sigmask(SIG_SETMASK, NULL, &oldmask);
  91. pthread_cleanup_push(cleanup, &oldmask);
  92. result = sigsuspend(sigmask);
  93. pthread_cleanup_pop(0);
  94. return result;
  95. }
  96. .fi
  97. .P
  98. .RE
  99. .SH "FUTURE DIRECTIONS"
  100. None.
  101. .SH "SEE ALSO"
  102. .IR "Section 2.4" ", " "Signal Concepts",
  103. .IR "\fIpause\fR\^(\|)",
  104. .IR "\fIsigaction\fR\^(\|)",
  105. .IR "\fIsigaddset\fR\^(\|)",
  106. .IR "\fIsigdelset\fR\^(\|)",
  107. .IR "\fIsigemptyset\fR\^(\|)",
  108. .IR "\fIsigfillset\fR\^(\|)"
  109. .P
  110. The Base Definitions volume of POSIX.1\(hy2017,
  111. .IR "\fB<signal.h>\fP"
  112. .\"
  113. .SH COPYRIGHT
  114. Portions of this text are reprinted and reproduced in electronic form
  115. from IEEE Std 1003.1-2017, Standard for Information Technology
  116. -- Portable Operating System Interface (POSIX), The Open Group Base
  117. Specifications Issue 7, 2018 Edition,
  118. Copyright (C) 2018 by the Institute of
  119. Electrical and Electronics Engineers, Inc and The Open Group.
  120. In the event of any discrepancy between this version and the original IEEE and
  121. The Open Group Standard, the original IEEE and The Open Group Standard
  122. is the referee document. The original Standard can be obtained online at
  123. http://www.opengroup.org/unix/online.html .
  124. .PP
  125. Any typographical or formatting errors that appear
  126. in this page are most likely
  127. to have been introduced during the conversion of the source files to
  128. man page format. To report such errors, see
  129. https://www.kernel.org/doc/man-pages/reporting_bugs.html .