open(2)
#include <fcntl.h>
int open(const char *pathname, int flags);
int open(const char *pathname, int flags, mode_t mode);
int creat(const char *pathname, mode_t mode);
int openat(int dirfd, const char *pathname, int flags);
int openat(int dirfd, const char *pathname, int flags, mode_t mode);
/* Documented separately, in openat2(2): */
int openat2(int dirfd, const char *pathname,
const struct open_how *how, size_t size);
Description
flags
- access modes
O_RDONLY
O_WRONLY
O_RDWR
- file creation flags, file status flags
O_CLOEXEC
enable close-on-exec flagO_CREAT
if pathname does not exist, create it as a regular fileO_DIRECTORY
if pathname is not a directory, cause the open to failO_EXCL
O_NOCTTY
O_NOFOLLOW
O_TMPFILE
O_APPEND
open in append modeO_ASYNC
enable signal-driven io
μμ£Ό μ°λ νλκ·Έ: μ¬λ¬ νλ‘μΈμ€λ€ κ°μ λ μ μ μΈ μ½κΈ°λ₯Ό 보μ₯ν΄μ£Όλ μ΅μ . μΌμ’ μ lock νμΌμ²λΌ μΈ μ μκ²λλ€.
O_CREAT | O_EXCL