gpt4 book ai didi

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

转载 作者:IT王子 更新时间:2023-10-29 01:02:16 24 4
gpt4 key购买 nike

在内核代码的某些部分使用它之前,我想使用内核链表。但是,如果我只包含 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com