DRV_GETPARM(9F) | Kernel Functions for Drivers | DRV_GETPARM(9F) |
drv_getparm - retrieve kernel state information
#include <sys/ddi.h> int drv_getparm(unsigned int parm, void *value_p);
Architecture independent level 1 (DDI/DKI).
parm
LBOLT
PPGRP
UPROCP
PPID
PSID
TIME
UCRED
value_p
Since the release of the Solaris 2.6 operating environment, the drv_getparm() function has been replaced by ddi_get_lbolt(9F), ddi_get_time(9F), and ddi_get_pid(9F).
The drv_getparm() 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 value_p.
The drv_getparm() 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 value_p. 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.
The drv_getparm() function returns 0 to indicate success, -1 to indicate failure. The value stored in the space pointed to by value_p 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, PPGRP, PPID, PSID, TIME, UCRED, or UPROCP. Always check the return code when using this function.
The drv_getparm() function can be called from user context only when using PPGRP, PPID, PSID, UCRED, or UPROCP. It can be called from user, interrupt, or kernel context when using the LBOLT or TIME argument.
ddi_get_lbolt(9F), ddi_get_pid(9F), ddi_get_time(9F), buf(9S)
Writing Device Drivers
November 26, 2017 | OmniOS |