Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 204530 - Splice prototype is wrong
Splice prototype is wrong
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
: Reopened
Depends On:
  Show dependency treegraph
Reported: 2006-08-29 15:35 EDT by James Antill
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version: 2.5.90-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-12-04 03:35:58 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Test program for splice() syscall. (2.42 KB, text/plain)
2006-12-04 02:34 EST, James Antill
no flags Details

  None (edit)
Description James Antill 2006-08-29 15:35:02 EDT
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):
Comment 1 James Antill 2006-08-29 16:14:22 EDT
 This is also true with:

Comment 2 Jakub Jelinek 2006-09-01 02:58:30 EDT
Should be fixed in glibc-2.4.90-28.
Comment 3 James Antill 2006-12-04 02:32:40 EST
 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[0], NULL, fd_io1[1], NULL, len_io1, flags);
      mysplice(fd_p2[0], NULL, fd_io2[1], 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

Comment 4 James Antill 2006-12-04 02:34:53 EST
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
Comment 5 Jakub Jelinek 2006-12-04 03:35:58 EST
You need glibc-2.5-4 or above (RHEL5ish and eventually a FC6 update) or
glibc-2.5.90-1 or above (rawhide).
Comment 6 James Antill 2006-12-04 11:16:48 EST
 Thanks for the quick fix. The rawhide package works fine on FC6.

Note You need to log in before you can comment on or make changes to this bug.