1 .\" Copyright (c) 2002 Packet Design, LLC.
2 .\" All rights reserved.
4 .\" Subject to the following obligations and disclaimer of warranty,
5 .\" use and redistribution of this software, in source or object code
6 .\" forms, with or without modifications are expressly permitted by
7 .\" Packet Design; provided, however, that:
9 .\" (i) Any and all reproductions of the source or object code
10 .\" must include the copyright notice above and the following
11 .\" disclaimer of warranties; and
12 .\" (ii) No rights are granted, in any manner or form, to use
13 .\" Packet Design trademarks, including the mark "PACKET DESIGN"
14 .\" on advertising, endorsements, or otherwise except as such
15 .\" appears in the above copyright notice or in the software.
17 .\" THIS SOFTWARE IS BEING PROVIDED BY PACKET DESIGN "AS IS", AND
18 .\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, PACKET DESIGN MAKES NO
19 .\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING
20 .\" THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED
21 .\" WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
22 .\" OR NON-INFRINGEMENT. PACKET DESIGN DOES NOT WARRANT, GUARANTEE,
23 .\" OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS
24 .\" OF THE USE OF THIS SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY,
25 .\" RELIABILITY OR OTHERWISE. IN NO EVENT SHALL PACKET DESIGN BE
26 .\" LIABLE FOR ANY DAMAGES RESULTING FROM OR ARISING OUT OF ANY USE
27 .\" OF THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY DIRECT,
28 .\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE, OR CONSEQUENTIAL
29 .\" DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF
30 .\" USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY THEORY OF
31 .\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
33 .\" THE USE OF THIS SOFTWARE, EVEN IF PACKET DESIGN IS ADVISED OF
34 .\" THE POSSIBILITY OF SUCH DAMAGE.
40 .Nm getcontext , getcontextx , setcontext
41 .Nd get and set user thread context
47 .Fn getcontext "ucontext_t *ucp"
49 .Fn getcontextx "void"
51 .Fn setcontext "const ucontext_t *ucp"
56 saves the current thread's execution context in the structure pointed to by
58 This saved context may then later be restored by calling
63 function saves the current execution context in the newly allocated structure
65 which is returned on success.
66 If architecture defines additional CPU states that can be stored in extended
67 blocks referenced from the
69 the memory for them may be allocated and their context also stored.
72 function shall be freed using
78 makes a previously saved thread context the current thread context, i.e.,
79 the current context is lost and
82 Instead, execution continues in the context specified by
84 which must have been previously initialized by a call to
87 or by being passed as an argument to a signal handler (see
94 then execution continues as if the original
96 call had just returned (again).
102 execution continues with the invocation of the function specified to
104 When that function returns,
106 determines what happens next:
113 .Fn setcontext "ucp->uc_link"
114 is implicitly invoked.
118 was initialized by the invocation of a signal handler, execution continues
119 at the point the thread was interrupted by the signal.
125 does not return; otherwise \-1 is returned.
128 returns pointer to the allocated and initialized context on success, and
132 No errors are defined for
138 may return the following errors in
142 No memory was available to allocate for the context or some extended state.
160 indications are an extension to the standard.
164 revision marked the functions
168 as obsolete, citing portability issues and recommending the use of
173 revision removed the functions from the specification.
179 functions first appeared in