Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 1 | From 9bcb4e170f01dbe0a9e7bf6b899c5d9b5283d4c6 Mon Sep 17 00:00:00 2001 |
| 2 | From: Randy MacLeod <Randy.MacLeod@windriver.com> |
| 3 | Date: Sun, 11 Nov 2018 23:00:53 -0500 |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 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 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 9 | Rebased patch for: |
| 10 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 11 | stress-{context, stackmmap}.c: Set tests to non-implemented because uses |
| 12 | swapcontext, musl provide the definition but not the implementation due |
| 13 | to that functions are pre-POSIX and set to be deprecated. |
| 14 | stress-{resources, pty}.c: Doesn't include termio.h and remove stress |
| 15 | operations that uses struct termio, musl doesn't provide that struct. |
| 16 | stress-malloc.c: Check for definition of M_MMAP_THRESHOLD musl doesn't |
| 17 | ptovide that constant. |
| 18 | stress-madvise.c: Add static poision_count integer, definition of |
| 19 | MADV_SOFT_OFFLINE doesn't grauntee MADV_HWPOISON to be defined. |
| 20 | cache.c: Define GLOB_ONLYDIR not available on MUSL. |
| 21 | |
| 22 | Signed-off-by: Aníbal Limón <anibal.limon@linaro.org> |
| 23 | Signed-off-by: Tim Orling <timothy.t.orling@linux.intel.com> |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 24 | Signed-off-by: Randy MacLeod <Randy.MacLeod@windriver.com> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 25 | |
| 26 | Upstream-status: Pending |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 27 | --- |
| 28 | cache.c | 4 ++++ |
| 29 | stress-madvise.c | 1 + |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 30 | stress-pty.c | 18 ------------------ |
| 31 | stress-resources.c | 1 - |
| 32 | stress-stackmmap.c | 2 +- |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 33 | 5 files changed, 6 insertions(+), 20 deletions(-) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 34 | |
| 35 | diff --git a/cache.c b/cache.c |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 36 | index e8a0f791..4c7bb486 100644 |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 37 | --- a/cache.c |
| 38 | +++ b/cache.c |
| 39 | @@ -28,6 +28,10 @@ typedef struct { |
| 40 | |
| 41 | #include <glob.h> |
| 42 | |
| 43 | +#ifndef GLOB_ONLYDIR |
| 44 | +#define GLOB_ONLYDIR 0x100 |
| 45 | +#endif |
| 46 | + |
| 47 | #if defined(__linux__) |
| 48 | #define SYS_CPU_PREFIX "/sys/devices/system/cpu" |
| 49 | #define GLOB_PATTERN SYS_CPU_PREFIX "/cpu[0-9]*" |
| 50 | diff --git a/stress-madvise.c b/stress-madvise.c |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 51 | index b2e3497f..77e43a91 100644 |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 52 | --- a/stress-madvise.c |
| 53 | +++ b/stress-madvise.c |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 54 | @@ -146,6 +146,7 @@ static int stress_random_advise(const args_t *args) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 55 | #if defined(MADV_SOFT_OFFLINE) |
| 56 | if (advise == MADV_SOFT_OFFLINE) { |
| 57 | static int soft_offline_count; |
| 58 | + static int poison_count; |
| 59 | |
| 60 | /* ..and minimize number of soft offline pages */ |
| 61 | if ((soft_offline_count >= NUM_SOFT_OFFLINE_MAX) || |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 62 | diff --git a/stress-pty.c b/stress-pty.c |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 63 | index 4dd88ab9..c79a7021 100644 |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 64 | --- a/stress-pty.c |
| 65 | +++ b/stress-pty.c |
| 66 | @@ -26,7 +26,6 @@ |
| 67 | |
| 68 | #if defined(__linux__) |
| 69 | |
| 70 | -#include <termio.h> |
| 71 | #include <termios.h> |
| 72 | |
| 73 | typedef struct { |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 74 | @@ -111,7 +110,6 @@ static int stress_pty(const args_t *args) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 75 | */ |
| 76 | for (i = 0; i < n; i++) { |
| 77 | struct termios ios; |
| 78 | - struct termio io; |
| 79 | struct winsize ws; |
| 80 | int arg; |
| 81 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 82 | @@ -133,22 +131,6 @@ static int stress_pty(const args_t *args) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 83 | if (ioctl(ptys[i].slave, TCSETSF, &ios) < 0) |
| 84 | pr_fail_err("ioctl TCSETSF on slave pty"); |
| 85 | #endif |
| 86 | -#if defined(TCGETA) |
| 87 | - if (ioctl(ptys[i].slave, TCGETA, &io) < 0) |
| 88 | - pr_fail_err("ioctl TCGETA on slave pty"); |
| 89 | -#endif |
| 90 | -#if defined(TCSETA) |
| 91 | - if (ioctl(ptys[i].slave, TCSETA, &io) < 0) |
| 92 | - pr_fail_err("ioctl TCSETA on slave pty"); |
| 93 | -#endif |
| 94 | -#if defined(TCSETAW) |
| 95 | - if (ioctl(ptys[i].slave, TCSETAW, &io) < 0) |
| 96 | - pr_fail_err("ioctl TCSETAW on slave pty"); |
| 97 | -#endif |
| 98 | -#if defined(TCSETAF) |
| 99 | - if (ioctl(ptys[i].slave, TCSETAF, &io) < 0) |
| 100 | - pr_fail_err("ioctl TCSETAF on slave pty"); |
| 101 | -#endif |
| 102 | #if defined(TIOCGLCKTRMIOS) |
| 103 | if (ioctl(ptys[i].slave, TIOCGLCKTRMIOS, &ios) < 0) |
| 104 | pr_fail_err("ioctl TIOCGLCKTRMIOS on slave pty"); |
| 105 | diff --git a/stress-resources.c b/stress-resources.c |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 106 | index f3dcfb38..86f9a5ba 100644 |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 107 | --- a/stress-resources.c |
| 108 | +++ b/stress-resources.c |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 109 | @@ -28,7 +28,6 @@ |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 110 | #include <sys/inotify.h> |
| 111 | #endif |
| 112 | #if defined(__linux__) |
| 113 | -#include <termio.h> |
| 114 | #include <termios.h> |
| 115 | #endif |
| 116 | #if defined(HAVE_LIB_PTHREAD) && defined(__linux__) |
| 117 | diff --git a/stress-stackmmap.c b/stress-stackmmap.c |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 118 | index c2f4c31d..54308777 100644 |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 119 | --- a/stress-stackmmap.c |
| 120 | +++ b/stress-stackmmap.c |
| 121 | @@ -24,7 +24,7 @@ |
| 122 | */ |
| 123 | #include "stress-ng.h" |
| 124 | |
| 125 | -#if defined(__linux__) |
| 126 | +#if defined(__linux__) && False |
| 127 | |
| 128 | #include <ucontext.h> |
| 129 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 130 | -- |
| 131 | 2.17.0 |
| 132 | |