Disable debug mode, so that the script will do the job rather
print debug info with no action. And check for root credentials,
to exit gracefully in case of script was executed under regular 
user account.  

Signed-off-by: Anton Arapov <[email protected]>
---
 huge_page_setup_helper.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/huge_page_setup_helper.py b/huge_page_setup_helper.py
index b8545ed..9de0739 100755
--- a/huge_page_setup_helper.py
+++ b/huge_page_setup_helper.py
@@ -10,7 +10,12 @@
 #
 import os
 
-debug = True
+debug = False
+
+# must be executed under the root to operate
+if os.geteuid() != 0:
+    print "You must be root to setup hugepages!"
+    os._exit(1)
 
 # config files we need access to
 sysctlConf = "/etc/sysctl.conf"
-- 
1.7.1


------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Libhugetlbfs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to