uint32_t classid = STC_RESERVED_CLASSID_MAX;
int ret = fread_uint(CUR_CLASSID_PATH, &classid);
if (ret < 0)
- STC_LOGI("Can not read current classid");
+ STC_LOGI("Can not read current classid"); //LCOV_EXCL_LINE
classid += 1;
ret = fwrite_uint(CUR_CLASSID_PATH, ++classid);
if (ret < 0)
- STC_LOGE("Can not write classid");
+ STC_LOGE("Can not write classid"); //LCOV_EXCL_LINE
return classid;
}
int ret = cgroup_read_node_uint32(buf, CLASSID_FILE_NAME, &classid);
if (ret < 0)
- STC_LOGE("Can't read classid from cgroup %s", buf);
+ STC_LOGE("Can't read classid from cgroup %s", buf); //LCOV_EXCL_LINE
return classid;
}
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;
+ STC_LOGE("Can not init current classid"); //LCOV_EXCL_LINE
+ return STC_ERROR_FAIL; //LCOV_EXCL_LINE
}
}
const char *path_to_net_cgroup_dir = NULL;
if (app_id == NULL) {
- STC_LOGE("app_id must be not empty");
- return STC_UNKNOWN_CLASSID;
+ STC_LOGE("app_id must be not empty"); //LCOV_EXCL_LINE
+ return STC_UNKNOWN_CLASSID; //LCOV_EXCL_LINE
}
if (!strcmp(app_id, STC_BACKGROUND_APP_ID))
/* just read */
if (!create)
- classid = __get_classid_from_cgroup(path_to_net_cgroup_dir,
+ classid = __get_classid_from_cgroup(path_to_net_cgroup_dir, //LCOV_EXCL_LINE
app_id);
if (classid != STC_UNKNOWN_CLASSID)
ret = __place_classid_to_cgroup(path_to_net_cgroup_dir,
(char *)app_id, &classid, NULL);
if (ret)
- goto handle_error;
+ goto handle_error; //LCOV_EXCL_LINE
return classid;
handle_error:
- STC_LOGE("error_code: [%d]", ret);
- return STC_UNKNOWN_CLASSID;
+ STC_LOGE("error_code: [%d]", ret); //LCOV_EXCL_LINE
+ return STC_UNKNOWN_CLASSID; //LCOV_EXCL_LINE
}
stc_error_e place_pids_to_net_cgroup(const int pid, const char *app_id)
snprintf(child_buf, sizeof(child_buf), PROC_TASK_CHILDREN, pid, pid);
if (app_id == NULL) {
- STC_LOGE("package name must be not empty");
- return STC_ERROR_INVALID_PARAMETER;
+ STC_LOGE("package name must be not empty"); //LCOV_EXCL_LINE
+ return STC_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
}
if (!strcmp(app_id, STC_BACKGROUND_APP_ID))
else if (strstr(app_id, STC_BACKGROUND_APP_SUFFIX))
path_to_net_cgroup_dir = BACKGROUND_CGROUP_NETWORK;
else
- path_to_net_cgroup_dir = FOREGROUND_CGROUP_NETWORK;
+ path_to_net_cgroup_dir = FOREGROUND_CGROUP_NETWORK; //LCOV_EXCL_LINE
if (access(child_buf, F_OK)) {
if (STC_DEBUG_LOG)
- STC_LOGD("%s of %s is not existed", child_buf, app_id);
+ STC_LOGD("%s of %s is not existed", child_buf, app_id); //LCOV_EXCL_LINE
return cgroup_write_pid(path_to_net_cgroup_dir, app_id, pid);
}
- return cgroup_write_pidtree(path_to_net_cgroup_dir, app_id, pid);
+ return cgroup_write_pidtree(path_to_net_cgroup_dir, app_id, pid); //LCOV_EXCL_LINE
}