Linux内核中的__KERNEL__是什么? [英] what is __KERNEL__ used for in linux kernel?
本文介绍了Linux内核中的__KERNEL__是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谁可以解释以下代码的含义?
who can explain what does the following code means?
如果未定义__KERNEL__
,请定义以下宏.
何时何地定义__KERNEL__
?
if __KERNEL__
is not defined, define following macros.
when and where define __KERNEL__
?
/* only for userspace compatibility */
#ifndef __KERNEL__
/* IP6 Hooks */
/* After promisc drops, checksum checks. */
#define NF_IP6_PRE_ROUTING 0
/* If the packet is destined for this box. */
#define NF_IP6_LOCAL_IN 1
/* If the packet is destined for another interface. */
#define NF_IP6_FORWARD 2
/* Packets coming from a local process. */
#define NF_IP6_LOCAL_OUT 3
/* Packets about to hit the wire. */
#define NF_IP6_POST_ROUTING 4
#define NF_IP6_NUMHOOKS 5
#endif /* ! __KERNEL__ */
推荐答案
编译内核时,在命令行上定义了__KERNEL__
.
When you compile your kernel, __KERNEL__
is defined on the command line.
用户空间程序需要访问内核头,但是内核头中的某些信息仅适用于内核.在#ifdef __KERNEL__/#endif
块中包装一些语句可确保用户空间程序看不到这些语句.
User-space programs need access to the kernel headers, but some of the info in kernel headers is intended only for the kernel. Wrapping some statements in an #ifdef __KERNEL__/#endif
block ensures that user-space programs don't see those statements.
这篇关于Linux内核中的__KERNEL__是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文