summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2012-12-12 12:01:16 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2012-12-12 12:01:16 +0100
commit9b0cffd1c46ebc77430d19fa173a848450512f6a (patch)
tree2ec658fe2f1429cd1dfb9547f271c0f5bbbc3a6d
parentf55179f734b5c3c48e116e21ebbe15a7c5870c2f (diff)
downloadprivsep-9b0cffd1c46ebc77430d19fa173a848450512f6a.tar.bz2
privsep-9b0cffd1c46ebc77430d19fa173a848450512f6a.tar.xz
add getpid example to show that they are running in different processes
-rw-r--r--example.lua5
-rw-r--r--modules/mymod.lua6
2 files changed, 11 insertions, 0 deletions
diff --git a/example.lua b/example.lua
index 324df49..91ce5ff 100644
--- a/example.lua
+++ b/example.lua
@@ -1,9 +1,14 @@
+
privsep = require("privsep")
+posix = require("posix")
mymod = privsep.wrap("mymod", "mysessionid")
print(mymod.myfunc("foo", false))
+print("posix.getpid:", posix.getpid().pid)
+print("mymod.getpid:", mymod.getpid().pid)
+
diff --git a/modules/mymod.lua b/modules/mymod.lua
index 1f5de06..c42b05b 100644
--- a/modules/mymod.lua
+++ b/modules/mymod.lua
@@ -1,7 +1,13 @@
local mymod = {}
+posix = require("posix")
+
function mymod.myfunc(arg1, arg2)
return "hello from mymod.myfunc. arg1 is '"..tostring(arg1).."' and arg2 is '"..tostring(arg2).."'"
end
+function mymod.getpid(...)
+ return posix.getpid(...)
+end
+
return mymod