From b5fca1cb2a4372c697948e57a9768bd5d6c11aac Mon Sep 17 00:00:00 2001 From: Brian Feldman Date: Fri, 27 Aug 1999 16:35:37 +0000 Subject: [PATCH] Add FIODTYPE ioctl for getting d_flags (type) info on a device. Okayed by: phk --- sys/kern/vfs_vnops.c | 8 +++++++- sys/sys/filio.h | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 71a43f56180f..a91ca18672f8 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_vnops.c 8.2 (Berkeley) 1/21/94 - * $Id: vfs_vnops.c,v 1.74 1999/08/13 11:22:48 phk Exp $ + * $Id: vfs_vnops.c,v 1.75 1999/08/25 11:44:11 phk Exp $ */ #include @@ -496,6 +496,12 @@ vn_ioctl(fp, com, data, p) case VFIFO: case VCHR: case VBLK: + if (com == FIODTYPE) { + if (vp->v_type != VCHR && vp->v_type != VBLK) + return (ENOTTY); + *(int *)data = devsw(vp->v_rdev)->d_flags & D_TYPEMASK; + return (0); + } error = VOP_IOCTL(vp, com, data, fp->f_flag, p->p_ucred, p); if (error == 0 && com == TIOCSCTTY) { diff --git a/sys/sys/filio.h b/sys/sys/filio.h index b82a649c0feb..d0c94af7b644 100644 --- a/sys/sys/filio.h +++ b/sys/sys/filio.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)filio.h 8.1 (Berkeley) 3/28/94 - * $Id$ + * $Id: filio.h,v 1.4 1997/02/22 09:45:16 peter Exp $ */ #ifndef _SYS_FILIO_H_ @@ -52,5 +52,6 @@ #define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */ #define FIOSETOWN _IOW('f', 124, int) /* set owner */ #define FIOGETOWN _IOR('f', 123, int) /* get owner */ +#define FIODTYPE _IOR('f', 122, int) /* get d_flags type part */ #endif /* !_SYS_FILIO_H_ */