1 .\" $NetBSD: getcontext.2,v 1.7 2010/04/29 06:07:35 jruoho Exp $
3 .\" Copyright (c) 1999 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
36 .Nd get and set current user context
42 .Fn getcontext "ucontext_t *ucp"
44 .Fn setcontext "const ucontext_t *ucp"
48 function initializes the object pointed to by
50 to the current user context of the calling thread.
51 The user context defines a thread's execution environment and includes
52 the contents of its machine registers,
54 and its current execution stack.
58 function restores the user context defined in the object pointed to by
60 as most recently initialized by a previous call to either
64 .\" TODO: signal handler
65 If successful, execution of the program resumes as defined in the
72 was initialized by the
74 function, program execution continues as if the corresponding invocation of
76 had just returned (successfully).
79 was initialized by the
81 function, program execution continues with the function (and function
85 On successful completion,
90 Otherwise a value of \-1 is returned and
92 is set to indicate the error.
98 functions will fail if:
103 argument points to an invalid address.
108 function will fail if:
111 The contents of the datum pointed to by
132 indications are an extension to the standard.
136 revision marked the functions
140 as obsolete, citing portability issues and recommending the use of
145 revision removed the functions from the specification.
151 functions first appeared in