diff options
Diffstat (limited to 'meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch')
-rw-r--r-- | meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch | 151 |
1 files changed, 0 insertions, 151 deletions
diff --git a/meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch b/meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch deleted file mode 100644 index 7311ee2e41..0000000000 --- a/meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch +++ /dev/null | |||
@@ -1,151 +0,0 @@ | |||
1 | From fc2b47ad979a87bfbd11aeea3f67c26e7fb39e30 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Thu, 7 Jan 2016 19:40:08 +0000 | ||
4 | Subject: [PATCH] Check if __GLIBC_PREREQ is defined before using it | ||
5 | |||
6 | __GLIBC_PREREQ is specific to glibc so it should be checked if it is | ||
7 | defined or not. | ||
8 | |||
9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
10 | |||
11 | Upstream-Status: Pending | ||
12 | --- | ||
13 | .../kernel/syscalls/accept4/accept4_01.c | 9 ++++++- | ||
14 | .../sched_getaffinity/sched_getaffinity01.c | 26 +++++++++++++++++++ | ||
15 | 2 files changed, 34 insertions(+), 1 deletion(-) | ||
16 | |||
17 | diff --git a/testcases/kernel/syscalls/accept4/accept4_01.c b/testcases/kernel/syscalls/accept4/accept4_01.c | ||
18 | index dec4ef93b..c5d74b07f 100644 | ||
19 | --- a/testcases/kernel/syscalls/accept4/accept4_01.c | ||
20 | +++ b/testcases/kernel/syscalls/accept4/accept4_01.c | ||
21 | @@ -64,6 +64,7 @@ static void cleanup(void) | ||
22 | tst_rmdir(); | ||
23 | } | ||
24 | |||
25 | +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) | ||
26 | #if !(__GLIBC_PREREQ(2, 10)) | ||
27 | static int | ||
28 | accept4_01(int fd, struct sockaddr *sockaddr, socklen_t *addrlen, int flags) | ||
29 | @@ -82,7 +83,6 @@ accept4_01(int fd, struct sockaddr *sockaddr, socklen_t *addrlen, int flags) | ||
30 | } | ||
31 | tst_resm(TINFO, "\n"); | ||
32 | #endif | ||
33 | - | ||
34 | #if USE_SOCKETCALL | ||
35 | long args[6]; | ||
36 | |||
37 | @@ -97,6 +97,7 @@ accept4_01(int fd, struct sockaddr *sockaddr, socklen_t *addrlen, int flags) | ||
38 | #endif | ||
39 | } | ||
40 | #endif | ||
41 | +#endif | ||
42 | |||
43 | static void | ||
44 | do_test(int lfd, struct sockaddr_in *conn_addr, | ||
45 | @@ -119,9 +120,15 @@ do_test(int lfd, struct sockaddr_in *conn_addr, | ||
46 | die("Connect Error"); | ||
47 | |||
48 | addrlen = sizeof(struct sockaddr_in); | ||
49 | +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) | ||
50 | #if !(__GLIBC_PREREQ(2, 10)) | ||
51 | acceptfd = accept4_01(lfd, (struct sockaddr *)&claddr, &addrlen, | ||
52 | closeonexec_flag | nonblock_flag); | ||
53 | + | ||
54 | +#else | ||
55 | + acceptfd = accept4(lfd, (struct sockaddr *)&claddr, &addrlen, | ||
56 | + closeonexec_flag | nonblock_flag); | ||
57 | +#endif | ||
58 | #else | ||
59 | acceptfd = accept4(lfd, (struct sockaddr *)&claddr, &addrlen, | ||
60 | closeonexec_flag | nonblock_flag); | ||
61 | diff --git a/testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c b/testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c | ||
62 | index 02f04b909..d906d7e09 100644 | ||
63 | --- a/testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c | ||
64 | +++ b/testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c | ||
65 | @@ -67,9 +67,11 @@ do { \ | ||
66 | tst_resm((TEST_RETURN == -1 ? TPASS : TFAIL) | TTERRNO, #t); \ | ||
67 | } while (0) | ||
68 | |||
69 | +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) | ||
70 | #if !(__GLIBC_PREREQ(2, 7)) | ||
71 | #define CPU_FREE(ptr) free(ptr) | ||
72 | #endif | ||
73 | +#endif | ||
74 | |||
75 | int main(int ac, char **av) | ||
76 | { | ||
77 | @@ -96,17 +98,26 @@ static void do_test(void) | ||
78 | pid_t unused_pid; | ||
79 | unsigned len; | ||
80 | |||
81 | +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) | ||
82 | #if __GLIBC_PREREQ(2, 7) | ||
83 | realloc: | ||
84 | mask = CPU_ALLOC(nrcpus); | ||
85 | +#else | ||
86 | + mask = malloc(sizeof(cpu_set_t)); | ||
87 | +#endif | ||
88 | #else | ||
89 | mask = malloc(sizeof(cpu_set_t)); | ||
90 | #endif | ||
91 | if (mask == NULL) | ||
92 | tst_brkm(TFAIL | TTERRNO, cleanup, "fail to get enough memory"); | ||
93 | +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) | ||
94 | #if __GLIBC_PREREQ(2, 7) | ||
95 | len = CPU_ALLOC_SIZE(nrcpus); | ||
96 | CPU_ZERO_S(len, mask); | ||
97 | +#else | ||
98 | + len = sizeof(cpu_set_t); | ||
99 | + CPU_ZERO(mask); | ||
100 | +#endif | ||
101 | #else | ||
102 | len = sizeof(cpu_set_t); | ||
103 | CPU_ZERO(mask); | ||
104 | @@ -115,11 +126,18 @@ realloc: | ||
105 | TEST(sched_getaffinity(0, len, mask)); | ||
106 | if (TEST_RETURN == -1) { | ||
107 | CPU_FREE(mask); | ||
108 | +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) | ||
109 | #if __GLIBC_PREREQ(2, 7) | ||
110 | if (errno == EINVAL && nrcpus < (1024 << 8)) { | ||
111 | nrcpus = nrcpus << 2; | ||
112 | goto realloc; | ||
113 | } | ||
114 | +#else | ||
115 | + if (errno == EINVAL) | ||
116 | + tst_resm(TFAIL, "NR_CPUS > 1024, we'd better use a " | ||
117 | + "newer glibc(>= 2.7)"); | ||
118 | + else | ||
119 | +#endif | ||
120 | #else | ||
121 | if (errno == EINVAL) | ||
122 | tst_resm(TFAIL, "NR_CPUS > 1024, we'd better use a " | ||
123 | @@ -132,8 +150,12 @@ realloc: | ||
124 | tst_resm(TINFO, "cpusetsize is %d", len); | ||
125 | tst_resm(TINFO, "mask.__bits[0] = %lu ", mask->__bits[0]); | ||
126 | for (i = 0; i < num; i++) { | ||
127 | +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) | ||
128 | #if __GLIBC_PREREQ(2, 7) | ||
129 | TEST(CPU_ISSET_S(i, len, mask)); | ||
130 | +#else | ||
131 | + TEST(CPU_ISSET(i, mask)); | ||
132 | +#endif | ||
133 | #else | ||
134 | TEST(CPU_ISSET(i, mask)); | ||
135 | #endif | ||
136 | @@ -144,8 +166,12 @@ realloc: | ||
137 | } | ||
138 | } | ||
139 | |||
140 | +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) | ||
141 | #if __GLIBC_PREREQ(2, 7) | ||
142 | CPU_ZERO_S(len, mask); | ||
143 | +#else | ||
144 | + CPU_ZERO(mask); | ||
145 | +#endif | ||
146 | #else | ||
147 | CPU_ZERO(mask); | ||
148 | #endif | ||
149 | -- | ||
150 | 2.17.1 | ||
151 | |||