On 24/01/17(Tue) 11:35, Philip Guenther wrote:
> On Tue, 24 Jan 2017, Martin Pieuchot wrote:
> > On 24/01/17(Tue) 10:08, Philip Guenther wrote:
> ...
> > > Hmm, ps/n (the default) is the only of the ps subcommands to not show 
> > > the TID...so that it can show more columns of COMMAND.  You've added 8 
> > > columns without shrinking any of the existing ones, which will cause 
> > > an unreadable mess when it wraps around.  Maybe drop PGRP from /n and 
> > > we add a new one that's more like (userspace) ps -j ?
> > 
> > Here's the updated output.
> > 
> >    PID     TID   PPID    UID  S       FLAGS  WAIT          COMMAND
> > *97567  517976  11478      0  7         0x3                sysctl
> >  11478  302289      1      0  3    0x10008b  pause         ksh
> >  68659  470461      1      0  3    0x100098  poll          cron
> > 
> > 
> > I like the idea of "ps /j", I could also merge the information in the
> > current "ps /w" since EMUL is always 'native' now.  What do you think?
> 
> Just s/EMUL/PGID/ and wait for someone to need something more?

Diff below does that and fix alignment issues with /a /o and /w.  The
problem was that TID needs 6 columns not 5.

With this ps /a no longer wraps on i386.

ddb{0}> ps /a
    TID  COMMAND         STRUCT PROC *             UAREA *      VMSPACE/VM_MAP
* 70709  sysctl             0xd94e9418          0xf551c000          0xd94e7144
 154620  ksh                0xd94e9c28          0xf5544000          0xd94e7324
 278101  cron               0xd94e9820          0xf557c000          0xd94e7004

ok?

Index: sys/kern/kern_proc.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_proc.c,v
retrieving revision 1.74
diff -u -p -r1.74 kern_proc.c
--- sys/kern/kern_proc.c        24 Jan 2017 04:50:48 -0000      1.74
+++ sys/kern/kern_proc.c        24 Jan 2017 05:03:38 -0000
@@ -467,7 +467,7 @@ db_show_all_procs(db_expr_t addr, int ha
        switch (*mode) {
 
        case 'a':
-               db_printf("   TID  %-10s  %18s  %18s  %18s\n",
+               db_printf("    TID  %-9s  %18s  %18s  %18s\n",
                    "COMMAND", "STRUCT PROC *", "UAREA *", "VMSPACE/VM_MAP");
                break;
        case 'n':
@@ -475,12 +475,12 @@ db_show_all_procs(db_expr_t addr, int ha
                    "TID", "PPID", "UID", "FLAGS", "WAIT", "COMMAND");
                break;
        case 'w':
-               db_printf("   TID  %-16s  %-8s  %18s  %s\n",
-                   "COMMAND", "EMUL", "WAIT-CHANNEL", "WAIT-MSG");
+               db_printf("    TID  %-15s  %-5s  %18s  %s\n",
+                   "COMMAND", "PGRP", "WAIT-CHANNEL", "WAIT-MSG");
                break;
        case 'o':
                skipzomb = 1;
-               db_printf("   TID  %5s  %5s  %10s %10s  %3s  %-31s\n",
+               db_printf("    TID  %5s  %5s  %10s %10s  %3s  %-30s\n",
                    "PID", "UID", "PRFLAGS", "PFLAGS", "CPU", "COMMAND");
                break;
        }
@@ -509,7 +509,7 @@ db_show_all_procs(db_expr_t addr, int ha
                                switch (*mode) {
 
                                case 'a':
-                                       db_printf("%-10.10s  %18p  %18p  
%18p\n",
+                                       db_printf("%-9.9s  %18p  %18p  %18p\n",
                                            pr->ps_comm, p, p->p_addr, 
p->p_vmspace);
                                        break;
 
@@ -524,9 +524,11 @@ db_show_all_procs(db_expr_t addr, int ha
                                        break;
 
                                case 'w':
-                                       db_printf("%-16s  %-8s  %18p  %s\n", 
pr->ps_comm,
-                                           pr->ps_emul->e_name, p->p_wchan,
-                                           (p->p_wchan && p->p_wmesg) ? 
+                                       db_printf("%-15s  %-5d  %18p  %s\n",
+                                           pr->ps_comm, (pr->ps_pgrp ?
+                                               pr->ps_pgrp->pg_id : -1),
+                                           p->p_wchan,
+                                           (p->p_wchan && p->p_wmesg) ?
                                                p->p_wmesg : "");
                                        break;
 
Index: share/man/man4/ddb.4
===================================================================
RCS file: /cvs/src/share/man/man4/ddb.4,v
retrieving revision 1.84
diff -u -p -r1.84 ddb.4
--- share/man/man4/ddb.4        24 Jan 2017 04:50:48 -0000      1.84
+++ share/man/man4/ddb.4        24 Jan 2017 05:03:38 -0000
@@ -849,7 +849,7 @@ Shows non-idle threads that were on CPU 
 Information printed includes thread ID, process ID, UID, process flags,
 thread flags, current CPU, and command name.
 .It Cm /w
-Shows each thread's ID, command, system call emulation,
+Shows each thread's ID, command, process group,
 wait channel address, and wait channel message.
 .El
 .\" --------------------

Reply via email to