tests/tcg/multiarch/linux-test: use portable alternative for dirent64
dirent64 and readdir64 are glibc-specific and not portable to other C libraries such as musl. Define _FILE_OFFSET_BITS=64 instead, which portably instructs all libc implementations to use 64-bit file offsets, making readdir() and struct dirent equivalent to their 64-bit variants. Signed-off-by: Matheus Tavares Bernardino <matheus.bernardino@oss.qualcomm.com> Reviewed-by: Brian Cain <brian.cain@oss.qualcomm.com> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Message-ID: <af31d21c4d668cfb940ba4159f584fa6454c3d82.1772107448.git.matheus.bernardino@oss.qualcomm.com> Message-ID: <20260320155107.2143191-3-alex.bennee@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Matheus Tavares Bernardino committed
Mar 20, 2026 at 15:51 UTC
e413f66f535c2bf73d76f10a6317d5e6221b140e
1 file changed
+3
-2
tests/tcg/multiarch/linux/linux-test.c
+3
-2
@@ -16,6 +16,7 @@
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, see <http://www.gnu.org/licenses/>.
18
*/
19
+#define _FILE_OFFSET_BITS 64
20
#define _GNU_SOURCE
21
#include <stdarg.h>
22
#include <stdlib.h>
@@ -83,7 +84,7 @@ static void test_file(void)
84
struct utimbuf tbuf;
85
struct iovec vecs[2];
86
DIR *dir;
86
- struct dirent64 *de;
87
+ struct dirent *de;
88
/* TODO: make common tempdir creation for tcg tests */
89
char template[] = "/tmp/linux-test-XXXXXX";
90
char *tmpdir = mkdtemp(template);
@@ -191,7 +192,7 @@ static void test_file(void)
192
error("opendir");
193
len = 0;
194
for(;;) {
194
- de = readdir64(dir);
195
+ de = readdir(dir);
196
if (!de)
197
break;
198
if (strcmp(de->d_name, ".") != 0 &&