Module Name: src Committed By: ryo Date: Thu Nov 25 02:35:00 UTC 2021
Modified Files: src/sys/compat/linux32/common: linux32_fcntl.c Added Files: src/sys/compat/linux32/arch/amd64: linux32_fcntl.h src/sys/compat/linux32/common: linux32_fcntl.h Log Message: - Use LINUX32_F_xxx instead of LINUX_F_xxx for compat_linux32. aarch64 and arm have different values. - Compile linux32_sys_fadvise64() only if the syscall is required. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/compat/linux32/arch/amd64/linux32_fcntl.h cvs rdiff -u -r1.10 -r1.11 src/sys/compat/linux32/common/linux32_fcntl.c cvs rdiff -u -r0 -r1.1 src/sys/compat/linux32/common/linux32_fcntl.h 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/linux32/common/linux32_fcntl.c diff -u src/sys/compat/linux32/common/linux32_fcntl.c:1.10 src/sys/compat/linux32/common/linux32_fcntl.c:1.11 --- src/sys/compat/linux32/common/linux32_fcntl.c:1.10 Sat May 17 09:30:07 2014 +++ src/sys/compat/linux32/common/linux32_fcntl.c Thu Nov 25 02:35:00 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: linux32_fcntl.c,v 1.10 2014/05/17 09:30:07 njoly Exp $ */ +/* $NetBSD: linux32_fcntl.c,v 1.11 2021/11/25 02:35:00 ryo Exp $ */ /*- * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved. @@ -33,7 +33,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux32_fcntl.c,v 1.10 2014/05/17 09:30:07 njoly Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux32_fcntl.c,v 1.11 2021/11/25 02:35:00 ryo Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -57,8 +57,10 @@ __KERNEL_RCSID(0, "$NetBSD: linux32_fcnt #include <compat/linux/linux_syscallargs.h> #include <compat/linux32/common/linux32_types.h> +#include <compat/linux32/common/linux32_fcntl.h> #include <compat/linux32/common/linux32_signal.h> #include <compat/linux32/common/linux32_machdep.h> +#include <compat/linux32/linux32_syscall.h> #include <compat/linux32/linux32_syscallargs.h> struct linux32_flock { @@ -120,18 +122,18 @@ linux32_sys_fcntl(struct lwp *l, const s int cmd = SCARG(uap, cmd); switch (cmd) { - case LINUX_F_GETLK64: + case LINUX32_F_GETLK64: do_linux_getlk(SCARG(uap, fd), cmd, SCARG_P32(uap, arg), linux32, flock64); - case LINUX_F_SETLK64: - case LINUX_F_SETLKW64: + case LINUX32_F_SETLK64: + case LINUX32_F_SETLKW64: do_linux_setlk(SCARG(uap, fd), cmd, SCARG_P32(uap, arg), linux32, flock64, LINUX_F_SETLK64); - case LINUX_F_GETLK: + case LINUX32_F_GETLK: do_linux_getlk(SCARG(uap, fd), cmd, SCARG_P32(uap, arg), linux32, flock); - case LINUX_F_SETLK: - case LINUX_F_SETLKW: + case LINUX32_F_SETLK: + case LINUX32_F_SETLKW: do_linux_setlk(SCARG(uap, fd), cmd, SCARG_P32(uap, arg), linux32, flock, LINUX_F_SETLK); default: @@ -145,6 +147,7 @@ linux32_sys_fcntl(struct lwp *l, const s return linux_sys_fcntl(l, &ua, retval); } +#ifdef LINUX32_SYS_fadvise64 int linux32_sys_fadvise64(struct lwp *l, const struct linux32_sys_fadvise64_args *uap, register_t *retval) @@ -161,6 +164,7 @@ linux32_sys_fadvise64(struct lwp *l, return do_posix_fadvise(SCARG(uap, fd), off, SCARG(uap, len), linux_to_bsd_posix_fadv(SCARG(uap, advice))); } +#endif int linux32_sys_fadvise64_64(struct lwp *l, Added files: Index: src/sys/compat/linux32/arch/amd64/linux32_fcntl.h diff -u /dev/null src/sys/compat/linux32/arch/amd64/linux32_fcntl.h:1.1 --- /dev/null Thu Nov 25 02:35:01 2021 +++ src/sys/compat/linux32/arch/amd64/linux32_fcntl.h Thu Nov 25 02:35:00 2021 @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2021 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Ryo Shimizu. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _AMD64_LINUX32_FCNTL_H_ +#define _AMD64_LINUX32_FCNTL_H_ + +#include <compat/linux/common/linux_fcntl.h> + +#define LINUX32_F_GETLK LINUX_F_GETLK +#define LINUX32_F_SETLK LINUX_F_SETLK +#define LINUX32_F_SETLKW LINUX_F_SETLKW +#define LINUX32_F_GETLK64 LINUX_F_GETLK64 +#define LINUX32_F_SETLK64 LINUX_F_SETLK64 +#define LINUX32_F_SETLKW64 LINUX_F_SETLKW64 + +#endif /* _AMD64_LINUX32_FCNTL_H_ */ Index: src/sys/compat/linux32/common/linux32_fcntl.h diff -u /dev/null src/sys/compat/linux32/common/linux32_fcntl.h:1.1 --- /dev/null Thu Nov 25 02:35:01 2021 +++ src/sys/compat/linux32/common/linux32_fcntl.h Thu Nov 25 02:35:00 2021 @@ -0,0 +1,43 @@ +/* $NetBSD: linux32_fcntl.h,v 1.1 2021/11/25 02:35:00 ryo Exp $ */ + +/*- + * Copyright (c) 2021 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Ryo Shimizu. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _LINUX32_FCNTL_H_ +#define _LINUX32_FCNTL_H_ + +#if defined(__aarch64__) +#include <compat/linux32/arch/aarch64/linux32_fcntl.h> +#elif defined(__amd64__) +#include <compat/linux32/arch/amd64/linux32_fcntl.h> +#else +#error Undefined linux32_fcntl.h machine type. +#endif + +#endif /* _LINUX32_FCNTL_H_ */