svn commit: r193016 - head/sys/compat/svr4

Xin LI delphij at FreeBSD.org
Fri May 29 06:19:38 UTC 2009


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:


More information about the svn-src-all mailing list