1 .\" $NetBSD: _lwp_ctl.2,v 1.5 2012/04/13 15:14:58 yamt Exp $
3 .\" Copyright (c)2007 YAMAMOTO Takashi,
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 .\" ------------------------------------------------------------
33 .Nd prepare per-LWP communication area between kernel and userland
34 .\" ------------------------------------------------------------
37 .\" ------------------------------------------------------------
42 .Fn _lwp_ctl "int features" "struct lwpctl **address"
43 .\" ------------------------------------------------------------
46 prepares per-LWP communication area for the calling LWP,
47 and maps it into the calling process' address space.
48 It takes the following arguments.
49 .Bl -tag -width features
51 The bitwise-OR of the following flags.
52 .Bl -tag -width LWPCTL_FEATURE_CURCPU
53 .It Dv LWPCTL_FEATURE_CURCPU
56 .It Dv LWPCTL_FEATURE_PCTR
61 The address to store a pointer to
63 structure for the calling LWP.
66 The per-LWP communication area is described by an
69 It has following members, depending on
71 .Bl -tag -width int_lc_curcpu
73 The integral identifier of the CPU on which the LWP is running,
76 when the LWP is not running on any CPU.
77 It's updated by the kernel and should be considered as read-only for
79 It's available only if requested with the
80 .Dv LWPCTL_FEATURE_CURCPU
83 The integer which is incremented on every context switches to the LWP.
84 It can be used to detect preemption of the LWP.
85 (thus its name "preemption counter".)
86 It's updated by the kernel and should be considered as read-only for
88 It's available only if requested with the
89 .Dv LWPCTL_FEATURE_PCTR
92 .\" ------------------------------------------------------------
96 Otherwise, \-1 is returned and
98 is set to indicate the error.
99 .\" ------------------------------------------------------------
101 .\" ------------------------------------------------------------