Red Hat Bugzilla – Bug 204530
Splice prototype is wrong
Last modified: 2007-11-30 17:11:41 EST
Description of problem:
/usr/include/bits/fcntl.h has the prototype of the splice() system call as:
extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags)
...the kernel has the prototype as:
asmlinkage long sys_splice(int fd_in, loff_t __user *off_in,
int fd_out, loff_t __user *off_out,
size_t len, unsigned int flags)
Version-Release number of selected component (if applicable):
This is also true with:
Should be fixed in glibc-2.4.90-28.
Argghhh, I've just spent way too long working out this isn't fixed.
The prototype is fixed, but the syscall itself is broken. See my attached patch
for my test program. The main set of lines for the below is:
mysplice(fd_p1, NULL, fd_io1, NULL, len_io1, flags);
mysplice(fd_p2, NULL, fd_io2, NULL, len_io2, flags);
Using the mysplice == splice (Ie. glibc code) I get, from strace:
SYS_313(0x80487ef, 0x3, 0, 0x8, 0) = 0
SYS_313(0x804881f, 0x5, 0, 0xa, 0) = 0
...using a mysplice function which is just a wrapper for syscall(SYS_splice) I
get, from strace:
SYS_313(0x3, 0, 0x8, 0, 0x4) = 4
SYS_313(0x5, 0, 0xa, 0, 0x8) = 8
% rpm -q glibc ~/work/tmp
Created attachment 142700 [details]
Test program for splice() syscall.
Compile like so:
gcc -Wall -W -o splicetst splicetst.c
...run like so:
% echo -n 12345678 > /tmp/sml_8
% echo -n 1234 > /tmp/sml_4
% strace -f ./splicetst /tmp/sml_4 /tmp/o1 /tmp/sml_8 /tmp/o2
You need glibc-2.5-4 or above (RHEL5ish and eventually a FC6 update) or
glibc-2.5.90-1 or above (rawhide).
Thanks for the quick fix. The rawhide package works fine on FC6.