summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-10-04 06:44:57 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-10-04 06:44:57 -0600
commit30ccac4b4397871b553b7cb5ef6c4ee5334664e9 (patch)
tree25fcb95e2f867db9c75f95144182a2c53438d81e
parent2961fed5f9719091f1a86cca766f67f5bdb6ac29 (diff)
downloadnuttx-30ccac4b4397871b553b7cb5ef6c4ee5334664e9.tar.gz
nuttx-30ccac4b4397871b553b7cb5ef6c4ee5334664e9.tar.bz2
nuttx-30ccac4b4397871b553b7cb5ef6c4ee5334664e9.zip
Implement creat() as a macro
-rw-r--r--nuttx/include/fcntl.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/nuttx/include/fcntl.h b/nuttx/include/fcntl.h
index 381cf5cad..7671c0aca 100644
--- a/nuttx/include/fcntl.h
+++ b/nuttx/include/fcntl.h
@@ -128,6 +128,13 @@
#define DN_RENAME 4 /* A file was renamed */
#define DN_ATTRIB 5 /* Attributes of a file were changed */
+/* int creat(const char *path, mode_t mode);
+ *
+ * is equivalent to open with O_WRONLY|O_CREAT|O_TRUNC.
+ */
+
+#define creat(path, mode) open(path, O_WRONLY|O_CREAT|O_TRUNC, mode)
+
/********************************************************************************
* Public Type Definitions
********************************************************************************/
@@ -144,26 +151,26 @@ struct flock
};
/********************************************************************************
- * Public Variables
- ********************************************************************************/
-
-/********************************************************************************
* Public Function Prototypes
********************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
-extern "C" {
+extern "C"
+{
#else
#define EXTERN extern
#endif
+/********************************************************************************
+ * Public Data
+ ********************************************************************************/
+
/* POSIX-like File System Interfaces */
-EXTERN int creat(const char *path, mode_t mode);
-EXTERN int open(const char *path, int oflag, ...);
-EXTERN int fcntl(int fd, int cmd, ...);
+int open(const char *path, int oflag, ...);
+int fcntl(int fd, int cmd, ...);
#undef EXTERN
#if defined(__cplusplus)