Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1444368
| From | "H.J. Lu" <hjl.tools@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] Pass 64-bit off_t as one 64-bit argument on 64-bit platforms |
| Date | 2016-07-15 17:20 +0200 |
| Message-ID | <rVd4e-8vN-21@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
[Multipart message — attachments visible in raw view] - view raw
Currently 64-bit off_t is passed in 2 64-bit arguments on 64-bit
platforms with the second argument ignored by
static inline loff_t pos_from_hilo(unsigned long high, unsigned long low)
{
return (((loff_t)high << HALF_LONG_BITS) << HALF_LONG_BITS) | low;
}
SYSCALL_DEFINE5(preadv, unsigned long, fd, const struct iovec __user *, vec,
unsigned long, vlen, unsigned long, pos_l, unsigned long, pos_h)
{
loff_t pos = pos_from_hilo(pos_h, pos_l);
return do_preadv(fd, vec, vlen, pos, 0);
}
On x86-64, only 4 arguments are passed to preadv. Since off_t is the
last argument, garbage in the 5th argument isn't used by kernel.
Since off_t isn't the last argument for preadv2 nor pwritev2, 64-bit
off_t has be be passed in 2 64-bit arguments. This patch changes preadv,
pwritev, preadv2 and pwritev2 to pass 64-bit off_t in one 64-bit argument
on 64-bit platforms. preadv and pwritev are compatible with passing
off_t in one or two arguments as the 2nd argument is ignored by kernel.
But preadv2 and pwritev2 are incompatible with the old ones.
--
H.J.
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH] Pass 64-bit off_t as one 64-bit argument on 64-bit platforms "H.J. Lu" <hjl.tools@gmail.com> - 2016-07-15 17:20 +0200
csiph-web