Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 31 Aug 2022 20:07:35 +0100
From: Duncan Bellamy <dunk@...kimushi.com>
To: info@...ordhuis.nl
Cc: musl@...ts.openwall.com,
	Duncan Bellamy <dunk@...kimushi.com>
Subject: [PATCH 2/2] V3 src/stat/fstatat.c use new statx define

---
 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)

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.