Venkata Duvvuru wrote this message on Mon, Dec 02, 2013 at 07:10 +0000: > I could use an int variable but if I have to dump huge number of statistics > through sysctl in which case I need to add many such variables to the nodes > and even if most of these variables are char I have to declare them as int, > hence resulting in an increased footprint.
If it's a few 10s of vars, then it isn't a big deal, but if it is 1000's, then you might want to look at another method to extract the data since the overhead of sysctl is expensive... Something like writing a _PROC routine that will copy them all out in a single sysctl call.. > -----Original Message----- > From: John-Mark Gurney [mailto:j...@funkthat.com] > Sent: Sunday, December 01, 2013 3:00 AM > To: Venkata Duvvuru > Cc: Matthew Fleming; email@example.com > Subject: Re: sysctl add macros > > Venkata Duvvuru wrote this message on Mon, Nov 25, 2013 at 14:58 +0000: > > The problem with using int or u_int for 1 or 2 byte values is that while > > printing these 1 or 2 byte values I observed that sysctl module is > > considering 4 bytes. Hence I see an undesired output. It is actually > > considering the next two bytes also as the value. > > If you _NEED_ to use a char or short, you need to write your own/clone it > from the macros... > > Why can't you use an int for this variable? > > > From: mdf...@gmail.com [mailto:mdf...@gmail.com] On Behalf Of Matthew > > Fleming > > Sent: Monday, November 25, 2013 8:18 PM > > To: Venkata Duvvuru > > Cc: firstname.lastname@example.org > > Subject: Re: sysctl add macros > > > > On Mon, Nov 25, 2013 at 3:35 AM, Venkata Duvvuru > > <venkatkumar.duvv...@emulex.com<mailto:venkatkumar.duvv...@emulex.com>> > > wrote: > > Hi, > > I'm unable to figure out how to add an unsigned short or an unsigned char > > values to a sysctl node. > > SYSCTL_ADD_INT, SYSCTL_ADD_UINT, etc., are present but to add a char or a > > short values I couldn't find any macros. > > > > Could you please let me know how to add them? > > > > FreeBSD does not have any sysctl handlers for 1 or 2 byte values. FreeBSD > > code that wants to do this has used int or u_int instead of a smaller type. > > -- > John-Mark Gurney Voice: +1 415 225 5579 > > "All that I will do, has been done, All that I have, has not." > _______________________________________________ > email@example.com mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org" -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." _______________________________________________ firstname.lastname@example.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"