Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Dec 2018 01:38:49 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r341778 - in stable/11/sys: compat/linuxkpi/common/src sys
Message-ID:  <201812100138.wBA1cnNg053301@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Dec 10 01:38:48 2018
New Revision: 341778
URL: https://svnweb.freebsd.org/changeset/base/341778

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

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

Modified: stable/11/sys/compat/linuxkpi/common/src/linux_compat.c
==============================================================================
--- stable/11/sys/compat/linuxkpi/common/src/linux_compat.c	Mon Dec 10 01:03:16 2018	(r341777)
+++ stable/11/sys/compat/linuxkpi/common/src/linux_compat.c	Mon Dec 10 01:38:48 2018	(r341778)
@@ -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/11/sys/sys/user.h
==============================================================================
--- stable/11/sys/sys/user.h	Mon Dec 10 01:03:16 2018	(r341777)
+++ stable/11/sys/sys/user.h	Mon Dec 10 01:38:48 2018	(r341778)
@@ -259,6 +259,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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812100138.wBA1cnNg053301>