summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authortodd stecher <todd.stecher@gmail.com>2009-02-17 16:16:35 -0800
committerSteven Danneman <steven.danneman@isilon.com>2009-02-18 18:08:32 -0800
commitc441f58dedc465f59060296815a0bc7f9aeb743f (patch)
treef6443ed770146ba26e9c09370c1a9bddc22252fe /source3/smbd
parentcdcd525a05ce851dcb338dfa8c9be3009194aa96 (diff)
downloadsamba-c441f58dedc465f59060296815a0bc7f9aeb743f.tar.gz
samba-c441f58dedc465f59060296815a0bc7f9aeb743f.tar.bz2
samba-c441f58dedc465f59060296815a0bc7f9aeb743f.zip
S3: Allow SMBD processes to survive in low memory condidtions
This commit adds a configure argument which allows for setting MADV_PROTECT in the madvise() API. With this enabled the kernel won't kill SMBD when it's running low on memory.
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/server.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 075e44d319..76dab96ad9 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -359,6 +359,10 @@ static void smbd_accept_connection(struct tevent_context *ev,
/* Child code ... */
am_parent = 0;
+#ifdef WITH_MADVISE_PROTECTED
+ madvise(NULL,0,MADV_PROTECT);
+#endif
+
/* Stop zombies, the parent explicitly handles
* them, counting worker smbds. */
CatchChild();
@@ -1127,6 +1131,9 @@ extern void build_options(bool screen);
if (is_daemon && !interactive) {
DEBUG( 3, ( "Becoming a daemon.\n" ) );
become_daemon(Fork, no_process_group);
+#ifdef WITH_MADVISE_PROTECTED
+ madvise(NULL,0,MADV_PROTECT);
+#endif
}
#if HAVE_SETPGID