cfgncb Configuration Notification Control Block

Purpose

Contains the address of a notification routine that is invoked each time the sysconfig subroutine is called with the SYS_SETPARMS command.

Syntax

int func (cmd, cur, new)
int cmd;
struct var *cur;
struct var *new;

Parameters

Item Description
cmd Indicates the current operation type. Possible values are CFGV_PREPARE and CFGV_COMMIT, as defined in the /usr/include/sys/sysconfig.h file.
cur Points to a var structure representing the current values of system-configurable variables.
new Points to a var structure representing the new or proposed values of system-configurable variables.

The cur and new var structures are both in the system address space.

Description

The configuration notification control block contains the address of a notification routine. This structure is intended to be used as a list element in a list of similar control blocks maintained by the kernel.

Each control block has the following definition:

struct cfgncb {
   struct cfgncb     *cbnext;      /* next block on chain         */
   struct cfgncb     *cbprev;      /* prev control block on chain */
   int    (*func)();               /* notification function       */
   };
   

The cfgndel or cfgnadd kernel service can be used to add or delete a cfgncb control block from the cfgncb list. To use either of these kernel services, the calling routine must define the cfgncb control block. This definition can be done using the /usr/include/sys/sysconfig.h file.

Every time a SYS_SETPARMS sysconfig command is issued, the sysconfig subroutine iterates through the kernel list of cfgncb blocks, invoking each notification routine with a CFGV_PREPARE command. This call represents the first pass of what is for the notification routine a two-pass process.

On a CFGV_PREPARE command, the cfgncb.func notification routine should determine if any values of interest have changed. All changed values should be checked for validity. If the values are valid, a return code of 0 should be returned. Otherwise, a return value indicating the byte offset of the first field in error in the new var structure should be returned.

If all registered notification routines create a return code of 0, then no value errors have been detected during validity checking. In this case, the sysconfig subroutine issues its second pass call to the cfgncb.func routine and sends the same parameters, although the cmd parameter contains a value of CFGV_COMMIT. This indicates that the new values go into effect at the earliest opportunity.

An example of notification routine processing might be the following. Suppose the user wishes to increase the size of the block I/O buffer cache. On a CFGV_PREPARE command, the block I/O notification routine would verify that the proposed new size for the cache is legal. On a CFGV_COMMIT command, the notification routine would then make the additional buffers available to the user by chaining more buffers onto the existing list of buffers.