OBS User unknown 2009-05-15 19:45:51 +00:00 committed by Git OBS Bridge
parent fe8e8206a9
commit 27bce2427a
15 changed files with 368 additions and 416 deletions

View File

@ -1,11 +0,0 @@
--- procps-3.2.5/proc/sysinfo.c
+++ procps-3.2.5/proc/sysinfo.c
@@ -43,7 +43,7 @@
#define VMINFO_FILE "/proc/vmstat"
static int vminfo_fd = -1;
-static char buf[1024];
+static char buf[4096];
/* This macro opens filename only if necessary and seeks to 0 so
* that successive calls to the functions are more efficient.

View File

@ -1,206 +0,0 @@
--- pmap.c
+++ pmap.c 2008-10-08 11:58:38.028263799 +0200
@@ -12,10 +12,13 @@
*/
#include <stdio.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <getopt.h>
+#include <sys/utsname.h>
+#include <unistd.h>
#include "proc/readproc.h"
#include "proc/version.h"
@@ -26,18 +29,28 @@
struct smap {
unsigned long size;
unsigned long rss;
+ unsigned long pss;
unsigned long shared_clean;
unsigned long shared_dirty;
unsigned long private_clean;
unsigned long private_dirty;
+ unsigned long referenced;
+ unsigned long swap;
};
static unsigned long mapped;
static unsigned long shared;
static unsigned long private;
static unsigned long rss;
+static unsigned long pss;
static unsigned long dirty;
+static unsigned long referenced;
+static unsigned long swap;
static FILE *smaps_fp;
+static int maj, min, patch, dopss, noref, doswap;
+static long lbits;
+#define BLK ((lbits==64)?" ":"")
+#define WDT ((lbits==64)?16:8)
static void usage(const char *cmd)
{
@@ -85,6 +98,18 @@ static int get_smap_data(struct smap *sm
smap->rss = data;
rss += data;
+ if (dopss) {
+ /* get pss */
+ if (!fgets(buff, BUFFERSIZE, smaps_fp))
+ return 1;
+
+ assigned = sscanf(buff, "Pss: %lld", &data);
+ if (assigned != 1)
+ return 1;
+ smap->pss = data;
+ pss += data;
+ }
+
/* get shared clean */
if (!fgets(buff, BUFFERSIZE, smaps_fp))
return 1;
@@ -123,6 +148,32 @@ static int get_smap_data(struct smap *sm
smap->private_dirty = data;
dirty += data;
+ if (noref)
+ goto out;
+
+ /* get referenced */
+ if (!fgets(buff, BUFFERSIZE, smaps_fp))
+ return 1;
+
+ assigned = sscanf(buff, "Referenced: %lld", &data);
+ if (assigned != 1)
+ return 1;
+ smap->referenced = data;
+ referenced += data;
+
+ if (!doswap)
+ goto out;
+
+ /* get swap */
+ if (!fgets(buff, BUFFERSIZE, smaps_fp))
+ return 1;
+
+ assigned = sscanf(buff, "Swap: %lld", &data);
+ if (assigned != 1)
+ return 1;
+ smap->swap = data;
+ swap += data;
+out:
return 0;
}
@@ -130,7 +181,7 @@ static void parse_line(pid_t pid, const
{
unsigned long long low, high, size, offset;
unsigned long major, minor;
- struct smap smap = { .rss = 0 };
+ struct smap smap = { .rss = 0, .pss = 0 };
int assigned;
char read_perm, write_perm, exec_perm, access_type;
char obj_buff[OBJECTSIZE] = "[anon]";
@@ -159,17 +210,21 @@ static void parse_line(pid_t pid, const
else if (access_type == 'p' && write_perm == 'w')
private += size;
- printf("%08llx %6lluK ", low, size);
+ printf("%0*llx %6lluK ", WDT, low, size);
if (smaps_fp) {
printf("%6luK ", smap.rss);
+ if (dopss)
+ printf("%6luK ", smap.pss);
printf("%6luK ", smap.private_dirty + smap.shared_dirty);
+ if (doswap)
+ printf("%6luK ", smap.swap);
}
printf("%c%c%c%c ", read_perm, write_perm, exec_perm, access_type);
if (show_devices)
- printf("%08llx %02lx:%02lx ", offset, major, minor);
+ printf("%0*llx %02lx:%02lx ", WDT, offset, major, minor);
printf("%s\n", obj_buff);
}
@@ -181,8 +236,27 @@ int main(int argc, char *argv[])
char path[PATH_MAX];
char buff[BUFFERSIZE];
int o, show_devices = 0, quiet = 0;
+ struct utsname uts;
pid_t pid;
+ if (uname(&uts) < 0) {
+ fprintf(stderr, "error getting information about current kernel: %m\n");
+ exit(EXIT_FAILURE);
+ }
+ sscanf(uts.release, "%d.%d.%d", &maj, &min, &patch);
+
+ if ((maj > 2) || ((maj == 2) && ((min > 6) || ((min == 6) && (patch >= 27)))))
+ doswap++;
+ if ((maj > 2) || ((maj == 2) && ((min > 6) || ((min == 6) && (patch >= 25)))))
+ dopss++;
+ if ((maj < 2) || ((maj == 2) && ((min < 6) || ((min == 6) && (patch < 22)))))
+ noref++;
+
+ if ((lbits = sysconf(_SC_LONG_BIT)) < 0) {
+ fprintf(stderr, "error getting information about current kernel: %m\n");
+ exit(EXIT_FAILURE);
+ }
+
struct option longopts[] = {
{ "help", 0, NULL, 'h' },
{ "version", 0, NULL, 'V' },
@@ -242,11 +316,15 @@ int main(int argc, char *argv[])
smaps_fp = fopen(path, "r");
if (!quiet) {
- printf("START SIZE ");
+ printf("START%s SIZE ", BLK);
if (smaps_fp) {
printf(" RSS ");
+ if (dopss)
+ printf(" PSS ");
printf(" DIRTY ");
+ if (doswap)
+ printf(" SWAP ");
}
if (show_devices)
@@ -259,13 +337,25 @@ int main(int argc, char *argv[])
parse_line(pid, buff, show_devices);
if (!quiet) {
- if (smaps_fp)
- printf("Total: %6luK %6luK %6luK\n\n", mapped, rss, dirty);
- else
+ if (smaps_fp) {
+ printf("Total:%s ", BLK);
+ printf(" %6luK", mapped);
+ printf(" %6luK", rss);
+ if (dopss)
+ printf(" %6luK", pss);
+ printf(" %6luK", dirty);
+ if (doswap)
+ printf(" %6luK", swap);
+ printf("\n\n");
+ } else
printf("mapped: %luK ", mapped);
- printf("%luK writable-private, %luK readonly-private, and %luK shared\n",
- private, mapped - private - shared, shared);
+ if (noref)
+ printf("%luK writable-private, %luK readonly-private, and %luK shared\n",
+ private, mapped - private - shared, shared);
+ else
+ printf("%luK writable-private, %luK readonly-private, %luK shared, and %luK referenced\n",
+ private, mapped - private - shared, shared, referenced);
}
return 0;

View File

@ -1,94 +0,0 @@
| On Tue, Feb 19, 2008 at 7:53 PM, Albert Cahalan <acahalan@cs.uml.edu> wrote:
| > On Feb 18, 2008 10:55 AM, Bart Van Assche <bart.vanassche@gmail.com> wrote:
| >
| > > This leads me to the question: if the layout of /proc/meminfo changes,
| > > who communicates these changes to the procps maintainers ?
| >
| > Nobody ever informs me. :-(
|
| Albert, can you please review the patch below ?
|
| Thanks,
|
| Bart.
|
|
--- procps-3.2.7/proc/library.map
+++ procps-3.2.7/proc/library.map 2008-03-08 10:17:01.000000000 +0100
@@ -18,6 +18,8 @@
kb_main_free; kb_main_total; kb_main_used; kb_swap_free;
kb_swap_total; kb_swap_used; kb_main_shared;
kb_low_total; kb_low_free; kb_high_total; kb_high_free;
+ kb_swap_cached; kb_anon_pages; kb_bounce; kb_nfs_unstable;
+ kb_slab_reclaimable; kb_slab_unreclaimable;
vm_pgpgin; vm_pgpgout; vm_pswpin; vm_pswpout;
free_slabinfo; put_slabinfo; get_slabinfo; get_proc_stats;
local: *;
--- procps-3.2.7/proc/sysinfo.c
+++ procps-3.2.7/proc/sysinfo.c 2008-03-08 10:30:14.000000000 +0100
@@ -8,6 +8,8 @@
// File for parsing top-level /proc entities. */
//
// June 2003, Fabian Frederick, disk and slab info
+// Copyright (c) 2003 Fabian Frederick.
+// Copyright (c) 2008 Bart Van Assche.
#include <stdio.h>
#include <stdlib.h>
@@ -503,6 +505,11 @@
unsigned long kb_swap_free;
unsigned long kb_swap_total;
/* recently introduced */
+unsigned long kb_anon_pages;
+unsigned long kb_bounce;
+unsigned long kb_nfs_unstable;
+unsigned long kb_slab_reclaimable;
+unsigned long kb_slab_unreclaimable;
unsigned long kb_high_free;
unsigned long kb_high_total;
unsigned long kb_low_free;
@@ -539,6 +546,8 @@
char *tail;
static const mem_table_struct mem_table[] = {
{"Active", &kb_active}, // important
+ {"AnonPages", &kb_anon_pages},
+ {"Bounce", &kb_bounce},
{"Buffers", &kb_main_buffers}, // important
{"Cached", &kb_main_cached}, // important
{"Committed_AS", &kb_committed_as},
@@ -556,10 +565,13 @@
{"MemFree", &kb_main_free}, // important
{"MemShared", &kb_main_shared}, // important, but now gone!
{"MemTotal", &kb_main_total}, // important
+ {"NFS_Unstable", &kb_nfs_unstable},
{"PageTables", &kb_pagetables}, // kB version of vmstat nr_page_table_pages
{"ReverseMaps", &nr_reversemaps}, // same as vmstat nr_page_table_pages
{"Slab", &kb_slab}, // kB version of vmstat nr_slab
{"SwapCached", &kb_swap_cached},
+ {"SReclaimable", &kb_slab_reclaimable},
+ {"SUnreclaim", &kb_slab_unreclaimable},
{"SwapFree", &kb_swap_free}, // important
{"SwapTotal", &kb_swap_total}, // important
{"VmallocChunk", &kb_vmalloc_chunk},
@@ -603,6 +615,7 @@
}
kb_swap_used = kb_swap_total - kb_swap_free;
kb_main_used = kb_main_total - kb_main_free;
+ kb_main_cached += kb_slab_reclaimable + kb_swap_cached + kb_nfs_unstable;
}
/*****************************************************************/
--- procps-3.2.7/proc/sysinfo.h
+++ procps-3.2.7/proc/sysinfo.h 2008-03-08 10:15:41.000000000 +0100
@@ -30,6 +30,11 @@
extern unsigned long kb_swap_free;
extern unsigned long kb_swap_total;
/* recently introduced */
+extern unsigned long kb_anon_pages;
+extern unsigned long kb_bounce;
+extern unsigned long kb_nfs_unstable;
+extern unsigned long kb_slab_reclaimable;
+extern unsigned long kb_slab_unreclaimable;
extern unsigned long kb_high_free;
extern unsigned long kb_high_total;
extern unsigned long kb_low_free;

View File

@ -6,7 +6,7 @@
+ /* Show memory by default as kB */
+static int shift = 10;
+#define S(X) (((unsigned long long)(X)<<10)>>shift)
+#define S(X) (unsigned long)(((unsigned long long)(X)<<10)>>shift)
+
// This is the select() timeout. Clear it in sig handlers to avoid a race.
// (signal happens just as we are about to select() and thus does not

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5aae203ea63433a37eb91ec84d08519c5979a881e2d18a94ffcb7e84ff277357
size 229702

View File

@ -0,0 +1,11 @@
--- proc/sysinfo.c
+++ proc/sysinfo.c 2009-05-11 11:18:28.142402352 +0200
@@ -45,7 +45,7 @@ static int vminfo_fd = -1;
// As of 2.6.24 /proc/meminfo seems to need 888 on 64-bit,
// and would need 1258 if the obsolete fields were there.
-static char buf[2048];
+static char buf[4096];
/* This macro opens filename only if necessary and seeks to 0 so
* that successive calls to the functions are more efficient.

View File

@ -1,5 +1,5 @@
--- sysctl.c
+++ sysctl.c 2008-02-14 12:04:35.540780685 +0100
+++ sysctl.c 2008-02-14 12:04:36.000000000 +0100
@@ -128,6 +128,7 @@ static int ReadSetting(const char *restr
char *restrict outname;
char inbuf[1025];
@ -8,15 +8,6 @@
if (!name || !*name) {
fprintf(stderr, ERR_INVALID_KEY, name);
@@ -135,7 +136,7 @@ static int ReadSetting(const char *restr
}
/* used to open the file */
- tmpname = malloc(strlen(name)+strlen(PROC_PATH)+1);
+ tmpname = malloc(strlen(name)+strlen(PROC_PATH)+2);
strcpy(tmpname, PROC_PATH);
strcat(tmpname, name);
slashdot(tmpname+strlen(PROC_PATH),'.','/'); /* change . to / */
@@ -144,6 +145,23 @@ static int ReadSetting(const char *restr
outname = strdup(name);
slashdot(outname,'/','.'); /* change / to . */

View File

@ -1,6 +1,6 @@
--- procps-3.2.7/top.c
+++ procps-3.2.7/top.c 2006-06-26 16:26:56.000000000 +0200
@@ -2480,21 +2480,21 @@
--- top.c
+++ top.c 2009-05-11 11:14:53.402401350 +0200
@@ -2489,21 +2489,21 @@ static void do_key (unsigned c)
static const char err_num_cpus[] = "\aSorry, terminal is not big enough";
#ifdef WARN_NOT_SMP
// standardized 'smp' errors
@ -10,7 +10,7 @@
switch (c) {
case '1':
if (Cpu_tot+7 > Screen_rows && !CHKw(Curwin, View_CPUSUM)) {
if (Cpu_tot+7 > Screen_rows && CHKw(Curwin, View_CPUSUM)) {
show_msg(err_num_cpus);
- break;
- }
@ -21,7 +21,7 @@
#else
TOGw(Curwin, View_CPUSUM);
#endif
+ }
+ }
break;
case 'a':

View File

@ -1,5 +1,5 @@
--- pgrep.1
+++ pgrep.1 2007-10-05 22:36:42.000000000 +1000
+++ pgrep.1 2007-10-05 14:36:42.000000000 +0200
@@ -7,7 +7,7 @@
pgrep, pkill \- look up or signal processes based on name and other attributes
@ -9,7 +9,7 @@
.br
[\-s \fIsid\fP,...] [\-u \fIeuid\fP,...] [\-U \fIuid\fP,...] [\-G \fIgid\fP,...]
.br
@@ -38,6 +38,9 @@
@@ -38,6 +38,9 @@ to each process instead of listing them
.SH OPTIONS
.TP
@ -20,8 +20,8 @@
Sets the string used to delimit each process ID in the output (by
default a newline). (\fBpgrep\fP only.)
--- pgrep.c
+++ pgrep.c 2007-10-05 22:35:52.000000000 +1000
@@ -54,6 +54,7 @@
+++ pgrep.c 2009-05-11 12:38:44.945901308 +0200
@@ -54,6 +54,7 @@ static int opt_oldest = 0;
static int opt_newest = 0;
static int opt_negate = 0;
static int opt_exact = 0;
@ -29,16 +29,7 @@
static int opt_signal = SIGTERM;
static int opt_lock = 0;
static int opt_case = 0;
@@ -77,7 +78,7 @@
if (i_am_pkill)
fprintf (stderr, "Usage: pkill [-SIGNAL] [-fvx] ");
else
- fprintf (stderr, "Usage: pgrep [-flvx] [-d DELIM] ");
+ fprintf (stderr, "Usage: pgrep [-cflvx] [-d DELIM] ");
fprintf (stderr, "[-n|-o] [-P PPIDLIST] [-g PGRPLIST] [-s SIDLIST]\n"
"\t[-u EUIDLIST] [-U UIDLIST] [-G GIDLIST] [-t TERMLIST] "
"[PATTERN]\n");
@@ -562,7 +563,7 @@
@@ -564,7 +565,7 @@ static void parse_opts (int argc, char *
strcat (opts, "ld:");
}
@ -47,17 +38,17 @@
while ((opt = getopt (argc, argv, opts)) != -1) {
switch (opt) {
@@ -610,6 +611,9 @@
@@ -612,6 +613,9 @@ static void parse_opts (int argc, char *
exit(EXIT_SUCCESS);
// case 'c': // Solaris: match by contract ID
// break;
+ case 'c':
+ opt_count = 1;
+ break;
+ case 'c':
+ opt_count = 1;
+ break;
case 'd': // Solaris: change the delimiter
opt_delim = strdup (optarg);
break;
@@ -721,10 +725,14 @@
@@ -723,10 +727,14 @@ int main (int argc, char *argv[])
procs[i].num, strerror (errno));
}
} else {

View File

@ -1,11 +1,6 @@
pmap.1 | 76 +++++---
pmap.c | 559 +++++++++++++++++++++++++++++------------------------------------
2 files changed, 297 insertions(+), 338 deletions(-)
diff -urN procps-3.2.5/pmap.1 procps/pmap.1
--- procps-3.2.5/pmap.1 2005-10-11 14:49:20.000000000 -0400
+++ procps/pmap.1 2005-10-12 10:39:28.000000000 -0400
@@ -1,39 +1,57 @@
--- pmap.1
+++ pmap.1 2009-05-11 12:14:59.377902682 +0200
@@ -1,39 +1,60 @@
-'\" t
-.\" (The preceding line is a note to broken versions of man to tell
-.\" them to pre-process this man page with tbl)
@ -27,7 +22,7 @@ diff -urN procps-3.2.5/pmap.1 procps/pmap.1
-pmap [ -x | -d ] [ -q ] pids...
-pmap -V
-.fi
+.BI "pmap [ \-d | \-q | \-h | \-V ] " pid
+.BI "pmap [ \-d | \-q | \-h | \-V | \-A\ low,high ] " pid
.SH DESCRIPTION
-The pmap command reports the memory map of a process or processes.
@ -61,6 +56,9 @@ diff -urN procps-3.2.5/pmap.1 procps/pmap.1
+.B\-d, \-\^\-device
+Display major and minor device numbers.
+.TP
+.B\-A, \-\-limit=low,high
+Limit results to the given range.
+.TP
+.B\-q, \-\^\-quiet
+Hide header and memory statistics.
+.TP
@ -92,10 +90,9 @@ diff -urN procps-3.2.5/pmap.1 procps/pmap.1
-to <procps-feedback@lists.sf.net>.
+The procps package is maintained by Albert Calahan. Please send
+bug reports to <albert@users.sf.net>.
diff -urN procps-3.2.5/pmap.c procps/pmap.c
--- procps-3.2.5/pmap.c 2005-10-11 14:49:21.000000000 -0400
+++ procps/pmap.c 2005-10-12 10:52:09.000000000 -0400
@@ -1,331 +1,272 @@
--- pmap.c
+++ pmap.c 2009-05-11 12:12:27.653901642 +0200
@@ -1,372 +1,395 @@
/*
- * Copyright 2002 by Albert Cahalan; all rights reserved.
- * This file may be used subject to the terms and conditions of the
@ -109,28 +106,32 @@ diff -urN procps-3.2.5/pmap.c procps/pmap.c
+ *
+ * Chris Rivera <chrismrivera@gmail.com>
+ * Robert Love <rml@novell.com>
+ * Werner Fink <werner@suse.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, v2, as
+ * published by the Free Software Foundation
+ *
+ * Copyright (C) 2003, 2005 Chris Rivera
+ * Copyright (C) 2009 Werner Fink
*/
#include <stdio.h>
+#include <stdint.h>
#include <stdlib.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
#include <string.h>
-#include <unistd.h>
-
-#include <sys/ipc.h>
-#include <sys/shm.h>
+#include <errno.h>
+#include <getopt.h>
+#include <sys/utsname.h>
#include <unistd.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-
#include "proc/readproc.h"
#include "proc/version.h"
-#include "proc/escape.h"
@ -138,15 +139,19 @@ diff -urN procps-3.2.5/pmap.c procps/pmap.c
-static void usage(void) NORETURN;
-static void usage(void){
- fprintf(stderr,
- "Usage: pmap [-x | -d] [-q] pid...\n"
- "Usage: pmap [-x | -d] [-q] [-A low,high] pid...\n"
- "-x show details\n"
- "-d show offset and device number\n"
- "-q quiet; less header/footer info\n"
- "-V show the version number\n"
- "-A limit results to the given range\n"
- );
- exit(1);
-}
-
-
-static unsigned KLONG range_low;
-static unsigned KLONG range_high = ~0ull;
-static int V_option;
-static int r_option; // ignored -- for SunOS compatibility
@ -154,7 +159,6 @@ diff -urN procps-3.2.5/pmap.c procps/pmap.c
-static int d_option;
-static int q_option;
-
-
-static unsigned shm_minor = ~0u;
-
-static void discover_shm_minor(void){
@ -194,24 +198,39 @@ diff -urN procps-3.2.5/pmap.c procps/pmap.c
- }
- }
+#define BUFFERSIZE 4096
+#define OBJECTSIZE 128
+#define OBJECTSIZE 1024
- if(shmdt(addr)) perror("shmdt");
-
-out_destroy:
- if(shmctl(shmid, IPC_RMID, NULL)) perror("IPC_RMID");
+struct smap {
+ unsigned long size;
+ unsigned long rss;
+ unsigned long pss;
+ unsigned long shared_clean;
+ unsigned long shared_dirty;
+ unsigned long private_clean;
+ unsigned long private_dirty;
+ unsigned long referenced;
+ unsigned long swap;
+};
+
+static unsigned long long range_low;
+static unsigned long long range_high = ~0ULL;
+static unsigned long mapped;
+static unsigned long shared;
+static unsigned long private;
+static unsigned long rss;
+static unsigned long pss;
+static unsigned long dirty;
+static unsigned long referenced;
+static unsigned long swap;
+static FILE *smaps_fp;
+static int maj, min, patch, dopss, noref, doswap;
+static long lbits;
+#define BLK ((lbits==64)?" ":"")
+#define WDT ((lbits==64)?16:8)
+
+static void usage(const char *cmd)
+{
@ -220,14 +239,15 @@ diff -urN procps-3.2.5/pmap.c procps/pmap.c
+ "display offset and device numbers\n");
+ fprintf(stderr, " -q, --quiet "
+ "hide header and memory statistics\n");
+ fprintf(stderr, " -A, --limit=low,high "
+ "limit results to the given range\n");
+ fprintf(stderr, " -V, --version "
+ "display version information\n");
+ fprintf(stderr, " -h, --help "
+ "display this help\n");
+}
-out_destroy:
- if(shmctl(shmid, IPC_RMID, NULL)) perror("IPC_RMID");
- return;
+static int get_smap_data(struct smap *smap)
+{
+ unsigned long long data;
@ -261,6 +281,18 @@ diff -urN procps-3.2.5/pmap.c procps/pmap.c
+ smap->rss = data;
+ rss += data;
+
+ if (dopss) {
+ /* get pss */
+ if (!fgets(buff, BUFFERSIZE, smaps_fp))
+ return 1;
+
+ assigned = sscanf(buff, "Pss: %lld", &data);
+ if (assigned != 1)
+ return 1;
+ smap->pss = data;
+ pss += data;
+ }
+
+ /* get shared clean */
+ if (!fgets(buff, BUFFERSIZE, smaps_fp))
+ return 1;
@ -298,8 +330,33 @@ diff -urN procps-3.2.5/pmap.c procps/pmap.c
+ return 1;
+ smap->private_dirty = data;
+ dirty += data;
- return;
+
+ if (noref)
+ goto out;
+
+ /* get referenced */
+ if (!fgets(buff, BUFFERSIZE, smaps_fp))
+ return 1;
+
+ assigned = sscanf(buff, "Referenced: %lld", &data);
+ if (assigned != 1)
+ return 1;
+ smap->referenced = data;
+ referenced += data;
+
+ if (!doswap)
+ goto out;
+
+ /* get swap */
+ if (!fgets(buff, BUFFERSIZE, smaps_fp))
+ return 1;
+
+ assigned = sscanf(buff, "Swap: %lld", &data);
+ if (assigned != 1)
+ return 1;
+ smap->swap = data;
+ swap += data;
+out:
+ return 0;
}
@ -307,7 +364,7 @@ diff -urN procps-3.2.5/pmap.c procps/pmap.c
+{
+ unsigned long long low, high, size, offset;
+ unsigned long major, minor;
+ struct smap smap = { .rss = 0 };
+ struct smap smap = { .rss = 0, .pss = 0 };
+ int assigned;
+ char read_perm, write_perm, exec_perm, access_type;
+ char obj_buff[OBJECTSIZE] = "[anon]";
@ -336,16 +393,26 @@ diff -urN procps-3.2.5/pmap.c procps/pmap.c
+ else if (access_type == 'p' && write_perm == 'w')
+ private += size;
+
+ printf("%08llx %6lluK ", low, size);
+ if(low > range_high)
+ return;
+ if(high < range_low)
+ return;
+
+ printf("%0*llx %6lluK ", WDT, low, size);
+
+ if (smaps_fp) {
+ printf("%6luK ", smap.rss);
+ if (dopss)
+ printf("%6luK ", smap.pss);
+ printf("%6luK ", smap.private_dirty + smap.shared_dirty);
+ if (doswap)
+ printf("%6luK ", smap.swap);
+ }
-static const char *mapping_name(proc_t *p, unsigned KLONG addr, unsigned KLONG len, const char *mapbuf, unsigned showpath, unsigned dev_major, unsigned dev_minor, unsigned long long inode){
- const char *cp;
-
+ printf("%c%c%c%c ", read_perm, write_perm, exec_perm, access_type);
- if(!dev_major && dev_minor==shm_minor && strstr(mapbuf,"/SYSV")){
- static char shmbuf[64];
- snprintf(shmbuf, sizeof shmbuf, " [ shmid=0x%Lx ]", inode);
@ -368,7 +435,8 @@ diff -urN procps-3.2.5/pmap.c procps/pmap.c
- if( (p->start_stack >= addr) && (p->start_stack <= addr+len) ) cp = " [ stack ]";
- return cp;
-}
+ printf("%c%c%c%c ", read_perm, write_perm, exec_perm, access_type);
+ if (show_devices)
+ printf("%0*llx %02lx:%02lx ", WDT, offset, major, minor);
-static int one_proc(proc_t *p){
- char buf[32];
@ -406,6 +474,12 @@ diff -urN procps-3.2.5/pmap.c procps/pmap.c
- unsigned long long file_offset, inode;
- unsigned dev_major, dev_minor;
- sscanf(mapbuf,"%"KLF"x-%"KLF"x %31s %Lx %x:%x %Lu", &start, &end, flags, &file_offset, &dev_major, &dev_minor, &inode);
-
- if(start > range_high)
- break;
- if(end < range_low)
- continue;
-
- tmp = strchr(mapbuf,'\n');
- if(tmp) *tmp='\0';
- tmp = mapbuf;
@ -468,6 +542,9 @@ diff -urN procps-3.2.5/pmap.c procps/pmap.c
-
- }
-
-
-
-
- if(!q_option){
- if(x_option){
- if(sizeof(KLONG)==8){
@ -497,9 +574,7 @@ diff -urN procps-3.2.5/pmap.c procps/pmap.c
- else printf(" total %8ldK\n", (total_shared + total_private_writeable + total_private_readonly) >> 10);
- }
- }
+ if (show_devices)
+ printf("%08llx %02lx:%02lx ", offset, major, minor);
-
- return 0;
+ printf("%s\n", obj_buff);
}
@ -511,17 +586,37 @@ diff -urN procps-3.2.5/pmap.c procps/pmap.c
+ char path[PATH_MAX];
+ char buff[BUFFERSIZE];
+ int o, show_devices = 0, quiet = 0;
+ struct utsname uts;
+ pid_t pid;
+
+ if (uname(&uts) < 0) {
+ fprintf(stderr, "error getting information about current kernel: %m\n");
+ exit(EXIT_FAILURE);
+ }
+ sscanf(uts.release, "%d.%d.%d", &maj, &min, &patch);
+
+ if ((maj > 2) || ((maj == 2) && ((min > 6) || ((min == 6) && (patch >= 27)))))
+ doswap++;
+ if ((maj > 2) || ((maj == 2) && ((min > 6) || ((min == 6) && (patch >= 25)))))
+ dopss++;
+ if ((maj < 2) || ((maj == 2) && ((min < 6) || ((min == 6) && (patch < 22)))))
+ noref++;
+
+ if ((lbits = sysconf(_SC_LONG_BIT)) < 0) {
+ fprintf(stderr, "error getting information about current kernel: %m\n");
+ exit(EXIT_FAILURE);
+ }
+
+ struct option longopts[] = {
+ { "help", 0, NULL, 'h' },
+ { "version", 0, NULL, 'V' },
+ { "quiet", 0, NULL, 'q' },
+ { "device", 0, NULL, 'd' },
+ { "limit", 0, NULL, 'A' },
+ { NULL, 0, NULL, 0 }
+ };
+
+ while ((o = getopt_long(argc, argv, "hqdV", longopts, NULL)) != -1) {
+ while ((o = getopt_long(argc, argv, "hqdA:V", longopts, NULL)) != -1) {
+ switch (o) {
+ case 'V':
+ display_version();
@ -532,6 +627,27 @@ diff -urN procps-3.2.5/pmap.c procps/pmap.c
+ case 'd':
+ show_devices = 1;
+ break;
+ case 'A':
+ if (!optarg || *optarg == 0) {
+ usage(argv[0]);
+ return 1;
+ } else {
+ char *low = optarg;
+ char *high = strchr(low, ',');
+ if (high) {
+ *high = '\0';
+ high++;
+ }
+ if (low)
+ range_low = strtoull(low, &low, 16);
+ if (high)
+ range_high = strtoull(high, &high, 16);
+ if (*low || *high) {
+ usage(argv[0]);
+ return 1;
+ }
+ }
+ break;
+ case 'h':
+ usage(argv[0]);
+ return 0;
@ -572,11 +688,15 @@ diff -urN procps-3.2.5/pmap.c procps/pmap.c
+ smaps_fp = fopen(path, "r");
+
+ if (!quiet) {
+ printf("START SIZE ");
+ printf("START%s SIZE ", BLK);
+
+ if (smaps_fp) {
+ printf(" RSS ");
+ if (dopss)
+ printf(" PSS ");
+ printf(" DIRTY ");
+ if (doswap)
+ printf(" SWAP ");
+ }
+
+ if (show_devices)
@ -589,13 +709,25 @@ diff -urN procps-3.2.5/pmap.c procps/pmap.c
+ parse_line(pid, buff, show_devices);
+
+ if (!quiet) {
+ if (smaps_fp)
+ printf("Total: %6luK %6luK %6luK\n\n", mapped, rss, dirty);
+ else
+ if (smaps_fp) {
+ printf("Total:%s ", BLK);
+ printf(" %6luK", mapped);
+ printf(" %6luK", rss);
+ if (dopss)
+ printf(" %6luK", pss);
+ printf(" %6luK", dirty);
+ if (doswap)
+ printf(" %6luK", swap);
+ printf("\n\n");
+ } else
+ printf("mapped: %luK ", mapped);
+
+ printf("%luK writable-private, %luK readonly-private, and %luK shared\n",
+ private, mapped - private - shared, shared);
+ if (noref)
+ printf("%luK writable-private, %luK readonly-private, and %luK shared\n",
+ private, mapped - private - shared, shared);
+ else
+ printf("%luK writable-private, %luK readonly-private, %luK shared, and %luK referenced\n",
+ private, mapped - private - shared, shared, referenced);
+ }
-int main(int argc, char *argv[]){
@ -633,6 +765,35 @@ diff -urN procps-3.2.5/pmap.c procps/pmap.c
- case 'q':
- q_option++;
- break;
- case 'A':{
- char *arg1;
- if(walk[1]){
- arg1 = walk+1;
- walk += strlen(walk)-1;
- }else{
- arg1 = *++argv;
- if(!arg1)
- usage();
- }
- char *arg2 = strchr(arg1,',');
- if(arg2)
- *arg2 = '\0';
- arg2 = arg2 ? arg2++ : arg1;
-
- if(*arg1)
- range_low = STRTOUKL(arg1,&arg1,16);
- if(*arg2)
- range_high = STRTOUKL(arg2,&arg2,16);
- if(*arg1 || *arg2)
- usage();
- }
- break;
- case 'a': // Sun prints anon/swap reservations
- case 'F': // Sun forces hostile ptrace-like grab
- case 'l': // Sun shows unresolved dynamic names
- case 'L': // Sun shows lgroup info
- case 's': // Sun shows page sizes
- case 'S': // Sun shows swap reservations
- default:
- usage();
- }

78
procps-3.2.8-slab.patch Normal file
View File

@ -0,0 +1,78 @@
| On Tue, Feb 19, 2008 at 7:53 PM, Albert Cahalan <acahalan@cs.uml.edu> wrote:
| > On Feb 18, 2008 10:55 AM, Bart Van Assche <bart.vanassche@gmail.com> wrote:
| >
| > > This leads me to the question: if the layout of /proc/meminfo changes,
| > > who communicates these changes to the procps maintainers ?
| >
| > Nobody ever informs me. :-(
|
| Albert, can you please review the patch below ?
|
| Thanks,
|
| Bart.
|
|
--- proc/library.map
+++ proc/library.map 2009-05-11 12:30:56.561900807 +0200
@@ -18,6 +18,8 @@ global:
kb_main_free; kb_main_total; kb_main_used; kb_swap_free;
kb_swap_total; kb_swap_used; kb_main_shared;
kb_low_total; kb_low_free; kb_high_total; kb_high_free;
+ kb_swap_cached; kb_anon_pages; kb_bounce; kb_commit_limit;
+ kb_nfs_unstable; kb_swap_reclaimable; kb_swap_unreclaimable;
vm_pgpgin; vm_pgpgout; vm_pswpin; vm_pswpout;
free_slabinfo; put_slabinfo; get_slabinfo; get_proc_stats;
local: *;
--- proc/sysinfo.c
+++ proc/sysinfo.c 2009-05-11 12:32:54.873901042 +0200
@@ -8,6 +8,8 @@
// File for parsing top-level /proc entities. */
//
// June 2003, Fabian Frederick, disk and slab info
+// Copyright (c) 2003 Fabian Frederick.
+// Copyright (c) 2008 Bart Van Assche.
#include <stdio.h>
#include <stdlib.h>
@@ -560,12 +562,12 @@ static unsigned long kb_vmalloc_chunk;
static unsigned long kb_vmalloc_total;
static unsigned long kb_vmalloc_used;
// seen on 2.6.24-rc6-git12
-static unsigned long kb_anon_pages;
-static unsigned long kb_bounce;
-static unsigned long kb_commit_limit;
-static unsigned long kb_nfs_unstable;
-static unsigned long kb_swap_reclaimable;
-static unsigned long kb_swap_unreclaimable;
+unsigned long kb_anon_pages;
+unsigned long kb_bounce;
+unsigned long kb_commit_limit;
+unsigned long kb_nfs_unstable;
+unsigned long kb_swap_reclaimable;
+unsigned long kb_swap_unreclaimable;
void meminfo(void){
char namebuf[16]; /* big enough to hold any row name */
@@ -645,6 +647,7 @@ nextline:
}
kb_swap_used = kb_swap_total - kb_swap_free;
kb_main_used = kb_main_total - kb_main_free;
+ kb_main_cached += kb_swap_reclaimable + kb_swap_cached + kb_nfs_unstable;
}
/*****************************************************************/
--- proc/sysinfo.h
+++ proc/sysinfo.h 2008-03-08 10:15:41.000000000 +0100
@@ -31,6 +31,11 @@ extern unsigned long kb_main_total;
extern unsigned long kb_swap_free;
extern unsigned long kb_swap_total;
/* recently introduced */
+extern unsigned long kb_anon_pages;
+extern unsigned long kb_bounce;
+extern unsigned long kb_nfs_unstable;
+extern unsigned long kb_slab_reclaimable;
+extern unsigned long kb_slab_unreclaimable;
extern unsigned long kb_high_free;
extern unsigned long kb_high_total;
extern unsigned long kb_low_free;

View File

@ -1,15 +1,6 @@
--- top.c
+++ top.c 2008-12-10 16:28:41.000000000 +0100
@@ -2514,7 +2514,7 @@ static void do_key (unsigned c)
switch (c) {
case '1':
- if (Cpu_tot+7 > Screen_rows && !CHKw(Curwin, View_CPUSUM)) {
+ if (Cpu_tot+7 > Screen_rows && CHKw(Curwin, View_CPUSUM)) {
show_msg(err_num_cpus);
} else {
#ifdef WARN_NOT_SMP
@@ -2984,7 +2984,7 @@ static proc_t **summary_show (void)
@@ -2993,7 +2993,7 @@ static proc_t **summary_show (void)
p_table = procs_refresh(p_table, Frames_libflags);
// Display Uptime and Loadavg
@ -18,7 +9,7 @@
if (!Rc.mode_altscr) {
show_special(0, fmtmk(LOADAV_line, Myname, sprint_uptime()));
} else {
@@ -3001,7 +3001,7 @@ static proc_t **summary_show (void)
@@ -3010,7 +3010,7 @@ static proc_t **summary_show (void)
}
// Display Task and Cpu(s) States
@ -27,7 +18,7 @@
show_special(
0,
fmtmk(
@@ -3015,21 +3015,29 @@ static proc_t **summary_show (void)
@@ -3024,21 +3024,29 @@ static proc_t **summary_show (void)
if (CHKw(Curwin, View_CPUSUM)) {
// display just the 1st /proc/stat line

3
procps-3.2.8.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5102a1d89e76840ca76815f22b50493d16a093f229598efc5ec54640320ee3c0
size 232846

View File

@ -1,3 +1,27 @@
-------------------------------------------------------------------
Mon May 11 12:42:59 CEST 2009 - werner@suse.de
- Update to procps-3.2.8
* ps: allow "+" in sort specifications, as in man page
* ps: recognize SCHED_ISO and SCHED_IDLE
* ps: document SCHED_BATCH and add a "see also" for stime
* ps: man page less ambiguous
* top: normal exit code should be 0
* top: misc fixes
* pgrep: usage error should exit with 2
* vmstat: use EXIT_FAILURE -- thanks Yoshio Nakamura
* sysctl: fix crash -- thanks Steinar Gunderson
* watch: tolerate umlauts
* pmap: range limits with -A low,high
* update /dev/tty* info to May 2009 devices.txt
* don't read off end of string const
- Adapt our patches
-------------------------------------------------------------------
Fri May 8 15:51:36 CEST 2009 - werner@suse.de
- top: shows correct values on 32bit arch (bnc#497544)
-------------------------------------------------------------------
Wed Mar 11 15:52:42 CET 2009 - werner@suse.de

View File

@ -1,5 +1,5 @@
#
# spec file for package procps (Version 3.2.7)
# spec file for package procps (Version 3.2.8)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -26,8 +26,8 @@ License: GPL v2 or later; LGPL v2.1 or later
Group: System/Monitoring
PreReq: %fillup_prereq %insserv_prereq
AutoReqProv: on
Version: 3.2.7
Release: 152
Version: 3.2.8
Release: 1
Summary: ps utilities for /proc
Provides: ps
Obsoletes: ps
@ -40,27 +40,26 @@ Patch1: procps-3.2.2-100cpus.diff
Patch2: procps-3.2.5-eof.diff
Patch3: procps-3.2.2-ia64.diff
Patch4: procps-3.2.7-stealtime.patch
Patch6: procps-3.2.7-manycpus.diff
Patch6: procps-3.2.8-manycpus.diff
Patch7: procps-3.2.2-w-notruncate.diff
Patch8: procps-3.2.2-w-simply-work.diff
Patch9: procps-3.2.7-top.1.diff
Patch10: procps-3.2.2-top-termsize.patch
Patch11: procps-3.2.3-buffersize.diff
Patch11: procps-3.2.8-buffersize.diff
Patch12: pwdx-bufferoverflow.diff
Patch13: procps-3.2.5-pmap-smaps-rml-2.patch
Patch14: procps-3.2.7-pmap.patch
Patch13: procps-3.2.8-pmap-smaps-rml-2.patch
Patch15: procps-3.2.5-top-rc.patch
Patch16: procps-3.2.7-cpu_hotplug.patch
Patch17: procps-3.2.5-CPU-states.patch
Patch18: procps-3.2.7-readeof.patch
Patch19: procps-3.2.7-btime-from-proc-stat.patch
Patch20: procps-3.2.7-glibc-2.6.1.dif
Patch21: procps-3.2.7-slab.patch
Patch20: procps-3.2.8-glibc-2.6.1.dif
Patch21: procps-3.2.8-slab.patch
Patch22: procps-3.2.7-selinux.patch
Patch23: procps-3.2.7-accuracy.dif
Patch24: procps-3.2.7-toosmall.dif
Patch24: procps-3.2.8-toosmall.dif
Patch25: procps-3.2.7-cgroups_flag.diff
Patch26: procps-3.2.7-pgrep_coption.dif
Patch26: procps-3.2.8-pgrep_coption.dif
Patch27: procps-3.2.7-terabyte.dif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -96,22 +95,21 @@ Authors:
%patch2 -p1
%patch3 -p1
%patch4 -p0
%patch6 -p1
%patch6 -p0
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch11 -p0
%patch12 -p1
%patch13 -p1
%patch14 -p0
%patch13 -p0
%patch15 -p1
%patch16 -p1
%patch17
%patch18
%patch19 -p1
%patch20
%patch21 -p1
%patch21 -p0
%patch22
%patch23
%patch24
@ -183,6 +181,24 @@ rm -rf $RPM_BUILD_ROOT
%_mandir/man8/sysctl.8.gz
%changelog
* Mon May 11 2009 werner@suse.de
- Update to procps-3.2.8
* ps: allow "+" in sort specifications, as in man page
* ps: recognize SCHED_ISO and SCHED_IDLE
* ps: document SCHED_BATCH and add a "see also" for stime
* ps: man page less ambiguous
* top: normal exit code should be 0
* top: misc fixes
* pgrep: usage error should exit with 2
* vmstat: use EXIT_FAILURE -- thanks Yoshio Nakamura
* sysctl: fix crash -- thanks Steinar Gunderson
* watch: tolerate umlauts
* pmap: range limits with -A low,high
* update /dev/tty* info to May 2009 devices.txt
* don't read off end of string const
- Adapt our patches
* Fri May 08 2009 werner@suse.de
- top: shows correct values on 32bit arch (bnc#497544)
* Wed Mar 11 2009 werner@suse.de
- top: show MB in case of TB of physical memory (bnc#484271)
* Mon Feb 09 2009 werner@suse.de
@ -598,7 +614,7 @@ rm -rf $RPM_BUILD_ROOT
- ran old prepare_spec on spec file to switch to new prepare_spec.
* Tue Sep 07 1999 werner@suse.de
- Avoid SEGV if /proc isn't mounted (e.g. in single user mode)
* Mon Sep 06 1999 werner@suse.de
* Tue Sep 07 1999 werner@suse.de
- Fix some maunal page (missed tbl mark, some nasty .TH's)
* Wed Aug 18 1999 werner@suse.de
- Update procinfo (ver 17), procps (ver 2.0.2) but hold