diff --git a/buildconf/all.ini b/buildconf/all.ini new file mode 100644 index 00000000..5e8cebaa --- /dev/null +++ b/buildconf/all.ini @@ -0,0 +1,3 @@ +[uwsgi] +main_plugin = python,gevent,psgi,lua,php,rack,jvm,jwsgi,ring,mono,transformation_gzip,transformation_toupper,coroae,v8,cgi +inherit = base diff --git a/core/rpc.c b/core/rpc.c index e4033224..7aaf2d4c 100644 --- a/core/rpc.c +++ b/core/rpc.c @@ -1,8 +1,8 @@ -#include "uwsgi.h" +#include extern struct uwsgi_server uwsgi; -int uwsgi_register_rpc(char *name, uint8_t modifier1, uint8_t args, void *func) { +int uwsgi_register_rpc(char *name, struct uwsgi_plugin *plugin, uint8_t args, void *func) { struct uwsgi_rpc *urpc; int ret = -1; @@ -30,7 +30,7 @@ int uwsgi_register_rpc(char *name, uint8_t modifier1, uint8_t args, void *func) uwsgi.shared->rpc_count[uwsgi.mywid]++; already: memcpy(urpc->name, name, strlen(name)); - urpc->modifier1 = modifier1; + urpc->plugin = plugin; urpc->args = args; urpc->func = func; urpc->shared = uwsgi.mywid == 0 ? 1 : 0; @@ -77,8 +77,8 @@ uint16_t uwsgi_rpc(char *name, uint8_t argc, char *argv[], uint16_t argvs[], cha } if (urpc) { - if (uwsgi.p[urpc->modifier1]->rpc) { - ret = uwsgi.p[urpc->modifier1]->rpc(urpc->func, argc, argv, argvs, output); + if (urpc->plugin->rpc) { + ret = urpc->plugin->rpc(urpc->func, argc, argv, argvs, output); } } diff --git a/plugins/coroae/coroae.c b/plugins/coroae/coroae.c index bd81cd21..8509c254 100644 --- a/plugins/coroae/coroae.c +++ b/plugins/coroae/coroae.c @@ -171,7 +171,7 @@ end: } XS(XS_coroae_sighandler) { - int sigfd = (int) XSANY.any_ptr; + int sigfd = (long) XSANY.any_ptr; uwsgi_receive_signal(sigfd, "worker", uwsgi.mywid); } diff --git a/plugins/jvm/jvm_plugin.c b/plugins/jvm/jvm_plugin.c index 0658b6ee..e530005e 100644 --- a/plugins/jvm/jvm_plugin.c +++ b/plugins/jvm/jvm_plugin.c @@ -41,7 +41,7 @@ JNIEXPORT void JNICALL uwsgi_jvm_api_register_signal(JNIEnv *env, jclass c, jint JNIEXPORT void JNICALL uwsgi_jvm_api_register_rpc(JNIEnv *env, jclass c, jstring name, jobject func) { // no need to release it char *n = uwsgi_jvm_str2c(name); - if (uwsgi_register_rpc(n, jvm_plugin.modifier1, 0, uwsgi_jvm_ref(func))) { + if (uwsgi_register_rpc(n, &jvm_plugin, 0, uwsgi_jvm_ref(func))) { uwsgi_jvm_throw("unable to register rpc function"); } } @@ -99,7 +99,7 @@ JNIEXPORT jobject JNICALL uwsgi_jvm_api_cache_get_name(JNIEnv *env, jclass c, js char *key = uwsgi_jvm_str2c(jkey); char *cache = uwsgi_jvm_str2c(jcache); uint64_t vallen = 0; - char *value = uwsgi_cache_magic_get(key, keylen, &vallen, cache); + char *value = uwsgi_cache_magic_get(key, keylen, &vallen, NULL, cache); uwsgi_jvm_release_chars(jkey, key); uwsgi_jvm_release_chars(jcache, cache); if (value) { diff --git a/plugins/lua/lua_plugin.c b/plugins/lua/lua_plugin.c index fe716967..b5a0a00e 100644 --- a/plugins/lua/lua_plugin.c +++ b/plugins/lua/lua_plugin.c @@ -1,4 +1,4 @@ -#include "../../uwsgi.h" +#include #include #include @@ -13,6 +13,8 @@ struct uwsgi_lua { struct uwsgi_string_list *load; } ulua; +struct uwsgi_plugin lua_plugin; + #define lca(L, n) ulua_check_args(L, __FUNCTION__, n) static void uwsgi_opt_luashell(char *opt, char *value, void *foobar) { @@ -88,7 +90,7 @@ static int uwsgi_api_register_rpc(lua_State *L) { uwsgi_log("registered function %d in Lua global table\n", func); lfunc = func; - if (uwsgi_register_rpc((char *)name, 6, 0, (void *) lfunc)) { + if (uwsgi_register_rpc((char *)name, &lua_plugin, 0, (void *) lfunc)) { lua_pushnil(L); } else { diff --git a/plugins/php/uwsgiplugin.py b/plugins/php/uwsgiplugin.py index fb9e5bb3..6861ce50 100644 --- a/plugins/php/uwsgiplugin.py +++ b/plugins/php/uwsgiplugin.py @@ -17,7 +17,7 @@ try: except: pass -CFLAGS = [os.popen(PHPPATH + ' --includes').read().rstrip(), '-Wno-error=sign-compare'] +CFLAGS = [os.popen(PHPPATH + ' --includes').read().rstrip(), '-Wno-sign-compare'] LDFLAGS = os.popen(PHPPATH + ' --ldflags').read().rstrip().split() if ld_run_path: diff --git a/plugins/python/uwsgi_pymodule.c b/plugins/python/uwsgi_pymodule.c index b664423b..3137b5e3 100644 --- a/plugins/python/uwsgi_pymodule.c +++ b/plugins/python/uwsgi_pymodule.c @@ -2,6 +2,7 @@ extern struct uwsgi_server uwsgi; extern struct uwsgi_python up; +extern struct uwsgi_plugin python_plugin; PyObject *py_uwsgi_signal_wait(PyObject * self, PyObject * args) { @@ -394,7 +395,7 @@ PyObject *py_uwsgi_register_rpc(PyObject * self, PyObject * args) { } - if (uwsgi_register_rpc(name, 0, argc, func)) { + if (uwsgi_register_rpc(name, &python_plugin, argc, func)) { return PyErr_Format(PyExc_ValueError, "unable to register rpc function"); } diff --git a/plugins/rack/rack_api.c b/plugins/rack/rack_api.c index e56b36c3..f2456858 100644 --- a/plugins/rack/rack_api.c +++ b/plugins/rack/rack_api.c @@ -774,7 +774,7 @@ VALUE uwsgi_ruby_register_rpc(int argc, VALUE *argv, VALUE *class) { void *func = (void *) argv[1]; - if (uwsgi_register_rpc(name, rack_plugin.modifier1, rb_argc, func)) { + if (uwsgi_register_rpc(name, &rack_plugin, rb_argc, func)) { clear: rb_raise(rb_eRuntimeError, "unable to register rpc function"); return Qnil; diff --git a/plugins/symcall/symcall_plugin.c b/plugins/symcall/symcall_plugin.c index 5498ad91..4676e61b 100644 --- a/plugins/symcall/symcall_plugin.c +++ b/plugins/symcall/symcall_plugin.c @@ -40,7 +40,7 @@ static void uwsgi_symcall_init(){ uwsgi_log("unable to find symbol \"%s\" in process address space\n", space+1); exit(1); } - if (uwsgi_register_rpc(usl->value, symcall_plugin.modifier1, 0, func)) { + if (uwsgi_register_rpc(usl->value, &symcall_plugin, 0, func)) { uwsgi_log("unable to register rpc function"); exit(1); } diff --git a/plugins/v8/v8_commonjs.cc b/plugins/v8/v8_commonjs.cc index 37ceabe2..4a92d28e 100644 --- a/plugins/v8/v8_commonjs.cc +++ b/plugins/v8/v8_commonjs.cc @@ -52,8 +52,8 @@ extern struct uwsgi_server uwsgi; v8::Persistent uwsgi_v8_setup_context() { -#ifdef UWSGI_V8_TEAJS v8::HandleScope handle_scope; +#ifdef UWSGI_V8_TEAJS try { app.init(); app.getContext()->Global()->Set(v8::String::New("require"), v8::FunctionTemplate::New(uwsgi_v8_commonjs_require)->GetFunction()); diff --git a/plugins/v8/v8_uwsgi.cc b/plugins/v8/v8_uwsgi.cc index da6546e8..2767d782 100644 --- a/plugins/v8/v8_uwsgi.cc +++ b/plugins/v8/v8_uwsgi.cc @@ -85,7 +85,7 @@ static v8::Handle uwsgi_v8_api_register_rpc(const v8::Arguments& args uvrt->func[core_id] = func; // we can safely call register_rpc here as it will check for already registered funcs - if (uwsgi_register_rpc(*name, v8_plugin.modifier1, j_argc, uvrt)) { + if (uwsgi_register_rpc(*name, &v8_plugin, j_argc, uvrt)) { uwsgi_log("[uwsgi-v8] unable to register RPC function \"%s\"\n", *name); return v8::Undefined(); } @@ -179,6 +179,7 @@ extern "C" int uwsgi_v8_init(){ pthread_key_create(&uv8.current_core, NULL); pthread_setspecific(uv8.current_core, (void *) 0); + uv8.contexts[0] = uwsgi_v8_new_isolate(0); return 0; diff --git a/uwsgi.h b/uwsgi.h index fdba3048..20124ccd 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -2315,8 +2315,8 @@ struct uwsgi_rpc { char name[UMAX8]; void *func; uint8_t args; - uint8_t modifier1; uint8_t shared; + struct uwsgi_plugin *plugin; }; struct uwsgi_signal_entry { @@ -2791,7 +2791,7 @@ void uwsgi_route_signal(uint8_t); int uwsgi_start(void *); -int uwsgi_register_rpc(char *, uint8_t, uint8_t, void *); +int uwsgi_register_rpc(char *, struct uwsgi_plugin *, uint8_t, void *); uint16_t uwsgi_rpc(char *, uint8_t, char **, uint16_t *, char *); char *uwsgi_do_rpc(char *, char *, uint8_t, char **, uint16_t *, uint16_t *); void uwsgi_rpc_init(void);