Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 08-16-2010, 08:16 AM   #1
LQ Newbie
Registered: Oct 2009
Posts: 20

Rep: Reputation: 0
Distinguish between kernel and user space


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
Old 08-16-2010, 11:55 AM   #2
Registered: Apr 2007
Location: Philippines
Distribution: Kubuntu, Ubuntu, CentOS
Posts: 289

Rep: Reputation: 41
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

Old 08-17-2010, 02:14 AM   #3
LQ Newbie
Registered: Oct 2009
Posts: 20

Original Poster
Rep: Reputation: 0
@archieval ... thanks


kernel, linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Division of Logical Memory Space in to User Space and Kernel Space shreshtha Linux - Newbie 2 01-14-2010 10:59 AM
Do we have any chance of calling user space callback function from kernel space? ravishankar.g Linux - Newbie 1 09-22-2009 08:14 PM
how to call socket prog code written in user space from kernel space???HELP kurt2 Programming 2 07-15-2009 10:56 PM > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 08:28 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration