summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgreen <green@FreeBSD.org>1999-08-27 16:35:37 +0000
committergreen <green@FreeBSD.org>1999-08-27 16:35:37 +0000
commit080e369bf20e9a57db62ba812782c46f7290d657 (patch)
treed0d1887e330efbfaf57156e4e2f9639ca3225ec1
parentffd6399600ecf9973a8a8202ef1d2c969dfb7c42 (diff)
downloadFreeBSD-src-080e369bf20e9a57db62ba812782c46f7290d657.zip
FreeBSD-src-080e369bf20e9a57db62ba812782c46f7290d657.tar.gz
Add FIODTYPE ioctl for getting d_flags (type) info on a device.
Okayed by: phk
-rw-r--r--sys/kern/vfs_vnops.c8
-rw-r--r--sys/sys/filio.h3
2 files changed, 9 insertions, 2 deletions
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index 71a43f5..a91ca18 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 <sys/param.h>
@@ -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 b82a649..d0c94af7 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_ */
OpenPOWER on IntegriCloud