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

📄 bsd_signal.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>bsd_signal</title></head><body bgcolor=white><center><font size=2>The Single UNIX &reg; Specification, Version 2<br>Copyright &copy; 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_001_305">&nbsp;</a>NAME</h4><blockquote>bsd_signal - simplified signal facilities</blockquote><h4><a name = "tag_000_001_306">&nbsp;</a>SYNOPSIS</h4><blockquote><pre><code>#include &lt;<a href="signal.h.html">signal.h</a>&gt;void (*bsd_signal(int <i>sig</i>, void (*<i>func</i>)(int)))(int);</code></pre></blockquote><h4><a name = "tag_000_001_307">&nbsp;</a>DESCRIPTION</h4><blockquote>The<i>bsd_signal()</i>function provides a partially compatible interface for programs written tohistorical system interfaces (see APPLICATION USAGE below).<p>The function call <i>bsd_signal</i>(<i>sig</i>, <i>func</i>)has an effect as if implemented as:<pre><code>void (*bsd_signal(int sig, void (*func)(int)))(int){     struct sigaction act, oact;     act.sa_handler = <i>func</i>;     act.sa_flags = SA_RESTART;     sigemptyset(&amp;act.sa_mask);     sigaddset(&amp;act.sa_mask, <i>sig</i>);     if (sigaction(<i>sig</i>, &amp;act, &amp;oact) == -1)          return(SIG_ERR);     return(oact.sa_handler);}</code></pre>The handler function should be declared:<pre><code>void handler(int <i>sig</i>);</code></pre>where <i>sig</i> is the signal number.  The behaviour is undefined if<i>func</i>is a function that takes more than one argument, or an argument of a differenttype.</blockquote><h4><a name = "tag_000_001_308">&nbsp;</a>RETURN VALUE</h4><blockquote>Upon successful completion,<i>bsd_signal()</i>returns the previous action for <i>sig</i>.Otherwise, SIG_ERR is returned and <i>errno</i> is set to indicate the error.</blockquote><h4><a name = "tag_000_001_309">&nbsp;</a>ERRORS</h4><blockquote>Refer to<i><a href="sigaction.html">sigaction()</a></i>.</blockquote><h4><a name = "tag_000_001_310">&nbsp;</a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_001_311">&nbsp;</a>APPLICATION USAGE</h4><blockquote>This function is a direct replacement for the BSD<i><a href="signal.html">signal()</a></i>function for simple applications that are installing a single-argument signalhandler function.  If a BSD signal handler function is being installed thatexpects more than one argument, the application has to be modified to use<i><a href="sigaction.html">sigaction()</a></i>.The<i>bsd_signal()</i>function differs from<i><a href="signal.html">signal()</a></i>in that the SA_RESTART flag is set and the SA_RESETHAND will be clear when<i>bsd_signal()</i>is used.  The state of these flags is not specified for<i><a href="signal.html">signal()</a></i>.</blockquote><h4><a name = "tag_000_001_312">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_001_313">&nbsp;</a>SEE ALSO</h4><blockquote><i><a href="sigaction.html">sigaction()</a></i>,<i><a href="sigaddset.html">sigaddset()</a></i>,<i><a href="sigemptyset.html">sigemptyset()</a></i>,<i><a href="signal.html">signal()</a></i>,<i><a href="signal.h.html">&lt;signal.h&gt;</a></i>.</blockquote><hr size=2 noshade><center><font size=2>UNIX &reg; is a registered Trademark of The Open Group.<br>Copyright &copy; 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>

⌨️ 快捷键说明

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