Source-Changes-HG archive

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

[src/trunk]: src/sys/compat Adjust to the new copyargs() footprint.



details:   https://anonhg.NetBSD.org/src/rev/75b70b15cb8c
branches:  trunk
changeset: 513372:75b70b15cb8c
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Jul 29 21:28:45 2001 +0000

description:
Adjust to the new copyargs() footprint.

diffstat:

 sys/compat/linux/arch/alpha/linux_exec.h           |   8 +-
 sys/compat/linux/arch/alpha/linux_exec_alpha.c     |  20 +++---
 sys/compat/linux/arch/powerpc/linux_exec.h         |   6 +-
 sys/compat/linux/arch/powerpc/linux_exec_powerpc.c |  36 ++++++------
 sys/compat/linux/common/linux_exec.h               |   6 +-
 sys/compat/linux/common/linux_exec_aout.c          |  60 +++++++++++----------
 sys/compat/netbsd32/netbsd32_exec.h                |  54 +++++++++++--------
 sys/compat/netbsd32/netbsd32_exec_elf32.c          |  21 +++----
 sys/compat/osf1/osf1_exec.h                        |   5 +-
 sys/compat/osf1/osf1_exec_ecoff.c                  |  39 ++++++-------
 sys/compat/pecoff/pecoff_exec.c                    |  27 ++++-----
 sys/compat/pecoff/pecoff_exec.h                    |   6 +-
 sys/compat/svr4/svr4_exec.h                        |  10 +-
 sys/compat/svr4/svr4_exec_elf32.c                  |  18 ++++--
 sys/compat/svr4/svr4_exec_elf64.c                  |  18 ++++--
 sys/compat/svr4_32/svr4_32_exec.h                  |   6 +-
 sys/compat/svr4_32/svr4_32_exec_elf32.c            |  46 ++++++++--------
 17 files changed, 200 insertions(+), 186 deletions(-)

diffs (truncated from 872 to 300 lines):

diff -r 8e034940f058 -r 75b70b15cb8c sys/compat/linux/arch/alpha/linux_exec.h
--- a/sys/compat/linux/arch/alpha/linux_exec.h  Sun Jul 29 21:28:20 2001 +0000
+++ b/sys/compat/linux/arch/alpha/linux_exec.h  Sun Jul 29 21:28:45 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_exec.h,v 1.3 2001/06/22 05:12:42 simonb Exp $    */
+/*     $NetBSD: linux_exec.h,v 1.4 2001/07/29 21:28:45 christos Exp $  */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -85,10 +85,12 @@
 #ifdef _KERNEL
 __BEGIN_DECLS
 #ifdef EXEC_ELF32
-void *linux_elf32_copyargs __P((struct exec_package *, struct ps_strings *, void *, void *));
+int linux_elf32_copyargs __P((struct exec_package *, struct ps_strings *,
+    char **, void *));
 #endif
 #ifdef EXEC_ELF64
-void *linux_elf64_copyargs __P((struct exec_package *, struct ps_strings *, void *, void *));
+int linux_elf64_copyargs __P((struct exec_package *, struct ps_strings *,
+    char **, void *));
 #endif
 __END_DECLS
 #endif /* !_KERNEL */
diff -r 8e034940f058 -r 75b70b15cb8c sys/compat/linux/arch/alpha/linux_exec_alpha.c
--- a/sys/compat/linux/arch/alpha/linux_exec_alpha.c    Sun Jul 29 21:28:20 2001 +0000
+++ b/sys/compat/linux/arch/alpha/linux_exec_alpha.c    Sun Jul 29 21:28:45 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_exec_alpha.c,v 1.2 2001/01/18 17:48:04 tv Exp $  */
+/*     $NetBSD: linux_exec_alpha.c,v 1.3 2001/07/29 21:28:45 christos Exp $    */
 
 #define ELFSIZE 64
 
@@ -19,17 +19,17 @@
  * XXX port.  If so, move it to common/linux_exec_elf32.c
  * XXX included based on some define.
  */
-void *
+int
 ELFNAME2(linux,copyargs)(struct exec_package *pack, struct ps_strings *arginfo,        
-                        void *stack, void *argp)
+    char **stackp, void *argp)
 {
        size_t len;
        LinuxAuxInfo ai[LINUX_ELF_AUX_ENTRIES], *a;
        struct elf_args *ap;
+       int error;
 
-       stack = copyargs(pack, arginfo, stack, argp);
-       if (!stack)
-               return(NULL);
+       if ((error = copyargs(pack, arginfo, stackp, argp)) != 0)
+               return error;
 
        memset(ai, 0, sizeof(LinuxAuxInfo) * LINUX_ELF_AUX_ENTRIES);
 
@@ -104,9 +104,9 @@
        a++;
 
        len = (a - ai) * sizeof(LinuxAuxInfo);
-       if (copyout(ai, stack, len))
-               return NULL;
-       stack = (caddr_t)stack + len;
+       if ((error = copyout(ai, *stackp, len)) != 0)
+               return error;
+       *stackp += len;
 
-       return(stack);
+       return 0;
 }
