- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
http://lists.openfabrics.org/pipermail/general/2007-January/032093.html说
At creation all subsys init functions are called before device init functions, and at destruction all device exit functions are called before subsys exit function.
也许这就是答案。然而,距该职位已过去 8 年。它可能不再正确。
我看了linux/net/core/net_namespaces.c中的代码,还是没完全看懂。
谁能帮帮我?谢谢。
最佳答案
好吧,我会在几个月的学习之后回答我自己的问题。
关键在于对列表(include/list.h)的理解。如果你对这个linux内核广泛使用的数据结构不熟悉,建议你先用它写一些代码。
Initially , pernet_list 和 first_device 都是指向同一个列表头的指针。
如果 register_pernet_subsys 被调用,pernet_list 和 first_device 仍然是同一个指向列表头的。准确的说,如果没有调用register_pernet_device,它们都指向privious location。
但是调用register_pernet_device后,first_device会指向新的list_head,而pernet_list仍然指向原来的list head。
关于linux - register_pernet_subsys 和 register_pernet_device 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32223367/
http://lists.openfabrics.org/pipermail/general/2007-January/032093.html说 At creation all subsys init
我是一名优秀的程序员,十分优秀!