From a66732de4f6b7b5d6149f5e8c3fc89c70ad52d43 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Mon, 3 Dec 2018 23:42:04 +0000 Subject: [PATCH] Print type designator 'D' for the KF_TYPE_DEV files. No type-specific data is provided by the kernel. Sponsored by: Mellanox Technologies MFC after: 1 week --- lib/libprocstat/libprocstat.c | 5 +++++ lib/libprocstat/libprocstat.h | 1 + usr.bin/fstat/fstat.c | 2 ++ usr.bin/procstat/procstat_files.c | 5 +++++ 4 files changed, 13 insertions(+) diff --git a/lib/libprocstat/libprocstat.c b/lib/libprocstat/libprocstat.c index 99a9c50337e4..abba033a8c52 100644 --- a/lib/libprocstat/libprocstat.c +++ b/lib/libprocstat/libprocstat.c @@ -588,6 +588,10 @@ procstat_getfiles_kvm(struct procstat *procstat, struct kinfo_proc *kp, int mmap type = PS_FST_TYPE_PROCDESC; data = file.f_data; break; + case DTYPE_DEV: + type = PS_FST_TYPE_DEV; + data = file.f_data; + break; default: continue; } @@ -673,6 +677,7 @@ kinfo_type2fst(int kftype) } kftypes2fst[] = { { KF_TYPE_PROCDESC, PS_FST_TYPE_PROCDESC }, { KF_TYPE_CRYPTO, PS_FST_TYPE_CRYPTO }, + { KF_TYPE_DEV, PS_FST_TYPE_DEV }, { KF_TYPE_FIFO, PS_FST_TYPE_FIFO }, { KF_TYPE_KQUEUE, PS_FST_TYPE_KQUEUE }, { KF_TYPE_MQUEUE, PS_FST_TYPE_MQUEUE }, diff --git a/lib/libprocstat/libprocstat.h b/lib/libprocstat/libprocstat.h index 94024c850e68..6e03ef515444 100644 --- a/lib/libprocstat/libprocstat.h +++ b/lib/libprocstat/libprocstat.h @@ -71,6 +71,7 @@ #define PS_FST_TYPE_UNKNOWN 11 #define PS_FST_TYPE_NONE 12 #define PS_FST_TYPE_PROCDESC 13 +#define PS_FST_TYPE_DEV 14 /* * Special descriptor numbers. diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c index 2c81ffd08e25..f4d8c25708c1 100644 --- a/usr.bin/fstat/fstat.c +++ b/usr.bin/fstat/fstat.c @@ -301,6 +301,8 @@ print_file_info(struct procstat *procstat, struct filestat *fst, case PS_FST_TYPE_SEM: print_sem_info(procstat, fst); break; + case PS_FST_TYPE_DEV: + break; default: if (vflg) fprintf(stderr, diff --git a/usr.bin/procstat/procstat_files.c b/usr.bin/procstat/procstat_files.c index ad1e1ca866d4..7a55659abcb5 100644 --- a/usr.bin/procstat/procstat_files.c +++ b/usr.bin/procstat/procstat_files.c @@ -408,6 +408,11 @@ procstat_files(struct procstat *procstat, struct kinfo_proc *kipp) xo_emit("{eq:fd_type/procdesc}"); break; + case PS_FST_TYPE_DEV: + str = "D"; + xo_emit("{eq:fd_type/dev}"); + break; + case PS_FST_TYPE_NONE: str = "?"; xo_emit("{eq:fd_type/none}");