免费注册 查看新帖 |

Chinaunix

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

请问proc文件系统--read_proc() [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-03-20 09:24 |只看该作者 |倒序浏览
想通过proc文件系统读取内核数据

但read_proc的eof该什么时候设置?read_proc该如何写?

看了些许文档, 但还是不理解,请指教

* How to be a proc read function
* ------------------------------
* Prototype:
*    int f(char *buffer, char **start, off_t offset,
*          int count, int *peof, void *dat)
*
* Assume that the buffer is "count" bytes in size.
*
* If you know you have supplied all the data you
* have, set *peof.
*
* You have three ways to return data:
* 0) Leave *start = NULL.  (This is the default.)
*    Put the data of the requested offset at that
*    offset within the buffer.  Return the number (n)
*    of bytes there are from the beginning of the
*    buffer up to the last byte of data.  If the
*    number of supplied bytes (= n - offset) is
*    greater than zero and you didn't signal eof
*    and the reader is prepared to take more data
*    you will be called again with the requested
*    offset advanced by the number of bytes
*    absorbed.  This interface is useful for files
*    no larger than the buffer.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP