summaryrefslogtreecommitdiffstats
path: root/source4/smbd/server.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-01-14 01:32:56 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:08:49 -0500
commit9327ec51d11855ec0ceac3ce1f4e0a75c8b57081 (patch)
tree7f4427b4246b91b050c16e8dc5d1f0433eb7cc2d /source4/smbd/server.c
parentcfc10f2a83b7c6190742498f1027256215cd0b31 (diff)
downloadsamba-9327ec51d11855ec0ceac3ce1f4e0a75c8b57081.tar.gz
samba-9327ec51d11855ec0ceac3ce1f4e0a75c8b57081.tar.xz
samba-9327ec51d11855ec0ceac3ce1f4e0a75c8b57081.zip
r4728: split up server_services into:
- stream_socket services the smb, ldap and rpc service which sets up a srtam socket end then waits for connections and - task services which this you can create a seperate task that do something (this is also going through the process_model subsystem so with -M standard a new process for this created with -M thread a new thread ... I'll add datagram services later when we whave support for datagram sockets in lib/socket/ see the next commit as an example for service_task's metze (This used to be commit d5fa02746c6569b09b6e05785642da2fad3ba3e0)
Diffstat (limited to 'source4/smbd/server.c')
-rw-r--r--source4/smbd/server.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/source4/smbd/server.c b/source4/smbd/server.c
index 830d26fa7f9..369391bdbfa 100644
--- a/source4/smbd/server.c
+++ b/source4/smbd/server.c
@@ -24,12 +24,6 @@
#include "includes.h"
#include "lib/cmdline/popt_common.h"
-static void exit_server(const char *reason)
-{
- DEBUG(3,("Server exit (%s)\n", (reason ? reason : "")));
- exit(0);
-}
-
/****************************************************************************
main server.
****************************************************************************/
@@ -41,10 +35,10 @@ static int binary_smbd_main(int argc,const char *argv[])
BOOL log_stdout = False;
int opt;
poptContext pc;
- struct server_context *srv_ctx;
+ struct server_context *server;
const char *model = "standard";
struct poptOption long_options[] = {
- POPT_AUTOHELP
+ POPT_AUTOHELP
POPT_COMMON_SAMBA
{"daemon", 'D', POPT_ARG_VAL, &is_daemon, True, "Become a daemon (default)" , NULL },
{"interactive", 'i', POPT_ARG_VAL, &interactive, True, "Run interactive (not a daemon)", NULL},
@@ -52,6 +46,7 @@ static int binary_smbd_main(int argc,const char *argv[])
{"log-stdout", 'S', POPT_ARG_VAL, &log_stdout, True, "Log to stdout", NULL },
{"port", 'p', POPT_ARG_STRING, NULL, 0, "Listen on the specified ports", "PORTS"},
{"model", 'M', POPT_ARG_STRING, &model, True, "Select process model", "MODEL"},
+ POPT_COMMON_VERSION
POPT_TABLEEND
};
@@ -77,7 +72,7 @@ static int binary_smbd_main(int argc,const char *argv[])
}
setup_logging(argv[0], log_stdout?DEBUG_STDOUT:DEBUG_FILE);
- fault_setup((void (*)(void *))exit_server);
+ fault_setup(NULL);
/* we are never interested in SIGPIPE */
BlockSignals(True,SIGPIPE);
@@ -105,7 +100,7 @@ static int binary_smbd_main(int argc,const char *argv[])
reopen_logs();
DEBUG(0,("smbd version %s started.\n", SAMBA_VERSION_STRING));
- DEBUGADD(0,("Copyright Andrew Tridgell and the Samba Team 1992-2004\n"));
+ DEBUGADD(0,("Copyright Andrew Tridgell and the Samba Team 1992-2005\n"));
if (sizeof(uint16_t) < 2 || sizeof(uint32_t) < 4 || sizeof(uint64_t) < 8) {
DEBUG(0,("ERROR: Samba is not configured correctly for the word size on your machine\n"));
@@ -142,15 +137,21 @@ static int binary_smbd_main(int argc,const char *argv[])
init_subsystems();
+ smbd_process_init();
+
DEBUG(0,("Using %s process model\n", model));
- srv_ctx = server_service_startup(model);
- if (!srv_ctx) {
+ server = server_service_startup(model, lp_server_services());
+ if (!server) {
DEBUG(0,("Starting Services failed.\n"));
return 1;
}
/* wait for events */
- return event_loop_wait(srv_ctx->events);
+ event_loop_wait(server->event.ctx);
+
+ server_service_shutdown(server, "exit");
+
+ return 0;
}
int main(int argc, const char *argv[])