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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Saket,

At code level you can check the size of a long. If you are in 32 bit it will be 4 bytes, if you are in 64 bit it will be 8 bytes.

Probably there will be better ways and functions already with this test.

If you want to check it you just have to include the file that has those defines and put your code under a #if .

Best regards,
Nuno Martins



On Wed, Oct 23, 2013 at 6:46 AM, Saket Sinha <saket.sinha89@xxxxxxxxx> 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




_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




--
Nuno Martins
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux