blob: c0b344901eb15353b27246653bd7eed5fdd9020b [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From 9bcb4e170f01dbe0a9e7bf6b899c5d9b5283d4c6 Mon Sep 17 00:00:00 2001
2From: Randy MacLeod <Randy.MacLeod@windriver.com>
3Date: Sun, 11 Nov 2018 23:00:53 -0500
Brad Bishop316dfdd2018-06-25 12:45:53 -04004Subject: [PATCH] Several changes to fix musl build
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08009Rebased patch for:
10
Brad Bishop316dfdd2018-06-25 12:45:53 -040011stress-{context, stackmmap}.c: Set tests to non-implemented because uses
12swapcontext, 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.
16stress-malloc.c: Check for definition of M_MMAP_THRESHOLD musl doesn't
17 ptovide that constant.
18stress-madvise.c: Add static poision_count integer, definition of
19 MADV_SOFT_OFFLINE doesn't grauntee MADV_HWPOISON to be defined.
20cache.c: Define GLOB_ONLYDIR not available on MUSL.
21
22Signed-off-by: Aníbal Limón <anibal.limon@linaro.org>
23Signed-off-by: Tim Orling <timothy.t.orling@linux.intel.com>
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080024Signed-off-by: Randy MacLeod <Randy.MacLeod@windriver.com>
Brad Bishop316dfdd2018-06-25 12:45:53 -040025
26Upstream-status: Pending
Brad Bishop316dfdd2018-06-25 12:45:53 -040027---
28 cache.c | 4 ++++
29 stress-madvise.c | 1 +
Brad Bishop316dfdd2018-06-25 12:45:53 -040030 stress-pty.c | 18 ------------------
31 stress-resources.c | 1 -
32 stress-stackmmap.c | 2 +-
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080033 5 files changed, 6 insertions(+), 20 deletions(-)
Brad Bishop316dfdd2018-06-25 12:45:53 -040034
35diff --git a/cache.c b/cache.c
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080036index e8a0f791..4c7bb486 100644
Brad Bishop316dfdd2018-06-25 12:45:53 -040037--- 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]*"
50diff --git a/stress-madvise.c b/stress-madvise.c
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080051index b2e3497f..77e43a91 100644
Brad Bishop316dfdd2018-06-25 12:45:53 -040052--- a/stress-madvise.c
53+++ b/stress-madvise.c
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080054@@ -146,6 +146,7 @@ static int stress_random_advise(const args_t *args)
Brad Bishop316dfdd2018-06-25 12:45:53 -040055 #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 Bishop316dfdd2018-06-25 12:45:53 -040062diff --git a/stress-pty.c b/stress-pty.c
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080063index 4dd88ab9..c79a7021 100644
Brad Bishop316dfdd2018-06-25 12:45:53 -040064--- 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 Bishop1a4b7ee2018-12-16 17:11:34 -080074@@ -111,7 +110,6 @@ static int stress_pty(const args_t *args)
Brad Bishop316dfdd2018-06-25 12:45:53 -040075 */
76 for (i = 0; i < n; i++) {
77 struct termios ios;
78- struct termio io;
79 struct winsize ws;
80 int arg;
81
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080082@@ -133,22 +131,6 @@ static int stress_pty(const args_t *args)
Brad Bishop316dfdd2018-06-25 12:45:53 -040083 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");
105diff --git a/stress-resources.c b/stress-resources.c
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800106index f3dcfb38..86f9a5ba 100644
Brad Bishop316dfdd2018-06-25 12:45:53 -0400107--- a/stress-resources.c
108+++ b/stress-resources.c
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800109@@ -28,7 +28,6 @@
Brad Bishop316dfdd2018-06-25 12:45:53 -0400110 #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__)
117diff --git a/stress-stackmmap.c b/stress-stackmmap.c
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800118index c2f4c31d..54308777 100644
Brad Bishop316dfdd2018-06-25 12:45:53 -0400119--- 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 Bishop1a4b7ee2018-12-16 17:11:34 -0800130--
1312.17.0
132