]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libc/gen/ucontext.3
zfs: merge openzfs/zfs@043c6ee3b
[FreeBSD/FreeBSD.git] / lib / libc / gen / ucontext.3
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 .Dd March 23, 2020
37 .Dt UCONTEXT 3
38 .Os
39 .Sh NAME
40 .Nm ucontext
41 .Nd user thread context
42 .Sh LIBRARY
43 .Lb libc
44 .Sh SYNOPSIS
45 .In ucontext.h
46 .Sh DESCRIPTION
47 The
48 .Vt ucontext_t
49 type is a structure type suitable for holding the context for a user
50 thread of execution.
51 A thread's context includes its stack, saved registers, and list of
52 blocked signals.
53 .Pp
54 The
55 .Vt ucontext_t
56 structure contains at least these fields:
57 .Pp
58 .Bl -tag -width ".Va mcontext_t\ \ uc_mcontext" -offset 3n -compact
59 .It Va "ucontext_t *uc_link"
60 context to assume when this one returns
61 .It Va "sigset_t uc_sigmask"
62 signals being blocked
63 .It Va "stack_t uc_stack"
64 stack area
65 .It Va "mcontext_t uc_mcontext"
66 saved registers
67 .El
68 .Pp
69 The
70 .Va uc_link
71 field points to the context to resume when this context's entry point
72 function returns.
73 If
74 .Va uc_link
75 is equal to
76 .Dv NULL ,
77 then the process exits when this context returns.
78 .Pp
79 The
80 .Va uc_mcontext
81 field is machine-dependent and should be treated as opaque by
82 portable applications.
83 .Pp
84 The following functions are defined to manipulate
85 .Vt ucontext_t
86 structures:
87 .Pp
88 .Bl -item -offset 3n -compact
89 .It
90 .Ft int
91 .Fn getcontext "ucontext_t *" ;
92 .It
93 .Ft "ucontext_t *"
94 .Fn getcontextx "void" ;
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
105 .Sh SEE ALSO
106 .Xr sigaltstack 2 ,
107 .Xr getcontext 3 ,
108 .Xr getcontextx 3 ,
109 .Xr makecontext 3
110 .Sh STANDARDS
111 The
112 .Vt ucontext_t
113 type conforms to
114 .St -xsh5
115 and
116 .St -p1003.1-2001 .
117 The
118 .St -p1003.1-2008
119 revision removed the
120 .Vt ucontext_t
121 from the specification.