proc_value_s *lookup;
if (proc_tree == NULL) {
- STC_LOGE("tree is null");
- return NULL;
+ STC_LOGE("tree is null"); //LCOV_EXCL_LINE
+ return NULL; //LCOV_EXCL_LINE
}
lookup = g_tree_lookup(proc_tree, key);
return lookup;
}
+//LCOV_EXCL_START
static gboolean __proc_tree_foreach_print(gpointer key, gpointer value,
gpointer data)
{
return FALSE;
}
+//LCOV_EXCL_STOP
static void __proc_tree_printall(void)
{
- g_tree_foreach(proc_tree, __proc_tree_foreach_print, NULL);
+ g_tree_foreach(proc_tree, __proc_tree_foreach_print, NULL); //LCOV_EXCL_LINE
}
static proc_value_s * __proc_tree_find_parent(proc_value_s *value)
} while (lookup);
if (STC_DEBUG_LOG) {
- if (parent != NULL)
- STC_LOGD("\033[0;35mPARENT\033[0;m: tgid[\033[1;33m%s\033[0;m] pid[%s] "
+ if (parent != NULL) //LCOV_EXCL_LINE
+ STC_LOGD("\033[0;35mPARENT\033[0;m: tgid[\033[1;33m%s\033[0;m] pid[%s] " //LCOV_EXCL_LINE
"ppid[\033[1;35m%s\033[0;m] cmdline[\033[0;34m%s\033[0;m] name[%s]",
parent->status[PROC_STATUS_TGID], parent->status[PROC_STATUS_PID],
parent->status[PROC_STATUS_PPID], parent->cmdline,
proc_value_s *parent;
if (proc_tree == NULL) {
- STC_LOGE("tree is null");
- return;
+ STC_LOGE("tree is null"); //LCOV_EXCL_LINE
+ return; //LCOV_EXCL_LINE
}
lookup = g_tree_lookup(proc_tree, key);
if (lookup) {
if (STC_DEBUG_LOG)
- STC_LOGD("LOOKUP: tgid[\033[1;33m%s\033[0;m] pid[%s] ppid[\033[1;35m%s\033[0;m] "
+ STC_LOGD("LOOKUP: tgid[\033[1;33m%s\033[0;m] pid[%s] ppid[\033[1;35m%s\033[0;m] " //LCOV_EXCL_LINE
"cmdline[\033[0;34m%s\033[0;m] name[%s]", lookup->status[PROC_STATUS_TGID],
lookup->status[PROC_STATUS_PID], lookup->status[PROC_STATUS_PPID],
lookup->cmdline, lookup->status[PROC_STATUS_NAME]);
static void __proc_tree_remove(const proc_key_s *key)
{
if (proc_tree == NULL) {
- STC_LOGE("tree is null");
- return;
+ STC_LOGE("tree is null"); //LCOV_EXCL_LINE
+ return; //LCOV_EXCL_LINE
}
stc_manager_app_status_changed(STC_CMD_SET_TERMINATED, key->pid, NULL,
g_tree_remove(proc_tree, key);
if (STC_DEBUG_LOG)
- __proc_tree_printall();
+ __proc_tree_printall(); //LCOV_EXCL_LINE
}
static gboolean __check_excn(char *cmdline)
GIOChannel *gio = NULL;
if (nl_connector_sock != -1 &&
- nl_connector_gsource_id != 0) {
- STC_LOGE("Socket is already open");
- __STC_LOG_FUNC_EXIT__;
- return;
+ nl_connector_gsource_id != 0) { //LCOV_EXCL_LINE
+ STC_LOGE("Socket is already open"); //LCOV_EXCL_LINE
+ __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
+ return; //LCOV_EXCL_LINE
}
if (nl_connector_sock != -1) {
- close(nl_connector_sock);
- nl_connector_sock = -1;
+ close(nl_connector_sock); //LCOV_EXCL_LINE
+ nl_connector_sock = -1; //LCOV_EXCL_LINE
}
if (nl_connector_gsource_id != 0) {
- g_source_remove(nl_connector_gsource_id);
- nl_connector_gsource_id = 0;
+ g_source_remove(nl_connector_gsource_id); //LCOV_EXCL_LINE
+ nl_connector_gsource_id = 0; //LCOV_EXCL_LINE
}
nl_connector_sock = create_netlink(NETLINK_CONNECTOR, CN_IDX_PROC);
if (nl_connector_sock == -1) {
- __STC_LOG_FUNC_EXIT__;
- return;
+ __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
+ return; //LCOV_EXCL_LINE
}
gio = g_io_channel_unix_new(nl_connector_sock);
static void __reopen_nl_connector_sock(void)
{
- __close_nl_connector_sock();
- __open_nl_connector_sock();
+ __close_nl_connector_sock(); //LCOV_EXCL_LINE
+ __open_nl_connector_sock(); //LCOV_EXCL_LINE
}
+//LCOV_EXCL_START
stc_error_e stc_manager_app_status_changed(stc_cmd_type_e cmd,
pid_t pid,
const gchar *app_id,
return ret;
}
+//LCOV_EXCL_STOP
static void __process_event_fork(int tgid, int pid)
{
if (__check_excn(cmdline)) {
if (STC_DEBUG_LOG)
- STC_LOGD("[%s] monitoring is excepted", cmdline);
+ STC_LOGD("[%s] monitoring is excepted", cmdline); //LCOV_EXCL_LINE
return;
}
key = MALLOC0(proc_key_s, 1);
if (key == NULL) {
- STC_LOGE("memory allocation failed");
- return;
+ STC_LOGE("memory allocation failed"); //LCOV_EXCL_LINE
+ return; //LCOV_EXCL_LINE
}
value = MALLOC0(proc_value_s, 1);
if (value == NULL) {
- STC_LOGE("memory allocation failed");
- FREE(key);
- return;
+ STC_LOGE("memory allocation failed"); //LCOV_EXCL_LINE
+ FREE(key); //LCOV_EXCL_LINE
+ return; //LCOV_EXCL_LINE
}
key->pid = tgid;
g_strlcpy(value->cmdline, cmdline, sizeof(value->cmdline));
if (STC_DEBUG_LOG) {
- STC_LOGD("\033[1;34mFORK\033[0;m: tgid[\033[1;33m%d\033[0;m] ppid=[\033[1;35m%s\033[0;m] "
+ STC_LOGD("\033[1;34mFORK\033[0;m: tgid[\033[1;33m%d\033[0;m] ppid=[\033[1;35m%s\033[0;m] " //LCOV_EXCL_LINE
"cmdline[\033[0;34m%s\033[0;m] pid[%d]", tgid, status[PROC_STATUS_PPID], cmdline, pid);
- STC_LOGD("STATUS: tgid[%s] pid[%s] ppid[%s] name[%s] state[%s] tracerpid[%s]",
+ STC_LOGD("STATUS: tgid[%s] pid[%s] ppid[%s] name[%s] state[%s] tracerpid[%s]", //LCOV_EXCL_LINE
status[PROC_STATUS_TGID], status[PROC_STATUS_PID], status[PROC_STATUS_PPID],
status[PROC_STATUS_NAME], status[PROC_STATUS_STATE], status[PROC_STATUS_TRACERPID]);
}
if (__check_excn(cmdline)) {
if (STC_DEBUG_LOG)
- STC_LOGD("[%s] monitoring is excepted", cmdline);
+ STC_LOGD("[%s] monitoring is excepted", cmdline); //LCOV_EXCL_LINE
return;
}
key = MALLOC0(proc_key_s, 1);
if (key == NULL) {
- STC_LOGE("memory allocation failed");
- return;
+ STC_LOGE("memory allocation failed"); //LCOV_EXCL_LINE
+ return; //LCOV_EXCL_LINE
}
value = MALLOC0(proc_value_s, 1);
if (value == NULL) {
- STC_LOGE("memory allocation failed");
- FREE(key);
- return;
+ STC_LOGE("memory allocation failed"); //LCOV_EXCL_LINE
+ FREE(key); //LCOV_EXCL_LINE
+ return; //LCOV_EXCL_LINE
}
key->pid = tgid;
g_strlcpy(value->cmdline, cmdline, sizeof(value->cmdline));
if (STC_DEBUG_LOG) {
- STC_LOGD("\033[1;32mEXEC\033[0;m: tgid[\033[1;33m%d\033[0;m] ppid=[\033[1;35m%s\033[0;m] "
+ STC_LOGD("\033[1;32mEXEC\033[0;m: tgid[\033[1;33m%d\033[0;m] ppid=[\033[1;35m%s\033[0;m] " //LCOV_EXCL_LINE
"cmdline[\033[0;34m%s\033[0;m] pid[%d]", tgid, status[PROC_STATUS_PPID], cmdline, pid);
- STC_LOGD("STATUS: tgid[%s] pid[%s] ppid[%s] name[%s] state[%s] tracerpid[%s]",
+ STC_LOGD("STATUS: tgid[%s] pid[%s] ppid[%s] name[%s] state[%s] tracerpid[%s]", //LCOV_EXCL_LINE
status[PROC_STATUS_TGID], status[PROC_STATUS_PID], status[PROC_STATUS_PPID],
status[PROC_STATUS_NAME], status[PROC_STATUS_STATE], status[PROC_STATUS_TRACERPID]);
}
return;
if (STC_DEBUG_LOG)
- STC_LOGD("\033[1;31mEXIT\033[0;m: tgid[\033[1;33m%d\033[0;m] "
+ STC_LOGD("\033[1;31mEXIT\033[0;m: tgid[\033[1;33m%d\033[0;m] " //LCOV_EXCL_LINE
"pid[%d] exitcode[\033[0;31m%d\033[0;m]", tgid, pid, exit_code);
__proc_tree_remove(&key);
(condition & G_IO_NVAL)) {
/* G_IO_ERR/G_IO_HUP/G_IO_NVAL received */
- STC_LOGE("Netlink Connector socket received G_IO event, closing"
+ STC_LOGE("Netlink Connector socket received G_IO event, closing" //LCOV_EXCL_LINE
" socket. G_IO_ERR [%d], G_IO_HUP [%d], G_IO_NVAL [%s]",
(condition & G_IO_ERR), (condition & G_IO_HUP),
(condition & G_IO_NVAL));
- __reopen_nl_connector_sock();
- __STC_LOG_FUNC_EXIT__;
- return FALSE;
+ __reopen_nl_connector_sock(); //LCOV_EXCL_LINE
+ __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
+ return FALSE; //LCOV_EXCL_LINE
}
memset(&msg, 0, sizeof(nl_connector_proc_event_s));
ret = read(sock, &msg, sizeof(nl_connector_proc_event_s));
if (ret == 0) {
- __STC_LOG_FUNC_EXIT__;
- return TRUE;
+ __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
+ return TRUE; //LCOV_EXCL_LINE
}
switch (msg.proc_ev.what) {
int sock = nl_connector_sock;
if (sock == -1) {
- __STC_LOG_FUNC_EXIT__;
- return -1;
+ __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
+ return -1; //LCOV_EXCL_LINE
}
memset(&msg, 0, sizeof(nl_connector_msg_s));
ret = send(sock, &msg, sizeof(nl_connector_msg_s), 0);
if (ret == -1) {
- STC_LOGE("Error sending netlink connector message");
- __STC_LOG_FUNC_EXIT__;
- return -1;
+ STC_LOGE("Error sending netlink connector message"); //LCOV_EXCL_LINE
+ __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
+ return -1; //LCOV_EXCL_LINE
}
__STC_LOG_FUNC_EXIT__;
int sock = nl_connector_sock;
if (sock == -1) {
- __STC_LOG_FUNC_EXIT__;
- return -1;
+ __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
+ return -1; //LCOV_EXCL_LINE
}
memset(&msg, 0, sizeof(nl_connector_msg_s));
ret = send(sock, &msg, sizeof(nl_connector_msg_s), 0);
if (ret == -1) {
- STC_LOGE("Error sending netlink connector message");
- __STC_LOG_FUNC_EXIT__;
- return -1;
+ STC_LOGE("Error sending netlink connector message"); //LCOV_EXCL_LINE
+ __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
+ return -1; //LCOV_EXCL_LINE
}
__STC_LOG_FUNC_EXIT__;
__STC_LOG_FUNC_ENTER__;
if (nl_connector_sock == -1) {
- STC_LOGE("socket already closed");
- return;
+ STC_LOGE("socket already closed"); //LCOV_EXCL_LINE
+ return; //LCOV_EXCL_LINE
}
__unsubscribe_proc_events();