免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4333 | 回复: 0
打印 上一主题 下一主题

问一个/proc文件系统中的 read_proc_t API [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-03-04 15:49 |只看该作者 |倒序浏览
想理解一下/proc文件系统,在看源代码中的include /linux/proc_fs.h文件时,看到这个声明:
typedef int (read_proc_t)(char *page, char **start, off_t off, int count, int *eof, void *data);
我想问一下这个函数声明中的各个参数是什么意思阿?

我看到<The Linux Kernel Module Programming Guide>中的解释是这样的.
1.char *page : The buffer where the data is to be inserted,if you decide to use it .
                       这个buffer是内核分配的 ?
2.char **start: A pointer to a pointer to characters.This is useful if you don't want to use the buffer allocated by the kernel.
                        没弄明白.这个参数到底该怎么使用呢?还有这句话的意思是说第一个参数可以不由内核来分配?那么谁来分配呢?
3.off_T off: The current position in the file
                  这里的file是指哪个?是指在/proc中刚刚创建的文件吗?
4.int count:The size of the buffer in the first argument.
5.int *eof :Write a "1" here to indicate EOF.
6.A pointer to data
    最后一个参数也没弄明白是什么意思.该怎么使用呢?

[ 本帖最后由 szjrabbit 于 2009-3-4 16:24 编辑 ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP