public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] io: statx, fstatat: Drop nonnull attribute on the path argument
@ 2024-10-03 18:51 Xi Ruoyao
  2024-12-19 16:19 ` Florian Weimer
  0 siblings, 1 reply; 3+ messages in thread
From: Xi Ruoyao @ 2024-10-03 18:51 UTC (permalink / raw)
  To: libc-alpha
  Cc: Florian Weimer, Adhemerval Zanella, Joseph Myers, Miao Wang, Xi Ruoyao

From: Miao Wang <shankerwangmiao@gmail.com>

Since Linux 6.11 the kernel allows path to be NULL if flags &
AT_EMPTY_PATH.  Let's allow users to take the advantage if they don't
care running on old kernels.

[ xry111: separate the obvious change from the controversial
  "io: statx, fstatat64: allow using NULL as path" patch ]

Signed-off-by: Miao Wang <shankerwangmiao@gmail.com>
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
---
 io/bits/statx-generic.h |  2 +-
 io/sys/stat.h           | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/io/bits/statx-generic.h b/io/bits/statx-generic.h
index 19c3565edc..c0e00c9d8b 100644
--- a/io/bits/statx-generic.h
+++ b/io/bits/statx-generic.h
@@ -62,6 +62,6 @@ __BEGIN_DECLS
 /* Fill *BUF with information about PATH in DIRFD.  */
 int statx (int __dirfd, const char *__restrict __path, int __flags,
            unsigned int __mask, struct statx *__restrict __buf)
-  __THROW __nonnull ((2, 5));
+  __THROW __nonnull ((5));
 
 __END_DECLS
diff --git a/io/sys/stat.h b/io/sys/stat.h
index 3b4ba80132..7ea39b8755 100644
--- a/io/sys/stat.h
+++ b/io/sys/stat.h
@@ -263,14 +263,14 @@ extern int __REDIRECT_NTH (fstat64, (int __fd, struct stat64 *__buf),
 # ifndef __USE_FILE_OFFSET64
 extern int fstatat (int __fd, const char *__restrict __file,
 		    struct stat *__restrict __buf, int __flag)
-     __THROW __nonnull ((2, 3));
+     __THROW __nonnull ((3));
 # else
 #  ifdef __USE_TIME64_REDIRECTS
 #   ifdef __REDIRECT_NTH
 extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
 				     struct stat *__restrict __buf,
 				     int __flag),
-			   __fstatat64_time64) __nonnull ((2, 3));
+			   __fstatat64_time64) __nonnull ((3));
 #   else
 #    define fstatat __fstatat64_time64
 #   endif
@@ -279,7 +279,7 @@ extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
 extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
 				     struct stat *__restrict __buf,
 				     int __flag),
-			   fstatat64) __nonnull ((2, 3));
+			   fstatat64) __nonnull ((3));
 #   else
 #    define fstatat fstatat64
 #   endif
@@ -290,7 +290,7 @@ extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
 #  ifndef __USE_TIME64_REDIRECTS
 extern int fstatat64 (int __fd, const char *__restrict __file,
 		      struct stat64 *__restrict __buf, int __flag)
-     __THROW __nonnull ((2, 3));
+     __THROW __nonnull ((3));
 #  else
 #   ifdef __REDIRECT_NTH
 extern int __REDIRECT_NTH (fstatat64, (int __fd,
@@ -298,7 +298,7 @@ extern int __REDIRECT_NTH (fstatat64, (int __fd,
 				       struct stat64 *__restrict __buf,
 				       int __flag),
 			   __fstatat64_time64)
-     __nonnull ((2, 3));
+     __nonnull ((3));
 #   else
 #    define fstatat64 __fstatat64_time64
 #   endif
-- 
2.46.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] io: statx, fstatat: Drop nonnull attribute on the path argument
  2024-10-03 18:51 [PATCH] io: statx, fstatat: Drop nonnull attribute on the path argument Xi Ruoyao
@ 2024-12-19 16:19 ` Florian Weimer
  2024-12-23  9:31   ` Florian Weimer
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Weimer @ 2024-12-19 16:19 UTC (permalink / raw)
  To: Xi Ruoyao; +Cc: libc-alpha, Adhemerval Zanella, Joseph Myers, Miao Wang

* Xi Ruoyao:

> From: Miao Wang <shankerwangmiao@gmail.com>
>
> Since Linux 6.11 the kernel allows path to be NULL if flags &
> AT_EMPTY_PATH.  Let's allow users to take the advantage if they don't
> care running on old kernels.
>
> [ xry111: separate the obvious change from the controversial
>   "io: statx, fstatat64: allow using NULL as path" patch ]
>
> Signed-off-by: Miao Wang <shankerwangmiao@gmail.com>
> Signed-off-by: Xi Ruoyao <xry111@xry111.site>
> ---
>  io/bits/statx-generic.h |  2 +-
>  io/sys/stat.h           | 10 +++++-----
>  2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/io/bits/statx-generic.h b/io/bits/statx-generic.h
> index 19c3565edc..c0e00c9d8b 100644
> --- a/io/bits/statx-generic.h
> +++ b/io/bits/statx-generic.h
> @@ -62,6 +62,6 @@ __BEGIN_DECLS
>  /* Fill *BUF with information about PATH in DIRFD.  */
>  int statx (int __dirfd, const char *__restrict __path, int __flags,
>             unsigned int __mask, struct statx *__restrict __buf)
> -  __THROW __nonnull ((2, 5));
> +  __THROW __nonnull ((5));
>  
>  __END_DECLS
> diff --git a/io/sys/stat.h b/io/sys/stat.h
> index 3b4ba80132..7ea39b8755 100644
> --- a/io/sys/stat.h
> +++ b/io/sys/stat.h
> @@ -263,14 +263,14 @@ extern int __REDIRECT_NTH (fstat64, (int __fd, struct stat64 *__buf),
>  # ifndef __USE_FILE_OFFSET64
>  extern int fstatat (int __fd, const char *__restrict __file,
>  		    struct stat *__restrict __buf, int __flag)
> -     __THROW __nonnull ((2, 3));
> +     __THROW __nonnull ((3));
>  # else
>  #  ifdef __USE_TIME64_REDIRECTS
>  #   ifdef __REDIRECT_NTH
>  extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
>  				     struct stat *__restrict __buf,
>  				     int __flag),
> -			   __fstatat64_time64) __nonnull ((2, 3));
> +			   __fstatat64_time64) __nonnull ((3));
>  #   else
>  #    define fstatat __fstatat64_time64
>  #   endif
> @@ -279,7 +279,7 @@ extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
>  extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
>  				     struct stat *__restrict __buf,
>  				     int __flag),
> -			   fstatat64) __nonnull ((2, 3));
> +			   fstatat64) __nonnull ((3));
>  #   else
>  #    define fstatat fstatat64
>  #   endif
> @@ -290,7 +290,7 @@ extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
>  #  ifndef __USE_TIME64_REDIRECTS
>  extern int fstatat64 (int __fd, const char *__restrict __file,
>  		      struct stat64 *__restrict __buf, int __flag)
> -     __THROW __nonnull ((2, 3));
> +     __THROW __nonnull ((3));
>  #  else
>  #   ifdef __REDIRECT_NTH
>  extern int __REDIRECT_NTH (fstatat64, (int __fd,
> @@ -298,7 +298,7 @@ extern int __REDIRECT_NTH (fstatat64, (int __fd,
>  				       struct stat64 *__restrict __buf,
>  				       int __flag),
>  			   __fstatat64_time64)
> -     __nonnull ((2, 3));
> +     __nonnull ((3));
>  #   else
>  #    define fstatat64 __fstatat64_time64
>  #   endif

This looks good to me.

Reviewed-by: Florian Weimer <fweimer@redhat.com>

Any objections to pushing this?

Thanks,
Florian


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] io: statx, fstatat: Drop nonnull attribute on the path argument
  2024-12-19 16:19 ` Florian Weimer
