| Summary: | vmstat.c: certain variables appear to have wrong declaration | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Ryan Beasley <ryanb> | ||||||
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> | ||||||
| Status: | Closed FIXED | ||||||||
| Severity: | Affects Only Me | ||||||||
| Priority: | Normal | ||||||||
| Version: | 4.4-STABLE | ||||||||
| Hardware: | Any | ||||||||
| OS: | Any | ||||||||
| Attachments: |
|
||||||||
State Changed From-To: open->analyzed I've looked at it. Better would be to use uint64_t instead of u_int64_t, since the latter is more BSD specific and the first more POSIX. I will run this past Jeff R. and Alan Cox. State Changed From-To: analyzed->closed Slightly different patch committed. Thanks! |
In vmstat.c, totreq is declared as a long, though the ks_calls (sys/malloc.h) that it's based from is int64_t. On one of our machines, the following output was returned from vmstat -m. Memory Totals: In Use Free Requests 12615K 21482K -2105873852 Relevant snips of code from vmstat.c 1.38.2.4: 760: long totuse = 0, totfree = 0, totreq = 0; 861: totreq += ks->ks_calls; 864: (void)printf(" %7ldK %6ldK %8ld\n", 865: (totuse + 1023) / 1024, (totfree + 1023) / 1024, totreq); With patch listed below, new output is as follows: Memory Totals: In Use Free Requests 12601K 21496K 10779019213 Fix: To be consistent with the declarations in sys/malloc.h: How-To-Repeat: To be honest, not sure, outside of lots of malloc calls as defined in sys/malloc.h as opposed to stdlib.h. I'm not a skilled coder.