Add proper stub code to make emulation of Linux's pread(2) and pwrite(2)

work. Fixes PR kern/8945 by Dave Sainty.
This commit is contained in:
tron 1999-12-05 21:24:28 +00:00
parent 5985528d02
commit ea2517e20d
4 changed files with 72 additions and 16 deletions

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.12 1999/10/04 16:55:54 tron Exp $
$NetBSD: syscalls.master,v 1.13 1999/12/05 21:24:28 tron Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@ -510,10 +510,10 @@
346 UNIMPL pciconfig_write
347 UNIMPL query_module
348 UNIMPL prctl
349 NOARGS { int sys_pread(int fd, char *buf, size_t nbytes, \
off_t offset); }
350 NOARGS { int sys_pwrite(int fd, char *buf, size_t nbytes, \
off_t offset); }
340 STD { int linux_sys_pread(int fd, char *buf, \
size_t nbyte, linux_off_t offset); }
350 STD { int linux_sys_pwrite(int fd, char *buf, \
size_t nbyte, linux_off_t offset); }
351 STD { int linux_sys_rt_sigreturn( \
struct linux_rt_sigframe *sfp); }
352 STD { int linux_sys_rt_sigaction(int signum, \

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.37 1999/12/04 22:14:14 tron Exp $
$NetBSD: syscalls.master,v 1.38 1999/12/05 21:24:30 tron Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@ -296,10 +296,10 @@
void *uinfo); }
179 STD { int linux_sys_rt_sigsuspend(linux_sigset_t *unewset, \
size_t sigsetsize); }
180 NOARGS { int sys_pread(int fd, char *buf, size_t nbytes, \
off_t offset); }
181 NOARGS { int sys_pwrite(int fd, char *buf, size_t nbytes, \
off_t offset); }
180 STD { int linux_sys_pread(int fd, char *buf, \
size_t nbyte, linux_off_t offset); }
181 STD { int linux_sys_pwrite(int fd, char *buf, \
size_t nbyte, linux_off_t offset); }
182 STD { int linux_sys_chown(const char *path, int uid, \
int gid); }
183 NOARGS { int sys___getcwd(char *bufp, size_t length); }

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.10 1999/12/04 22:14:15 tron Exp $
$NetBSD: syscalls.master,v 1.11 1999/12/05 21:24:30 tron Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@ -321,10 +321,10 @@
void *uinfo); }
179 STD { int linux_sys_rt_sigsuspend(linux_sigset_t *unewset, \
size_t sigsetsize); }
180 NOARGS { int sys_pread(int fd, char *buf, size_t nbytes, \
off_t offset); }
181 NOARGS { int sys_pwrite(int fd, char *buf, size_t nbytes, \
off_t offset); }
180 STD { int linux_sys_pread(int fd, char *buf, \
size_t nbyte, linux_off_t offset); }
181 STD { int linux_sys_pwrite(int fd, char *buf, \
size_t nbyte, linux_off_t offset); }
;182 chown on i386; lchown on m68k.
182 STD { int linux_sys_lchown(const char *path, int uid, \
int gid); }

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_file.c,v 1.27 1999/02/09 20:37:19 christos Exp $ */
/* $NetBSD: linux_file.c,v 1.28 1999/12/05 21:24:30 tron Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -835,3 +835,59 @@ linux_sys_fdatasync(p, v, retval)
#endif
return sys_fsync(p, v, retval);
}
/*
* pread(2).
*/
int
linux_sys_pread(p, v, retval)
struct proc *p;
void *v;
register_t *retval;
{
struct linux_sys_pread_args /* {
syscallarg(int) fd;
syscallarg(void *) buf;
syscallarg(size_t) nbyte;
syscallarg(linux_off_t) offset;
} */ *uap = v;
struct sys_pread_args pra;
caddr_t sg;
sg = stackgap_init(p->p_emul);
SCARG(&pra, fd) = SCARG(uap, fd);
SCARG(&pra, buf) = SCARG(uap, buf);
SCARG(&pra, nbyte) = SCARG(uap, nbyte);
SCARG(&pra, offset) = SCARG(uap, offset);
return sys_read(p, &pra, retval);
}
/*
* pwrite(2).
*/
int
linux_sys_pwrite(p, v, retval)
struct proc *p;
void *v;
register_t *retval;
{
struct linux_sys_pwrite_args /* {
syscallarg(int) fd;
syscallarg(void *) buf;
syscallarg(size_t) nbyte;
syscallarg(linux_off_t) offset;
} */ *uap = v;
struct sys_pwrite_args pra;
caddr_t sg;
sg = stackgap_init(p->p_emul);
SCARG(&pra, fd) = SCARG(uap, fd);
SCARG(&pra, buf) = SCARG(uap, buf);
SCARG(&pra, nbyte) = SCARG(uap, nbyte);
SCARG(&pra, offset) = SCARG(uap, offset);
return sys_write(p, &pra, retval);
}