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