summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-06-12 00:17:23 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:59 -0500
commitea7942d468dc6de98ee20d16acf73c06b5c8b365 (patch)
treec42a6af2c2e7544dd5d4bb8f858e68f7583b36c0
parent39172de4dceb58884525a28d964e6c52f3d933e1 (diff)
downloadsamba-ea7942d468dc6de98ee20d16acf73c06b5c8b365.tar.gz
samba-ea7942d468dc6de98ee20d16acf73c06b5c8b365.tar.bz2
samba-ea7942d468dc6de98ee20d16acf73c06b5c8b365.zip
r7493: add a --maximum-runtime option to smbd. If this time is exceeeded then it exits.
This will be used in the build farm (This used to be commit 3cec5b3c8656efcb00df530071c2badca914126a)
-rw-r--r--source4/smbd/server.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source4/smbd/server.c b/source4/smbd/server.c
index c2646ff825..a08202baab 100644
--- a/source4/smbd/server.c
+++ b/source4/smbd/server.c
@@ -137,6 +137,18 @@ static void server_stdin_handler(struct event_context *event_ctx, struct fd_even
}
}
+
+/*
+ die if the user selected maximum runtime is exceeded
+*/
+static void max_runtime_handler(struct event_context *ev, struct timed_event *te,
+ struct timeval t, void *private)
+{
+ DEBUG(0,("smbd maximum runtime exceeded - terminating\n"));
+ exit(0);
+}
+
+
/*
main server.
*/
@@ -148,6 +160,7 @@ static int binary_smbd_main(int argc, const char *argv[])
struct event_context *event_ctx;
NTSTATUS status;
const char *model = "standard";
+ int max_runtime = 0;
struct poptOption long_options[] = {
POPT_AUTOHELP
POPT_COMMON_SAMBA
@@ -155,6 +168,8 @@ static int binary_smbd_main(int argc, const char *argv[])
"Run interactive (not a daemon)", NULL},
{"model", 'M', POPT_ARG_STRING, &model, True,
"Select process model", "MODEL"},
+ {"maximum-runtime", 0, POPT_ARG_INT, &max_runtime, True,
+ "set maximum time for smbd to live", "seconds"},
POPT_COMMON_VERSION
POPT_TABLEEND
};
@@ -222,6 +237,13 @@ static int binary_smbd_main(int argc, const char *argv[])
server_stdin_handler, NULL);
}
+
+ if (max_runtime) {
+ event_add_timed(event_ctx, event_ctx,
+ timeval_current_ofs(max_runtime, 0),
+ max_runtime_handler, NULL);
+ }
+
DEBUG(0,("Using %s process model\n", model));
status = server_service_startup(event_ctx, model, lp_server_services());
if (!NT_STATUS_IS_OK(status)) {