您的位置:首页 > 其它

glibc源码分析之statfs系列函数

2017-08-18 18:54 597 查看
glibc中与statfs函数相关的函数有4个,它们分别是:statfs,fstatfs,statfs64,fstatfs64。它们都是系统调用的封装函数。

关于statfs的系统调用有statfs(99),fstatfs(100),statfs64(268),fstatfs64(269)。statfs,fstatfs用于获取文件系统属性,属性是32位的。statfs64,fstatfs64用于获取文件系统属性,属性是64位的。

statfs和fstatfs函数都是脚本生成的。

#define SYSCALL_NAME statfs
#define SYSCALL_NARGS 2
#define SYSCALL_SYMBOL __statfs
#define SYSCALL_CANCELLABLE 0
#define SYSCALL_NOERRNO 0
#define SYSCALL_ERRVAL 0
#include <syscall-template.S>
weak_alias (__statfs, statfs)
hidden_weak (statfs)


#define SYSCALL_NAME fstatfs
#define SYSCALL_NARGS 2
#define SYSCALL_SYMBOL __fstatfs
#define SYSCALL_CANCELLABLE 0
#define SYSCALL_NOERRNO 0
#define SYSCALL_ERRVAL 0
#include <syscall-template.S>
weak_alias (__fstatfs, fstatfs)
hidden_weak (fstatfs)


statfs64和fstatfs64是.c文件构成的。

int
__statfs64 (const char *file, struct statfs64 *buf)
{
{
int result = INLINE_SYSCALL (statfs64, 3, file, sizeof (*buf), buf);
return result;
}
}
weak_alias (__statfs64, statfs64)


__statfs64 函数调用了statfs64系统调用。

int
__fstatfs64 (int fd, struct statfs64 *buf)
{
{
int result = INLINE_SYSCALL (fstatfs64, 3, fd, sizeof (*buf), buf);
return result;
}
}
weak_alias (__fstatfs64, fstatfs64)


__fstatfs64 函数调用了fstatfs64系统调用。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: