Linux内核标头的组织 [英] Linux kernel headers' organization

查看:62
本文介绍了Linux内核标头的组织的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在阅读系统调用时,我搜索了syscalls.h以在LXR中找到头文件.搜索结果使我感到困惑. arch/_arch_name_/include/asm下的目录中有十二个syscalls.h文件.没关系,它们是体系结构特定的定义或其他需要的东西.问题是,为什么在include/linuxinclude/asm-generic下我们都有两个不同的syscalls.h标头?

While I was doing some reading on system calls, I did a search for syscalls.h to find the header file in LXR. The search results puzzled me. There is a dozen of syscalls.h files coming from directories under arch/_arch_name_/include/asm. These are ok, they are architecture specific definitions or something else needed. The question is why do we have two different syscalls.h headers under both include/linux and include/asm-generic?

此外,我想找出include/linux标头用于什么以及include/asm-generic标头用于什么.它们之间如何区分?具有两个单独的头文件夹背后的逻辑是什么?它们如何相互联系?

Also, I want to find out that what include/linux headers are for and what include/asm-generic headers are for. How do they differentiate between each other? What is the logic behind having two separate header folders? How do they relate to each other?

谢谢

推荐答案

我在

I've asked this question on Kernel Newbies ML. I got the following answer which makes things clear:

Cihangir Akturk写道:

Cihangir Akturk wrote:

AFAIK,在/include/asm-generic目录中找到的标头用于 独立于体系结构的代码(可能在体系结构之间共享). 您很可能不需要直接包含这些标头,而是 我们通过Architecthure依赖关系间接地包含这些标头 标头.

AFAIK, headers found in /include/asm-generic directory is for architechture independent (probably shared across architectures) code. Most likely you do not need to include these headers directly, instead we include these headers indirectly via architecthure dependent headers.

OTOH,/include/linux目录用于定义通用头文件 内核组件之间的接口.在大多数情况下,您 将在这些标头中找到您需要的所有内核功能.

OTOH, /include/linux directory is for generic header files to define interfaces between components of the kernel. In most situations, you will find all the kernel functionalities you need in these headers.

问候,chngr.

这篇关于Linux内核标头的组织的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