From owner-p4-projects@FreeBSD.ORG Thu Jan 18 16:57:17 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A432416A417; Thu, 18 Jan 2007 16:57:17 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3E86816A407 for ; Thu, 18 Jan 2007 16:57:17 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from anuket.mj.niksun.com (gwnew.niksun.com [65.115.46.162]) by mx1.freebsd.org (Postfix) with ESMTP id F0FBE13C45D for ; Thu, 18 Jan 2007 16:57:16 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from niksun.com (anuket [10.70.0.5]) by anuket.mj.niksun.com (8.13.6/8.13.6) with ESMTP id l0IGvF5R086383; Thu, 18 Jan 2007 11:57:15 -0500 (EST) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: John Baldwin Date: Thu, 18 Jan 2007 11:57:12 -0500 User-Agent: KMail/1.6.2 References: <200701180243.l0I2hcLn035071@repoman.freebsd.org> <200701180917.15131.jhb@freebsd.org> In-Reply-To: <200701180917.15131.jhb@freebsd.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200701181157.13834.jkim@FreeBSD.org> X-Virus-Scanned: ClamAV 0.88.6/2462/Thu Jan 18 05:07:46 2007 on anuket.mj.niksun.com X-Virus-Status: Clean Cc: Perforce Change Reviews Subject: Re: PERFORCE change 113090 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jan 2007 16:57:17 -0000 On Thursday 18 January 2007 09:17 am, John Baldwin wrote: > On Wednesday 17 January 2007 21:43, Jung-uk Kim wrote: > > http://perforce.freebsd.org/chv.cgi?CH=113090 > > > > Change 113090 by jkim@jkim_hammer on 2007/01/18 02:43:32 > > > > - Add Linux kernel version strings to /proc/sys/kernel. > > - Properly implement OS build date string instead of using fake > > one. > > > > Affected files ... > > > > .. > > //depot/projects/linuxolator/src/sys/compat/linprocfs/linprocfs.c > >#8 edit > > > > Differences ... > > > > ==== > > //depot/projects/linuxolator/src/sys/compat/linprocfs/linprocfs.c > >#8 (text+ko) ==== > > > > @@ -416,6 +416,37 @@ > > } > > > > /* > > + * Get OS build date > > + */ > > +static void > > +linprocfs_osbuild(struct thread *td, struct sbuf *sb) > > +{ > > + char osbuild[256]; > > + int kern_ver[2]; > > + size_t size; > > + char *cp1, *cp2; > > + > > + cp1 = NULL; > > + kern_ver[0] = CTL_KERN; > > + kern_ver[1] = KERN_VERSION; > > + osbuild[0] = '\0'; > > + size = sizeof(osbuild); > > + if (kernel_sysctl(td, kern_ver, 2, &osbuild, &size, 0, 0, 0, 0) > > == 0) { + cp1 = strstr(osbuild, "\n"); > > + cp2 = strstr(osbuild, ":"); > > + if (cp1 && cp2) { > > + *cp1 = *cp2 = '\0'; > > + cp1 = strstr(osbuild, "#"); > > + } else > > + cp1 = NULL; > > + } > > + if (cp1) > > + sbuf_printf(sb, "%s%s", cp1, cp2 + 1); > > + else > > + sbuf_printf(sb, "#4 Sun Dec 18 04:30:00 CET 1977"); > > +} > > You can just reference the 'version' global variable w/o having to > bounce through the sysctl. It's defined in . Actually I thought about that but I implemented this way for no apparent reason. :-) I will just grab sys/systm.h in the next revision and I will parse builder string as well. Thanks, Jung-uk Kim