Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240224165757.GB4163@brightrain.aerifal.cx>
Date: Sat, 24 Feb 2024 11:57:59 -0500
From: Rich Felker <dalias@...c.org>
To: Duncan Bellamy <dunk@...kimushi.com>
Cc: info@...ordhuis.nl, musl@...ts.openwall.com
Subject: Re: [PATCH 2/2] V3 src/stat/fstatat.c use new statx define

On Wed, Aug 31, 2022 at 08:07:35PM +0100, Duncan Bellamy wrote:
> ---
>  src/stat/fstatat.c | 30 +++---------------------------
>  1 file changed, 3 insertions(+), 27 deletions(-)
> 
> diff --git a/src/stat/fstatat.c b/src/stat/fstatat.c
> index 74c51cf5..6b44f48a 100644
> --- a/src/stat/fstatat.c
> +++ b/src/stat/fstatat.c
> @@ -1,4 +1,5 @@
>  #define _BSD_SOURCE
> +#define _GNU_SOURCE
>  #include <sys/stat.h>
>  #include <string.h>
>  #include <fcntl.h>
> @@ -7,36 +8,11 @@
>  #include <sys/sysmacros.h>
>  #include "syscall.h"
>  
> -struct statx {
> -	uint32_t stx_mask;
> -	uint32_t stx_blksize;
> -	uint64_t stx_attributes;
> -	uint32_t stx_nlink;
> -	uint32_t stx_uid;
> -	uint32_t stx_gid;
> -	uint16_t stx_mode;
> -	uint16_t pad1;
> -	uint64_t stx_ino;
> -	uint64_t stx_size;
> -	uint64_t stx_blocks;
> -	uint64_t stx_attributes_mask;
> -	struct {
> -		int64_t tv_sec;
> -		uint32_t tv_nsec;
> -		int32_t pad;
> -	} stx_atime, stx_btime, stx_ctime, stx_mtime;
> -	uint32_t stx_rdev_major;
> -	uint32_t stx_rdev_minor;
> -	uint32_t stx_dev_major;
> -	uint32_t stx_dev_minor;
> -	uint64_t spare[14];
> -};
> -
>  static int fstatat_statx(int fd, const char *restrict path, struct stat *restrict st, int flag)
>  {
>  	struct statx stx;
>  
> -	int ret = __syscall(SYS_statx, fd, path, flag, 0x7ff, &stx);
> +	int ret = __syscall(SYS_statx, fd, path, flag, STATX_BASIC_STATS, &stx);
>  	if (ret) return ret;
>  
>  	*st = (struct stat){
> @@ -152,6 +128,6 @@ int __fstatat(int fd, const char *restrict path, struct stat *restrict st, int f
>  
>  weak_alias(__fstatat, fstatat);
>  
> -#if !_REDIR_TIME64
> +#if !_REDIR_TIME64 && !defined(_GNU_SOURCE)
>  weak_alias(fstatat, fstatat64);
>  #endif
> -- 
> 2.32.1 (Apple Git-133)

I don't understand why the condition for the glibc-compat alias was
changed here. It seems like an unrelated and unmotivated change that
slipped in...

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.