diff --git a/Makefile b/Makefile index 5870e325..9de32963 100644 --- a/Makefile +++ b/Makefile @@ -148,9 +148,6 @@ endif # in case -O3 is enabled, avoid bloat ALL_CFLAGS += $(call check_gcc,-fno-inline-functions,) -# ought to file a gcc bug about this nonsense -ALL_CFLAGS += $(call check_gcc,-fno-threadsafe-statics,) - endif endif endif diff --git a/NEWS b/NEWS index e3cc9736..c96d94ea 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,7 @@ pgrep: usage error should exit with 2 #413383 vmstat: use EXIT_FAILURE -- thanks Yoshio Nakamura #425492 sysctl: fix crash -- thanks Steinar Gunderson #423704 watch: tolerate umlauts #207103 +update /dev/tty* info to May 2009 devices.txt procps-3.2.6 --> procps-3.2.7 diff --git a/TODO b/TODO index a3429262..7831ea04 100644 --- a/TODO +++ b/TODO @@ -63,6 +63,8 @@ Extract /proc/diskstats parsing from vmstat into libproc somewhere. Stop storing fields with duplicate info (often different units: kB and pages, seconds and jiffies) in the proc_t struct. +Use own readdir code (assembly language) because glibc sucks ass. + ---------------------- top ------------------------- Share more stuff with ps. diff --git a/pmap.c b/pmap.c index a46c696d..6b865fc5 100644 --- a/pmap.c +++ b/pmap.c @@ -28,23 +28,26 @@ 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 static int x_option; static int d_option; static int q_option; - static unsigned shm_minor = ~0u; static void discover_shm_minor(void){ @@ -155,6 +158,12 @@ static int one_proc(proc_t *p){ 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; @@ -217,6 +226,9 @@ static int one_proc(proc_t *p){ } + + + if(!q_option){ if(x_option){ if(sizeof(KLONG)==8){ @@ -286,6 +298,35 @@ int main(int argc, char *argv[]){ 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(); } diff --git a/proc/devname.c b/proc/devname.c index 158bf496..32ad9540 100644 --- a/proc/devname.c +++ b/proc/devname.c @@ -166,6 +166,12 @@ static const char low_density_names[][6] = { "NX0", "NX1", "NX2", "NX3", "NX4", "NX5", "NX6", "NX7", "NX8", "NX9", "NX10", "NX11", "NX12", "NX13", "NX14", "NX15", "J0", // minor is 186 +"UL0","UL1","UL2","UL3", +"xvc0", // FAIL -- "/dev/xvc0" lacks "tty" prefix +"PZ0","PZ1","PZ2","PZ3", +"TX0","TX1","TX2","TX3","TX4","TX5","TX6","TX7", +"SC0","SC1","SC2","SC3", +"MAX0","MAX1","MAX2","MAX3", }; #if 0 @@ -175,7 +181,7 @@ static const char low_density_names[][6] = { int main(int argc, char *argv[]){ int i = 0; while(i