summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2016-06-30 08:51:10 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2016-06-30 08:51:10 +0200
commit01ee1627dc1e739932849b47a4c2cb5ff4145cb6 (patch)
tree7df235d2ec04ba2fcfea6d9f4d04407901f701a6 /config
parenteae71df1767de0b0b9e86b74d56f8bf1f71e6c0f (diff)
Add possibility to test if configsystem is ready.
Diffstat (limited to 'config')
-rw-r--r--config/src/vespa/config/common/CMakeLists.txt1
-rw-r--r--config/src/vespa/config/common/configsystem.cpp32
-rw-r--r--config/src/vespa/config/common/configsystem.h14
3 files changed, 47 insertions, 0 deletions
diff --git a/config/src/vespa/config/common/CMakeLists.txt b/config/src/vespa/config/common/CMakeLists.txt
index 81a81456906..ee654cc8eb6 100644
--- a/config/src/vespa/config/common/CMakeLists.txt
+++ b/config/src/vespa/config/common/CMakeLists.txt
@@ -10,6 +10,7 @@ vespa_add_library(config_common OBJECT
configholder.cpp
configcontext.cpp
configkey.cpp
+ configsytem.cpp
configvalue.cpp
trace.cpp
payload_converter.cpp
diff --git a/config/src/vespa/config/common/configsystem.cpp b/config/src/vespa/config/common/configsystem.cpp
new file mode 100644
index 00000000000..548c0c39bce
--- /dev/null
+++ b/config/src/vespa/config/common/configsystem.cpp
@@ -0,0 +1,32 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#include <vespa/fastos/fastos.h>
+#include "configsystem.h"
+#include <vespalib/stllike/string.h>
+#include <vespa/defaults.h>
+
+namespace config {
+
+namespace {
+
+vespalib::string CONFIG_PROXY_PID_FILE= vespa::Defaults::vespaHome() + vespalib::string("var/run/configproxy.pid");
+
+}
+
+bool ConfigSystem::isUp() const {
+ return isConfigProxyRunning();
+}
+
+bool ConfigSystem::isConfigProxyRunning() const {
+ struct stat fs;
+
+ int retval = stat(CONFIG_PROXY_PID_FILE, &fs);
+ if (retval == 0) {
+ if (S_ISREG(fs.st_mode)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+}
diff --git a/config/src/vespa/config/common/configsystem.h b/config/src/vespa/config/common/configsystem.h
new file mode 100644
index 00000000000..1f04f5eaee8
--- /dev/null
+++ b/config/src/vespa/config/common/configsystem.h
@@ -0,0 +1,14 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+#pragma once
+
+namespace config {
+
+class ConfigSystem {
+public:
+ bool isUp() const;
+private:
+ bool isConfigProxyRunning() const;
+};
+
+}
+