summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2014-05-31 14:01:53 +1000
committerAmitay Isaacs <amitay@samba.org>2014-07-07 13:28:25 +0200
commit1be8564e553ce044426dbe7b3987edf514832940 (patch)
tree27bad94fc05a35e76b0464f84a0bbe5f282052e1
parenta283b9e43a602b9c72065336edbe8ad7c2499117 (diff)
downloadsamba-1be8564e553ce044426dbe7b3987edf514832940.tar.gz
samba-1be8564e553ce044426dbe7b3987edf514832940.tar.xz
samba-1be8564e553ce044426dbe7b3987edf514832940.zip
ctdb-common: Use SCHED_RESET_ON_FORK when setting SCHED_FIFO
This makes the scheduler reset code a no-op. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Mon Jul 7 13:28:25 CEST 2014 on sn-devel-104
-rw-r--r--ctdb/common/system_util.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ctdb/common/system_util.c b/ctdb/common/system_util.c
index 6a5f454f8f..fe0f403f48 100644
--- a/ctdb/common/system_util.c
+++ b/ctdb/common/system_util.c
@@ -59,10 +59,14 @@ void set_scheduler(void)
#else /* no AIX */
#if HAVE_SCHED_SETSCHEDULER
struct sched_param p;
+ int policy = SCHED_FIFO;
p.sched_priority = 1;
- if (sched_setscheduler(0, SCHED_FIFO, &p) == -1) {
+#ifdef SCHED_RESET_ON_FORK
+ policy |= SCHED_RESET_ON_FORK;
+#endif
+ if (sched_setscheduler(0, policy, &p) == -1) {
DEBUG(DEBUG_CRIT,("Unable to set scheduler to SCHED_FIFO (%s)\n",
strerror(errno)));
} else {
@@ -92,6 +96,7 @@ void reset_scheduler(void)
#endif
#else /* no AIX */
#if HAVE_SCHED_SETSCHEDULER
+#ifndef SCHED_RESET_ON_FORK
struct sched_param p;
p.sched_priority = 0;
@@ -100,6 +105,7 @@ void reset_scheduler(void)
}
#endif
#endif
+#endif
}
void set_nonblocking(int fd)