* [LTP] [PATCH 1/2] hugetlb: rename lib/ipcshm.* to lib/hugetlb.*
@ 2015-11-27 8:18 Li Wang
2015-11-27 8:18 ` [LTP] [PATCH 2/2] hugetlb: checking if hugepage is supported on target system Li Wang
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Li Wang @ 2015-11-27 8:18 UTC (permalink / raw)
To: ltp
Signed-off-by: Li Wang <liwang@redhat.com>
---
testcases/kernel/mem/hugetlb/Makefile | 2 +-
testcases/kernel/mem/hugetlb/Makefile.inc | 4 +-
.../kernel/mem/hugetlb/hugeshmat/hugeshmat01.c | 2 +-
.../kernel/mem/hugetlb/hugeshmat/hugeshmat02.c | 2 +-
.../kernel/mem/hugetlb/hugeshmat/hugeshmat03.c | 2 +-
.../kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c | 2 +-
.../kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c | 2 +-
.../kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c | 2 +-
.../kernel/mem/hugetlb/hugeshmdt/hugeshmdt01.c | 2 +-
.../kernel/mem/hugetlb/hugeshmget/hugeshmget01.c | 2 +-
.../kernel/mem/hugetlb/hugeshmget/hugeshmget02.c | 2 +-
.../kernel/mem/hugetlb/hugeshmget/hugeshmget03.c | 2 +-
.../kernel/mem/hugetlb/hugeshmget/hugeshmget05.c | 2 +-
testcases/kernel/mem/hugetlb/lib/Makefile | 2 +-
testcases/kernel/mem/hugetlb/lib/hugetlb.c | 116 +++++++++++++++++++++
testcases/kernel/mem/hugetlb/lib/hugetlb.h | 61 +++++++++++
testcases/kernel/mem/hugetlb/lib/ipcshm.h | 61 -----------
testcases/kernel/mem/hugetlb/lib/libipc.c | 116 ---------------------
18 files changed, 192 insertions(+), 192 deletions(-)
create mode 100644 testcases/kernel/mem/hugetlb/lib/hugetlb.c
create mode 100644 testcases/kernel/mem/hugetlb/lib/hugetlb.h
delete mode 100644 testcases/kernel/mem/hugetlb/lib/ipcshm.h
delete mode 100644 testcases/kernel/mem/hugetlb/lib/libipc.c
diff --git a/testcases/kernel/mem/hugetlb/Makefile b/testcases/kernel/mem/hugetlb/Makefile
index 1e8f8f8..ea7867f 100644
--- a/testcases/kernel/mem/hugetlb/Makefile
+++ b/testcases/kernel/mem/hugetlb/Makefile
@@ -21,7 +21,7 @@ top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/env_pre.mk
LIBDIR := lib
-LIB := $(LIBDIR)/libipc_hugetlb.a
+LIB := $(LIBDIR)/libhugetlb.a
FILTER_OUT_DIRS := $(LIBDIR)
$(LIBDIR):
diff --git a/testcases/kernel/mem/hugetlb/Makefile.inc b/testcases/kernel/mem/hugetlb/Makefile.inc
index cc0ada6..c07d600 100644
--- a/testcases/kernel/mem/hugetlb/Makefile.inc
+++ b/testcases/kernel/mem/hugetlb/Makefile.inc
@@ -22,7 +22,7 @@
# DO NOT USE THIS FILE FOR hugetlb / lib!!!
LIBIPCDIR := ../lib
-LIBIPC := $(LIBIPCDIR)/libipc_hugetlb.a
+LIBIPC := $(LIBIPCDIR)/libhugetlb.a
$(LIBIPCDIR):
mkdir -p "$@"
@@ -31,7 +31,7 @@ $(LIBIPC): $(LIBIPCDIR)
CPPFLAGS += -I$(abs_srcdir)/$(LIBIPCDIR)
LDFLAGS += -L$(abs_builddir)/$(LIBIPCDIR)
-LDLIBS += -lipc_hugetlb
+LDLIBS += -lhugetlb
MAKE_DEPS += $(LIBIPC)
include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat01.c b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat01.c
index 851d4cf..35e7216 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat01.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat01.c
@@ -56,7 +56,7 @@
* none
*/
-#include "ipcshm.h"
+#include "hugetlb.h"
#include "safe_macros.h"
#include "mem.h"
diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c
index 52348f1..2bac9c2 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c
@@ -51,7 +51,7 @@
*/
#include <pwd.h>
-#include "ipcshm.h"
+#include "hugetlb.h"
#include "safe_macros.h"
#include "mem.h"
diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat03.c b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat03.c
index 723c8b5..fe74810 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat03.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat03.c
@@ -57,7 +57,7 @@
* test must be run at root
*/
-#include "ipcshm.h"
+#include "hugetlb.h"
#include "safe_macros.h"
#include "mem.h"
diff --git a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c
index 66ad1b5..d7990c7 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c
@@ -61,7 +61,7 @@
* none
*/
-#include "ipcshm.h"
+#include "hugetlb.h"
#include "safe_macros.h"
#include "mem.h"
diff --git a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
index 4aeb638..f79ee83 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
@@ -53,7 +53,7 @@
*/
#include <pwd.h>
-#include "ipcshm.h"
+#include "hugetlb.h"
#include "safe_macros.h"
#include "mem.h"
diff --git a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c
index 9f5c2c9..e553a2a 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c
@@ -60,7 +60,7 @@
#include <sys/types.h>
#include <sys/wait.h>
-#include "ipcshm.h"
+#include "hugetlb.h"
#include "safe_macros.h"
#include "mem.h"
diff --git a/testcases/kernel/mem/hugetlb/hugeshmdt/hugeshmdt01.c b/testcases/kernel/mem/hugetlb/hugeshmdt/hugeshmdt01.c
index 9770e87..c8592b3 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmdt/hugeshmdt01.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmdt/hugeshmdt01.c
@@ -58,7 +58,7 @@
*/
#include <setjmp.h>
-#include "ipcshm.h"
+#include "hugetlb.h"
#include "safe_macros.h"
#include "mem.h"
diff --git a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget01.c b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget01.c
index ee82de3..5d45aaa 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget01.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget01.c
@@ -58,7 +58,7 @@
* none
*/
-#include "ipcshm.h"
+#include "hugetlb.h"
#include "safe_macros.h"
#include "mem.h"
diff --git a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c
index b995ef8..0ac4a29 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c
@@ -51,7 +51,7 @@
* none
*/
-#include "ipcshm.h"
+#include "hugetlb.h"
#include "safe_macros.h"
#include "mem.h"
diff --git a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c
index 9284669..9a2a0b2 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c
@@ -52,7 +52,7 @@
* none
*/
-#include "ipcshm.h"
+#include "hugetlb.h"
#include "safe_macros.h"
#include "mem.h"
diff --git a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget05.c b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget05.c
index 7b8f6b4..567b02d 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget05.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget05.c
@@ -60,7 +60,7 @@
#include <sys/types.h>
#include <sys/wait.h>
-#include "ipcshm.h"
+#include "hugetlb.h"
#include "safe_macros.h"
#include "mem.h"
diff --git a/testcases/kernel/mem/hugetlb/lib/Makefile b/testcases/kernel/mem/hugetlb/lib/Makefile
index 4cdd142..96e8e37 100644
--- a/testcases/kernel/mem/hugetlb/lib/Makefile
+++ b/testcases/kernel/mem/hugetlb/lib/Makefile
@@ -20,6 +20,6 @@ top_srcdir ?= ../../../../..
include $(top_srcdir)/include/mk/env_pre.mk
-LIB := libipc_hugetlb.a
+LIB := libhugetlb.a
include $(top_srcdir)/include/mk/lib.mk
diff --git a/testcases/kernel/mem/hugetlb/lib/hugetlb.c b/testcases/kernel/mem/hugetlb/lib/hugetlb.c
new file mode 100644
index 0000000..4b2a3d2
--- /dev/null
+++ b/testcases/kernel/mem/hugetlb/lib/hugetlb.c
@@ -0,0 +1,116 @@
+/*
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * hugetlb.c
+ *
+ * DESCRIPTION
+ * common routines for the hugepage tests.
+ *
+ * The library contains the following routines:
+ *
+ * getipckey()
+ * getuserid()
+ * rm_shm()
+ * help()
+ */
+
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <sys/timeb.h>
+#include <pwd.h>
+#include "hugetlb.h"
+
+/*
+ * getipckey() - generates and returns a message key used by the "get"
+ * calls to create an IPC resource.
+ */
+int getipckey(void)
+{
+ const char a = 'a';
+ int ascii_a = (int)a;
+ char *curdir = NULL;
+ size_t size = 0;
+ key_t ipc_key;
+ struct timeb time_info;
+
+ curdir = getcwd(curdir, size);
+ if (curdir == NULL)
+ tst_brkm(TBROK | TERRNO, cleanup, "getcwd(curdir)");
+
+ /*
+ * Get a Sys V IPC key
+ *
+ * ftok() requires a character as a second argument. This is
+ * refered to as a "project identifier" in the man page. In
+ * order to maximize the chance of getting a unique key, the
+ * project identifier is a "random character" produced by
+ * generating a random number between 0 and 25 and then adding
+ * that to the ascii value of 'a'. The "seed" for the random
+ * number is the millisecond value that is set in the timeb
+ * structure after calling ftime().
+ */
+ ftime(&time_info);
+ srandom((unsigned int)time_info.millitm);
+
+ ipc_key = ftok(curdir, ascii_a + random() % 26);
+ if (ipc_key == -1)
+ tst_brkm(TBROK | TERRNO, cleanup, "ftok");
+
+ return ipc_key;
+}
+
+/*
+ * getuserid() - return the integer value for the "user" id
+ */
+int getuserid(char *user)
+{
+ struct passwd *ent;
+
+ ent = getpwnam(user);
+ if (ent == NULL)
+ tst_brkm(TBROK | TERRNO, cleanup, "getpwnam");
+
+ return ent->pw_uid;
+}
+
+/*
+ * rm_shm() - removes a shared memory segment.
+ */
+void rm_shm(int shm_id)
+{
+ if (shm_id == -1)
+ return;
+
+ /*
+ * check for # of attaches ?
+ */
+ if (shmctl(shm_id, IPC_RMID, NULL) == -1) {
+ tst_resm(TINFO, "WARNING: shared memory deletion failed.");
+ tst_resm(TINFO, "This could lead to IPC resource problems.");
+ tst_resm(TINFO, "id = %d", shm_id);
+ }
+}
+
+void help(void)
+{
+ printf(" -s NUM Set the number of hugepages to be allocated\n");
+}
diff --git a/testcases/kernel/mem/hugetlb/lib/hugetlb.h b/testcases/kernel/mem/hugetlb/lib/hugetlb.h
new file mode 100644
index 0000000..6d73e9c
--- /dev/null
+++ b/testcases/kernel/mem/hugetlb/lib/hugetlb.h
@@ -0,0 +1,61 @@
+/*
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * hugetlb.h - common definitions for the hugepage tests
+ */
+
+#ifndef __HUGETLB_H
+#define __HUGETLB_H
+
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <errno.h>
+#include <wait.h>
+#include "test.h"
+
+#define SHM_RD 0400
+#define SHM_WR 0200
+#define SHM_RW (SHM_RD|SHM_WR)
+
+#ifndef SHM_HUGETLB
+#define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */
+#endif
+
+/*
+ * to get the lower nine permission bits
+ * from shmid_ds.ipc_perm.mode
+ */
+#define MODE_MASK 0x01FF
+
+key_t shmkey; /* an IPC key generated by ftok() */
+
+int getipckey(void);
+int getuserid(char *user);
+void rm_shm(int shm_id);
+
+void cleanup(void);
+void setup(void);
+
+char *nr_opt;
+int sflag;
+long orig_hugepages;
+void help(void);
+
+#endif /* hugetlb.h */
diff --git a/testcases/kernel/mem/hugetlb/lib/ipcshm.h b/testcases/kernel/mem/hugetlb/lib/ipcshm.h
deleted file mode 100644
index 194d14b..0000000
--- a/testcases/kernel/mem/hugetlb/lib/ipcshm.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *
- * Copyright (c) International Business Machines Corp., 2001
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
- * the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
- * ipcshm.h - common definitions for the IPC shared memory tests
- */
-
-#ifndef __IPCSHM_H
-#define __IPCSHM_H
-
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <errno.h>
-#include <wait.h>
-#include "test.h"
-
-#define SHM_RD 0400
-#define SHM_WR 0200
-#define SHM_RW (SHM_RD|SHM_WR)
-
-#ifndef SHM_HUGETLB
-#define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */
-#endif
-
-/*
- * to get the lower nine permission bits
- * from shmid_ds.ipc_perm.mode
- */
-#define MODE_MASK 0x01FF
-
-key_t shmkey; /* an IPC key generated by ftok() */
-
-int getipckey(void);
-int getuserid(char *user);
-void rm_shm(int shm_id);
-
-void cleanup(void);
-void setup(void);
-
-char *nr_opt;
-int sflag;
-long orig_hugepages;
-void help(void);
-
-#endif /* ipcshm.h */
diff --git a/testcases/kernel/mem/hugetlb/lib/libipc.c b/testcases/kernel/mem/hugetlb/lib/libipc.c
deleted file mode 100644
index 1f16f22..0000000
--- a/testcases/kernel/mem/hugetlb/lib/libipc.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- *
- * Copyright (c) International Business Machines Corp., 2001
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
- * the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
- * NAME
- * libipc.c
- *
- * DESCRIPTION
- * common routines for the IPC system call tests.
- *
- * The library contains the following routines:
- *
- * getipckey()
- * getuserid()
- * rm_shm()
- * help()
- */
-
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <sys/timeb.h>
-#include <pwd.h>
-#include "ipcshm.h"
-
-/*
- * getipckey() - generates and returns a message key used by the "get"
- * calls to create an IPC resource.
- */
-int getipckey(void)
-{
- const char a = 'a';
- int ascii_a = (int)a;
- char *curdir = NULL;
- size_t size = 0;
- key_t ipc_key;
- struct timeb time_info;
-
- curdir = getcwd(curdir, size);
- if (curdir == NULL)
- tst_brkm(TBROK | TERRNO, cleanup, "getcwd(curdir)");
-
- /*
- * Get a Sys V IPC key
- *
- * ftok() requires a character as a second argument. This is
- * refered to as a "project identifier" in the man page. In
- * order to maximize the chance of getting a unique key, the
- * project identifier is a "random character" produced by
- * generating a random number between 0 and 25 and then adding
- * that to the ascii value of 'a'. The "seed" for the random
- * number is the millisecond value that is set in the timeb
- * structure after calling ftime().
- */
- ftime(&time_info);
- srandom((unsigned int)time_info.millitm);
-
- ipc_key = ftok(curdir, ascii_a + random() % 26);
- if (ipc_key == -1)
- tst_brkm(TBROK | TERRNO, cleanup, "ftok");
-
- return ipc_key;
-}
-
-/*
- * getuserid() - return the integer value for the "user" id
- */
-int getuserid(char *user)
-{
- struct passwd *ent;
-
- ent = getpwnam(user);
- if (ent == NULL)
- tst_brkm(TBROK | TERRNO, cleanup, "getpwnam");
-
- return ent->pw_uid;
-}
-
-/*
- * rm_shm() - removes a shared memory segment.
- */
-void rm_shm(int shm_id)
-{
- if (shm_id == -1)
- return;
-
- /*
- * check for # of attaches ?
- */
- if (shmctl(shm_id, IPC_RMID, NULL) == -1) {
- tst_resm(TINFO, "WARNING: shared memory deletion failed.");
- tst_resm(TINFO, "This could lead to IPC resource problems.");
- tst_resm(TINFO, "id = %d", shm_id);
- }
-}
-
-void help(void)
-{
- printf(" -s NUM Set the number of hugepages to be allocated\n");
-}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [LTP] [PATCH 2/2] hugetlb: checking if hugepage is supported on target system
2015-11-27 8:18 [LTP] [PATCH 1/2] hugetlb: rename lib/ipcshm.* to lib/hugetlb.* Li Wang
@ 2015-11-27 8:18 ` Li Wang
2015-12-03 16:08 ` Cyril Hrubis
2015-12-03 2:57 ` [LTP] [PATCH 1/2] hugetlb: rename lib/ipcshm.* to lib/hugetlb.* Li Wang
2015-12-03 16:05 ` Cyril Hrubis
2 siblings, 1 reply; 6+ messages in thread
From: Li Wang @ 2015-11-27 8:18 UTC (permalink / raw)
To: ltp
Signed-off-by: Li Wang <liwang@redhat.com>
---
testcases/kernel/mem/hugetlb/hugemmap/Makefile | 2 +-
testcases/kernel/mem/hugetlb/hugemmap/hugemmap01.c | 4 ++--
testcases/kernel/mem/hugetlb/hugemmap/hugemmap02.c | 5 +++--
testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c | 4 ++--
testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c | 20 ++++++++++----------
testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat01.c | 3 ++-
testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c | 3 ++-
testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat03.c | 3 ++-
testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c | 3 ++-
.../kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c | 4 +++-
.../kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c | 4 +++-
.../kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c | 4 +++-
testcases/kernel/mem/hugetlb/hugeshmdt/hugeshmdt01.c | 3 ++-
.../kernel/mem/hugetlb/hugeshmget/hugeshmget01.c | 3 ++-
.../kernel/mem/hugetlb/hugeshmget/hugeshmget02.c | 3 ++-
.../kernel/mem/hugetlb/hugeshmget/hugeshmget03.c | 3 ++-
.../kernel/mem/hugetlb/hugeshmget/hugeshmget05.c | 3 ++-
testcases/kernel/mem/hugetlb/lib/hugetlb.c | 13 +++++++------
testcases/kernel/mem/hugetlb/lib/hugetlb.h | 4 +++-
testcases/kernel/syscalls/futex/futex_wake04.c | 4 ++++
20 files changed, 59 insertions(+), 36 deletions(-)
diff --git a/testcases/kernel/mem/hugetlb/hugemmap/Makefile b/testcases/kernel/mem/hugetlb/hugemmap/Makefile
index 71da630..f51f6b9 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/Makefile
+++ b/testcases/kernel/mem/hugetlb/hugemmap/Makefile
@@ -23,5 +23,5 @@
top_srcdir ?= ../../../../..
include $(top_srcdir)/include/mk/testcases.mk
-include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
+include $(abs_srcdir)/../Makefile.inc
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap01.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap01.c
index 62c3cc8..da8bdb1 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap01.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap01.c
@@ -60,6 +60,7 @@
#include <unistd.h>
#include "test.h"
+#include "hugetlb.h"
#include "safe_macros.h"
#include "mem.h"
@@ -70,12 +71,10 @@ int TST_TOTAL = 1;
static long *addr;
static int fildes;
static char *Hopt;
-static char *nr_opt;
static long beforetest;
static long aftertest;
static long hugepagesmapped;
static long hugepages = 128;
-static long orig_hugepages;
static void help(void);
@@ -159,6 +158,7 @@ void setup(void)
{
TEST_PAUSE;
tst_require_root();
+ check_hugepage();
if (mount("none", Hopt, "hugetlbfs", 0, NULL) < 0)
tst_brkm(TBROK | TERRNO, NULL, "mount failed on %s", Hopt);
diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap02.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap02.c
index 9fee330..1a44993 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap02.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap02.c
@@ -55,6 +55,7 @@
#include "test.h"
#include "safe_macros.h"
#include "mem.h"
+#include "hugetlb.h"
#define LOW_ADDR 0x80000000
#define LOW_ADDR2 0x90000000
@@ -72,9 +73,7 @@ static int i;
static int fildes;
static int nfildes;
static char *Hopt;
-static char *nr_opt;
static long hugepages = 128;
-static long orig_hugepages;
static void help(void);
@@ -93,6 +92,8 @@ int main(int ac, char **av)
tst_parse_opts(ac, av, options, &help);
+ check_hugepage();
+
if (!Hflag) {
tst_tmpdir();
Hopt = tst_get_tmpdir();
diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c
index 727b102..e1f2986 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c
@@ -63,6 +63,7 @@
#include "test.h"
#include "safe_macros.h"
#include "mem.h"
+#include "hugetlb.h"
static char TEMPFILE[MAXPATHLEN];
@@ -76,9 +77,7 @@ static long beforetest;
static long aftertest;
static long hugepagesmapped;
static long hugepages = 128;
-static long orig_hugepages;
static char *Hopt;
-static char *nr_opt;
static void help(void);
@@ -175,6 +174,7 @@ void setup(void)
{
TEST_PAUSE;
tst_require_root();
+ check_hugepage();
if (mount("none", Hopt, "hugetlbfs", 0, NULL) < 0)
tst_brkm(TBROK | TERRNO, NULL, "mount failed on %s", Hopt);
orig_hugepages = get_sys_tune("nr_hugepages");
diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c
index b68c981..7143e82 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c
@@ -48,6 +48,7 @@
#include <string.h>
#include <ctype.h>
#include "test.h"
+#include "hugetlb.h"
#define PROTECTION (PROT_READ | PROT_WRITE)
#define PATH_MEMINFO "/proc/meminfo"
@@ -97,8 +98,6 @@ static option_t options[] = {
{NULL, NULL, NULL}
};
-static void setup(void);
-static void cleanup(void);
static void overcommit(void);
static void write_bytes(void *addr);
static void read_bytes(void *addr);
@@ -247,7 +246,7 @@ static void overcommit(void)
}
}
-static void cleanup(void)
+void cleanup(void)
{
int fd;
@@ -255,7 +254,7 @@ static void cleanup(void)
fd = open(PATH_SHMMAX, O_WRONLY);
if (fd == -1)
tst_resm(TWARN | TERRNO, "open");
- if (write(fd, shmmax, strlen(shmmax)) != strlen(shmmax))
+ if (write(fd, shmmax, strlen(shmmax)) != (ssize_t)strlen(shmmax))
tst_resm(TWARN | TERRNO, "write");
close(fd);
}
@@ -264,7 +263,7 @@ static void cleanup(void)
tst_resm(TWARN | TERRNO, "open");
tst_resm(TINFO, "restore nr_hugepages to %s.", nr_hugepages);
if (write(fd, nr_hugepages,
- strlen(nr_hugepages)) != strlen(nr_hugepages))
+ strlen(nr_hugepages)) != (ssize_t)strlen(nr_hugepages))
tst_resm(TWARN | TERRNO, "write");
close(fd);
@@ -274,7 +273,7 @@ static void cleanup(void)
tst_resm(TINFO, "restore nr_overcommit_hugepages to %s.",
nr_overcommit_hugepages);
if (write(fd, nr_overcommit_hugepages, strlen(nr_overcommit_hugepages))
- != strlen(nr_overcommit_hugepages))
+ != (ssize_t)strlen(nr_overcommit_hugepages))
tst_resm(TWARN | TERRNO, "write");
close(fd);
@@ -289,7 +288,7 @@ static void cleanup(void)
tst_rmdir();
}
-static void setup(void)
+void setup(void)
{
FILE *fp;
int fd;
@@ -323,7 +322,7 @@ static void setup(void)
tst_brkm(TBROK | TERRNO, cleanup, "open");
snprintf(buf, BUFSIZ, "%ld",
(long)(length / 2 * hugepagesize));
- if (write(fd, buf, strlen(buf)) != strlen(buf))
+ if (write(fd, buf, strlen(buf)) != (ssize_t)strlen(buf))
tst_brkm(TBROK | TERRNO, cleanup,
"failed to change shmmax.");
}
@@ -347,7 +346,7 @@ static void setup(void)
if (lseek(fd, 0, SEEK_SET) == -1)
tst_brkm(TBROK | TERRNO, cleanup, "lseek");
snprintf(buf, BUFSIZ, "%zd", size);
- if (write(fd, buf, strlen(buf)) != strlen(buf))
+ if (write(fd, buf, strlen(buf)) != (ssize_t)strlen(buf))
tst_brkm(TBROK | TERRNO, cleanup,
"failed to change nr_hugepages.");
close(fd);
@@ -371,7 +370,7 @@ static void setup(void)
if (lseek(fd, 0, SEEK_SET) == -1)
tst_brkm(TBROK | TERRNO, cleanup, "lseek");
snprintf(buf, BUFSIZ, "%zd", size);
- if (write(fd, buf, strlen(buf)) != strlen(buf))
+ if (write(fd, buf, strlen(buf)) != (ssize_t)strlen(buf))
tst_brkm(TBROK | TERRNO, cleanup,
"failed to change nr_hugepages.");
close(fd);
@@ -469,6 +468,7 @@ static void init_hugepagesize(void)
{
FILE *fp;
+ check_hugepage();
memset(buf, -1, BUFSIZ);
fp = fopen(PATH_MEMINFO, "r");
if (fp == NULL)
diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat01.c b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat01.c
index 35e7216..8f994f6 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat01.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat01.c
@@ -101,7 +101,7 @@ int main(int ac, char **av)
{
int lc, i;
- tst_parse_opts(ac, av, options, &help);
+ tst_parse_opts(ac, av, options, NULL);
if (sflag)
hugepages = SAFE_STRTOL(NULL, nr_opt, 0, LONG_MAX);
@@ -209,6 +209,7 @@ void setup(void)
long hpage_size;
tst_require_root();
+ check_hugepage();
tst_sig(NOFORK, DEF_HANDLER, cleanup);
tst_tmpdir();
diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c
index 2bac9c2..b1c5812 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c
@@ -91,7 +91,7 @@ int main(int ac, char **av)
{
int lc, i;
- tst_parse_opts(ac, av, options, &help);
+ tst_parse_opts(ac, av, options, NULL);
if (sflag)
hugepages = SAFE_STRTOL(NULL, nr_opt, 0, LONG_MAX);
@@ -125,6 +125,7 @@ void setup(void)
long hpage_size;
tst_require_root();
+ check_hugepage();
tst_sig(NOFORK, DEF_HANDLER, cleanup);
tst_tmpdir();
diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat03.c b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat03.c
index fe74810..12c9549 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat03.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat03.c
@@ -83,7 +83,7 @@ int main(int ac, char **av)
int status;
pid_t pid;
- tst_parse_opts(ac, av, options, &help);
+ tst_parse_opts(ac, av, options, NULL);
if (sflag)
hugepages = SAFE_STRTOL(NULL, nr_opt, 0, LONG_MAX);
@@ -131,6 +131,7 @@ void setup(void)
long hpage_size;
tst_require_root();
+ check_hugepage();
tst_sig(FORK, DEF_HANDLER, cleanup);
tst_tmpdir();
diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
index f631a0a..7a71747 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
@@ -47,6 +47,7 @@
#include "test.h"
#include "mem.h"
+#include "hugetlb.h"
#define SIZE (1024 * 1024 * 1024)
#define BOUNDARY (1024 * 1024 * 1024)
@@ -57,7 +58,6 @@ int TST_TOTAL = 3;
static long huge_free;
static long huge_free2;
static long hugepages;
-static long orig_hugepages;
static long orig_shmmax, new_shmmax;
static void shared_hugepage(void);
@@ -126,6 +126,7 @@ void setup(void)
long mem_total, hpage_size;
tst_require_root();
+ check_hugepage();
mem_total = read_meminfo("MemTotal:");
SAFE_FILE_SCANF(NULL, PATH_SHMMAX, "%ld", &orig_shmmax);
diff --git a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c
index d7990c7..a0d0c55 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c
@@ -64,6 +64,7 @@
#include "hugetlb.h"
#include "safe_macros.h"
#include "mem.h"
+#include "hugetlb.h"
char *TCID = "hugeshmctl01";
int TST_TOTAL = 4;
@@ -112,7 +113,7 @@ int main(int ac, char **av)
{
int lc, i;
- tst_parse_opts(ac, av, options, &help);
+ tst_parse_opts(ac, av, options, NULL);
if (sflag)
hugepages = SAFE_STRTOL(NULL, nr_opt, 0, LONG_MAX);
@@ -392,6 +393,7 @@ void setup(void)
long hpage_size;
tst_require_root();
+ check_hugepage();
tst_sig(FORK, sighandler, cleanup);
tst_tmpdir();
diff --git a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
index f79ee83..1ba6159 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
@@ -56,6 +56,7 @@
#include "hugetlb.h"
#include "safe_macros.h"
#include "mem.h"
+#include "hugetlb.h"
char *TCID = "hugeshmctl02";
int TST_TOTAL = 4;
@@ -95,7 +96,7 @@ int main(int ac, char **av)
{
int lc, i;
- tst_parse_opts(ac, av, options, &help);
+ tst_parse_opts(ac, av, options, NULL);
if (sflag)
hugepages = SAFE_STRTOL(NULL, nr_opt, 0, LONG_MAX);
@@ -130,6 +131,7 @@ void setup(void)
long hpage_size;
tst_require_root();
+ check_hugepage();
tst_sig(NOFORK, DEF_HANDLER, cleanup);
tst_tmpdir();
diff --git a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c
index e553a2a..f3a0d22 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c
@@ -63,6 +63,7 @@
#include "hugetlb.h"
#include "safe_macros.h"
#include "mem.h"
+#include "hugetlb.h"
char *TCID = "hugeshmctl03";
int TST_TOTAL = 3;
@@ -102,7 +103,7 @@ int main(int ac, char **av)
pid_t pid;
int status;
- tst_parse_opts(ac, av, options, &help);
+ tst_parse_opts(ac, av, options, NULL);
if (sflag)
hugepages = SAFE_STRTOL(NULL, nr_opt, 0, LONG_MAX);
@@ -156,6 +157,7 @@ void setup(void)
long hpage_size;
tst_require_root();
+ check_hugepage();
tst_sig(FORK, DEF_HANDLER, cleanup);
tst_tmpdir();
diff --git a/testcases/kernel/mem/hugetlb/hugeshmdt/hugeshmdt01.c b/testcases/kernel/mem/hugetlb/hugeshmdt/hugeshmdt01.c
index c8592b3..02c7a3d 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmdt/hugeshmdt01.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmdt/hugeshmdt01.c
@@ -85,7 +85,7 @@ int main(int ac, char **av)
{
int lc;
- tst_parse_opts(ac, av, options, &help);
+ tst_parse_opts(ac, av, options, NULL);
if (sflag)
hugepages = SAFE_STRTOL(NULL, nr_opt, 0, LONG_MAX);
@@ -165,6 +165,7 @@ void setup(void)
long hpage_size;
tst_require_root();
+ check_hugepage();
tst_sig(NOFORK, sighandler, cleanup);
tst_tmpdir();
diff --git a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget01.c b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget01.c
index 5d45aaa..4c51599 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget01.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget01.c
@@ -79,7 +79,7 @@ int main(int ac, char **av)
int lc;
struct shmid_ds buf;
- tst_parse_opts(ac, av, options, &help);
+ tst_parse_opts(ac, av, options, NULL);
if (sflag)
hugepages = SAFE_STRTOL(NULL, nr_opt, 0, LONG_MAX);
@@ -143,6 +143,7 @@ void setup(void)
long hpage_size;
tst_require_root();
+ check_hugepage();
tst_sig(NOFORK, DEF_HANDLER, cleanup);
tst_tmpdir();
diff --git a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c
index 0ac4a29..73fab60 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c
@@ -95,7 +95,7 @@ int main(int ac, char **av)
int lc, i;
int shm_id_2 = -1;
- tst_parse_opts(ac, av, options, &help);
+ tst_parse_opts(ac, av, options, NULL);
if (sflag)
hugepages = SAFE_STRTOL(NULL, nr_opt, 0, LONG_MAX);
@@ -138,6 +138,7 @@ void setup(void)
long hpage_size;
tst_require_root();
+ check_hugepage();
tst_sig(NOFORK, DEF_HANDLER, cleanup);
tst_tmpdir();
diff --git a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c
index 9a2a0b2..e38d3aa 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c
@@ -82,7 +82,7 @@ int main(int ac, char **av)
{
int lc;
- tst_parse_opts(ac, av, options, &help);
+ tst_parse_opts(ac, av, options, NULL);
if (sflag)
hugepages = SAFE_STRTOL(NULL, nr_opt, 0, LONG_MAX);
@@ -113,6 +113,7 @@ void setup(void)
long hpage_size;
tst_require_root();
+ check_hugepage();
tst_sig(NOFORK, DEF_HANDLER, cleanup);
tst_tmpdir();
diff --git a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget05.c b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget05.c
index 567b02d..2a0d468 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget05.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget05.c
@@ -85,7 +85,7 @@ int main(int ac, char **av)
pid_t pid;
int status;
- tst_parse_opts(ac, av, options, &help);
+ tst_parse_opts(ac, av, options, NULL);
if (sflag)
hugepages = SAFE_STRTOL(NULL, nr_opt, 0, LONG_MAX);
@@ -135,6 +135,7 @@ void setup(void)
long hpage_size;
tst_require_root();
+ check_hugepage();
tst_sig(FORK, DEF_HANDLER, cleanup);
tst_tmpdir();
diff --git a/testcases/kernel/mem/hugetlb/lib/hugetlb.c b/testcases/kernel/mem/hugetlb/lib/hugetlb.c
index 4b2a3d2..dae7da3 100644
--- a/testcases/kernel/mem/hugetlb/lib/hugetlb.c
+++ b/testcases/kernel/mem/hugetlb/lib/hugetlb.c
@@ -26,10 +26,10 @@
*
* The library contains the following routines:
*
+ * check_hugepage()
* getipckey()
* getuserid()
* rm_shm()
- * help()
*/
#include <sys/types.h>
@@ -39,6 +39,12 @@
#include <pwd.h>
#include "hugetlb.h"
+void check_hugepage(void)
+{
+ if (access(PATH_HUGEPAGES, F_OK))
+ tst_brkm(TCONF, NULL, "Huge page is not supported.");
+}
+
/*
* getipckey() - generates and returns a message key used by the "get"
* calls to create an IPC resource.
@@ -109,8 +115,3 @@ void rm_shm(int shm_id)
tst_resm(TINFO, "id = %d", shm_id);
}
}
-
-void help(void)
-{
- printf(" -s NUM Set the number of hugepages to be allocated\n");
-}
diff --git a/testcases/kernel/mem/hugetlb/lib/hugetlb.h b/testcases/kernel/mem/hugetlb/lib/hugetlb.h
index 6d73e9c..9b76abe 100644
--- a/testcases/kernel/mem/hugetlb/lib/hugetlb.h
+++ b/testcases/kernel/mem/hugetlb/lib/hugetlb.h
@@ -43,9 +43,12 @@
* from shmid_ds.ipc_perm.mode
*/
#define MODE_MASK 0x01FF
+#define PATH_HUGEPAGES "/sys/kernel/mm/hugepages/"
key_t shmkey; /* an IPC key generated by ftok() */
+void check_hugepage(void);
+
int getipckey(void);
int getuserid(char *user);
void rm_shm(int shm_id);
@@ -56,6 +59,5 @@ void setup(void);
char *nr_opt;
int sflag;
long orig_hugepages;
-void help(void);
#endif /* hugetlb.h */
diff --git a/testcases/kernel/syscalls/futex/futex_wake04.c b/testcases/kernel/syscalls/futex/futex_wake04.c
index dcefde8..3c70383 100644
--- a/testcases/kernel/syscalls/futex/futex_wake04.c
+++ b/testcases/kernel/syscalls/futex/futex_wake04.c
@@ -50,6 +50,7 @@
#define PATH_MEMINFO "/proc/meminfo"
#define PATH_NR_HUGEPAGES "/proc/sys/vm/nr_hugepages"
+#define PATH_HUGEPAGES "/sys/kernel/mm/hugepages/"
const char *TCID = "futex_wake04";
const int TST_TOTAL = 1;
@@ -69,6 +70,9 @@ static void setup(void)
"that are 2.6.32 or higher");
}
+ if (access(PATH_HUGEPAGES, F_OK))
+ tst_brkm(TCONF, NULL, "Huge page is not supported.");
+
tst_tmpdir();
SAFE_FILE_SCANF(NULL, PATH_NR_HUGEPAGES, "%ld", &orig_hugepages);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [LTP] [PATCH 1/2] hugetlb: rename lib/ipcshm.* to lib/hugetlb.*
2015-11-27 8:18 [LTP] [PATCH 1/2] hugetlb: rename lib/ipcshm.* to lib/hugetlb.* Li Wang
2015-11-27 8:18 ` [LTP] [PATCH 2/2] hugetlb: checking if hugepage is supported on target system Li Wang
@ 2015-12-03 2:57 ` Li Wang
2015-12-03 16:05 ` Cyril Hrubis
2 siblings, 0 replies; 6+ messages in thread
From: Li Wang @ 2015-12-03 2:57 UTC (permalink / raw)
To: ltp
Hi,
sorry, ping~
http://lists.linux.it/pipermail/ltp/2015-November/000563.html
http://lists.linux.it/pipermail/ltp/2015-November/000564.html
http://lists.linux.it/pipermail/ltp/2015-November/000565.html
http://lists.linux.it/pipermail/ltp/2015-November/000566.html
any comments on above patches?
On Fri, Nov 27, 2015 at 4:18 PM, Li Wang <liwang@redhat.com> wrote:
> Signed-off-by: Li Wang <liwang@redhat.com>
> ---
> testcases/kernel/mem/hugetlb/Makefile | 2 +-
> testcases/kernel/mem/hugetlb/Makefile.inc | 4 +-
> .../kernel/mem/hugetlb/hugeshmat/hugeshmat01.c | 2 +-
> .../kernel/mem/hugetlb/hugeshmat/hugeshmat02.c | 2 +-
> .../kernel/mem/hugetlb/hugeshmat/hugeshmat03.c | 2 +-
> .../kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c | 2 +-
> .../kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c | 2 +-
> .../kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c | 2 +-
> .../kernel/mem/hugetlb/hugeshmdt/hugeshmdt01.c | 2 +-
> .../kernel/mem/hugetlb/hugeshmget/hugeshmget01.c | 2 +-
> .../kernel/mem/hugetlb/hugeshmget/hugeshmget02.c | 2 +-
> .../kernel/mem/hugetlb/hugeshmget/hugeshmget03.c | 2 +-
> .../kernel/mem/hugetlb/hugeshmget/hugeshmget05.c | 2 +-
> testcases/kernel/mem/hugetlb/lib/Makefile | 2 +-
> testcases/kernel/mem/hugetlb/lib/hugetlb.c | 116
> +++++++++++++++++++++
> testcases/kernel/mem/hugetlb/lib/hugetlb.h | 61 +++++++++++
> testcases/kernel/mem/hugetlb/lib/ipcshm.h | 61 -----------
> testcases/kernel/mem/hugetlb/lib/libipc.c | 116
> ---------------------
> 18 files changed, 192 insertions(+), 192 deletions(-)
> create mode 100644 testcases/kernel/mem/hugetlb/lib/hugetlb.c
> create mode 100644 testcases/kernel/mem/hugetlb/lib/hugetlb.h
> delete mode 100644 testcases/kernel/mem/hugetlb/lib/ipcshm.h
> delete mode 100644 testcases/kernel/mem/hugetlb/lib/libipc.c
>
> diff --git a/testcases/kernel/mem/hugetlb/Makefile
> b/testcases/kernel/mem/hugetlb/Makefile
> index 1e8f8f8..ea7867f 100644
> --- a/testcases/kernel/mem/hugetlb/Makefile
> +++ b/testcases/kernel/mem/hugetlb/Makefile
> @@ -21,7 +21,7 @@ top_srcdir ?= ../../../..
> include $(top_srcdir)/include/mk/env_pre.mk
>
> LIBDIR := lib
> -LIB := $(LIBDIR)/libipc_hugetlb.a
> +LIB := $(LIBDIR)/libhugetlb.a
> FILTER_OUT_DIRS := $(LIBDIR)
>
> $(LIBDIR):
> diff --git a/testcases/kernel/mem/hugetlb/Makefile.inc
> b/testcases/kernel/mem/hugetlb/Makefile.inc
> index cc0ada6..c07d600 100644
> --- a/testcases/kernel/mem/hugetlb/Makefile.inc
> +++ b/testcases/kernel/mem/hugetlb/Makefile.inc
> @@ -22,7 +22,7 @@
>
> # DO NOT USE THIS FILE FOR hugetlb / lib!!!
> LIBIPCDIR := ../lib
> -LIBIPC := $(LIBIPCDIR)/libipc_hugetlb.a
> +LIBIPC := $(LIBIPCDIR)/libhugetlb.a
>
> $(LIBIPCDIR):
> mkdir -p "$@"
> @@ -31,7 +31,7 @@ $(LIBIPC): $(LIBIPCDIR)
>
> CPPFLAGS += -I$(abs_srcdir)/$(LIBIPCDIR)
> LDFLAGS += -L$(abs_builddir)/$(LIBIPCDIR)
> -LDLIBS += -lipc_hugetlb
> +LDLIBS += -lhugetlb
> MAKE_DEPS += $(LIBIPC)
>
> include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
> diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat01.c
> b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat01.c
> index 851d4cf..35e7216 100644
> --- a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat01.c
> +++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat01.c
> @@ -56,7 +56,7 @@
> * none
> */
>
> -#include "ipcshm.h"
> +#include "hugetlb.h"
> #include "safe_macros.h"
> #include "mem.h"
>
> diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c
> b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c
> index 52348f1..2bac9c2 100644
> --- a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c
> +++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c
> @@ -51,7 +51,7 @@
> */
>
> #include <pwd.h>
> -#include "ipcshm.h"
> +#include "hugetlb.h"
> #include "safe_macros.h"
> #include "mem.h"
>
> diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat03.c
> b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat03.c
> index 723c8b5..fe74810 100644
> --- a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat03.c
> +++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat03.c
> @@ -57,7 +57,7 @@
> * test must be run at root
> */
>
> -#include "ipcshm.h"
> +#include "hugetlb.h"
> #include "safe_macros.h"
> #include "mem.h"
>
> diff --git a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c
> b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c
> index 66ad1b5..d7990c7 100644
> --- a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c
> +++ b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c
> @@ -61,7 +61,7 @@
> * none
> */
>
> -#include "ipcshm.h"
> +#include "hugetlb.h"
> #include "safe_macros.h"
> #include "mem.h"
>
> diff --git a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
> b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
> index 4aeb638..f79ee83 100644
> --- a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
> +++ b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
> @@ -53,7 +53,7 @@
> */
>
> #include <pwd.h>
> -#include "ipcshm.h"
> +#include "hugetlb.h"
> #include "safe_macros.h"
> #include "mem.h"
>
> diff --git a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c
> b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c
> index 9f5c2c9..e553a2a 100644
> --- a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c
> +++ b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c
> @@ -60,7 +60,7 @@
>
> #include <sys/types.h>
> #include <sys/wait.h>
> -#include "ipcshm.h"
> +#include "hugetlb.h"
> #include "safe_macros.h"
> #include "mem.h"
>
> diff --git a/testcases/kernel/mem/hugetlb/hugeshmdt/hugeshmdt01.c
> b/testcases/kernel/mem/hugetlb/hugeshmdt/hugeshmdt01.c
> index 9770e87..c8592b3 100644
> --- a/testcases/kernel/mem/hugetlb/hugeshmdt/hugeshmdt01.c
> +++ b/testcases/kernel/mem/hugetlb/hugeshmdt/hugeshmdt01.c
> @@ -58,7 +58,7 @@
> */
>
> #include <setjmp.h>
> -#include "ipcshm.h"
> +#include "hugetlb.h"
> #include "safe_macros.h"
> #include "mem.h"
>
> diff --git a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget01.c
> b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget01.c
> index ee82de3..5d45aaa 100644
> --- a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget01.c
> +++ b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget01.c
> @@ -58,7 +58,7 @@
> * none
> */
>
> -#include "ipcshm.h"
> +#include "hugetlb.h"
> #include "safe_macros.h"
> #include "mem.h"
>
> diff --git a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c
> b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c
> index b995ef8..0ac4a29 100644
> --- a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c
> +++ b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c
> @@ -51,7 +51,7 @@
> * none
> */
>
> -#include "ipcshm.h"
> +#include "hugetlb.h"
> #include "safe_macros.h"
> #include "mem.h"
>
> diff --git a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c
> b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c
> index 9284669..9a2a0b2 100644
> --- a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c
> +++ b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c
> @@ -52,7 +52,7 @@
> * none
> */
>
> -#include "ipcshm.h"
> +#include "hugetlb.h"
> #include "safe_macros.h"
> #include "mem.h"
>
> diff --git a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget05.c
> b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget05.c
> index 7b8f6b4..567b02d 100644
> --- a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget05.c
> +++ b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget05.c
> @@ -60,7 +60,7 @@
>
> #include <sys/types.h>
> #include <sys/wait.h>
> -#include "ipcshm.h"
> +#include "hugetlb.h"
> #include "safe_macros.h"
> #include "mem.h"
>
> diff --git a/testcases/kernel/mem/hugetlb/lib/Makefile
> b/testcases/kernel/mem/hugetlb/lib/Makefile
> index 4cdd142..96e8e37 100644
> --- a/testcases/kernel/mem/hugetlb/lib/Makefile
> +++ b/testcases/kernel/mem/hugetlb/lib/Makefile
> @@ -20,6 +20,6 @@ top_srcdir ?= ../../../../..
>
> include $(top_srcdir)/include/mk/env_pre.mk
>
> -LIB := libipc_hugetlb.a
> +LIB := libhugetlb.a
>
> include $(top_srcdir)/include/mk/lib.mk
> diff --git a/testcases/kernel/mem/hugetlb/lib/hugetlb.c
> b/testcases/kernel/mem/hugetlb/lib/hugetlb.c
> new file mode 100644
> index 0000000..4b2a3d2
> --- /dev/null
> +++ b/testcases/kernel/mem/hugetlb/lib/hugetlb.c
> @@ -0,0 +1,116 @@
> +/*
> + *
> + * Copyright (c) International Business Machines Corp., 2001
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
> + * the GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA
> + */
> +
> +/*
> + * NAME
> + * hugetlb.c
> + *
> + * DESCRIPTION
> + * common routines for the hugepage tests.
> + *
> + * The library contains the following routines:
> + *
> + * getipckey()
> + * getuserid()
> + * rm_shm()
> + * help()
> + */
> +
> +#include <sys/types.h>
> +#include <sys/ipc.h>
> +#include <sys/shm.h>
> +#include <sys/timeb.h>
> +#include <pwd.h>
> +#include "hugetlb.h"
> +
> +/*
> + * getipckey() - generates and returns a message key used by the "get"
> + * calls to create an IPC resource.
> + */
> +int getipckey(void)
> +{
> + const char a = 'a';
> + int ascii_a = (int)a;
> + char *curdir = NULL;
> + size_t size = 0;
> + key_t ipc_key;
> + struct timeb time_info;
> +
> + curdir = getcwd(curdir, size);
> + if (curdir == NULL)
> + tst_brkm(TBROK | TERRNO, cleanup, "getcwd(curdir)");
> +
> + /*
> + * Get a Sys V IPC key
> + *
> + * ftok() requires a character as a second argument. This is
> + * refered to as a "project identifier" in the man page. In
> + * order to maximize the chance of getting a unique key, the
> + * project identifier is a "random character" produced by
> + * generating a random number between 0 and 25 and then adding
> + * that to the ascii value of 'a'. The "seed" for the random
> + * number is the millisecond value that is set in the timeb
> + * structure after calling ftime().
> + */
> + ftime(&time_info);
> + srandom((unsigned int)time_info.millitm);
> +
> + ipc_key = ftok(curdir, ascii_a + random() % 26);
> + if (ipc_key == -1)
> + tst_brkm(TBROK | TERRNO, cleanup, "ftok");
> +
> + return ipc_key;
> +}
> +
> +/*
> + * getuserid() - return the integer value for the "user" id
> + */
> +int getuserid(char *user)
> +{
> + struct passwd *ent;
> +
> + ent = getpwnam(user);
> + if (ent == NULL)
> + tst_brkm(TBROK | TERRNO, cleanup, "getpwnam");
> +
> + return ent->pw_uid;
> +}
> +
> +/*
> + * rm_shm() - removes a shared memory segment.
> + */
> +void rm_shm(int shm_id)
> +{
> + if (shm_id == -1)
> + return;
> +
> + /*
> + * check for # of attaches ?
> + */
> + if (shmctl(shm_id, IPC_RMID, NULL) == -1) {
> + tst_resm(TINFO, "WARNING: shared memory deletion failed.");
> + tst_resm(TINFO, "This could lead to IPC resource
> problems.");
> + tst_resm(TINFO, "id = %d", shm_id);
> + }
> +}
> +
> +void help(void)
> +{
> + printf(" -s NUM Set the number of hugepages to be
> allocated\n");
> +}
> diff --git a/testcases/kernel/mem/hugetlb/lib/hugetlb.h
> b/testcases/kernel/mem/hugetlb/lib/hugetlb.h
> new file mode 100644
> index 0000000..6d73e9c
> --- /dev/null
> +++ b/testcases/kernel/mem/hugetlb/lib/hugetlb.h
> @@ -0,0 +1,61 @@
> +/*
> + *
> + * Copyright (c) International Business Machines Corp., 2001
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
> + * the GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA
> + */
> +
> +/*
> + * hugetlb.h - common definitions for the hugepage tests
> + */
> +
> +#ifndef __HUGETLB_H
> +#define __HUGETLB_H
> +
> +#include <sys/ipc.h>
> +#include <sys/shm.h>
> +#include <errno.h>
> +#include <wait.h>
> +#include "test.h"
> +
> +#define SHM_RD 0400
> +#define SHM_WR 0200
> +#define SHM_RW (SHM_RD|SHM_WR)
> +
> +#ifndef SHM_HUGETLB
> +#define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */
> +#endif
> +
> +/*
> + * to get the lower nine permission bits
> + * from shmid_ds.ipc_perm.mode
> + */
> +#define MODE_MASK 0x01FF
> +
> +key_t shmkey; /* an IPC key generated by ftok() */
> +
> +int getipckey(void);
> +int getuserid(char *user);
> +void rm_shm(int shm_id);
> +
> +void cleanup(void);
> +void setup(void);
> +
> +char *nr_opt;
> +int sflag;
> +long orig_hugepages;
> +void help(void);
> +
> +#endif /* hugetlb.h */
> diff --git a/testcases/kernel/mem/hugetlb/lib/ipcshm.h
> b/testcases/kernel/mem/hugetlb/lib/ipcshm.h
> deleted file mode 100644
> index 194d14b..0000000
> --- a/testcases/kernel/mem/hugetlb/lib/ipcshm.h
> +++ /dev/null
> @@ -1,61 +0,0 @@
> -/*
> - *
> - * Copyright (c) International Business Machines Corp., 2001
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation; either version 2 of the License, or
> - * (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
> - * the GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA
> - */
> -
> -/*
> - * ipcshm.h - common definitions for the IPC shared memory tests
> - */
> -
> -#ifndef __IPCSHM_H
> -#define __IPCSHM_H
> -
> -#include <sys/ipc.h>
> -#include <sys/shm.h>
> -#include <errno.h>
> -#include <wait.h>
> -#include "test.h"
> -
> -#define SHM_RD 0400
> -#define SHM_WR 0200
> -#define SHM_RW (SHM_RD|SHM_WR)
> -
> -#ifndef SHM_HUGETLB
> -#define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */
> -#endif
> -
> -/*
> - * to get the lower nine permission bits
> - * from shmid_ds.ipc_perm.mode
> - */
> -#define MODE_MASK 0x01FF
> -
> -key_t shmkey; /* an IPC key generated by ftok() */
> -
> -int getipckey(void);
> -int getuserid(char *user);
> -void rm_shm(int shm_id);
> -
> -void cleanup(void);
> -void setup(void);
> -
> -char *nr_opt;
> -int sflag;
> -long orig_hugepages;
> -void help(void);
> -
> -#endif /* ipcshm.h */
> diff --git a/testcases/kernel/mem/hugetlb/lib/libipc.c
> b/testcases/kernel/mem/hugetlb/lib/libipc.c
> deleted file mode 100644
> index 1f16f22..0000000
> --- a/testcases/kernel/mem/hugetlb/lib/libipc.c
> +++ /dev/null
> @@ -1,116 +0,0 @@
> -/*
> - *
> - * Copyright (c) International Business Machines Corp., 2001
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation; either version 2 of the License, or
> - * (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
> - * the GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA
> - */
> -
> -/*
> - * NAME
> - * libipc.c
> - *
> - * DESCRIPTION
> - * common routines for the IPC system call tests.
> - *
> - * The library contains the following routines:
> - *
> - * getipckey()
> - * getuserid()
> - * rm_shm()
> - * help()
> - */
> -
> -#include <sys/types.h>
> -#include <sys/ipc.h>
> -#include <sys/shm.h>
> -#include <sys/timeb.h>
> -#include <pwd.h>
> -#include "ipcshm.h"
> -
> -/*
> - * getipckey() - generates and returns a message key used by the "get"
> - * calls to create an IPC resource.
> - */
> -int getipckey(void)
> -{
> - const char a = 'a';
> - int ascii_a = (int)a;
> - char *curdir = NULL;
> - size_t size = 0;
> - key_t ipc_key;
> - struct timeb time_info;
> -
> - curdir = getcwd(curdir, size);
> - if (curdir == NULL)
> - tst_brkm(TBROK | TERRNO, cleanup, "getcwd(curdir)");
> -
> - /*
> - * Get a Sys V IPC key
> - *
> - * ftok() requires a character as a second argument. This is
> - * refered to as a "project identifier" in the man page. In
> - * order to maximize the chance of getting a unique key, the
> - * project identifier is a "random character" produced by
> - * generating a random number between 0 and 25 and then adding
> - * that to the ascii value of 'a'. The "seed" for the random
> - * number is the millisecond value that is set in the timeb
> - * structure after calling ftime().
> - */
> - ftime(&time_info);
> - srandom((unsigned int)time_info.millitm);
> -
> - ipc_key = ftok(curdir, ascii_a + random() % 26);
> - if (ipc_key == -1)
> - tst_brkm(TBROK | TERRNO, cleanup, "ftok");
> -
> - return ipc_key;
> -}
> -
> -/*
> - * getuserid() - return the integer value for the "user" id
> - */
> -int getuserid(char *user)
> -{
> - struct passwd *ent;
> -
> - ent = getpwnam(user);
> - if (ent == NULL)
> - tst_brkm(TBROK | TERRNO, cleanup, "getpwnam");
> -
> - return ent->pw_uid;
> -}
> -
> -/*
> - * rm_shm() - removes a shared memory segment.
> - */
> -void rm_shm(int shm_id)
> -{
> - if (shm_id == -1)
> - return;
> -
> - /*
> - * check for # of attaches ?
> - */
> - if (shmctl(shm_id, IPC_RMID, NULL) == -1) {
> - tst_resm(TINFO, "WARNING: shared memory deletion failed.");
> - tst_resm(TINFO, "This could lead to IPC resource
> problems.");
> - tst_resm(TINFO, "id = %d", shm_id);
> - }
> -}
> -
> -void help(void)
> -{
> - printf(" -s NUM Set the number of hugepages to be
> allocated\n");
> -}
> --
> 1.8.3.1
>
>
> --
> Mailing list info: http://lists.linux.it/listinfo/ltp
>
--
Regards,
Li Wang
Email: liwang@redhat.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20151203/74c0747a/attachment-0001.html>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH 1/2] hugetlb: rename lib/ipcshm.* to lib/hugetlb.*
2015-11-27 8:18 [LTP] [PATCH 1/2] hugetlb: rename lib/ipcshm.* to lib/hugetlb.* Li Wang
2015-11-27 8:18 ` [LTP] [PATCH 2/2] hugetlb: checking if hugepage is supported on target system Li Wang
2015-12-03 2:57 ` [LTP] [PATCH 1/2] hugetlb: rename lib/ipcshm.* to lib/hugetlb.* Li Wang
@ 2015-12-03 16:05 ` Cyril Hrubis
2 siblings, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2015-12-03 16:05 UTC (permalink / raw)
To: ltp
Hi!
This one (the rename) is fine.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH 2/2] hugetlb: checking if hugepage is supported on target system
2015-11-27 8:18 ` [LTP] [PATCH 2/2] hugetlb: checking if hugepage is supported on target system Li Wang
@ 2015-12-03 16:08 ` Cyril Hrubis
2015-12-04 5:55 ` Li Wang
0 siblings, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2015-12-03 16:08 UTC (permalink / raw)
To: ltp
Hi!
> -static void setup(void)
> +void setup(void)
This is wrong. What you should do instead is:
* Remove the cleanup() and setup() definitions from the header from lib/
* Change the getipckey() and getuserid() to have the callback pointer as
their first parameter and pass the cleanup callback in the
testcases.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH 2/2] hugetlb: checking if hugepage is supported on target system
2015-12-03 16:08 ` Cyril Hrubis
@ 2015-12-04 5:55 ` Li Wang
0 siblings, 0 replies; 6+ messages in thread
From: Li Wang @ 2015-12-04 5:55 UTC (permalink / raw)
To: ltp
Hi,
On Fri, Dec 4, 2015 at 12:08 AM, Cyril Hrubis <chrubis@suse.cz> wrote:
> Hi!
> > -static void setup(void)
> > +void setup(void)
>
> This is wrong. What you should do instead is:
>
> * Remove the cleanup() and setup() definitions from the header from lib/
>
> * Change the getipckey() and getuserid() to have the callback pointer as
> their first parameter and pass the cleanup callback in the
> testcases.
>
ok, great. I would like to change that. patch V2 will be threw out.
--
Regards,
Li Wang
Email: liwang@redhat.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20151204/55a132c1/attachment.html>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-12-04 5:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-27 8:18 [LTP] [PATCH 1/2] hugetlb: rename lib/ipcshm.* to lib/hugetlb.* Li Wang
2015-11-27 8:18 ` [LTP] [PATCH 2/2] hugetlb: checking if hugepage is supported on target system Li Wang
2015-12-03 16:08 ` Cyril Hrubis
2015-12-04 5:55 ` Li Wang
2015-12-03 2:57 ` [LTP] [PATCH 1/2] hugetlb: rename lib/ipcshm.* to lib/hugetlb.* Li Wang
2015-12-03 16:05 ` Cyril Hrubis
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.