哪个函数可以替换Linux内核2.6.32中的“create_proc_info_entry”?

问题描述 投票:0回答:2

2.6.32内核没有“create_proc_info_entry”的功能。 哪个功能可以取代它? 谢谢。

kernel proc
2个回答
0
投票

从Documentation / filesystems / seq_file.txt我们有以下内容:

不推荐使用create_proc_entry

请注意,上面的文章使用了在内核3.10中删除的create_proc_entry。当前版本需要以下更新

-   entry = create_proc_entry("sequence", 0, NULL);
-   if (entry)
-       entry->proc_fops = &ct_file_ops;
+   entry = proc_create("sequence", 0, NULL, &ct_file_ops);

有关更多信息,请参阅80e928f7ebb958f4d79d4099d1c5c0a015a23b93


0
投票

可能你需要这样的东西:

int proc_read(char *page, char **start, off_t off, int count, int *eof, void *data)
{
    return sprintf(page, "Hello World!\n");
}

create_proc_read_entry("proc_test", 0444, NULL, proc_read, NULL);
© www.soinside.com 2019 - 2024. All rights reserved.