summaryrefslogtreecommitdiffstats
path: root/poky/meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch
diff options
context:
space:
mode:
Diffstat (limited to 'poky/meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch')
-rw-r--r--poky/meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch190
1 files changed, 29 insertions, 161 deletions
diff --git a/poky/meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch b/poky/meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch
index 428ac3004..7311ee2e4 100644
--- a/poky/meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch
+++ b/poky/meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch
@@ -1,7 +1,7 @@
-From a3cbee31daae2466bc8dcac36b33a01352693346 Mon Sep 17 00:00:00 2001
+From fc2b47ad979a87bfbd11aeea3f67c26e7fb39e30 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 7 Jan 2016 19:40:08 +0000
-Subject: [PATCH 01/26] Check if __GLIBC_PREREQ is defined before using it
+Subject: [PATCH] Check if __GLIBC_PREREQ is defined before using it
__GLIBC_PREREQ is specific to glibc so it should be checked if it is
defined or not.
@@ -10,13 +10,12 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
Upstream-Status: Pending
---
- testcases/kernel/syscalls/accept4/accept4_01.c | 9 ++++-
- testcases/kernel/syscalls/getcpu/getcpu01.c | 39 +++++++++++++++++++++-
- .../sched_getaffinity/sched_getaffinity01.c | 26 +++++++++++++++
- 3 files changed, 72 insertions(+), 2 deletions(-)
+ .../kernel/syscalls/accept4/accept4_01.c | 9 ++++++-
+ .../sched_getaffinity/sched_getaffinity01.c | 26 +++++++++++++++++++
+ 2 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/syscalls/accept4/accept4_01.c b/testcases/kernel/syscalls/accept4/accept4_01.c
-index 6072bfa..2b090cb 100644
+index dec4ef93b..c5d74b07f 100644
--- a/testcases/kernel/syscalls/accept4/accept4_01.c
+++ b/testcases/kernel/syscalls/accept4/accept4_01.c
@@ -64,6 +64,7 @@ static void cleanup(void)
@@ -59,131 +58,8 @@ index 6072bfa..2b090cb 100644
#else
acceptfd = accept4(lfd, (struct sockaddr *)&claddr, &addrlen,
closeonexec_flag | nonblock_flag);
-diff --git a/testcases/kernel/syscalls/getcpu/getcpu01.c b/testcases/kernel/syscalls/getcpu/getcpu01.c
-index c927512..921b107 100644
---- a/testcases/kernel/syscalls/getcpu/getcpu01.c
-+++ b/testcases/kernel/syscalls/getcpu/getcpu01.c
-@@ -62,6 +62,7 @@
- #include <dirent.h>
-
- #if defined(__i386__) || defined(__x86_64__)
-+#if defined(__GLIBC__)
- #if __GLIBC_PREREQ(2,6)
- #if defined(__x86_64__)
- #include <utmpx.h>
-@@ -75,10 +76,17 @@ int sys_support = 0;
- #else
- int sys_support = 0;
- #endif
-+#else
-+int sys_support = 0;
-+#endif
-
-+#if defined(__GLIBC__)
- #if !(__GLIBC_PREREQ(2, 7))
- #define CPU_FREE(ptr) free(ptr)
- #endif
-+#else
-+#define CPU_FREE(ptr) free(ptr)
-+#endif
-
- void cleanup(void);
- void setup(void);
-@@ -164,7 +172,11 @@ 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 defined(__GLIBC__)
-+#if __GLIBC_PREREQ(2,6)
-+ *cpu_id = sched_getcpu();
-+#endif
-+#else
- *cpu_id = sched_getcpu();
- #endif
- return 0;
-@@ -191,15 +203,20 @@ unsigned int set_cpu_affinity(void)
- cpu_set_t *set;
- size_t size;
- int nrcpus = 1024;
-+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
- #if __GLIBC_PREREQ(2, 7)
- realloc:
- set = CPU_ALLOC(nrcpus);
- #else
- set = malloc(sizeof(cpu_set_t));
- #endif
-+#else
-+ set = malloc(sizeof(cpu_set_t));
-+#endif
- if (set == NULL) {
- tst_brkm(TFAIL, NULL, "CPU_ALLOC:errno:%d", errno);
- }
-+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
- #if __GLIBC_PREREQ(2, 7)
- size = CPU_ALLOC_SIZE(nrcpus);
- CPU_ZERO_S(size, set);
-@@ -207,8 +224,13 @@ realloc:
- size = sizeof(cpu_set_t);
- CPU_ZERO(set);
- #endif
-+#else
-+ size = sizeof(cpu_set_t);
-+ CPU_ZERO(set);
-+#endif
- if (sched_getaffinity(0, size, set) < 0) {
- CPU_FREE(set);
-+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
- #if __GLIBC_PREREQ(2, 7)
- if (errno == EINVAL && nrcpus < (1024 << 8)) {
- nrcpus = nrcpus << 2;
-@@ -220,10 +242,17 @@ realloc:
- "NR_CPUS of the kernel is more than 1024, so we'd better use a newer glibc(>= 2.7)");
- else
- #endif
-+#else
-+ if (errno == EINVAL)
-+ tst_resm(TFAIL,
-+ "NR_CPUS of the kernel is more than 1024, so we'd better use a newer glibc(>= 2.7)");
-+ else
-+#endif
- tst_resm(TFAIL, "sched_getaffinity:errno:%d", errno);
- tst_exit();
- }
- cpu_max = max_cpuid(size, set);
-+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
- #if __GLIBC_PREREQ(2, 7)
- CPU_ZERO_S(size, set);
- CPU_SET_S(cpu_max, size, set);
-@@ -231,6 +260,10 @@ realloc:
- CPU_ZERO(set);
- CPU_SET(cpu_max, set);
- #endif
-+#else
-+ CPU_ZERO(set);
-+ CPU_SET(cpu_max, set);
-+#endif
- if (sched_setaffinity(0, size, set) < 0) {
- CPU_FREE(set);
- tst_brkm(TFAIL, NULL, "sched_setaffinity:errno:%d", errno);
-@@ -247,11 +280,15 @@ 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 defined(__GLIBC__) && defined(__GLIBC_PREREQ)
- #if __GLIBC_PREREQ(2, 7)
- if (CPU_ISSET_S(index, size, set))
- #else
- if (CPU_ISSET(index, set))
- #endif
-+#else
-+ if (CPU_ISSET(index, set))
-+#endif
- max = index;
- return max;
- }
diff --git a/testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c b/testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c
-index 9d6a81a..4ed13b2 100644
+index 02f04b909..d906d7e09 100644
--- a/testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c
+++ b/testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c
@@ -67,9 +67,11 @@ do { \
@@ -198,7 +74,7 @@ index 9d6a81a..4ed13b2 100644
int main(int ac, char **av)
{
-@@ -96,14 +98,19 @@ static void do_test(void)
+@@ -96,17 +98,26 @@ static void do_test(void)
pid_t unused_pid;
unsigned len;
@@ -206,27 +82,26 @@ index 9d6a81a..4ed13b2 100644
#if __GLIBC_PREREQ(2, 7)
realloc:
mask = CPU_ALLOC(nrcpus);
- #else
- mask = malloc(sizeof(cpu_set_t));
- #endif
+#else
+ mask = malloc(sizeof(cpu_set_t));
+#endif
+ #else
+ mask = malloc(sizeof(cpu_set_t));
+ #endif
if (mask == NULL)
tst_brkm(TFAIL | TTERRNO, cleanup, "fail to get enough memory");
+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
#if __GLIBC_PREREQ(2, 7)
len = CPU_ALLOC_SIZE(nrcpus);
CPU_ZERO_S(len, mask);
-@@ -111,10 +118,15 @@ realloc:
- len = sizeof(cpu_set_t);
- CPU_ZERO(mask);
- #endif
+#else
+ len = sizeof(cpu_set_t);
+ CPU_ZERO(mask);
+#endif
- /* positive test */
+ #else
+ len = sizeof(cpu_set_t);
+ CPU_ZERO(mask);
+@@ -115,11 +126,18 @@ realloc:
TEST(sched_getaffinity(0, len, mask));
if (TEST_RETURN == -1) {
CPU_FREE(mask);
@@ -234,50 +109,43 @@ index 9d6a81a..4ed13b2 100644
#if __GLIBC_PREREQ(2, 7)
if (errno == EINVAL && nrcpus < (1024 << 8)) {
nrcpus = nrcpus << 2;
-@@ -126,17 +138,27 @@ realloc:
- "newer glibc(>= 2.7)");
- else
- #endif
+ goto realloc;
+ }
+#else
+ if (errno == EINVAL)
+ tst_resm(TFAIL, "NR_CPUS > 1024, we'd better use a "
+ "newer glibc(>= 2.7)");
+ else
+#endif
- tst_resm(TFAIL | TTERRNO, "fail to get cpu affinity");
- cleanup();
- } else {
+ #else
+ if (errno == EINVAL)
+ tst_resm(TFAIL, "NR_CPUS > 1024, we'd better use a "
+@@ -132,8 +150,12 @@ realloc:
tst_resm(TINFO, "cpusetsize is %d", len);
tst_resm(TINFO, "mask.__bits[0] = %lu ", mask->__bits[0]);
for (i = 0; i < num; i++) {
+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
#if __GLIBC_PREREQ(2, 7)
TEST(CPU_ISSET_S(i, len, mask));
- #else
- TEST(CPU_ISSET(i, mask));
- #endif
+#else
+ TEST(CPU_ISSET(i, mask));
+#endif
- if (TEST_RETURN != -1)
- tst_resm(TPASS, "sched_getaffinity() succeed, "
- "this process %d is running "
-@@ -144,11 +166,15 @@ realloc:
+ #else
+ TEST(CPU_ISSET(i, mask));
+ #endif
+@@ -144,8 +166,12 @@ realloc:
}
}
+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
#if __GLIBC_PREREQ(2, 7)
CPU_ZERO_S(len, mask);
- #else
- CPU_ZERO(mask);
- #endif
+#else
+ CPU_ZERO(mask);
+#endif
- /* negative tests */
- QUICK_TEST(sched_getaffinity(0, len, (cpu_set_t *) - 1));
- QUICK_TEST(sched_getaffinity(0, 0, mask));
+ #else
+ CPU_ZERO(mask);
+ #endif
--
-1.9.1
+2.17.1
OpenPOWER on IntegriCloud