update /dev/tty* info to May 2009 devices.txt

This commit is contained in:
albert 2009-05-03 06:39:33 +00:00
parent fcc376b861
commit b0210803bf
6 changed files with 55 additions and 8 deletions

View File

@ -148,9 +148,6 @@ endif
# in case -O3 is enabled, avoid bloat # in case -O3 is enabled, avoid bloat
ALL_CFLAGS += $(call check_gcc,-fno-inline-functions,) 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 endif
endif endif

1
NEWS
View File

@ -8,6 +8,7 @@ pgrep: usage error should exit with 2 #413383
vmstat: use EXIT_FAILURE -- thanks Yoshio Nakamura #425492 vmstat: use EXIT_FAILURE -- thanks Yoshio Nakamura #425492
sysctl: fix crash -- thanks Steinar Gunderson #423704 sysctl: fix crash -- thanks Steinar Gunderson #423704
watch: tolerate umlauts #207103 watch: tolerate umlauts #207103
update /dev/tty* info to May 2009 devices.txt
procps-3.2.6 --> procps-3.2.7 procps-3.2.6 --> procps-3.2.7

2
TODO
View File

@ -63,6 +63,8 @@ Extract /proc/diskstats parsing from vmstat into libproc somewhere.
Stop storing fields with duplicate info (often different Stop storing fields with duplicate info (often different
units: kB and pages, seconds and jiffies) in the proc_t struct. units: kB and pages, seconds and jiffies) in the proc_t struct.
Use own readdir code (assembly language) because glibc sucks ass.
---------------------- top ------------------------- ---------------------- top -------------------------
Share more stuff with ps. Share more stuff with ps.

45
pmap.c
View File

