aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2020-12-23 14:17:44 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2020-12-27 10:57:27 +0000
commit67af9aba6b144789734289443a5f90a3ca716dbe (patch)
treea637702cee998fad632005bcc7d4b3da71f87770
parent6d075fd9a5d339c6d178968d7be86ba128b6dc7b (diff)
downloadsrc-67af9aba6b144789734289443a5f90a3ca716dbe.tar.gz
src-67af9aba6b144789734289443a5f90a3ca716dbe.zip
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
-rw-r--r--lib/libprocstat/libprocstat.c5
-rw-r--r--lib/libprocstat/libprocstat.h1
-rw-r--r--usr.bin/procstat/procstat.12
-rw-r--r--usr.bin/procstat/procstat_files.c5
4 files changed, 13 insertions, 0 deletions
diff --git a/lib/libprocstat/libprocstat.c b/lib/libprocstat/libprocstat.c
index 8d10c2900459..a2de61855815 100644
--- a/lib/libprocstat/libprocstat.c
+++ b/lib/libprocstat/libprocstat.c
@@ -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))
diff --git a/lib/libprocstat/libprocstat.h b/lib/libprocstat/libprocstat.h
index 4ef34da75ec2..0624ec5289d4 100644
--- a/lib/libprocstat/libprocstat.h
+++ b/lib/libprocstat/libprocstat.h
@@ -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.
diff --git a/usr.bin/procstat/procstat.1 b/usr.bin/procstat/procstat.1
index 174f932a9dde..1ce0b796beb4 100644
--- a/usr.bin/procstat/procstat.1
+++ b/usr.bin/procstat/procstat.1
@@ -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
diff --git a/usr.bin/procstat/procstat_files.c b/usr.bin/procstat/procstat_files.c
index 74c6e48eab01..1d7b419b3f4a 100644
--- a/usr.bin/procstat/procstat_files.c
+++ b/usr.bin/procstat/procstat_files.c
@@ -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}");