]> git.tuebingen.mpg.de Git - osl.git/blobdiff - fd.h
Do not specify LDLAGS twice.
[osl.git] / fd.h
diff --git a/fd.h b/fd.h
index a01f920e9acb9c46baa1007d4f74da31f4d60778..0ca272d45ab733fb3bddad8eb187d24c41201c88 100644 (file)
--- a/fd.h
+++ b/fd.h
@@ -8,8 +8,39 @@
 
 int osl_open(const char *path, int flags, mode_t mode);
 int para_opendir(const char *dirname, DIR **dir, int *cwd);
-int para_mkdir(const char *path, mode_t mode);
 int para_fchdir(int fd);
 int mmap_full_file(const char *filename, int open_mode, void **map,
        size_t *size, int *fd_ptr);
-int para_munmap(void *start, size_t length);
+int osl_munmap(void *start, size_t length);
+
+/**
+ * A wrapper for mkdir(2).
+ *
+ * \param path Name of the directory to create.
+ * \param mode The permissions to use.
+ *
+ * \return Standard.
+ */
+static inline int osl_mkdir(const char *path, mode_t mode)
+{
+       if (!mkdir(path, mode))
+               return 1;
+       return -ERRNO_TO_ERROR(errno);
+}
+
+/**
+ * A wrapper for rename(2).
+ *
+ * \param old_path The source path.
+ * \param new_path The destination path.
+ *
+ * \return Standard.
+ *
+ * \sa rename(2).
+ */
+_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 1;
+}