[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAMe9rOoaLhhP-Xe_d2eXcQPmCtjq7oAa1Amr_nVZoXTVws6ByQ@mail.gmail.com>
Date: Fri, 15 Jul 2016 08:13:20 -0700
From: "H.J. Lu" <hjl.tools@...il.com>
To: LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] Pass 64-bit off_t as one 64-bit argument on 64-bit platforms
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.
View attachment "0001-Pass-64-bit-off_t-as-one-64-bit-argument-on-64-bit-p.patch" of type "text/x-patch" (4895 bytes)
Powered by blists - more mailing lists