s4:lib/tevent: rename structs
[kamenim/samba.git] / source4 / smbd / server.c
index e1ebd133ce19ebd3c0ea59ad72f9a20649b14b08..c1683a48dcf77eca25bc89ca63ab2043c358dad2 100644 (file)
@@ -37,7 +37,6 @@
 #include "smbd/service.h"
 #include "param/secrets.h"
 #include "smbd/pidfile.h"
-#include "cluster/ctdb/ctdb_cluster.h"
 #include "param/param.h"
 
 /*
@@ -149,7 +148,7 @@ static void setup_signals(void)
 /*
   handle io on stdin
 */
-static void server_stdin_handler(struct event_context *event_ctx, struct fd_event *fde, 
+static void server_stdin_handler(struct tevent_context *event_ctx, struct tevent_fd *fde, 
                                 uint16_t flags, void *private)
 {
        const char *binary_name = (const char *)private;
@@ -168,8 +167,8 @@ static void server_stdin_handler(struct event_context *event_ctx, struct fd_even
 /*
   die if the user selected maximum runtime is exceeded
 */
-_NORETURN_ static void max_runtime_handler(struct event_context *ev, 
-                                          struct timed_event *te, 
+_NORETURN_ static void max_runtime_handler(struct tevent_context *ev, 
+                                          struct tevent_timer *te, 
                                           struct timeval t, void *private)
 {
        const char *binary_name = (const char *)private;
@@ -198,9 +197,12 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[
        extern NTSTATUS server_service_smb_init(void);
        extern NTSTATUS server_service_drepl_init(void);
        extern NTSTATUS server_service_rpc_init(void);
-       init_module_fn static_init[] = { STATIC_smbd_MODULES };
+       extern NTSTATUS server_service_ntp_signd_init(void);
+       extern NTSTATUS server_service_samba3_smb_init(void);
+       init_module_fn static_init[] = { STATIC_service_MODULES };
        init_module_fn *shared_init;
-       struct event_context *event_ctx;
+       struct tevent_context *event_ctx;
+       uint16_t stdin_event_flags;
        NTSTATUS status;
        const char *model = "standard";
        int max_runtime = 0;
@@ -312,26 +314,28 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[
        
        /* the event context is the top level structure in smbd. Everything else
           should hang off that */
-       event_ctx = event_context_init(talloc_autofree_context());
+       event_ctx = s4_event_context_init(talloc_autofree_context());
 
        if (event_ctx == NULL) {
                DEBUG(0,("Initializing event context failed\n"));
                return 1;
        }
 
-       /* initialise clustering if needed */
-       cluster_ctdb_init(cmdline_lp_ctx, event_ctx, model);
-
        if (opt_interactive) {
-               /* catch EOF on stdin */
-#ifdef SIGTTIN
-               signal(SIGTTIN, SIG_IGN);
-#endif
-               event_add_fd(event_ctx, event_ctx, 0, EVENT_FD_READ, 
-                            server_stdin_handler,
-                            discard_const(binary_name));
+               /* terminate when stdin goes away */
+               stdin_event_flags = EVENT_FD_READ;
+       } else {
+               /* stay alive forever */
+               stdin_event_flags = 0;
        }
 
+       /* catch EOF on stdin */
+#ifdef SIGTTIN
+       signal(SIGTTIN, SIG_IGN);
+#endif
+       event_add_fd(event_ctx, event_ctx, 0, stdin_event_flags,
+                    server_stdin_handler,
+                    discard_const(binary_name));
 
        if (max_runtime) {
                event_add_timed(event_ctx, event_ctx,