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

Grissiom chaos.proton at gmail.com
Wed Oct 23 05:19:36 EDT 2013


Hi,

On Wed, Oct 23, 2013 at 1:46 PM, Saket Sinha <saket.sinha89 at gmail.com>wrote:

> Hi,
>
> I want to write a kernel module which depends on the kernel type (32 or 64
> bit). There are some lines of code which I want to be included in the
> module if and only if the kernel is 32 bit and some lines of code which
> should be included if kernel is 64 bit.
>
> Is there anything like #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) for
> this case ?
>
> 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?
>
> Regards,
>
> Saket Sinha
>
>
> User space program may test the arch on the fly by `uname -m`. However, I
don't know the counter part in the kernel space.

-- 
Cheers,
Grissiom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20131023/aa9e66be/attachment.html 


More information about the Kernelnewbies mailing list