Signed-off-by: Angus Salkeld <[email protected]>
---
 configure.ac   |    6 ++++++
 exec/main.c    |   21 +++++++++++++++------
 man/corosync.8 |    7 +++++--
 3 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index 35e3cfb..e00edeb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -73,6 +73,12 @@ AC_CHECK_LIB([socket], [socket])
 AC_CHECK_LIB([nsl], [t_open])
 AC_CHECK_LIB([rt], [sched_getscheduler])
 PKG_CHECK_MODULES([LIBQB], [libqb])
+AC_CHECK_LIB([qb], [qb_log_thread_priority_set], \
+            have_qb_log_thread_priority_set="yes", \
+            have_qb_log_thread_priority_set="no")
+if test "x${have_qb_log_thread_priority_set}" = xyes; then
+       AC_DEFINE_UNQUOTED([HAVE_QB_LOG_THREAD_PRIORITY_SET], 1, [have 
qb_log_thread_priority_set])
+fi
 
 # Checks for header files.
 AC_FUNC_ALLOCA
diff --git a/exec/main.c b/exec/main.c
index 9b2c941..a822120 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -980,13 +980,19 @@ static void corosync_setscheduler (void)
                                global_sched_param.sched_priority);
 
                        global_sched_param.sched_priority = 0;
-                       logsys_thread_priority_set (SCHED_OTHER, NULL, 1);
+#ifdef HAVE_QB_LOG_THREAD_PRIORITY_SET
+                       qb_log_thread_priority_set (SCHED_OTHER, 0);
+#endif
                } else {
 
                        /*
                         * Turn on SCHED_RR in logsys system
                         */
-                       res = logsys_thread_priority_set (SCHED_RR, 
&global_sched_param, 10);
+#ifdef HAVE_QB_LOG_THREAD_PRIORITY_SET
+                       res = qb_log_thread_priority_set (SCHED_RR, 
sched_priority);
+#else
+                       res = -1;
+#endif
                        if (res == -1) {
                                log_printf (LOGSYS_LEVEL_ERROR,
                                            "Could not set logsys thread 
priority."
@@ -1238,9 +1244,9 @@ int main (int argc, char **argv, char **envp)
        /* default configuration
         */
        background = 1;
-       setprio = 1;
+       setprio = 0;
 
-       while ((ch = getopt (argc, argv, "fpv")) != EOF) {
+       while ((ch = getopt (argc, argv, "fprv")) != EOF) {
 
                switch (ch) {
                        case 'f':
@@ -1248,7 +1254,9 @@ int main (int argc, char **argv, char **envp)
                                logsys_config_mode_set (NULL, 
LOGSYS_MODE_OUTPUT_STDERR|LOGSYS_MODE_THREADED|LOGSYS_MODE_FORK);
                                break;
                        case 'p':
-                               setprio = 0;
+                               break;
+                       case 'r':
+                               setprio = 1;
                                break;
                        case 'v':
                                printf ("Corosync Cluster Engine, version 
'%s'\n", VERSION);
@@ -1260,7 +1268,8 @@ int main (int argc, char **argv, char **envp)
                                fprintf(stderr, \
                                        "usage:\n"\
                                        "        -f     : Start application in 
foreground.\n"\
-                                       "        -p     : Do not set process 
priority.    \n"\
+                                       "        -p     : Does nothing.    \n"\
+                                       "        -r     : Set round robin 
realtime scheduling \n"\
                                        "        -v     : Display version and 
SVN revision of Corosync and exit.\n");
                                return EXIT_FAILURE;
                }
diff --git a/man/corosync.8 b/man/corosync.8
index c45cc56..016c053 100644
--- a/man/corosync.8
+++ b/man/corosync.8
@@ -35,7 +35,7 @@
 .SH NAME
 corosync \- The Corosync Cluster Engine.
 .SH SYNOPSIS
-.B "corosync [\-f] [\-p] [\-v]"
+.B "corosync [\-f] [\-p] [\-r] [\-v]"
 .SH DESCRIPTION
 .B corosync
 Corosync provides clustering infracture such as membership, messaging and 
quorum.
@@ -45,7 +45,10 @@ Corosync provides clustering infracture such as membership, 
messaging and quorum
 Start application in foreground.
 .TP
 .B -p
-Do not set process priority.    
+Does nothing (was: "Do not set process priority" - this is now the default).
+.TP
+.B -r
+Set round robin realtime scheduling.
 .TP
 .B -v
 Display version and SVN revision of Corosync and exit.
-- 
1.7.6

_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to