diff --git a/test/log_read.lua b/test/log_read.lua index 4defb36b..8b83b562 100644 --- a/test/log_read.lua +++ b/test/log_read.lua @@ -5,6 +5,11 @@ local sock = require"sys.sock" local wipf = require"wipflua" +function get_procpath(id) + local pid = sys.pid(id, true) + return (pid and pid:path()) or "" +end + function print_logs(buf) local size = buf:seek() local ptr = buf:getptr() @@ -13,8 +18,14 @@ function print_logs(buf) while off < size do local len, ip, pid, path = wipf.log_read(ptr, off) local ip_str = sock.inet_ntop(ip) - off = off + len + + if not path then + path = get_procpath(pid) + end + print(ip_str, pid, path) + + off = off + len end buf:seek(0) diff --git a/test/wipf_test.lua b/test/wipf_test.lua index 40d3a99d..f6d6c5ab 100644 --- a/test/wipf_test.lua +++ b/test/wipf_test.lua @@ -6,9 +6,11 @@ local wipf = require"wipflua" local mem, win32 = sys.mem, sys.win32 -print"-- Log Write" +print"-- Log Read/Write" do local path = "/test" + assert(#path == 5) + local outlen = 12 + #path + 3 local bufsize = outlen + 4 local buf = assert(mem.pointer(bufsize))