Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/linux - add a real linux_sys___sysctl because the...



details:   https://anonhg.NetBSD.org/src/rev/e1d45022cfdf
branches:  trunk
changeset: 522286:e1d45022cfdf
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Feb 15 16:47:58 2002 +0000

description:
- add a real linux_sys___sysctl because the mib numbers are different.
  implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
  that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
        gdb, telnet, work
        jdk-1.4.0 extractor works, jdk still coredumps.

christos

diffstat:

 sys/compat/linux/arch/alpha/linux_machdep.c       |   13 +-
 sys/compat/linux/arch/alpha/linux_machdep.h       |    6 +-
 sys/compat/linux/arch/alpha/linux_syscall.h       |    2 +-
 sys/compat/linux/arch/alpha/linux_syscallargs.h   |    2 +-
 sys/compat/linux/arch/alpha/linux_syscalls.c      |    4 +-
 sys/compat/linux/arch/alpha/linux_sysent.c        |    4 +-
 sys/compat/linux/arch/alpha/syscalls.master       |    9 +-
 sys/compat/linux/arch/arm/linux_machdep.c         |    7 +-
 sys/compat/linux/arch/arm/linux_machdep.h         |   11 +-
 sys/compat/linux/arch/arm/linux_syscall.h         |    5 +-
 sys/compat/linux/arch/arm/linux_syscallargs.h     |   12 +-
 sys/compat/linux/arch/arm/linux_syscalls.c        |    6 +-
 sys/compat/linux/arch/arm/linux_sysent.c          |    8 +-
 sys/compat/linux/arch/arm/syscalls.master         |    8 +-
 sys/compat/linux/arch/i386/linux_machdep.c        |   21 +-
 sys/compat/linux/arch/i386/linux_machdep.h        |    5 +-
 sys/compat/linux/arch/i386/linux_signal.h         |   14 +-
 sys/compat/linux/arch/i386/linux_syscall.h        |    8 +-
 sys/compat/linux/arch/i386/linux_syscallargs.h    |   32 ++-
 sys/compat/linux/arch/i386/linux_syscalls.c       |    8 +-
 sys/compat/linux/arch/i386/linux_sysent.c         |   20 +-
 sys/compat/linux/arch/i386/linux_types.h          |   36 +-
 sys/compat/linux/arch/i386/syscalls.master        |   26 +-
 sys/compat/linux/arch/m68k/linux_machdep.c        |   15 +-
 sys/compat/linux/arch/m68k/linux_machdep.h        |   10 +-
 sys/compat/linux/arch/m68k/linux_syscall.h        |    5 +-
 sys/compat/linux/arch/m68k/linux_syscallargs.h    |   12 +-
 sys/compat/linux/arch/m68k/linux_syscalls.c       |    6 +-
 sys/compat/linux/arch/m68k/linux_sysent.c         |    8 +-
 sys/compat/linux/arch/m68k/syscalls.master        |   22 +-
 sys/compat/linux/arch/mips/linux_machdep.c        |    7 +-
 sys/compat/linux/arch/mips/linux_machdep.h        |    9 +-
 sys/compat/linux/arch/mips/linux_syscall.h        |   21 +-
 sys/compat/linux/arch/mips/linux_syscallargs.h    |  206 +-------------------
 sys/compat/linux/arch/mips/linux_syscalls.c       |  231 +---------------------
 sys/compat/linux/arch/mips/syscalls.master        |   15 +-
 sys/compat/linux/arch/powerpc/linux_machdep.c     |   16 +-
 sys/compat/linux/arch/powerpc/linux_machdep.h     |   11 +-
 sys/compat/linux/arch/powerpc/linux_syscall.h     |    5 +-
 sys/compat/linux/arch/powerpc/linux_syscallargs.h |   12 +-
 sys/compat/linux/arch/powerpc/linux_syscalls.c    |    6 +-
 sys/compat/linux/arch/powerpc/linux_sysent.c      |    8 +-
 sys/compat/linux/arch/powerpc/syscalls.master     |    8 +-
 sys/compat/linux/common/linux_emuldata.h          |   10 +-
 sys/compat/linux/common/linux_file.c              |    8 +-
 sys/compat/linux/common/linux_file64.c            |    9 +-
 sys/compat/linux/common/linux_machdep.h           |    9 +-
 sys/compat/linux/common/linux_misc.c              |  183 ++++++++++++++--
 sys/compat/linux/common/linux_misc.h              |   15 +-
 sys/compat/linux/common/linux_mmap.h              |    3 +-
 sys/compat/linux/common/linux_oldmmap.c           |    8 +-
 sys/compat/linux/common/linux_sig_notalpha.c      |   10 +-
 sys/compat/linux/common/linux_sigaction.c         |    8 +-
 sys/compat/linux/common/linux_signal.c            |  204 +++++++++----------
 sys/compat/linux/common/linux_signal.h            |   40 ++-
 sys/compat/linux/common/linux_types.h             |    8 +-
 sys/compat/linux/files.linux                      |    3 +-
 57 files changed, 594 insertions(+), 824 deletions(-)

