Bug 204530 - Splice prototype is wrong
Summary: Splice prototype is wrong
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc   
(Show other bugs)
Version: 6
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
Keywords: Reopened
Depends On:
TreeView+ depends on / blocked
Reported: 2006-08-29 19:35 UTC by James Antill
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version: 2.5.90-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-12-04 08:35:58 UTC
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 07:34 UTC, James Antill
no flags Details

Description James Antill 2006-08-29 19:35:02 UTC
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 20:14:22 UTC
 This is also true with:


Comment 2 Jakub Jelinek 2006-09-01 06:58:30 UTC
Should be fixed in glibc-2.4.90-28.

Comment 3 James Antill 2006-12-04 07:32:40 UTC
 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 07:34:53 UTC
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 08:35:58 UTC
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 16:16:48 UTC
 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.