MFC r283492:
Implement Linux specific syncfs() system call.
This commit is contained in:
parent
5835d4a5eb
commit
ddaf8065bb
@ -113,7 +113,6 @@ DUMMY(fanotify_mark);
|
|||||||
DUMMY(name_to_handle_at);
|
DUMMY(name_to_handle_at);
|
||||||
DUMMY(open_by_handle_at);
|
DUMMY(open_by_handle_at);
|
||||||
DUMMY(clock_adjtime);
|
DUMMY(clock_adjtime);
|
||||||
DUMMY(syncfs);
|
|
||||||
DUMMY(setns);
|
DUMMY(setns);
|
||||||
DUMMY(process_vm_readv);
|
DUMMY(process_vm_readv);
|
||||||
DUMMY(process_vm_writev);
|
DUMMY(process_vm_writev);
|
||||||
|
@ -502,7 +502,7 @@
|
|||||||
303 AUE_NULL STD { int linux_name_to_handle_at(void); }
|
303 AUE_NULL STD { int linux_name_to_handle_at(void); }
|
||||||
304 AUE_NULL STD { int linux_open_by_handle_at(void); }
|
304 AUE_NULL STD { int linux_open_by_handle_at(void); }
|
||||||
305 AUE_NULL STD { int linux_clock_adjtime(void); }
|
305 AUE_NULL STD { int linux_clock_adjtime(void); }
|
||||||
306 AUE_NULL STD { int linux_syncfs(void); }
|
306 AUE_SYNC STD { int linux_syncfs(l_int fd); }
|
||||||
307 AUE_NULL STD { int linux_sendmmsg(l_int s, \
|
307 AUE_NULL STD { int linux_sendmmsg(l_int s, \
|
||||||
struct l_mmsghdr *msg, l_uint vlen, \
|
struct l_mmsghdr *msg, l_uint vlen, \
|
||||||
l_uint flags); }
|
l_uint flags); }
|
||||||
|
@ -125,7 +125,6 @@ DUMMY(fanotify_mark);
|
|||||||
DUMMY(name_to_handle_at);
|
DUMMY(name_to_handle_at);
|
||||||
DUMMY(open_by_handle_at);
|
DUMMY(open_by_handle_at);
|
||||||
DUMMY(clock_adjtime);
|
DUMMY(clock_adjtime);
|
||||||
DUMMY(syncfs);
|
|
||||||
DUMMY(setns);
|
DUMMY(setns);
|
||||||
DUMMY(process_vm_readv);
|
DUMMY(process_vm_readv);
|
||||||
DUMMY(process_vm_writev);
|
DUMMY(process_vm_writev);
|
||||||
|
@ -573,7 +573,7 @@
|
|||||||
341 AUE_NULL STD { int linux_name_to_handle_at(void); }
|
341 AUE_NULL STD { int linux_name_to_handle_at(void); }
|
||||||
342 AUE_NULL STD { int linux_open_by_handle_at(void); }
|
342 AUE_NULL STD { int linux_open_by_handle_at(void); }
|
||||||
343 AUE_NULL STD { int linux_clock_adjtime(void); }
|
343 AUE_NULL STD { int linux_clock_adjtime(void); }
|
||||||
344 AUE_NULL STD { int linux_syncfs(void); }
|
344 AUE_SYNC STD { int linux_syncfs(l_int fd); }
|
||||||
345 AUE_NULL STD { int linux_sendmmsg(l_int s, \
|
345 AUE_NULL STD { int linux_sendmmsg(l_int s, \
|
||||||
struct l_mmsghdr *msg, l_uint vlen, \
|
struct l_mmsghdr *msg, l_uint vlen, \
|
||||||
l_uint flags); }
|
l_uint flags); }
|
||||||
|
@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include "opt_compat.h"
|
#include "opt_compat.h"
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
#include <sys/capsicum.h>
|
||||||
#include <sys/dirent.h>
|
#include <sys/dirent.h>
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#include <sys/filedesc.h>
|
#include <sys/filedesc.h>
|
||||||
@ -653,3 +654,43 @@ linux_newfstatat(struct thread *td, struct linux_newfstatat_args *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
|
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
|
||||||
|
|
||||||
|
int
|
||||||
|
linux_syncfs(struct thread *td, struct linux_syncfs_args *args)
|
||||||
|
{
|
||||||
|
cap_rights_t rights;
|
||||||
|
struct mount *mp;
|
||||||
|
struct vnode *vp;
|
||||||
|
int error, save;
|
||||||
|
|
||||||
|
error = fgetvp(td, args->fd, cap_rights_init(&rights, CAP_FSYNC), &vp);
|
||||||
|
if (error != 0)
|
||||||
|
/*
|
||||||
|
* Linux syncfs() returns only EBADF, however fgetvp()
|
||||||
|
* can return EINVAL in case of file descriptor does
|
||||||
|
* not represent a vnode. XXX.
|
||||||
|
*/
|
||||||
|
return (error);
|
||||||
|
|
||||||
|
mp = vp->v_mount;
|
||||||
|
mtx_lock(&mountlist_mtx);
|
||||||
|
error = vfs_busy(mp, MBF_MNTLSTLOCK);
|
||||||
|
if (error != 0) {
|
||||||
|
/* See comment above. */
|
||||||
|
mtx_unlock(&mountlist_mtx);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
if ((mp->mnt_flag & MNT_RDONLY) == 0 &&
|
||||||
|
vn_start_write(NULL, &mp, V_NOWAIT) == 0) {
|
||||||
|
save = curthread_pflags_set(TDP_SYNCIO);
|
||||||
|
vfs_msync(mp, MNT_NOWAIT);
|
||||||
|
VFS_SYNC(mp, MNT_NOWAIT);
|
||||||
|
curthread_pflags_restore(save);
|
||||||
|
vn_finished_write(mp);
|
||||||
|
}
|
||||||
|
vfs_unbusy(mp);
|
||||||
|
|
||||||
|
out:
|
||||||
|
vrele(vp);
|
||||||
|
return (error);
|
||||||
|
}
|
||||||
|
@ -121,7 +121,6 @@ DUMMY(fanotify_mark);
|
|||||||
DUMMY(name_to_handle_at);
|
DUMMY(name_to_handle_at);
|
||||||
DUMMY(open_by_handle_at);
|
DUMMY(open_by_handle_at);
|
||||||
DUMMY(clock_adjtime);
|
DUMMY(clock_adjtime);
|
||||||
DUMMY(syncfs);
|
|
||||||
DUMMY(setns);
|
DUMMY(setns);
|
||||||
DUMMY(process_vm_readv);
|
DUMMY(process_vm_readv);
|
||||||
DUMMY(process_vm_writev);
|
DUMMY(process_vm_writev);
|
||||||
|
@ -581,7 +581,7 @@
|
|||||||
341 AUE_NULL STD { int linux_name_to_handle_at(void); }
|
341 AUE_NULL STD { int linux_name_to_handle_at(void); }
|
||||||
342 AUE_NULL STD { int linux_open_by_handle_at(void); }
|
342 AUE_NULL STD { int linux_open_by_handle_at(void); }
|
||||||
343 AUE_NULL STD { int linux_clock_adjtime(void); }
|
343 AUE_NULL STD { int linux_clock_adjtime(void); }
|
||||||
344 AUE_NULL STD { int linux_syncfs(void); }
|
344 AUE_SYNC STD { int linux_syncfs(l_int fd); }
|
||||||
345 AUE_NULL STD { int linux_sendmmsg(l_int s, \
|
345 AUE_NULL STD { int linux_sendmmsg(l_int s, \
|
||||||
struct l_mmsghdr *msg, l_uint vlen, \
|
struct l_mmsghdr *msg, l_uint vlen, \
|
||||||
l_uint flags); }
|
l_uint flags); }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user