使用内核模块中的 sysctl 接口
Using sysctl interface from kernel module
我正在尝试从内核模块访问 tcp_input.c 中定义的 tcp_pacing_ss_ratio。可以在用户 space 中使用 sysctl 命令修改该变量。
但是它不会导出,也不能直接从模块中引用。
从内核模块访问 sysctl 条目的最简单方法是什么?
use of this system call has
long been discouraged, and it is so unloved that it is likely to
disappear in a future kernel version. Since Linux 2.6.24, uses of
this system call result in warnings in the kernel log. Remove it
from your programs now; use the /proc/sys interface instead.
你的情况是 /proc/sys/net/ipv4/tcp_pacing_ss_ratio
,你可以写成 kernel_write
。查看 sysctl(2)
's implementation for example usage。
我正在尝试从内核模块访问 tcp_input.c 中定义的 tcp_pacing_ss_ratio。可以在用户 space 中使用 sysctl 命令修改该变量。 但是它不会导出,也不能直接从模块中引用。
从内核模块访问 sysctl 条目的最简单方法是什么?
use of this system call has long been discouraged, and it is so unloved that it is likely to disappear in a future kernel version. Since Linux 2.6.24, uses of this system call result in warnings in the kernel log. Remove it from your programs now; use the /proc/sys interface instead.
你的情况是 /proc/sys/net/ipv4/tcp_pacing_ss_ratio
,你可以写成 kernel_write
。查看 sysctl(2)
's implementation for example usage。