From owner-freebsd-arch@FreeBSD.ORG Fri Aug 6 22:41:31 2010 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FE38106566C for ; Fri, 6 Aug 2010 22:41:31 +0000 (UTC) (envelope-from peter@wemm.org) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id C3EB08FC14 for ; Fri, 6 Aug 2010 22:41:30 +0000 (UTC) Received: by qwg5 with SMTP id 5so4074829qwg.13 for ; Fri, 06 Aug 2010 15:41:30 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.69.17 with SMTP id x17mr6408316qai.283.1281133184956; Fri, 06 Aug 2010 15:19:44 -0700 (PDT) Received: by 10.229.189.15 with HTTP; Fri, 6 Aug 2010 15:19:44 -0700 (PDT) In-Reply-To: References: Date: Fri, 6 Aug 2010 15:19:44 -0700 Message-ID: From: Peter Wemm To: Jeff Roberson Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: arch@freebsd.org Subject: Re: Change to sysctl to support linux kobj X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2010 22:41:31 -0000 On Thu, Aug 5, 2010 at 2:46 PM, Jeff Roberson wro= te: > Hi folks, > > I really need two pointer arguments to a sysctl function to support linux > sysfs via sysctl. =A0To facilitate this I propose changing the int arg2 t= o a > uinptr_t. =A0This keeps it as an integer type but makes it wide enough to > accept a pointer. =A0A small number of places in the kernel have to be fi= xed > for the new type or because they don't use SYSCTL_HANDLER_ARGS. =A0This w= ill > introduce an api/abi incompatibility although it is relatively minor. > > Comments? =A0Alternatives? > > Thanks, > Jeff > > Index: sysctl.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- sysctl.h =A0 =A0(revision 207767) > +++ sysctl.h =A0 =A0(working copy) > @@ -114,8 +114,8 @@ > =A0#define CTL_AUTO_START 0x100 > > =A0#ifdef _KERNEL > -#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, int arg= 2, > \ > - =A0 =A0 =A0 struct sysctl_req *req > +#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, =A0 =A0= =A0 \ > + =A0 =A0 =A0 uintptr_t arg2, struct sysctl_req *req > > =A0/* definitions for sysctl_req 'lock' member */ > =A0#define REQ_UNLOCKED =A0 0 =A0 =A0 =A0 /* not locked and not wired */ > @@ -158,7 +158,7 @@ > =A0 =A0 =A0 =A0int =A0 =A0 =A0 =A0 =A0 =A0 oid_number; > =A0 =A0 =A0 =A0u_int =A0 =A0 =A0 =A0 =A0 oid_kind; > =A0 =A0 =A0 =A0void =A0 =A0 =A0 =A0 =A0 =A0*oid_arg1; > - =A0 =A0 =A0 int =A0 =A0 =A0 =A0 =A0 =A0 oid_arg2; > + =A0 =A0 =A0 uintptr_t =A0 =A0 =A0 oid_arg2; > =A0 =A0 =A0 =A0const char =A0 =A0 =A0*oid_name; > =A0 =A0 =A0 =A0int =A0 =A0 =A0 =A0 =A0 =A0 (*oid_handler)(SYSCTL_HANDLER_= ARGS); > =A0 =A0 =A0 =A0const char =A0 =A0 =A0*oid_fmt; > > _______________________________________________ > freebsd-arch@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-arch > To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org" > My initial thoughts.. 32 bit systems should be unaffected. Impact on 64 bit systems may be low.. For the args passing on amd64, that should be covered by the already 64 bit register passing. The impact on sysctl_oid struct is varied. It won't change the size on 64 bit systems because of native alignment requirements adding invisible padding in the structure already. A 64 bit type, followed by 32 bit, followed by 64 bit, leaves space to expand the 32 bit to a 64 bit object. However, little vs big endian is affected to a different degree. Big endian ppc64 would be affected since the oid_arg2 fields won't be in the same bit positions. The impact on little endian systems depends on what goes into the padding area. If it is usually initialized to zeroes, we might get away with it. --=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV "All of this is for nothing if we don't go to the stars" - JMS/B5 "If Java had true garbage collection, most programs would delete themselves upon execution." -- Robert Sewell