From patchwork Wed Apr 7 17:08:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Cavallari X-Patchwork-Id: 1463414 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=uclibc-ng.org (client-ip=89.238.66.15; helo=helium.openadk.org; envelope-from=devel-bounces@uclibc-ng.org; receiver=) X-Greylist: delayed 370 seconds by postgrey-1.36 at bilbo; Thu, 08 Apr 2021 03:15:29 AEST Received: from helium.openadk.org (helium.openadk.org [89.238.66.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FFrcx18Rxz9sV5 for ; Thu, 8 Apr 2021 03:15:29 +1000 (AEST) Received: from helium.openadk.org (localhost [IPv6:::1]) by helium.openadk.org (Postfix) with ESMTP id 82A52100C2; Wed, 7 Apr 2021 19:09:09 +0200 (CEST) X-Original-To: devel@uclibc-ng.org Delivered-To: devel@helium.openadk.org Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.24]) by helium.openadk.org (Postfix) with ESMTPS id 9759C100C2 for ; Wed, 7 Apr 2021 19:08:53 +0200 (CEST) Received: from evilbit.green-communications.fr ([92.154.77.116]) by mrelayeu.kundenserver.de (mreue106 [213.165.67.119]) with ESMTPSA (Nemesis) id 1MILnm-1lOfM83N3s-00ENJY; Wed, 07 Apr 2021 19:08:52 +0200 From: Nicolas Cavallari To: devel@uclibc-ng.org Date: Wed, 7 Apr 2021 19:08:23 +0200 Message-Id: <20210407170823.13254-1-nicolas.cavallari@green-communications.fr> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:gGgFQjDln/VA7QX4eB5wt2TFO18vIGPUmY35Ul5s2DIGKnUDoy7 JrRAscut92jEPwxZWoI6g+QX5l8uQYAJKpOBGliQ3K6Zc3Lbv9QrU6E7bJ3nmRdNimgEwUt s8c0G+2rsjEkTDO8TJpO32dgsO71j1BMpPFeO5yReqNE4ulrTqyp+W3c93AG9ePDVZmi5PD OVur9LyrOkSQaz1XFRvYA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:IZ0dk3CRUHU=:8ILFjwDo+afKyoSfeMGeJh JU5OyjRn1hQ3VZ9HYi6uC0ihu0eNDua6cawTsmc9ZSPLnPaKEo52Hxmjo76k0DlqfgEJWfCon qqvgaKiJ1uimXkqxpj+7D0sKpcKMO2Ro7SY+iVT6FO7q2kddLxA7jrKPbG7zTafT65JpLjxcv UyG8CBHlTphWFG0xkpGg2h0LHyxgt2JSYvCskhWTgs1wHbJFpwalq3AIzja/Caf7d1PEER7a8 lKl8f5SKdffXPuVAPEkCWkHp4KQX8bAEx8L8DCNKfmwMKKppRg5pFUtsvBZIeJL+lHOygpbrY 5oEzgrnS1P4vI/J+Mvzd2ySOGKXsswzFx5ZNACAyF+jIU4b8mX+7VQ3OEQ5On6WdTohiqAnkf jLNa+wH0oDt90mz0GejncFxtF664YNwMfozuvN4lchl69AEnSqV7rTXrsN2XGl6CY/WkfRHCe 1pBkhszrJfTQUC/IBGZ5Mn30fk7nVuR42Fo7VBY6sbPTfiS1BfdqFTTzjNzJpCcm6jpw4hBf/ Q== Subject: [uclibc-ng-devel] [PATCH] open: Add support for O_TMPFILE X-BeenThere: devel@uclibc-ng.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: uClibc-ng Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: devel-bounces@uclibc-ng.org Sender: "devel" Since Linux 3.11, O_TMPFILE allows to create unnamed files that can be linked later on. It is internally defined as (O_TMPFILE | O_DIRECTORY) to make it fail on old kernels. Copying definitions from glibc for O_TMPFILE is not enough to support O_TMPFILE; The open() wrapper also need to pass the mode when the flag contains O_TMPFILE, otherwise, it will pass mode 000 which will succeed but yield unexpected results. openat() is curiously not affected since it passes the mode unconditionally.. Signed-off-by: Nicolas Cavallari --- include/fcntl.h | 5 +++-- libc/sysdeps/linux/aarch64/bits/fcntl.h | 1 + libc/sysdeps/linux/alpha/bits/fcntl.h | 1 + libc/sysdeps/linux/arc/bits/fcntl.h | 1 + libc/sysdeps/linux/arm/bits/fcntl.h | 1 + libc/sysdeps/linux/avr32/bits/fcntl.h | 1 + libc/sysdeps/linux/bfin/bits/fcntl.h | 1 + libc/sysdeps/linux/c6x/bits/fcntl.h | 1 + libc/sysdeps/linux/common/open.c | 2 +- libc/sysdeps/linux/common/open64.c | 4 ++-- libc/sysdeps/linux/cris/bits/fcntl.h | 1 + libc/sysdeps/linux/csky/bits/fcntl.h | 1 + libc/sysdeps/linux/frv/bits/fcntl.h | 1 + libc/sysdeps/linux/h8300/bits/fcntl.h | 1 + libc/sysdeps/linux/hppa/bits/fcntl.h | 1 + libc/sysdeps/linux/i386/bits/fcntl.h | 1 + libc/sysdeps/linux/ia64/bits/fcntl.h | 1 + libc/sysdeps/linux/kvx/bits/fcntl.h | 1 + libc/sysdeps/linux/lm32/bits/fcntl.h | 1 + libc/sysdeps/linux/m68k/bits/fcntl.h | 1 + libc/sysdeps/linux/metag/bits/fcntl.h | 1 + libc/sysdeps/linux/microblaze/bits/fcntl.h | 1 + libc/sysdeps/linux/mips/bits/fcntl.h | 1 + libc/sysdeps/linux/nds32/bits/fcntl.h | 1 + libc/sysdeps/linux/nios2/bits/fcntl.h | 1 + libc/sysdeps/linux/or1k/bits/fcntl.h | 1 + libc/sysdeps/linux/powerpc/bits/fcntl.h | 1 + libc/sysdeps/linux/riscv64/bits/fcntl.h | 1 + libc/sysdeps/linux/sh/bits/fcntl.h | 1 + libc/sysdeps/linux/sparc/bits/fcntl.h | 1 + libc/sysdeps/linux/sparc64/bits/fcntl.h | 1 + libc/sysdeps/linux/tile/bits/fcntl.h | 1 + libc/sysdeps/linux/x86_64/bits/fcntl.h | 1 + libc/sysdeps/linux/xtensa/bits/fcntl.h | 1 + 34 files changed, 37 insertions(+), 5 deletions(-) diff --git a/include/fcntl.h b/include/fcntl.h index 35797c689..136f64d70 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 27922f602..c143ba9c9 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 24caaf6d4..11e68214e 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 af4c85af8..beb32e41e 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 036f4161c..823660648 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 6f1039a34..ec0a3b55d 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 c0d70875b..0909ae6c4 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 02c2ee131..14aea565e 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 ccdcf3848..ac09d40f0 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 6e65a988e..9d4c06b18 100644 --- a/libc/sysdeps/linux/common/open64.c +++ b/libc/sysdeps/linux/common/open64.c @@ -10,13 +10,13 @@ #include #include -/* 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 01920fbc7..e9bc90ea9 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 817ef56e4..b36f41569 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 91d72bc66..02c8ac310 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 cd9280462..2062f7cda 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 a355737d0..4ce76ce5f 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 302aebcbc..f3c08bbe5 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 08343c3cb..a20f44ff7 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 14a75fe08..ea0c59d09 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 780c0c643..0bfea6e7a 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 51589fffa..5a56c8781 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 98dc44085..bdd697348 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 64942f5a5..110927d95 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 0d7fb9a5a..33251c74d 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 988686b27..2e6a95ec8 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 b70b718d2..200a35443 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 1d9cc215e..c9599ef3a 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 a76d84fb5..ef1beeca0 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 a22287b32..a9d7c84e0 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 32c7d4b8f..0d687f04f 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 336f5ca43..935495937 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 b183f7b91..395c95baf 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 ca195b393..818da5c4a 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 e4306aae1..3547a2046 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 757fd6b9c..5af9d2124 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.