From: Steve Muckle <smuckle.linux@gmail.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] syscalls/getcpu01: support Android
Date: Wed, 12 Sep 2018 10:32:08 -0700 [thread overview]
Message-ID: <20180912173208.131065-1-smuckle.linux@gmail.com> (raw)
Android platforms have the required support for this test.
Signed-off-by: Steve Muckle <smuckle.linux@gmail.com>
---
testcases/kernel/syscalls/getcpu/getcpu01.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/testcases/kernel/syscalls/getcpu/getcpu01.c b/testcases/kernel/syscalls/getcpu/getcpu01.c
index c927512ca..73db5a21a 100644
--- a/testcases/kernel/syscalls/getcpu/getcpu01.c
+++ b/testcases/kernel/syscalls/getcpu/getcpu01.c
@@ -61,7 +61,9 @@
#include <sys/types.h>
#include <dirent.h>
-#if defined(__i386__) || defined(__x86_64__)
+#ifdef ANDROID
+int sys_support = 1;
+#elif defined(__i386__) || defined(__x86_64__)
#if __GLIBC_PREREQ(2,6)
#if defined(__x86_64__)
#include <utmpx.h>
@@ -164,7 +166,7 @@ static inline int getcpu(unsigned *cpu_id, unsigned *node_id,
{
#if defined(__i386__)
return syscall(318, cpu_id, node_id, cache_struct);
-#elif __GLIBC_PREREQ(2,6)
+#elif __GLIBC_PREREQ(2,6) || defined(ANDROID)
*cpu_id = sched_getcpu();
#endif
return 0;
@@ -191,7 +193,7 @@ unsigned int set_cpu_affinity(void)
cpu_set_t *set;
size_t size;
int nrcpus = 1024;
-#if __GLIBC_PREREQ(2, 7)
+#if __GLIBC_PREREQ(2, 7) || defined(ANDROID)
realloc:
set = CPU_ALLOC(nrcpus);
#else
@@ -200,7 +202,7 @@ realloc:
if (set == NULL) {
tst_brkm(TFAIL, NULL, "CPU_ALLOC:errno:%d", errno);
}
-#if __GLIBC_PREREQ(2, 7)
+#if __GLIBC_PREREQ(2, 7) || defined(ANDROID)
size = CPU_ALLOC_SIZE(nrcpus);
CPU_ZERO_S(size, set);
#else
@@ -209,7 +211,7 @@ realloc:
#endif
if (sched_getaffinity(0, size, set) < 0) {
CPU_FREE(set);
-#if __GLIBC_PREREQ(2, 7)
+#if __GLIBC_PREREQ(2, 7) || defined(ANDROID)
if (errno == EINVAL && nrcpus < (1024 << 8)) {
nrcpus = nrcpus << 2;
goto realloc;
@@ -224,7 +226,7 @@ realloc:
tst_exit();
}
cpu_max = max_cpuid(size, set);
-#if __GLIBC_PREREQ(2, 7)
+#if __GLIBC_PREREQ(2, 7) || defined(ANDROID)
CPU_ZERO_S(size, set);
CPU_SET_S(cpu_max, size, set);
#else
@@ -247,7 +249,7 @@ unsigned int max_cpuid(size_t size, cpu_set_t * set)
{
unsigned int index, max = 0;
for (index = 0; index < size * BITS_PER_BYTE; index++)
-#if __GLIBC_PREREQ(2, 7)
+#if __GLIBC_PREREQ(2, 7) || defined(ANDROID)
if (CPU_ISSET_S(index, size, set))
#else
if (CPU_ISSET(index, set))
--
2.19.0.rc2.392.g5ba43deb5a-goog
next reply other threads:[~2018-09-12 17:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-12 17:32 Steve Muckle [this message]
2018-09-27 13:35 ` [LTP] [PATCH] syscalls/getcpu01: support Android Cyril Hrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180912173208.131065-1-smuckle.linux@gmail.com \
--to=smuckle.linux@gmail.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox