Skip to contentSkip to conversation

readahead: use glibc wrapper function

PATCH New Jan Stancek 2 participants 3 messages Mar 24, 2016 – Mar 29, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 readahead: use glibc wrapper function

We have had reports of this testcase not functioning properly on 32bit powerpc systems, because syscall() is not passing 64bit parameters correctly.

This patch is using glibc wrapper, which should be available for a long time now (since glibc 2.3).

---
 testcases/kernel/syscalls/readahead/readahead01.c | 18 ++++++++++--------
 testcases/kernel/syscalls/readahead/readahead02.c |  3 +--
 2 files changed, 11 insertions(+), 10 deletions(-)
testcases/kernel/syscalls/readahead/readahead01.c +10 -8
index f579174b8c8a..5f829bd838f4 100644
@@ -25,14 +25,16 @@
 /*
  * errno tests for readahead() syscall
  */
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/syscall.h>
-#include <sys/socket.h>
+#define _GNU_SOURCE
 #include <errno.h>
+#include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
 #include "config.h"
 #include "test.h"
 #include "safe_macros.h"
@@ -84,7 +86,7 @@ static void test_bad_fd(void)
 	int fd;
 
 	tst_resm(TINFO, "test_bad_fd -1");
-	TEST(ltp_syscall(__NR_readahead, -1, 0, getpagesize()));
+	TEST(readahead(-1, 0, getpagesize()));
 	check_ret(-1);
 	check_errno(EBADF);
 
@@ -96,7 +98,7 @@ static void test_bad_fd(void)
 	fd = open(tempname, O_WRONLY);
 	if (fd == -1)
 		tst_resm(TBROK | TERRNO, "Failed to open testfile");
-	TEST(ltp_syscall(__NR_readahead, fd, 0, getpagesize()));
+	TEST(readahead(fd, 0, getpagesize()));
 	check_ret(-1);
 	check_errno(EBADF);
 	close(fd);
@@ -110,7 +112,7 @@ static void test_invalid_fd(void)
 	tst_resm(TINFO, "test_invalid_fd pipe");
 	if (pipe(fd) < 0)
 		tst_resm(TBROK | TERRNO, "Failed to create pipe");
-	TEST(ltp_syscall(__NR_readahead, fd[0], 0, getpagesize()));
+	TEST(readahead(fd[0], 0, getpagesize()));
 	check_ret(-1);
 	check_errno(EINVAL);
 	close(fd[0]);
@@ -120,7 +122,7 @@ static void test_invalid_fd(void)
 	fd[0] = socket(AF_INET, SOCK_STREAM, 0);
 	if (fd[0] < 0)
 		tst_resm(TBROK | TERRNO, "Failed to create socket");
-	TEST(ltp_syscall(__NR_readahead, fd[0], 0, getpagesize()));
+	TEST(readahead(fd[0], 0, getpagesize()));
 	check_ret(-1);
 	check_errno(EINVAL);
 	close(fd[0]);
testcases/kernel/syscalls/readahead/readahead02.c +1 -2
index 7dc308c03e5d..53278be7d84c 100644
@@ -236,8 +236,7 @@ static void read_testfile(int do_readahead, const char *fname, size_t fsize,
 
 	if (do_readahead) {
 		for (i = 0; i < fsize; i += readahead_size) {
-			TEST(ltp_syscall(__NR_readahead, fd,
-				(off64_t) i, readahead_size));
+			TEST(readahead(fd, (off64_t) i, readahead_size));
 			if (TEST_RETURN != 0)
 				break;
 		}
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 readahead: use glibc wrapper function

Hi!

Quoted 6 lines

We have had reports of this testcase not functioning properly on 32bit powerpc systems, because syscall() is not passing 64bit parameters correctly.

This patch is using glibc wrapper, which should be available for a long time now (since glibc 2.3).

Looks good to me, acked.

Signature · 2 lines
Cyril Hrubis
[email protected]
#2 lore raw

PATCH 1/1 readahead: use glibc wrapper function

----- Original Message -----

Quoted 7 lines

From: "Cyril Hrubis" <[email protected]>
To: "Jan Stancek" <[email protected]>
Cc: [email protected], "Kshitij Malik" <[email protected]>
Sent: Tuesday, 29 March, 2016 2:57:29 PM
Subject: Re: [LTP] [PATCH] readahead: use glibc wrapper function

Hi!

Quoted 8 lines
Quoted 6 lines

We have had reports of this testcase not functioning properly on 32bit powerpc systems, because syscall() is not passing 64bit parameters correctly.

This patch is using glibc wrapper, which should be available for a long time now (since glibc 2.3).

Looks good to me, acked.

Pushed.

Regards,
Jan