xref: /netbsd/share/man/man9/curproc.9 (revision 6550d01e)
1.\"     $NetBSD: curproc.9,v 1.5 2010/07/01 15:12:31 wiz Exp $
2.\"
3.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Gregory McGarry.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE.
29.\"
30.Dd July 1, 2010
31.Dt CURPROC 9
32.Os
33.Sh NAME
34.Nm curproc ,
35.Nm curcpu ,
36.Nm curlwp
37.Nd current process, processor, and
38.Tn LWP
39.Sh SYNOPSIS
40.In sys/proc.h
41.Ft struct cpu_info *
42.Fn curcpu "void"
43.Ft struct proc *
44.Fn curproc "void"
45.Ft struct lwp *
46.Fn curlwp "void"
47.Sh DESCRIPTION
48The following macros can be used to retrieve
49the current processor, process, and light-weight process
50.Pq Tn LWP ,
51respectively:
52.Bl -enum -offset indent
53.It
54The machine-dependent
55.Fn curcpu
56macro returns a pointer to a
57.Em cpu_info
58structure containing information of the
59.Tn CPU
60that this thread is running on.
61.It
62The machine-independent
63.Fn curproc
64macro refers to a pointer to the process currently running on this
65.Tn CPU .
66.It
67The
68.Fn curlwp
69macro expands to a pointer to
70.Em lwp
71structure, containing information about the current
72.Tn LWP .
73This macro is machine-independent,
74but machine-dependent
75.In machine/cpu.h
76may redefine it.
77.El
78.Sh SEE ALSO
79.Xr cpu_number 9 ,
80.Xr proc_find 9
81