svn commit: r341447 - in head/sys: compat/linuxkpi/common/src sys
Konstantin Belousov
kib at FreeBSD.org
Mon Dec 3 23:39:46 UTC 2018
Author: kib
Date: Mon Dec 3 23:39:45 2018
New Revision: 341447
URL: https://svnweb.freebsd.org/changeset/base/341447
Log:
Improve procstat reporting for the linux cdev file descriptors.
If there is a vnode attached to the linux file, use it to fill
kinfo_file. Otherwise, report a new KF_TYPE_DEV file type, without
supplying any type-specific information.
KF_TYPE_DEV is supposed to be used by most devfs-specific file types.
Sponsored by: Mellanox Technologies
MFC after: 1 week
Modified:
head/sys/compat/linuxkpi/common/src/linux_compat.c
head/sys/sys/user.h
Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c
==============================================================================
--- head/sys/compat/linuxkpi/common/src/linux_compat.c Mon Dec 3 22:31:57 2018 (r341446)
+++ head/sys/compat/linuxkpi/common/src/linux_compat.c Mon Dec 3 23:39:45 2018 (r341447)
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
#include <sys/rwlock.h>
#include <sys/mman.h>
#include <sys/stack.h>
+#include <sys/user.h>
#include <vm/vm.h>
#include <vm/pmap.h>
@@ -1546,8 +1547,24 @@ static int
linux_file_fill_kinfo(struct file *fp, struct kinfo_file *kif,
struct filedesc *fdp)
{
+ struct linux_file *filp;
+ struct vnode *vp;
+ int error;
- return (0);
+ filp = fp->f_data;
+ vp = filp->f_vnode;
+ if (vp == NULL) {
+ error = 0;
+ kif->kf_type = KF_TYPE_DEV;
+ } else {
+ vref(vp);
+ FILEDESC_SUNLOCK(fdp);
+ error = vn_fill_kinfo_vnode(vp, kif);
+ vrele(vp);
+ kif->kf_type = KF_TYPE_VNODE;
+ FILEDESC_SLOCK(fdp);
+ }
+ return (error);
}
unsigned int
Modified: head/sys/sys/user.h
==============================================================================
--- head/sys/sys/user.h Mon Dec 3 22:31:57 2018 (r341446)
+++ head/sys/sys/user.h Mon Dec 3 23:39:45 2018 (r341447)
@@ -262,6 +262,7 @@ struct user {
#define KF_TYPE_SEM 9
#define KF_TYPE_PTS 10
#define KF_TYPE_PROCDESC 11
+#define KF_TYPE_DEV 12
#define KF_TYPE_UNKNOWN 255
#define KF_VTYPE_VNON 0
More information about the svn-src-all
mailing list