From owner-freebsd-ports@FreeBSD.ORG Sat Jan 8 09:47:21 2005 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 46BAC16A4CE for ; Sat, 8 Jan 2005 09:47:21 +0000 (GMT) Received: from lakermmtao11.cox.net (lakermmtao11.cox.net [68.230.240.28]) by mx1.FreeBSD.org (Postfix) with ESMTP id AF52D43D2D for ; Sat, 8 Jan 2005 09:47:20 +0000 (GMT) (envelope-from conrads@cox.net) Received: from dolphin.local.net ([68.11.30.50]) by lakermmtao11.cox.net (InterMail vM.6.01.04.00 201-2131-117-20041022) with ESMTP id <20050108094719.KLKH1657.lakermmtao11.cox.net@dolphin.local.net>; Sat, 8 Jan 2005 04:47:19 -0500 Received: from dolphin.local.net (localhost.local.net [127.0.0.1]) by dolphin.local.net (8.13.1/8.13.1) with ESMTP id j089lJ8g022735; Sat, 8 Jan 2005 03:47:19 -0600 (CST) (envelope-from conrads@cox.net) Date: Sat, 8 Jan 2005 03:47:14 -0600 From: "Conrad J. Sabatier" To: Craig Rodrigues Message-ID: <20050108034714.40f42462@dolphin.local.net> In-Reply-To: <20050108071324.GA32371@crodrigues.org> References: <20050108071324.GA32371@crodrigues.org> X-Mailer: Sylpheed-Claws 0.9.13 (GTK+ 1.2.10; amd64-portbld-freebsd6.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit cc: freebsd-ports@freebsd.org cc: Kris Kennaway Subject: Re: Hack to sysctl kern.osreldate, for ports cluster X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jan 2005 09:47:21 -0000 On Sat, 8 Jan 2005 02:13:24 -0500, Craig Rodrigues wrote: > Hi, > > > On http://pointyhat.freebsd.org/errorlogs/ it states > that sysctl should not be used to determine the > version of FreeBSD, and that uname(1) or the OSVERSION > variable should be used instead. > > While a valid thing to do, this is another detail > for port maintainers to keep track of. > > > What do you think of this hack to sysctl, > which cats /usr/include/sys/param.h to get the > value of kern.osreldate, instead of going to > the true kernel sysctl variable? Well, while it's certainly a "doable" thing, don't you think it's just a little bit dangerous? What about when the source tree is not in sync with the currently running kernel? > --- sbin/sysctl/sysctl.c.orig Sat Jan 8 01:34:41 2005 > +++ sbin/sysctl/sysctl.c Sat Jan 8 01:57:13 2005 > @@ -568,8 +568,14 @@ > printf("%d", *(int *)p); > else > printf("%d.%dC", (*(int *)p - 2732) / 10, (*(int > *)p - 2732) % 10); > - } else > - printf(hflag ? "%'d" : "%d", *(int *)p); > + } else { > +#ifdef PORTS_HACK > + if (strcmp("kern.osreldate", name ) == 0) { > + system("awk '/^#define __FreeBSD_version/ { > print $3 }' /usr/include/sys/param.h");+ } else > +#endif /* PORTS_HACK */ > + printf(hflag ? "%'d" : "%d", *(int *)p); > + } > val = " "; > len -= sizeof(int); > p += sizeof(int); > -- > Craig Rodrigues > rodrigc@crodrigues.org > _______________________________________________ > freebsd-ports@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-ports > To unsubscribe, send any mail to > "freebsd-ports-unsubscribe@freebsd.org" > -- Conrad J. Sabatier -- "In Unix veritas"