Linux 上的 getfsstat() 等效项是什么?
问题说明了一切。我想要 C 函数调用返回已安装文件系统的列表以及相关信息(例如文件系统类型)。
Question says it all. I want C function call that returns the list the mounted filesystems along with associated information such as filesystem type.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您正在寻找
getmntent
和其他*mntent
函数系列。请参阅 联机帮助页 以获取更多参考。代码示例取自此处并稍加修改。
/etc/mtab
是一个包含已安装文件系统列表的文件。不幸的是,这些函数不在 POSIX 中。但它们是在 glibc 中进行手册页和实现的,所以我认为它们是比解析
/proc
更好的选择。You're looking for
getmntent
and other*mntent
functions family. See manpage For further reference.Code example taken from here and slightly modified.
/etc/mtab
is a file that contains a list of mounted filesystems.Unfortunately, these functions are not in POSIX. But they're manpaged and implemented in glibc, so I think they're a better alternative than parsing
/proc
.您可以解析
/proc/filesystems
。You can parse
/proc/filesystems
.