Re-add backward compatibility which got lost in
058e8154.
Initializing unknown struct members to 0xdead is similar to
the fallback.
For upward compatibility ignore columns > 16 but not the whole
line (in case the kernel would add more columns in future).
Reported-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
while (fgetc(f) != '\n'); /* skip header */
while (fgets(buf, sizeof(buf), f) != NULL) {
+ /* scan for the first 14-16 columns (e.g. Linux 2.6.32 has 14) */
+ p->shm_rss = 0xdead;
+ p->shm_swp = 0xdead;
if (sscanf(buf,
"%d %d %o %"SCNu64 " %u %u "
"%"SCNu64 " %u %u %u %u %"SCNi64 " %"SCNi64 " %"SCNi64
&p->shm_dtim,
&p->shm_ctim,
&p->shm_rss,
- &p->shm_swp) != 16)
+ &p->shm_swp) < 14)
continue; /* ivalid line, skipped */
if (id > -1) {