diff options
author | Felix Fietkau <nbd@openwrt.org> | 2009-10-26 04:52:07 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2009-10-26 04:52:07 +0000 |
commit | 64d9a00a9934cd06401f4b9ec2e14950a4423a87 (patch) | |
tree | 99f8a9f96407f1420e36a37f02a000346dc6ca81 /libs/nixio/src/process.c | |
parent | 2181825db596a12d23f56fa8fbfebd94f99b13c4 (diff) |
nixio: store stats and other number information as integer, which works better when lua number support is downgraded from double to float
Diffstat (limited to 'libs/nixio/src/process.c')
-rw-r--r-- | libs/nixio/src/process.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/libs/nixio/src/process.c b/libs/nixio/src/process.c index 0e8ac8a297..536acd7fff 100644 --- a/libs/nixio/src/process.c +++ b/libs/nixio/src/process.c @@ -225,16 +225,16 @@ static int nixio_times(lua_State *L) { return nixio__perror(L); } else { lua_createtable(L, 0, 4); - lua_pushnumber(L, buf.tms_cstime); + lua_pushinteger(L, buf.tms_cstime); lua_setfield(L, -2, "cstime"); - lua_pushnumber(L, buf.tms_cutime); + lua_pushinteger(L, buf.tms_cutime); lua_setfield(L, -2, "cutime"); - lua_pushnumber(L, buf.tms_stime); + lua_pushinteger(L, buf.tms_stime); lua_setfield(L, -2, "stime"); - lua_pushnumber(L, buf.tms_utime); + lua_pushinteger(L, buf.tms_utime); lua_setfield(L, -2, "utime"); return 1; @@ -365,44 +365,44 @@ static int nixio_sysinfo(lua_State *L) { lua_createtable(L, 0, 12); - lua_pushnumber(L, info.bufferram); + lua_pushinteger(L, info.bufferram); lua_setfield(L, -2, "bufferram"); - lua_pushnumber(L, info.freehigh); + lua_pushinteger(L, info.freehigh); lua_setfield(L, -2, "freehigh"); - lua_pushnumber(L, info.freeram); + lua_pushinteger(L, info.freeram); lua_setfield(L, -2, "freeram"); - lua_pushnumber(L, info.freeswap); + lua_pushinteger(L, info.freeswap); lua_setfield(L, -2, "freeswap"); lua_createtable(L, 0, 3); for (int i=0; i<3; i++) { - lua_pushnumber(L, info.loads[i] / 65536.); + lua_pushinteger(L, info.loads[i] / 65536.); lua_rawseti(L, -2, i+1); } lua_setfield(L, -2, "loads"); - lua_pushnumber(L, info.mem_unit); + lua_pushinteger(L, info.mem_unit); lua_setfield(L, -2, "mem_unit"); - lua_pushnumber(L, info.procs); + lua_pushinteger(L, info.procs); lua_setfield(L, -2, "procs"); - lua_pushnumber(L, info.sharedram); + lua_pushinteger(L, info.sharedram); lua_setfield(L, -2, "sharedram"); - lua_pushnumber(L, info.totalhigh); + lua_pushinteger(L, info.totalhigh); lua_setfield(L, -2, "totalhigh"); - lua_pushnumber(L, info.totalram); + lua_pushinteger(L, info.totalram); lua_setfield(L, -2, "totalram"); - lua_pushnumber(L, info.totalswap); + lua_pushinteger(L, info.totalswap); lua_setfield(L, -2, "totalswap"); - lua_pushnumber(L, info.uptime); + lua_pushinteger(L, info.uptime); lua_setfield(L, -2, "uptime"); return 1; |