From: Steven Rostedt <rostedt@goodmis.org>
To: Khem Raj <raj.khem@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH] Replace LFS64 interfaces off64_t and lseek64
Date: Mon, 9 Jan 2023 13:05:39 -0500 [thread overview]
Message-ID: <20230109130539.62a15985@gandalf.local.home> (raw)
In-Reply-To: <20230107010245.1290391-1-raj.khem@gmail.com>
On Fri, 6 Jan 2023 17:02:45 -0800
Khem Raj <raj.khem@gmail.com> wrote:
> Musl does not define these interfaces unless -D_LARGEFILE64_SOURCE is
> defined and that too it is transitional until apps switch to using 64bit
> off_t. We pass -D_LARGEFILE64_SOURCE in makefiles already therefore
> original lseek and off_t are already 64bit
I just tested this, and that's not true.
static void pdie(const char *msg)
{
perror(msg);
exit(-1);
}
int main (int argc, char **argv)
{
off_t off;
int fd;
argv0 = argv[0];
if (argc < 2)
usage();
printf("off size = %zd\n", sizeof(off));
fd = open(argv[1], O_RDONLY);
if (fd < 0)
pdie("open");
off = lseek(fd, 0, SEEK_END);
if (off < 0)
pdie("lseek");
printf("offset = %zd\n", off);
return 0;
}
I compiled the above on a 32bit machine with:
$ gcc -D_LARGEFILE64_SOURCE -o lseek lseek.c
$ ./lseek big-file
Where big-file was 6GBs, and I got this:
off size = 4
lseek: Value too large for defined data type
The _LARGEFILE64_SOURCE just makes the 64 bit versions available. It does
not convert the original ones.
>
> This fixes build with latest musl which has dropped LFS64 interfaces [1]
>
> [1] https://git.musl-libc.org/cgit/musl/commit/?id=246f1c811448f37a44b41cd8df8d0ef9736d95f4i
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
What we could do is add something like:
#ifdef MUSL
# define off64_t off_t
# define lseek64 lseek
[..]
#endif
in one of the headers to make it work with musl.
-- Steve
next prev parent reply other threads:[~2023-01-09 18:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-07 1:02 [PATCH] Replace LFS64 interfaces off64_t and lseek64 Khem Raj
2023-01-09 18:05 ` Steven Rostedt [this message]
2023-01-09 18:10 ` Steven Rostedt
2023-01-09 19:42 ` Khem Raj
2023-01-09 20:46 ` Steven Rostedt
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=20230109130539.62a15985@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.org \
--cc=raj.khem@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).