svn commit: r341776 - in stable/12/sys: compat/linuxkpi/common/src sys

Konstantin Belousov kib at FreeBSD.org
Mon Dec 10 01:01:44 UTC 2018


Author: kib
Date: Mon Dec 10 01:01:43 2018
New Revision: 341776
URL: https://svnweb.freebsd.org/changeset/base/341776

Log:
  MFC r341447:
  Improve procstat reporting for the linux cdev file descriptors.

Modified:
  stable/12/sys/compat/linuxkpi/common/src/linux_compat.c
  stable/12/sys/sys/user.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/compat/linuxkpi/common/src/linux_compat.c
==============================================================================
--- stable/12/sys/compat/linuxkpi/common/src/linux_compat.c	Mon Dec 10 00:59:10 2018	(r341775)
+++ stable/12/sys/compat/linuxkpi/common/src/linux_compat.c	Mon Dec 10 01:01:43 2018	(r341776)
@@ -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: stable/12/sys/sys/user.h
==============================================================================
--- stable/12/sys/sys/user.h	Mon Dec 10 00:59:10 2018	(r341775)
+++ stable/12/sys/sys/user.h	Mon Dec 10 01:01:43 2018	(r341776)
@@ -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-stable mailing list