proc-usage : make runtime resourced directory after initialized 80/163980/1 accepted/tizen/4.0/unified/20180112.071758 submit/tizen_4.0/20180111.111014 tizen_4.0.IoT.p2_release
authorKichan Kwon <k_c.kwon@samsung.com>
Thu, 14 Dec 2017 10:47:12 +0000 (19:47 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Thu, 14 Dec 2017 10:49:11 +0000 (19:49 +0900)
- Refer the comment about RUNTIME_RESOURCED_DIR for details

Change-Id: I553dffac98579147feb3d885b2344fdef3a80294
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
src/proc-usage/proc-usage.c
src/proc-usage/proc-usage.h

index 4954bce5685258262bec9f127e230c0acc8edf7b..2fa8cc613e2b0772ee722155d7af603e1f96c38d 100644 (file)
@@ -18,6 +18,8 @@
 
 #include <gio/gio.h>
 #include <glib.h>
+#include <sys/stat.h>
+#include <sys/types.h>
 
 #include <event.h>
 #include <log.h>
@@ -77,6 +79,12 @@ static int __INIT__ proc_usage_init(void)
                return ret;
        }
 
+       ret = mkdir(RUNTIME_RESOURCED_DIR, S_IRWXU | S_IRGRP | S_IXGRP);
+       if (ret < 0 && errno != EEXIST) {
+               _E("Failed to create directory %s: %m", RUNTIME_RESOURCED_DIR);
+               return ret;
+       }
+
        return 0;
 }
 
index 6c76efae0409c028849384302a740e1b699f53c1..5ffcc64aacb1fd9cf3bb55d144ac6966732bad6c 100644 (file)
 #include <gio/gio.h>
 #include <glib.h>
 
+/**
+ * @brief  Runtime resourced directory
+ * @details  This directory is used for headed resourced to store app information.
+ *           In current, resourced-headless doesn't store app information, but
+ *           runtime-info tests check whether resourced is activated or not
+ *           by the existance of this directory.
+ *           To tell we provide per-process(app) information, resourced-headless
+ *           will make this directory after proc-usage module is initialized.
+ */
+#define RUNTIME_RESOURCED_DIR  "/run/resourced"
+
 /**
  * @brief  Local event for proc-usage module
  */