Subject: Re: Mapping 2 compat linux32 syscalls on a single native one
To: None <tech-kern@netbsd.org>
From: Christos Zoulas <christos@astron.com>
List: tech-kern
Date: 01/29/2007 15:50:12
In article <20070129152622.GA437890@medusa.sis.pasteur.fr>,
Nicolas Joly  <njoly@pasteur.fr> wrote:
>
>Hi,
>
>I encountered a small problem while trying to map 2 amd64 compat
>linux32 syscalls (linux32_sys_exit and linux32_sys_exit_groups) on the
>native sys_exit one.
>
>1       NOARGS  { int sys_exit(int rval); }
>252     NOARGS  { int sys_exit(int rval); }
>
>Unfortunately this won't work, because of LINUX32_SYS_exit multiple
>definitions ...
>
>njoly@lanfeust [arch/amd64]> grep LINUX32_SYS_exit linux32_syscall.h
>#define LINUX32_SYS_exit        1
>#define LINUX32_SYS_exit        252
>
>Then i changed the second call from NOARGS to NODEF, but this doesn't
>work either because of `sys_exit_args' redefinition.
>
>In file included from ./machine/linux32_machdep.h:11,
>                 from /tmp/genassym.7132/assym.c:27:
>/local/src/NetBSD/src/sys/compat/linux32/arch/amd64/linux32_syscallargs.h:402:
>error: redefinition of 'struct sys_exit_args'
>
>I think that i need both NODEF and NOARGS to handle this
>case. Unfortunately, setting both flags at the same time does not
>seems to be supported.
>
>For now, i use a dummy linux32_sys_exit_group(), which only calls
>sys_exit() ...
>
>252     NOARGS  { int linux32_sys_exit_group(int error_code); }
>
>int
>linux32_sys_exit_group(l, v, retval)
>        struct lwp *l;
>        void *v;
>        register_t *retval;
>{
>        return sys_exit(l, v, retval);
>}
>
>Is there a better way to handle this ?

There is an implementation already for exit_group that kills all threads
in a process in compat/linux/common. Why don't you use this?

christos