#ifndef _FCNTL_H #define _FCNTL_H #include /* Open for reading only. */ #define O_RDONLY 1 /* Open for writing only. */ #define O_WRONLY 2 /* Open for reading and writing. */ #define O_RDWR 3 /* Open without blocking. */ #define O_NONBLOCK 4 /* Close the opened file descriptor on a call to execve(). */ #define O_CLOEXEC 8 /* Refuse to open the file if it is not a directory. */ #define O_DIRECTORY 16 /* Truncate the file on open. */ #define O_TRUNC 32 /* Create the file if it doesn't exist. */ #define O_CREAT 64 /* Open the file for appending. */ #define O_APPEND 128 /* Fail to open the file if it already exists. */ #define O_EXCL 256 /* Duplicate a file descriptor. */ #define F_DUPFD 0 /* Is a file descriptor a TTY? */ #define F_ISTTY 1 /* Get the file descriptor flags. */ #define F_GETFD 2 /* Set the file descriptor flags. */ #define F_SETFD 3 /* Close the file descriptor on a call to execve(). */ #define FD_CLOEXEC 1 #ifdef __cplusplus extern "C" { #endif /* Opens the file specified by pathname. Returns a file descriptor on success, or -1 on error. */ int open(const char* pathname, int flags, ...); /* Opens the file specified by pathname, creating it if it doesn't exist or overwriting it otherwise. Calling this * function is equivalent to calling open(pathname, O_WRONLY|O_CREAT|O_TRUNC, mode) */ int creat(const char* pathname, mode_t mode); /* Performs an operation on the file descriptor fd determined by cmd. */ int fcntl(int fd, int cmd, ...); #ifdef __cplusplus } #endif #endif