'\" te
.\"  opyright (c) 2006, Sun Microsystems, Inc.  All Rights Reserved.
.\" Copyright 1989 AT&T
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH DRV_GETPARM 9F "Jan 16, 2006"
.SH NAME
drv_getparm \- retrieve kernel state information
.SH SYNOPSIS
.LP
.nf
#include <sys/ddi.h>



\fBint\fR \fBdrv_getparm\fR(\fBunsigned int\fR \fIparm\fR, \fBvoid *\fR\fIvalue_p\fR);
.fi

.SH INTERFACE LEVEL
.sp
.LP
Architecture independent level 1 (DDI/DKI).
.SH PARAMETERS
.sp
.ne 2
.na
\fB\fIparm\fR\fR
.ad
.RS 8n
The kernel parameter to be obtained. Possible values are:
.RE

.sp
.ne 2
.na
\fB\fBLBOLT\fR\fR
.ad
.RS 10n
Read the value of \fBlbolt\fR. \fBlbolt\fR is a \fBclock_t\fR that is
unconditionally incremented by one at each clock tick. No special treatment is
applied when this value overflows the maximum value of the signed integral type
\fBclock_t\fR. When this occurs, its value will be negative, and its magnitude
will be decreasing until it again passes zero. It can therefore not be relied
upon to provide an indication of the amount of time that passes since the last
system reboot, nor should it be used to mark an absolute time in the system.
Only the difference between two measurements of \fBlbolt\fR is significant. It
is used in this way inside the system kernel for timing purposes.
.RE

.sp
.ne 2
.na
\fB\fBPPGRP\fR\fR
.ad
.RS 10n
Read the process group identification number. This number determines which
processes should receive a \fBHANGUP\fR or \fBBREAK\fR signal when detected by
a driver.
.RE

.sp
.ne 2
.na
\fB\fBUPROCP\fR\fR
.ad
.RS 10n
Read the process table token value.
.RE

.sp
.ne 2
.na
\fB\fBPPID\fR\fR
.ad
.RS 10n
Read process identification number.
.RE

.sp
.ne 2
.na
\fB\fBPSID\fR\fR
.ad
.RS 10n
Read process session identification number.
.RE

.sp
.ne 2
.na
\fB\fBTIME\fR\fR
.ad
.RS 10n
Read time in seconds.
.RE

.sp
.ne 2
.na
\fB\fBUCRED\fR\fR
.ad
.RS 10n
Return a pointer to the caller's credential structure.
.RE

.sp
.ne 2
.na
\fB\fIvalue_p\fR\fR
.ad
.RS 11n
A pointer to the data space in which the value of the parameter is to be
copied.
.RE

.SH DESCRIPTION
.sp
.LP
Since the release of the Solaris 2.6 operating environment, the
\fBdrv_getparm()\fR function has been replaced by \fBddi_get_lbolt\fR(9F),
\fBddi_get_time\fR(9F), and \fBddi_get_pid\fR(9F).
.sp
.LP
The \fBdrv_getparm()\fR function verifies that \fIparm\fR corresponds to a
kernel parameter that may be read. If the value of \fIparm\fR does not
correspond to a parameter or corresponds to a parameter that may not be read,
\fB-1\fR is returned. Otherwise, the value of the parameter is stored in the
data space pointed to by \fIvalue_p\fR.
.sp
.LP
The \fBdrv_getparm()\fR function does not explicitly check to see whether the
device has the appropriate context when the function is called and the function
does not check for correct alignment in the data space pointed to by
\fIvalue_p\fR. It is the responsibility of the driver writer to use this
function only when it is appropriate to do so and to correctly declare the data
space needed by the driver.
.SH RETURN VALUES
.sp
.LP
The \fBdrv_getparm()\fR function returns \fB0\fR to indicate success, \fB-1\fR
to indicate failure. The value stored in the space pointed to by \fIvalue_p\fR
is the value of the parameter if \fB0\fR is returned, or undefined if \fB-1\fR
is returned. \fB-1\fR is returned if you specify a value other than
\fBLBOLT\fR, \fBPPGRP\fR, \fBPPID\fR, \fBPSID\fR, \fBTIME\fR, \fBUCRED\fR, or
\fBUPROCP\fR. Always check the return code when using this function.
.SH CONTEXT
.sp
.LP
The \fBdrv_getparm()\fR function can be called from user context only when
using \fBPPGRP\fR, \fBPPID\fR, \fBPSID\fR, \fBUCRED\fR, or \fBUPROCP\fR. It can
be called from user, interrupt, or kernel context when using the \fBLBOLT\fR or
\fBTIME\fR argument.
.SH SEE ALSO
.sp
.LP
\fBddi_get_lbolt\fR(9F), \fBddi_get_pid\fR(9F), \fBddi_get_time\fR(9F),
\fBbuf\fR(9S)
.sp
.LP
\fIWriting Device Drivers\fR