Module Name: src Committed By: matt Date: Thu Jul 18 13:43:32 UTC 2013
Modified Files: src/sys/compat/netbsd32: netbsd32_fs.c netbsd32_netbsd.c Log Message: Move *at syscall handlers to netbsd32_fs.c from netbsd32_netbsd.c Fix netbsd32_fstatat to emit a 32bit stat structure. To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/sys/compat/netbsd32/netbsd32_fs.c cvs rdiff -u -r1.180 -r1.181 src/sys/compat/netbsd32/netbsd32_netbsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/compat/netbsd32/netbsd32_fs.c diff -u src/sys/compat/netbsd32/netbsd32_fs.c:1.64 src/sys/compat/netbsd32/netbsd32_fs.c:1.65 --- src/sys/compat/netbsd32/netbsd32_fs.c:1.64 Thu Dec 13 15:16:57 2012 +++ src/sys/compat/netbsd32/netbsd32_fs.c Thu Jul 18 13:43:32 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_fs.c,v 1.64 2012/12/13 15:16:57 matt Exp $ */ +/* $NetBSD: netbsd32_fs.c,v 1.65 2013/07/18 13:43:32 matt Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.64 2012/12/13 15:16:57 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.65 2013/07/18 13:43:32 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -972,3 +972,303 @@ netbsd32___mount50(struct lwp *l, const } return error; } + +int +netbsd32_linkat(struct lwp *l, const struct netbsd32_linkat_args *uap, + register_t *retval) +{ + /* { + syscallarg(int) fd1; + syscallarg(const netbsd32_charp) name1; + syscallarg(int) fd2; + syscallarg(const netbsd32_charp) name2; + syscallarg(int) flags; + } */ + struct sys_linkat_args ua; + + NETBSD32TO64_UAP(fd1); + NETBSD32TOP_UAP(name1, const char); + NETBSD32TO64_UAP(fd2); + NETBSD32TOP_UAP(name2, const char); + NETBSD32TO64_UAP(flags); + + return sys_linkat(l, &ua, retval); +} + +int +netbsd32_renameat(struct lwp *l, const struct netbsd32_renameat_args *uap, + register_t *retval) +{ + /* { + syscallarg(int) fromfd; + syscallarg(const netbsd32_charp) from; + syscallarg(int) tofd; + syscallarg(const netbsd32_charp) to; + } */ + struct sys_renameat_args ua; + + NETBSD32TO64_UAP(fromfd); + NETBSD32TOP_UAP(from, const char); + NETBSD32TO64_UAP(tofd); + NETBSD32TOP_UAP(to, const char); + + return sys_renameat(l, &ua, retval); +} + +int +netbsd32_mkfifoat(struct lwp *l, const struct netbsd32_mkfifoat_args *uap, + register_t *retval) +{ + /* { + syscallarg(int) fd; + syscallarg(const netbsd32_charp) path; + syscallarg(mode_t) mode; + } */ + struct sys_mkfifoat_args ua; + + NETBSD32TO64_UAP(fd); + NETBSD32TOP_UAP(path, const char); + NETBSD32TO64_UAP(mode); + + return sys_mkfifoat(l, &ua, retval); +} + +int +netbsd32_mknodat(struct lwp *l, const struct netbsd32_mknodat_args *uap, + register_t *retval) +{ + /* { + syscallarg(int) fd; + syscallarg(netbsd32_charp) path; + syscallarg(mode_t) mode; + syscallarg(uint32_t) dev; + } */ + struct sys_mknodat_args ua; + + NETBSD32TO64_UAP(fd); + NETBSD32TOP_UAP(path, const char); + NETBSD32TO64_UAP(mode); + NETBSD32TO64_UAP(dev); + + return sys_mknodat(l, &ua, retval); +} + +int +netbsd32_mkdirat(struct lwp *l, const struct netbsd32_mkdirat_args *uap, + register_t *retval) +{ + /* { + syscallarg(int) fd; + syscallarg(netbsd32_charp) path; + syscallarg(mode_t) mode; + } */ + struct sys_mkdirat_args ua; + + NETBSD32TO64_UAP(fd); + NETBSD32TOP_UAP(path, const char); + NETBSD32TO64_UAP(mode); + + return sys_mkdirat(l, &ua, retval); +} + +int +netbsd32_faccessat(struct lwp *l, const struct netbsd32_faccessat_args *uap, + register_t *retval) +{ + /* { + syscallarg(int) fd; + syscallarg(netbsd32_charp) path; + syscallarg(int) amode; + syscallarg(int) flag; + } */ + struct sys_faccessat_args ua; + + NETBSD32TO64_UAP(fd); + NETBSD32TOP_UAP(path, const char); + NETBSD32TO64_UAP(amode); + NETBSD32TO64_UAP(flag); + + return sys_faccessat(l, &ua, retval); +} + +int +netbsd32_fchmodat(struct lwp *l, const struct netbsd32_fchmodat_args *uap, + register_t *retval) +{ + /* { + syscallarg(int) fd; + syscallarg(netbsd32_charp) path; + syscallarg(mode_t) mode; + syscallarg(int) flag; + } */ + struct sys_fchmodat_args ua; + + NETBSD32TO64_UAP(fd); + NETBSD32TOP_UAP(path, const char); + NETBSD32TO64_UAP(mode); + NETBSD32TO64_UAP(flag); + + return sys_fchmodat(l, &ua, retval); +} + +int +netbsd32_fchownat(struct lwp *l, const struct netbsd32_fchownat_args *uap, + register_t *retval) +{ + /* { + syscallarg(int) fd; + syscallarg(netbsd32_charp) path; + syscallarg(uid_t) owner; + syscallarg(gid_t) group; + syscallarg(int) flag; + } */ + struct sys_fchownat_args ua; + + NETBSD32TO64_UAP(fd); + NETBSD32TOP_UAP(path, const char); + NETBSD32TO64_UAP(owner); + NETBSD32TO64_UAP(group); + NETBSD32TO64_UAP(flag); + + return sys_fchownat(l, &ua, retval); +} + +int +netbsd32_fstatat(struct lwp *l, const struct netbsd32_fstatat_args *uap, + register_t *retval) +{ + /* { + syscallarg(int) fd; + syscallarg(netbsd32_charp) path; + syscallarg(netbsd32_statp_t) buf; + syscallarg(int) flag; + } */ + struct netbsd32_stat sb32; + struct stat sb; + unsigned int nd_flag; + int error; + + if (SCARG(uap, flag) & AT_SYMLINK_NOFOLLOW) + nd_flag = NOFOLLOW; + else + nd_flag = FOLLOW; + + error = do_sys_statat(l, SCARG(uap, fd), SCARG_P32(uap, path), + nd_flag, &sb); + if (error) + return error; + netbsd32_from_stat(&sb, &sb32); + return copyout(&sb32, SCARG_P32(uap, buf), sizeof(sb32)); +} + +int +netbsd32_utimensat(struct lwp *l, const struct netbsd32_utimensat_args *uap, + register_t *retval) +{ + /* { + syscallarg(int) fd; + syscallarg(netbsd32_charp) path; + syscallarg(netbsd32_timespecp_t) tptr; + syscallarg(int) flag; + } */ + struct sys_utimensat_args ua; + + NETBSD32TO64_UAP(fd); + NETBSD32TOP_UAP(path, const char); + NETBSD32TOP_UAP(tptr, const struct timespec); + NETBSD32TO64_UAP(flag); + + return sys_utimensat(l, &ua, retval); +} + +int +netbsd32_openat(struct lwp *l, const struct netbsd32_openat_args *uap, + register_t *retval) +{ + /* { + syscallarg(int) fd; + syscallarg(netbsd32_charp) path; + syscallarg(int) oflags; + syscallarg(mode_t) mode; + } */ + struct sys_openat_args ua; + + NETBSD32TO64_UAP(fd); + NETBSD32TOP_UAP(path, const char); + NETBSD32TO64_UAP(oflags); + NETBSD32TO64_UAP(mode); + + return sys_openat(l, &ua, retval); +} + +int +netbsd32_readlinkat(struct lwp *l, const struct netbsd32_readlinkat_args *uap, + register_t *retval) +{ + /* { + syscallarg(int) fd; + syscallarg(netbsd32_charp) path; + syscallarg(netbsd32_charp) buf; + syscallarg(netbsd32_size_t) bufsize; + } */ + struct sys_readlinkat_args ua; + + NETBSD32TO64_UAP(fd); + NETBSD32TOP_UAP(path, const char *); + NETBSD32TOP_UAP(buf, char *); + NETBSD32TOX_UAP(bufsize, size_t); + + return sys_readlinkat(l, &ua, retval); +} + +int +netbsd32_symlinkat(struct lwp *l, const struct netbsd32_symlinkat_args *uap, + register_t *retval) +{ + /* { + syscallarg(netbsd32_charp) path1; + syscallarg(int) fd; + syscallarg(netbsd32_charp) path2; + } */ + struct sys_symlinkat_args ua; + + NETBSD32TOP_UAP(path1, const char *); + NETBSD32TO64_UAP(fd); + NETBSD32TOP_UAP(path2, const char *); + + return sys_symlinkat(l, &ua, retval); +} + +int +netbsd32_unlinkat(struct lwp *l, const struct netbsd32_unlinkat_args *uap, + register_t *retval) +{ + /* { + syscallarg(int) fd; + syscallarg(netbsd32_charp) path; + syscallarg(int) flag; + } */ + struct sys_unlinkat_args ua; + + NETBSD32TO64_UAP(fd); + NETBSD32TOP_UAP(path, const char *); + NETBSD32TO64_UAP(flag); + + return sys_unlinkat(l, &ua, retval); +} + +int +netbsd32_futimens(struct lwp *l, const struct netbsd32_futimens_args *uap, + register_t *retval) +{ + /* { + syscallarg(int) fd; + syscallarg(netbsd32_timespecp_t) tptr; + } */ + struct sys_futimens_args ua; + + NETBSD32TO64_UAP(fd); + NETBSD32TOP_UAP(tptr, const struct timespec *); + + return sys_futimens(l, &ua, retval); +} Index: src/sys/compat/netbsd32/netbsd32_netbsd.c diff -u src/sys/compat/netbsd32/netbsd32_netbsd.c:1.180 src/sys/compat/netbsd32/netbsd32_netbsd.c:1.181 --- src/sys/compat/netbsd32/netbsd32_netbsd.c:1.180 Sun Feb 19 21:06:39 2012 +++ src/sys/compat/netbsd32/netbsd32_netbsd.c Thu Jul 18 13:43:32 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_netbsd.c,v 1.180 2012/02/19 21:06:39 rmind Exp $ */ +/* $NetBSD: netbsd32_netbsd.c,v 1.181 2013/07/18 13:43:32 matt Exp $ */ /* * Copyright (c) 1998, 2001, 2008 Matthew R. Green @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.180 2012/02/19 21:06:39 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.181 2013/07/18 13:43:32 matt Exp $"); #if defined(_KERNEL_OPT) #include "opt_ddb.h" @@ -2697,298 +2697,6 @@ netbsd32_paccept(struct lwp *l, const st return sys_paccept(l, &ua, retval); } -int -netbsd32_linkat(struct lwp *l, const struct netbsd32_linkat_args *uap, - register_t *retval) -{ - /* { - syscallarg(int) fd1; - syscallarg(const netbsd32_charp) name1; - syscallarg(int) fd2; - syscallarg(const netbsd32_charp) name2; - syscallarg(int) flags; - } */ - struct sys_linkat_args ua; - - NETBSD32TO64_UAP(fd1); - NETBSD32TOP_UAP(name1, const char); - NETBSD32TO64_UAP(fd2); - NETBSD32TOP_UAP(name2, const char); - NETBSD32TO64_UAP(flags); - - return sys_linkat(l, &ua, retval); -} - -int -netbsd32_renameat(struct lwp *l, const struct netbsd32_renameat_args *uap, - register_t *retval) -{ - /* { - syscallarg(int) fromfd; - syscallarg(const netbsd32_charp) from; - syscallarg(int) tofd; - syscallarg(const netbsd32_charp) to; - } */ - struct sys_renameat_args ua; - - NETBSD32TO64_UAP(fromfd); - NETBSD32TOP_UAP(from, const char); - NETBSD32TO64_UAP(tofd); - NETBSD32TOP_UAP(to, const char); - - return sys_renameat(l, &ua, retval); -} - -int -netbsd32_mkfifoat(struct lwp *l, const struct netbsd32_mkfifoat_args *uap, - register_t *retval) -{ - /* { - syscallarg(int) fd; - syscallarg(const netbsd32_charp) path; - syscallarg(mode_t) mode; - } */ - struct sys_mkfifoat_args ua; - - NETBSD32TO64_UAP(fd); - NETBSD32TOP_UAP(path, const char); - NETBSD32TO64_UAP(mode); - - return sys_mkfifoat(l, &ua, retval); -} - -int -netbsd32_mknodat(struct lwp *l, const struct netbsd32_mknodat_args *uap, - register_t *retval) -{ - /* { - syscallarg(int) fd; - syscallarg(netbsd32_charp) path; - syscallarg(mode_t) mode; - syscallarg(uint32_t) dev; - } */ - struct sys_mknodat_args ua; - - NETBSD32TO64_UAP(fd); - NETBSD32TOP_UAP(path, const char); - NETBSD32TO64_UAP(mode); - NETBSD32TO64_UAP(dev); - - return sys_mknodat(l, &ua, retval); -} - -int -netbsd32_mkdirat(struct lwp *l, const struct netbsd32_mkdirat_args *uap, - register_t *retval) -{ - /* { - syscallarg(int) fd; - syscallarg(netbsd32_charp) path; - syscallarg(mode_t) mode; - } */ - struct sys_mkdirat_args ua; - - NETBSD32TO64_UAP(fd); - NETBSD32TOP_UAP(path, const char); - NETBSD32TO64_UAP(mode); - - return sys_mkdirat(l, &ua, retval); -} - -int -netbsd32_faccessat(struct lwp *l, const struct netbsd32_faccessat_args *uap, - register_t *retval) -{ - /* { - syscallarg(int) fd; - syscallarg(netbsd32_charp) path; - syscallarg(int) amode; - syscallarg(int) flag; - } */ - struct sys_faccessat_args ua; - - NETBSD32TO64_UAP(fd); - NETBSD32TOP_UAP(path, const char); - NETBSD32TO64_UAP(amode); - NETBSD32TO64_UAP(flag); - - return sys_faccessat(l, &ua, retval); -} - -int -netbsd32_fchmodat(struct lwp *l, const struct netbsd32_fchmodat_args *uap, - register_t *retval) -{ - /* { - syscallarg(int) fd; - syscallarg(netbsd32_charp) path; - syscallarg(mode_t) mode; - syscallarg(int) flag; - } */ - struct sys_fchmodat_args ua; - - NETBSD32TO64_UAP(fd); - NETBSD32TOP_UAP(path, const char); - NETBSD32TO64_UAP(mode); - NETBSD32TO64_UAP(flag); - - return sys_fchmodat(l, &ua, retval); -} - -int -netbsd32_fchownat(struct lwp *l, const struct netbsd32_fchownat_args *uap, - register_t *retval) -{ - /* { - syscallarg(int) fd; - syscallarg(netbsd32_charp) path; - syscallarg(uid_t) owner; - syscallarg(gid_t) group; - syscallarg(int) flag; - } */ - struct sys_fchownat_args ua; - - NETBSD32TO64_UAP(fd); - NETBSD32TOP_UAP(path, const char); - NETBSD32TO64_UAP(owner); - NETBSD32TO64_UAP(group); - NETBSD32TO64_UAP(flag); - - return sys_fchownat(l, &ua, retval); -} - -int -netbsd32_fstatat(struct lwp *l, const struct netbsd32_fstatat_args *uap, - register_t *retval) -{ - /* { - syscallarg(int) fd; - syscallarg(netbsd32_charp) path; - syscallarg(netbsd32_statp_t) buf; - syscallarg(int) flag; - } */ - struct sys_fstatat_args ua; - - NETBSD32TO64_UAP(fd); - NETBSD32TOP_UAP(path, const char); - NETBSD32TOP_UAP(buf, const struct stat); - NETBSD32TO64_UAP(flag); - - return sys_fstatat(l, &ua, retval); -} - -int -netbsd32_utimensat(struct lwp *l, const struct netbsd32_utimensat_args *uap, - register_t *retval) -{ - /* { - syscallarg(int) fd; - syscallarg(netbsd32_charp) path; - syscallarg(netbsd32_timespecp_t) tptr; - syscallarg(int) flag; - } */ - struct sys_utimensat_args ua; - - NETBSD32TO64_UAP(fd); - NETBSD32TOP_UAP(path, const char); - NETBSD32TOP_UAP(tptr, const struct timespec); - NETBSD32TO64_UAP(flag); - - return sys_utimensat(l, &ua, retval); -} - -int -netbsd32_openat(struct lwp *l, const struct netbsd32_openat_args *uap, - register_t *retval) -{ - /* { - syscallarg(int) fd; - syscallarg(netbsd32_charp) path; - syscallarg(int) oflags; - syscallarg(mode_t) mode; - } */ - struct sys_openat_args ua; - - NETBSD32TO64_UAP(fd); - NETBSD32TOP_UAP(path, const char); - NETBSD32TO64_UAP(oflags); - NETBSD32TO64_UAP(mode); - - return sys_openat(l, &ua, retval); -} - -int -netbsd32_readlinkat(struct lwp *l, const struct netbsd32_readlinkat_args *uap, - register_t *retval) -{ - /* { - syscallarg(int) fd; - syscallarg(netbsd32_charp) path; - syscallarg(netbsd32_charp) buf; - syscallarg(netbsd32_size_t) bufsize; - } */ - struct sys_readlinkat_args ua; - - NETBSD32TO64_UAP(fd); - NETBSD32TOP_UAP(path, const char *); - NETBSD32TOP_UAP(buf, char *); - NETBSD32TOX_UAP(bufsize, size_t); - - return sys_readlinkat(l, &ua, retval); -} - -int -netbsd32_symlinkat(struct lwp *l, const struct netbsd32_symlinkat_args *uap, - register_t *retval) -{ - /* { - syscallarg(netbsd32_charp) path1; - syscallarg(int) fd; - syscallarg(netbsd32_charp) path2; - } */ - struct sys_symlinkat_args ua; - - NETBSD32TOP_UAP(path1, const char *); - NETBSD32TO64_UAP(fd); - NETBSD32TOP_UAP(path2, const char *); - - return sys_symlinkat(l, &ua, retval); -} - -int -netbsd32_unlinkat(struct lwp *l, const struct netbsd32_unlinkat_args *uap, - register_t *retval) -{ - /* { - syscallarg(int) fd; - syscallarg(netbsd32_charp) path; - syscallarg(int) flag; - } */ - struct sys_unlinkat_args ua; - - NETBSD32TO64_UAP(fd); - NETBSD32TOP_UAP(path, const char *); - NETBSD32TO64_UAP(flag); - - return sys_unlinkat(l, &ua, retval); -} - -int -netbsd32_futimens(struct lwp *l, const struct netbsd32_futimens_args *uap, - register_t *retval) -{ - /* { - syscallarg(int) fd; - syscallarg(netbsd32_timespecp_t) tptr; - } */ - struct sys_futimens_args ua; - - NETBSD32TO64_UAP(fd); - NETBSD32TOP_UAP(tptr, const struct timespec *); - - return sys_futimens(l, &ua, retval); -} - /* * MI indirect system call support. * Only used if the MD netbsd32_syscall.c doesn't intercept the calls.