@ -28,23 +28,26 @@
static void usage(void) NORETURN; static void usage(void) NORETURN;
static void usage(void){ static void usage(void){
fprintf(stderr, fprintf(stderr,
"Usage: pmap [-x | -d] [-q] pid...\n" "Usage: pmap [-x | -d] [-q] [-A low,high] pid...\n"
"-x show details\n" "-x show details\n"
"-d show offset and device number\n" "-d show offset and device number\n"
"-q quiet; less header/footer info\n" "-q quiet; less header/footer info\n"
"-V show the version number\n" "-V show the version number\n"
"-A limit results to the given range\n"
); );
exit(1); exit(1);
} }
static unsigned KLONG range_low;
static unsigned KLONG range_high = ~0ull;
static int V_option; static int V_option;
static int r_option; // ignored -- for SunOS compatibility static int r_option; // ignored -- for SunOS compatibility
static int x_option; static int x_option;
static int d_option; static int d_option;
static int q_option; static int q_option;
static unsigned shm_minor = ~0u; static unsigned shm_minor = ~0u;
static void discover_shm_minor(void){ static void discover_shm_minor(void){
@ -155,6 +158,12 @@ static int one_proc(proc_t *p){
unsigned long long file_offset, inode; unsigned long long file_offset, inode;
unsigned dev_major, dev_minor; 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); 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'); tmp = strchr(mapbuf,'\n');
if(tmp) *tmp='\0'; if(tmp) *tmp='\0';
tmp = mapbuf; tmp = mapbuf;
@ -217,6 +226,9 @@ static int one_proc(proc_t *p){
} }
if(!q_option){ if(!q_option){
if(x_option){ if(x_option){
if(sizeof(KLONG)==8){ if(sizeof(KLONG)==8){
@ -286,6 +298,35 @@ int main(int argc, char *argv[]){
case 'q': case 'q':
q_option++; q_option++;
break; 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: default:
usage(); usage();
} }

View File

@ -166,6 +166,12 @@ static const char low_density_names[][6] = {
"NX0", "NX1", "NX2", "NX3", "NX4", "NX5", "NX6", "NX7", "NX0", "NX1", "NX2", "NX3", "NX4", "NX5", "NX6", "NX7",
"NX8", "NX9", "NX10", "NX11", "NX12", "NX13", "NX14", "NX15", "NX8", "NX9", "NX10", "NX11", "NX12", "NX13", "NX14", "NX15",
"J0", // minor is 186 "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 #if 0
@ -175,7 +181,7 @@ static const char low_density_names[][6] = {
int main(int argc, char *argv[]){ int main(int argc, char *argv[]){
int i = 0; int i = 0;
while(i<AS(low_density_names)){ while(i<AS(low_density_names)){
printf("%3d = /dev/tty%.6s\n",i,low_density_names[i]); printf("%3d = /dev/tty%.*s\n",i,sizeof low_density_names[i],low_density_names[i]);
i++; i++;
} }
return 0; return 0;

View File

@ -1431,7 +1431,7 @@ static const format_struct format_array[] = {
{"sgroup", "SGROUP", pr_sgroup, sr_sgroup, 8, GRP, LNX, ET|USER}, {"sgroup", "SGROUP", pr_sgroup, sr_sgroup, 8, GRP, LNX, ET|USER},
{"share", "-", pr_nop, sr_share, 1, MEM, LNX, PO|RIGHT}, {"share", "-", pr_nop, sr_share, 1, MEM, LNX, PO|RIGHT},
{"sid", "SID", pr_sess, sr_session, 5, 0, XXX, PO|PIDMAX|RIGHT}, /* Sun & HP */ {"sid", "SID", pr_sess, sr_session, 5, 0, XXX, PO|PIDMAX|RIGHT}, /* Sun & HP */
{"sig", "PENDING", pr_sig, sr_nop, 9, 0, XXX, ET|SIGNAL}, /*pending*/ {"sig", "PENDING", pr_sig, sr_nop, 9, 0, XXX, ET|SIGNAL}, /*pending -- Dragonfly uses this for whole-proc and "tsig" for thread */
{"sig_block", "BLOCKED", pr_sigmask, sr_nop, 9, 0, LNX, TO|SIGNAL}, {"sig_block", "BLOCKED", pr_sigmask, sr_nop, 9, 0, LNX, TO|SIGNAL},
{"sig_catch", "CATCHED", pr_sigcatch, sr_nop, 9, 0, LNX, TO|SIGNAL}, {"sig_catch", "CATCHED", pr_sigcatch, sr_nop, 9, 0, LNX, TO|SIGNAL},
{"sig_ignore", "IGNORED",pr_sigignore, sr_nop, 9, 0, LNX, TO|SIGNAL}, {"sig_ignore", "IGNORED",pr_sigignore, sr_nop, 9, 0, LNX, TO|SIGNAL},
@ -1473,7 +1473,7 @@ static const format_struct format_array[] = {
{"tsess", "TSESS", pr_nop, sr_nop, 5, 0, BSD, PO|PIDMAX|RIGHT}, {"tsess", "TSESS", pr_nop, sr_nop, 5, 0, BSD, PO|PIDMAX|RIGHT},
{"tsession", "TSESS", pr_nop, sr_nop, 5, 0, DEC, PO|PIDMAX|RIGHT}, {"tsession", "TSESS", pr_nop, sr_nop, 5, 0, DEC, PO|PIDMAX|RIGHT},
{"tsid", "TSID", pr_nop, sr_nop, 5, 0, BSD, PO|PIDMAX|RIGHT}, {"tsid", "TSID", pr_nop, sr_nop, 5, 0, BSD, PO|PIDMAX|RIGHT},
{"tsig", "PENDING", pr_tsig, sr_nop, 9, 0, BSD, ET|SIGNAL}, {"tsig", "PENDING", pr_tsig, sr_nop, 9, 0, BSD, ET|SIGNAL}, /* Dragonfly used this for thread-specific, and "sig" for whole-proc */
{"tsiz", "TSIZ", pr_tsiz, sr_nop, 4, 0, BSD, PO|RIGHT}, {"tsiz", "TSIZ", pr_tsiz, sr_nop, 4, 0, BSD, PO|RIGHT},
{"tt", "TT", pr_tty8, sr_tty, 8, 0, BSD, PO|LEFT}, {"tt", "TT", pr_tty8, sr_tty, 8, 0, BSD, PO|LEFT},
{"tty", "TT", pr_tty8, sr_tty, 8, 0, U98, PO|LEFT}, /* Unix98 requires "TT" but has "TTY" too. :-( */ /* was 3 wide */ {"tty", "TT", pr_tty8, sr_tty, 8, 0, U98, PO|LEFT}, /* Unix98 requires "TT" but has "TTY" too. :-( */ /* was 3 wide */