summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty_pts.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2014-09-22 16:20:47 +0000
committerjhb <jhb@FreeBSD.org>2014-09-22 16:20:47 +0000
commit8f082668d04c6a91668059ff9bdebcfa153839f0 (patch)
tree1934338f5bf1e12f3ce97b74e9e403dcf5a32bc8 /sys/kern/tty_pts.c
parent2a681a5c921fd16ac653be127abedd8baa3ab4a9 (diff)
downloadFreeBSD-src-8f082668d04c6a91668059ff9bdebcfa153839f0.zip
FreeBSD-src-8f082668d04c6a91668059ff9bdebcfa153839f0.tar.gz
Add a new fo_fill_kinfo fileops method to add type-specific information to
struct kinfo_file. - Move the various fill_*_info() methods out of kern_descrip.c and into the various file type implementations. - Rework the support for kinfo_ofile to generate a suitable kinfo_file object for each file and then convert that to a kinfo_ofile structure rather than keeping a second, different set of code that directly manipulates type-specific file information. - Remove the shm_path() and ksem_info() layering violations. Differential Revision: https://reviews.freebsd.org/D775 Reviewed by: kib, glebius (earlier version)
Diffstat (limited to 'sys/kern/tty_pts.c')
-rw-r--r--sys/kern/tty_pts.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/kern/tty_pts.c b/sys/kern/tty_pts.c
index 16cbb3c..58cbc52 100644
--- a/sys/kern/tty_pts.c
+++ b/sys/kern/tty_pts.c
@@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/tty.h>
#include <sys/ttycom.h>
+#include <sys/user.h>
#include <machine/stdarg.h>
@@ -580,6 +581,18 @@ ptsdev_close(struct file *fp, struct thread *td)
return (0);
}
+static int
+ptsdev_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp)
+{
+ struct tty *tp;
+
+ kif->kf_type = KF_TYPE_PTS;
+ tp = fp->f_data;
+ kif->kf_un.kf_pts.kf_pts_dev = tty_udev(tp);
+ strlcpy(kif->kf_path, tty_devname(tp), sizeof(kif->kf_path));
+ return (0);
+}
+
static struct fileops ptsdev_ops = {
.fo_read = ptsdev_read,
.fo_write = ptsdev_write,
@@ -592,6 +605,7 @@ static struct fileops ptsdev_ops = {
.fo_chmod = invfo_chmod,
.fo_chown = invfo_chown,
.fo_sendfile = invfo_sendfile,
+ .fo_fill_kinfo = ptsdev_fill_kinfo,
.fo_flags = DFLAG_PASSABLE,
};
OpenPOWER on IntegriCloud