Change-Id: Ib7c6bd5ce363a8079750e66943d287e86224e5c6
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
Name: stc-manager
Summary: STC(Smart Traffic Control) manager
Name: stc-manager
Summary: STC(Smart Traffic Control) manager
Release: 0
Group: Network & Connectivity/Other
License: Apache-2.0
Release: 0
Group: Network & Connectivity/Other
License: Apache-2.0
#include "helper-file.h"
#include "helper-net-cls.h"
#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;
#define CLASSID_FILE_NAME "net_cls.classid"
typedef GArray task_classid_array;
+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;
uint32_t get_classid_by_app_id(const char *app_id, int create)
{
int ret = 0;
typedef GArray int_array;
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
/**
* @desc take classid from net_cls cgroup by appid
static void __excn_hash_foreach_print(gpointer key, gpointer value,
gpointer data)
{
static void __excn_hash_foreach_print(gpointer key, gpointer value,
gpointer data)
{
process_name, exe_type);
}
process_name, exe_type);
}
static void __excn_hash_printall(void)
{
g_hash_table_foreach(g_system->excns_hash,
static void __excn_hash_printall(void)
{
g_hash_table_foreach(g_system->excns_hash,
ret_value_msg_if(system == NULL, STC_ERROR_OUT_OF_MEMORY, "stc_system_s malloc fail!");
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();
/* initializing cgroups */
cgroup_init();