📄 sigstack.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>sigstack</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_008_732"> </a>NAME</h4><blockquote>sigstack - set and/or get alternate signal stack context(<b>LEGACY</b>)</blockquote><h4><a name = "tag_000_008_733"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="signal.h.html">signal.h</a>>int sigstack(struct sigstack *<i>ss</i>, struct sigstack *<i>oss</i>);</code></pre></blockquote><h4><a name = "tag_000_008_734"> </a>DESCRIPTION</h4><blockquote>The<i>sigstack()</i>function allows the calling process to indicate to the system an area of itsaddress space to be used for processing signals received by the process.<p>If the <i>ss</i> argument is not a null pointer, it mustpoint to a <b>sigstack</b> structure.The length of the application-supplied stack must be at least SIGSTKSZ bytes.If the alternate signal stack overflows, the resulting behaviour isundefined. (See APPLICATION USAGE below.)<ul><p><li>The value of the<b>ss_onstack</b>member indicates whether the process wants the systemto use an alternate signal stack when delivering signals.<p><li>The value of the<b>ss_sp</b>member indicates the desired locationof the alternate signal stack area in the process' address space.<p><li>If the<i>ss</i>argument is a null pointer, the current alternate signal stack context is notchanged.<p></ul><p>If the<i>oss</i>argument is not a null pointer, it points to a <b>sigstack</b> structure inwhich the current alternate signal stack context is placed. The value storedin the<b>ss_onstack</b>member of<i>oss</i>will be non-zero if the process is currently executing on the alternate signalstack. If the<i>oss</i>argument is a null pointer, the current alternate signal stack context is notreturned.<p>When a signal's action indicates its handlershould execute on the alternate signal stack (specified by calling<i><a href="sigaction.html">sigaction()</a></i>),the implementation checks to see if the process is currently executing on thatstack. If the process is not currently executing on the alternate signalstack, the system arranges a switch to the alternate signal stack for theduration of the signal handler's execution.<p>After a successful call to one of the<i>exec</i>functions, there are no alternate signal stacks in the new process image.<p>This interface need not be reentrant.</blockquote><h4><a name = "tag_000_008_735"> </a>RETURN VALUE</h4><blockquote>Upon successful completion,<i>sigstack()</i>returns 0. Otherwise, it returns -1 and sets <i>errno</i> to indicate theerror.</blockquote><h4><a name = "tag_000_008_736"> </a>ERRORS</h4><blockquote>The<i>sigstack()</i>function will fail if:<dl compact><dt>[EPERM]<dd>An attempt was made to modify an active stack.</dl></blockquote><h4><a name = "tag_000_008_737"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_008_738"> </a>APPLICATION USAGE</h4><blockquote>A portable application, when being written or rewritten, should use<i><a href="sigaltstack.html">sigaltstack()</a></i>instead of<i>sigstack()</i>.<p>On some implementations, stack space is automatically extended as needed. Onthose implementations, automatic extension is typically not available for analternate stack. If a signal stack overflows, the resulting behaviour of theprocess is undefined.<p>The direction of stack growth is not indicated in thehistorical definition of <b>struct sigstack</b>.The only way to portably establish a stack pointer is for the applicationto determine stack growth direction, or to allocate a block of storageand set the stack pointer to the middle.The implementation may assume that the size of the signal stackis SIGSTKSZ as found in<i><a href="signal.h.html"><signal.h></a></i>.An implementation that would like to specify a signal stack sizeother than SIGSTKSZ should use<i><a href="sigaltstack.html">sigaltstack()</a></i>.<p>Programs should not use<i><a href="longjmp.html">longjmp()</a></i>to leave a signal handler that is running on a stack established with<i>sigstack()</i>.Doing so may disable future use of the signal stack. For abnormal exit from asignal handler,<i><a href="siglongjmp.html">siglongjmp()</a></i>,<i><a href="setcontext.html">setcontext()</a></i>or<i><a href="swapcontext.html">swapcontext()</a></i>may be used. These functions fully support switching from one stack toanother.<p>The<i>sigstack()</i>function requires the application to have knowledge of the underlying system'sstack architecture. For this reason,<i><a href="sigaltstack.html">sigaltstack()</a></i>is recommended over this function.</blockquote><h4><a name = "tag_000_008_739"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_008_740"> </a>SEE ALSO</h4><blockquote><i><a href="exec.html">exec</a></i>,<i><a href="fork.html">fork()</a></i>,<i><a href="_longjmp.html">_longjmp()</a></i>,<i><a href="longjmp.html">longjmp()</a></i>,<i><a href="setjmp.html">setjmp()</a></i>,<i><a href="sigaltstack.html">sigaltstack()</a></i>,<i><a href="siglongjmp.html">siglongjmp()</a></i>,<i><a href="sigsetjmp.html">sigsetjmp()</a></i>,<i><a href="signal.h.html"><signal.h></a></i>.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 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 + -