Author: will
Date: Mon Aug 26 23:48:21 2013
New Revision: 254943
URL: http://svnweb.freebsd.org/changeset/base/254943

Log:
  Add the ability to display the default FIB number for a process to the
  ps(1) utility, e.g. "ps -O fib".
  
  bin/ps/keyword.c:
        Add the "fib" keyword and default its column name to "FIB".
  
  bin/ps/ps.1:
        Add "fib" as a supported keyword.
  
  sys/compat/freebsd32/freebsd32.h:
  sys/kern/kern_proc.c:
  sys/sys/user.h:
        Add the default fib number for a process (p->p_fibnum)
        to the user land accessible process data of struct kinfo_proc.
  
  Submitted by: Oliver Fromme <o...@fromme.com>, gibbs

Modified:
  head/bin/ps/keyword.c
  head/bin/ps/ps.1
  head/sys/compat/freebsd32/freebsd32.h
  head/sys/kern/kern_proc.c
  head/sys/sys/user.h

Modified: head/bin/ps/keyword.c
==============================================================================
--- head/bin/ps/keyword.c       Mon Aug 26 23:37:11 2013        (r254942)
+++ head/bin/ps/keyword.c       Mon Aug 26 23:48:21 2013        (r254943)
@@ -87,6 +87,7 @@ static VAR var[] = {
        {"etimes", "ELAPSED", NULL, USER, elapseds, 0, CHAR, NULL, 0},
        {"euid", "", "uid", 0, NULL, 0, CHAR, NULL, 0},
        {"f", "F", NULL, 0, kvar, KOFF(ki_flag), INT, "x", 0},
+       {"fib", "FIB", NULL, 0, kvar, KOFF(ki_fibnum), INT, "d", 0},
        {"flags", "", "f", 0, NULL, 0, CHAR, NULL, 0},
        {"gid", "GID", NULL, 0, kvar, KOFF(ki_groups), UINT, UIDFMT, 0},
        {"group", "GROUP", NULL, LJUST, egroupname, 0, CHAR, NULL, 0},

Modified: head/bin/ps/ps.1
==============================================================================
--- head/bin/ps/ps.1    Mon Aug 26 23:37:11 2013        (r254942)
+++ head/bin/ps/ps.1    Mon Aug 26 23:48:21 2013        (r254943)
@@ -512,6 +512,9 @@ elapsed running time, format
 minutes:seconds.
 .It Cm etimes
 elapsed running time, in decimal integer seconds
+.It Cm fib
+default FIB number, see
+.Xr setfib 1
 .It Cm flags
 the process flags, in hexadecimal (alias
 .Cm f )

Modified: head/sys/compat/freebsd32/freebsd32.h
==============================================================================
--- head/sys/compat/freebsd32/freebsd32.h       Mon Aug 26 23:37:11 2013        
(r254942)
+++ head/sys/compat/freebsd32/freebsd32.h       Mon Aug 26 23:48:21 2013        
(r254943)
@@ -342,6 +342,7 @@ struct kinfo_proc32 {
        char    ki_loginclass[LOGINCLASSLEN+1];
        char    ki_sparestrings[50];
        int     ki_spareints[KI_NSPARE_INT];
+       int     ki_fibnum;
        u_int   ki_cr_flags;
        int     ki_jid;
        int     ki_numthreads;

Modified: head/sys/kern/kern_proc.c
==============================================================================
--- head/sys/kern/kern_proc.c   Mon Aug 26 23:37:11 2013        (r254942)
+++ head/sys/kern/kern_proc.c   Mon Aug 26 23:48:21 2013        (r254943)
@@ -862,6 +862,7 @@ fill_kinfo_proc_only(struct proc *p, str
        kp->ki_swtime = (ticks - p->p_swtick) / hz;
        kp->ki_pid = p->p_pid;
        kp->ki_nice = p->p_nice;
+       kp->ki_fibnum = p->p_fibnum;
        kp->ki_start = p->p_stats->p_start;
        timevaladd(&kp->ki_start, &boottime);
        PROC_SLOCK(p);
@@ -1160,6 +1161,7 @@ freebsd32_kinfo_proc_out(const struct ki
        bcopy(ki->ki_comm, ki32->ki_comm, COMMLEN + 1);
        bcopy(ki->ki_emul, ki32->ki_emul, KI_EMULNAMELEN + 1);
        bcopy(ki->ki_loginclass, ki32->ki_loginclass, LOGINCLASSLEN + 1);
+       CP(*ki, *ki32, ki_fibnum);
        CP(*ki, *ki32, ki_cr_flags);
        CP(*ki, *ki32, ki_jid);
        CP(*ki, *ki32, ki_numthreads);

Modified: head/sys/sys/user.h
==============================================================================
--- head/sys/sys/user.h Mon Aug 26 23:37:11 2013        (r254942)
+++ head/sys/sys/user.h Mon Aug 26 23:48:21 2013        (r254943)
@@ -83,7 +83,7 @@
  * it in two places: function fill_kinfo_proc in sys/kern/kern_proc.c and
  * function kvm_proclist in lib/libkvm/kvm_proc.c .
  */
-#define        KI_NSPARE_INT   9
+#define        KI_NSPARE_INT   8
 #define        KI_NSPARE_LONG  12
 #define        KI_NSPARE_PTR   6
 
@@ -186,6 +186,7 @@ struct kinfo_proc {
         */
        char    ki_sparestrings[50];    /* spare string space */
        int     ki_spareints[KI_NSPARE_INT];    /* spare room for growth */
+       int     ki_fibnum;              /* Default FIB number */
        u_int   ki_cr_flags;            /* Credential flags */
        int     ki_jid;                 /* Process jail ID */
        int     ki_numthreads;          /* XXXKSE number of threads in total */
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to