3.2.0 release prep; pmap -d
This commit is contained in:
parent
98f8cbd614
commit
74954d33e3
8
Makefile
8
Makefile
@ -17,10 +17,10 @@
|
||||
|
||||
|
||||
VERSION := 3
|
||||
SUBVERSION := 1
|
||||
MINORVERSION := 15
|
||||
TARVERSION := 3.1.15
|
||||
LIBVERSION := 3.1.15
|
||||
SUBVERSION := 2
|
||||
MINORVERSION := 0
|
||||
TARVERSION := 3.2.0
|
||||
LIBVERSION := 3.2.0
|
||||
|
||||
############ vars
|
||||
|
||||
|
1
NEWS
1
NEWS
@ -6,6 +6,7 @@ top: during a ^Z, the terminal was messed up #228822
|
||||
future-proof the tty handling (thanks to Zhou Wei)
|
||||
slabtop (Chris Rivera and Robert Love) #226778 rh114012a
|
||||
pmap: detect the primary stack
|
||||
pmap: -d format
|
||||
|
||||
procps-3.1.14 --> procps-3.1.15
|
||||
|
||||
|
5
pmap.1
5
pmap.1
@ -11,7 +11,8 @@ pmap \- report memory map of a process
|
||||
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
pmap [-x] [-V] pids...
|
||||
pmap [ -x | -d ] [ -q ] pids...
|
||||
pmap -V
|
||||
.fi
|
||||
|
||||
.SH DESCRIPTION
|
||||
@ -21,6 +22,8 @@ The pmap command reports the memory map of a process or processes.
|
||||
.TS
|
||||
l l l.
|
||||
-x extended Show the extended format.
|
||||
-d device Show the device format.
|
||||
-q quiet Do not display some header/footer lines.
|
||||
-V show version Displays version of program.
|
||||
.TE
|
||||
|
||||
|
71
pmap.c
71
pmap.c
@ -23,8 +23,11 @@
|
||||
static void usage(void) NORETURN;
|
||||
static void usage(void){
|
||||
fprintf(stderr,
|
||||
"Usage: pmap [-r] [-x] pid...\n"
|
||||
"Usage: pmap [-x | -d] [-q] 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"
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
@ -93,19 +96,25 @@ static int one_proc(unsigned pid){
|
||||
char buf[32];
|
||||
char mapbuf[9600];
|
||||
unsigned long total_shared = 0ul;
|
||||
unsigned long total_private = 0ul;
|
||||
unsigned long total_private_readonly = 0ul;
|
||||
unsigned long total_private_writeable = 0ul;
|
||||
|
||||
sprintf(buf,"/proc/%u/maps",pid);
|
||||
if(!freopen(buf, "r", stdin)) return 1;
|
||||
printf("%u: %s\n", pid, get_args(pid));
|
||||
if(x_option)
|
||||
|
||||
if(x_option && !q_option)
|
||||
printf("Address Kbytes RSS Anon Locked Mode Mapping\n");
|
||||
if(d_option && !q_option)
|
||||
printf("Address Kbytes Mode Offset Device Mapping\n");
|
||||
|
||||
while(fgets(mapbuf,sizeof mapbuf,stdin)){
|
||||
char flags[32];
|
||||
char *tmp; // to clean up unprintables
|
||||
unsigned KLONG start, end, diff;
|
||||
unsigned long long pgoff;
|
||||
sscanf(mapbuf,"%"KLF"x-%"KLF"x %31s %Lx", &start, &end, flags, &pgoff);
|
||||
unsigned long long file_offset;
|
||||
unsigned dev_major, dev_minor;
|
||||
sscanf(mapbuf,"%"KLF"x-%"KLF"x %31s %Lx %x:%x", &start, &end, flags, &file_offset, &dev_major, &dev_minor);
|
||||
tmp = strchr(mapbuf,'\n');
|
||||
if(tmp) *tmp='\0';
|
||||
tmp = mapbuf;
|
||||
@ -116,7 +125,10 @@ static int one_proc(unsigned pid){
|
||||
|
||||
diff = end-start;
|
||||
if(flags[3]=='s') total_shared += diff;
|
||||
if(flags[3]=='p') total_private += diff;
|
||||
if(flags[3]=='p'){
|
||||
if(flags[1]=='w') total_private_writeable += diff;
|
||||
else total_private_readonly += diff;
|
||||
}
|
||||
|
||||
// format used by Solaris 9 and procps-3.2.0+
|
||||
if(flags[3] == 'p') flags[3] = '-';
|
||||
@ -136,7 +148,24 @@ static int one_proc(unsigned pid){
|
||||
flags,
|
||||
cp
|
||||
);
|
||||
}else{
|
||||
}
|
||||
if(d_option){
|
||||
const char *cp = strrchr(mapbuf,'/');
|
||||
if(cp && cp[1]) cp++;
|
||||
if(!cp) cp = anon_name(pid, start, diff);
|
||||
printf(
|
||||
(sizeof(KLONG)==8)
|
||||
? "%016"KLF"x %7lu %s %016Lx %03x:%05x %s\n"
|
||||
: "%08lx %7lu %s %016Lx %03x:%05x %s\n",
|
||||
start,
|
||||
(unsigned long)(diff>>10),
|
||||
flags,
|
||||
file_offset,
|
||||
dev_major, dev_minor,
|
||||
cp
|
||||
);
|
||||
}
|
||||
if(!x_option && !d_option){
|
||||
const char *cp = strchr(mapbuf,'/');
|
||||
if(!cp) cp = anon_name(pid, start, diff);
|
||||
printf(
|
||||
@ -151,26 +180,35 @@ static int one_proc(unsigned pid){
|
||||
}
|
||||
|
||||
}
|
||||
if(x_option){
|
||||
|
||||
if(x_option && !q_option){
|
||||
if(sizeof(KLONG)==8){
|
||||
printf("---------------- ------ ------ ------ ------\n");
|
||||
printf(
|
||||
"total kB %15ld - %7ld %7ld\n",
|
||||
(total_shared + total_private) >> 10,
|
||||
total_shared >> 10,
|
||||
total_private >> 10
|
||||
"total kB %15ld - - -\n",
|
||||
(total_shared + total_private_writeable + total_private_readonly) >> 10
|
||||
);
|
||||
}else{
|
||||
printf("-------- ------- ------- ------- -------\n");
|
||||
printf(
|
||||
"total kB %7ld - - -\n",
|
||||
(total_shared + total_private) >> 10
|
||||
(total_shared + total_private_writeable + total_private_readonly) >> 10
|
||||
);
|
||||
}
|
||||
}else{
|
||||
if(sizeof(KLONG)==8) printf(" total %16ldK\n", (total_shared + total_private) >> 10);
|
||||
else printf(" total %8ldK\n", (total_shared + total_private) >> 10);
|
||||
}
|
||||
if(d_option && !q_option){
|
||||
printf(
|
||||
"mapped %ldK writeable/private: %ldK shared: %ldK\n",
|
||||
(total_shared + total_private_writeable + total_private_readonly) >> 10,
|
||||
total_private_writeable >> 10,
|
||||
total_shared >> 10
|
||||
);
|
||||
}
|
||||
if(!x_option && !d_option && !q_option){
|
||||
if(sizeof(KLONG)==8) printf(" total %16ldK\n", (total_shared + total_private_writeable + total_private_readonly) >> 10);
|
||||
else printf(" total %8ldK\n", (total_shared + total_private_writeable + total_private_readonly) >> 10);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -236,6 +274,7 @@ int main(int argc, char *argv[]){
|
||||
return 0;
|
||||
}
|
||||
if(count<1) usage(); // no processes
|
||||
if(d_option && x_option) usage();
|
||||
|
||||
u=0;
|
||||
while(u<count) ret |= one_proc(pidlist[u++]);
|
||||
|
@ -1,15 +1,15 @@
|
||||
Begin4
|
||||
Title: procps
|
||||
Version: 3.1.15
|
||||
Entered-date: 2003-12-24
|
||||
Version: 3.2.0
|
||||
Entered-date: 2004-1-29
|
||||
Description: Linux system utilities
|
||||
Keywords: procps /proc libproc sysctl pmap ps uptime tload
|
||||
free w top vmstat watch skill snice kill pgrep pkill
|
||||
Author: Albert Cahalan, Michael K. Johnson, Jim Warner, etc.
|
||||
Maintained-by: various <procps-feedback@lists.sf.net>
|
||||
Primary-site: http://procps.sf.net/
|
||||
242kB procps-3.1.15.tar.gz
|
||||
242kB procps-3.2.0.tar.gz
|
||||
Alternate-site: http://www.debian.org/Packages/unstable/base/procps.html
|
||||
242kB procps-3.1.15.tar.gz
|
||||
242kB procps-3.2.0.tar.gz
|
||||
Copying-policy: mixed
|
||||
End
|
||||
|
@ -2,8 +2,8 @@ URL: http://procps.sf.net/
|
||||
Summary: System and process monitoring utilities
|
||||
Name: procps
|
||||
%define major_version 3
|
||||
%define minor_version 1
|
||||
%define revision 15
|
||||
%define minor_version 2
|
||||
%define revision 0
|
||||
%define version %{major_version}.%{minor_version}.%{revision}
|
||||
Version: %{version}
|
||||
Release: 1
|
||||
|
Loading…
Reference in New Issue
Block a user