On Sun, 9 Nov 2025 16:13:03 +0900
Masaharu Noguchi <nogunix@gmail.com> wrote:
> Signed-off-by: Masaharu Noguchi <nogunix@gmail.com>
> ---
> include/uapi/linux/fcntl.h | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/include/uapi/linux/fcntl.h b/include/uapi/linux/fcntl.h
> index 3741ea1b73d8..e3026381fbe7 100644
> --- a/include/uapi/linux/fcntl.h
> +++ b/include/uapi/linux/fcntl.h
> @@ -157,9 +157,15 @@
> */
>
> /* Flags for renameat2(2) (must match legacy RENAME_* flags). */
> +#ifndef AT_RENAME_NOREPLACE
> #define AT_RENAME_NOREPLACE 0x0001
> +#endif
> +#ifndef AT_RENAME_EXCHANGE
> #define AT_RENAME_EXCHANGE 0x0002
> +#endif
> +#ifndef AT_RENAME_WHITEOUT
> #define AT_RENAME_WHITEOUT 0x0004
> +#endif
That looks like the start of an 'accident waiting to happen'.
Either #undef the constants so that code is guaranteed to get the 'uapi' values,
or do explicit checks, eg:
/* stdio.h may have defined AT_RENAME_NOREPLACE */
#if !defined(AT_RENAME_NOREPLACE) || AT_RENAME_NOREPLACE != 0x0001
#define AT_RENAME_NOREPLACE 0x0001
#endif
David
>
> /* Flag for faccessat(2). */
> #define AT_EACCESS 0x200 /* Test access permitted for