Subject: Linux_sched.c won't compile (and current can't be built)
To: None <tech-kern@netbsd.org>
From: Vincent <10.50@free.fr>
List: tech-kern
Date: 05/22/2006 09:19:46
Hi,

when trying to compile a current kernel just synchronized from CVS, I 
get that error:
---

cc -march=pentium4 -msse2 -mfpmath=sse -ffreestanding -O2 -Werror -Wall 
-Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes 
-Wstrict-prototypes -Wreturn-type -Wswitch -Wshadow -Wcast-qual 
-Wwrite-strings -Wno-sign-compare -fno-zero-initialized-in-bss -Di386 
-I. -I../../../../contrib/dev/ath/netbsd -I../../../../../common/include 
-I../../../../arch -I../../../.. -nostdinc -DDFLDSIZ=805306368 -DLKM 
-DMAXUSERS=32 -D_KERNEL -D_KERNEL_OPT 
-I../../../../lib/libkern/../../../common/lib/libc/quad 
-I../../../../lib/libkern/../../../common/lib/libc/string 
-I../../../../lib/libkern/../../../common/lib/libc/arch/i386/string 
-I../../../../dist/ipf -c ../../../../compat/linux/common/linux_sched.c
../../../../compat/linux/common/linux_sched.c: In function 
`linux_sys_sched_setparam':
../../../../compat/linux/common/linux_sched.c:196: warning: 
initialization from incompatible pointer type
../../../../compat/linux/common/linux_sched.c:202: error: dereferencing 
pointer to incomplete type
../../../../compat/linux/common/linux_sched.c:203: error: dereferencing 
pointer to incomplete type
../../../../compat/linux/common/linux_sched.c:204: error: structure has 
no member named `p_ucred'
../../../../compat/linux/common/linux_sched.c:205: error: structure has 
no member named `p_ucred'
../../../../compat/linux/common/linux_sched.c: In function 
`linux_sys_sched_getparam':
../../../../compat/linux/common/linux_sched.c:233: warning: 
initialization from incompatible pointer type
../../../../compat/linux/common/linux_sched.c:239: error: dereferencing 
pointer to incomplete type
../../../../compat/linux/common/linux_sched.c:240: error: dereferencing 
pointer to incomplete type
../../../../compat/linux/common/linux_sched.c:241: error: structure has 
no member named `p_ucred'
../../../../compat/linux/common/linux_sched.c:242: error: structure has 
no member named `p_ucred'
../../../../compat/linux/common/linux_sched.c: In function 
`linux_sys_sched_setscheduler':
../../../../compat/linux/common/linux_sched.c:278: warning: 
initialization from incompatible pointer type
../../../../compat/linux/common/linux_sched.c:284: error: dereferencing 
pointer to incomplete type
../../../../compat/linux/common/linux_sched.c:285: error: dereferencing 
pointer to incomplete type
../../../../compat/linux/common/linux_sched.c:286: error: structure has 
no member named `p_ucred'
../../../../compat/linux/common/linux_sched.c:287: error: structure has 
no member named `p_ucred'
../../../../compat/linux/common/linux_sched.c: In function 
`linux_sys_sched_getscheduler':
../../../../compat/linux/common/linux_sched.c:318: warning: 
initialization from incompatible pointer type
../../../../compat/linux/common/linux_sched.c:324: error: dereferencing 
pointer to incomplete type
../../../../compat/linux/common/linux_sched.c:325: error: dereferencing 
pointer to incomplete type
../../../../compat/linux/common/linux_sched.c:326: error: structure has 
no member named `p_ucred'
../../../../compat/linux/common/linux_sched.c:327: error: structure has 
no member named `p_ucred'
*** Error code 1
---

It turns out that the lines:

	if (SCARG(uap, pid) != 0) {
		struct pcred *pc = cp->p_cred;

in linux_sched.c try to assign to a 'struct pcred' the p_cred field of 
the 'struct proc' cp pointer, but that field is no more a 'struct pcred' 
pointer but rather a 'struct kauth_cred', which happens to be used but 
never defined, as a gcc -E easily reveals.

Any clue?

Vincent