/* this function is a POSIX compliant version, which will get file status. */
int fstat(int fildes, struct stat *buf)
/* this function is a POSIX compliant version, which will get file status. */
int fstat(int fildes, struct stat *buf)
{
    int ret = -1;
    struct dfs_file *file;
    if (buf == NULL)
    {
        rt_set_errno(-EBADF);
        return -1;
    }
    file = fd_get(fildes);
    if (file == NULL)
    {
        rt_set_errno(-EBADF);
        return -1;
    }
    if (dfs_is_mounted(file->dentry->mnt) == 0)
    {
        ret = file->dentry->mnt->fs_ops->stat(file->dentry, buf);
    }
    return ret;
}