diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 433f6820f245..376ab40b4663 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -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 diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index ff3a7486b5c1..3d5cbb4e6b1f 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -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. */