Comparison

plugins/mod_admin_telnet.lua @ 6511:5f9389af5115

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Sun, 09 Nov 2014 20:32:33 +0100
parent 6383:ec8878113907
parent 6503:8437058c4226
child 6534:b89406fa076c
comparison
equal deleted inserted replaced
6502:8fed6ea12098 6511:5f9389af5115
25 local jid_bare, jid_split = import("util.jid", "bare", "prepped_split"); 25 local jid_bare, jid_split = import("util.jid", "bare", "prepped_split");
26 local set, array = require "util.set", require "util.array"; 26 local set, array = require "util.set", require "util.array";
27 local cert_verify_identity = require "util.x509".verify_identity; 27 local cert_verify_identity = require "util.x509".verify_identity;
28 local envload = require "util.envload".envload; 28 local envload = require "util.envload".envload;
29 local envloadfile = require "util.envload".envloadfile; 29 local envloadfile = require "util.envload".envloadfile;
30 local has_pposix, pposix = pcall(require, "util.pposix");
30 31
31 local commands = module:shared("commands") 32 local commands = module:shared("commands")
32 local def_env = module:shared("env"); 33 local def_env = module:shared("env");
33 local default_env_mt = { __index = def_env }; 34 local default_env_mt = { __index = def_env };
34 local core_post_stanza = prosody.core_post_stanza; 35 local core_post_stanza = prosody.core_post_stanza;
320 end 321 end
321 return ("%0.2f%sB"):format(kb, unit); 322 return ("%0.2f%sB"):format(kb, unit);
322 end 323 end
323 324
324 function def_env.server:memory() 325 function def_env.server:memory()
325 if not pposix.meminfo then 326 if not has_pposix or not pposix.meminfo then
326 return true, "Lua is using "..collectgarbage("count"); 327 return true, "Lua is using "..collectgarbage("count");
327 end 328 end
328 local mem, lua_mem = pposix.meminfo(), collectgarbage("count"); 329 local mem, lua_mem = pposix.meminfo(), collectgarbage("count");
329 local print = self.session.print; 330 local print = self.session.print;
330 print("Process: "..human((mem.allocated+mem.allocated_mmap)/1024)); 331 print("Process: "..human((mem.allocated+mem.allocated_mmap)/1024));