Subject: Re: port-amd64/32303: -current amd64 kernel compilation failure with options COMPAT_LINUX
To: None <port-amd64-maintainer@NetBSD.org, gnats-admin@NetBSD.org,>
From: Nicolas Joly <njoly@pasteur.fr>
List: netbsd-bugs
Date: 12/16/2005 13:55:42
On Wed, Dec 14, 2005 at 05:05:00PM +0000, Nicolas Joly wrote:
> >Number: 32303
> >Category: port-amd64
> >Synopsis: -current amd64 kernel compilation failure with options COMPAT_LINUX
[...]
> >Description:
> With recent ktrace-lwp branch merge to head, -current amd64 kernels does not
> compile anymore with COMPAT_LINUX. The amd64 part of the code seems to needs
> some proc -> lwp tweaking.
I just got some time to look into this ...
The following patch fix the kernel compilation failure. I also checked
that linux programs i test are running again.
Index: sys/compat/linux/arch/amd64/linux_exec.h
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/amd64/linux_exec.h,v
retrieving revision 1.2
diff -u -r1.2 linux_exec.h
--- sys/compat/linux/arch/amd64/linux_exec.h 11 Dec 2005 12:20:14 -0000 1.2
+++ sys/compat/linux/arch/amd64/linux_exec.h 16 Dec 2005 12:47:29 -0000
@@ -63,6 +63,6 @@
/* we have special powerpc ELF copyargs */
#define LINUX_MACHDEP_ELF_COPYARGS
-int linux_exec_setup_stack(struct proc *, struct exec_package *);
+int linux_exec_setup_stack(struct lwp *, struct exec_package *);
#endif /* !_AMD64_LINUX_EXEC_H */
Index: sys/compat/linux/arch/amd64/linux_exec_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/amd64/linux_exec_machdep.c,v
retrieving revision 1.4
diff -u -r1.4 linux_exec_machdep.c
--- sys/compat/linux/arch/amd64/linux_exec_machdep.c 14 Dec 2005 18:33:32 -0000 1.4
+++ sys/compat/linux/arch/amd64/linux_exec_machdep.c 16 Dec 2005 12:47:29 -0000
@@ -119,8 +119,8 @@
}
int
-ELFNAME2(linux,copyargs)(p, pack, arginfo, stackp, argp)
- struct proc *p;
+ELFNAME2(linux,copyargs)(l, pack, arginfo, stackp, argp)
+ struct lwp *l;
struct exec_package *pack;
struct ps_strings *arginfo;
char **stackp;
@@ -128,7 +128,8 @@
{
struct linux_extra_stack_data64 *esdp, esd;
struct elf_args *ap;
- struct vattr *vap;
+ struct vattr *vap;
+ struct proc *p = l->l_proc;
Elf_Ehdr *eh;
Elf_Phdr *ph;
u_long phsize;
@@ -136,7 +137,7 @@
int error;
int i;
- if ((error = copyargs(p, pack, arginfo, stackp, argp)) != 0)
+ if ((error = copyargs(l, pack, arginfo, stackp, argp)) != 0)
return error;
/*
@@ -155,7 +156,7 @@
if (ap == NULL) {
phsize = eh->e_phnum * sizeof(Elf_Phdr);
ph = (Elf_Phdr *)malloc(phsize, M_TEMP, M_WAITOK);
- error = exec_read_from(p, pack->ep_vp, eh->e_phoff, ph, phsize);
+ error = exec_read_from(l, pack->ep_vp, eh->e_phoff, ph, phsize);
if (error != 0) {
for (i = 0; i < eh->e_phnum; i++) {
if (ph[i].p_type == PT_PHDR) {
Index: sys/compat/linux/arch/amd64/linux_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/amd64/linux_machdep.c,v
retrieving revision 1.12
diff -u -r1.12 linux_machdep.c
--- sys/compat/linux/arch/amd64/linux_machdep.c 11 Dec 2005 12:20:14 -0000 1.12
+++ sys/compat/linux/arch/amd64/linux_machdep.c 16 Dec 2005 12:47:29 -0000
@@ -342,8 +342,8 @@
}
int
-linux_machdepioctl(p, v, retval)
- struct proc *p;
+linux_machdepioctl(l, v, retval)
+ struct lwp *l;
void *v;
register_t *retval;
{
--
Nicolas Joly
Biological Software and Databanks.
Institut Pasteur, Paris.