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,

I am writing a code using sysctl to manipulate a kernel variable. The variable is a data structure with two fields, protocol number (uint16_t) and description (char *).

I have some difficulties with sysctl command 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 sysctl_handle_opaque to read data. 

It 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. 

struct protodesc { 
uint16_t protonumber; 
char description[256];
}



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