Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Dec 2013 07:10:11 +0000
From:      Venkata Duvvuru <VenkatKumar.Duvvuru@Emulex.Com>
To:        John-Mark Gurney <jmg@funkthat.com>
Cc:        Matthew Fleming <mdf@freebsd.org>, "freebsd-current@freebsd.org" <freebsd-current@freebsd.org>
Subject:   RE: sysctl add macros
Message-ID:  <BF3270C86E8B1349A26C34E4EC1C44CB2C7E46D7@CMEXMB1.ad.emulex.com>
In-Reply-To: <20131130213006.GC55638@funkthat.com>
References:  <BF3270C86E8B1349A26C34E4EC1C44CB2C7E0C74@CMEXMB1.ad.emulex.com> <CAMBSHm9K_Yu9SDdHP1exh99RXq9tta7kwVWQbEY_zs2ZJa5RjQ@mail.gmail.com> <BF3270C86E8B1349A26C34E4EC1C44CB2C7E0D3E@CMEXMB1.ad.emulex.com> <20131130213006.GC55638@funkthat.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 node=
s and even if most of these variables are char I have to declare them as in=
t, hence resulting in an increased footprint.

/Venkat.

-----Original Message-----
From: John-Mark Gurney [mailto:jmg@funkthat.com]=20
Sent: Sunday, December 01, 2013 3:00 AM
To: Venkata Duvvuru
Cc: Matthew Fleming; freebsd-current@freebsd.org
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 consider=
ing 4 bytes. Hence I see an undesired output. It is actually considering th=
e next two bytes also as the value.

If you _NEED_ to use a char or short, you need to write your own/clone it f=
rom the macros...

Why can't you use an int for this variable?

> From: mdf356@gmail.com [mailto:mdf356@gmail.com] On Behalf Of Matthew=20
> Fleming
> Sent: Monday, November 25, 2013 8:18 PM
> To: Venkata Duvvuru
> Cc: freebsd-current@freebsd.org
> Subject: Re: sysctl add macros
>=20
> On Mon, Nov 25, 2013 at 3:35 AM, Venkata Duvvuru <VenkatKumar.Duvvuru@emu=
lex.com<mailto:VenkatKumar.Duvvuru@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.
>=20
> Could you please let me know how to add them?
>=20
> FreeBSD does not have any sysctl handlers for 1 or 2 byte values.  FreeBS=
D code that wants to do this has used int or u_int instead of a smaller typ=
e.

--=20
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."



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