added --hook-as-emperor-before-vassal and --hook-as-vassal-before-drop

This commit is contained in:
Unbit
2014-08-11 07:38:04 +02:00
parent 2210f907db
commit cb302fc05d
3 changed files with 10 additions and 1 deletions
+5 -1
View File
@@ -1226,8 +1226,10 @@ int uwsgi_emperor_vassal_start(struct uwsgi_instance *n_ui) {
uwsgi.emperor_broodlord_num++;
}
// TODO pre-start hook
if (uwsgi_hooks_run_and_return(uwsgi.hook_as_emperor_before_vassal, "as-emperor-before-vassal", NULL, 0)) {
emperor_del(n_ui);
}
// check for fork server
char *fork_server = uwsgi.emperor_use_fork_server;
@@ -1371,6 +1373,8 @@ static void uwsgi_emperor_spawn_vassal(struct uwsgi_instance *n_ui) {
}
#endif
uwsgi_hooks_run(uwsgi.hook_as_vassal_before_drop, "as-vassal-before-drop", 1);
#ifdef UWSGI_CAP
#if defined(CAP_LAST_CAP) && defined(PR_CAPBSET_READ) && defined(PR_CAPBSET_DROP)
if (uwsgi.emperor_cap && uwsgi.emperor_cap_count > 0) {
+3
View File
@@ -422,6 +422,9 @@ static struct uwsgi_option uwsgi_base_options[] = {
{"hook-as-on-demand-vassal", required_argument, 0, "run the specified hook whenever a vassal enters on-demand mode", uwsgi_opt_add_string_list, &uwsgi.hook_as_on_demand_vassal, 0},
{"hook-as-emperor-before-vassal", required_argument, 0, "run the specified hook before the new vassal is spawned", uwsgi_opt_add_string_list, &uwsgi.hook_as_emperor_before_vassal, 0},
{"hook-as-vassal-before-drop", required_argument, 0, "run the specified hook into vassal, before dropping its privileges", uwsgi_opt_add_string_list, &uwsgi.hook_as_vassal_before_drop, 0},
{"hook-as-mule", required_argument, 0, "run the specified hook in each mule", uwsgi_opt_add_string_list, &uwsgi.hook_as_mule, 0},
{"hook-as-gateway", required_argument, 0, "run the specified hook in each gateway", uwsgi_opt_add_string_list, &uwsgi.hook_as_gateway, 0},
+2
View File
@@ -2741,6 +2741,8 @@ struct uwsgi_server {
char *emperor_chdir_attr;
struct uwsgi_string_list *subscription_algos;
int subscription_mountpoints;
struct uwsgi_string_list *hook_as_emperor_before_vassal;
struct uwsgi_string_list *hook_as_vassal_before_drop;
};
struct uwsgi_rpc {