diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2013-03-28 02:08:40 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2013-03-28 02:08:40 +0000 |
commit | bee2ea35a216108e9a1e1db4c01820e8e236b62d (patch) | |
tree | 46815e26503ea2aa9ee8af2c3fcea3d44cd8adff | |
parent | 1682209d2280b7c51c61607fe7cb5e272b7ded92 (diff) |
Handle the pathconf _PC_PATH_MAX, _PC_PIPE_BUF, _PC_ASYNC_IO,
_PC_PRIO_IO, and _PC_SYNC_IO names in VOP_PATHCONF(), as they're
fs-independent for us. Since we don't support latter three on any
fs, we can also define the related _POSIX_{ASYNC,PRIO,SYNC}_IO
symbols in <unistd.h> (via sys/unistd.h) with value -1.
Also, zap pointless tty-only values from procfs(!).
ok beck@, deraadt@
-rw-r--r-- | sys/isofs/cd9660/cd9660_vnops.c | 8 | ||||
-rw-r--r-- | sys/isofs/udf/udf_vnops.c | 5 | ||||
-rw-r--r-- | sys/kern/spec_vnops.c | 5 | ||||
-rw-r--r-- | sys/kern/vfs_vops.c | 22 | ||||
-rw-r--r-- | sys/miscfs/fifofs/fifo_vnops.c | 5 | ||||
-rw-r--r-- | sys/miscfs/procfs/procfs_vnops.c | 14 | ||||
-rw-r--r-- | sys/msdosfs/msdosfs_vnops.c | 5 | ||||
-rw-r--r-- | sys/ntfs/ntfs_vnops.c | 5 | ||||
-rw-r--r-- | sys/sys/unistd.h | 5 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_vnops.c | 14 |
10 files changed, 33 insertions, 55 deletions
diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c index b6446bb513b..c0c16032058 100644 --- a/sys/isofs/cd9660/cd9660_vnops.c +++ b/sys/isofs/cd9660/cd9660_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd9660_vnops.c,v 1.57 2012/09/26 04:32:40 brad Exp $ */ +/* $OpenBSD: cd9660_vnops.c,v 1.58 2013/03/28 02:08:39 guenther Exp $ */ /* $NetBSD: cd9660_vnops.c,v 1.42 1997/10/16 23:56:57 christos Exp $ */ /*- @@ -876,12 +876,6 @@ cd9660_pathconf(void *v) else *ap->a_retval = 37; break; - case _PC_PATH_MAX: - *ap->a_retval = PATH_MAX; - break; - case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; - break; case _PC_CHOWN_RESTRICTED: *ap->a_retval = 1; break; diff --git a/sys/isofs/udf/udf_vnops.c b/sys/isofs/udf/udf_vnops.c index 4f77dd05644..46fdd29f10f 100644 --- a/sys/isofs/udf/udf_vnops.c +++ b/sys/isofs/udf/udf_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udf_vnops.c,v 1.45 2012/06/20 17:30:22 matthew Exp $ */ +/* $OpenBSD: udf_vnops.c,v 1.46 2013/03/28 02:08:39 guenther Exp $ */ /* * Copyright (c) 2001, 2002 Scott Long <scottl@freebsd.org> @@ -401,9 +401,6 @@ udf_pathconf(struct vop_pathconf_args *a) case _PC_NAME_MAX: *ap->a_retval = NAME_MAX; break; - case _PC_PATH_MAX: - *ap->a_retval = PATH_MAX; - break; case _PC_NO_TRUNC: *ap->a_retval = 1; break; diff --git a/sys/kern/spec_vnops.c b/sys/kern/spec_vnops.c index bc2d60c3230..9c54d61ee7d 100644 --- a/sys/kern/spec_vnops.c +++ b/sys/kern/spec_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spec_vnops.c,v 1.69 2012/06/20 17:30:22 matthew Exp $ */ +/* $OpenBSD: spec_vnops.c,v 1.70 2013/03/28 02:08:39 guenther Exp $ */ /* $NetBSD: spec_vnops.c,v 1.29 1996/04/22 01:42:38 christos Exp $ */ /* @@ -617,9 +617,6 @@ spec_pathconf(void *v) case _PC_MAX_INPUT: *ap->a_retval = MAX_INPUT; break; - case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; - break; case _PC_CHOWN_RESTRICTED: *ap->a_retval = 1; break; diff --git a/sys/kern/vfs_vops.c b/sys/kern/vfs_vops.c index 8b9f6e49735..a89a7746457 100644 --- a/sys/kern/vfs_vops.c +++ b/sys/kern/vfs_vops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_vops.c,v 1.4 2011/07/02 15:52:25 thib Exp $ */ +/* $OpenBSD: vfs_vops.c,v 1.5 2013/03/28 02:08:39 guenther Exp $ */ /* * Copyright (c) 2010 Thordur I. Bjornsson <thib@openbsd.org> * @@ -45,6 +45,7 @@ #include <sys/param.h> #include <sys/mount.h> #include <sys/vnode.h> +#include <sys/unistd.h> #ifdef VFSLCKDEBUG #define ASSERT_VP_ISLOCKED(vp) do { \ @@ -562,6 +563,25 @@ int VOP_PATHCONF(struct vnode *vp, int name, register_t *retval) { struct vop_pathconf_args a; + + /* + * Handle names that are constant across filesystem + */ + switch (name) { + case _PC_PATH_MAX: + *retval = PATH_MAX; + return (0); + case _PC_PIPE_BUF: + *retval = PIPE_BUF; + return (0); + case _PC_ASYNC_IO: + case _PC_PRIO_IO: + case _PC_SYNC_IO: + *retval = 0; + return (0); + + } + a.a_vp = vp; a.a_name = name; a.a_retval = retval; diff --git a/sys/miscfs/fifofs/fifo_vnops.c b/sys/miscfs/fifofs/fifo_vnops.c index cb73bdd09fa..d52795d8732 100644 --- a/sys/miscfs/fifofs/fifo_vnops.c +++ b/sys/miscfs/fifofs/fifo_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fifo_vnops.c,v 1.37 2012/06/20 17:30:22 matthew Exp $ */ +/* $OpenBSD: fifo_vnops.c,v 1.38 2013/03/28 02:08:39 guenther Exp $ */ /* $NetBSD: fifo_vnops.c,v 1.18 1996/03/16 23:52:42 christos Exp $ */ /* @@ -414,9 +414,6 @@ fifo_pathconf(void *v) case _PC_LINK_MAX: *ap->a_retval = LINK_MAX; break; - case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; - break; case _PC_CHOWN_RESTRICTED: *ap->a_retval = 1; break; diff --git a/sys/miscfs/procfs/procfs_vnops.c b/sys/miscfs/procfs/procfs_vnops.c index 45939b1b234..eb20e525507 100644 --- a/sys/miscfs/procfs/procfs_vnops.c +++ b/sys/miscfs/procfs/procfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs_vnops.c,v 1.55 2012/06/20 17:30:22 matthew Exp $ */ +/* $OpenBSD: procfs_vnops.c,v 1.56 2013/03/28 02:08:39 guenther Exp $ */ /* $NetBSD: procfs_vnops.c,v 1.40 1996/03/16 23:52:55 christos Exp $ */ /* @@ -320,21 +320,9 @@ procfs_pathconf(void *v) case _PC_LINK_MAX: *ap->a_retval = LINK_MAX; break; - case _PC_MAX_CANON: - *ap->a_retval = MAX_CANON; - break; - case _PC_MAX_INPUT: - *ap->a_retval = MAX_INPUT; - break; - case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; - break; case _PC_CHOWN_RESTRICTED: *ap->a_retval = 1; break; - case _PC_VDISABLE: - *ap->a_retval = _POSIX_VDISABLE; - break; default: error = EINVAL; break; diff --git a/sys/msdosfs/msdosfs_vnops.c b/sys/msdosfs/msdosfs_vnops.c index 1acfebb716c..74e8d1a7704 100644 --- a/sys/msdosfs/msdosfs_vnops.c +++ b/sys/msdosfs/msdosfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfs_vnops.c,v 1.83 2013/01/15 06:05:47 martynas Exp $ */ +/* $OpenBSD: msdosfs_vnops.c,v 1.84 2013/03/28 02:08:39 guenther Exp $ */ /* $NetBSD: msdosfs_vnops.c,v 1.63 1997/10/17 11:24:19 ws Exp $ */ /*- @@ -1882,9 +1882,6 @@ msdosfs_pathconf(void *v) case _PC_NAME_MAX: *ap->a_retval = pmp->pm_flags & MSDOSFSMNT_LONGNAME ? WIN_MAXLEN : 12; break; - case _PC_PATH_MAX: - *ap->a_retval = PATH_MAX; - break; case _PC_CHOWN_RESTRICTED: *ap->a_retval = 1; break; diff --git a/sys/ntfs/ntfs_vnops.c b/sys/ntfs/ntfs_vnops.c index 2e169c1bb27..533e1ee05c1 100644 --- a/sys/ntfs/ntfs_vnops.c +++ b/sys/ntfs/ntfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntfs_vnops.c,v 1.29 2013/01/14 09:44:57 jsing Exp $ */ +/* $OpenBSD: ntfs_vnops.c,v 1.30 2013/03/28 02:08:39 guenther Exp $ */ /* $NetBSD: ntfs_vnops.c,v 1.6 2003/04/10 21:57:26 jdolecek Exp $ */ /* @@ -734,9 +734,6 @@ ntfs_pathconf(void *v) case _PC_NAME_MAX: *ap->a_retval = NTFS_MAXFILENAME; break; - case _PC_PATH_MAX: - *ap->a_retval = PATH_MAX; - break; case _PC_CHOWN_RESTRICTED: *ap->a_retval = 1; break; diff --git a/sys/sys/unistd.h b/sys/sys/unistd.h index 609bebe8692..ee35db7e48c 100644 --- a/sys/sys/unistd.h +++ b/sys/sys/unistd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: unistd.h,v 1.26 2013/03/14 21:38:22 tedu Exp $ */ +/* $OpenBSD: unistd.h,v 1.27 2013/03/28 02:08:39 guenther Exp $ */ /* $NetBSD: unistd.h,v 1.10 1994/06/29 06:46:06 cgd Exp $ */ /* @@ -38,6 +38,9 @@ #include <sys/cdefs.h> #define _POSIX_VDISABLE (0377) +#define _POSIX_ASYNC_IO (-1) +#define _POSIX_PRIO_IO (-1) +#define _POSIX_SYNC_IO (-1) /* Define the POSIX.1 version we target for compliance. */ #define _POSIX_VERSION 199009L diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 112bec3dd09..2f35cc6b20c 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_vnops.c,v 1.104 2012/06/20 17:30:22 matthew Exp $ */ +/* $OpenBSD: ufs_vnops.c,v 1.105 2013/03/28 02:08:39 guenther Exp $ */ /* $NetBSD: ufs_vnops.c,v 1.18 1996/05/11 18:28:04 mycroft Exp $ */ /* @@ -1725,24 +1725,12 @@ ufs_pathconf(void *v) case _PC_NAME_MAX: *ap->a_retval = NAME_MAX; break; - case _PC_PATH_MAX: - *ap->a_retval = PATH_MAX; - break; - case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; - break; case _PC_CHOWN_RESTRICTED: *ap->a_retval = 1; break; case _PC_NO_TRUNC: *ap->a_retval = 1; break; - case _PC_PRIO_IO: - *ap->a_retval = 0; - break; - case _PC_SYNC_IO: - *ap->a_retval = 0; - break; case _PC_ALLOC_SIZE_MIN: *ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_bsize; break; |