diff options
author | will <will@FreeBSD.org> | 2013-08-26 23:48:21 +0000 |
---|---|---|
committer | will <will@FreeBSD.org> | 2013-08-26 23:48:21 +0000 |
commit | a52b9ca1d3093315714bdb9c80d6cc06215837a0 (patch) | |
tree | f82f67cc875d4d29e153a4dc547c3ccbc1a22f38 | |
parent | fe9638e56d5327851fc0bb1330797ef34ad22cb5 (diff) | |
download | FreeBSD-src-a52b9ca1d3093315714bdb9c80d6cc06215837a0.zip FreeBSD-src-a52b9ca1d3093315714bdb9c80d6cc06215837a0.tar.gz |
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 <olli@fromme.com>, gibbs
-rw-r--r-- | bin/ps/keyword.c | 1 | ||||
-rw-r--r-- | bin/ps/ps.1 | 3 | ||||
-rw-r--r-- | sys/compat/freebsd32/freebsd32.h | 1 | ||||
-rw-r--r-- | sys/kern/kern_proc.c | 2 | ||||
-rw-r--r-- | sys/sys/user.h | 3 |
5 files changed, 9 insertions, 1 deletions
diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c index 5861129..21e6791 100644 --- a/bin/ps/keyword.c +++ b/bin/ps/keyword.c @@ -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}, diff --git a/bin/ps/ps.1 b/bin/ps/ps.1 index 1a364f5..81a1f6d 100644 --- a/bin/ps/ps.1 +++ b/bin/ps/ps.1 @@ -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 ) diff --git a/sys/compat/freebsd32/freebsd32.h b/sys/compat/freebsd32/freebsd32.h index 9b04965..aa08432 100644 --- a/sys/compat/freebsd32/freebsd32.h +++ b/sys/compat/freebsd32/freebsd32.h @@ -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; diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 45920c4..3fa7a7f 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -862,6 +862,7 @@ fill_kinfo_proc_only(struct proc *p, struct kinfo_proc *kp) 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 kinfo_proc *ki, struct kinfo_proc32 *ki32) 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); diff --git a/sys/sys/user.h b/sys/sys/user.h index aa81dc9..9389e55 100644 --- a/sys/sys/user.h +++ b/sys/sys/user.h @@ -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 */ |