使内核头可供用户空间使用(Make kernel headers available to user space)

编程入门 行业动态 更新时间:2024-10-27 06:24:40
使内核头可供用户空间使用(Make kernel headers available to user space)

我已经编写了一个自定义设备驱动程序作为树状内核模块。 此设备驱动程序定义用户空间应用程序所需的一组ioctl。 ioctl在自定义头文件中定义。

应该安装此头文件的标准位置是什么? 这应该是/usr/include吗? 或者也许安装标准内核包含文件的位置相同?

我已阅读此问题,但它没有指定应安装自定义头文件的位置。

I have written a custom device driver as an out of tree kernel module. This device driver defines a set of ioctls that are needed by user space applications. The ioctls are defined in a custom header file.

What is the standard location where this header file should be installed? Should this be /usr/include? Or perhaps the same location where the standard kernel include files are installed?

I have read this question but it does not specify where the custom header files should be installed.

最满意答案

我认为您应该像处理其他任何内容一样处理您的公共用户空间API标头,并将它们放在/usr/include 。 如果它是一个小API,则作为单个文件,或者在子目录中。 只需确保只提供该标题中的必要部分,而不是实现细节。 如果您要为开发人员生成Linux软件包,通常将其命名为foo-dev(APT / Ubuntu)或foo-devel(YUM / RHEL)。

I think you should treat your public user-space API headers like any others, and put them under /usr/include. Either as a single file if it's a small API, or in a subdirectory. Just make sure to provide only the necessary pieces in that header, and not the implementation details. If you're going to produce a Linux package for developers, you'd usually name it like foo-dev (APT/Ubuntu) or foo-devel (YUM/RHEL).

更多推荐

本文发布于:2023-08-04 09:51:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1415355.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:可供   内核   用户   空间   user

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!