xref: /netbsd-src/lib/libc/sys/_lwp_ctl.2 (revision 267197ec1eebfcb9810ea27a89625b6ddf68e3e7)
1.\"     $NetBSD: _lwp_ctl.2,v 1.1 2007/12/14 21:52:18 yamt Exp $
2.\"
3.\" Copyright (c)2007 YAMAMOTO Takashi,
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
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.
14.\"
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
25.\" SUCH DAMAGE.
26.\"
27.\" ------------------------------------------------------------
28.Dd December 15, 2007
29.Dt _LWP_CTL 2
30.Os
31.Sh NAME
32.Nm _lwp_ctl
33.Nd prepare per-LWP communication area between kernel and userland
34.\" ------------------------------------------------------------
35.Sh LIBRARY
36.Lb libc
37.\" ------------------------------------------------------------
38.Sh SYNOPSIS
39.In lwp.h
40.Ft int
41.Fn _lwp_ctl "int features" "struct lwpctl **address"
42.\" ------------------------------------------------------------
43.Sh DESCRIPTION
44.Fn _lwp_ctl
45prepares per-LWP communication area for the calling LWP,
46and maps it into the calling process' address space.
47It takes the following arguments.
48.Bl -tag -width features
49.It Fa features
50The bitwise-OR of the following flags.
51.Bl -tag -width LWPCTL_FEATURE_CURCPU
52.It Dv LWPCTL_FEATURE_CURCPU
53Request lc_curcpu.
54.El
55.It Fa address
56The address to store a pointer to lwpctl structure for the calling LWP.
57.El
58.Pp
59The per-LWP communication area is described by an lwpctl structure.
60It has following members, depending on
61.Fa features .
62.Bl -tag -width int_lc_curcpu
63.It int lc_curcpu
64The integral identifier of the CPU on which the LWP is running,
65or
66.Dv LWPCTL_CPU_NONE
67when the LWP is not running on any CPU.
68It's updated by the kernel and should be considered as read-only for
69userland.
70It's available only if requested with the
71.Dv LWPCTL_FEATURE_CURCPU
72flag.
73.El
74.\" ------------------------------------------------------------
75.Sh RETURN VALUES
76.Fn _lwp_ctl
77returns 0 on success.
78Otherwise, \-1 is returned and
79.Va errno
80is set to indicate the error.
81.\" ------------------------------------------------------------
82.\".Sh ERRORS
83.\" ------------------------------------------------------------
84.Sh SEE ALSO
85.Xr errno 2
86