Add AT_* constants from Linux 6.12

Message ID 1dc3b4b9-5ffd-57ad-30fd-f3359191206b@redhat.com (mailing list archive)
State Accepted
Delegated to: Adhemerval Zanella Netto
Headers
Series Add AT_* constants from Linux 6.12 |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Build passed
redhat-pt-bot/TryBot-32bit success Build for i686
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Test passed

Commit Message

Joseph Myers April 9, 2025, 7:51 p.m. UTC
  Linux 6.12 adds AT_RENAME_* aliases for RENAME_* flags for renameat2,
and also AT_HANDLE_MNT_ID_UNIQUE.  Add the first set of aliases to
stdio.h alongside the RENAME_* names, and AT_HANDLE_MNT_ID_UNIQUE to
bits/fcntl-linux.h.

Tested for x86_64.
  

Comments

enh April 9, 2025, 9:25 p.m. UTC | #1
(i'm never sure whether glibc cares, but note that those definitions
wouldn't be compatible with the <linux/fcntl.h> ones, were someone to
try to #include both...)

On Wed, Apr 9, 2025 at 3:52 PM Joseph Myers <josmyers@redhat.com> wrote:
>
> Linux 6.12 adds AT_RENAME_* aliases for RENAME_* flags for renameat2,
> and also AT_HANDLE_MNT_ID_UNIQUE.  Add the first set of aliases to
> stdio.h alongside the RENAME_* names, and AT_HANDLE_MNT_ID_UNIQUE to
> bits/fcntl-linux.h.
>
> Tested for x86_64.
>
> diff --git a/libio/stdio.h b/libio/stdio.h
> index 4436525731..d042b36618 100644
> --- a/libio/stdio.h
> +++ b/libio/stdio.h
> @@ -168,8 +168,11 @@ extern int renameat (int __oldfd, const char *__old, int __newfd,
>  #ifdef __USE_GNU
>  /* Flags for renameat2.  */
>  # define RENAME_NOREPLACE (1 << 0)
> +# define AT_RENAME_NOREPLACE RENAME_NOREPLACE
>  # define RENAME_EXCHANGE (1 << 1)
> +# define AT_RENAME_EXCHANGE RENAME_EXCHANGE
>  # define RENAME_WHITEOUT (1 << 2)
> +# define AT_RENAME_WHITEOUT RENAME_WHITEOUT
>
>  /* Rename file OLD relative to OLDFD to NEW relative to NEWFD, with
>     additional flags.  */
> diff --git a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
> index dfc554aafc..f425a4bf22 100644
> --- a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
> +++ b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
> @@ -379,6 +379,8 @@ struct file_handle
>                                                 identity and may not
>                                                 be usable to
>                                                 open_by_handle_at.  */
> +# define AT_HANDLE_MNT_ID_UNIQUE 1 /* Return the 64-bit unique mount
> +                                     ID.  */
>  #endif
>
>  __BEGIN_DECLS
>
> --
> Joseph S. Myers
> josmyers@redhat.com
>
  
Adhemerval Zanella Netto April 14, 2025, 4 p.m. UTC | #2
On 09/04/25 16:51, Joseph Myers wrote:
> Linux 6.12 adds AT_RENAME_* aliases for RENAME_* flags for renameat2,
> and also AT_HANDLE_MNT_ID_UNIQUE.  Add the first set of aliases to
> stdio.h alongside the RENAME_* names, and AT_HANDLE_MNT_ID_UNIQUE to
> bits/fcntl-linux.h.
> 
> Tested for x86_64.

LGTM, although I am not sure about the possible <linux/fcntl.h> inclusion
clash.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> 
> diff --git a/libio/stdio.h b/libio/stdio.h
> index 4436525731..d042b36618 100644
> --- a/libio/stdio.h
> +++ b/libio/stdio.h
> @@ -168,8 +168,11 @@ extern int renameat (int __oldfd, const char *__old, int __newfd,
>  #ifdef __USE_GNU
>  /* Flags for renameat2.  */
>  # define RENAME_NOREPLACE (1 << 0)
> +# define AT_RENAME_NOREPLACE RENAME_NOREPLACE
>  # define RENAME_EXCHANGE (1 << 1)
> +# define AT_RENAME_EXCHANGE RENAME_EXCHANGE
>  # define RENAME_WHITEOUT (1 << 2)
> +# define AT_RENAME_WHITEOUT RENAME_WHITEOUT
>  
>  /* Rename file OLD relative to OLDFD to NEW relative to NEWFD, with
>     additional flags.  */
> diff --git a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
> index dfc554aafc..f425a4bf22 100644
> --- a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
> +++ b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
> @@ -379,6 +379,8 @@ struct file_handle
>  						identity and may not
>  						be usable to
>  						open_by_handle_at.  */
> +# define AT_HANDLE_MNT_ID_UNIQUE 1 /* Return the 64-bit unique mount
> +				      ID.  */
>  #endif
>  
>  __BEGIN_DECLS
>
  

Patch

diff --git a/libio/stdio.h b/libio/stdio.h
index 4436525731..d042b36618 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -168,8 +168,11 @@  extern int renameat (int __oldfd, const char *__old, int __newfd,
 #ifdef __USE_GNU
 /* Flags for renameat2.  */
 # define RENAME_NOREPLACE (1 << 0)
+# define AT_RENAME_NOREPLACE RENAME_NOREPLACE
 # define RENAME_EXCHANGE (1 << 1)
+# define AT_RENAME_EXCHANGE RENAME_EXCHANGE
 # define RENAME_WHITEOUT (1 << 2)
+# define AT_RENAME_WHITEOUT RENAME_WHITEOUT
 
 /* Rename file OLD relative to OLDFD to NEW relative to NEWFD, with
    additional flags.  */
diff --git a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
index dfc554aafc..f425a4bf22 100644
--- a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
+++ b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
@@ -379,6 +379,8 @@  struct file_handle
 						identity and may not
 						be usable to
 						open_by_handle_at.  */
+# define AT_HANDLE_MNT_ID_UNIQUE 1 /* Return the 64-bit unique mount
+				      ID.  */
 #endif
 
 __BEGIN_DECLS