[Ocfs2-test-devel] [REPORT] splice_test.h: conflicting types for ‘splice' comes again
Coly Li
coly.li at suse.de
Sun Apr 12 23:51:08 PDT 2009
tristan.ye Wrote:
> On Mon, 2009-04-13 at 02:21 +0800, Coly Li wrote:
>> Several days passed since last time I observed the splice conflicted definition
>> and submitted a patch[1]. Today I saw the same error again.
>>
>> This time, I pull the code up-to-date, run autogen.sh and make. The similar
>> error comes:
>> make -C splice
>> make[2]: Entering directory `/root/ocfs2-test/programs/splice'
>> gcc -O2 -Wall -g -MD -MP -MF ./.splice_read.d -o splice_read.o -c
>> splice_read.c
>> In file included from splice_read.c:2:
>> splice_test.h:34: error: conflicting types for ‘splice’
>> /usr/include/bits/fcntl.h:244: error: previous declaration of ‘splice’ was here
>> make[2]: *** [splice_read.o] Error 1
>> make[2]: Leaving directory `/root/ocfs2-test/programs/splice'
>> make[1]: *** [splice] Error 2
>> make[1]: Leaving directory `/root/ocfs2-test/programs'
>> make: *** [programs] Error 2
>>
>> I past the whole compile log on: http://nopaste.com/p/aRz7tukuc , will be
>> available for several days.
>>
>> Can anybody reproduce the issue ?
>>
>> Thanks.
>>
>
> Coly,
>
> I remembered you passed the compilation last time without modifying the
> src a bit, but just by a refresh 'autogen':)?
>
Yes, but this time the refreshing does not work any more :(
> Such a compiling error may have something to do with your enviornment.
> under my development env, the splice() defined in bits/fcntl.h like
> following,
>
> /* Splice two files together. */
> extern int splice (int __fdin, __off64_t *__offin, int __fdout,
> __off64_t *__offout, size_t __len, unsigned int
> __flags)
> __THROW;
>
> And in our ocfs2-test/splice/splice_test.h, such declaration as follows,
> int splice(int fdin, loff_t *off_in, int fdout,
> loff_t *off_out, size_t len, unsigned int
> flags)
>
> We saw the only thing could potentially casue the conflicting type error
> is the difference between 'loff_t' and '__off64_t', in my testing env,
> such two data type were perfectly the same as we can prove this by
> observing file bits/types.h:
>
> typedef __off64_t __loff_t; /* Type of file sizes and offsets (LFS).
> */
>
> And that's also why most of us will not likely to hit such error!
>
> Would you please paste the corresponding codes as described above from
> bits/fcntl.h and bits/types.h to see what's happening in your testing
> env? not sure why loff_t and __off64_t were different in your env.
>
On openSuSE 11.1 (almost same to SLES11) the splice in bits/fcntl.h is:
/* Splice two files together. */
extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
__off64_t *__offout, size_t __len,
unsigned int __flags);
And the bits/types.h is:
/* These few don't really vary by system, they always correspond
to one of the other defined types. */
typedef __off64_t __loff_t; /* Type of file sizes and offsets (LFS). */
The conflict is on the return value of splice() in bits/fcntl.h, which is int
VS. ssize_t.
On 32bit system, ssize_t is identical to int, on my 64bit openSuSE 11.1, ssize_t
is defined to long int. And from the splice(2) man page, the return value should
be 'long' other than 'int'. This might be how type conflict comes.
> I guess it's safe to use 'loff_t' in original splice_test.h without any
> patch needed:)
Such a patch fixes the compiling error:
programs/splice/splice_test.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/programs/splice/splice_test.h b/programs/splice/splice_test.h
index 5113bbb..daf02a5 100644
--- a/programs/splice/splice_test.h
+++ b/programs/splice/splice_test.h
@@ -31,7 +31,7 @@
#error unsupported arch
#endif
-int splice(int fdin, loff_t *off_in, int fdout,
+ssize_t splice(int fdin, loff_t *off_in, int fdout,
loff_t *off_out, size_t len, unsigned int flags)
{
return syscall(__NR_splice, fdin, off_in, fdout, off_out, len, flags);
(This is just a copy+past, I will post a real patch later)
Thanks for your kindly feedback :)
--
Coly Li
SuSE Labs
More information about the Ocfs2-test-devel
mailing list