@@ -1,4 +1,4 @@
-.\" $NetBSD: fdatasync.2,v 1.16 2008/04/30 13:10:51 martin Exp $
+.\" $NetBSD: fdatasync.2,v 1.16.56.1 2020/04/22 18:18:26 martin Exp $
.\"
.\" Copyright (c) 1998 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -68,7 +68,7 @@
.It Bq Er EBADF
The
.Fa fd
-argument is not a valid file descriptor open for writing.
+argument is not a valid file descriptor.
.It Bq Er EINVAL
This implementation does not support synchronized I/O for this file.
.It Bq Er ENOSYS
@@ -93,4 +93,4 @@
The
.Fn fdatasync
function conforms to
-.St -p1003.1b-93 .
+.St -p1003.1-2008 .
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_syscalls.c,v 1.516 2017/06/01 02:45:13 chs Exp $ */
+/* $NetBSD: vfs_syscalls.c,v 1.516.2.1 2020/04/22 18:18:26 martin Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.516 2017/06/01 02:45:13 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.516.2.1 2020/04/22 18:18:26 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_fileassoc.h"
@@ -4004,8 +4004,7 @@
* Sync a range of file data. API modeled after that found in AIX.
*
* FDATASYNC indicates that we need only save enough metadata to be able
- * to re-read the written data. Note we duplicate AIX's requirement that
- * the file be open for writing.
+ * to re-read the written data.
*/
/* ARGSUSED */
int
@@ -4086,10 +4085,6 @@
/* fd_getvnode() will use the descriptor for us */
if ((error = fd_getvnode(SCARG(uap, fd), &fp)) != 0)
return (error);
- if ((fp->f_flag & FWRITE) == 0) {
- fd_putfile(SCARG(uap, fd));
- return (EBADF);
- }
vp = fp->f_vnode;
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
error = VOP_FSYNC(vp, fp->f_cred, FSYNC_WAIT|FSYNC_DATAONLY, 0, 0);