summaryrefslogtreecommitdiff
path: root/source4/smbd/service_task.c
diff options
context:
space:
mode:
authorGary Lockyer <gary@catalyst.net.nz>2017-09-15 07:09:23 +1200
committerAndrew Bartlett <abartlet@samba.org>2017-10-19 05:33:09 +0200
commitb852ad044b98c0c574c3420956e153055d46136d (patch)
tree4246355fbade866ba399d3e6266b7572df953b09 /source4/smbd/service_task.c
parent6d7a8d80cdc9ee996ff503d8834037001cf233d9 (diff)
downloadsamba-b852ad044b98c0c574c3420956e153055d46136d.tar.gz
source4/smbd: refactor the process model for prefork
Refactor the process model code to allow the addition of a prefork process model. - Add a process context to contain process model specific state - Add a service details structure to allow service to indicate which process model options they can support. In the new code the services advertise the features they support to the process model. The process model context is plumbed through to allow the process model to keep track of the supported options, and any state the process model may require. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Diffstat (limited to 'source4/smbd/service_task.c')
-rw-r--r--source4/smbd/service_task.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/source4/smbd/service_task.c b/source4/smbd/service_task.c
index e0e98f644e1..1d33a43e919 100644
--- a/source4/smbd/service_task.c
+++ b/source4/smbd/service_task.c
@@ -50,8 +50,8 @@ void task_server_terminate(struct task_server *task, const char *reason, bool fa
imessaging_cleanup(task->msg_ctx);
- model_ops->terminate(event_ctx, task->lp_ctx, reason);
-
+ model_ops->terminate(event_ctx, task->lp_ctx, reason,
+ task->process_context);
/* don't free this above, it might contain the 'reason' being printed */
talloc_free(task);
}
@@ -67,9 +67,11 @@ struct task_state {
called by the process model code when the new task starts up. This then calls
the server specific startup code
*/
-static void task_server_callback(struct tevent_context *event_ctx,
+static void task_server_callback(struct tevent_context *event_ctx,
struct loadparm_context *lp_ctx,
- struct server_id server_id, void *private_data)
+ struct server_id server_id,
+ void *private_data,
+ void *context)
{
struct task_state *state = talloc_get_type(private_data, struct task_state);
struct task_server *task;
@@ -81,6 +83,7 @@ static void task_server_callback(struct tevent_context *event_ctx,
task->model_ops = state->model_ops;
task->server_id = server_id;
task->lp_ctx = lp_ctx;
+ task->process_context = context;
task->msg_ctx = imessaging_init(task,
task->lp_ctx,
@@ -97,11 +100,12 @@ static void task_server_callback(struct tevent_context *event_ctx,
/*
startup a task based server
*/
-NTSTATUS task_server_startup(struct tevent_context *event_ctx,
+NTSTATUS task_server_startup(struct tevent_context *event_ctx,
struct loadparm_context *lp_ctx,
- const char *service_name,
- const struct model_ops *model_ops,
+ const char *service_name,
+ const struct model_ops *model_ops,
void (*task_init)(struct task_server *),
+ const struct service_details *service_details,
int from_parent_fd)
{
struct task_state *state;
@@ -113,7 +117,7 @@ NTSTATUS task_server_startup(struct tevent_context *event_ctx,
state->model_ops = model_ops;
state->model_ops->new_task(event_ctx, lp_ctx, service_name,
- task_server_callback, state,
+ task_server_callback, state, service_details,
from_parent_fd);
return NT_STATUS_OK;