From: Bian Naimeng <biannm@cn.fujitsu.com>
To: Garrett Cooper <yanegomi@gmail.com>
Cc: ltp-list@lists.sourceforge.net
Subject: [LTP] [PATCH]Fix building error.
Date: Wed, 15 Dec 2010 14:15:13 +0800 [thread overview]
Message-ID: <4D085CF1.7070308@cn.fujitsu.com> (raw)
When i build the LTP at RHEL5.5GA, the following error was caught.
make[4]: Entering directory `/home/biannm/gitsrc/ltp-dev/testcases/kernel/syscalls/mmap'
gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -I/home/biannm/gitsrc/ltp-dev/testcases/kernel/include -I../../../../include -I../../../../include -L../../../../lib mmap10.c -lltp -lpthread -o mmap10
mmap10.c: In function ‘mmapzero’:
mmap10.c:120: error: ‘MADV_MERGEABLE’ undeclared (first use in this function)
mmap10.c:120: error: (Each undeclared identifier is reported only once
mmap10.c:120: error: for each function it appears in.)
make[4]: *** [mmap10] Error 1
So, what about this patch?
---------------------------------------------------------------------
KSM is unsupported before 2.6.32. So if MADV_MERGEABLE is undefine,
we should not test the following cases.
1. mmap10 with the option "-s".
2. ksm01.
Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>
---
testcases/kernel/mem/ksm/ksm01.c | 15 ++++++++++++---
testcases/kernel/syscalls/mmap/mmap10.c | 4 ++++
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/mem/ksm/ksm01.c b/testcases/kernel/mem/ksm/ksm01.c
index 1143791..9b575ff 100644
--- a/testcases/kernel/mem/ksm/ksm01.c
+++ b/testcases/kernel/mem/ksm/ksm01.c
@@ -70,12 +70,14 @@
#include "test.h"
#include "usctest.h"
-#define _PATH_KSM "/sys/kernel/mm/ksm/"
-#define MB (1024 * 1024)
-
char *TCID = "ksm01";
int TST_TOTAL = 1;
extern int Tst_count;
+
+#ifdef MADV_MERGEABLE
+
+#define _PATH_KSM "/sys/kernel/mm/ksm/"
+#define MB (1024 * 1024)
static int opt_num, opt_size;
static char *opt_numstr, *opt_sizestr;
/* memory pointer to identify per process, MB, and byte like
@@ -538,3 +540,10 @@ void group_check(int run, int pages_shared, int pages_sharing,
check("sleep_millisecs", NULL, sleep_millisecs);
check("pages_to_scan", NULL, pages_to_scan);
}
+
+#else
+int main(int argc, char *argv[])
+{
+ tst_brkm(TRETR, tst_exit, "KSM is unsupported");
+}
+#endif
diff --git a/testcases/kernel/syscalls/mmap/mmap10.c b/testcases/kernel/syscalls/mmap/mmap10.c
index fe9d622..be988cf 100644
--- a/testcases/kernel/syscalls/mmap/mmap10.c
+++ b/testcases/kernel/syscalls/mmap/mmap10.c
@@ -116,9 +116,13 @@ void mmapzero(void)
if (x == MAP_FAILED)
tst_brkm(TBROK|TERRNO, cleanup, "mmap");
if (opt_ksm) {
+#ifdef MADV_MERGEABLE
tst_resm(TINFO, "add to KSM regions.");
if (madvise(x, SIZE+SIZE-4096, MADV_MERGEABLE) == -1)
tst_brkm(TBROK|TERRNO, cleanup, "madvise");
+#else
+ tst_brkm(TRETR, cleanup, "KSM is unsupported.");
+#endif
}
x[SIZE] = 0;
--
1.7.0.4
--
Regards
Bian Naimeng
------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next reply other threads:[~2010-12-15 6:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-15 6:15 Bian Naimeng [this message]
2010-12-21 6:20 ` [LTP] [PATCH]Fix building error Bian Naimeng
2010-12-21 6:39 ` CAI Qian
2010-12-21 7:02 ` Bian Naimeng
2010-12-21 7:11 ` CAI Qian
2010-12-21 7:31 ` Bian Naimeng
2010-12-21 8:05 ` Garrett Cooper
2010-12-23 6:45 ` Bian Naimeng
2010-12-23 7:02 ` CAI Qian
2010-12-23 7:13 ` Bian Naimeng
2010-12-23 19:25 ` Garrett Cooper
2010-12-27 5:27 ` CAI Qian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D085CF1.7070308@cn.fujitsu.com \
--to=biannm@cn.fujitsu.com \
--cc=ltp-list@lists.sourceforge.net \
--cc=yanegomi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.