show full path when no -x or -d option (was buggy)

This commit is contained in:
albert 2005-01-10 23:41:10 +00:00
parent 31fca6bb2d
commit 7514c4e4a0
2 changed files with 8 additions and 6 deletions

2
NEWS
View File

@ -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: compile with glibc 2.2.17 (and older, likely)
slabtop: fix overflow on huge NUMA boxes #264640 slabtop: fix overflow on huge NUMA boxes #264640
slabtop: accept any slabinfo 2.x format g77301 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 procps-3.2.3 --> procps-3.2.4

12
pmap.c
View File

@ -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; const char *cp;
if(!dev_major && dev_minor==shm_minor && strstr(mapbuf,"/SYSV")){ 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,'/'); cp = strrchr(mapbuf,'/');
if(cp){ if(cp){
if(cp[1]) cp += advance; if(showpath) return strchr(mapbuf,'/');
return cp; return cp[1] ? cp+1 : cp;
} }
cp = " [ anon ]"; cp = " [ anon ]";
@ -171,7 +171,7 @@ static int one_proc(proc_t *p){
flags[5] = '\0'; flags[5] = '\0';
if(x_option){ 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( printf(
(sizeof(KLONG)==8) (sizeof(KLONG)==8)
? "%016"KLF"x %7lu - - - %s %s\n" ? "%016"KLF"x %7lu - - - %s %s\n"
@ -183,7 +183,7 @@ static int one_proc(proc_t *p){
); );
} }
if(d_option){ 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( printf(
(sizeof(KLONG)==8) (sizeof(KLONG)==8)
? "%016"KLF"x %7lu %s %016Lx %03x:%05x %s\n" ? "%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){ 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( printf(
(sizeof(KLONG)==8) (sizeof(KLONG)==8)
? "%016"KLF"x %6luK %s %s\n" ? "%016"KLF"x %6luK %s %s\n"