Page MenuHomeFreeBSD

D60285.id188764.diff
No OneTemporary

D60285.id188764.diff

diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c
--- a/sys/fs/devfs/devfs_vnops.c
+++ b/sys/fs/devfs/devfs_vnops.c
@@ -67,6 +67,7 @@
static struct vop_vector devfs_vnodeops;
static struct vop_vector devfs_specops;
static const struct fileops devfs_ops_f;
+static const struct fileops devfs_ops_nonpassable_f;
#include <fs/devfs/devfs.h>
#include <fs/devfs/devfs_int.h>
@@ -1344,8 +1345,11 @@
if (fp == NULL)
return (error);
#endif
- if (fp->f_ops == &badfileops)
- finit(fp, fp->f_flag, DTYPE_VNODE, dev, &devfs_ops_f);
+ if (fp->f_ops == &badfileops) {
+ finit(fp, fp->f_flag, DTYPE_VNODE, dev,
+ (dsw->d_flags & D_NONPASSABLE) == 0 ? &devfs_ops_f :
+ &devfs_ops_nonpassable_f);
+ }
return (error);
}
@@ -2096,6 +2100,25 @@
.fo_flags = DFLAG_PASSABLE | DFLAG_SEEKABLE
};
+static const struct fileops devfs_ops_nonpassable_f = {
+ .fo_read = devfs_read_f,
+ .fo_write = devfs_write_f,
+ .fo_truncate = devfs_truncate_f,
+ .fo_ioctl = devfs_ioctl_f,
+ .fo_poll = devfs_poll_f,
+ .fo_kqfilter = devfs_kqfilter_f,
+ .fo_stat = devfs_stat_f,
+ .fo_close = devfs_close_f,
+ .fo_chmod = vn_chmod,
+ .fo_chown = vn_chown,
+ .fo_sendfile = vn_sendfile,
+ .fo_seek = vn_seek,
+ .fo_fill_kinfo = vn_fill_kinfo,
+ .fo_mmap = devfs_mmap_f,
+ .fo_cmp = devfs_cmp_f,
+ .fo_flags = DFLAG_SEEKABLE
+};
+
/* Vops for non-CHR vnodes in /dev. */
static struct vop_vector devfs_vnodeops = {
.vop_default = &default_vnodeops,
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -177,6 +177,8 @@
#define D_GIANTOK 0x00200000 /* suppress warning about using Giant */
#define D_NEEDGIANT 0x00400000 /* driver want Giant */
#define D_NEEDMINOR 0x00800000 /* driver uses clone_create() */
+#define D_NONPASSABLE 0x01000000 /* file is not passable with
+ SCM_RIGHTS or fork(2) */
/*
* Version numbers.

File Metadata

Mime Type
text/plain
Expires
Wed, Oct 7, 6:56 PM (1 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40319642
Default Alt Text
D60285.id188764.diff (1 KB)

Event Timeline