NOTDIR "not a directory"
STAT "stat error"
UNLINK "failed to unlink file"
+WRITE "write error"
+OPEN "failed to open file"
+TRUNCATE "could not truncate file"
+MKDIR "failed to create directory"
+RENAME "could not rename file"
+MUNMAP "munmap error"
+FSTAT "fstat error"
ret = write(fd, buf, size);
if ((ret < 0) && (errno == EAGAIN || errno == EINTR))
continue;
- return ret >= 0? ret : -ERRNO_TO_ERROR(errno);
+ return ret >= 0? ret : -E_OSL_WRITE;
}
}
if (ret >= 0)
return ret;
- return -ERRNO_TO_ERROR(errno);
+ return -E_OSL_OPEN;
}
/**
return ret;
fd = ret;
if (fstat(fd, &file_status) < 0) {
- ret = -ERRNO_TO_ERROR(errno);
+ ret = -E_OSL_FSTAT;
goto out;
}
*size = file_status.st_size;
err = errno;
ERROR_LOG("munmap (%p/%zu) failed: %s\n", start, length,
strerror(err));
- return -ERRNO_TO_ERROR(err);
+ return -E_OSL_MUNMAP;
}
/**
if (statbuf.st_size < size)
return ret;
if (truncate(path, statbuf.st_size - size) < 0)
- return -ERRNO_TO_ERROR(errno);
+ return -E_OSL_TRUNCATE;
return 1;
}
{
if (!mkdir(path, mode))
return 1;
- return -ERRNO_TO_ERROR(errno);
+ return -E_OSL_MKDIR;
}
/**
_static_inline_ int osl_rename(const char *old_path, const char *new_path)
{
if (rename(old_path, new_path) < 0)
- return -ERRNO_TO_ERROR(errno);
+ return -E_OSL_RENAME;
return 1;
}
{
if (stat(path, buf) >= 0)
return 1;
- return -ERRNO_TO_ERROR(errno);
+ return -E_OSL_STAT;
}