Skip to contentSkip to conversation

syscalls/sysfs: replace syscall() macro by ltp_syscall()

PATCH In review Li Wang 2 participants 2 messages Jul 27, 2015 – Jul 28, 2015

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH v2 1/1 syscalls/sysfs: replace syscall() macro by ltp_syscall()

v1 ---> v2
a. remove the __NR_sysfs macro defined
b. replace syscall() with ltp_syscall()

---
 testcases/kernel/syscalls/sysfs/sysfs01.c | 11 +++--------
 testcases/kernel/syscalls/sysfs/sysfs02.c | 11 +++--------
 testcases/kernel/syscalls/sysfs/sysfs03.c | 11 +++--------
 testcases/kernel/syscalls/sysfs/sysfs04.c |  9 ++-------
 testcases/kernel/syscalls/sysfs/sysfs05.c |  9 ++-------
 testcases/kernel/syscalls/sysfs/sysfs06.c |  9 ++-------
 6 files changed, 15 insertions(+), 45 deletions(-)
testcases/kernel/syscalls/sysfs/sysfs01.c +3 -8
index 11ebe43..582918a 100644
@@ -66,10 +66,11 @@
  *Kernel should be compiled with proc filesystem support
  ******************************************************************************/
 
-#include "test.h"
 #include <errno.h>
 #include <unistd.h>
 #include <syscall.h>
+#include "test.h"
+#include "linux_syscall_numbers.h"
 
 static void setup();
 static void cleanup();
@@ -85,14 +86,12 @@ int main(int ac, char **av)
 
 	setup();
 
-#ifdef __NR_sysfs
-
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
 
 		tst_count = 0;
 
 		/* option 1, buf holds fs name */
-		TEST(syscall(__NR_sysfs, 1, "proc"));
+		TEST(ltp_syscall(__NR_sysfs, 1, "proc"));
 
 		/* check return code */
 		if (TEST_RETURN == -1) {
@@ -102,10 +101,6 @@ int main(int ac, char **av)
 			tst_resm(TPASS, "sysfs(2) Passed for " "option 1");
 		}
 	}			/*End of TEST_LOOPING */
-#else
-	tst_resm(TWARN,
-		 "This test can only run on kernels that support the sysfs system call");
-#endif
 
 	/*Clean up and exit */
 	cleanup();
testcases/kernel/syscalls/sysfs/sysfs02.c +3 -8
index f7cb96a..d7e8923 100644
@@ -64,10 +64,11 @@
  *There is no glibc or libc support
  *****************************************************************************/
 
-#include "test.h"
 #include <errno.h>
 #include <unistd.h>
 #include <syscall.h>
+#include "test.h"
+#include "linux_syscall_numbers.h"
 
 static void setup();
 static void cleanup();
@@ -84,14 +85,12 @@ int main(int ac, char **av)
 
 	setup();
 
-#ifdef __NR_sysfs
-
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
 
 		tst_count = 0;
 
 		/*option 2 buf holds fs name */
-		TEST(syscall(__NR_sysfs, 2, 0, buf));
+		TEST(ltp_syscall(__NR_sysfs, 2, 0, buf));
 
 		/* check return code */
 		if (TEST_RETURN == -1) {
@@ -102,10 +101,6 @@ int main(int ac, char **av)
 			tst_resm(TPASS, "sysfs(2) Passed for option 2");
 		}
 	}			/*End of TEST_LOOPING */
-#else
-	tst_resm(TWARN,
-		 "This test can only run on kernels that support the sysfs system call");
-#endif
 
 	/*Clean up and exit */
 	cleanup();
testcases/kernel/syscalls/sysfs/sysfs03.c +3 -8
index 59b997e..51fdc92 100644
@@ -64,10 +64,11 @@
  *There is no glibc or libc support
  *****************************************************************************/
 
-#include "test.h"
 #include <errno.h>
 #include <unistd.h>
 #include <syscall.h>
+#include "test.h"
+#include "linux_syscall_numbers.h"
 
 static void setup();
 static void cleanup();
@@ -83,13 +84,11 @@ int main(int ac, char **av)
 
 	setup();
 
-#ifdef __NR_sysfs
-
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
 
 		tst_count = 0;
 
