Only handle _PC_MAX_CANON, _PC_MAX_INPUT, and _PC_VDISABLE for TTY devices.

Move handling of these three pathconf() variables out of vop_stdpathconf()
and into devfs_pathconf() as TTY devices can only be devfs files.  In
addition, only return settings for these three variables for devfs devices
whose device switch has the D_TTY flag set.

Discussed with:	bde, kib
Sponsored by:	Chelsio Communications
This commit is contained in:
jhb 2017-09-21 23:05:32 +00:00
parent ebd5dd0a34
commit c5f4b54f16
2 changed files with 18 additions and 9 deletions

View File

@ -1178,6 +1178,24 @@ devfs_pathconf(struct vop_pathconf_args *ap)
{
switch (ap->a_name) {
case _PC_MAX_CANON:
if (ap->a_vp->v_vflag & VV_ISTTY) {
*ap->a_retval = MAX_CANON;
return (0);
}
return (EINVAL);
case _PC_MAX_INPUT:
if (ap->a_vp->v_vflag & VV_ISTTY) {
*ap->a_retval = MAX_INPUT;
return (0);
}
return (EINVAL);
case _PC_VDISABLE:
if (ap->a_vp->v_vflag & VV_ISTTY) {
*ap->a_retval = _POSIX_VDISABLE;
return (0);
}
return (EINVAL);
case _PC_MAC_PRESENT:
#ifdef MAC
/*

View File

@ -486,21 +486,12 @@ vop_stdpathconf(ap)
case _PC_LINK_MAX:
*ap->a_retval = LINK_MAX;
return (0);
case _PC_MAX_CANON:
*ap->a_retval = MAX_CANON;
return (0);
case _PC_MAX_INPUT:
*ap->a_retval = MAX_INPUT;
return (0);
case _PC_PIPE_BUF:
*ap->a_retval = PIPE_BUF;
return (0);
case _PC_CHOWN_RESTRICTED:
*ap->a_retval = 1;
return (0);
case _PC_VDISABLE:
*ap->a_retval = _POSIX_VDISABLE;
return (0);
default:
return (EINVAL);
}