some NUMA related syscalls: mbind, get_mempolicy are not supported on
some arches (e.g. i386), this patch checks the syscalls' availability in
setup() function, if the syscall is not implemented on the system, a
TCONF message will be given like this:

get_mempolicy01    1  TCONF  : syscall __NR_get_mempolicy01 not supported on 
your arch

Signed-off-by: Caspar Zhang <[email protected]>
---
 .../syscalls/get_mempolicy/get_mempolicy01.c       |   10 ++++++++++
 testcases/kernel/syscalls/mbind/mbind01.c          |    9 +++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c b/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c
index d0e372c..f321172 100644
--- a/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c
+++ b/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c
@@ -339,6 +339,16 @@ static void cleanup(void)
 
 static void setup(void)
 {
+	/* check syscall availability */
+	if (syscall(__NR_get_mempolicy, NULL, NULL, 0, NULL, 0) == -1) {
+		if (errno == ENOSYS)
+			tst_brkm(TCONF, NULL, "syscall __NR_get_mempolicy "
+				    "not supported on your arch.");
+		else
+			tst_brkm(TBROK|TERRNO, NULL,
+				    "syscall __NR_get_mempolicy");
+	}
+
 	TEST_PAUSE;
 	tst_tmpdir();
 }
diff --git a/testcases/kernel/syscalls/mbind/mbind01.c b/testcases/kernel/syscalls/mbind/mbind01.c
index 2fc6f5a..714dbf7 100644
--- a/testcases/kernel/syscalls/mbind/mbind01.c
+++ b/testcases/kernel/syscalls/mbind/mbind01.c
@@ -300,6 +300,15 @@ TEST_END:
 
 static void setup(void)
 {
+	/* check syscall availability */
+	if (syscall(__NR_mbind, NULL, 0, 0, NULL, 0, 0) == -1) {
+		if (errno == ENOSYS)
+			tst_brkm(TCONF, NULL, "syscall __NR_mbind "
+				    "not supported on your arch.");
+		else
+			tst_brkm(TBROK|TERRNO, NULL, "syscall __NR_mbind");
+	}
+
 	TEST_PAUSE;
 	tst_tmpdir();
 }
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to