Bug 430424 - Redeem "vmstat.c" source.
Summary: Redeem "vmstat.c" source.
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: procps
Version: 4.6
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Tomas Smetana
QA Contact: Brian Brock
Depends On:
TreeView+ depends on / blocked
Reported: 2008-01-27 22:53 UTC by David Tonhofer
Modified: 2008-03-10 09:26 UTC (History)
1 user (show)

Clone Of:
Last Closed: 2008-03-10 09:26:17 UTC

Attachments (Terms of Use)
Unified diff for vmstat.c (24.76 KB, patch)
2008-01-27 22:53 UTC, David Tonhofer
no flags Details | Diff

Description David Tonhofer 2008-01-27 22:53:59 UTC
Description of problem:

procps-3.2.3-8.9 "vmstat.c" code has a few style problems.

Patch provided. This patch includes the Red Hat "procps-3.2.3-vmstat-pgpg.patch"
which transforms "unsigned long" to "unsigned long long" in some cases.

What is fixed:

Most important: 

Changed the usage output fully - hopefully made clearer, added '-f' explanation
which was missing.

Most problematic:

Output "-s" displays "KB", "KiB", "MB", "MiB" instead of "k", "K", "m", "M",
which is nicer but may break some programs which parse the output of vmstat.

Style fixes:

The "unit selectors" (dataUnit,szDataUnit) are transformed from global vars to
local var passed as arguments.

The "number of updates" (num_updates) is transformed from global var to local
var passed as argument.

The "display forks since boot" mode is implemented as a mode, not as a call and

The "display active/inactive pages" (a_option) is transformed from global var to
local var passed as argument.

Added function count32Bits() to check whether user requested more than one mode.
Removed the "FIXME" remark for that.

unitConvert() has a special case for SLABSTAT mode which never occurs. Commented

Used "strncpy" instead of "strcpy" to read partition name form argument line.

In main(), "argc" was horribly recycled as "counter of integer arguments". Fixed.

The printf() call for the vmstat results has been rearranged to always used
"delta" values; it's just clearer.

Some variables have been renamed; this makes the diff messy but the code nicer.

Comment 1 David Tonhofer 2008-01-27 22:53:59 UTC
Created attachment 293088 [details]
Unified diff for vmstat.c

Comment 2 Tomas Smetana 2008-01-28 06:49:26 UTC
Thank you for the patch.  However I don't wish to include patches that don't
have bugzillas associated and are not present in the upstream version.  Have you
sent the patch upstream?

Comment 3 David Tonhofer 2008-01-28 13:17:01 UTC
No, I haven't ... yet. Where do I post it? Wat about the Red Hat patch which
transforms some "long" to "long long" (and also affects other files)? Do I
include it?

Comment 4 Tomas Smetana 2008-01-28 13:42:58 UTC
The procps upstream maintainer is Albert Cahalan <albert@users.sf.net>.  Update
your patch according to the latest CVS version and send it to him (a good
starting point is the project homepage: http://procps.sourceforge.net/).

It is up to the Product Management to decide what patch is to be included in
RHEL.  I'm afraid that code cleanup that doesn't fix any bug is really not a
good adept for RHEL inclusion.  Even more: as you noted changing the output
format may cause incompatibilities -- this is simply unacceptable (in RHEL)
without any further justification.

Hope I made clearer...

Comment 6 RHEL Product and Program Management 2008-03-05 10:08:09 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update

Comment 8 RHEL Product and Program Management 2008-03-10 09:26:17 UTC
Development Management has reviewed and declined this request.  You may appeal
this decision by reopening this request. 

Note You need to log in before you can comment on or make changes to this bug.