Implement creat() as a macro

This commit is contained in:
Gregory Nutt 2014-10-04 06:44:57 -06:00
parent da29907ac9
commit 4764c95670

View File

@ -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
********************************************************************************/
@ -143,10 +150,6 @@ struct flock
pid_t l_pid; /* PID of process blocking our lock (F_GETLK only) */
};
/********************************************************************************
* Public Variables
********************************************************************************/
/********************************************************************************
* Public Function Prototypes
********************************************************************************/
@ -154,16 +157,20 @@ struct flock
#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)