Module Name:    src
Committed By:   tsutsui
Date:           Tue Apr  7 10:49:54 UTC 2009

Modified Files:
        src/sys/kern: init_main.c

Log Message:
Explicitly pass a specific buffer length to format_bytes() to
make it print memory sizes in humanized readable digits.


To generate a diff of this commit:
cvs rdiff -u -r1.387 -r1.388 src/sys/kern/init_main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/init_main.c
diff -u src/sys/kern/init_main.c:1.387 src/sys/kern/init_main.c:1.388
--- src/sys/kern/init_main.c:1.387	Thu Apr  2 19:43:11 2009
+++ src/sys/kern/init_main.c	Tue Apr  7 10:49:54 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: init_main.c,v 1.387 2009/04/02 19:43:11 ad Exp $	*/
+/*	$NetBSD: init_main.c,v 1.388 2009/04/07 10:49:54 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.387 2009/04/02 19:43:11 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.388 2009/04/07 10:49:54 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_ipsec.h"
@@ -919,6 +919,8 @@
  * - Print a limited banner if AB_SILENT.
  * - Always send normal banner to the log.
  */
+#define MEM_PBUFSIZE	sizeof("99999 MB")
+
 void
 banner(void)
 {
@@ -942,8 +944,8 @@
 
 	memset(pbuf, 0, sizeof(pbuf));
 	(*pr)("%s%s", copyright, version);
-	format_bytes(pbuf, sizeof(pbuf), ctob((uint64_t)physmem));
+	format_bytes(pbuf, MEM_PBUFSIZE, ctob((uint64_t)physmem));
 	(*pr)("total memory = %s\n", pbuf);
-	format_bytes(pbuf, sizeof(pbuf), ctob((uint64_t)uvmexp.free));
+	format_bytes(pbuf, MEM_PBUFSIZE, ctob((uint64_t)uvmexp.free));
 	(*pr)("avail memory = %s\n", pbuf);
 }

Reply via email to