@ 2024-12-23  9:31   ` Florian Weimer
  0 siblings, 0 replies; 3+ messages in thread
From: Florian Weimer @ 2024-12-23  9:31 UTC (permalink / raw)
  To: Xi Ruoyao; +Cc: libc-alpha, Adhemerval Zanella, Joseph Myers, Miao Wang

* Florian Weimer:

> * Xi Ruoyao:
>
>> From: Miao Wang <shankerwangmiao@gmail.com>
>>
>> Since Linux 6.11 the kernel allows path to be NULL if flags &
>> AT_EMPTY_PATH.  Let's allow users to take the advantage if they don't
>> care running on old kernels.
>>
>> [ xry111: separate the obvious change from the controversial
>>   "io: statx, fstatat64: allow using NULL as path" patch ]
>>
>> Signed-off-by: Miao Wang <shankerwangmiao@gmail.com>
>> Signed-off-by: Xi Ruoyao <xry111@xry111.site>
>> ---
>>  io/bits/statx-generic.h |  2 +-
>>  io/sys/stat.h           | 10 +++++-----
>>  2 files changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/io/bits/statx-generic.h b/io/bits/statx-generic.h
>> index 19c3565edc..c0e00c9d8b 100644
>> --- a/io/bits/statx-generic.h
>> +++ b/io/bits/statx-generic.h
>> @@ -62,6 +62,6 @@ __BEGIN_DECLS
>>  /* Fill *BUF with information about PATH in DIRFD.  */
>>  int statx (int __dirfd, const char *__restrict __path, int __flags,
>>             unsigned int __mask, struct statx *__restrict __buf)
>> -  __THROW __nonnull ((2, 5));
>> +  __THROW __nonnull ((5));
>>  
>>  __END_DECLS
>> diff --git a/io/sys/stat.h b/io/sys/stat.h
>> index 3b4ba80132..7ea39b8755 100644
>> --- a/io/sys/stat.h
>> +++ b/io/sys/stat.h
>> @@ -263,14 +263,14 @@ extern int __REDIRECT_NTH (fstat64, (int __fd, struct stat64 *__buf),
>>  # ifndef __USE_FILE_OFFSET64
>>  extern int fstatat (int __fd, const char *__restrict __file,
>>  		    struct stat *__restrict __buf, int __flag)
>> -     __THROW __nonnull ((2, 3));
>> +     __THROW __nonnull ((3));
>>  # else
>>  #  ifdef __USE_TIME64_REDIRECTS
>>  #   ifdef __REDIRECT_NTH
>>  extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
>>  				     struct stat *__restrict __buf,
>>  				     int __flag),
>> -			   __fstatat64_time64) __nonnull ((2, 3));
>> +			   __fstatat64_time64) __nonnull ((3));
>>  #   else
>>  #    define fstatat __fstatat64_time64
>>  #   endif
>> @@ -279,7 +279,7 @@ extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
>>  extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
>>  				     struct stat *__restrict __buf,
>>  				     int __flag),
>> -			   fstatat64) __nonnull ((2, 3));
>> +			   fstatat64) __nonnull ((3));
>>  #   else
>>  #    define fstatat fstatat64
>>  #   endif
>> @@ -290,7 +290,7 @@ extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
>>  #  ifndef __USE_TIME64_REDIRECTS
>>  extern int fstatat64 (int __fd, const char *__restrict __file,
>>  		      struct stat64 *__restrict __buf, int __flag)
>> -     __THROW __nonnull ((2, 3));
>> +     __THROW __nonnull ((3));
>>  #  else
>>  #   ifdef __REDIRECT_NTH
>>  extern int __REDIRECT_NTH (fstatat64, (int __fd,
>> @@ -298,7 +298,7 @@ extern int __REDIRECT_NTH (fstatat64, (int __fd,
>>  				       struct stat64 *__restrict __buf,
>>  				       int __flag),
>>  			   __fstatat64_time64)
>> -     __nonnull ((2, 3));
>> +     __nonnull ((3));
>>  #   else
>>  #    define fstatat64 __fstatat64_time64
>>  #   endif
>
> This looks good to me.
>
> Reviewed-by: Florian Weimer <fweimer@redhat.com>
>
> Any objections to pushing this?

Hearing no objections, I've pushed this.

Thanks,
Florian


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-12-23  9:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-03 18:51 [PATCH] io: statx, fstatat: Drop nonnull attribute on the path argument Xi Ruoyao
2024-12-19 16:19 ` Florian Weimer
2024-12-23  9:31   ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).