diffs (truncated from 2800 to 300 lines):

diff -r 349a12df62a9 -r e1d45022cfdf sys/compat/linux/arch/alpha/linux_machdep.c
--- a/sys/compat/linux/arch/alpha/linux_machdep.c       Fri Feb 15 12:42:34 2002 +0000
+++ b/sys/compat/linux/arch/alpha/linux_machdep.c       Fri Feb 15 16:47:58 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_machdep.c,v 1.19 2001/11/13 02:08:33 lukem Exp $ */
+/*     $NetBSD: linux_machdep.c,v 1.20 2002/02/15 16:47:58 christos Exp $      */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.19 2001/11/13 02:08:33 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.20 2002/02/15 16:47:58 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -159,8 +159,8 @@
 
        /* Setup potentially partial signal mask in sc_mask. */
        /* But get all of it in uc_sigmask */
-       native_to_linux_old_sigset(mask, &sigframe.uc.uc_mcontext.sc_mask);
-       native_to_linux_sigset(mask, &sigframe.uc.uc_sigmask);
+       native_to_linux_old_sigset(&sigframe.uc.uc_mcontext.sc_mask, mask);
+       native_to_linux_sigset(&sigframe.uc.uc_sigmask, mask);
 
        sigframe.uc.uc_mcontext.sc_pc = tf->tf_regs[FRAME_PC];
        sigframe.uc.uc_mcontext.sc_ps = ALPHA_PSL_USERMODE;
@@ -256,7 +256,7 @@
         */
        bzero(&sigframe.sf_sc, sizeof(struct linux_ucontext));
        sigframe.sf_sc.sc_onstack = onstack;
-       native_to_linux_old_sigset(mask, &sigframe.sf_sc.sc_mask);
+       native_to_linux_old_sigset(&sigframe.sf_sc.sc_mask, mask);
        sigframe.sf_sc.sc_pc = tf->tf_regs[FRAME_PC];
        sigframe.sf_sc.sc_ps = ALPHA_PSL_USERMODE;
        frametoreg(tf, (struct reg *)sigframe.sf_sc.sc_regs);
@@ -524,8 +524,9 @@
 
 /* XXX XAX fix this */
 dev_t
-linux_fakedev(dev)
+linux_fakedev(dev, raw)
        dev_t dev;
+       int raw;
 {
        return dev;
 }
diff -r 349a12df62a9 -r e1d45022cfdf sys/compat/linux/arch/alpha/linux_machdep.h
--- a/sys/compat/linux/arch/alpha/linux_machdep.h       Fri Feb 15 12:42:34 2002 +0000
+++ b/sys/compat/linux/arch/alpha/linux_machdep.h       Fri Feb 15 16:47:58 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_machdep.h,v 1.5 2000/12/14 18:10:14 mycroft Exp $        */
+/*     $NetBSD: linux_machdep.h,v 1.6 2002/02/15 16:47:58 christos Exp $       */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -39,6 +39,8 @@
 #ifndef _ALPHA_LINUX_MACHDEP_H
 #define _ALPHA_LINUX_MACHDEP_H
 
