summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2013-03-28 03:29:46 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2013-03-28 03:29:46 +0000
commit7f3b9e3bc6d1bf3735d920fc2a1a0928246b3143 (patch)
tree0aa1425db7a5ebb5ec5e9217909e9e73b676b196
parent5db347204f2f2d0c33e0cf121e4067464540507a (diff)
Add support for _PC_TIMESTAMP_RESOLUTION for ffs/mfs, cd9600, ext2,
msdos, NFS, fifos and devices, plus support for querying it in getconf(2) and the requisite pathconf(2) manpage blurb ok tedu@
-rw-r--r--lib/libc/sys/pathconf.26
-rw-r--r--sys/isofs/cd9660/cd9660_vnops.c5
-rw-r--r--sys/kern/spec_vnops.c5
-rw-r--r--sys/miscfs/fifofs/fifo_vnops.c5
-rw-r--r--sys/msdosfs/msdosfs_vnops.c5
-rw-r--r--sys/nfs/nfs_vnops.c5
-rw-r--r--sys/sys/unistd.h43
-rw-r--r--sys/ufs/ext2fs/ext2fs_extern.h3
-rw-r--r--sys/ufs/ext2fs/ext2fs_vnops.c24
-rw-r--r--sys/ufs/ufs/ufs_vnops.c5
-rw-r--r--usr.bin/getconf/getconf.c4
11 files changed, 76 insertions, 34 deletions
diff --git a/lib/libc/sys/pathconf.2 b/lib/libc/sys/pathconf.2
index 4b022be7a4b..effa98da931 100644
--- a/lib/libc/sys/pathconf.2
+++ b/lib/libc/sys/pathconf.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: pathconf.2,v 1.17 2012/07/17 06:30:31 matthew Exp $
+.\" $OpenBSD: pathconf.2,v 1.18 2013/03/28 03:29:45 guenther Exp $
.\" $NetBSD: pathconf.2,v 1.2 1995/02/27 12:35:22 cgd Exp $
.\"
.\" Copyright (c) 1993
@@ -30,7 +30,7 @@
.\"
.\" @(#)pathconf.2 8.1 (Berkeley) 6/4/93
.\"
-.Dd $Mdocdate: July 17 2012 $
+.Dd $Mdocdate: March 28 2013 $
.Dt PATHCONF 2
.Os
.Sh NAME
@@ -129,6 +129,8 @@ Recommended file transfer buffer alignment.
Maximum number of bytes in a symbolic link.
.It Dv _PC_SYNC_IO
Returns 1 if synchronized I/O is supported, otherwise 0.
+.It Dv _PC_TIMESTAMP_RESOLUTION
+The resolution in nanoseconds of file timestamps.
.El
.Sh RETURN VALUES
If the call to
diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c
index c0c16032058..90351762669 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.58 2013/03/28 02:08:39 guenther Exp $ */
+/* $OpenBSD: cd9660_vnops.c,v 1.59 2013/03/28 03:29:44 guenther Exp $ */
/* $NetBSD: cd9660_vnops.c,v 1.42 1997/10/16 23:56:57 christos Exp $ */
/*-
@@ -882,6 +882,9 @@ cd9660_pathconf(void *v)
case _PC_NO_TRUNC:
*ap->a_retval = 1;
break;
+ case _PC_TIMESTAMP_RESOLUTION:
+ *ap->a_retval = 1000000000; /* one billion nanoseconds */
+ break;
default:
error = EINVAL;
break;
diff --git a/sys/kern/spec_vnops.c b/sys/kern/spec_vnops.c
index 9c54d61ee7d..d92dd34210d 100644
--- a/sys/kern/spec_vnops.c
+++ b/sys/kern/spec_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spec_vnops.c,v 1.70 2013/03/28 02:08:39 guenther Exp $ */
+/* $OpenBSD: spec_vnops.c,v 1.71 2013/03/28 03:29:44 guenther Exp $ */
/* $NetBSD: spec_vnops.c,v 1.29 1996/04/22 01:42:38 christos Exp $ */
/*
@@ -623,6 +623,9 @@ spec_pathconf(void *v)
case _PC_VDISABLE:
*ap->a_retval = _POSIX_VDISABLE;
break;
+ case _PC_TIMESTAMP_RESOLUTION:
+ *ap->a_retval = 1;
+ break;
default:
error = EINVAL;
break;
diff --git a/sys/miscfs/fifofs/fifo_vnops.c b/sys/miscfs/fifofs/fifo_vnops.c
index d52795d8732..c6995b89379 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.38 2013/03/28 02:08:39 guenther Exp $ */
+/* $OpenBSD: fifo_vnops.c,v 1.39 2013/03/28 03:29:44 guenther Exp $ */
/* $NetBSD: fifo_vnops.c,v 1.18 1996/03/16 23:52:42 christos Exp $ */
/*
@@ -417,6 +417,9 @@ fifo_pathconf(void *v)
case _PC_CHOWN_RESTRICTED:
*ap->a_retval = 1;
break;
+ case _PC_TIMESTAMP_RESOLUTION:
+ *ap->a_retval = 1;
+ break;
default:
error = EINVAL;
break;
diff --git a/sys/msdosfs/msdosfs_vnops.c b/sys/msdosfs/msdosfs_vnops.c
index 74e8d1a7704..805db9e2309 100644
--- a/sys/msdosfs/msdosfs_vnops.c
+++ b/sys/msdosfs/msdosfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msdosfs_vnops.c,v 1.84 2013/03/28 02:08:39 guenther Exp $ */
+/* $OpenBSD: msdosfs_vnops.c,v 1.85 2013/03/28 03:29:44 guenther Exp $ */
/* $NetBSD: msdosfs_vnops.c,v 1.63 1997/10/17 11:24:19 ws Exp $ */
/*-
@@ -1888,6 +1888,9 @@ msdosfs_pathconf(void *v)
case _PC_NO_TRUNC:
*ap->a_retval = 0;
break;
+ case _PC_TIMESTAMP_RESOLUTION:
+ *ap->a_retval = 2000000000; /* 2 billion nanoseconds */
+ break;
default:
error = EINVAL;
break;
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c
index 24b0c78d7c6..af217384554 100644
--- a/sys/nfs/nfs_vnops.c
+++ b/sys/nfs/nfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_vnops.c,v 1.143 2013/03/28 02:27:27 tedu Exp $ */
+/* $OpenBSD: nfs_vnops.c,v 1.144 2013/03/28 03:29:44 guenther Exp $ */
/* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */
/*
@@ -2987,6 +2987,9 @@ nfs_pathconf(void *v)
case _PC_2_SYMLINKS:
*ap->a_retval = 1;
break;
+ case _PC_TIMESTAMP_RESOLUTION:
+ *ap->a_retval = NFS_ISV3(ap->a_vp) ? 1 : 1000;
+ break;
default:
error = EINVAL;
break;
diff --git a/sys/sys/unistd.h b/sys/sys/unistd.h
index ee35db7e48c..ac174567cdd 100644
--- a/sys/sys/unistd.h
+++ b/sys/sys/unistd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: unistd.h,v 1.27 2013/03/28 02:08:39 guenther Exp $ */
+/* $OpenBSD: unistd.h,v 1.28 2013/03/28 03:29:44 guenther Exp $ */
/* $NetBSD: unistd.h,v 1.10 1994/06/29 06:46:06 cgd Exp $ */
/*
@@ -80,25 +80,26 @@ struct __tfork51 {
/* the pathconf(2) variable values are part of the ABI */
/* configurable pathname variables */
-#define _PC_LINK_MAX 1
-#define _PC_MAX_CANON 2
-#define _PC_MAX_INPUT 3
-#define _PC_NAME_MAX 4
-#define _PC_PATH_MAX 5
-#define _PC_PIPE_BUF 6
-#define _PC_CHOWN_RESTRICTED 7
-#define _PC_NO_TRUNC 8
-#define _PC_VDISABLE 9
-#define _PC_2_SYMLINKS 10
-#define _PC_ALLOC_SIZE_MIN 11
-#define _PC_ASYNC_IO 12
-#define _PC_FILESIZEBITS 13
-#define _PC_PRIO_IO 14
-#define _PC_REC_INCR_XFER_SIZE 15
-#define _PC_REC_MAX_XFER_SIZE 16
-#define _PC_REC_MIN_XFER_SIZE 17
-#define _PC_REC_XFER_ALIGN 18
-#define _PC_SYMLINK_MAX 19
-#define _PC_SYNC_IO 20
+#define _PC_LINK_MAX 1
+#define _PC_MAX_CANON 2
+#define _PC_MAX_INPUT 3
+#define _PC_NAME_MAX 4
+#define _PC_PATH_MAX 5
+#define _PC_PIPE_BUF 6
+#define _PC_CHOWN_RESTRICTED 7
+#define _PC_NO_TRUNC 8
+#define _PC_VDISABLE 9
+#define _PC_2_SYMLINKS 10
+#define _PC_ALLOC_SIZE_MIN 11
+#define _PC_ASYNC_IO 12
+#define _PC_FILESIZEBITS 13
+#define _PC_PRIO_IO 14
+#define _PC_REC_INCR_XFER_SIZE 15
+#define _PC_REC_MAX_XFER_SIZE 16
+#define _PC_REC_MIN_XFER_SIZE 17
+#define _PC_REC_XFER_ALIGN 18
+#define _PC_SYMLINK_MAX 19
+#define _PC_SYNC_IO 20
+#define _PC_TIMESTAMP_RESOLUTION 21
#endif /* !_SYS_UNISTD_H_ */
diff --git a/sys/ufs/ext2fs/ext2fs_extern.h b/sys/ufs/ext2fs/ext2fs_extern.h
index 8edd0c47eeb..b44b57b743b 100644
--- a/sys/ufs/ext2fs/ext2fs_extern.h
+++ b/sys/ufs/ext2fs/ext2fs_extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_extern.h,v 1.29 2010/12/21 20:14:44 thib Exp $ */
+/* $OpenBSD: ext2fs_extern.h,v 1.30 2013/03/28 03:29:44 guenther Exp $ */
/* $NetBSD: ext2fs_extern.h,v 1.1 1997/06/11 09:33:55 bouyer Exp $ */
/*-
@@ -140,6 +140,7 @@ int ext2fs_mkdir(void *);
int ext2fs_rmdir(void *);
int ext2fs_symlink(void *);
int ext2fs_readlink(void *);
+int ext2fs_pathconf(void *);
int ext2fs_advlock(void *);
int ext2fs_makeinode(int, struct vnode *, struct vnode **,
struct componentname *cnp);
diff --git a/sys/ufs/ext2fs/ext2fs_vnops.c b/sys/ufs/ext2fs/ext2fs_vnops.c
index c320d7c7096..65370bfc7e9 100644
--- a/sys/ufs/ext2fs/ext2fs_vnops.c
+++ b/sys/ufs/ext2fs/ext2fs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_vnops.c,v 1.61 2011/07/04 20:35:35 deraadt Exp $ */
+/* $OpenBSD: ext2fs_vnops.c,v 1.62 2013/03/28 03:29:44 guenther Exp $ */
/* $NetBSD: ext2fs_vnops.c,v 1.1 1997/06/11 09:34:09 bouyer Exp $ */
/*
@@ -1121,6 +1121,26 @@ ext2fs_readlink(void *v)
}
/*
+ * Return POSIX pathconf information applicable to ext2 filesystems.
+ */
+int
+ext2fs_pathconf(void *v)
+{
+ struct vop_pathconf_args *ap = v;
+ int error = 0;
+
+ switch (ap->a_name) {
+ case _PC_TIMESTAMP_RESOLUTION:
+ *ap->a_retval = 1000000000; /* 1 billion nanoseconds */
+ break;
+ default:
+ return (ufs_pathconf(v));
+ }
+
+ return (error);
+}
+
+/*
* Advisory record locking support
*/
int
@@ -1286,7 +1306,7 @@ struct vops ext2fs_vops = {
.vop_strategy = ufs_strategy,
.vop_print = ufs_print,
.vop_islocked = ufs_islocked,
- .vop_pathconf = ufs_pathconf,
+ .vop_pathconf = ext2fs_pathconf,
.vop_advlock = ext2fs_advlock,
.vop_bwrite = vop_generic_bwrite
};
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index 2f35cc6b20c..e321b2e94f0 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.105 2013/03/28 02:08:39 guenther Exp $ */
+/* $OpenBSD: ufs_vnops.c,v 1.106 2013/03/28 03:29:44 guenther Exp $ */
/* $NetBSD: ufs_vnops.c,v 1.18 1996/05/11 18:28:04 mycroft Exp $ */
/*
@@ -1755,6 +1755,9 @@ ufs_pathconf(void *v)
case _PC_2_SYMLINKS:
*ap->a_retval = 1;
break;
+ case _PC_TIMESTAMP_RESOLUTION:
+ *ap->a_retval = 1;
+ break;
default:
error = EINVAL;
break;
diff --git a/usr.bin/getconf/getconf.c b/usr.bin/getconf/getconf.c
index c2a5378ecb4..b4593c705e2 100644
--- a/usr.bin/getconf/getconf.c
+++ b/usr.bin/getconf/getconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getconf.c,v 1.15 2013/03/07 08:54:53 guenther Exp $ */
+/* $OpenBSD: getconf.c,v 1.16 2013/03/28 03:29:45 guenther Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -287,7 +287,7 @@ const struct conf_variable uposix_conf_table[] =
pathconf_row(ASYNC_IO)
pathconf_row(PRIO_IO)
pathconf_row(SYNC_IO)
- /*pathconf_row(TIMESTAMP_RESOLUTION)*/
+ pathconf_row(TIMESTAMP_RESOLUTION)
{ NULL }
};