Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 May 2012 22:47:56 +0100 (BST)
From:      Pham Viet Ha <hapvbk@yahoo.co.uk>
To:        "net@freebsd.org" <net@freebsd.org>, "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>
Subject:   sysctl command with struct
Message-ID:  <1336168076.28222.YahooMailNeo@web28802.mail.ir2.yahoo.com>

next in thread | raw e-mail | index | archive | help
Hi all,=0A=0AI am writing a code using sysctl to manipulate a kernel variab=
le. The variable is a data structure with two fields, protocol number (uint=
16_t) and description (char *).=0A=0AI have some difficulties with sysctl c=
ommand to pass both protocol number and description at a time to the kernel=
. I used CTLTYPE_OPAQUE in SYSCTL_ADD_PROC call, then I used=A0sysctl_handl=
e_opaque to read data.=A0=0A=0AIt does not work correctly. I don't know how=
 what is the format I have to use when I type in "sysctl ..." at the prompt=
.=A0=0A=0Astruct protodesc {=A0=0Auint16_t protonumber;=A0=0Achar descripti=
on[256];=0A}



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