glibc doesn't define getdents() and requires use of the raw syscall.
As such lib9/dirread.c needed to decide whether to use SYS_getdents or
SYS_getdents64 and was checking if __USE_LARGEFILE64 was defined in
order to do so. musl does not define __USE_LARGEFILE64 so the wrong
syscall was being used. musl does however define _LARGEFILE64_SOURCE,
the macro that glibc checks in order to define __USE_LARGEFILE64.
From 1711bb2c1648d355d1d6998f02c6df1a344663a8 Mon Sep 17 00:00:00 2001
From: Evan Gates <evan.ga...@gmail.com>
Date: Fri, 9 Sep 2016 12:36:57 -0700
Subject: [PATCH] check for _LARGEFILE64_SOURCE instead of __USE_LARGEFILE64

glibc doesn't define getdents() and requires use of the raw syscall. As
such lib9/dirread.c needed to decide whether to use SYS_getdents or
SYS_getdents64 and was checking if __USE_LARGEFILE64 was defined in
order to do so. musl does not define __USE_LARGEFILE64 so the wrong
syscall was being used. musl does however define _LARGEFILE64_SOURCE,
the macro that glibc checks in order to define __USE_LARGEFILE64.
---
 lib9/dirread.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib9/dirread.c b/lib9/dirread.c
index f114195..6c494ab 100644
--- a/lib9/dirread.c
+++ b/lib9/dirread.c
@@ -6,7 +6,7 @@
 
 #if defined (__linux__)
 # include <sys/syscall.h>
-# if defined (__USE_LARGEFILE64)
+# if defined (_LARGEFILE64_SOURCE)
 #  define getdents SYS_getdents64
 # else
 #  define getdents SYS_getdents
-- 
2.9.3

Reply via email to