Date: Sat, 8 Jan 2005 03:47:14 -0600 From: "Conrad J. Sabatier" <conrads@cox.net> To: Craig Rodrigues <rodrigc@crodrigues.org> Cc: Kris Kennaway <kris@obsecurity.org> Subject: Re: Hack to sysctl kern.osreldate, for ports cluster Message-ID: <20050108034714.40f42462@dolphin.local.net> In-Reply-To: <20050108071324.GA32371@crodrigues.org> References: <20050108071324.GA32371@crodrigues.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 8 Jan 2005 02:13:24 -0500, Craig Rodrigues <rodrigc@crodrigues.org> 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 <conrads@cox.net> -- "In Unix veritas"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050108034714.40f42462>