Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame^] | 1 | From 784dcd09d3f266e271d007f4fd257e85036872ca Mon Sep 17 00:00:00 2001 |
| 2 | From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= <anibal.limon@linaro.org> |
| 3 | Date: Tue, 17 Oct 2017 10:13:20 -0500 |
| 4 | Subject: [PATCH] Several changes to fix musl build |
| 5 | MIME-Version: 1.0 |
| 6 | Content-Type: text/plain; charset=UTF-8 |
| 7 | Content-Transfer-Encoding: 8bit |
| 8 | |
| 9 | stress-{context, stackmmap}.c: Set tests to non-implemented because uses |
| 10 | swapcontext, musl provide the definition but not the implementation due |
| 11 | to that functions are pre-POSIX and set to be deprecated. |
| 12 | stress-{resources, pty}.c: Doesn't include termio.h and remove stress |
| 13 | operations that uses struct termio, musl doesn't provide that struct. |
| 14 | stress-malloc.c: Check for definition of M_MMAP_THRESHOLD musl doesn't |
| 15 | ptovide that constant. |
| 16 | stress-madvise.c: Add static poision_count integer, definition of |
| 17 | MADV_SOFT_OFFLINE doesn't grauntee MADV_HWPOISON to be defined. |
| 18 | cache.c: Define GLOB_ONLYDIR not available on MUSL. |
| 19 | |
| 20 | Signed-off-by: Aníbal Limón <anibal.limon@linaro.org> |
| 21 | Signed-off-by: Tim Orling <timothy.t.orling@linux.intel.com> |
| 22 | |
| 23 | Upstream-status: Pending |
| 24 | |
| 25 | --- |
| 26 | cache.c | 4 ++++ |
| 27 | stress-madvise.c | 1 + |
| 28 | stress-malloc.c | 2 +- |
| 29 | stress-pty.c | 18 ------------------ |
| 30 | stress-resources.c | 1 - |
| 31 | stress-stackmmap.c | 2 +- |
| 32 | 6 files changed, 7 insertions(+), 21 deletions(-) |
| 33 | |
| 34 | diff --git a/cache.c b/cache.c |
| 35 | index fbf7674..936c1ff 100644 |
| 36 | --- a/cache.c |
| 37 | +++ b/cache.c |
| 38 | @@ -28,6 +28,10 @@ typedef struct { |
| 39 | |
| 40 | #include <glob.h> |
| 41 | |
| 42 | +#ifndef GLOB_ONLYDIR |
| 43 | +#define GLOB_ONLYDIR 0x100 |
| 44 | +#endif |
| 45 | + |
| 46 | #if defined(__linux__) |
| 47 | #define SYS_CPU_PREFIX "/sys/devices/system/cpu" |
| 48 | #define GLOB_PATTERN SYS_CPU_PREFIX "/cpu[0-9]*" |
| 49 | diff --git a/stress-madvise.c b/stress-madvise.c |
| 50 | index 9e71e11..ddf8d2d 100644 |
| 51 | --- a/stress-madvise.c |
| 52 | +++ b/stress-madvise.c |
| 53 | @@ -147,6 +147,7 @@ static int stress_random_advise(const args_t *args) |
| 54 | #if defined(MADV_SOFT_OFFLINE) |
| 55 | if (advise == MADV_SOFT_OFFLINE) { |
| 56 | static int soft_offline_count; |
| 57 | + static int poison_count; |
| 58 | |
| 59 | /* ..and minimize number of soft offline pages */ |
| 60 | if ((soft_offline_count >= NUM_SOFT_OFFLINE_MAX) || |
| 61 | diff --git a/stress-malloc.c b/stress-malloc.c |
| 62 | index a46b8c6..427827a 100644 |
| 63 | --- a/stress-malloc.c |
| 64 | +++ b/stress-malloc.c |
| 65 | @@ -99,7 +99,7 @@ int stress_malloc(const args_t *args) |
| 66 | malloc_max = MIN_MALLOC_MAX; |
| 67 | } |
| 68 | |
| 69 | -#if defined(__GNUC__) && defined(__linux__) |
| 70 | +#if defined(__GNUC__) && defined(__linux__) && defined(M_MMAP_THRESHOLD) |
| 71 | if (get_setting("malloc-threshold", &malloc_threshold)) |
| 72 | (void)mallopt(M_MMAP_THRESHOLD, (int)malloc_threshold); |
| 73 | #endif |
| 74 | diff --git a/stress-pty.c b/stress-pty.c |
| 75 | index 1bd1fbd..b1fe573 100644 |
| 76 | --- a/stress-pty.c |
| 77 | +++ b/stress-pty.c |
| 78 | @@ -26,7 +26,6 @@ |
| 79 | |
| 80 | #if defined(__linux__) |
| 81 | |
| 82 | -#include <termio.h> |
| 83 | #include <termios.h> |
| 84 | |
| 85 | typedef struct { |
| 86 | @@ -108,7 +107,6 @@ int stress_pty(const args_t *args) |
| 87 | */ |
| 88 | for (i = 0; i < n; i++) { |
| 89 | struct termios ios; |
| 90 | - struct termio io; |
| 91 | struct winsize ws; |
| 92 | int arg; |
| 93 | |
| 94 | @@ -130,22 +128,6 @@ int stress_pty(const args_t *args) |
| 95 | if (ioctl(ptys[i].slave, TCSETSF, &ios) < 0) |
| 96 | pr_fail_err("ioctl TCSETSF on slave pty"); |
| 97 | #endif |
| 98 | -#if defined(TCGETA) |
| 99 | - if (ioctl(ptys[i].slave, TCGETA, &io) < 0) |
| 100 | - pr_fail_err("ioctl TCGETA on slave pty"); |
| 101 | -#endif |
| 102 | -#if defined(TCSETA) |
| 103 | - if (ioctl(ptys[i].slave, TCSETA, &io) < 0) |
| 104 | - pr_fail_err("ioctl TCSETA on slave pty"); |
| 105 | -#endif |
| 106 | -#if defined(TCSETAW) |
| 107 | - if (ioctl(ptys[i].slave, TCSETAW, &io) < 0) |
| 108 | - pr_fail_err("ioctl TCSETAW on slave pty"); |
| 109 | -#endif |
| 110 | -#if defined(TCSETAF) |
| 111 | - if (ioctl(ptys[i].slave, TCSETAF, &io) < 0) |
| 112 | - pr_fail_err("ioctl TCSETAF on slave pty"); |
| 113 | -#endif |
| 114 | #if defined(TIOCGLCKTRMIOS) |
| 115 | if (ioctl(ptys[i].slave, TIOCGLCKTRMIOS, &ios) < 0) |
| 116 | pr_fail_err("ioctl TIOCGLCKTRMIOS on slave pty"); |
| 117 | diff --git a/stress-resources.c b/stress-resources.c |
| 118 | index 958c99a..af79abd 100644 |
| 119 | --- a/stress-resources.c |
| 120 | +++ b/stress-resources.c |
| 121 | @@ -31,7 +31,6 @@ |
| 122 | #include <sys/inotify.h> |
| 123 | #endif |
| 124 | #if defined(__linux__) |
| 125 | -#include <termio.h> |
| 126 | #include <termios.h> |
| 127 | #endif |
| 128 | #if defined(HAVE_LIB_PTHREAD) && defined(__linux__) |
| 129 | diff --git a/stress-stackmmap.c b/stress-stackmmap.c |
| 130 | index 9c83a69..2984f09 100644 |
| 131 | --- a/stress-stackmmap.c |
| 132 | +++ b/stress-stackmmap.c |
| 133 | @@ -24,7 +24,7 @@ |
| 134 | */ |
| 135 | #include "stress-ng.h" |
| 136 | |
| 137 | -#if defined(__linux__) |
| 138 | +#if defined(__linux__) && False |
| 139 | |
| 140 | #include <ucontext.h> |
| 141 | |