Changed cur classid path and initialize 20/151420/1
authorhyunuktak <hyunuk.tak@samsung.com>
Thu, 21 Sep 2017 01:30:02 +0000 (10:30 +0900)
committerhyunuktak <hyunuk.tak@samsung.com>
Thu, 21 Sep 2017 01:30:04 +0000 (10:30 +0900)
Change-Id: Ib7c6bd5ce363a8079750e66943d287e86224e5c6
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
packaging/stc-manager.spec
src/helper/helper-net-cls.c
src/helper/helper-net-cls.h
src/monitor/stc-monitor.c

index 7979283..4a256b3 100644 (file)
@@ -1,6 +1,6 @@
 Name:       stc-manager
 Summary:    STC(Smart Traffic Control) manager
-Version:    0.0.33
+Version:    0.0.34
 Release:    0
 Group:      Network & Connectivity/Other
 License:    Apache-2.0
index 0f2ae30..ef5e4b3 100755 (executable)
@@ -26,7 +26,7 @@
 #include "helper-file.h"
 #include "helper-net-cls.h"
 
-#define CUR_CLASSID_PATH "/tmp/cur_classid"
+#define CUR_CLASSID_PATH   "/var/lib/stc/cur_classid"
 #define CLASSID_FILE_NAME "net_cls.classid"
 
 typedef GArray task_classid_array;
@@ -85,6 +85,23 @@ static uint32_t __get_classid_from_cgroup(const char *cgroup,
        return classid;
 }
 
+stc_error_e init_current_classid(void)
+{
+       int ret = 0;
+       struct stat stat_buf;
+
+       if (stat(STC_CGROUP_NETWORK, &stat_buf) != 0) {
+               uint32_t classid = STC_RESERVED_CLASSID_MAX;
+               ret = fwrite_uint(CUR_CLASSID_PATH, classid);
+               if (ret < 0) {
+                       STC_LOGE("Can not init current classid");
+                       return STC_ERROR_FAIL;
+               }
+       }
+
+       return STC_ERROR_NONE;
+}
+
 uint32_t get_classid_by_app_id(const char *app_id, int create)
 {
        int ret = 0;
index 24cd993..d27a5b2 100755 (executable)
@@ -33,10 +33,7 @@ enum {
 
 typedef GArray int_array;
 
-/**
- * @desc Get appid from classid task table. At present it is package name.
- */
-char *get_app_id_by_pid(const pid_t pid);
+stc_error_e init_current_classid(void);
 
 /**
  * @desc take classid from net_cls cgroup by appid
index 734620b..fc7b7bb 100755 (executable)
@@ -1500,6 +1500,7 @@ static stc_error_e __process_update_background(void)
        return STC_ERROR_NONE;
 }
 
+#if 0
 static void __excn_hash_foreach_print(gpointer key, gpointer value,
                                          gpointer data)
 {
@@ -1510,7 +1511,6 @@ static void __excn_hash_foreach_print(gpointer key, gpointer value,
                process_name, exe_type);
 }
 
-#if 0
 static void __excn_hash_printall(void)
 {
        g_hash_table_foreach(g_system->excns_hash,
@@ -1573,6 +1573,9 @@ stc_error_e stc_monitor_init(void)
 
        ret_value_msg_if(system == NULL, STC_ERROR_OUT_OF_MEMORY, "stc_system_s malloc fail!");
 
+       /* initializing current classid */
+       init_current_classid();
+
        /* initializing cgroups */
        cgroup_init();