diff options
author | Richard Ipsum <richardipsum@fastmail.co.uk> | 2018-10-12 18:10:53 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2018-10-21 13:39:52 +0100 |
commit | 301de4c825ae109cc3a7c780d662863ada62753b (patch) | |
tree | 6ec32101bff5b6b36603a4aa2b3a7cbcd26f1995 /luxio.c | |
parent | 4e95fbccfbbec3c1ebc10dc156a154a2953200dd (diff) | |
download | luxio-301de4c825ae109cc3a7c780d662863ada62753b.tar.bz2 |
Bind sysconf(3)
Diffstat (limited to 'luxio.c')
-rw-r--r-- | luxio.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -1011,7 +1011,17 @@ luxio_isatty(lua_State *L) /* 4.8 Configurable system variables *****************************************/ -/* TODO: sysconf() 4.8.1 */ +static int +luxio_sysconf(lua_State *L) +{ + int name = luaL_checkinteger(L, 1); + long result = sysconf(name); + + lua_pushinteger(L, result); + lua_pushinteger(L, result == -1 ? errno : 0); + + return 2; +} /*** Directories. @section dir @@ -4592,6 +4602,8 @@ luxio_functions[] = { { "ttyname", luxio_ttyname }, { "isatty", luxio_isatty }, + { "sysconf", luxio_sysconf }, + { NULL, NULL } }; |