c - 可用于 sysfs 读取的最大字节数

标签 c linux-kernel sysfs

处理 sysfs阅读我需要创建一个 show添加到 kobj_attribute 的函数结构体。 the function is defined as的原型(prototype):

ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr,
            char *buf);

显然我需要将数据写入 buf参数,但是可以写入的字节数上限是多少?它是否在任何地方定义?

最佳答案

根据Documentation/filesystems/sysfs.txt (搜索“Reading/Writing Attribute Data”)缓冲区大小为一页,或PAGE_SIZE字节。

关于c - 可用于 sysfs 读取的最大字节数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51867251/

相关文章:

c - 即时返回数组 (C)

字符串以某种方式发生变异

c - 为什么 gdb "set"命令不能识别全局变量,必须添加 "::"或 "variable"?

linux - 数据链路层库 linux 内核

linux - 在 openwrt 中降级 Linux 内核版本会引发构建错误

linux - 如何在 sysfs 中获取路径的父对象?

c - 如果您已经知道输出,找到函数输入的最佳方法是什么?

Linux - dmesg 不显示 printk 消息

c - raspberry-gpio (sysfs) raspberry 上的 poll()

linux - 什么时候使用哪个函数修改 Linux 的 sysfs 上的文件?