From: "Arnd Bergmann" <arnd@arndb.de>
To: "Zhangjin Wu" <falcon@tinylab.org>
Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
"Thomas Weißschuh" <linux@weissschuh.net>,
"Thomas Weißschuh" <thomas@t-8ch.de>, "Willy Tarreau" <w@1wt.eu>
Subject: Re: [PATCH v3 03/14] selftests/nolibc: add _LARGEFILE64_SOURCE for musl
Date: Fri, 30 Jun 2023 20:45:15 +0200 [thread overview]
Message-ID: <d096e463-b135-49b1-884b-a3038723ccdd@app.fastmail.com> (raw)
In-Reply-To: <20230630180126.283419-1-falcon@tinylab.org>
On Fri, Jun 30, 2023, at 20:01, Zhangjin Wu wrote:
> Hi, Arnd
>
>> On Fri, Jun 30, 2023, at 16:44, Zhangjin Wu wrote:
>> > _GNU_SOURCE Implies _LARGEFILE64_SOURCE in glibc, but in musl, the
>> > default configuration doesn't enable _LARGEFILE64_SOURCE.
>> >
>> > From include/dirent.h of musl, getdents64 is provided as getdents when
>> > _LARGEFILE64_SOURCE is defined.
>> >
>> > #if defined(_LARGEFILE64_SOURCE)
>> > ...
>> > #define getdents64 getdents
>> > #endif
>> >
>> > Let's define _LARGEFILE64_SOURCE to fix up this compile error:
>>
>> I think a better solution would be to use the normal getdents() instead
>> of glibc getdents64(), but then define _FILE_OFFSET_BITS=64 to tell
>> glibc to use the modern version of all filesystem syscalls.
>>
>
> Just checked the getdents manpage[1] and the nolibc code, both of glibc and
> nolibc don't provide the getdents() library routine but both of them provide
> the getdents64(), only musl provide getdents() by default.
>
> And as the manpage shows, it is not easy to call getdents() with glibc, we
> need manually call syscall() and define the 'dirent' struct ourselves:
>
> glibc does not provide a wrapper for getdents(); call getdents()
> using syscall(2). In that case you will need to define the
> linux_dirent or linux_dirent64 structure yourself.
>
> And for nolibc, a getdents64() with linux_dirent64 struct (with int64_t offset)
> is provided, there is either no getdents() currently.
>
> This patch aims to let nolibc-test at least compile for musl and therefore we
> can easily check the new tests for musl, glibc and nolibc together.
Ok, I see. Your current approach should be fine then.
> For the 64bit offset related stuff, we'd better delay it in another patchset
> (part of full rv32 support), which will convert the off_t to 64bit by default.
Right, makes sense.
ARnd
next prev parent reply other threads:[~2023-06-30 18:45 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-30 14:41 [PATCH v3 00/14] selftests/nolibc: allow run with minimal kernel config Zhangjin Wu
2023-06-30 14:42 ` [PATCH v3 01/14] selftests/nolibc: stat_fault: silence NULL argument warning with glibc Zhangjin Wu
2023-06-30 14:43 ` [PATCH v3 02/14] selftests/nolibc: gettid: restore for glibc and musl Zhangjin Wu
2023-06-30 14:44 ` [PATCH v3 03/14] selftests/nolibc: add _LARGEFILE64_SOURCE for musl Zhangjin Wu
2023-06-30 15:23 ` Arnd Bergmann
2023-06-30 18:01 ` Zhangjin Wu
2023-06-30 18:45 ` Arnd Bergmann [this message]
2023-06-30 14:46 ` [PATCH v3 04/14] selftests/nolibc: fix up int_fast16/32_t test cases " Zhangjin Wu
2023-06-30 14:47 ` [PATCH v3 05/14] selftests/nolibc: fix up kernel parameters support Zhangjin Wu
2023-06-30 14:48 ` [PATCH v3 06/14] selftests/nolibc: stat_timestamps: remove procfs dependency Zhangjin Wu
2023-06-30 14:50 ` [PATCH v3 07/14] selftests/nolibc: chroot_exe: " Zhangjin Wu
2023-06-30 14:52 ` [PATCH v3 08/14] selftests/nolibc: link_cross: use /proc/self/cmdline Zhangjin Wu
2023-06-30 14:54 ` [PATCH v3 09/14] tools/nolibc: add rmdir() support Zhangjin Wu
2023-06-30 14:55 ` [PATCH v3 10/14] selftests/nolibc: add a new rmdir() test case Zhangjin Wu
2023-06-30 14:56 ` [PATCH v3 11/14] selftests/nolibc: fix up failures when CONFIG_PROC_FS=n Zhangjin Wu
2023-06-30 14:58 ` [PATCH v3 12/14] selftests/nolibc: prepare /tmp for tmpfs or ramfs Zhangjin Wu
2023-06-30 14:59 ` [PATCH v3 13/14] selftests/nolibc: add chmod_tmpdir test Zhangjin Wu
2023-06-30 15:00 ` [PATCH v3 14/14] selftests/nolibc: vfprintf: remove MEMFD_CREATE dependency Zhangjin Wu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d096e463-b135-49b1-884b-a3038723ccdd@app.fastmail.com \
--to=arnd@arndb.de \
--cc=falcon@tinylab.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=thomas@t-8ch.de \
--cc=w@1wt.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®