Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Mar 2004 18:14:19 -0000
From:      Thomas Wolf <tw@wsf.at>
To:        freebsd-hackers@freebsd.org
Subject:   custom sysctls
Message-ID:  <20040320191419.2a5tojaij1nog@.mailhost.wsf.at>

next in thread | raw e-mail | index | archive | help

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,
    &current_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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040320191419.2a5tojaij1nog>