------------------------------------------------------------ revno: 339 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell <[EMAIL PROTECTED]> branch nick: tridge timestamp: Thu 2007-05-24 14:52:10 +1000 message: make ctdbd realtime if possible modified: common/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1 common/ctdb_util.c ctdb_util.c-20061128065342-to93h6eejj5kon81-3 configure.ac configure.ac-20061117234101-o3qt14umlg9en8z0-10 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 === modified file 'common/ctdb_daemon.c' --- a/common/ctdb_daemon.c 2007-05-23 10:15:09 +0000 +++ b/common/ctdb_daemon.c 2007-05-24 04:52:10 +0000 @@ -738,6 +738,9 @@ block_signal(SIGPIPE); block_signal(SIGCHLD); + /* try to set us up as realtime */ + ctdb_set_realtime(); + /* start the recovery daemon process */ if (ctdb_start_recoverd(ctdb) != 0) { DEBUG(0,("Failed to start recovery daemon\n"));
=== modified file 'common/ctdb_util.c' --- a/common/ctdb_util.c 2007-05-23 10:15:09 +0000 +++ b/common/ctdb_util.c 2007-05-24 04:52:10 +0000 @@ -194,3 +194,23 @@ return d; } +#if HAVE_SCHED_H +#include <sched.h> +#endif + +/* + if possible, make this task real time + */ +void ctdb_set_realtime(void) +{ +#if HAVE_SCHED_SETSCHEDULER + struct sched_param p; + p.__sched_priority = 1; + + if (sched_setscheduler(getpid(), SCHED_FIFO, &p) == -1) { + DEBUG(0,("Unable to set scheduler to SCHED_FIFO (%s)\n", strerror(errno))); + } else { + DEBUG(0,("Set scheduler to SCHED_FIFO\n")); + } +#endif +} === modified file 'configure.ac' --- a/configure.ac 2007-05-14 23:42:52 +0000 +++ b/configure.ac 2007-05-24 04:52:10 +0000 @@ -30,6 +30,9 @@ m4_include(libevents.m4) m4_include(ib/config.m4) +AC_CHECK_HEADERS(sched.h) +AC_CHECK_FUNCS(sched_setscheduler) + AC_CACHE_CHECK([for sin_len in sock],ctdb_cv_HAVE_SOCK_SIN_LEN,[ AC_TRY_COMPILE([#include <sys/types.h> #include <sys/socket.h> === modified file 'include/ctdb_private.h' --- a/include/ctdb_private.h 2007-05-23 07:21:14 +0000 +++ b/include/ctdb_private.h 2007-05-24 04:52:10 +0000 @@ -864,5 +864,6 @@ uint32_t destnode, uint32_t db_id, uint64_t rsn); int ctdb_ctrl_delete_low_rsn(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t db_id, uint64_t rsn); +void ctdb_set_realtime(void); #endif