[ENBD] enbd_ioctl 2.6.9 kernel fails to modprobe enbd - seg fault

scunacc scunacc at yahoo.com
Thu Mar 2 12:18:13 MST 2006


Dear Peter et al.,

I much appreciate your ongoing help with this. I really do want to get
this code in and working - so it is all very useful if we get to a point
of fixing things.

> There is no such function in my code. That line is
> 
>           sock = accept (self->socket, (struct sockaddr *) &addrin, &addrinlen);
> 
> It must be the defn
> 
>            int addrinlen = sizeof (addrin);
> 
> Change the defn to  match whatever your manual page says the third
> argument of accept(2) should be.  Socklen_t*? So write instead
> 
> 
>           socklen_t addrinlen = sizeof (addrin);

OK. But that's just a warning. 

> > /home/sysadmin/net_disk/nbd-2.4.33/nbd/enbd-server.c: In function
> > ___slavesighandler___:
> > /home/sysadmin/net_disk/nbd-2.4.33/nbd/enbd-server.c:1234: error:
> > invalid storage class for function ___nullsigchldhandler___
> 
> That line is a forward declaration:
> 
>        static void nullsigchldhandler();
> 
> The function itself is declared later. Simply move the forward declaration
> higher up the code. That is a compiler bug.

Yes I agree - but in gcc 4.

> > -------------------------------
> > Now, if I "fix" that by moving the declaration at 1234 just above
> > outside of the function it's in, it continues, and compiles up to the
> > following:....
> > 
> > -------------------------------
> > .......
> > 
> > gcc -D_LARGEFILE64_SOURCE=1 -D_LARGEFILE_SOURCE=1 -D_GNU_SOURCE=1
> > -D_XOPEN_SOURCE=1 -D_FILE_OFFSET_BITS=64 -Wall -Winline -O2  -I/tmp/enbd
> > -I/home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include
> > -I/lib/modules/2.6.9-cm46customVM/build/include  -D__SMP__
> > -DCONFIG_X86_LOCAL_APIC -DUSING_SSL=1  -DDEBUG=0 -o ioctl.o
> > -c /home/sysadmin/net_disk/nbd-2.4.33/nbd/ioctl.c
> 
> Well, we need some ioctl defs. It looks like the wrong header is being
> included. You probably don't want a kernel header, but instead a
> sanitised one for user consumption. I would suggest the option
> 
> 
>      -I/lib/modules/2.6.9-cm46customVM/build/include
> 
> is WRONG.  Don't point at your kernel code for userspace compiles. Set
> something like KERNELDIR=/usr . Take it from there.


Where is KERNELDIR ?

Not in any of your code. Do you mean KERNELDIR or something else?
LINUXDIR? 

What then does it do with the 2.6 make system if so?

Tad confused here. I didn't do anything to set that - it picked it up
from uname -r from this line in the Makefile:

# where the kernel sources are     - alter to suit
LINUXDIR    := /lib/modules/$(shell uname -r)/build

and I imagine:

line 299:

                               -I$(LINUXDIR)/include \

What should I do here?


> Extreme grunginess from nasty nasty kernel headers in userspace.

Right :-)

Kind regards

Derek.



More information about the ENBD mailing list