summaryrefslogtreecommitdiffstats
path: root/src/monitor
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2010-06-30 13:55:41 -0400
committerStephen Gallagher <sgallagh@redhat.com>2010-07-09 11:44:07 -0400
commitcab4c5011d0dc6d98e2115f46b1185a17804df49 (patch)
tree02532efe8caa98f12a6e1564a85f11bf60e27709 /src/monitor
parent09c170c5b5cf0d62e7302ef284a1e35072ef1d95 (diff)
downloadsssd-cab4c5011d0dc6d98e2115f46b1185a17804df49.tar.gz
sssd-cab4c5011d0dc6d98e2115f46b1185a17804df49.tar.xz
sssd-cab4c5011d0dc6d98e2115f46b1185a17804df49.zip
Add try_inotify option
There are some special cases where inotify cannot be used, even if the host OS claims that it is supported. In these cases, it should be possible to explicitly disable the use of inotify. https://fedorahosted.org/sssd/ticket/484
Diffstat (limited to 'src/monitor')
-rw-r--r--src/monitor/monitor.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index 41eadf52a..47832c95d 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -1632,6 +1632,7 @@ static int monitor_config_file(TALLOC_CTX *mem_ctx,
monitor_reconf_fn fn)
{
int ret, err;
+ bool use_inotify;
struct timeval tv;
struct stat file_stat;
struct config_file_callback *cb = NULL;
@@ -1650,8 +1651,24 @@ static int monitor_config_file(TALLOC_CTX *mem_ctx,
ctx->file_ctx->parent_ctx = mem_ctx;
ctx->file_ctx->mt_ctx = ctx;
}
- ret = try_inotify(ctx->file_ctx, file, fn);
+
+ ret = confdb_get_bool(ctx->cdb, ctx,
+ CONFDB_MONITOR_CONF_ENTRY,
+ CONFDB_MONITOR_TRY_INOTIFY,
+ true, &use_inotify);
if (ret != EOK) {
+ talloc_free(ctx->file_ctx);
+ return ret;
+ }
+
+ if (use_inotify) {
+ ret = try_inotify(ctx->file_ctx, file, fn);
+ if (ret != EOK) {
+ use_inotify = false;
+ }
+ }
+
+ if (!use_inotify) {
/* Could not monitor file with inotify, fall back to polling */
cb = talloc_zero(ctx->file_ctx, struct config_file_callback);
if (!cb) {