common: add printing dlog 53/189253/3
authorByungSoo Kim <bs1770.kim@samsung.com>
Mon, 6 Aug 2018 06:04:54 +0000 (15:04 +0900)
committerLukasz Stelmach <l.stelmach@samsung.com>
Wed, 19 Sep 2018 12:56:35 +0000 (12:56 +0000)
support debugging infrasturcture by using dlog

Change-Id: I792105a1829f910ac8610419b44f184be0869021
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
Signed-off-by: Ɓukasz Stelmach <l.stelmach@samsung.com>
CMakeLists.txt [changed mode: 0755->0644]
include/common.h
packaging/argos_watchdog.spec
src/argos-systemd.c

old mode 100755 (executable)
new mode 100644 (file)
index 8ab0af1..ea66e12
@@ -14,7 +14,7 @@ SET(HEADERS
 
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
 
-SET(PKG_MODULES )
+SET(PKG_MODULES dlog)
 
 IF(LIBSYSTEMD STREQUAL on)
        SET(PKG_MODULES ${PKG_MODULES} libsystemd)
index c604da3..f7a7c5f 100644 (file)
 #define API __attribute__ ((visibility("default")))
 #endif
 
+#ifndef LOG_TAG
+#define LOG_TAG "ARGOS_WATCHDOG"
+#endif
+#include <dlog.h>
+
+#define _D(fmt, arg...) SLOGD(fmt, ##arg)
+#define _I(fmt, arg...) SLOGI(fmt, ##arg)
+#define _W(fmt, arg...) SLOGW(fmt, ##arg)
+#define _E(fmt, arg...) SLOGE(fmt, ##arg)
+
 int _aw_register(unsigned int timeout);
 int _aw_control(aw_op_e op, void *data);
 int _aw_notify(void);
index 690e62b..e5dc2c5 100644 (file)
@@ -11,6 +11,7 @@ Source1:    %{name}.manifest
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
 BuildRequires:  cmake
+BuildRequires: pkgconfig(dlog)
 %if %{?libsystemd} == on
 BuildRequires: pkgconfig(libsystemd)
 %endif
index 3afbb97..70e7168 100644 (file)
@@ -26,7 +26,13 @@ static unsigned int saved_timeout=0;
 /* https://github.com/systemd/systemd/commit/2787d83c2 */
 int systemd_change_watchdog_timeout(unsigned int timeout)
 {
-       return sd_notifyf(0, "WATCHDOG_USEC=%llu", (unsigned long long) timeout*SEC_TO_USEC);
+       int ret;
+
+       ret = sd_notifyf(0, "WATCHDOG_USEC=%llu", (unsigned long long) timeout*SEC_TO_USEC);
+       if (ret <= 0)
+               _E("sd notify failed ret=%d, timeout=%u", ret, timeout);
+
+       return ret;
 }
 
 int _aw_register(unsigned int timeout)