svn commit: r304080 - head/sys/ddb

Bruce Evans bde at FreeBSD.org
Sun Aug 14 15:26:41 UTC 2016


Author: bde
Date: Sun Aug 14 15:26:40 2016
New Revision: 304080
URL: https://svnweb.freebsd.org/changeset/base/304080

Log:
  In ddb ps, left justify the non-numeric fields 'state' and 'wmesg' and
  the fixed-width numeric field 'wchan', as in ps(1).  They were sort
  of centered, although the template shows 'state' as right-justified.
  The `wmesg' field very rarely has a prefix of '*' (for lock names)
  that is still to the left of the header, and the width of this field
  is reduced from 8 to 7 (more than 6 is an error).
  
  The 'wmesg' and 'wchan' fields are still misnamed and poorly handled.
  They are named sort of backwards relative to ps(1):
  - wmesg in ddb = mwchan in ps
  - wmesg in ddb = wchan in ps (if it is a wait channel name, not a lock name)
  - wchan in ddb = nwchan in ps
  ddb ps wastes lots of space for the unimportant 'wchan' field (20
  columns altogether on 64-bit arches).  ps(1) documents using a
  compressed format, but the compression only omits leading nybbles of
  0 so it has neveqr worked on arches that put the kernel in the top half
  of the address space.  It just avoids wasting space for an 0x prefix.

Modified:
  head/sys/ddb/db_ps.c

Modified: head/sys/ddb/db_ps.c
==============================================================================
--- head/sys/ddb/db_ps.c	Sun Aug 14 14:50:32 2016	(r304079)
+++ head/sys/ddb/db_ps.c	Sun Aug 14 15:26:40 2016	(r304080)
@@ -69,10 +69,10 @@ DB_SHOW_ALL_COMMAND(procs, db_procs_cmd)
  *
  *          1         2         3         4         5         6         7
  * 1234567890123456789012345678901234567890123456789012345678901234567890
- *   pid  ppid  pgrp   uid   state   wmesg     wchan    cmd
- * <pid> <ppi> <pgi> <uid>  <stat> < wmesg > < wchan  > <name>
+ *   pid  ppid  pgrp   uid  state   wmesg   wchan       cmd
+ * <pid> <ppi> <pgi> <uid>  <stat>  <wmesg> <wchan   >  <name>
  * <pid> <ppi> <pgi> <uid>  <stat>  (threaded)          <command>
- * <tid >                   <stat> < wmesg > < wchan  > <name>
+ * <tid >                   <stat>  <wmesg> <wchan   >  <name>
  *
  * For machines with 64-bit pointers, we expand the wchan field 8 more
  * characters.
@@ -95,9 +95,9 @@ db_ps(db_expr_t addr, bool hasaddr, db_e
 		p = &proc0;
 
 #ifdef __LP64__
-	db_printf("  pid  ppid  pgrp   uid   state   wmesg         wchan        cmd\n");
+	db_printf("  pid  ppid  pgrp   uid  state   wmesg   wchan               cmd\n");
 #else
-	db_printf("  pid  ppid  pgrp   uid   state   wmesg     wchan    cmd\n");
+	db_printf("  pid  ppid  pgrp   uid  state   wmesg   wchan       cmd\n");
 #endif
 	while (--np >= 0 && !db_pager_quit) {
 		if (p == NULL) {
@@ -279,15 +279,15 @@ dumpthread(volatile struct proc *p, vola
 		wmesg = "";
 		wchan = NULL;
 	}
-	db_printf("%c%-8.8s ", wprefix, wmesg);
+	db_printf("%c%-7.7s ", wprefix, wmesg);
 	if (wchan == NULL)
 #ifdef __LP64__
-		db_printf("%18s ", "");
+		db_printf("%18s  ", "");
 #else
-		db_printf("%10s ", "");
+		db_printf("%10s  ", "");
 #endif
 	else
-		db_printf("%p ", wchan);
+		db_printf("%p  ", wchan);
 	if (p->p_flag & P_SYSTEM)
 		db_printf("[");
 	if (td->td_name[0] != '\0')


More information about the svn-src-head mailing list