LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

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

Rep: Reputation: 0
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
 
Old 08-16-2010, 10:55 AM   #2
archieval
Member
 
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

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

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


Reply

Tags
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 09:59 AM
Do we have any chance of calling user space callback function from kernel space? ravishankar.g Linux - Newbie 1 09-22-2009 07:14 PM
how to call socket prog code written in user space from kernel space???HELP kurt2 Programming 2 07-15-2009 09:56 PM


All times are GMT -5. The time now is 03:00 AM.

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