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
This commit is contained in:
Will Andrews 2013-08-26 23:48:21 +00:00
parent e44da61e69
commit 5e9ccc8797
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=254943
5 changed files with 9 additions and 1 deletions

View file

@ -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},

View file

@ -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 )

View file

@ -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;

View file

@ -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);

View file

@ -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 */