1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-04 23:35:36 -08:00

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@
This commit is contained in:
guenther 2013-03-28 03:29:44 +00:00
parent 17f3788af0
commit d4648cd609
11 changed files with 76 additions and 34 deletions

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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_ */

View File

@ -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);

View File

@ -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 $ */
/*
@ -1120,6 +1120,26 @@ ext2fs_readlink(void *v)
return (VOP_READ(vp, ap->a_uio, 0, ap->a_cred));
}
/*
* 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
*/
@ -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
};

View File

@ -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;

View File

@ -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 }
};