1drv_getparm(9F)          Kernel Functions for Drivers          drv_getparm(9F)
2
3
4

NAME

6       drv_getparm - retrieve kernel state information
7

SYNOPSIS

9       #include <sys/ddi.h>
10
11
12
13       int drv_getparm(unsigned int parm, void *value_p);
14
15

INTERFACE LEVEL

17       Architecture independent level 1 (DDI/DKI).
18

PARAMETERS

20       parm    The kernel parameter to be obtained. Possible values are:
21
22
23       LBOLT     Read  the value of lbolt. lbolt is a clock_t that is uncondi‐
24                 tionally incremented by one at each clock  tick.  No  special
25                 treatment  is  applied  when this value overflows the maximum
26                 value of the signed integral type clock_t. When this  occurs,
27                 its  value  will  be  negative,  and  its  magnitude  will be
28                 decreasing until it again passes zero. It can  therefore  not
29                 be relied upon to provide an indication of the amount of time
30                 that passes since the last system reboot, nor  should  it  be
31                 used to mark an absolute time in the system. Only the differ‐
32                 ence between two measurements of lbolt is significant. It  is
33                 used  in  this  way  inside the system kernel for timing pur‐
34                 poses.
35
36
37       PPGRP     Read the process group  identification  number.  This  number
38                 determines  which  processes should receive a HANGUP or BREAK
39                 signal when detected by a driver.
40
41
42       UPROCP    Read the process table token value.
43
44
45       PPID      Read process identification number.
46
47
48       PSID      Read process session identification number.
49
50
51       TIME      Read time in seconds.
52
53
54       UCRED     Return a pointer to the caller's credential structure.
55
56
57       value_p    A pointer to the data space in which the value of the param‐
58                  eter is to be copied.
59
60

DESCRIPTION

62       Since  the  release  of  the  Solaris  2.6  operating  environment, the
63       drv_getparm()  function  has  been   replaced   by   ddi_get_lbolt(9F),
64       ddi_get_time(9F), and ddi_get_pid(9F).
65
66
67       The  drv_getparm()  function verifies that parm corresponds to a kernel
68       parameter that may be read. If the value of parm does not correspond to
69       a  parameter  or corresponds to a parameter that may not be read, -1 is
70       returned. Otherwise, the value of the parameter is stored in  the  data
71       space pointed to by value_p.
72
73
74       The drv_getparm() function does not explicitly check to see whether the
75       device has the appropriate context when the function is called and  the
76       function does not check for correct alignment in the data space pointed
77       to by value_p. It is the responsibility of the  driver  writer  to  use
78       this  function  only  when  it is appropriate to do so and to correctly
79       declare the data space needed by the driver.
80

RETURN VALUES

82       The drv_getparm() function returns 0 to indicate success, -1  to  indi‐
83       cate  failure.  The  value stored in the space pointed to by value_p is
84       the value of the parameter if 0 is returned,  or  undefined  if  -1  is
85       returned.  -1  is  returned  if  you  specify a value other than LBOLT,
86       PPGRP, PPID, PSID, TIME, UCRED, or UPROCP. Always check the return code
87       when using this function.
88

CONTEXT

90       The  drv_getparm()  function  can be called from user context only when
91       using PPGRP, PPID, PSID, UCRED, or UPROCP. It can be called from  user,
92       interrupt, or kernel context when using the LBOLT or TIME argument.
93

SEE ALSO

95       ddi_get_lbolt(9F), ddi_get_pid(9F), ddi_get_time(9F), buf(9S)
96
97
98       Writing Device Drivers
99
100
101
102SunOS 5.11                        16 Jan 2006                  drv_getparm(9F)
Impressum