From 7514c4e4a03fdc709baca90d1ae109b4b1790e13 Mon Sep 17 00:00:00 2001 From: albert <> Date: Mon, 10 Jan 2005 23:41:10 +0000 Subject: [PATCH] show full path when no -x or -d option (was buggy) --- NEWS | 2 ++ pmap.c | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index cf7de58b..db443682 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,8 @@ ps: SIGTSTP and SIGTTOU shouldn't print bug email address #246123 slabtop: compile with glibc 2.2.17 (and older, likely) slabtop: fix overflow on huge NUMA boxes #264640 slabtop: accept any slabinfo 2.x format g77301 +ps: alignment after WCHAN fixed ub5385 +pmap: when no -x or -d option, show full path procps-3.2.3 --> procps-3.2.4 diff --git a/pmap.c b/pmap.c index a5ade691..30675858 100644 --- a/pmap.c +++ b/pmap.c @@ -93,7 +93,7 @@ out_destroy: } -static const char *mapping_name(proc_t *p, unsigned KLONG addr, unsigned KLONG len, const char *mapbuf, unsigned advance, unsigned dev_major, unsigned dev_minor, unsigned long long inode){ +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; if(!dev_major && dev_minor==shm_minor && strstr(mapbuf,"/SYSV")){ @@ -104,8 +104,8 @@ static const char *mapping_name(proc_t *p, unsigned KLONG addr, unsigned KLONG l cp = strrchr(mapbuf,'/'); if(cp){ - if(cp[1]) cp += advance; - return cp; + if(showpath) return strchr(mapbuf,'/'); + return cp[1] ? cp+1 : cp; } cp = " [ anon ]"; @@ -171,7 +171,7 @@ static int one_proc(proc_t *p){ flags[5] = '\0'; if(x_option){ - const char *cp = mapping_name(p, start, diff, mapbuf, 1, dev_major, dev_minor, inode); + const char *cp = mapping_name(p, start, diff, mapbuf, 0, dev_major, dev_minor, inode); printf( (sizeof(KLONG)==8) ? "%016"KLF"x %7lu - - - %s %s\n" @@ -183,7 +183,7 @@ static int one_proc(proc_t *p){ ); } if(d_option){ - const char *cp = mapping_name(p, start, diff, mapbuf, 1, dev_major, dev_minor, inode); + const char *cp = mapping_name(p, start, diff, mapbuf, 0, dev_major, dev_minor, inode); printf( (sizeof(KLONG)==8) ? "%016"KLF"x %7lu %s %016Lx %03x:%05x %s\n" @@ -197,7 +197,7 @@ static int one_proc(proc_t *p){ ); } if(!x_option && !d_option){ - const char *cp = mapping_name(p, start, diff, mapbuf, 0, dev_major, dev_minor, inode); + const char *cp = mapping_name(p, start, diff, mapbuf, 1, dev_major, dev_minor, inode); printf( (sizeof(KLONG)==8) ? "%016"KLF"x %6luK %s %s\n"