⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sigaction.html

📁 posix标准英文,html格式
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy, see www.w3.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 --><!-- Copyright (c) 2001-2004 IEEE and The Open Group, All Rights Reserved --><title>sigaction</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="sigaction"></a> <a name="tag_03_680"></a><!-- sigaction --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2004 Edition<br>Copyright &copy; 2001-2004 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_03_680_01"></a>NAME</h4><blockquote>sigaction - examine and change a signal action</blockquote><h4><a name="tag_03_680_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><div class="box"><code><tt><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> #include &lt;<a href="../basedefs/signal.h.html">signal.h</a>&gt;<br><br> int sigaction(int</tt> <i>sig</i><tt>, const struct sigaction *restrict</tt> <i>act</i><tt>,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; struct sigaction *restrict</tt> <i>oact</i><tt>); <img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div><tt><br></tt></blockquote><h4><a name="tag_03_680_03"></a>DESCRIPTION</h4><blockquote><p>The <i>sigaction</i>() function allows the calling process to examine and/or specify the action to be associated with a specificsignal. The argument <i>sig</i> specifies the signal; acceptable values are defined in <a href="../basedefs/signal.h.html"><i>&lt;signal.h&gt;</i></a>.</p><p>The structure <b>sigaction</b>, used to describe an action to be taken, is defined in the <a href="../basedefs/signal.h.html"><i>&lt;signal.h&gt;</i></a> header to include at least the following members:</p><center><table border="1" cellpadding="3" align="center"><tr valign="top"><th align="center"><p class="tent"><b>Member Type</b></p></th><th align="center"><p class="tent"><b>Member Name</b></p></th><th align="center"><p class="tent"><b>Description</b></p></th></tr><tr valign="top"><td align="left"><p class="tent"><b>void(*) (int)</b></p></td><td align="left"><p class="tent"><i>sa_handler</i></p></td><td align="left"><p class="tent">Pointer to a signal-catching function or one of the macros SIG_IGN or SIG_DFL.</p></td></tr><tr valign="top"><td align="left"><p class="tent"><b>sigset_t</b></p></td><td align="left"><p class="tent"><i>sa_mask</i></p></td><td align="left"><p class="tent">Additional set of signals to be blocked during execution of signal-catching function.</p></td></tr><tr valign="top"><td align="left"><p class="tent"><b>int</b></p></td><td align="left"><p class="tent"><i>sa_flags</i></p></td><td align="left"><p class="tent">Special flags to affect behavior of signal.</p></td></tr><tr valign="top"><td align="left"><p class="tent"><b>void(*) (int,</b></p></td><td align="left"><p class="tent"><i>&nbsp;</i></p></td><td align="left"><p class="tent">&nbsp;</p></td></tr><tr valign="top"><td align="left"><p class="tent"><b>&nbsp;&nbsp;siginfo_t *, void *)</b></p></td><td align="left"><p class="tent"><i>sa_sigaction</i></p></td><td align="left"><p class="tent">Pointer to a signal-catching function.</p></td></tr></table></center><p>The storage occupied by <i>sa_handler</i> and <i>sa_sigaction</i> may overlap, and a conforming application shall not use bothsimultaneously.</p><p>If the argument <i>act</i> is not a null pointer, it points to a structure specifying the action to be associated with thespecified signal. If the argument <i>oact</i> is not a null pointer, the action previously associated with the signal is stored inthe location pointed to by the argument <i>oact</i>. If the argument <i>act</i> is a null pointer, signal handling is unchanged;thus, the call can be used to enquire about the current handling of a given signal. The SIGKILL and SIGSTOP signals shall not beadded to the signal mask using this mechanism; this restriction shall be enforced by the system without causing an error to beindicated.</p><p>If the SA_SIGINFO flag (see below) is cleared in the <i>sa_flags</i> field of the <b>sigaction</b> structure, the<i>sa_handler</i> field identifies the action to be associated with the specified signal. <sup>[<a href="javascript:open_code('XSI')">XSI|RTS</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> &nbsp;If theSA_SIGINFO flag is set in the <i>sa_flags</i> field, and the implementation supports the Realtime Signals Extension option or theXSI Extension option, the <i>sa_sigaction</i> field specifies a signal-catching function. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p><p>The <i>sa_flags</i> field can be used to modify the behavior of the specified signal.</p><p>The following flags, defined in the <a href="../basedefs/signal.h.html"><i>&lt;signal.h&gt;</i></a> header, can be set in<i>sa_flags</i>:</p><dl compact><dt>SA_NOCLDSTOP</dt><dd>Do not generate SIGCHLD when children stop <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> &nbsp;or stopped children continue. <img src="../images/opt-end.gif"alt="[Option End]" border="0"> <p>If <i>sig</i> is SIGCHLD and the SA_NOCLDSTOP flag is not set in <i>sa_flags</i>, and the implementation supports the SIGCHLDsignal, then a SIGCHLD signal shall be generated for the calling process whenever any of its child processes stop <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> &nbsp;and aSIGCHLD signal may be generated for the calling process whenever any of its stopped child processes are continued. <img src="../images/opt-end.gif" alt="[Option End]" border="0"> &nbsp;If <i>sig</i> is SIGCHLD and the SA_NOCLDSTOP flag is set in<i>sa_flags</i>, then the implementation shall not generate a SIGCHLD signal in this way.</p></dd><dt>SA_ONSTACK</dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">If set and an alternate signal stack has been declared with <a href="../functions/sigaltstack.html"><i>sigaltstack</i>()</a>, thesignal shall be delivered to the calling process on that stack. Otherwise, the signal shall be delivered on the current stack. <imgsrc="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt>SA_RESETHAND</dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">If set, the disposition of the signal shall be reset to SIG_DFL and the SA_SIGINFO flag shall be cleared on entry to the signalhandler. <basefont size="2"> <dl><dt><b>Note:</b></dt><dd>SIGILL and SIGTRAP cannot be automatically reset when delivered; the system silently enforces this restriction.</dd></dl><basefont size="3"> Otherwise, the disposition of the signal shall not be modified on entry to the signal handler. <p>In addition, if this flag is set, <i>sigaction</i>() behaves as if the SA_NODEFER flag were also set. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p></dd><dt>SA_RESTART</dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -