【问题标题】:I can't find the header file to include kstat_create method我找不到包含 kstat_create 方法的头文件
【发布时间】:2019-12-19 01:28:31
【问题描述】:

我对 Linux 内核编程非常陌生,我正在尝试向我使用 kstat_create 和 kstat_install 方法的 Linux Ubuntu 18.04 系统添加一个新的系统调用,但我似乎没有找到相应的头文件任何地方。在 Oracle 网站上包含这些方法的行是 sys/types.h 和 sys.kstat.h,我找到了 linux/types.h 而不是 sys/types.h 但是上面的方法在任何地方都没有 kstat.h被定义。 如果你们能帮助我,我将不胜感激。 提前致谢

【问题讨论】:

  • 这些函数来自 Solaris 内核。您正在查看错误的操作系统。

标签: c linux include kernel


【解决方案1】:

使用 apt-file 搜索您丢失的文件。

这些是我在 ubuntu 16.04 中的搜索结果。它们在 18.04 中可能略有不同,但您可以通过以下方式找到它们。

sudo apt-get install apt-file
apt-file update

$ apt-file search kstat.h
db5.3-doc: /usr/share/doc/db5.3-doc/api_reference/C/lockstat.html
db5.3-doc: /usr/share/doc/db5.3-doc/api_reference/CXX/lockstat.html
db5.3-doc: /usr/share/doc/db5.3-doc/upgrading/upgrade_4_4_lockstat.html
libace-dev: /usr/include/ace/os_include/os_kstat.h
libzfslinux-dev: /usr/include/libspl/sys/kstat.h
python-scipy-doc: /usr/share/doc/python-scipy-doc/h

【讨论】:

    【解决方案2】:

    在您的 kstat_create 标头代码中包含此 #include <sys/kstat.h>

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-28
      • 1970-01-01
      • 2012-09-11
      • 1970-01-01
      相关资源
      最近更新 更多