+#include <compat/linux/common/linux_signal.h>
+
 /*
  * The Linux sigcontext, pretty much a standard alpha trapframe.
  */
@@ -99,8 +101,6 @@
 void setup_linux_sigframe __P((struct trapframe *, int, sigset_t *));
 int linux_restore_sigcontext __P((struct proc *, struct linux_sigcontext,
                                  sigset_t *));
-void linux_sendsig __P((sig_t, int, sigset_t *, u_long));
-dev_t linux_fakedev __P((dev_t));
 void linux_syscall_intern __P((struct proc *));
 __END_DECLS
 #endif /* !_KERNEL */
diff -r 349a12df62a9 -r e1d45022cfdf sys/compat/linux/arch/alpha/linux_syscall.h
--- a/sys/compat/linux/arch/alpha/linux_syscall.h       Fri Feb 15 12:42:34 2002 +0000
+++ b/sys/compat/linux/arch/alpha/linux_syscall.h       Fri Feb 15 16:47:58 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_syscall.h,v 1.41 2001/11/13 02:08:35 lukem Exp $ */
+/* $NetBSD: linux_syscall.h,v 1.42 2002/02/15 16:47:59 christos Exp $ */
 
 /*
  * System call numbers.
diff -r 349a12df62a9 -r e1d45022cfdf sys/compat/linux/arch/alpha/linux_syscallargs.h
--- a/sys/compat/linux/arch/alpha/linux_syscallargs.h   Fri Feb 15 12:42:34 2002 +0000
+++ b/sys/compat/linux/arch/alpha/linux_syscallargs.h   Fri Feb 15 16:47:58 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_syscallargs.h,v 1.40 2001/11/13 02:08:35 lukem Exp $ */
+/* $NetBSD: linux_syscallargs.h,v 1.41 2002/02/15 16:47:59 christos Exp $ */
 
 /*
  * System call argument lists.
diff -r 349a12df62a9 -r e1d45022cfdf sys/compat/linux/arch/alpha/linux_syscalls.c
--- a/sys/compat/linux/arch/alpha/linux_syscalls.c      Fri Feb 15 12:42:34 2002 +0000
+++ b/sys/compat/linux/arch/alpha/linux_syscalls.c      Fri Feb 15 16:47:58 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_syscalls.c,v 1.42 2001/11/13 02:08:36 lukem Exp $ */
+/* $NetBSD: linux_syscalls.c,v 1.43 2002/02/15 16:47:59 christos Exp $ */
 
 /*
  * System call names.
@@ -8,7 +8,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.42 2001/11/13 02:08:36 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.43 2002/02/15 16:47:59 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #if defined(_KERNEL_OPT)
diff -r 349a12df62a9 -r e1d45022cfdf sys/compat/linux/arch/alpha/linux_sysent.c
--- a/sys/compat/linux/arch/alpha/linux_sysent.c        Fri Feb 15 12:42:34 2002 +0000
+++ b/sys/compat/linux/arch/alpha/linux_sysent.c        Fri Feb 15 16:47:58 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_sysent.c,v 1.41 2001/11/13 02:08:37 lukem Exp $ */
+/* $NetBSD: linux_sysent.c,v 1.42 2002/02/15 16:47:59 christos Exp $ */
 
 /*
  * System call switch table.
@@ -8,7 +8,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_sysent.c,v 1.41 2001/11/13 02:08:37 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_sysent.c,v 1.42 2002/02/15 16:47:59 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_sysv.h"
diff -r 349a12df62a9 -r e1d45022cfdf sys/compat/linux/arch/alpha/syscalls.master
--- a/sys/compat/linux/arch/alpha/syscalls.master       Fri Feb 15 12:42:34 2002 +0000
+++ b/sys/compat/linux/arch/alpha/syscalls.master       Fri Feb 15 16:47:58 2002 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.36 2001/09/08 07:09:43 manu Exp $
+       $NetBSD: syscalls.master,v 1.37 2002/02/15 16:47:59 christos Exp $
 ;
 ;      @(#)syscalls.master     8.1 (Berkeley) 7/19/93
 
@@ -341,8 +341,11 @@
 188    UNIMPL
 189    UNIMPL
 190    UNIMPL
-191    UNIMPL
-192    UNIMPL
+/* XXX: Dunno */
+191    STD             { int linux_sys_ugetrlimit(int which, \
+                           struct rlimit *rlp); }
+192    STD             { int linux_sys_mmap2(void *addr, size_t len, \
+                           int prot, int flags, int fd, off_t offset); }
 193    UNIMPL
 194    UNIMPL
 195    UNIMPL
