Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 May 2009 06:19:37 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r193016 - head/sys/compat/svr4
Message-ID:  <200905290619.n4T6JbIg061753@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Fri May 29 06:19:37 2009
New Revision: 193016
URL: http://svn.freebsd.org/changeset/base/193016

Log:
  Fix the sysinfo(SI_HW_SERIAL, emulation so that we actually get the
  hostid of the machine rather than always getting "0".
  
  PR:		kern/91293
  Submitted by:	"Pedro f. Giffuni" <giffunip asme org>
  Obtained from:	NetBSD

Modified:
  head/sys/compat/svr4/svr4_stat.c

Modified: head/sys/compat/svr4/svr4_stat.c
==============================================================================
--- head/sys/compat/svr4/svr4_stat.c	Fri May 29 06:04:26 2009	(r193015)
+++ head/sys/compat/svr4/svr4_stat.c	Fri May 29 06:19:37 2009	(r193016)
@@ -417,9 +417,10 @@ svr4_sys_systeminfo(td, uap)
 	int		error = 0;
 	register_t	*retval = td->td_retval;
 	size_t		len = 0;
-	char		buf[1];   /* XXX NetBSD uses 256, but that seems
-				     like awfully excessive kstack usage
-				     for an empty string... */
+	char		buf[11];   /* XXX NetBSD uses 256, but we use 11
+				     here as that seems like awfully
+				     excessive kstack usage for hostid
+				     string... */
 	u_int		rlen = uap->len;
 
 	switch (uap->what) {
@@ -448,7 +449,8 @@ svr4_sys_systeminfo(td, uap)
 		break;
 
 	case SVR4_SI_HW_SERIAL:
-		str = "0";
+		snprintf(buf, sizeof(buf), "%lu", hostid);
+		str = buf;
 		break;
 
 	case SVR4_SI_HW_PROVIDER:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905290619.n4T6JbIg061753>