aboutsummaryrefslogtreecommitdiffstats
path: root/util-src
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-02-27 14:36:43 +0100
committerKim Alvefur <zash@zash.se>2022-02-27 14:36:43 +0100
commit04aa101da3dc40c92b1c3ce8e3503367d9dcc5f2 (patch)
treeba8a34afbeb571653d06cdb264151e16a6b4c59a /util-src
parent22d734e305340a67304c81fdf64dd8662a41874b (diff)
downloadprosody-04aa101da3dc40c92b1c3ce8e3503367d9dcc5f2.tar.gz
prosody-04aa101da3dc40c92b1c3ce8e3503367d9dcc5f2.zip
util.poll: Expose API (epoll or select) used
Could he handy to know for debugging or decisions
Diffstat (limited to 'util-src')
-rw-r--r--util-src/poll.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/util-src/poll.c b/util-src/poll.c
index be0f6ffd..4bd897ae 100644
--- a/util-src/poll.c
+++ b/util-src/poll.c
@@ -14,8 +14,10 @@
#if defined(__linux__)
#define USE_EPOLL
+#define POLL_BACKEND "epoll"
#else
#define USE_SELECT
+#define POLL_BACKEND "select"
#endif
#ifdef USE_EPOLL
@@ -31,12 +33,7 @@
#include <lualib.h>
#include <lauxlib.h>
-#ifdef USE_EPOLL
-#define STATE_MT "util.poll<epoll>"
-#endif
-#ifdef USE_SELECT
-#define STATE_MT "util.poll<select>"
-#endif
+#define STATE_MT "util.poll<" POLL_BACKEND ">"
#if (LUA_VERSION_NUM == 501)
#define luaL_setmetatable(L, tname) luaL_getmetatable(L, tname); lua_setmetatable(L, -2)
@@ -487,6 +484,9 @@ int luaopen_util_poll(lua_State *L) {
push_errno(EEXIST);
push_errno(ENOENT);
+ lua_pushliteral(L, POLL_BACKEND);
+ lua_setfield(L, -2, "api");
+
}
return 1;
}