From: Subrata M. <su...@li...> - 2009-05-22 15:05:24
|
Hi, >On Fri, 2009-05-22 at 09:02 -0400, Srinivasan Subramanian3 wrote: >Hi all, > > When i tried to build ltp on a RHEL4.8 machine, the build failed with undefined reference on splice02. > > Machine info > > RHEL4.8 GA (64 bit) > > Kernel version- 2.6.9-89.EL > > Error Info > > /root/ltp-intermediate-20090521/testcases/kernel/syscalls/splice/splice02.c:126: undefined reference to `splice' > collect2: ld returned 1 exit status > make[4]: *** [splice02] Error 1 > make[4]: Leaving directory `/root/ltp-intermediate-20090521/testcases/kernel/syscalls/splice' > make[3]: *** [all] Error 2 > make[3]: Leaving directory `/root/ltp-intermediate-20090521/testcases/kernel/syscalls' > make[2]: *** [all] Error 2 > make[2]: Leaving directory `/root/ltp-intermediate-20090521/testcases/kernel' > make[1]: *** [all] Error 2 > make[1]: Leaving directory `/root/ltp-intermediate-20090521/testcases' > make: *** [all] Error 2 > > Kindly help me on this issue. Hope the following patch solves your problem: 1) Avoids build problem on your very old kernel, 2) Will not run on on your old kernel but on kernel > 2.6.17, Signed-off-by: Subrata Modak <su...@li...> --- --- ltp-intermediate-20090521/testcases/kernel/syscalls/splice/splice02.c.orig 2009-05-22 18:33:41.000000000 +0530 +++ ltp-intermediate-20090521/testcases/kernel/syscalls/splice/splice02.c 2009-05-22 19:10:49.000000000 +0530 @@ -52,6 +52,15 @@ char *TCID = "splice02"; /* Test progra int testno; int TST_TOTAL = 1; /* total number of tests in this file. */ +static inline long ltp_splice(int fd_in, loff_t *off_in, + int fd_out, loff_t *off_out, + size_t len, unsigned int flags) +{ + return syscall(__NR_splice, fd_in, off_in, fd_out, + off_out, len, flags); +} + + /* Extern Global Functions */ /******************************************************************************/ /* */ @@ -108,7 +117,15 @@ void setup() { int main(int ac, char **av) { int fd = 0; - + int results = 0; + + /* Disable test if the version of the kernel is less than 2.6.17 */ + if (((results = tst_kvercmp(2, 6, 17)) < 0)) { + tst_resm(TINFO, "This test can only run on kernels that are "); + tst_resm(TINFO, "2.6.17 and higher"); + exit(0); + } + setup(); if (ac < 2 ) { @@ -123,7 +140,7 @@ int main(int ac, char **av) { } do { - TEST(splice(STDIN_FILENO, NULL, fd, NULL, SPLICE_SIZE, 0)); + TEST(ltp_splice(STDIN_FILENO, NULL, fd, NULL, SPLICE_SIZE, 0)); if (TEST_RETURN < 0) { tst_resm(TFAIL, "splice failed - errno = %d : %s", TEST_ERRNO, strerror(TEST_ERRNO)); cleanup(); --- Regards-- Subrata > Thanks & > > --------------------------------- > Best Regards, > Srinivasan S, > Linux on System z, LTC > sri...@in... > sri...@li... > ---------------------------------- |