/* this function is a POSIX compliant version, which will close the open file descriptor. */
int close(int fd)
/* this function is a POSIX compliant version, which will close the open file descriptor. */
int close(int fd)
{
    int result;
    struct dfs_fd *d;
    d = fd_get(fd);
    if (d == NULL)
    {
        rt_set_errno(-EBADF);
        return -1;
    }
    result = dfs_file_close(d);
    fd_put(d);
    if (result < 0)
    {
        rt_set_errno(result);
        return -1;
    }
    fd_put(d);
    return 0;
}