mod_measure_memory: Silence warnings [luacheck]

Tue, 07 Apr 2015 22:05:48 +0200

author
Kim Alvefur <zash@zash.se>
date
Tue, 07 Apr 2015 22:05:48 +0200
changeset 1655
4d38b8c03dfe
parent 1654
1a6d6221c5f6
child 1656
98a186874806

mod_measure_memory: Silence warnings [luacheck]

mod_measure_memory/mod_measure_memory.lua file | annotate | diff | comparison | revisions
--- a/mod_measure_memory/mod_measure_memory.lua	Tue Apr 07 18:12:40 2015 +0200
+++ b/mod_measure_memory/mod_measure_memory.lua	Tue Apr 07 22:05:48 2015 +0200
@@ -5,8 +5,8 @@
 
 local measures = {};
 setmetatable(measures, {
-	__index = function (t, k, m)
-		m = measure("sizes", "memory."..k); t[k] = m; return m;
+	__index = function (t, k)
+		local m = measure("sizes", "memory."..k); t[k] = m; return m;
 	end
 });
 
@@ -23,9 +23,7 @@
 	end);
 end
 
-local statm = io.open("/proc/self/statm");
-if statm then
-	statm:close();
+if require"lfs".attributes("/proc/self/statm", "mode") == "file" then
 	local pagesize = module:get_option_number("memory_pagesize", 4096); -- getconf PAGESIZE
 
 	module:hook("stats-update", function ()

mercurial