Add support for mapping shared memory segments via the --shm option.

Signed-off-by: Andy Whitcroft <[EMAIL PROTECTED]>
Acked-by: Mel Gorman <[EMAIL PROTECTED]>
Acked-by: Adam Litke <[EMAIL PROTECTED]>
---
 hugectl.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/hugectl.c b/hugectl.c
index 7400d8b..0358ce2 100644
--- a/hugectl.c
+++ b/hugectl.c
@@ -66,6 +66,7 @@ void print_usage()
        OPTION("--bss", "Requests remapping of the program bss");
        OPTION("--heap", "Requests remapping of the program heap");
        CONT("(malloc space)");
+       OPTION("--shm", "Requests remapping of shared memory segments");
 
        OPTION("--no-preload", "Disable preloading the libhugetlbfs library");
 
@@ -162,6 +163,7 @@ void verbose_expose(void)
 #define MAP_DATA       0x0004
 #define MAP_BSS                0x0008
 #define MAP_HEAP       0x0010
+#define MAP_SHM                0x0020
 
 void setup_mappings(int which)
 {
@@ -193,6 +195,9 @@ void setup_mappings(int which)
 
        if (which & MAP_HEAP)
                setup_environment("HUGETLB_MORECORE", "yes");
+
+       if (which & MAP_SHM)
+               setup_environment("HUGETLB_SHM", "yes");
 }
 
 #define LIBRARY_DISABLE ((void *)-1)
@@ -253,9 +258,9 @@ void library_path(char *path)
 
 void ldpreload(int which)
 {
-       if (which == MAP_HEAP) {
+       if (which & (MAP_HEAP|MAP_SHM)) {
                setup_environment("LD_PRELOAD", "libhugetlbfs.so");
-               WARNING("LD_PRELOAD in use for lone --heap\n");
+               WARNING("LD_PRELOAD in use for lone --heap/--shm\n");
        } else {
                DEBUG("LD_PRELOAD not appropriate for this map combination\n");
        }
@@ -284,6 +289,7 @@ int main(int argc, char** argv)
                {"data",       no_argument, NULL, MAP_BASE|MAP_DATA},
                {"bss",        no_argument, NULL, MAP_BASE|MAP_BSS},
                {"heap",       no_argument, NULL, MAP_BASE|MAP_HEAP},
+               {"shm",        no_argument, NULL, MAP_BASE|MAP_SHM},
 
                {0},
        };
-- 
1.6.0.1.451.gc8d31


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to