Per IEEE Std 1003.1b-1993, implement the fdatasync() system call which is

identical to fsync() with the expecption of not being required to synchronize
file status information.
This commit is contained in:
kleink 1998-06-05 20:31:36 +00:00
parent 70dae9bb3a
commit e9d6f5e996
2 changed files with 29 additions and 3 deletions

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.75 1998/05/30 22:21:03 kleink Exp $
$NetBSD: syscalls.master,v 1.76 1998/06/05 20:31:36 kleink Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@ -476,7 +476,7 @@
;
240 STD { int sys_nanosleep(const struct timespec *rqtp, \
struct timespec *rmtp); }
241 UNIMPL fktrace
241 STD { int sys_fdatasync(int fd); }
242 UNIMPL
243 UNIMPL
244 UNIMPL

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs_syscalls.c,v 1.116 1998/06/05 20:04:15 kleink Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.117 1998/06/05 20:31:36 kleink Exp $ */
/*
* Copyright (c) 1989, 1993
@ -2014,6 +2014,32 @@ sys_fsync(p, v, retval)
return (error);
}
/*
* Sync the data of an open file.
*/
/* ARGSUSED */
int
sys_fdatasync(p, v, retval)
struct proc *p;
void *v;
register_t *retval;
{
struct sys_fdatasync_args /* {
syscallarg(int) fd;
} */ *uap = v;
struct vnode *vp;
struct file *fp;
int error;
if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0)
return (error);
vp = (struct vnode *)fp->f_data;
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
error = VOP_FSYNC(vp, fp->f_cred, FSYNC_WAIT|FSYNC_DATAONLY, p);
VOP_UNLOCK(vp, 0);
return (error);
}
/*
* Rename files, (standard) BSD semantics frontend.
*/