Determining 32bit or 64bit OS from a running kernel module

Valdis.Kletnieks at vt.edu Valdis.Kletnieks at vt.edu
Wed Oct 23 08:41:29 EDT 2013


On Wed, 23 Oct 2013 11:16:23 +0530, Saket Sinha said:

> I want to write a kernel module which depends on the kernel type (32 or 64
> bit)

In general, that's probably very bad software design.  If you're a module,
you probably shouldn't be mucking with stuff that's 32/64 bit dependent,
and you should be trying to write code that doesn't care (witness the botch that
most people make of ioctl parameters that aren't the same layout for 32 or
64 bit).

However, it's possible you have an actual sane use case for caring inside
a module.

> I know we have CONFIG_X86_64 and CONFIG_X86_32 for  x86 architecture but
> how do I exactly check it in my module code?

I'm totally failing to understand why '#ifdef CONFIG_X86_64' isn't sufficient?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20131023/9a1bf09f/attachment.bin 


More information about the Kernelnewbies mailing list