谁可以解释下面的代码是什么意思?
如果__KERNEL__未定义,请定义以下宏.何时何地定义__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__ */
Run Code Online (Sandbox Code Playgroud)
Kar*_*tan 27
编译内核时,__KERNEL__在命令行中定义.
用户空间程序需要访问内核头文件,但内核头文件中的某些信息仅适用于内核.在#ifdef __KERNEL__/#endif块中包装一些语句可确保用户空间程序不会看到这些语句.