Sha256: c26c1f78a18bdc467bfe19f61cceaa5edf1a9373c8f60c17eb63e69f01086765

Contents?: true

Size: 699 Bytes

Versions: 11

Compression:

Stored size: 699 Bytes

Contents

#include <stdio.h>

#define LUA_LIB
#include "lua.h"
#include "lauxlib.h"

/*https://www.centos.org/docs/5/html/5.1/Deployment_Guide/s2-proc-meminfo.html
Gives information about RAM*/
/* Immunio Lua bindings */

static int
lua_meminfo(lua_State *L) {
  FILE *fp;
  char buf[2000];
  if ((fp=fopen("/proc/meminfo","r"))==NULL) {
    return 0;
  }
  else {
    fread(buf, 1, 2000, fp);
    size_t fsize = ftell(fp);
    buf[fsize] = '\0';
    lua_pushstring(L,buf);
  }
  fclose(fp);
  return 1;
}

static const luaL_Reg libmeminfo[] = {
  {"meminfo", lua_meminfo},
  {NULL, NULL}
};

int
luaopen_meminfo(lua_State *L) {
//  luaL_checkversion(L);
  luaL_register(L, "perf", libmeminfo);
  return 1;
}

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
immunio-1.2.1 lua-hooks/ext/perf/luameminfo.c
immunio-1.1.19 lua-hooks/ext/perf/luameminfo.c
immunio-1.1.18 lua-hooks/ext/perf/luameminfo.c
immunio-1.1.16 lua-hooks/ext/perf/luameminfo.c
immunio-1.1.15 lua-hooks/ext/perf/luameminfo.c
immunio-1.1.13 lua-hooks/ext/perf/luameminfo.c
immunio-1.1.11 lua-hooks/ext/perf/luameminfo.c
immunio-1.1.10 lua-hooks/ext/perf/luameminfo.c
immunio-1.1.7 lua-hooks/ext/perf/luameminfo.c
immunio-1.1.6 lua-hooks/ext/perf/luameminfo.c
immunio-1.1.5 lua-hooks/ext/perf/luameminfo.c