lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Write a Lua C API function that does the work, or use LuaJIT and use
the FFI. I recommend using the FFI, because using the C API means you
have to either write a C library to be loaded by Lua or you have to
write a program that embeds the Lua interpreter, and at that point
your "as lightweight as possible" starts leaning toward "write it in
pure C" in my opinion (not that either of these solutions are any
heavier than using the standalone Lua interpreter, but if you're
writing C code anyway, might as well go all the way).

/s/ Adam

On Fri, Mar 15, 2013 at 7:50 AM, Laurent Faillie <> wrote:
> Hello,
> I wonder if their is anyway to do a statfs() from Lua ?
> Statfs() is the internal function used by unix' df command to retrieve
> file-system usage. I'm working on a monitoring tool (à la Nagios) but I
> would like to have it as lightweight as possible : it's why the monitor
> is in Lua and I would like to avoid as much as possible to fork()
> eternal processes as it's heavy for the host ; So no exec() if possible.
> I've been able to retrieve cpuload and memory usage directly in Linuxs
> /proc but nothing regarding disk usage :(
> Thanks
> Laurent