Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ drv_getparm(D3DK) — Motorola System V 88k Release 4 Version 4.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

drv_getparm(D3DK)  —  

.IX \f4drv_getparm\fP(D3DK)

NAME

drv_getparm − retrieve kernel state information

SYNOPSIS

#include <sys/types.h>
#include <sys/diag-cntl.h>
#include <sys/ddi.h>
int drv_getparm(unsigned long parm, unsigned long ∗value_p);

ARGUMENTS

parmThe kernel parameter to be obtained from ddi.h.  Possible values are:

LBOLT Read the number of clock ticks since the last system reboot.  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(D3DK) and drv_usectohz(D3DK) functions can be used, as necessary, to convert between clock ticks and microseconds (implementation independent units). 

PPGRP Read the process group identification number.  This number determines which processes should receive a HANGUP or BREAK signal when detected by a driver. 

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(D3DK).  Since this value is associated with the current process, the caller must have process context (that is, must be at base level) when attempting to retrieve this value.  Also, this value should only be used in the context of the process in which it was retrieved. 

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 drv_priv(D3DK).  Since this value is associated with the current process, the caller must have process context (that is, must be at base level) when attempting to retrieve this value.  Also, this value should only be used in the context of the process in which it was retrieved. 

PPID Read process identification number. 

PSID Read process session identification number. 

TIME Read the time in seconds.  This is the same time value that is returned by the time(2) 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. 

CPUBOARD
Read the CPU board token. The values for the token may be found in the file /usr/include/sys/mvmecpu.h. 

DRVR_DIAG_CNTL
Read the diagnostic control information for a specific driver. For a driver to obtain its diagnostic control information it must compute a value for parm.  This is done by adding DRVR_DIAG_CNTL to the value of the external major for the device.  The value returned in ∗value_p is of type (struct driver_diagnostic_info ∗). 

CPU_FRU_STATUS
When calling drv_getparm with a parm of CPU_FRU_STATUS, value_p must point to a structure of type struct dinfo_fru_status.  drv_getparm will initialize all fields of that structure with information about the cpu board running the UNIX kernel. 

value_pA pointer to the data space where the value of the parameter is to be copied. 

DESCRIPTION

This 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. 

drv_getparm does not check 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.  The driver writer must use this function only when appropriate and should correctly declare the data space needed by the driver. 

RETURN VALUES

drv_getparm 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, undefined if -1 is returned.  -1 is returned if you specify a value other than those specified above.  Always check the return code when using this function. 

LEVEL

Base only when using the PPGRP, PPID, PSID, TIME, UPROCP, DRVR_DIAG_CNTL, or CPU_FRU_STATUS argument values.  Interrupt usable when using the LBOLT and CPUBOARD argument value. 

SEE ALSO

buf(D4DK), vtop(D3DK)

DDI/DKI

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026