diff -r 8e034940f058 -r 75b70b15cb8c sys/compat/linux/arch/powerpc/linux_exec.h
--- a/sys/compat/linux/arch/powerpc/linux_exec.h        Sun Jul 29 21:28:20 2001 +0000
+++ b/sys/compat/linux/arch/powerpc/linux_exec.h        Sun Jul 29 21:28:45 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_exec.h,v 1.3 2001/07/26 22:53:14 wiz Exp $  */
+/*     $NetBSD: linux_exec.h,v 1.4 2001/07/29 21:28:45 christos Exp $  */
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -116,8 +116,8 @@
 
 #ifdef _KERNEL
 __BEGIN_DECLS
-void * linux_elf32_copyargs __P((struct exec_package *,
-    struct ps_strings *, void *, void *)); 
+int linux_elf32_copyargs __P((struct exec_package *,
+    struct ps_strings *, char **, void *)); 
 __END_DECLS
 #endif /* _KERNEL */
 
diff -r 8e034940f058 -r 75b70b15cb8c sys/compat/linux/arch/powerpc/linux_exec_powerpc.c
--- a/sys/compat/linux/arch/powerpc/linux_exec_powerpc.c        Sun Jul 29 21:28:20 2001 +0000
+++ b/sys/compat/linux/arch/powerpc/linux_exec_powerpc.c        Sun Jul 29 21:28:45 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_exec_powerpc.c,v 1.3 2001/06/13 23:10:31 wiz Exp $ */
+/* $NetBSD: linux_exec_powerpc.c,v 1.4 2001/07/29 21:28:45 christos Exp $ */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -72,11 +72,11 @@
 /*
  * Alpha and PowerPC specific linux copyargs function.
  */
-void *
-ELFNAME2(linux,copyargs)(pack, arginfo, stack, argp)
+int
+ELFNAME2(linux,copyargs)(pack, arginfo, stackp, argp)
        struct exec_package *pack;
        struct ps_strings *arginfo;
-       void *stack;
+       char **stackp;
        void *argp;
 {
        size_t len;
@@ -88,6 +88,7 @@
        char    linux_sp_wrap_code[LINUX_SP_WRAP];
        unsigned long*  cga;
 #endif
+       int error;
 
 #ifdef LINUX_SHIFT
        /* 
@@ -95,12 +96,11 @@
         * aligned address. And we need one more 16 byte shift if it was already
         * 16 bytes aligned,    
         */
-       (unsigned long)stack = ((unsigned long)stack - 1) & ~LINUX_SHIFT; 
+       *stackp = (char *)((unsigned long)*stackp - 1) & ~LINUX_SHIFT; 
 #endif
 
-       stack = copyargs(pack, arginfo, stack, argp);
-       if (!stack)
-               return(NULL);
+       if ((error = copyargs(pack, arginfo, stackp, argp)) != 0)
+               return error;
 
 #ifdef LINUX_SHIFT
        /* 
@@ -108,7 +108,8 @@
         * expects the ELF auxiliary table to start on a 16 bytes boundary on
         * the PowerPC.
         */
-       stack = (void *)(((unsigned long) stack + LINUX_SHIFT) & ~LINUX_SHIFT);
+       *stackp = (char *)(((unsigned long)(*stackp) + LINUX_SHIFT)
+           & ~LINUX_SHIFT);
 #endif 
 
        memset(ai, 0, sizeof(LinuxAuxInfo) * LINUX_ELF_AUX_ENTRIES);
@@ -205,20 +206,21 @@
 
 #ifdef LINUX_SP_WRAP
        if (prog_entry != NULL) 
-               prog_entry->a_v = (unsigned long)stack + len;
+               prog_entry->a_v = (unsigned long)(*stackp) + len;
 #endif
 
-       if (copyout(ai, stack, len))
-               return NULL;
-       stack = (caddr_t)stack + len; 
+       if ((error = copyout(ai, *stackp, len)) != 0)
+               return error;
+       *stackp += len; 
 
 #ifdef LINUX_SP_WRAP
        if (prog_entry != NULL) {
-               if (copyout(linux_sp_wrap_code, stack, LINUX_SP_WRAP))
-                       return NULL;
-               stack = (caddr_t)stack + LINUX_SP_WRAP;
+               if ((error = copyout(linux_sp_wrap_code, *stackp,
+                   LINUX_SP_WRAP)) != 0)
+                       return error;
+               *stackp += LINUX_SP_WRAP;
        }
 #endif
 
-       return(stack);
+       return 0;
 }
diff -r 8e034940f058 -r 75b70b15cb8c sys/compat/linux/common/linux_exec.h
--- a/sys/compat/linux/common/linux_exec.h      Sun Jul 29 21:28:20 2001 +0000
+++ b/sys/compat/linux/common/linux_exec.h      Sun Jul 29 21:28:45 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_exec.h,v 1.15 2001/06/18 02:00:53 christos Exp $ */
+/*     $NetBSD: linux_exec.h,v 1.16 2001/07/29 21:28:45 christos Exp $ */
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -93,8 +93,8 @@
 
 void linux_setregs __P((struct proc *, struct exec_package *, u_long));
 int exec_linux_aout_makecmds __P((struct proc *, struct exec_package *));
