Re: [PATCH 2/3] vmsplice: make vmsplice a trivial wrapper for preadv2/pwritev2
From: Linus Torvalds
Date: Thu Jun 04 2026 - 10:35:54 EST
On Thu, 4 Jun 2026 at 02:06, David Laight <david.laight.linux@xxxxxxxxx> wrote:
>
> Something needs to ensure that the high 32bits of the fd get masked off
> on 64bit systems.
That something already exists: CLASS(fd, f)(fd);
It ignores the top bits, because 'fdget()' takes an 'unsigned int'.
We have been a bit random in how we declare the system calls in
general, and we mix 'unsigned int' and 'int' and 'unsigned long'
pretty much randomly when it comes to file descriptor arguments to
system calls.
fs/read_write.c in particular uses all three cases with no real logic to it all:
SYSCALL_DEFINE3(lseek, unsigned int, fd, ..
SYSCALL_DEFINE3(readv, unsigned long, fd, ..
SYSCALL_DEFINE4(sendfile, int, out_fd, ..
but then anything that uses fdget() (through one of the helper classes
or not) will simply not care.
Does it make sense? Is it pretty? Nope. Does it matter? Also nope.
Linus