sysctl command with struct
Pham Viet Ha
hapvbk at yahoo.co.uk
Fri May 4 21:48:04 UTC 2012
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];
}
More information about the freebsd-net
mailing list