Sparc problem: userspace 32 bit, kernel 64 bit

Sparc problem: userspace 32 bit, kernel 64 bit

Post by bart.de.schuy.. » Wed, 30 Jan 2002 08:24:46



Hello,

I have a kernel module and a user tool that interacts with it. Someone
wants to run this on a sparc and it's not working. Turns out the sparc
has a 32 bit userspace and 64 bit kernel.
The userspace/kernel interaction is done with a "struct info" (and
getsockopt/setsockopt). When I print the size of this struct info I
get 28 for userspace and 40 in the kernel! Ofcourse sh*t happens then.
How to solve this? Is there a compiler option for the userspace
program?
Or do I have to go work with annoying "#ifdef" stuff in my header file
that is used by both kernel and userspace. And if yes, can you say
how?

cheers,
Bart

 
 
 

Sparc problem: userspace 32 bit, kernel 64 bit

Post by Pete Zaitc » Wed, 30 Jan 2002 08:52:35


Quote:> The userspace/kernel interaction is done with a "struct info" (and
> getsockopt/setsockopt). When I print the size of this struct info I
> get 28 for userspace and 40 in the kernel! Ofcourse sh*t happens then.
> How to solve this? Is there a compiler option for the userspace
> program?

There is a conversion code somewhere, try to find it.
It re-marshalls setsockopt arguments.

Quote:> Or do I have to go work with annoying "#ifdef" stuff in my header file
> that is used by both kernel and userspace. And if yes, can you say
> how?

You have to maintain two copies of that on Linux, even if
you only build on 32-bitters. The diff(1) and patch(1) are
your friends. Kernel headers must not be included in applications.

-- Pete