From owner-freebsd-current@FreeBSD.ORG Mon Nov 25 14:58:53 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 47EF0F8; Mon, 25 Nov 2013 14:58:53 +0000 (UTC) Received: from CMEXEDGE1.ext.emulex.com (cmexedge1.ext.emulex.com [138.239.224.99]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 251142F91; Mon, 25 Nov 2013 14:58:53 +0000 (UTC) Received: from CMEXHTCAS1.ad.emulex.com (138.239.115.217) by CMEXEDGE1.ext.emulex.com (138.239.224.99) with Microsoft SMTP Server (TLS) id 14.3.146.0; Mon, 25 Nov 2013 06:59:06 -0800 Received: from CMEXMB1.ad.emulex.com ([169.254.1.137]) by CMEXHTCAS1.ad.emulex.com ([2002:8aef:73d9::8aef:73d9]) with mapi id 14.03.0146.002; Mon, 25 Nov 2013 06:58:51 -0800 From: Venkata Duvvuru To: Matthew Fleming Subject: RE: sysctl add macros Thread-Topic: sysctl add macros Thread-Index: Ac7py2Eb3GYul2HXQGupi09t7TvnXQAZRFYAABCOHkA= Date: Mon, 25 Nov 2013 14:58:50 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.226.252.30] MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.16 Cc: "freebsd-current@freebsd.org" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Nov 2013 14:58:53 -0000 The problem with using int or u_int for 1 or 2 byte values is that while pr= inting these 1 or 2 byte values I observed that sysctl module is considerin= g 4 bytes. Hence I see an undesired output. It is actually considering the = next two bytes also as the value. /Venkat. From: mdf356@gmail.com [mailto:mdf356@gmail.com] On Behalf Of Matthew Flemi= ng Sent: Monday, November 25, 2013 8:18 PM To: Venkata Duvvuru Cc: freebsd-current@freebsd.org Subject: Re: sysctl add macros On Mon, Nov 25, 2013 at 3:35 AM, Venkata Duvvuru > wrote: Hi, I'm unable to figure out how to add an unsigned short or an unsigned char v= alues to a sysctl node. SYSCTL_ADD_INT, SYSCTL_ADD_UINT, etc., are present but to add a char or a s= hort 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. Cheers, matthew