/* this function is a POSIX compliant version, which will open a file and return a file descriptor according specified flags. */
int open(const char *file, int flags,...)
/* this function is a POSIX compliant version, which will open a file and return a file descriptor according specified flags. */
int open(const char *file, int flags,...)
{
    int fd, result;
    struct dfs_file *d;
    fd = fd_new();
    if (fd < 0)
    {
        rt_set_errno(-ENOMEM);
        return -1;
    }
    d = fd_get(fd);
    result = dfs_file_open(d, file, flags);
    if (result < 0)
    {
        fd_release(fd);
        rt_set_errno(result);
        return -1;
    }
    return fd;
}