| Skip Navigation Links | |
| Exit Print View | |
![]() | man pages section 2: System Calls Oracle Solaris 11 Information Library |
- get and set current user context
#include <ucontext.h>intgetcontext(ucontext_t *ucp);
intsetcontext(const ucontext_t *ucp);
Thegetcontext() function initializes the structure pointed to byucp to thecurrent user context of the calling process. Theucontext_t type thatucp points to defines the user context and includes the contents of thecalling process' machine registers, the signal mask, and the current execution stack.
Thesetcontext() function restores the user context pointed to byucp. A successful call tosetcontext() does not return; program execution resumes atthe point specified by theucp argument passed tosetcontext(). Theucpargument should be created either by a prior call togetcontext(), orby being passed as an argument to a signal handler. If theucp argument was created withgetcontext(), program execution continues as if the correspondingcall ofgetcontext() had just returned. If theucp argument wascreated withmakecontext(3C), program execution continues with the function passed tomakecontext(3C).When that function returns, the process continues as if after a call tosetcontext() with theucp argument that was input tomakecontext(3C). If theucp argument was passed to a signal handler, program execution continues with theprogram instruction following the instruction interrupted by the signal. If theuc_link member of theucontext_t structure pointed to by theucp argumentis equal to 0, then this context is the main context, and theprocess will exit when this context returns. The effects of passingaucp argument obtained from any other source are unspecified.
On successful completion,setcontext() does not return andgetcontext() returns0. Otherwise,-1 is returned.
No errors are defined.
Portable applications should not modify or access theuc_mcontext member ofucontext_t. A portable application cannot assume that context includes any process-wide staticdata, possibly includingerrno. Users manipulating contexts should take care to handle theseexplicitly when required.
Seeattributes(5) for descriptions of the following attributes:
|
sigaction(2),sigaltstack(2),sigprocmask(2),bsd_signal(3C),makecontext(3C),ucontext.h(3HEAD),attributes(5),standards(5)
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.Legal Notices | ![]() ![]() |