LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Distinguish between kernel and user space (https://www.linuxquestions.org/questions/linux-kernel-70/distinguish-between-kernel-and-user-space-826520/)

ramukaka 08-16-2010 07:16 AM

Distinguish between kernel and user space
 
Hi,

I have defined a header file for ioctls macros definitions. I am including it in both, my user space application as well as in my device driver. Now there are some macros that I want to be visible only in device drive and some only in user space application. Is there any set of macros defined in linux for such purpose?

Thanks in advance
Ravi Gupta

archieval 08-16-2010 10:55 AM

Add this around your macros. __KERNEL__ is defined only in kernel space so this will isolate your kernel macros from being used in user space.

#if defined(__KERNEL__)

#define YOUR_MACRO

#endif

ramukaka 08-17-2010 01:14 AM

@archieval ... thanks


All times are GMT -5. The time now is 12:04 PM.