xref: /freebsd/lib/libc/gen/ucontext.3 (revision d3d381b2b194b4d24853e92eecef55f262688d1a)
1.\" Copyright (c) 2002 Packet Design, LLC.
2.\" All rights reserved.
3.\"
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:
8.\"
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.
16.\"
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.
35.\"
36.\" $FreeBSD$
37.\"
38.Dd September 10, 2002
39.Dt UCONTEXT 3
40.Os
41.Sh NAME
42.Nm ucontext
43.Nd user thread context
44.Sh LIBRARY
45.Lb libc
46.Sh SYNOPSIS
47.In ucontext.h
48.Sh DESCRIPTION
49The
50.Vt ucontext_t
51type is a structure type suitable for holding the context for a user
52thread of execution.
53A thread's context includes its stack, saved registers, and list of
54blocked signals.
55.Pp
56The
57.Vt ucontext_t
58structure contains at least these fields:
59.Pp
60.Bl -tag -width ".Va mcontext_t\ \ uc_mcontext" -offset 3n -compact
61.It Va "ucontext_t *uc_link"
62context to assume when this one returns
63.It Va "sigset_t uc_sigmask"
64signals being blocked
65.It Va "stack_t uc_stack"
66stack area
67.It Va "mcontext_t uc_mcontext"
68saved registers
69.El
70.Pp
71The
72.Va uc_link
73field points to the context to resume when this context's entry point
74function returns.
75If
76.Va uc_link
77is equal to
78.Dv NULL ,
79then the process exits when this context returns.
80.Pp
81The
82.Va uc_mcontext
83field is machine-dependent and should be treated as opaque by
84portable applications.
85.Pp
86The following functions are defined to manipulate
87.Vt ucontext_t
88structures:
89.Pp
90.Bl -item -offset 3n -compact
91.It
92.Ft int
93.Fn getcontext "ucontext_t *" ;
94.It
95.Ft "ucontext_t *"
96.Fn getcontextx "void" ;
97.It
98.Ft int
99.Fn setcontext "const ucontext_t *" ;
100.It
101.Ft void
102.Fn makecontext "ucontext_t *" "void \*[lp]*\*[rp]\*[lp]void\*[rp]" int ... ;
103.It
104.Ft int
105.Fn swapcontext "ucontext_t *" "const ucontext_t *" ;
106.El
107.Sh SEE ALSO
108.Xr sigaltstack 2 ,
109.Xr getcontext 3 ,
110.Xr getcontextx 3 ,
111.Xr makecontext 3
112