Module Name: src Committed By: dholland Date: Mon Jun 13 03:42:15 UTC 2011
Modified Files: src/bin/ps: print.c Log Message: When converting from pages to kilobytes, cast the return value of getpagesize() to size_t. For some reason getpagesize() is defined to return int, and several of the page counts we get come back from the kernel as int32_t; in LP64 without the cast the byte count will be computed in a 32-bit value and for large processes will overflow and become negative... and then remain negative when divided by 1024 to convert to kilobytes. Fixes a problem I hit the other day where I saw negative RSS, which turns out also to be PR 40642. Note: other logic in here will break down when we first get >2TB processes... and int32 page counts will break on >8TB processes. But hopefully we won't see any of that for a few years yet. To generate a diff of this commit: cvs rdiff -u -r1.117 -r1.118 src/bin/ps/print.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.