Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: regression with sys/kern/init_main.c:banner()



ad%NetBSD.org@localhost wrote:

> On Thu, Apr 02, 2009 at 02:19:34PM +0200, Jukka Salmi wrote:
> > Kurt Schreiner --> current-users (2009-04-02 13:56:20 +0200):
> > > On Thu, Apr 02, 2009 at 01:11:30PM +0200, Jukka Salmi wrote:
> > > > 
> > > > comparing dmesg(8) output from a 5.99.8 and a 5.99.9 kernel:
> > > > 
> > > > < total memory = 1534 MB
> > > > < avail memory = 1496 MB
> > > > ---
> > > > > total memory = 0 EB
> > > > > avail memory = 0 EB
> > > > 
> > > > Not sure what additional information to provide...
> > > Saw this for a few days on my amd64's, too - went away with another
> > > cvs update some days ago...
> > 
> > Forgot to mention: I'm seeing this on i386 using sources as of now.
> 
> Superb. It worked before I checked it in, and now it is not working.
> format_bytes or humanize_number or whatever seems buggy.

humanize_number() tries to use whole buffer as much as possible,
so we should pass necessary output length rather than available size,
shouldn't we?

---
Index: kern/init_main.c
===================================================================
RCS file: /cvsroot/src/sys/kern/init_main.c,v
retrieving revision 1.387
diff -u -r1.387 init_main.c
--- kern/init_main.c    2 Apr 2009 19:43:11 -0000       1.387
+++ kern/init_main.c    5 Apr 2009 08:58:19 -0000
@@ -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);
 }

---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index