#include <sys/types.h> #include <netinet/in_cfg.h> #include <fcntl.h> #include <paths.h>fd = open(_PATH_INCONFIG, flags);
Access to the INCF driver is via two ioctls: INCFG_RETRIEVE and INCFG_MODIFY. These ioctls are issued as I_STR ioctls (see streamio(7)).
Each ioctl operates on an in_config_t structure, which has the following definition:
#define MAX_SYM 256typedef struct in_config { char *ic_kname; /* symbol name in kernel */ char ic_name[MAX_SYM]; /* symbol name */ caddr_t ic_addr; /* kernel address */ u_long ic_current; /* current/default val */ u_long ic_minimum; /* minimum value */ u_long ic_maximum; /* maximum value */ } in_config_t;
To retrieve current information about a kernel variable,
copy the name of the desired variable into the
ic_name
field,
and then issue
an
INCFG_RETRIEVE
ioctl.
The
ic_current
,
ic_minimum
,
and
ic_maximum
fields will be filled in by the kernel.
To modify the value of a variable,
copy the name of the desired variable into the
ic_name
field, assign the desired value to the
ic_current
field,
and issue an
INCFG_MODIFY
ioctl.
The kernel performs upper and lower bounds checking on the specified value.
If the value is acceptable, the kernel configuration will be updated.
ioc_count
of the argument is not the
size of an
in_config_t
structure