From: Yury Norov <ynorov@caviumnetworks.com>
To: <cmetcalf@mellanox.com>
Cc: <cmetcalf@tilera.com>, <arnd@arndb.de>, <catalin.marinas@arm.com>,
<linux-kernel@vger.kernel.org>, <libc-alpha@sourceware.org>,
<pinskia@gmail.com>
Subject: [glibc] preadv/pwritev question
Date: Tue, 31 May 2016 23:04:54 +0300 [thread overview]
Message-ID: <20160531200454.GA32677@yury-N73SV> (raw)
Hi Chris,
In path a63c7fa18a (Add sysdeps/unix/sysv/linux/generic/.) you add
this:
+++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/preadv.c
[...]
+static ssize_t
+do_preadv (int fd, const struct iovec *vector, int count, off_t
offset)
+{
+ assert (sizeof (offset) == 4);
+ return INLINE_SYSCALL (preadv, __ALIGNMENT_COUNT (5, 6), fd,
+ vector, count, __ALIGNMENT_ARG
+ __LONG_LONG_PAIR (offset >> 31, offset));
+}
+
And this is the code that is picked up if I choose wordsize-32 for my
AARCH64/ILP32. So I have questions.
1. What is the assert for? We agreed that all new ABIs will be 64-bit
off_t only.
I fixed it internally like this:
+#ifndef __OFF_T_MATCHES_OFF64_T
assert (sizeof (offset) == 4);
+#endif
There is a bunch of similar assertions in glibc.
2. This one looks weird:
__LONG_LONG_PAIR (offset >> 31, offset))
Why 31-bit offset? And why you don't mask 2nd argument?
Later in your patch I see this:
+static ssize_t
+do_preadv64 (int fd, const struct iovec *vector, int count, off64_t
offset)
+{
+ return INLINE_SYSCALL (preadv, __ALIGNMENT_COUNT (5, 6), fd,
+ vector, count, __ALIGNMENT_ARG
+ __LONG_LONG_PAIR ((off_t) (offset >> 32),
+ (off_t) (offset & 0xffffffff)));
+}
And it looks correct to me. If 1st version is correct as well, I think
it should be commented.
Yury.
next reply other threads:[~2016-05-31 20:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-31 20:04 Yury Norov [this message]
2016-05-31 21:00 ` [glibc] preadv/pwritev question Chris Metcalf
2016-05-31 22:00 ` Mike Frysinger
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=20160531200454.GA32677@yury-N73SV \
--to=ynorov@caviumnetworks.com \
--cc=arnd@arndb.de \
--cc=catalin.marinas@arm.com \
--cc=cmetcalf@mellanox.com \
--cc=cmetcalf@tilera.com \
--cc=libc-alpha@sourceware.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pinskia@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).