From 5a9ff583f216d5122d8e83a1d5db11d0c16dcae6 Mon Sep 17 00:00:00 2001 From: Kaarle Ritvanen Date: Tue, 1 Jan 2013 13:00:21 +0000 Subject: testing/uwsgi: Lua bindings for lock/unlock functions, added missing make dependency --- testing/uwsgi/APKBUILD | 9 +++--- testing/uwsgi/lua-lock.patch | 71 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 testing/uwsgi/lua-lock.patch (limited to 'testing') diff --git a/testing/uwsgi/APKBUILD b/testing/uwsgi/APKBUILD index ee07b4d340..3a6a0c64b8 100644 --- a/testing/uwsgi/APKBUILD +++ b/testing/uwsgi/APKBUILD @@ -2,14 +2,14 @@ # Maintainer: pkgname=uwsgi pkgver=1.4.3 -pkgrel=0 +pkgrel=1 pkgdesc="uWSGI application container server" url=http://projects.unbit.it/uwsgi/ arch=all license=GPL-2 -makedepends="linux-headers lua-dev python python-dev" +makedepends="linux-headers lua-dev python python-dev zeromq-dev" subpackages="uwsgi-lua uwsgi-python:py" -source="http://projects.unbit.it/downloads/uwsgi-${pkgver}.tar.gz futimes.patch include-sched.patch" +source="http://projects.unbit.it/downloads/uwsgi-${pkgver}.tar.gz futimes.patch include-sched.patch lua-lock.patch" _builddir=$srcdir/$pkgname-$pkgver prepare() { @@ -65,4 +65,5 @@ py() { md5sums="98561cfdb93fb72ed68b7afb2ae4df3a uwsgi-1.4.3.tar.gz 2c9aeb5b2adf1fa45ef4ed6bda47236a futimes.patch -02c43e001d5f44eb421079e17f9db003 include-sched.patch" +02c43e001d5f44eb421079e17f9db003 include-sched.patch +b791fb4994b0350992ffab3f939002ed lua-lock.patch" diff --git a/testing/uwsgi/lua-lock.patch b/testing/uwsgi/lua-lock.patch new file mode 100644 index 0000000000..059e8e9694 --- /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} + }; + -- cgit v1.2.3