From a976e36a7af75712ea91c26fe60835686b71befa Mon Sep 17 00:00:00 2001 From: Unbit Date: Fri, 24 Oct 2014 12:05:01 +0200 Subject: [PATCH] added --hook-post-fork --- core/uwsgi.c | 3 +++ uwsgi.h | 1 + 2 files changed, 4 insertions(+) diff --git a/core/uwsgi.c b/core/uwsgi.c index 4a074b96..32aca3fb 100644 --- a/core/uwsgi.c +++ b/core/uwsgi.c @@ -409,6 +409,7 @@ static struct uwsgi_option uwsgi_base_options[] = { {"hook-as-user-atexit", required_argument, 0, "run the specified hook before app exit and reload", uwsgi_opt_add_string_list, &uwsgi.hook_as_user_atexit, 0}, {"hook-pre-app", required_argument, 0, "run the specified hook before app loading", uwsgi_opt_add_string_list, &uwsgi.hook_pre_app, 0}, {"hook-post-app", required_argument, 0, "run the specified hook after app loading", uwsgi_opt_add_string_list, &uwsgi.hook_post_app, 0}, + {"hook-post-fork", required_argument, 0, "run the specified hook after each fork", uwsgi_opt_add_string_list, &uwsgi.hook_post_fork, 0}, {"hook-accepting", required_argument, 0, "run the specified hook after each worker enter the accepting phase", uwsgi_opt_add_string_list, &uwsgi.hook_accepting, 0}, {"hook-accepting1", required_argument, 0, "run the specified hook after the first worker enters the accepting phase", uwsgi_opt_add_string_list, &uwsgi.hook_accepting1, 0}, {"hook-accepting-once", required_argument, 0, "run the specified hook after each worker enter the accepting phase (once per-instance)", uwsgi_opt_add_string_list, &uwsgi.hook_accepting_once, 0}, @@ -3346,6 +3347,8 @@ int uwsgi_run() { } } + uwsgi_hooks_run(uwsgi.hook_post_fork, "post-fork", 1); + if (uwsgi.worker_exec2) { char *w_argv[2]; w_argv[0] = uwsgi.worker_exec2; diff --git a/uwsgi.h b/uwsgi.h index 8bb28639..410ecd12 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -2756,6 +2756,7 @@ struct uwsgi_server { int sslv3; struct uwsgi_string_list *ssl_options; #endif + struct uwsgi_string_list *hook_post_fork; // uWSGI 2.1 char *fork_socket;