diff -r 349a12df62a9 -r e1d45022cfdf sys/compat/linux/arch/arm/linux_machdep.c
--- a/sys/compat/linux/arch/arm/linux_machdep.c Fri Feb 15 12:42:34 2002 +0000
+++ b/sys/compat/linux/arch/arm/linux_machdep.c Fri Feb 15 16:47:58 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_machdep.c,v 1.3 2002/02/02 16:52:45 bjh21 Exp $  */
+/*     $NetBSD: linux_machdep.c,v 1.4 2002/02/15 16:47:59 christos Exp $       */
 
 /*-
  * Copyright (c) 1995, 2000 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.3 2002/02/02 16:52:45 bjh21 Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.4 2002/02/15 16:47:59 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -278,8 +278,9 @@
  * major device numbers remapping
  */
 dev_t
-linux_fakedev(dev)
+linux_fakedev(dev, raw)
        dev_t dev;
+       int raw;
 {
   /* XXX write me */
   return dev;
diff -r 349a12df62a9 -r e1d45022cfdf sys/compat/linux/arch/arm/linux_machdep.h
--- a/sys/compat/linux/arch/arm/linux_machdep.h Fri Feb 15 12:42:34 2002 +0000
+++ b/sys/compat/linux/arch/arm/linux_machdep.h Fri Feb 15 16:47:58 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_machdep.h,v 1.2 2002/01/17 22:50:38 bjh21 Exp $  */
+/*     $NetBSD: linux_machdep.h,v 1.3 2002/02/15 16:47:59 christos Exp $       */
 
 /*-
  * Copyright (c) 1995, 2000 The NetBSD Foundation, Inc.
@@ -39,6 +39,8 @@
 #ifndef _ARM_LINUX_MACHDEP_H_
 #define _ARM_LINUX_MACHDEP_H_
 
+#include <compat/linux/common/linux_signal.h>
+
 struct linux_sigcontext {
        u_int32_t       sc_trapno;
        u_int32_t       sc_error_code;
@@ -75,11 +77,4 @@
        unsigned long   sf_extramask[LINUX__NSIG_WORDS - 1];
 };
 
-#ifdef _KERNEL
-__BEGIN_DECLS
-void linux_sendsig __P((sig_t, int, sigset_t *, u_long));
-dev_t linux_fakedev __P((dev_t));
-__END_DECLS
-#endif /* _KERNEL */
-
 #endif
diff -r 349a12df62a9 -r e1d45022cfdf sys/compat/linux/arch/arm/linux_syscall.h
--- a/sys/compat/linux/arch/arm/linux_syscall.h Fri Feb 15 12:42:34 2002 +0000
+++ b/sys/compat/linux/arch/arm/linux_syscall.h Fri Feb 15 16:47:58 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_syscall.h,v 1.6 2002/01/27 15:28:22 bjh21 Exp $ */
+/* $NetBSD: linux_syscall.h,v 1.7 2002/02/15 16:47:59 christos Exp $ */
 
 /*
  * System call numbers.
@@ -466,6 +466,9 @@
 /* syscall: "vfork" ret: "int" args: */
 #define        LINUX_SYS_vfork 190
 
+/* syscall: "mmap2" ret: "int" args: "void *" "size_t" "int" "int" "int" "off_t" */
+#define        LINUX_SYS_mmap2 192
+
 /* syscall: "truncate64" ret: "int" args: "const char *" "off_t" */
 #define        LINUX_SYS_truncate64    193
 
diff -r 349a12df62a9 -r e1d45022cfdf sys/compat/linux/arch/arm/linux_syscallargs.h
--- a/sys/compat/linux/arch/arm/linux_syscallargs.h     Fri Feb 15 12:42:34 2002 +0000
+++ b/sys/compat/linux/arch/arm/linux_syscallargs.h     Fri Feb 15 16:47:58 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_syscallargs.h,v 1.6 2002/01/27 15:28:22 bjh21 Exp $ */
+/* $NetBSD: linux_syscallargs.h,v 1.7 2002/02/15 16:47:59 christos Exp $ */
 
 /*
  * System call argument lists.
@@ -489,6 +489,15 @@
        syscallarg(struct linux_sigaltstack *) oss;
 };
 
+struct linux_sys_mmap2_args {
+       syscallarg(void *) addr;
+       syscallarg(size_t) len;
+       syscallarg(int) prot;
+       syscallarg(int) flags;
+       syscallarg(int) fd;
+       syscallarg(off_t) offset;
+};
+
 struct linux_sys_truncate64_args {
        syscallarg(const char *) path;
        syscallarg(off_t) length;
@@ -682,6 +691,7 @@
 int    sys___getcwd(struct proc *, void *, register_t *);
 int    linux_sys_sigaltstack(struct proc *, void *, register_t *);
 int    sys___vfork14(struct proc *, void *, register_t *);
+int    linux_sys_mmap2(struct proc *, void *, register_t *);
 int    linux_sys_truncate64(struct proc *, void *, register_t *);
 int    sys_ftruncate(struct proc *, void *, register_t *);
 int    linux_sys_stat64(struct proc *, void *, register_t *);
diff -r 349a12df62a9 -r e1d45022cfdf sys/compat/linux/arch/arm/linux_syscalls.c
--- a/sys/compat/linux/arch/arm/linux_syscalls.c        Fri Feb 15 12:42:34 2002 +0000
+++ b/sys/compat/linux/arch/arm/linux_syscalls.c        Fri Feb 15 16:47:58 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_syscalls.c,v 1.6 2002/01/27 15:28:22 bjh21 Exp $ */
+/* $NetBSD: linux_syscalls.c,v 1.7 2002/02/15 16:47:59 christos Exp $ */
 
 /*
  * System call names.
@@ -8,7 +8,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.6 2002/01/27 15:28:22 bjh21 Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.7 2002/02/15 16:47:59 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #if defined(_KERNEL_OPT)
@@ -224,7 +224,7 @@
        "#189 (unimplemented putpmsg)",         /* 189 = unimplemented putpmsg */
        "vfork",                        /* 190 = vfork */
        "#191 (unimplemented getrlimit)",               /* 191 = unimplemented getrlimit */
-       "#192 (unimplemented mmap2)",           /* 192 = unimplemented mmap2 */
+       "mmap2",                        /* 192 = mmap2 */
        "truncate64",                   /* 193 = truncate64 */
        "ftruncate64",                  /* 194 = ftruncate64 */
        "stat64",                       /* 195 = stat64 */
diff -r 349a12df62a9 -r e1d45022cfdf sys/compat/linux/arch/arm/linux_sysent.c
--- a/sys/compat/linux/arch/arm/linux_sysent.c  Fri Feb 15 12:42:34 2002 +0000
+++ b/sys/compat/linux/arch/arm/linux_sysent.c  Fri Feb 15 16:47:58 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_sysent.c,v 1.6 2002/01/27 15:28:22 bjh21 Exp $ */
+/* $NetBSD: linux_sysent.c,v 1.7 2002/02/15 16:47:59 christos Exp $ */
 
 /*
  * System call switch table.



Home | Main Index | Thread Index | Old Index