sys_parm Subroutine

Purpose

Provides a service for examining or setting kernel run-time tunable parameters.

Library

Standard C Library (libc.a)

Syntax

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

int sys_parm ( cmd,  parmflag,  parmp)
int cmd;
int parmflag;
struct vario *parmp;

Description

The sys_parm subroutine is used to query and/or customize run-time operating system parameters.

Note: This is a replacement service for sysconfig with respect to querying or changing information in the var structure. The audit subroutine or command can be used to audit changes to the var structure.

The sys_parm subroutine:

The following operations are supported:

Item Description
SYSP_GET Returns a structure containing the current value of the specified run-time parameter found in the var structure.
SYSP_SET Sets the value of the specfied run-time parameter.

The run-time parameters that can be returned or set are found in the var structure as defined in var.h

Parameters

Item Description
cmd Specifies the SYSP_GET or SYSP_SET function.
parmflag Specifies the parameter upon which the function will act.
parmp Points to the user specified structure from which or to which the system parameter value is copied. parmp points to a structure of type vario as defined in var.h.

The vario structure is an abstraction of the various fields in the var structure for which each field is size invariant. The size of the data does not depend on the execution environment of the kernel being 32 or 64 bit or the calling application being 32 or 64 bit.

Examples

  1. To examine the value of v.v_iostrun (collect disk usage statistics).
    #include <sys/var.h>
    #include <stdio.h>
    struct vario myvar;
    rc=sys_parm(SYSP_GET,SYSP_V_IOSTRUN,&myvar);
    if(rc==0)
            printf("v.v_iostrun is set to %d\n",myvar.v.v_iostrun.value);
  2. To change the value of v.v_iostrun (collect disk usage statistics).
    #include <sys/var.h>
    #include <stdio.h>
    struct vario myvar;
    myvar.v.v_iostrun.value=0; /* initialize to false */
    rc=sys_parm(SYSP_SET,SYSP_V_IOSTRUN,&myvar);
    if(rc==0)
            printf("disk usage statistics are not being collected\n");

Other parameters may be examined or set by changing the parmflag parameter.

Return Values

These operations return a value of 0 upon succesful completion of the subroutine. Otherwise or a value of -1 is returned and the errno global variable is set to indicate the error.

Error Codes

Item Description
EACCES The calling process does not have the required privilege.
EINVAL One of the following is true:
  • The command is neither SYSP_GET nor SYSP_SET
  • parmflag is out of range of parameters defined in var.h
  • The value specified in the parmp parameter is not a valid value for the field indicated by the parmflag parameter.
EFAULT An invalid address was specified by the parmp parameter.

File

Item Description
sys/var.h Contains structure definitions.