Date: Thu, 21 Sep 2017 23:05:33 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323882 - in head/sys: fs/devfs kern Message-ID: <201709212305.v8LN5XPT094925@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Thu Sep 21 23:05:32 2017 New Revision: 323882 URL: https://svnweb.freebsd.org/changeset/base/323882 Log: 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 Modified: head/sys/fs/devfs/devfs_vnops.c head/sys/kern/vfs_default.c Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Thu Sep 21 22:33:59 2017 (r323881) +++ head/sys/fs/devfs/devfs_vnops.c Thu Sep 21 23:05:32 2017 (r323882) @@ -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 /* Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Thu Sep 21 22:33:59 2017 (r323881) +++ head/sys/kern/vfs_default.c Thu Sep 21 23:05:32 2017 (r323882) @@ -486,20 +486,11 @@ 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201709212305.v8LN5XPT094925>