-/**
- * Wrapper for the open(2) system call.
- *
- * \param path The filename.
- * \param flags The usual open(2) flags.
- * \param mode Specifies the permissions to use.
- *
- * The mode parameter must be specified when O_CREAT is in the flags, and is ignored
- * otherwise.
- *
- * \return Positive on success, negative on errors. Possible errors: \p
- * E_EXIST, \p E_ISDIR, \p E_NOENT, \p E_OSL_PERM.
- *
- * \sa open(2).
- */
-int para_open(const char *path, int flags, mode_t mode)
-{
- PARA_DEBUG_LOG("opening %s\n", path);
- int ret = open(path, flags, mode);
-
- if (ret >= 0)
- return ret;
- switch (errno) {
- case EEXIST:
- ret = -E_EXIST;
- break;
- case EISDIR:
- ret = -E_ISDIR;
- break;
- case ENOENT:
- ret = -E_NOENT;
- break;
- case EPERM:
- ret = -E_OSL_PERM;
- break;
- };
- PARA_ERROR_LOG("failed to open %s: %s\n", path, strerror(errno));
- return ret;
-}
-