/*
initialise the kdc task after a fork
*/
-static void kdc_post_fork(struct task_server *task)
+static void kdc_post_fork(struct task_server *task, struct process_details *pd)
{
struct kdc_server *kdc;
krb5_kdc_configuration *kdc_config = NULL;
struct tevent_context *ev2;
struct task_server *task = NULL;
+ struct process_details pd = initial_process_details;
t = tfork_create();
if (t == NULL) {
* The task does not support pre-fork
*/
if (task != NULL && service_details->post_fork != NULL) {
- service_details->post_fork(task);
+ service_details->post_fork(task, &pd);
}
tevent_loop_wait(ev);
TALLOC_FREE(ev);
"after fork");
}
tevent_fd_set_auto_close(fde);
+ pd.instances++;
} else {
/*
* tfork uses malloc
free(w);
TALLOC_FREE(ev);
- setproctitle("task[%s] pre-forked worker",
- service_name);
+ setproctitle("task[%s] pre-forked worker(%d)",
+ service_name,
+ pd.instances);
prefork_reload_after_fork();
setup_handlers(ev2, from_parent_fd);
if (service_details->post_fork != NULL) {
- service_details->post_fork(task);
+ service_details->post_fork(task, &pd);
}
tevent_loop_wait(ev2);
talloc_free(ev2);
*/
task = new_task(ev, lp_ctx, cluster_id(pid, taskid++), private_data, NULL);
if (task != NULL && service_details->post_fork != NULL) {
- service_details->post_fork(task);
+ struct process_details pd = initial_process_details;
+ service_details->post_fork(task, &pd);
}
}
* is forked in standard_accept_connection.
*/
if (task != NULL && service_details->post_fork != NULL) {
- service_details->post_fork(task);
+ struct process_details pd = initial_process_details;
+ service_details->post_fork(task, &pd);
}
#include "smbd/service_stream.h"
#include "smbd/service_task.h"
+struct process_details {
+ unsigned int instances;
+};
+
+static const struct process_details initial_process_details = {
+ .instances = 0
+};
+
struct service_details {
/*
* Prevent the standard process model from forking a new worker
* process is forked on a new connection. It is instead called
* immediately after the task_init.
*/
- void (*post_fork) (struct task_server *);
+ void (*post_fork) (struct task_server *, struct process_details *);
};
#include "smbd/service_proto.h"