Add FIODTYPE ioctl for getting d_flags (type) info on a device.

Okayed by:	phk
This commit is contained in:
Brian Feldman 1999-08-27 16:35:37 +00:00
parent 34067f9475
commit b5fca1cb2a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=50459
2 changed files with 9 additions and 2 deletions

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)vfs_vnops.c 8.2 (Berkeley) 1/21/94 * @(#)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> #include <sys/param.h>
@ -496,6 +496,12 @@ vn_ioctl(fp, com, data, p)
case VFIFO: case VFIFO:
case VCHR: case VCHR:
case VBLK: 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); error = VOP_IOCTL(vp, com, data, fp->f_flag, p->p_ucred, p);
if (error == 0 && com == TIOCSCTTY) { if (error == 0 && com == TIOCSCTTY) {

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)filio.h 8.1 (Berkeley) 3/28/94 * @(#)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_ #ifndef _SYS_FILIO_H_
@ -52,5 +52,6 @@
#define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */ #define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */
#define FIOSETOWN _IOW('f', 124, int) /* set owner */ #define FIOSETOWN _IOW('f', 124, int) /* set owner */
#define FIOGETOWN _IOR('f', 123, int) /* get owner */ #define FIOGETOWN _IOR('f', 123, int) /* get owner */
#define FIODTYPE _IOR('f', 122, int) /* get d_flags type part */
#endif /* !_SYS_FILIO_H_ */ #endif /* !_SYS_FILIO_H_ */