[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions , Volume 2

SYS_SETPARMS sysconfig Operation


Sets the kernel run-time tunable parameters.


The SYS_SETPARMS sysconfig operation sets the current system parameters from a copy of the system parameter var structure provided by the caller. Only the run-time tunable parameters in the var structure can be set by this subroutine.

If the var_vers and var_gen values in the caller-provided structure do not match the var_vers and var_gen values in the current system var structure, no parameters are modified and an error is returned. The var_vers, var_gen, and var_size fields in the structure should not be altered. The var_vers value is assigned by the kernel and is used to insure that the correct version of the structure is being used. The var_gen value is a generation number having a new value for each read of the structure. This provides consistency between the data read by the SYS_GETPARMS (SYS_GETPARMS sysconfig Operation) operation and the data written by the SYS_SETPARMS operation.

The parmp parameter on the sysconfig subroutine points to a buffer that contains all or part of the var structure as defined in the sys/var.h file.

The parmlen parameter on the subroutine should be set either to the length of the var structure or to the size of the structure containing the parameters to be modified. The number of system parameters modified by this operation is determined either by the parmlen parameter value or by the var_size field in the caller-provided var structure. (The smaller of the two values is used.)

The structure provided by the caller must contain at least the header fields of the var structure. Otherwise, an error will be returned. Partial modification of a parameter in the var structure can occur if the caller's data area does not contain enough data to end on a field boundary. It is up to the caller to ensure that this does not happen.

Return Values

The SYS_SETPARMS sysconfig operation returns a value of -1 if an error occurred.

Error Codes

When an error occurs, the errno global variable is set to one of the following values:

EACESS The calling process does not have the required privilege.
EINVAL One of the following error situations exists:
  • The var_vers version number of the provided structure does not match the version number of the current var structure.
  • The structure provided by the caller does not contain enough data to specify the header fields within the var structure.
  • One of the specified variable values is invalid or not allowed. On the return from the subroutine, the var_vers field in the caller-provided buffer contains the byte offset of the first variable in the structure that was detected in error.
EAGAIN The var_gen generation number in the structure provided does not match the current generation number in the kernel. This occurs if consistency is lost between reads and writes of this structure. The caller should repeat the read, modify, and write operations on the structure.
EFAULT The calling process does not have sufficient authority to access the data area described by the parmp and parmlen parameters provided to the subroutine. This error is also returned if an I/O error occurred when accessing data in this area.


sys/var.h Contains structure definitions.

Related Information

The sysconfig (sysconfig Subroutine) subroutine and sys_parm (sys_parm Subroutine) subroutine.

The SYS_GETPARMS (SYS_GETPARMS sysconfig Operation) sysconfig operation.

Programming in the Kernel Environment Overview in AIX 5L Version 5.1 Kernel Extensions and Device Support Programming Concepts.

[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]