diff options
34 files changed, 37 insertions, 5 deletions
diff --git a/include/fcntl.h b/include/fcntl.h index 35797c6..136f64d 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -104,8 +104,9 @@ libc_hidden_proto(fcntl64) #endif /* Open FILE and return a new file descriptor for it, or -1 on error. - OFLAG determines the type of access used. If O_CREAT is on OFLAG, - the third argument is taken as a `mode_t', the mode of the created file. + OFLAG determines the type of access used. If O_CREAT or O_TMPFILE + is on OFLAG, the third argument is taken as a `mode_t', the mode of + the created file. This function is a cancellation point and therefore not marked with __THROW. */ diff --git a/libc/sysdeps/linux/aarch64/bits/fcntl.h b/libc/sysdeps/linux/aarch64/bits/fcntl.h index 27922f6..c143ba9 100644 --- a/libc/sysdeps/linux/aarch64/bits/fcntl.h +++ b/libc/sysdeps/linux/aarch64/bits/fcntl.h @@ -52,6 +52,7 @@ # define O_DIRECT 0200000 # define O_NOATIME 01000000 # define O_PATH 010000000 +# define O_TMPFILE 020040000 #endif /* For now Linux has synchronisity options for data and read operations. diff --git a/libc/sysdeps/linux/alpha/bits/fcntl.h b/libc/sysdeps/linux/alpha/bits/fcntl.h index 24caaf6..11e6821 100644 --- a/libc/sysdeps/linux/alpha/bits/fcntl.h +++ b/libc/sysdeps/linux/alpha/bits/fcntl.h @@ -54,6 +54,7 @@ # define O_DIRECT 02000000 /* Direct disk access. */ # define O_NOATIME 04000000 /* Do not set atime. */ # define O_PATH 040000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 0100100000 /* Atomically create nameless file. */ #endif #ifdef __USE_LARGEFILE64 diff --git a/libc/sysdeps/linux/arc/bits/fcntl.h b/libc/sysdeps/linux/arc/bits/fcntl.h index af4c85a..beb32e4 100755 --- a/libc/sysdeps/linux/arc/bits/fcntl.h +++ b/libc/sysdeps/linux/arc/bits/fcntl.h @@ -41,6 +41,7 @@ # define O_DIRECT 040000 /* Direct disk access. */ # define O_NOATIME 01000000 /* Do not set atime. */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 020200000 /* Atomically create nameless file. */ #endif #ifdef __USE_LARGEFILE64 diff --git a/libc/sysdeps/linux/arm/bits/fcntl.h b/libc/sysdeps/linux/arm/bits/fcntl.h index 036f416..8236606 100644 --- a/libc/sysdeps/linux/arm/bits/fcntl.h +++ b/libc/sysdeps/linux/arm/bits/fcntl.h @@ -54,6 +54,7 @@ # define O_DIRECT 0200000 /* Direct disk access. */ # define O_NOATIME 01000000 /* Do not set atime. */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 020040000 /* Atomically create nameless file. */ #endif /* For now Linux has synchronisity options for data and read operations. diff --git a/libc/sysdeps/linux/avr32/bits/fcntl.h b/libc/sysdeps/linux/avr32/bits/fcntl.h index 6f1039a..ec0a3b5 100644 --- a/libc/sysdeps/linux/avr32/bits/fcntl.h +++ b/libc/sysdeps/linux/avr32/bits/fcntl.h @@ -35,6 +35,7 @@ # define O_DIRECT 00040000 /* must be a directory */ # define O_NOATIME 01000000 /* don't set atime */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 020200000 /* Atomically create nameless file. */ #endif #ifdef __USE_LARGEFILE64 diff --git a/libc/sysdeps/linux/bfin/bits/fcntl.h b/libc/sysdeps/linux/bfin/bits/fcntl.h index c0d7087..0909ae6 100644 --- a/libc/sysdeps/linux/bfin/bits/fcntl.h +++ b/libc/sysdeps/linux/bfin/bits/fcntl.h @@ -53,6 +53,7 @@ # define O_DIRECT 0200000 /* Direct disk access. */ # define O_NOATIME 01000000 /* don't set atime */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 020040000 /* Atomically create nameless file. */ #endif /* For now Linux has synchronisity options for data and read operations. diff --git a/libc/sysdeps/linux/c6x/bits/fcntl.h b/libc/sysdeps/linux/c6x/bits/fcntl.h index 02c2ee1..14aea56 100644 --- a/libc/sysdeps/linux/c6x/bits/fcntl.h +++ b/libc/sysdeps/linux/c6x/bits/fcntl.h @@ -54,6 +54,7 @@ # define O_LARGEFILE 0100000 # define O_NOATIME 01000000 # define O_PATH 010000000/* Resolve pathname but do not open file. */ +# define O_TMPFILE 020200000/* Atomically create nameless file. */ #endif /* For now Linux has synchronisity options for data and read operations. diff --git a/libc/sysdeps/linux/common/open.c b/libc/sysdeps/linux/common/open.c index ccdcf38..ac09d40 100644 --- a/libc/sysdeps/linux/common/open.c +++ b/libc/sysdeps/linux/common/open.c @@ -31,7 +31,7 @@ int open(const char *file, int oflag, ...) int oldtype, result; #endif - if (oflag & O_CREAT) { + if (oflag & (O_CREAT | (O_TMPFILE &~ O_DIRECTORY))) { va_list arg; va_start(arg, oflag); mode = va_arg(arg, mode_t); diff --git a/libc/sysdeps/linux/common/open64.c b/libc/sysdeps/linux/common/open64.c index 6e65a98..9d4c06b 100644 --- a/libc/sysdeps/linux/common/open64.c +++ b/libc/sysdeps/linux/common/open64.c @@ -10,13 +10,13 @@ #include <stdarg.h> #include <cancel.h> -/* Open FILE with access OFLAG. If OFLAG includes O_CREAT, +/* Open FILE with access OFLAG. If OFLAG includes O_CREAT or O_TMPFILE, a third argument is the file protection. */ int open64(const char *file, int oflag, ...) { mode_t mode = 0; - if (oflag & O_CREAT) { + if (oflag & (O_CREAT | (O_TMPFILE &~ O_DIRECTORY))) { va_list arg; va_start (arg, oflag); mode = va_arg (arg, mode_t); diff --git a/libc/sysdeps/linux/cris/bits/fcntl.h b/libc/sysdeps/linux/cris/bits/fcntl.h index 01920fb..e9bc90e 100644 --- a/libc/sysdeps/linux/cris/bits/fcntl.h +++ b/libc/sysdeps/linux/cris/bits/fcntl.h @@ -54,6 +54,7 @@ # define O_DIRECT 040000 /* Direct disk access. */ # define O_NOATIME 01000000 /* Do not set atime. */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 020200000 /* Atomically create nameless file. */ #endif /* For now Linux has synchronisity options for data and read operations. diff --git a/libc/sysdeps/linux/csky/bits/fcntl.h b/libc/sysdeps/linux/csky/bits/fcntl.h index 817ef56..b36f415 100644 --- a/libc/sysdeps/linux/csky/bits/fcntl.h +++ b/libc/sysdeps/linux/csky/bits/fcntl.h @@ -42,6 +42,7 @@ # define O_DIRECT 00040000 /* direct disk access hint */ # define O_NOATIME 01000000 /* Do not set atime. */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 020200000 /* Atomically create nameless file. */ #endif /* For now Linux has synchronisity options for data and read operations. diff --git a/libc/sysdeps/linux/frv/bits/fcntl.h b/libc/sysdeps/linux/frv/bits/fcntl.h index 91d72bc..02c8ac3 100644 --- a/libc/sysdeps/linux/frv/bits/fcntl.h +++ b/libc/sysdeps/linux/frv/bits/fcntl.h @@ -53,6 +53,7 @@ # define O_DIRECT 040000 /* Direct disk access. */ # define O_NOATIME 01000000 /* don't set atime */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 020200000 /* Atomically create nameless file. */ #endif /* For now Linux has synchronisity options for data and read operations. diff --git a/libc/sysdeps/linux/h8300/bits/fcntl.h b/libc/sysdeps/linux/h8300/bits/fcntl.h index cd92804..2062f7c 100644 --- a/libc/sysdeps/linux/h8300/bits/fcntl.h +++ b/libc/sysdeps/linux/h8300/bits/fcntl.h @@ -53,6 +53,7 @@ # define O_DIRECT 040000 /* Direct disk access. */ # define O_NOATIME 01000000 /* Do not set atime. */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 020200000 /* Atomically create nameless file. */ #endif /* For now Linux has synchronisity options for data and read operations. diff --git a/libc/sysdeps/linux/hppa/bits/fcntl.h b/libc/sysdeps/linux/hppa/bits/fcntl.h index a355737..4ce76ce 100644 --- a/libc/sysdeps/linux/hppa/bits/fcntl.h +++ b/libc/sysdeps/linux/hppa/bits/fcntl.h @@ -53,6 +53,7 @@ # define O_DIRECT 00040000 /* Direct disk access. */ # define O_NOATIME 04000000 /* Do not set atime. */ # define O_PATH 020000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 040010000 /* Atomically create nameless file. */ #endif #ifdef __USE_LARGEFILE64 diff --git a/libc/sysdeps/linux/i386/bits/fcntl.h b/libc/sysdeps/linux/i386/bits/fcntl.h index 302aebc..f3c08bb 100644 --- a/libc/sysdeps/linux/i386/bits/fcntl.h +++ b/libc/sysdeps/linux/i386/bits/fcntl.h @@ -54,6 +54,7 @@ # define O_DIRECT 040000 /* Direct disk access. */ # define O_NOATIME 01000000 /* Do not set atime. */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 020200000 /* Atomically create nameless file. */ #endif /* For now Linux has synchronisity options for data and read operations. diff --git a/libc/sysdeps/linux/ia64/bits/fcntl.h b/libc/sysdeps/linux/ia64/bits/fcntl.h index 08343c3..a20f44f 100644 --- a/libc/sysdeps/linux/ia64/bits/fcntl.h +++ b/libc/sysdeps/linux/ia64/bits/fcntl.h @@ -53,6 +53,7 @@ # define O_DIRECT 040000 # define O_NOATIME 01000000 /* Do not set atime. */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 020200000 /* Atomically create nameless file. */ #endif #ifdef __USE_LARGEFILE64 diff --git a/libc/sysdeps/linux/kvx/bits/fcntl.h b/libc/sysdeps/linux/kvx/bits/fcntl.h index 14a75fe..ea0c59d 100644 --- a/libc/sysdeps/linux/kvx/bits/fcntl.h +++ b/libc/sysdeps/linux/kvx/bits/fcntl.h @@ -42,6 +42,7 @@ # define O_DIRECT 040000 /* Direct disk access. */ # define O_NOATIME 01000000 /* Do not set atime. */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 020200000 /* Atomically create nameless file. */ #endif #ifdef __USE_LARGEFILE64 diff --git a/libc/sysdeps/linux/lm32/bits/fcntl.h b/libc/sysdeps/linux/lm32/bits/fcntl.h index 780c0c6..0bfea6e 100644 --- a/libc/sysdeps/linux/lm32/bits/fcntl.h +++ b/libc/sysdeps/linux/lm32/bits/fcntl.h @@ -53,6 +53,7 @@ # define O_DIRECT 040000 /* Direct disk access. */ # define O_NOATIME 01000000 /* Do not set atime. */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 020200000 /* Atomically create nameless file. */ #endif /* For now Linux has synchronisity options for data and read operations. diff --git a/libc/sysdeps/linux/m68k/bits/fcntl.h b/libc/sysdeps/linux/m68k/bits/fcntl.h index 51589ff..5a56c87 100644 --- a/libc/sysdeps/linux/m68k/bits/fcntl.h +++ b/libc/sysdeps/linux/m68k/bits/fcntl.h @@ -53,6 +53,7 @@ # define O_DIRECT 0200000 /* Direct disk access. */ # define O_NOATIME 01000000 /* Do not set atime. */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 020040000 /* Atomically create nameless file. */ #endif /* For now Linux has synchronisity options for data and read operations. diff --git a/libc/sysdeps/linux/metag/bits/fcntl.h b/libc/sysdeps/linux/metag/bits/fcntl.h index 98dc440..bdd6973 100644 --- a/libc/sysdeps/linux/metag/bits/fcntl.h +++ b/libc/sysdeps/linux/metag/bits/fcntl.h @@ -54,6 +54,7 @@ # define O_DIRECT 040000 /* Direct disk access. */ # define O_NOATIME 01000000 /* Do not set atime. */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 020200000 /* Atomically create nameless file. */ #endif /* For now Linux has synchronisity options for data and read operations. diff --git a/libc/sysdeps/linux/microblaze/bits/fcntl.h b/libc/sysdeps/linux/microblaze/bits/fcntl.h index 64942f5..110927d 100644 --- a/libc/sysdeps/linux/microblaze/bits/fcntl.h +++ b/libc/sysdeps/linux/microblaze/bits/fcntl.h @@ -53,6 +53,7 @@ # define O_DIRECT 040000 /* Direct disk access. */ # define O_NOATIME 01000000 /* Do not set atime. */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 020200000 /* Atomically create nameless file. */ #endif /* For now Linux has synchronisity options for data and read operations. diff --git a/libc/sysdeps/linux/mips/bits/fcntl.h b/libc/sysdeps/linux/mips/bits/fcntl.h index 0d7fb9a..33251c7 100644 --- a/libc/sysdeps/linux/mips/bits/fcntl.h +++ b/libc/sysdeps/linux/mips/bits/fcntl.h @@ -55,6 +55,7 @@ # define O_DIRECT 0x8000 /* Direct disk access hint. */ # define O_NOATIME 0x40000 /* Do not set atime. */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 0x410000 /* Atomically create nameless file. */ #endif /* For now Linux has no synchronisity options for data and read operations. diff --git a/libc/sysdeps/linux/nds32/bits/fcntl.h b/libc/sysdeps/linux/nds32/bits/fcntl.h index 988686b..2e6a95e 100644 --- a/libc/sysdeps/linux/nds32/bits/fcntl.h +++ b/libc/sysdeps/linux/nds32/bits/fcntl.h @@ -58,6 +58,7 @@ # define O_DIRECT 040000 /* Direct disk access. */ # define O_NOATIME 01000000 /* Do not set atime. */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 020200000 /* Atomically create nameless file. */ #endif /* For now Linux has synchronisity options for data and read operations. diff --git a/libc/sysdeps/linux/nios2/bits/fcntl.h b/libc/sysdeps/linux/nios2/bits/fcntl.h index b70b718..200a354 100644 --- a/libc/sysdeps/linux/nios2/bits/fcntl.h +++ b/libc/sysdeps/linux/nios2/bits/fcntl.h @@ -53,6 +53,7 @@ # define O_DIRECT 040000 /* Direct disk access. */ # define O_NOATIME 01000000 /* Do not set atime. */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 020200000 /* Atomically create nameless file. */ #endif /* For now Linux has synchronisity options for data and read operations. diff --git a/libc/sysdeps/linux/or1k/bits/fcntl.h b/libc/sysdeps/linux/or1k/bits/fcntl.h index 1d9cc21..c9599ef 100644 --- a/libc/sysdeps/linux/or1k/bits/fcntl.h +++ b/libc/sysdeps/linux/or1k/bits/fcntl.h @@ -53,6 +53,7 @@ # define O_DIRECT 040000 /* Direct disk access. */ # define O_NOATIME 01000000 /* Do not set atime. */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 020200000 /* Atomically create nameless file. */ #endif #ifdef __USE_LARGEFILE64 diff --git a/libc/sysdeps/linux/powerpc/bits/fcntl.h b/libc/sysdeps/linux/powerpc/bits/fcntl.h index a76d84f..ef1beec 100644 --- a/libc/sysdeps/linux/powerpc/bits/fcntl.h +++ b/libc/sysdeps/linux/powerpc/bits/fcntl.h @@ -54,6 +54,7 @@ # define O_DIRECT 0400000 /* Direct disk access. */ # define O_NOATIME 01000000 /* Do not set atime. */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 020040000 /* Atomically create nameless file. */ #endif #ifdef __USE_LARGEFILE64 diff --git a/libc/sysdeps/linux/riscv64/bits/fcntl.h b/libc/sysdeps/linux/riscv64/bits/fcntl.h index a22287b..a9d7c84 100644 --- a/libc/sysdeps/linux/riscv64/bits/fcntl.h +++ b/libc/sysdeps/linux/riscv64/bits/fcntl.h @@ -40,6 +40,7 @@ # define O_DIRECT 00040000 /* Direct disk access. */ # define O_NOATIME 01000000 /* Do not set atime. */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 020200000 /* Atomically create nameless file. */ #endif #ifdef __USE_LARGEFILE64 diff --git a/libc/sysdeps/linux/sh/bits/fcntl.h b/libc/sysdeps/linux/sh/bits/fcntl.h index 32c7d4b..0d687f0 100644 --- a/libc/sysdeps/linux/sh/bits/fcntl.h +++ b/libc/sysdeps/linux/sh/bits/fcntl.h @@ -54,6 +54,7 @@ # define O_DIRECT 040000 /* Direct disk access. */ # define O_NOATIME 01000000 /* Do not set atime. */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 020200000 /* Atomically create nameless file. */ #endif /* For now Linux has synchronisity options for data and read operations. diff --git a/libc/sysdeps/linux/sparc/bits/fcntl.h b/libc/sysdeps/linux/sparc/bits/fcntl.h index 336f5ca..9354959 100644 --- a/libc/sysdeps/linux/sparc/bits/fcntl.h +++ b/libc/sysdeps/linux/sparc/bits/fcntl.h @@ -51,6 +51,7 @@ # define O_DIRECT 0x100000 /* direct disk access hint */ # define O_NOATIME 0x200000 /* Do not set atime. */ # define O_PATH 0x1000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 0x2010000 /* Atomically create nameless file. */ #endif #ifdef __USE_LARGEFILE64 diff --git a/libc/sysdeps/linux/sparc64/bits/fcntl.h b/libc/sysdeps/linux/sparc64/bits/fcntl.h index b183f7b..395c95b 100644 --- a/libc/sysdeps/linux/sparc64/bits/fcntl.h +++ b/libc/sysdeps/linux/sparc64/bits/fcntl.h @@ -47,6 +47,7 @@ # define O_NOATIME 0x200000 /* Do not set atime. */ # define O_CLOEXEC 0x400000 /* Set close_on_exit. */ # define O_PATH 0x1000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 0x2010000 /* Atomically create nameless file. */ #endif #ifdef __USE_LARGEFILE64 diff --git a/libc/sysdeps/linux/tile/bits/fcntl.h b/libc/sysdeps/linux/tile/bits/fcntl.h index ca195b3..818da5c 100644 --- a/libc/sysdeps/linux/tile/bits/fcntl.h +++ b/libc/sysdeps/linux/tile/bits/fcntl.h @@ -40,6 +40,7 @@ # define O_DIRECT 040000 /* Direct disk access. */ # define O_NOATIME 01000000 /* Do not set atime. */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 020200000 /* Atomically create nameless file. */ #endif #ifdef __USE_LARGEFILE64 diff --git a/libc/sysdeps/linux/x86_64/bits/fcntl.h b/libc/sysdeps/linux/x86_64/bits/fcntl.h index e4306aa..3547a20 100644 --- a/libc/sysdeps/linux/x86_64/bits/fcntl.h +++ b/libc/sysdeps/linux/x86_64/bits/fcntl.h @@ -54,6 +54,7 @@ # define O_DIRECT 040000 /* Direct disk access. */ # define O_NOATIME 01000000 /* Do not set atime. */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 020200000 /* Atomically create nameless file. */ #endif /* For now Linux has synchronisity options for data and read operations. diff --git a/libc/sysdeps/linux/xtensa/bits/fcntl.h b/libc/sysdeps/linux/xtensa/bits/fcntl.h index 757fd6b..5af9d21 100644 --- a/libc/sysdeps/linux/xtensa/bits/fcntl.h +++ b/libc/sysdeps/linux/xtensa/bits/fcntl.h @@ -54,6 +54,7 @@ # define O_DIRECT 040000 /* Direct disk access. */ # define O_NOATIME 01000000 /* Do not set atime. */ # define O_PATH 010000000 /* Resolve pathname but do not open file. */ +# define O_TMPFILE 020200000 /* Atomically create nameless file. */ #endif /* For now Linux has synchronisity options for data and read operations. |