-void *linux_aout_copyargs __P((struct exec_package *,
-    struct ps_strings *, void *, void *));
+int linux_aout_copyargs __P((struct exec_package *, struct ps_strings *,
+    char **, void *));
 void linux_trapsignal __P((struct proc *, int, u_long));
 
 #ifdef EXEC_ELF32
diff -r 8e034940f058 -r 75b70b15cb8c sys/compat/linux/common/linux_exec_aout.c
--- a/sys/compat/linux/common/linux_exec_aout.c Sun Jul 29 21:28:20 2001 +0000
+++ b/sys/compat/linux/common/linux_exec_aout.c Sun Jul 29 21:28:45 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_exec_aout.c,v 1.44 2000/12/01 13:49:35 jdolecek Exp $    */
+/*     $NetBSD: linux_exec_aout.c,v 1.45 2001/07/29 21:28:46 christos Exp $    */
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -66,40 +66,41 @@
 #include <compat/linux/linux_syscallargs.h>
 #include <compat/linux/linux_syscall.h>
 
-void *linux_aout_copyargs __P((struct exec_package *,
-    struct ps_strings *, void *, void *));
+int linux_aout_copyargs __P((struct exec_package *, struct ps_strings *,
+    char **, void *));
 
 static int exec_linux_aout_prep_zmagic __P((struct proc *,
-       struct exec_package *));
+    struct exec_package *));
 static int exec_linux_aout_prep_nmagic __P((struct proc *,
-       struct exec_package *));
+    struct exec_package *));
 static int exec_linux_aout_prep_omagic __P((struct proc *,
-       struct exec_package *));
+    struct exec_package *));
 static int exec_linux_aout_prep_qmagic __P((struct proc *,
-       struct exec_package *));
+    struct exec_package *));
 
-void *
-linux_aout_copyargs(pack, arginfo, stack, argp)
+int
+linux_aout_copyargs(pack, arginfo, stackp, argp)
        struct exec_package *pack;
        struct ps_strings *arginfo;
-       void *stack;
+       char **stackp;
        void *argp;
 {
-       char **cpp = stack;
-       char **stk = stack;
+       char **cpp = (char **)*stackp;
+       char **stk = (char **)*stackp;
        char *dp, *sp;
        size_t len;
        void *nullp = NULL;
        int argc = arginfo->ps_nargvstr;
        int envc = arginfo->ps_nenvstr;
+       int error;
 
-       if (copyout(&argc, cpp++, sizeof(argc)))
-               return NULL;
+       if ((error = copyout(&argc, cpp++, sizeof(argc))) != 0)
+               return error;
 
        /* leave room for envp and argv */
        cpp += 2;
-       if (copyout(&cpp, &stk[1], sizeof (cpp)))
-               return NULL;
+       if ((error = copyout(&cpp, &stk[1], sizeof (cpp))) != 0)
+               return error;
 
        dp = (char *) (cpp + argc + envc + 2);
        sp = argp;
@@ -108,27 +109,28 @@
        arginfo->ps_argvstr = cpp; /* remember location of argv for later */
 
        for (; --argc >= 0; sp += len, dp += len)
-               if (copyout(&dp, cpp++, sizeof(dp)) ||
-                   copyoutstr(sp, dp, ARG_MAX, &len))
-                       return NULL;
+               if ((error = copyout(&dp, cpp++, sizeof(dp))) != 0 ||
+                   (error = copyoutstr(sp, dp, ARG_MAX, &len)) != 0)
+                       return error;
 
-       if (copyout(&nullp, cpp++, sizeof(nullp)))
-               return NULL;
+       if ((error = copyout(&nullp, cpp++, sizeof(nullp))) != 0)
+               return error;
 
-       if (copyout(&cpp, &stk[2], sizeof (cpp)))
-               return NULL;
+       if ((error = copyout(&cpp, &stk[2], sizeof (cpp))) != 0)
+               return error;
 
        arginfo->ps_envstr = cpp; /* remember location of envp for later */
 
        for (; --envc >= 0; sp += len, dp += len)
-               if (copyout(&dp, cpp++, sizeof(dp)) ||
-                   copyoutstr(sp, dp, ARG_MAX, &len))
-                       return NULL;
+               if ((error = copyout(&dp, cpp++, sizeof(dp))) != 0 ||
+                   (error = copyoutstr(sp, dp, ARG_MAX, &len)) != 0)
+                       return error;
 
-       if (copyout(&nullp, cpp++, sizeof(nullp)))
-               return NULL;
+       if ((error = copyout(&nullp, cpp++, sizeof(nullp))) != 0)
+               return error;
 



Home | Main Index | Thread Index | Old Index