summaryrefslogtreecommitdiff
path: root/source4/smbd/server.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-07-13 21:04:56 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:57:35 -0500
commit45a85bdd353418828df8017a9d7eb7c14f6f0cd3 (patch)
tree14ec6ac1262f9a0a1974b6725a7f26afddb38f61 /source4/smbd/server.c
parent9b4ac4d81ecf9786d2a3f96914af4a2895046676 (diff)
downloadsamba-45a85bdd353418828df8017a9d7eb7c14f6f0cd3.tar.gz
samba-45a85bdd353418828df8017a9d7eb7c14f6f0cd3.tar.bz2
samba-45a85bdd353418828df8017a9d7eb7c14f6f0cd3.zip
r1486: commit the start of the generic server infastructure
the idea is to have services as modules (smb, dcerpc, swat, ...) the process_model don't know about the service it self anymore. TODO: - the smbsrv should use the smbsrv_send function - the service subsystem init should be done like for other modules - we need to have a generic socket subsystem, which handle stream, datagram, and virtuell other sockets( e.g. for the ntvfs_ipc module to connect to the dcerpc server , or for smb or dcerpc or whatever to connect to a server wide auth service) - and other fixes... NOTE: process model pthread seems to be broken( but also before this patch!) metze (This used to be commit bbe5e00715ca4013ff0dbc345aa97adc6b5c2458)
Diffstat (limited to 'source4/smbd/server.c')
-rw-r--r--source4/smbd/server.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/source4/smbd/server.c b/source4/smbd/server.c
index 3a579b846a..e748795177 100644
--- a/source4/smbd/server.c
+++ b/source4/smbd/server.c
@@ -23,10 +23,16 @@
#include "includes.h"
+static void exit_server(const char *reason)
+{
+ DEBUG(3,("Server exit (%s)\n", (reason ? reason : "")));
+ exit(0);
+}
+
/****************************************************************************
- main program.
+ main server.
****************************************************************************/
- int main(int argc,const char *argv[])
+static int binary_smbd_main(int argc,const char *argv[])
{
BOOL is_daemon = False;
BOOL interactive = False;
@@ -34,7 +40,7 @@
BOOL log_stdout = False;
int opt;
poptContext pc;
- struct event_context *events;
+ struct server_context *srv_ctx;
const char *model = "standard";
struct poptOption long_options[] = {
POPT_AUTOHELP
@@ -42,7 +48,6 @@
{"interactive", 'i', POPT_ARG_VAL, &interactive, True, "Run interactive (not a daemon)"},
{"foreground", 'F', POPT_ARG_VAL, &Fork, False, "Run daemon in foreground (for daemontools & etc)" },
{"log-stdout", 'S', POPT_ARG_VAL, &log_stdout, True, "Log to stdout" },
- {"build-options", 'b', POPT_ARG_NONE, NULL, 'b', "Print build options" },
{"port", 'p', POPT_ARG_STRING, NULL, 0, "Listen on the specified ports"},
{"model", 'M', POPT_ARG_STRING, &model, 0, "select process model"},
POPT_COMMON_SAMBA
@@ -53,11 +58,6 @@
while((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) {
- case 'b':
- /* Display output to screen as well as debug */
- build_options(True);
- exit(0);
- break;
case 'p':
lp_set_cmdline("smb ports", poptGetOptArg(pc));
break;
@@ -65,8 +65,6 @@
}
poptFreeContext(pc);
- events = event_context_init();
-
load_case_tables();
if (interactive) {
@@ -110,15 +108,11 @@
DEBUG(0,("smbd version %s started.\n", SAMBA_VERSION_STRING));
DEBUGADD(0,("Copyright Andrew Tridgell and the Samba Team 1992-2004\n"));
- /* Output the build options to the debug log */
- build_options(False);
-
- if (sizeof(uint16_t) < 2 || sizeof(uint32_t) < 4) {
+ 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"));
exit(1);
}
- DEBUG(0,("Using %s process model\n", model));
-
+
if (!reload_services(NULL, False))
return(-1);
@@ -149,8 +143,18 @@
init_subsystems();
- process_model_startup(events, model);
+ DEBUG(0,("Using %s process model\n", model));
+ srv_ctx = server_service_startup(model);
+ if (!srv_ctx) {
+ DEBUG(0,("Starting Services failed.\n"));
+ return 1;
+ }
/* wait for events */
- return event_loop_wait(events);
+ return event_loop_wait(srv_ctx->events);
+}
+
+ int main(int argc, const char *argv[])
+{
+ return binary_smbd_main(argc, argv);
}