/* this function is a POSIX compliant version, which will unlink (remove) a specified path file from file system. */
int unlink(const char *pathname)
/* this function is a POSIX compliant version, which will unlink (remove) a specified path file from file system. */
int unlink(const char *pathname)
{
    int result;
    struct stat stat;
    if (pathname == NULL)
    {
        rt_set_errno(-EBADF);
        return -1;
    }
    result = dfs_file_lstat(pathname, &stat);
    if (result == 0 && S_ISDIR(stat.st_mode))
    {
        rt_set_errno(-RT_ERROR);
        return -1;
    }
    result = dfs_file_unlink(pathname);
    if (result < 0)
    {
        rt_set_errno(result);
        return -1;
    }
    return 0;
}