custom sysctls
Thomas Wolf
tw at wsf.at
Sat Mar 20 10:17:06 PST 2004
Hi,
I have written a very small module to implement 'custom'
sysctls. Everything seems to work as expected, however,
could a kind soul have a look at it an tell me if i have
missed something ?
The source (under /usr/src/sys/modules:
/* --------------------------------------------------- */
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/sysctl.h>
static char current_wanif[10];
static char something[10];
static int example=0;
SYSCTL_NODE(, OID_AUTO, wsf, CTLFLAG_RW, 0,"Configuration data");
SYSCTL_NODE(_wsf, OID_AUTO, net, CTLFLAG_RW, 0,"Network");
SYSCTL_NODE(_wsf, OID_AUTO, info, CTLFLAG_RW, 0,"Info");
SYSCTL_INT( _wsf_net, OID_AUTO, example, CTLFLAG_RW, &example, 0, "");
SYSCTL_STRING(_wsf_net, OID_AUTO, current_wanif, CTLFLAG_RW,
¤t_wanif, sizeof(current_wanif), "Current WAN-interface");
SYSCTL_STRING(_wsf_info, OID_AUTO, something, CTLFLAG_RW,
&something, sizeof(something), "Some useful info");
/* ------------------------------------------------------------- */
Build with the following Makefile:
KMOD= wsf_sysctl
SRCS= wsf_sysctl.c
NOMAN=
CFLAGS+= -I${.CURDIR}/..
.include <bsd.kmod.mk>
Thank you for any comments!
Thomas
--
Thomas Wolf
Wiener Software Fabrik
Dubas u. Wolf GMBH
1050 Wien, Mittersteig 4
--
Thomas Wolf
Wiener Software Fabrik
Dubas u. Wolf GMBH
1050 Wien, Mittersteig 4
More information about the freebsd-hackers
mailing list