Kernel Functions for Drivers drvgetparm(9F)
NAME
drvgetparm - retrieve kernel state information
SYNOPSIS
#include
int drvgetparm(unsigned int parm, void *valuep);
INTERFACE LEVEL
Architecture independent level 1 (DI/DKI).
PARAMETERS
parm The kernel parameter to be obtained. Possible values
are:
LBOLT Read the value of lbolt. lbolt is a clockt 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 clockt. 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 indica-
tion 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 differ-
ence between two measurements of lbolt is signifi-
cant. It is used in this way inside the system
kernel for timing purposes.
PGRP Read the process group identification number. This
number determines which processes should receive a
HANGUP or BREAK signal when detected by a driver.
UPROCP Read the process table token value.
PID Read process identification number.
PSID Read process session identification number.
TIME Read time in seconds.
SunOS 5.11 Last change: 16 Jan 2006 1
Kernel Functions for Drivers drvgetparm(9F)
UCRED Return a pointer to the caller's credential struc-
ture.
valuep A pointer to the data space in which the value of
the parameter is to be copied.
DESCRIPTION
Since the release of the Solaris 2.6 operating environment,
the drvgetparm() function has been replaced by
ddigetlbolt(9F), ddigettime(9F), and ddigetpid(9F).
The drvgetparm() function verifies that parm corresponds to
a kernel parameter that may be read. If the value of parm
does not correspond to a parameter or corresponds to a
parameter that may not be read, -1 is returned. Otherwise,
the value of the parameter is stored in the data space
pointed to by valuep.
The drvgetparm() 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 valuep.
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.
RETURN VALUES
The drvgetparm() function returns 0 to indicate success, -1
to indicate failure. The value stored in the space pointed
to by valuep is the value of the parameter if 0 is
returned, or undefined if -1 is returned. -1 is returned if
you specify a value other than LBOLT, PGRP, PID, PSID,
TIME, UCRED, or UPROCP. Always check the return code when
using this function.
CONTEXT
The drvgetparm() function can be called from user context
only when using PGRP, PID, PSID, UCRED, or UPROCP. It can
be called from user, interrupt, or kernel context when using
the LBOLT or TIME argument.
SEE ALSO
ddigetlbolt(9F), ddigetpid(9F), ddigettime(9F),
buf(9S)
Writing Device Drivers
SunOS 5.11 Last change: 16 Jan 2006 2
|