-		TEST(syscall(__NR_sysfs, 3));
+		TEST(ltp_syscall(__NR_sysfs, 3));
 
 		/* check return code */
 		if (TEST_RETURN == -1) {
@@ -100,10 +99,6 @@ int main(int ac, char **av)
 			tst_resm(TPASS, "sysfs(2) Passed for option 3");
 		}
 	}			/*End of TEST_LOOPING */
-#else
-	tst_resm(TWARN,
-		 "This test can only run on kernels that support the sysfs system call");
-#endif
 
 	/*Clean up and exit */
 	cleanup();
testcases/kernel/syscalls/sysfs/sysfs04.c +2 -7
index f4fda36..6f596e1 100644
@@ -71,6 +71,7 @@
 #include <errno.h>
 #include  <syscall.h>
 #include "test.h"
+#include "linux_syscall_numbers.h"
 
 #define INVALID_OPTION 100
 static void setup();
@@ -87,12 +88,10 @@ int main(int ac, char **av)
 
 	setup();
 
-#ifdef __NR_sysfs
-
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
 
 		tst_count = 0;
-		TEST(syscall(__NR_sysfs, INVALID_OPTION));
+		TEST(ltp_syscall(__NR_sysfs, INVALID_OPTION));
 
 		/* check return code */
 		if ((TEST_RETURN == -1) && (TEST_ERRNO == EINVAL)) {
@@ -104,10 +103,6 @@ int main(int ac, char **av)
 				 " : EINVAL and got %d", EINVAL, TEST_ERRNO);
 		}
 	}
-#else
-	tst_resm(TWARN,
-		 "This test can only run on kernels that support the sysfs system call");
-#endif
 
 	/*Clean up and exit */
 	cleanup();
testcases/kernel/syscalls/sysfs/sysfs05.c +2 -7
index e97f0c8..749efe7 100644
@@ -72,6 +72,7 @@
 #include <errno.h>
 #include <syscall.h>
 #include "test.h"
+#include "linux_syscall_numbers.h"
 
 static void setup();
 static void cleanup();
@@ -101,14 +102,12 @@ int main(int ac, char **av)
 
 	setup();
 
-#ifdef __NR_sysfs
-
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
 
 		for (i = 0; i < TST_TOTAL; i++) {
 
 			tst_count = 0;
-			TEST(syscall(__NR_sysfs, option[i], fsname[i]));
+			TEST(ltp_syscall(__NR_sysfs, option[i], fsname[i]));
 
 			/* check return code */
 			if ((TEST_RETURN == -1)
@@ -128,10 +127,6 @@ int main(int ac, char **av)
 
 		}		/*End of TEST LOOPS */
 	}
-#else
-	tst_resm(TWARN,
-		 "This test can only run on kernels that support the sysfs system call");
-#endif
 
 	/*Clean up and exit */
 	cleanup();
testcases/kernel/syscalls/sysfs/sysfs06.c +2 -7
index 121e944..a282d93 100644
@@ -73,6 +73,7 @@
 #include <syscall.h>
 #include <sys/mman.h>
 #include "test.h"
+#include "linux_syscall_numbers.h"
 
 static void setup();
 static void cleanup();
@@ -104,14 +105,12 @@ int main(int ac, char **av)
 
 	setup();
 
-#ifdef __NR_sysfs
-
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
 
 		for (i = 0; i < TST_TOTAL; i++) {
 
 			tst_count = 0;
-			TEST(syscall
+			TEST(ltp_syscall
 			     (__NR_sysfs, option[i], fsindex[i], bad_addr));
 
 			/* check return code */
@@ -131,10 +130,6 @@ int main(int ac, char **av)
 			}
 		}		/*End of TEST LOOPS */
 	}
-#else
-	tst_resm(TWARN,
-		 "This test can only run on kernels that support the sysfs system call");
-#endif
 
 	/*Clean up and exit */
 	cleanup();
Signature · 8 lines
1.8.3.1


------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw

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

Quoted 6 lines

From: "Li Wang" <[email protected]>
To: [email protected]
Cc: "Jan Stancek" <[email protected]>
Sent: Monday, 27 July, 2015 10:53:12 AM
Subject: [Patch v2] syscalls/sysfs: replace syscall() macro by ltp_syscall()

Quoted 6 lines

v1 ---> v2
a. remove the __NR_sysfs macro defined b. replace syscall() with ltp_syscall()

Pushed with modified commit message, that reflects final version of patch.

Thanks,
Jan

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list