2012-11-15 12:06:41 +01:00
|
|
|
.\" $NetBSD: _lwp_ctl.2,v 1.5 2012/04/13 15:14:58 yamt Exp $
|
2011-02-14 20:36:03 +01:00
|
|
|
.\"
|
|
|
|
.\" Copyright (c)2007 YAMAMOTO Takashi,
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" ------------------------------------------------------------
|
2012-11-15 12:06:41 +01:00
|
|
|
.Dd April 13, 2012
|
2011-02-14 20:36:03 +01:00
|
|
|
.Dt _LWP_CTL 2
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm _lwp_ctl
|
|
|
|
.Nd prepare per-LWP communication area between kernel and userland
|
|
|
|
.\" ------------------------------------------------------------
|
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libc
|
|
|
|
.\" ------------------------------------------------------------
|
|
|
|
.Sh SYNOPSIS
|
2012-11-15 12:06:41 +01:00
|
|
|
.In sys/lwpctl.h
|
2011-02-14 20:36:03 +01:00
|
|
|
.In lwp.h
|
|
|
|
.Ft int
|
|
|
|
.Fn _lwp_ctl "int features" "struct lwpctl **address"
|
|
|
|
.\" ------------------------------------------------------------
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
.Fn _lwp_ctl
|
|
|
|
prepares per-LWP communication area for the calling LWP,
|
|
|
|
and maps it into the calling process' address space.
|
|
|
|
It takes the following arguments.
|
|
|
|
.Bl -tag -width features
|
|
|
|
.It Fa features
|
|
|
|
The bitwise-OR of the following flags.
|
|
|
|
.Bl -tag -width LWPCTL_FEATURE_CURCPU
|
|
|
|
.It Dv LWPCTL_FEATURE_CURCPU
|
2012-11-15 12:06:41 +01:00
|
|
|
Request
|
|
|
|
.Vt lc_curcpu .
|
2011-02-14 20:36:03 +01:00
|
|
|
.It Dv LWPCTL_FEATURE_PCTR
|
2012-11-15 12:06:41 +01:00
|
|
|
Request
|
|
|
|
.Vt lc_pctr .
|
2011-02-14 20:36:03 +01:00
|
|
|
.El
|
|
|
|
.It Fa address
|
2012-11-15 12:06:41 +01:00
|
|
|
The address to store a pointer to
|
|
|
|
.Vt lwpctl
|
|
|
|
structure for the calling LWP.
|
2011-02-14 20:36:03 +01:00
|
|
|
.El
|
|
|
|
.Pp
|
2012-11-15 12:06:41 +01:00
|
|
|
The per-LWP communication area is described by an
|
|
|
|
.Vt lwpctl
|
|
|
|
structure.
|
2011-02-14 20:36:03 +01:00
|
|
|
It has following members, depending on
|
|
|
|
.Fa features .
|
|
|
|
.Bl -tag -width int_lc_curcpu
|
2012-11-15 12:06:41 +01:00
|
|
|
.It Vt int lc_curcpu
|
2011-02-14 20:36:03 +01:00
|
|
|
The integral identifier of the CPU on which the LWP is running,
|
|
|
|
or
|
|
|
|
.Dv LWPCTL_CPU_NONE
|
|
|
|
when the LWP is not running on any CPU.
|
|
|
|
It's updated by the kernel and should be considered as read-only for
|
|
|
|
userland.
|
|
|
|
It's available only if requested with the
|
|
|
|
.Dv LWPCTL_FEATURE_CURCPU
|
|
|
|
flag.
|
2012-11-15 12:06:41 +01:00
|
|
|
.It Vt int lc_pctr
|
2011-02-14 20:36:03 +01:00
|
|
|
The integer which is incremented on every context switches to the LWP.
|
|
|
|
It can be used to detect preemption of the LWP.
|
|
|
|
(thus its name "preemption counter".)
|
|
|
|
It's updated by the kernel and should be considered as read-only for
|
|
|
|
userland.
|
|
|
|
It's available only if requested with the
|
|
|
|
.Dv LWPCTL_FEATURE_PCTR
|
|
|
|
flag.
|
|
|
|
.El
|
|
|
|
.\" ------------------------------------------------------------
|
|
|
|
.Sh RETURN VALUES
|
|
|
|
.Fn _lwp_ctl
|
|
|
|
returns 0 on success.
|
|
|
|
Otherwise, \-1 is returned and
|
|
|
|
.Va errno
|
|
|
|
is set to indicate the error.
|
|
|
|
.\" ------------------------------------------------------------
|
|
|
|
.\".Sh ERRORS
|
|
|
|
.\" ------------------------------------------------------------
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr errno 2
|