linux - 我可以在内核代码之外使用 Linux 内核链表吗?

标签 linux list kernel

在内核代码的某些部分使用它之前,我想使用内核链表。但是,如果我只包含 list.h,由于依赖关系,它不会工作。

如何在 single.c 文件中使用列表编写代码,例如test.c 以便我可以通过编译 test.c 来测试我的代码?期待很快收到您的来信。

另外,如何使用嵌套链表?

最佳答案

您可以从 http://www.mcs.anl.gov/~kazutomo/list/list.h 获取用户空间端口.
它说:

Here is a recipe to cook list.h for user space program

  1. copy list.h from linux/include/list.h
  2. remove
    • #ifdef KERNE and its #endif
    • all #include line
    • prefetch() and rcu related functions
  3. add macro offsetof() and container_of

关于linux - 我可以在内核代码之外使用 Linux 内核链表吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13620501/

相关文章:

linux - 如何修改 LD_LIBRARY_PATH 环境变量?

operating-system - 错误系统调用 : Function not implemented

linux - 如何缓解高 SoftIRQ (si) CPU

ios - 在iOS更新期间,更新Ramdisk中的哪个二进制文件会加载内核?

Linux shell : LOOP for create file in each folder

c++ - 编译库以便 GDB 自动查找源代码

linux - 如何使用 Gnuplot 5.2 制作多轴图?

list - 如何实现 not_all_equal/1 谓词

list - 如何对两个列表的元素求和。 haskell

list - 如何检查变量是否在列表中?