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
procps-3.1.14 --> procps-3.1.15
static const char *anon_name(int pid, unsigned KLONG addr, unsigned KLONG len){
const char *cp = " [ anon ]";
proc_t proc;
- if (get_proc_stats(pid, &proc)){
+ static int oldpid = -1;
+ if (pid==oldpid || get_proc_stats(pid, &proc)){
+ oldpid = pid;
if( (proc.start_stack >= addr) && (proc.start_stack <= addr+len) ) cp = " [ stack ]";
}
return cp;
tmp++;
}
+ diff = end-start;
+ if(flags[3]=='s') total_shared += diff;
+ if(flags[3]=='p') total_private += diff;
+
+#if 1
+ // format used by Solaris 7 and old procps
if(flags[0]=='r'){
if(flags[1]=='w'){
if(flags[2]=='x') perms = "read/write/exec";
else perms = "none ";
}
}
- diff = end-start;
- if(flags[3]=='s') total_shared += diff;
- if(flags[3]=='p') total_private += diff;
+#else
+ // format used by Solaris 9 and future procps
+ perms = flags;
+ if(flags[3] == 'p') flags[3] = '-';
+ flags[4] = '-'; // an 'R' if swap not reserved (MAP_NORESERVE, SysV ISM shared mem, etc.)
+ flags[5] = '\0';
+#endif
+
if(x_option){
const char *cp = strrchr(mapbuf,'/');
if(cp && cp[1]) cp++;
proc_data_t *pd = NULL;
PROCTAB *restrict ptp;
int n = 0; /* number of processes & index into array */
-#if 0
- if(thread_flags){
- fprintf(stderr, "can't have threads with sorting or forest output\n");
- exit(49);
- }
-#endif
+
ptp = openproc(needs_for_format | needs_for_sort | needs_for_select | needs_for_threads);
if(!ptp) {
fprintf(stderr, "Error: can not access /proc.\n");
exit(1);
}
-#if 0
- while((retbuf = readproc(ptp,retbuf))){
- if(want_this_proc_pcpu(retbuf)){
-// fill_pcpu(retbuf); // in case we might sort by %cpu
- processes[n++] = retbuf;
- retbuf = NULL; // NULL asks readproc to allocate
- }
- }
- if(retbuf) free(retbuf);
-#else
+
if(thread_flags & TF_loose_tasks){
pd = readproctab2(want_this_proc_nop, want_this_proc_pcpu, ptp);
}else{
}
n = pd->n;
processes = pd->tab;
-#endif
+
if(!n) return; /* no processes */
if(forest_type) prep_forest_sort();
qsort(processes, n, sizeof(proc_t*), compare_two_procs);
Curwin->rc.maxtasks = 0;
SETw(Curwin, Show_IDLEPS | VISIBLE_tsk);
Monpidsidx = 0;
+ selection_type = '\0';
break;
case '+':