summaryrefslogtreecommitdiffhomepage
path: root/libs/nixio/src
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2009-02-18 21:46:55 +0000
committerSteven Barth <steven@midlink.org>2009-02-18 21:46:55 +0000
commitcbc49a3b537e2e7cc49166f9d85e730d0f7d6275 (patch)
treed593ea5a84a8a1590367046074d13e65fb9ac1a2 /libs/nixio/src
parente062ec6981cc6a351b2a79676bdfc9054db44655 (diff)
More nixio fixes, initial httpclient
Diffstat (limited to 'libs/nixio/src')
-rw-r--r--libs/nixio/src/nixio.c12
-rw-r--r--libs/nixio/src/nixio.h4
2 files changed, 16 insertions, 0 deletions
diff --git a/libs/nixio/src/nixio.c b/libs/nixio/src/nixio.c
index 5f098be31..a4ef7462e 100644
--- a/libs/nixio/src/nixio.c
+++ b/libs/nixio/src/nixio.c
@@ -123,6 +123,18 @@ LUALIB_API int luaopen_nixio(lua_State *L) {
lua_pushnumber(L, VERSION);
lua_setfield(L, -2, "version");
+ /* some constants */
+ lua_createtable(L, 0, 1);
+
+ NIXIO_PUSH_CONSTANT(EACCES);
+ NIXIO_PUSH_CONSTANT(ENOSYS);
+ NIXIO_PUSH_CONSTANT(EINVAL);
+ NIXIO_PUSH_CONSTANT(EWOULDBLOCK);
+ NIXIO_PUSH_CONSTANT(EAGAIN);
+ NIXIO_PUSH_CONSTANT(ENOMEM);
+
+ lua_setfield(L, -2, "const");
+
/* remove meta table */
lua_remove(L, -2);
diff --git a/libs/nixio/src/nixio.h b/libs/nixio/src/nixio.h
index e4bb6d6de..cdb43599e 100644
--- a/libs/nixio/src/nixio.h
+++ b/libs/nixio/src/nixio.h
@@ -6,6 +6,10 @@
#define NIXIO_BUFFERSIZE 8096
#define _FILE_OFFSET_BITS 64
+#define NIXIO_PUSH_CONSTANT(x) \
+ lua_pushinteger(L, x); \
+ lua_setfield(L, -2, #x);
+
/* uClibc: broken as always */
#define _LARGEFILE_SOURCE