diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2013-01-01 13:00:21 +0000 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2013-01-01 13:00:21 +0000 |
commit | 5a9ff583f216d5122d8e83a1d5db11d0c16dcae6 (patch) | |
tree | 0a6e5bc948079503f72957e6c088e31be3a525d5 /testing/uwsgi/lua-lock.patch | |
parent | 645f0a4c31437e6d317a67adfd2ba494a12cd673 (diff) | |
download | aports-5a9ff583f216d5122d8e83a1d5db11d0c16dcae6.tar.bz2 aports-5a9ff583f216d5122d8e83a1d5db11d0c16dcae6.tar.xz |
testing/uwsgi: Lua bindings for lock/unlock functions, added missing make dependency
Diffstat (limited to 'testing/uwsgi/lua-lock.patch')
-rw-r--r-- | testing/uwsgi/lua-lock.patch | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/testing/uwsgi/lua-lock.patch b/testing/uwsgi/lua-lock.patch new file mode 100644 index 000000000..059e8e969 --- /dev/null +++ b/testing/uwsgi/lua-lock.patch @@ -0,0 +1,71 @@ +diff --git a/plugins/lua/lua_plugin.c b/plugins/lua/lua_plugin.c +index 6a2a2a9..692c4ef 100644 +--- a/plugins/lua/lua_plugin.c ++++ b/plugins/lua/lua_plugin.c +@@ -291,6 +291,57 @@ static int uwsgi_api_req_fd(lua_State *L) { + return 1; + } + ++static int uwsgi_api_lock(lua_State *L) { ++ ++ int lock_num = 0; ++ ++ // the spooler cannot lock resources ++#ifdef UWSGI_SPOOLER ++ if (uwsgi.i_am_a_spooler) { ++ lua_pushstring(L, "The spooler cannot lock/unlock resources"); ++ lua_error(L); ++ } ++#endif ++ ++ if (lua_gettop(L) > 0) { ++ lock_num = lua_isnumber(L, 1) ? lua_tonumber(L, 1) : -1; ++ if (lock_num < 0 || lock_num > uwsgi.locks) { ++ lua_pushstring(L, "Invalid lock number"); ++ lua_error(L); ++ } ++ } ++ ++ uwsgi_lock(uwsgi.user_lock[lock_num]); ++ ++ return 0; ++} ++ ++ ++static int uwsgi_api_unlock(lua_State *L) { ++ ++ int lock_num = 0; ++ ++ // the spooler cannot lock resources ++#ifdef UWSGI_SPOOLER ++ if (uwsgi.i_am_a_spooler) { ++ lua_pushstring(L, "The spooler cannot lock/unlock resources"); ++ lua_error(L); ++ } ++#endif ++ ++ if (lua_gettop(L) > 0) { ++ lock_num = lua_isnumber(L, 1) ? lua_tonumber(L, 1) : -1; ++ if (lock_num < 0 || lock_num > uwsgi.locks) { ++ lua_pushstring(L, "Invalid lock number"); ++ lua_error(L); ++ } ++ } ++ ++ uwsgi_unlock(uwsgi.user_lock[lock_num]); ++ ++ return 0; ++} ++ + static const luaL_reg uwsgi_api[] = { + {"log", uwsgi_api_log}, + {"cl", uwsgi_api_cl}, +@@ -300,6 +351,8 @@ static const luaL_reg uwsgi_api[] = { + {"cache_set", uwsgi_api_cache_set}, + {"register_signal", uwsgi_api_register_signal}, + {"register_rpc", uwsgi_api_register_rpc}, ++ {"lock", uwsgi_api_lock}, ++ {"unlock", uwsgi_api_unlock}, + {NULL, NULL} + }; + |