1*ce099b40Smartin /* $NetBSD: linux_fcntl64.c,v 1.4 2008/04/28 20:23:43 martin Exp $ */
27e5ac707Sdsl
37e5ac707Sdsl /*-
47e5ac707Sdsl * Copyright (c) 1995, 1998, 2000 The NetBSD Foundation, Inc.
57e5ac707Sdsl * All rights reserved.
67e5ac707Sdsl *
77e5ac707Sdsl * This code is derived from software contributed to The NetBSD Foundation
87e5ac707Sdsl * by Frank van der Linden and Eric Haszlakiewicz.
97e5ac707Sdsl *
107e5ac707Sdsl * Redistribution and use in source and binary forms, with or without
117e5ac707Sdsl * modification, are permitted provided that the following conditions
127e5ac707Sdsl * are met:
137e5ac707Sdsl * 1. Redistributions of source code must retain the above copyright
147e5ac707Sdsl * notice, this list of conditions and the following disclaimer.
157e5ac707Sdsl * 2. Redistributions in binary form must reproduce the above copyright
167e5ac707Sdsl * notice, this list of conditions and the following disclaimer in the
177e5ac707Sdsl * documentation and/or other materials provided with the distribution.
187e5ac707Sdsl *
197e5ac707Sdsl * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
207e5ac707Sdsl * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
217e5ac707Sdsl * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
227e5ac707Sdsl * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
237e5ac707Sdsl * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
247e5ac707Sdsl * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
257e5ac707Sdsl * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
267e5ac707Sdsl * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
277e5ac707Sdsl * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
287e5ac707Sdsl * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
297e5ac707Sdsl * POSSIBILITY OF SUCH DAMAGE.
307e5ac707Sdsl */
317e5ac707Sdsl
327e5ac707Sdsl /*
3322774d7cSdsl * Linux 64bit-offset filesystem calls.
347e5ac707Sdsl */
357e5ac707Sdsl
367e5ac707Sdsl #include <sys/cdefs.h>
37*ce099b40Smartin __KERNEL_RCSID(0, "$NetBSD: linux_fcntl64.c,v 1.4 2008/04/28 20:23:43 martin Exp $");
387e5ac707Sdsl
397e5ac707Sdsl #include <sys/param.h>
407e5ac707Sdsl #include <sys/systm.h>
417e5ac707Sdsl #include <sys/proc.h>
427e5ac707Sdsl #include <sys/file.h>
437e5ac707Sdsl #include <sys/filedesc.h>
44301a1d2dShe #include <sys/fstypes.h>
457e5ac707Sdsl #include <sys/vfs_syscalls.h>
467e5ac707Sdsl #include <sys/conf.h>
477e5ac707Sdsl
487e5ac707Sdsl #include <sys/syscallargs.h>
497e5ac707Sdsl
507e5ac707Sdsl #include <compat/linux/common/linux_types.h>
517e5ac707Sdsl #include <compat/linux/common/linux_fcntl.h>
527e5ac707Sdsl #include <compat/linux/common/linux_machdep.h>
537e5ac707Sdsl
547e5ac707Sdsl #include <compat/linux/linux_syscallargs.h>
557e5ac707Sdsl
conv_linux_flock(linux,flock64)5622774d7cSdsl conv_linux_flock(linux, flock64)
577e5ac707Sdsl
587e5ac707Sdsl int
597e5ac707Sdsl linux_sys_fcntl64(struct lwp *l, const struct linux_sys_fcntl64_args *uap, register_t *retval)
607e5ac707Sdsl {
617e5ac707Sdsl /* {
627e5ac707Sdsl syscallarg(int) fd;
637e5ac707Sdsl syscallarg(int) cmd;
647e5ac707Sdsl syscallarg(void *) arg;
657e5ac707Sdsl } */
667e5ac707Sdsl int cmd = SCARG(uap, cmd);
677e5ac707Sdsl
687e5ac707Sdsl switch (cmd) {
697e5ac707Sdsl case LINUX_F_GETLK64:
7022774d7cSdsl do_linux_getlk(SCARG(uap, fd), cmd, SCARG(uap, arg),
7122774d7cSdsl linux, flock64);
727e5ac707Sdsl case LINUX_F_SETLK64:
737e5ac707Sdsl case LINUX_F_SETLKW64:
7422774d7cSdsl do_linux_setlk(SCARG(uap, fd), cmd, SCARG(uap, arg),
7522774d7cSdsl linux, flock64, LINUX_F_SETLK64);
767e5ac707Sdsl default:
777e5ac707Sdsl return linux_sys_fcntl(l, (const void *)uap, retval);
787e5ac707Sdsl }
797e5ac707Sdsl }
80