From: Gary Lockyer Date: Thu, 19 Oct 2017 02:15:33 +0000 (+1300) Subject: process_standard: Honour proc_ctx->inhibit_fork_on_accept X-Git-Tag: tevent-0.9.34~176 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=62d7bf9e0ae94baaaa090051bd6b7cb40e5ef3c3;p=thirdparty%2Fsamba.git process_standard: Honour proc_ctx->inhibit_fork_on_accept This allows the service to control if it should fork per accept() without needing to replace the whole process model with process_single. Signed-off-by: Andrew Bartlett Reviewed-by: Garming Sam --- diff --git a/source4/smbd/process_standard.c b/source4/smbd/process_standard.c index f5922c8d91c..a17a1ec3b06 100644 --- a/source4/smbd/process_standard.c +++ b/source4/smbd/process_standard.c @@ -263,6 +263,21 @@ static void standard_accept_connection( proc_ctx = talloc_get_type_abort(process_context, struct process_context); + if (proc_ctx->inhibit_fork_on_accept) { + pid = getpid(); + /* + * Service does not support forking a new process on a + * new connection, either it's maintaining shared + * state or the overhead of forking a new process is a + * significant fraction of the response time. + */ + talloc_steal(private_data, sock2); + new_conn(ev, lp_ctx, sock2, + cluster_id(pid, socket_get_fd(sock2)), private_data, + process_context); + return; + } + state = setup_standard_child_pipe(ev, NULL); if (state == NULL) { return;