add Linux compat arg wrapper for ftruncate64(), and change linux compat

truncate64() wrapper to translate args structure
NetBSD truncate() and ftrucate() have hidden 'pad' argument, so we have
to do the argument translation

Problem found and patch supplied in PR kern/22360 by Ales Krenek

This is the last of syscalls with hidden 'pad' arg we didn't have
wrapper for; all the others (lseek, mmap, pwrite, pread) already had
wrapper before.
This commit is contained in:
jdolecek 2003-08-10 20:16:20 +00:00
parent b22732fe70
commit 94b152275c
6 changed files with 41 additions and 13 deletions

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.14 2003/06/28 07:55:08 he Exp $
$NetBSD: syscalls.master,v 1.15 2003/08/10 20:16:20 jdolecek Exp $
; Derived from sys/compat/linux/arch/*/syscalls.master
; and from Linux 2.4.12 arch/arm/kernel/calls.S
@ -332,7 +332,7 @@
linux_off_t offset); }
193 STD { int linux_sys_truncate64(const char *path, \
off_t length); }
194 NOARGS ftruncate64 { int sys_ftruncate(int fd, \
194 STD { int linux_sys_ftruncate64(unsigned int fd, \
off_t length); }
195 STD { int linux_sys_stat64(const char *path, \
struct linux_stat64 *sp); }

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.66 2003/07/03 21:24:28 christos Exp $
$NetBSD: syscalls.master,v 1.67 2003/08/10 20:16:22 jdolecek Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@ -330,7 +330,7 @@
linux_off_t offset); }
193 STD { int linux_sys_truncate64(const char *path, \
off_t length); }
194 NOARGS linux_ftruncate64 { int sys_ftruncate(int fd, \
194 STD { int linux_sys_ftruncate64(unsigned int fd, \
off_t length); }
195 STD { int linux_sys_stat64(const char *path, \
struct linux_stat64 *sp); }

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.42 2003/06/29 16:07:58 thorpej Exp $
$NetBSD: syscalls.master,v 1.43 2003/08/10 20:16:23 jdolecek Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@ -343,7 +343,8 @@
linux_off_t offset); }
193 STD { int linux_sys_truncate64(const char *path, \
off_t length); }
194 NOARGS ftruncate64 { int sys_ftruncate(int fd, off_t length); }
194 STD { int linux_sys_ftruncate64(unsigned int fd, \
off_t length); }
195 STD { int linux_sys_stat64(const char *path, \
struct linux_stat64 *sp); }
196 STD { int linux_sys_lstat64(const char *path, \

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.11 2003/06/23 21:25:58 christos Exp $
$NetBSD: syscalls.master,v 1.12 2003/08/10 20:16:25 jdolecek Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@ -371,7 +371,8 @@
linux_off_t offset); }
211 STD { int linux_sys_truncate64(const char *path, \
off_t length); }
212 UNIMPL ftruncate64
212 STD { int linux_sys_ftruncate64(unsigned int fd, \
off_t length); }
213 STD { int linux_sys_stat64(const char *path, \
struct linux_stat64 *sp); }
214 STD { int linux_sys_lstat64(const char *path, \

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.15 2003/06/23 21:25:58 christos Exp $
$NetBSD: syscalls.master,v 1.16 2003/08/10 20:16:26 jdolecek Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@ -358,7 +358,7 @@
linux_off_t offset); }
193 STD { int linux_sys_truncate64(const char *path, \
off_t length); }
194 NOARGS linux_ftruncate64 { int sys_ftruncate(int fd, \
194 STD { int linux_sys_ftruncate64(unsigned int fd, \
off_t length); }
195 STD { int linux_sys_stat64(const char *path, \
struct linux_stat64 *sp); }

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_file64.c,v 1.21 2003/06/29 22:29:29 fvdl Exp $ */
/* $NetBSD: linux_file64.c,v 1.22 2003/08/10 20:16:27 jdolecek Exp $ */
/*-
* Copyright (c) 1995, 1998, 2000 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.21 2003/06/29 22:29:29 fvdl Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.22 2003/08/10 20:16:27 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -227,12 +227,38 @@ linux_sys_truncate64(l, v, retval)
syscallarg(const char *) path;
syscallarg(off_t) length;
} */ *uap = v;
struct sys_truncate_args ta;
struct proc *p = l->l_proc;
caddr_t sg = stackgap_init(p, 0);
CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
return sys_truncate(l, uap, retval);
/* Linux doesn't have the 'pad' pseudo-parameter */
SCARG(&ta, path) = SCARG(uap, path);
SCARG(&ta, pad) = 0;
SCARG(&ta, length) = SCARG(uap, length);
return sys_truncate(l, &ta, retval);
}
int
linux_sys_ftruncate64(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
struct linux_sys_ftruncate64_args /* {
syscallarg(unsigned int) fd;
syscallarg(off_t) length;
} */ *uap = v;
struct sys_ftruncate_args ta;
/* Linux doesn't have the 'pad' pseudo-parameter */
SCARG(&ta, fd) = SCARG(uap, fd);
SCARG(&ta, pad) = 0;
SCARG(&ta, length) = SCARG(uap, length);
return sys_ftruncate(l, &ta, retval);
}
#if !defined(__m68k__)