diff options
| author | tron <tron@NetBSD.org> | 1999-12-05 21:24:28 +0000 |
|---|---|---|
| committer | tron <tron@NetBSD.org> | 1999-12-05 21:24:28 +0000 |
| commit | ea2517e20d1633fdbf5881563ddcadfdbbe4185e (patch) | |
| tree | 4a4a19aa6a041f23eef400295943fc33392ec1e0 /sys/compat/linux | |
| parent | 5985528d02553fd357d5420db63afd5328e902a2 (diff) | |
Add proper stub code to make emulation of Linux's pread(2) and pwrite(2)
work. Fixes PR kern/8945 by Dave Sainty.
Diffstat (limited to 'sys/compat/linux')
| -rw-r--r-- | sys/compat/linux/arch/alpha/syscalls.master | 10 | ||||
| -rw-r--r-- | sys/compat/linux/arch/i386/syscalls.master | 10 | ||||
| -rw-r--r-- | sys/compat/linux/arch/m68k/syscalls.master | 10 | ||||
| -rw-r--r-- | sys/compat/linux/common/linux_file.c | 58 |
4 files changed, 72 insertions, 16 deletions
diff --git a/sys/compat/linux/arch/alpha/syscalls.master b/sys/compat/linux/arch/alpha/syscalls.master index 11697f124d6..f353a8ee489 100644 --- a/sys/compat/linux/arch/alpha/syscalls.master +++ b/sys/compat/linux/arch/alpha/syscalls.master @@ -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, \ diff --git a/sys/compat/linux/arch/i386/syscalls.master b/sys/compat/linux/arch/i386/syscalls.master index 07173eb66fa..124a4305f1c 100644 --- a/sys/compat/linux/arch/i386/syscalls.master +++ b/sys/compat/linux/arch/i386/syscalls.master @@ -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); } diff --git a/sys/compat/linux/arch/m68k/syscalls.master b/sys/compat/linux/arch/m68k/syscalls.master index b6f7334a07e..7e5871772ed 100644 --- a/sys/compat/linux/arch/m68k/syscalls.master +++ b/sys/compat/linux/arch/m68k/syscalls.master @@ -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); } diff --git a/sys/compat/linux/common/linux_file.c b/sys/compat/linux/common/linux_file.c index 295809e2485..355aa321e37 100644 --- a/sys/compat/linux/common/linux_file.c +++ b/sys/compat/linux/common/linux_file.c @@ -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); +} |
