Re: Compiling kernel module ...

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

 



On Fri, Aug 5, 2011 at 5:10 PM, Akash <email2akashjain@xxxxxxxxx> wrote:
Use #if like

#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)
           // New socket create function
#else
           // Old socket create function
#endif

LINUX_VERSION_CODE is defined somewhere in the kernel and you should get to use it easily.


HTH

Akash

I do this in many parts of my code. Issue in this particular case is different. In Vanila kernel this change appears in 2.6.33 and in Scientific Linux this change appears in 2.6.32. So in addition to LINUX_KERNEL_VERSION, I have to use some distribution specific #if.

I was wondwring what is general practice in this regard.
_______________________________________________
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