Decode and report native eventfd descriptors from libprocstat and procstat.

Submitted by:   greg@unrelenting.technology
Reviewed by:    markj (previous version)
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D26668
This commit is contained in:
Konstantin Belousov 2020-12-23 16:17:44 +02:00
parent 6d075fd9a5
commit 67af9aba6b
4 changed files with 13 additions and 0 deletions

View File

@ -628,6 +628,10 @@ procstat_getfiles_kvm(struct procstat *procstat, struct kinfo_proc *kp, int mmap
type = PS_FST_TYPE_DEV;
data = file.f_data;
break;
case DTYPE_EVENTFD:
type = PS_FST_TYPE_EVENTFD;
data = file.f_data;
break;
default:
continue;
}
@ -719,6 +723,7 @@ kinfo_type2fst(int kftype)
{ KF_TYPE_SHM, PS_FST_TYPE_SHM },
{ KF_TYPE_SOCKET, PS_FST_TYPE_SOCKET },
{ KF_TYPE_VNODE, PS_FST_TYPE_VNODE },
{ KF_TYPE_EVENTFD, PS_FST_TYPE_EVENTFD },
{ KF_TYPE_UNKNOWN, PS_FST_TYPE_UNKNOWN }
};
#define NKFTYPES (sizeof(kftypes2fst) / sizeof(*kftypes2fst))

View File

@ -72,6 +72,7 @@
#define PS_FST_TYPE_NONE 12
#define PS_FST_TYPE_PROCDESC 13
#define PS_FST_TYPE_DEV 14
#define PS_FST_TYPE_EVENTFD 15
/*
* Special descriptor numbers.

View File

@ -313,6 +313,8 @@ The following file descriptor types may be displayed:
.Bl -tag -width X -compact
.It e
POSIX semaphore
.It E
eventfd
.It f
fifo
.It h

View File

@ -414,6 +414,11 @@ procstat_files(struct procstat *procstat, struct kinfo_proc *kipp)
xo_emit("{eq:fd_type/dev}");
break;
case PS_FST_TYPE_EVENTFD:
str = "E";
xo_emit("{eq:fd_type/eventfd}");
break;
case PS_FST_TYPE_NONE:
str = "?";
xo_emit("{eq:fd_type/none}");