git: 7273d80ba18c - main - vfs_syscalls.c: add kern_ and user_ implementations

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Thu, 12 Nov 2026 10:23:48 UTC
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=7273d80ba18c4af0cc6f9ec6c953e2b0bab263d7

commit 7273d80ba18c4af0cc6f9ec6c953e2b0bab263d7
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2026-11-12 10:23:23 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2026-11-12 10:23:23 +0000

    vfs_syscalls.c: add kern_ and user_ implementations
    
    Effort:         CHERI upstreaming
    Sponsored by:   Innovate UK
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/2284
---
 sys/kern/vfs_syscalls.c | 180 +++++++++++++++++++++++++++++++++---------------
 sys/sys/syscallsubr.h   |  33 ++++++++-
 2 files changed, 153 insertions(+), 60 deletions(-)

diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 308c1c0297df..472abac6bb97 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -89,8 +89,6 @@
 
 MALLOC_DEFINE(M_FADVISE, "fadvise", "posix_fadvise(2) information");
 
-static int kern_chflagsat(struct thread *td, int fd, const char *path,
-    enum uio_seg pathseg, u_long flags, int atflag);
 static int setfflags(struct thread *td, struct vnode *, u_long);
 static int getutimes(const struct timeval *, enum uio_seg, struct timespec *);
 static int getutimens(const struct timespec *, enum uio_seg,
@@ -99,8 +97,6 @@ static int setutimes(struct thread *td, struct vnode *,
     const struct timespec *, int, int);
 static int vn_access(struct vnode *vp, int user_flags, struct ucred *cred,
     struct thread *td);
-static int kern_fhlinkat(struct thread *td, int fd, const char *path,
-    enum uio_seg pathseg, fhandle_t *fhp);
 static int kern_readlink_vp(struct vnode *vp, char *buf, enum uio_seg bufseg,
     size_t count, struct thread *td);
 static int kern_linkat_vp(struct thread *td, struct vnode *vp, int fd,
@@ -187,18 +183,24 @@ struct quotactl_args {
 #endif
 int
 sys_quotactl(struct thread *td, struct quotactl_args *uap)
+{
+	return (kern_quotactl(td, uap->path, uap->cmd, uap->uid, uap->arg));
+}
+
+int
+kern_quotactl(struct thread *td, const char *path, int cmd, int uid, void *arg)
 {
 	struct mount *mp;
 	struct nameidata nd;
 	int error;
 	bool mp_busy;
 
-	AUDIT_ARG_CMD(uap->cmd);
-	AUDIT_ARG_UID(uap->uid);
+	AUDIT_ARG_CMD(cmd);
+	AUDIT_ARG_UID(uid);
 	if (!prison_allow(td->td_ucred, PR_ALLOW_QUOTAS))
 		return (EPERM);
 	NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, UIO_USERSPACE,
-	    uap->path);
+	    path);
 	if ((error = namei(&nd)) != 0)
 		return (error);
 	NDFREE_PNBUF(&nd);
@@ -211,7 +213,7 @@ sys_quotactl(struct thread *td, struct quotactl_args *uap)
 		return (error);
 	}
 	mp_busy = true;
-	error = VFS_QUOTACTL(mp, uap->cmd, uap->uid, uap->arg, &mp_busy);
+	error = VFS_QUOTACTL(mp, cmd, uid, arg, &mp_busy);
 
 	/*
 	 * Since quota on/off operations typically need to open quota
@@ -308,14 +310,20 @@ struct statfs_args {
 #endif
 int
 sys_statfs(struct thread *td, struct statfs_args *uap)
+{
+	return (user_statfs(td, uap->path, uap->buf));
+}
+
+int
+user_statfs(struct thread *td, const char *path, struct statfs *buf)
 {
 	struct statfs *sfp;
 	int error;
 
 	sfp = malloc(sizeof(struct statfs), M_STATFS, M_WAITOK);
-	error = kern_statfs(td, uap->path, UIO_USERSPACE, sfp);
+	error = kern_statfs(td, path, UIO_USERSPACE, sfp);
 	if (error == 0)
-		error = copyout(sfp, uap->buf, sizeof(struct statfs));
+		error = copyout(sfp, buf, sizeof(struct statfs));
 	free(sfp, M_STATFS);
 	return (error);
 }
@@ -349,14 +357,20 @@ struct fstatfs_args {
 #endif
 int
 sys_fstatfs(struct thread *td, struct fstatfs_args *uap)
+{
+	return (user_fstatfs(td, uap->fd, uap->buf));
+}
+
+int
+user_fstatfs(struct thread *td, int fd, struct statfs *buf)
 {
 	struct statfs *sfp;
 	int error;
 
 	sfp = malloc(sizeof(struct statfs), M_STATFS, M_WAITOK);
-	error = kern_fstatfs(td, uap->fd, sfp);
+	error = kern_fstatfs(td, fd, sfp);
 	if (error == 0)
-		error = copyout(sfp, uap->buf, sizeof(struct statfs));
+		error = copyout(sfp, buf, sizeof(struct statfs));
 	free(sfp, M_STATFS);
 	return (error);
 }
@@ -398,14 +412,19 @@ struct getfsstat_args {
 #endif
 int
 sys_getfsstat(struct thread *td, struct getfsstat_args *uap)
+{
+	return (user_getfsstat(td, uap->buf, uap->bufsize, uap->mode));
+}
+
+int
+user_getfsstat(struct thread *td, struct statfs *buf, long bufsize, int mode)
 {
 	size_t count;
 	int error;
 
-	if (uap->bufsize < 0 || uap->bufsize > SIZE_MAX)
+	if (bufsize < 0 || bufsize > SIZE_MAX)
 		return (EINVAL);
-	error = kern_getfsstat(td, &uap->buf, uap->bufsize, &count,
-	    UIO_USERSPACE, uap->mode);
+	error = kern_getfsstat(td, &buf, bufsize, &count, UIO_USERSPACE, mode);
 	if (error == 0)
 		td->td_retval[0] = count;
 	return (error);
@@ -1040,12 +1059,18 @@ struct chroot_args {
 #endif
 int
 sys_chroot(struct thread *td, struct chroot_args *uap)
+{
+	return (user_chroot(td, uap->path));
+}
+
+int
+user_chroot(struct thread *td, const char *path)
 {
 	struct nameidata nd;
 	int error;
 
 	NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1,
-	    UIO_USERSPACE, uap->path);
+	    UIO_USERSPACE, path);
 	error = namei(&nd);
 	if (error != 0)
 		return (error);
@@ -1936,6 +1961,12 @@ struct undelete_args {
 #endif
 int
 sys_undelete(struct thread *td, struct undelete_args *uap)
+{
+	return (kern_undelete(td, uap->path, UIO_USERSPACE));
+}
+
+int
+kern_undelete(struct thread *td, const char *path, enum uio_seg pathseg)
 {
 	struct mount *mp;
 	struct nameidata nd;
@@ -1945,7 +1976,7 @@ sys_undelete(struct thread *td, struct undelete_args *uap)
 restart:
 	bwillwrite();
 	NDINIT(&nd, DELETE, LOCKPARENT | DOWHITEOUT | AUDITVNODE1,
-	    UIO_USERSPACE, uap->path);
+	    UIO_USERSPACE, path);
 	error = namei(&nd);
 	if (error != 0)
 		return (error);
@@ -1987,16 +2018,14 @@ struct unlink_args {
 int
 sys_unlink(struct thread *td, struct unlink_args *uap)
 {
-
 	return (kern_funlinkat(td, AT_FDCWD, uap->path, FD_NONE, UIO_USERSPACE,
 	    0, 0));
 }
 
-static int
+int
 kern_funlinkat_ex(struct thread *td, int dfd, const char *path, int fd,
     int flags, enum uio_seg pathseg, ino_t oldinum)
 {
-
 	if ((flags & ~(AT_REMOVEDIR | AT_RESOLVE_BENEATH)) != 0)
 		return (EINVAL);
 
@@ -2142,7 +2171,6 @@ struct lseek_args {
 int
 sys_lseek(struct thread *td, struct lseek_args *uap)
 {
-
 	return (kern_lseek(td, uap->fd, uap->offset, uap->whence));
 }
 
@@ -2176,7 +2204,6 @@ struct olseek_args {
 int
 olseek(struct thread *td, struct olseek_args *uap)
 {
-
 	return (kern_lseek(td, uap->fd, uap->offset, uap->whence));
 }
 #endif /* COMPAT_43 */
@@ -2186,7 +2213,6 @@ olseek(struct thread *td, struct olseek_args *uap)
 int
 freebsd6_lseek(struct thread *td, struct freebsd6_lseek_args *uap)
 {
-
 	return (kern_lseek(td, uap->fd, uap->offset, uap->whence));
 }
 #endif
@@ -2234,7 +2260,6 @@ struct access_args {
 int
 sys_access(struct thread *td, struct access_args *uap)
 {
-
 	return (kern_accessat(td, AT_FDCWD, uap->path, UIO_USERSPACE,
 	    0, uap->amode));
 }
@@ -2250,7 +2275,6 @@ struct faccessat_args {
 int
 sys_faccessat(struct thread *td, struct faccessat_args *uap)
 {
-
 	return (kern_accessat(td, uap->fd, uap->path, UIO_USERSPACE, uap->flag,
 	    uap->amode));
 }
@@ -2556,14 +2580,20 @@ struct fstatat_args {
 #endif
 int
 sys_fstatat(struct thread *td, struct fstatat_args *uap)
+{
+	return (user_fstatat(td, uap->fd, uap->path, uap->buf, uap->flag));
+}
+
+int
+user_fstatat(struct thread *td, int fd, const char *path, struct stat *buf,
+    int flag)
 {
 	struct stat sb;
 	int error;
 
-	error = kern_statat(td, uap->flag, uap->fd, uap->path,
-	    UIO_USERSPACE, &sb);
+	error = kern_statat(td, flag, fd, path, UIO_USERSPACE, &sb);
 	if (error == 0)
-		error = copyout(&sb, uap->buf, sizeof (sb));
+		error = copyout(&sb, buf, sizeof(sb));
 	return (error);
 }
 
@@ -2893,7 +2923,6 @@ struct chflags_args {
 int
 sys_chflags(struct thread *td, struct chflags_args *uap)
 {
-
 	return (kern_chflagsat(td, AT_FDCWD, uap->path, UIO_USERSPACE,
 	    uap->flags, 0));
 }
@@ -2909,7 +2938,6 @@ struct chflagsat_args {
 int
 sys_chflagsat(struct thread *td, struct chflagsat_args *uap)
 {
-
 	return (kern_chflagsat(td, uap->fd, uap->path, UIO_USERSPACE,
 	    uap->flags, uap->atflag));
 }
@@ -2926,12 +2954,11 @@ struct lchflags_args {
 int
 sys_lchflags(struct thread *td, struct lchflags_args *uap)
 {
-
 	return (kern_chflagsat(td, AT_FDCWD, uap->path, UIO_USERSPACE,
 	    uap->flags, AT_SYMLINK_NOFOLLOW));
 }
 
-static int
+int
 kern_chflagsat(struct thread *td, int fd, const char *path,
     enum uio_seg pathseg, u_long flags, int atflag)
 {
@@ -4402,16 +4429,24 @@ freebsd11_getdents(struct thread *td, struct freebsd11_getdents_args *uap)
  */
 int
 sys_getdirentries(struct thread *td, struct getdirentries_args *uap)
+{
+	return (user_getdirentries(td, uap->fd, uap->buf, uap->count,
+	    uap->basep));
+}
+
+int
+user_getdirentries(struct thread *td, int fd, char *buf, size_t count,
+    off_t *basep)
 {
 	off_t base;
 	int error;
 
-	error = kern_getdirentries(td, uap->fd, uap->buf, uap->count, &base,
-	    NULL, UIO_USERSPACE);
+	error = kern_getdirentries(td, fd, buf, count, &base, NULL,
+	    UIO_USERSPACE);
 	if (error != 0)
 		return (error);
-	if (uap->basep != NULL)
-		error = copyout(&base, uap->basep, sizeof(off_t));
+	if (basep != NULL)
+		error = copyout(&base, basep, sizeof(off_t));
 	return (error);
 }
 
@@ -4534,6 +4569,12 @@ struct revoke_args {
 #endif
 int
 sys_revoke(struct thread *td, struct revoke_args *uap)
+{
+	return (kern_revoke(td, uap->path, UIO_USERSPACE));
+}
+
+int
+kern_revoke(struct thread *td, const char *path, enum uio_seg pathseg)
 {
 	struct vnode *vp;
 	struct vattr vattr;
@@ -4541,7 +4582,7 @@ sys_revoke(struct thread *td, struct revoke_args *uap)
 	int error;
 
 	NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, UIO_USERSPACE,
-	    uap->path);
+	    path);
 	if ((error = namei(&nd)) != 0)
 		return (error);
 	vp = nd.ni_vp;
@@ -4734,7 +4775,6 @@ struct fhlink_args {
 int
 sys_fhlink(struct thread *td, struct fhlink_args *uap)
 {
-
 	return (kern_fhlinkat(td, AT_FDCWD, uap->to, UIO_USERSPACE, uap->fhp));
 }
 
@@ -4748,11 +4788,10 @@ struct fhlinkat_args {
 int
 sys_fhlinkat(struct thread *td, struct fhlinkat_args *uap)
 {
-
 	return (kern_fhlinkat(td, uap->tofd, uap->to, UIO_USERSPACE, uap->fhp));
 }
 
-static int
+int
 kern_fhlinkat(struct thread *td, int fd, const char *path,
     enum uio_seg pathseg, fhandle_t *fhp)
 {
@@ -4790,6 +4829,12 @@ struct fhreadlink_args {
 #endif
 int
 sys_fhreadlink(struct thread *td, struct fhreadlink_args *uap)
+{
+	return (kern_fhreadlink(td, uap->fhp, uap->buf, uap->bufsize));
+}
+
+int
+kern_fhreadlink(struct thread *td, fhandle_t *fhp, char *buf, size_t bufsize)
 {
 	fhandle_t fh;
 	struct mount *mp;
@@ -4799,9 +4844,9 @@ sys_fhreadlink(struct thread *td, struct fhreadlink_args *uap)
 	error = priv_check(td, PRIV_VFS_GETFH);
 	if (error != 0)
 		return (error);
-	if (uap->bufsize > IOSIZE_MAX)
+	if (bufsize > IOSIZE_MAX)
 		return (EINVAL);
-	error = copyin(uap->fhp, &fh, sizeof(fh));
+	error = copyin(fhp, &fh, sizeof(fh));
 	if (error != 0)
 		return (error);
 	if ((mp = vfs_busyfs(&fh.fh_fsid)) == NULL)
@@ -4810,7 +4855,7 @@ sys_fhreadlink(struct thread *td, struct fhreadlink_args *uap)
 	vfs_unbusy(mp);
 	if (error != 0)
 		return (error);
-	error = kern_readlink_vp(vp, uap->buf, UIO_USERSPACE, uap->bufsize, td);
+	error = kern_readlink_vp(vp, buf, UIO_USERSPACE, bufsize, td);
 	vput(vp);
 	return (error);
 }
@@ -4930,17 +4975,23 @@ struct fhstat_args {
 #endif
 int
 sys_fhstat(struct thread *td, struct fhstat_args *uap)
+{
+	return (user_fhstat(td, uap->u_fhp, uap->sb));
+}
+
+int
+user_fhstat(struct thread *td, const struct fhandle *u_fhp, struct stat *usb)
 {
 	struct stat sb;
 	struct fhandle fh;
 	int error;
 
-	error = copyin(uap->u_fhp, &fh, sizeof(fh));
+	error = copyin(u_fhp, &fh, sizeof(fh));
 	if (error != 0)
 		return (error);
 	error = kern_fhstat(td, fh, &sb);
 	if (error == 0)
-		error = copyout(&sb, uap->sb, sizeof(sb));
+		error = copyout(&sb, usb, sizeof(sb));
 	return (error);
 }
 
@@ -4976,18 +5027,25 @@ struct fhstatfs_args {
 #endif
 int
 sys_fhstatfs(struct thread *td, struct fhstatfs_args *uap)
+{
+	return (user_fhstatfs(td, uap->u_fhp, uap->buf));
+}
+
+int
+user_fhstatfs(struct thread *td, const struct fhandle *u_fhp,
+    struct statfs *buf)
 {
 	struct statfs *sfp;
 	fhandle_t fh;
 	int error;
 
-	error = copyin(uap->u_fhp, &fh, sizeof(fhandle_t));
+	error = copyin(u_fhp, &fh, sizeof(fhandle_t));
 	if (error != 0)
 		return (error);
 	sfp = malloc(sizeof(struct statfs), M_STATFS, M_WAITOK);
 	error = kern_fhstatfs(td, fh, sfp);
 	if (error == 0)
-		error = copyout(sfp, uap->buf, sizeof(*sfp));
+		error = copyout(sfp, buf, sizeof(*sfp));
 	free(sfp, M_STATFS);
 	return (error);
 }
@@ -5333,28 +5391,36 @@ out:
 
 int
 sys_copy_file_range(struct thread *td, struct copy_file_range_args *uap)
+{
+	return (user_copy_file_range(td, uap->infd, uap->inoffp, uap->outfd,
+	    uap->outoffp, uap->len, uap->flags));
+}
+
+int
+user_copy_file_range(struct thread *td, int infd, off_t *uinoffp, int outfd,
+    off_t *uoutoffp, size_t len, unsigned int flags)
 {
 	off_t inoff, outoff, *inoffp, *outoffp;
 	int error;
 
 	inoffp = outoffp = NULL;
-	if (uap->inoffp != NULL) {
-		error = copyin(uap->inoffp, &inoff, sizeof(off_t));
+	if (uinoffp != NULL) {
+		error = copyin(uinoffp, &inoff, sizeof(off_t));
 		if (error != 0)
 			return (error);
 		inoffp = &inoff;
 	}
-	if (uap->outoffp != NULL) {
-		error = copyin(uap->outoffp, &outoff, sizeof(off_t));
+	if (uoutoffp != NULL) {
+		error = copyin(uoutoffp, &outoff, sizeof(off_t));
 		if (error != 0)
 			return (error);
 		outoffp = &outoff;
 	}
-	error = kern_copy_file_range(td, uap->infd, inoffp, uap->outfd,
-	    outoffp, uap->len, uap->flags);
-	if (error == 0 && uap->inoffp != NULL)
-		error = copyout(inoffp, uap->inoffp, sizeof(off_t));
-	if (error == 0 && uap->outoffp != NULL)
-		error = copyout(outoffp, uap->outoffp, sizeof(off_t));
+	error = kern_copy_file_range(td, infd, inoffp, outfd, outoffp, len,
+	    flags);
+	if (error == 0 && uinoffp != NULL)
+		error = copyout(inoffp, uinoffp, sizeof(off_t));
+	if (error == 0 && uoutoffp != NULL)
+		error = copyout(outoffp, uoutoffp, sizeof(off_t));
 	return (error);
 }
diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h
index c8da8dc8300d..364d36f5ff79 100644
--- a/sys/sys/syscallsubr.h
+++ b/sys/sys/syscallsubr.h
@@ -169,6 +169,8 @@ int	kern_cap_ioctls_limit(struct thread *td, int fd, u_long *cmds,
 	    size_t ncmds);
 int	kern_cap_rights_limit(struct thread *td, int fd, cap_rights_t *rights);
 int	kern_chdir(struct thread *td, const char *path, enum uio_seg pathseg);
+int	kern_chflagsat(struct thread *td, int fd, const char *path,
+	    enum uio_seg pathseg, u_long flags, int atflag);
 int	kern_clock_getcpuclockid2(struct thread *td, id_t id, int which,
 	    clockid_t *clk_id);
 int	kern_clock_getres(struct thread *td, clockid_t clock_id,
@@ -250,7 +252,11 @@ int	kern_ffclock_getestimate(struct thread *td,
 	    struct ffclock_estimate *ucest);
 int	kern_ffclock_setestimate(struct thread *td,
 	    const struct ffclock_estimate *ucest);
+int	kern_fhlinkat(struct thread *td, int fd, const char *path,
+	    enum uio_seg pathseg, fhandle_t *fhp);
 int	kern_fhopen(struct thread *td, const struct fhandle *u_fhp, int flags);
+int	kern_fhreadlink(struct thread *td, fhandle_t *fhp, char *buf,
+	    size_t bufsize);
 int	kern_fhstat(struct thread *td, fhandle_t fh, struct stat *buf);
 int	kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf);
 int	kern_filewrite(struct thread *td, int fd, struct file *fp,
@@ -266,6 +272,8 @@ int	kern_fsync(struct thread *td, int fd, bool fullsync);
 int	kern_ftruncate(struct thread *td, int fd, off_t length);
 int	kern_funlinkat(struct thread *td, int dfd, const char *path, int fd,
 	    enum uio_seg pathseg, int flag, ino_t oldinum);
+int	kern_funlinkat_ex(struct thread *td, int dfd, const char *path,
+	    int fd, int flag, enum uio_seg pathseg, ino_t oldinum);
 int	kern_futimes(struct thread *td, int fd, const struct timeval *tptr,
 	    enum uio_seg tptrseg);
 int	kern_futimens(struct thread *td, int fd, const struct timespec *tptr,
@@ -427,6 +435,8 @@ int	kern_ptrace(struct thread *td, int req, pid_t pid, void *addr,
 int	kern_pwrite(struct thread *td, int fd, const void *buf, size_t nbyte,
 	    off_t offset);
 int	kern_pwritev(struct thread *td, int fd, struct uio *auio, off_t offset);
+int	kern_quotactl(struct thread *td, const char *path, int cmd, int uid,
+	    void *arg);
 int	kern_rctl_add_rule(struct thread *td, const void *inbufp,
 	    size_t inbuflen);
 int	kern_rctl_get_limits(struct thread *td, const void *inbufp,
@@ -446,6 +456,7 @@ int	kern_recvit(struct thread *td, int s, struct msghdr *mp,
 	    enum uio_seg fromseg, struct mbuf **controlp);
 int	kern_renameat(struct thread *td, int fromfd, const char *from,
 	    int tofd, const char *to, enum uio_seg pathseg, u_int flags);
+int	kern_revoke(struct thread *td, const char *path, enum uio_seg pathseg);
 int	kern_rtprio(struct thread *td, int function, pid_t pid,
 	    struct rtprio *urtp);
 int	kern_rtprio_thread(struct thread *td, int function, lwpid_t lwpid,
@@ -549,6 +560,8 @@ int	kern_timerfd_settime(struct thread *td, int fd, int flags,
 	    const struct itimerspec *new_value, struct itimerspec *old_value);
 int	kern_truncate(struct thread *td, const char *path,
 	    enum uio_seg pathseg, off_t length);
+int	kern_undelete(struct thread *td, const char *path,
+	    enum uio_seg pathseg);
 int	kern_utimesat(struct thread *td, int fd, const char *path,
 	    enum uio_seg pathseg, const struct timeval *tptr,
 	    enum uio_seg tptrseg);
@@ -579,11 +592,13 @@ int	user_bindat(struct thread *td, int fd, int s,
 int	user_cap_ioctls_limit(struct thread *td, int fd, const u_long *ucmds,
 	    size_t ncmds);
 int	user_cap_rights_limit(struct thread *td, int fd, cap_rights_t *rightsp);
-int	user_clock_nanosleep(struct thread *td, clockid_t clock_id,
-	    int flags, const struct timespec *ua_rqtp,
-	    struct timespec *ua_rmtp);
+int	user_chroot(struct thread *td, const char *path);
+int	user_clock_nanosleep(struct thread *td, clockid_t clock_id, int flags,
+	    const struct timespec *ua_rqtp, struct timespec *ua_rmtp);
 int	user_connectat(struct thread *td, int fd, int s,
 	    const struct sockaddr *name, socklen_t namelen);
+int	user_copy_file_range(struct thread *td, int infd, off_t *uinoffp,
+	    int outfd, off_t *uoutoffp, size_t len, unsigned int flags);
 int	user_cpuset_getaffinity(struct thread *td, cpulevel_t level,
 	    cpuwhich_t which, id_t id, size_t cpusetsize, cpuset_t *maskp,
 	    const struct cpuset_copy_cb *cb);
@@ -608,10 +623,21 @@ int	user_extattr_set_fd(struct thread *td, int fd, int attrnamespace,
 int	user_extattr_set_path(struct thread *td, const char *path,
 	    int attrnamespace, const char *attrname, void *data,
 	    size_t nbytes, int follow);
+int	user_fhstat(struct thread *td, const struct fhandle *u_fhp,
+	    struct stat *usb);
+int	user_fhstatfs(struct thread *td, const struct fhandle *u_fhp,
+	    struct statfs *buf);
 int	user_fspacectl(struct thread *td, int fd, int cmd,
 	    const struct spacectl_range *rqsrp, int flags,
 	    struct spacectl_range *rmsrp);
 int	user_fstat(struct thread *td, int fd, struct stat *sb);
+int	user_fstatat(struct thread *td, int fd, const char *path,
+	    struct stat *buf, int flag);
+int	user_fstatfs(struct thread *td, int fd, struct statfs *buf);
+int	user_getdirentries(struct thread *td, int fd, char *buf, size_t count,
+	    off_t *basep);
+int	user_getfsstat(struct thread *td, struct statfs *buf, long bufsize,
+	    int mode);
 int	user_getpeername(struct thread *td, int fdes, struct sockaddr *asa,
 	    socklen_t *alen, bool compat);
 int	user_getrlimitusage(struct thread *td, u_int which, int flags,
@@ -669,6 +695,7 @@ int	user_sigwaitinfo(struct thread *td, const sigset_t *uset, void *info,
 	    copyout_siginfo_t *copyout_siginfop);
 int	user_socketpair(struct thread *td, int domain, int type, int protocol,
 	    int *rsv);
+int	user_statfs(struct thread *td, const char *path, struct statfs *buf);
 int	user_uuidgen(struct thread *td, struct uuid *ustore, int count);
 int	user_wait6(struct thread *td, enum idtype idtype, id_t id,
 	    int *statusp, int options, struct __wrusage *wrusage,