Make procstat(1) recognize process descriptors, so that it shows

"P" instead of "?" in "procstat -af" output. Note that there are
still a few more DTYPE_* kinds we don't decode yet.

Reported by:	rwatson
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D12426
This commit is contained in:
Edward Tomasz Napierala 2017-10-03 11:45:24 +00:00
parent a470b2750f
commit 3cfa7c6e48
4 changed files with 14 additions and 1 deletions

View File

@ -582,6 +582,10 @@ procstat_getfiles_kvm(struct procstat *procstat, struct kinfo_proc *kp, int mmap
type = PS_FST_TYPE_SHM;
data = file.f_data;
break;
case DTYPE_PROCDESC:
type = PS_FST_TYPE_PROCDESC;
data = file.f_data;
break;
default:
continue;
}
@ -665,6 +669,7 @@ kinfo_type2fst(int kftype)
int kf_type;
int fst_type;
} kftypes2fst[] = {
{ KF_TYPE_PROCDESC, PS_FST_TYPE_PROCDESC },
{ KF_TYPE_CRYPTO, PS_FST_TYPE_CRYPTO },
{ KF_TYPE_FIFO, PS_FST_TYPE_FIFO },
{ KF_TYPE_KQUEUE, PS_FST_TYPE_KQUEUE },

View File

@ -68,6 +68,7 @@
#define PS_FST_TYPE_SEM 10
#define PS_FST_TYPE_UNKNOWN 11
#define PS_FST_TYPE_NONE 12
#define PS_FST_TYPE_PROCDESC 13
/*
* Special descriptor numbers.

View File

@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd May 26, 2017
.Dd October 3, 2017
.Dt PROCSTAT 1
.Os
.Sh NAME
@ -212,6 +212,8 @@ shared memory
kqueue
.It m
message queue
.It P
process descriptor
.It p
pipe
.It s

View File

@ -400,6 +400,11 @@ procstat_files(struct procstat *procstat, struct kinfo_proc *kipp)
xo_emit("{eq:fd_type/sem}");
break;
case PS_FST_TYPE_PROCDESC:
str = "P";
xo_emit("{eq:fd_type/procdesc}");
break;
case PS_FST_TYPE_NONE:
str = "?";
xo_emit("{eq:fd_type/none}");