DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
SVR5

drv_getparm(D3)


drv_getparm -- retrieve kernel state information

Synopsis

   #include <sys/types.h>
   #include <sys/ddi.h>
   

int drv_getparm(ulong_t parm, void *value_p);

Description

drv_getparm returns the value of the parameter specified by parm in the location pointed to by value_p.

Arguments


parm
The kernel parameter to be obtained.

value_p
A pointer to the data space into which the value of the parameter is to be copied.

Return values

On success, drv_getparm returns 0. On failure it returns -1 to indicate that parm specified an invalid parameter.

Usage

drv_getparm does not explicitly check to see whether the driver has the appropriate context when the function is called. It is the responsibility of the driver to use this function only when it is appropriate to do so and to correctly declare the data space needed.

Valid values for parm are:


DRV_MAXBIOSIZE
Get the maximum possible I/O transfer size, a value which is returned as a size_t value. This value can then be used when allocating data structures or to perform other optimizations.

HW_PROVIDER
Return a pointer to a string that describes the OEM platform vendor and platform name for the running system. The pointer is returned in *value_p and is of type char *. See the SI_HW_PROVIDER option of sysinfo.

STRMSGSIZE
Return the value of the maximum STREAMS message size as a size_t value.

SYSCRED
return a pointer to an ``all-powerful'' credentials structure for performing tasks on behalf of the core system. This assumes that credential checks for such tasks are made at a higher level. The value returned in *value_p is of type cred_t * and may used only to pass on to kernel functions that require credentials, such as drv_open(D3). Use SYSCRED rather than UCRED when not in user context.

TIME
Return the time in seconds, as a time_t value. This is the same time value that is returned by the time system call. The value is defined as the time in seconds since 00:00:00 GMT, January 1, 1970. This definition presupposes that the administrator has set the correct system date and time.

UCRED
Retrieve a pointer to the credential structure describing the current user credentials for the current process. The value returned in *value_p is of type (cred_t *) and the only valid use of the value is as an argument to the drv_priv(D3) or drv_open(D3) function. Because this value is associated with the current process, the caller must be in user context when attempting to retrieve this value. Also, this value should only be used in the context of the process in which it was retrieved.

Context and synchronization


If parm is UPROCP:
User context


For all other parm values:
All contexts

Hardware applicability

All

Version applicability

ddi: 1, 2, 3, 4, 5, 5mp, 6, 6mp, 7, 7mp, 7.1, 7.1mp, 8, 8mp

Differences between versions

The value_p argument is currently defined as a pointer to a void data type. In earlier releases, it was a pointer to a ulong_t data type.

SYSCRED and HW_PROVIDER are not supported in DDI versions before version 8.

The following parameters are not supported in DDI version 8 and later versions:


LBOLT
Read the number of clock ticks since the last system reboot, returned as a clock_t value. The difference between the values returned from successive calls to retrieve this parameter provides an indication of the elapsed time between the calls in units of clock ticks. The length of a clock tick can vary across different implementations, and therefore drivers should not include any hard-coded assumptions about the length of a tick. The drv_hztousec(D3) and drv_usectohz(D3) functions can be used, as necessary, to convert between clock ticks and microseconds (implementation independent units).

The lbolt variable can become negative after the system has been up for a long period. Drivers should be coded to work correctly under these circumstances; see ``lbolt'' in HDK Technical Reference. Drivers written for DDI version 8 and later should use the TICKS(D3) family of macros to access lbolt values.


UPROCP
Retrieve a pointer to the process structure for the current process. The value returned in *value_p is of type (proc_t *) and the only valid use of the value is as an argument to vtop(D3), or when calling psignal(D3) on those systems which do not have the new proc_signal(D3) interfaces. Since this value is associated with the current process, the caller must be in user context when attempting to retrieve this value. Also, this value should only be used in the context of the process in which it was retrieved.

The PPGRP, PPID, and PSID parameters that are listed in the ddi.h header file are obsolete and may not be used in any DDI drivers.

UDI compatibility

Use the udi_time_between( ), udi_time_since( ), and udi_timer_current( ) to replace calls to the TICKS( ) macros in UDI drivers. See ``lbolt'' in HDK Technical Reference for more information.

References

drv_hztousec(D3), drv_priv(D3), drv_setparm(D3), drv_usectohz(D3), proc_signal(D3), kmem_alloc_phys(D3), psignal(D3), TICKS(D3), vtop(D3)
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005