Use the same function to implement linux32_sys_fcntl() and linux_sys_fcntl64().
A rather excessive amount of 'appending 64' to names seems to have happened when linux won support for files > 4G. technically the linux32_sys_fcntl() function should error the 64bit file locking requests - but life is too short.
This commit is contained in:
parent
527bf7ecad
commit
174ee4c867
|
@ -1,4 +1,4 @@
|
|||
$NetBSD: syscalls.master,v 1.28 2008/02/02 22:57:05 dsl Exp $
|
||||
$NetBSD: syscalls.master,v 1.29 2008/02/04 22:23:43 dsl Exp $
|
||||
|
||||
; NetBSD i386 COMPAT_LINUX32 system call name/number "master" file.
|
||||
; (See syscalls.conf to see what it is processed into.)
|
||||
|
@ -366,7 +366,10 @@
|
|||
netbsd32_size_t len, int behav); }
|
||||
220 STD { int linux32_sys_getdents64(int fd, \
|
||||
linux32_dirent64p_t dent, unsigned int count); }
|
||||
221 STD { int linux32_sys_fcntl64(int fd, \
|
||||
; fcntl64() - Exactly the same as fcntl()
|
||||
#define linux32_sys_fcntl64 linux32_sys_fcntl
|
||||
#define linux32_sys_fcntl64_args linux32_sys_fcntl_args
|
||||
221 NOARGS { int linux32_sys_fcntl64(int fd, \
|
||||
int cmd, netbsd32_voidp arg); }
|
||||
222 UNIMPL /* unused */
|
||||
223 UNIMPL /* unused */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: linux32_fcntl.c,v 1.5 2008/02/02 21:54:01 dsl Exp $ */
|
||||
/* $NetBSD: linux32_fcntl.c,v 1.6 2008/02/04 22:23:43 dsl 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.5 2008/02/02 21:54:01 dsl Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux32_fcntl.c,v 1.6 2008/02/04 22:23:43 dsl Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -95,8 +95,19 @@ linux32_sys_open(struct lwp *l, const struct linux32_sys_open_args *uap, registe
|
|||
return linux_sys_open(l, &ua, retval);
|
||||
}
|
||||
|
||||
/*
|
||||
* The linux support for 64bit file offsets introduced both an fcntl64()
|
||||
* function and LINUX_F_SETLK64 (et al), however the fcntl64() function
|
||||
* can still be passed LINUX_F_GETLK (etc).
|
||||
* In practice this means that the two functions are identical!
|
||||
*
|
||||
* We have to intercept both sets of locking primitives because the
|
||||
* structure layout of the 64bit version differs from that on amd64 due
|
||||
* to extra padding because the alignment constraint for int64_t differs.
|
||||
*/
|
||||
|
||||
int
|
||||
linux32_sys_fcntl64(struct lwp *l, const struct linux32_sys_fcntl64_args *uap, register_t *retval)
|
||||
linux32_sys_fcntl(struct lwp *l, const struct linux32_sys_fcntl_args *uap, register_t *retval)
|
||||
{
|
||||
/* {
|
||||
syscallcarg(int) fd;
|
||||
|
@ -114,29 +125,6 @@ linux32_sys_fcntl64(struct lwp *l, const struct linux32_sys_fcntl64_args *uap, r
|
|||
case LINUX_F_SETLKW64:
|
||||
do_linux_setlk(SCARG(uap, fd), cmd, SCARG_P32(uap, arg),
|
||||
linux32, flock64, LINUX_F_SETLK64);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
NETBSD32TO64_UAP(fd);
|
||||
SCARG(&ua, cmd) = cmd;
|
||||
NETBSD32TOP_UAP(arg, void);
|
||||
|
||||
return linux_sys_fcntl(l, &ua, retval);
|
||||
}
|
||||
|
||||
int
|
||||
linux32_sys_fcntl(struct lwp *l, const struct linux32_sys_fcntl_args *uap, register_t *retval)
|
||||
{
|
||||
/* {
|
||||
syscallcarg(int) fd;
|
||||
syscallarg(int) cmd;
|
||||
syscallarg(netbsd32_voidp) arg;
|
||||
} */
|
||||
struct linux_sys_fcntl_args ua;
|
||||
int cmd = SCARG(uap, cmd);
|
||||
|
||||
switch (cmd) {
|
||||
case LINUX_F_GETLK:
|
||||
do_linux_getlk(SCARG(uap, fd), cmd, SCARG_P32(uap, arg),
|
||||
linux32, flock);
|
||||
|
|
Loading…
Reference in New Issue