[LTP] [PATCH resend 3/6] syscalls/numa: check syscall availability

Caspar Zhang
2012-08-09T06:16:13Z

[-- Attachment #1: Type: text/plain, Size: 589 bytes --]

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 <caspar@casparzhang.com>
---
.../syscalls/get_mempolicy/get_mempolicy01.c | 10 ++++++++++
testcases/kernel/syscalls/mbind/mbind01.c | 9 +++++++++
2 files changed, 19 insertions(+), 0 deletions(-)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0003-syscalls-numa-check-syscall-availability.patch --]
[-- Type: text/x-patch; name="0003-syscalls-numa-check-syscall-availability.patch", Size: 1305 bytes --]

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();
}

[-- Attachment #3: Type: text/plain, Size: 395 bytes --]

------------------------------------------------------------------------------
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/

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]