summaryrefslogtreecommitdiff
path: root/src/kpi
diff options
context:
space:
mode:
authorAmber Bhardwaj <amber.bhardwaj10@gmail.com>2017-06-16 11:08:42 +0530
committerChristoph Lipka <clipka@users.noreply.github.com>2017-06-16 07:38:42 +0200
commitcf65615d35b7c0d3cae3239c53374d841d9a175d (patch)
tree16693b958e879a36c737cb50f13fa5b3ae8e7ce2 /src/kpi
parentb91b38534e5276db69ffbf938177c227b01c65ad (diff)
downloadDLT-daemon-cf65615d35b7c0d3cae3239c53374d841d9a175d.tar.gz
Input parameter check & Error message modification (#15)
* Update dlt-kpi-process.c Added input param checking and added return value in non-void functions. * Update dlt-kpi.c Added Input param checking and added return values in non-void functions. * Input parameter check and Error msg modification Added null pointer checking Added input parameter checking Added return values in non-void functions Added proper error message for debugging purpose Signed-off-by: amberbhardwaj <amber.bhardwaj10@gmail.com>
Diffstat (limited to 'src/kpi')
-rw-r--r--src/kpi/dlt-kpi-common.c10
-rw-r--r--src/kpi/dlt-kpi-interrupt.c18
-rw-r--r--src/kpi/dlt-kpi-options.c14
-rw-r--r--src/kpi/dlt-kpi-process-list.c30
-rw-r--r--src/kpi/dlt-kpi-process.c57
-rw-r--r--src/kpi/dlt-kpi.c16
6 files changed, 83 insertions, 62 deletions
diff --git a/src/kpi/dlt-kpi-common.c b/src/kpi/dlt-kpi-common.c
index 26c4e28..fa131dc 100644
--- a/src/kpi/dlt-kpi-common.c
+++ b/src/kpi/dlt-kpi-common.c
@@ -30,7 +30,13 @@ static int dlt_kpi_cpu_count = -1;
DltReturnValue dlt_kpi_read_file_compact(char *filename, char **target)
{
- char buffer[BUFFER_SIZE];
+ if(filename == NULL || target == NULL)
+ {
+ fprintf(stderr, "%s: Nullpointer parameter!\n",__func__);
+ return DLT_RETURN_WRONG_PARAMETER;
+ }
+
+ char buffer[BUFFER_SIZE];
int ret = dlt_kpi_read_file(filename, buffer, BUFFER_SIZE);
if(ret < DLT_RETURN_OK)
return ret;
@@ -50,7 +56,7 @@ DltReturnValue dlt_kpi_read_file(char* filename, char* buffer, uint maxLength)
{
if(filename == NULL || buffer == NULL)
{
- fprintf(stderr, "Nullpointer parameter!\n");
+ fprintf(stderr, "%s: Nullpointer parameter!\n",__func__);
return DLT_RETURN_WRONG_PARAMETER;
}
diff --git a/src/kpi/dlt-kpi-interrupt.c b/src/kpi/dlt-kpi-interrupt.c
index c193b70..b8e4e80 100644
--- a/src/kpi/dlt-kpi-interrupt.c
+++ b/src/kpi/dlt-kpi-interrupt.c
@@ -30,7 +30,7 @@ DltReturnValue dlt_kpi_log_interrupts(DltContext *ctx, DltLogLevelType log_level
{
if(ctx == NULL)
{
- fprintf(stderr, "dlt_kpi_log_interrupts(): Nullpointer parameter\n");
+ fprintf(stderr, "%s: Nullpointer parameter (NULL) !\n",__func__);
return DLT_RETURN_WRONG_PARAMETER;
}
@@ -53,7 +53,7 @@ DltReturnValue dlt_kpi_log_interrupts(DltContext *ctx, DltLogLevelType log_level
cpu_count++;
else if(cpu_count <= 0)
{
- fprintf(stderr, "dlt_kpi_log_interrupts: Could not parse CPU count\n");
+ fprintf(stderr, "%s: Could not parse CPU count !\n",__func__);
return DLT_RETURN_ERROR;
}
else if(strcmp(token, "\n") == 0)
@@ -83,7 +83,7 @@ DltReturnValue dlt_kpi_log_interrupts(DltContext *ctx, DltLogLevelType log_level
long int interrupt_count = strtol(token, &check, 10);
if(*check != '\0')
{
- fprintf(stderr, "dlt_kpi_log_interrupts: Could not parse interrupt count for CPU %d\n", column - 1);
+ fprintf(stderr, "%s: Could not parse interrupt count for CPU !\n",__func__);
return DLT_RETURN_ERROR;
}
@@ -102,13 +102,13 @@ DltReturnValue dlt_kpi_log_interrupts(DltContext *ctx, DltLogLevelType log_level
DltContextData ctx_data;
if((ret = dlt_user_log_write_start(ctx, &ctx_data, log_level)) < DLT_RETURN_OK)
{
- fprintf(stderr, "dlt_kpi_log_interrupts(): dlt_user_log_write_start() returned error\n");
+ fprintf(stderr, "%s: dlt_user_log_write_start() returned error\n", __func__);
return ret;
}
if((ret = dlt_user_log_write_string(&ctx_data, "IRQ")) < DLT_RETURN_OK)
{
- fprintf(stderr, "dlt_kpi_log_interrupts(): dlt_user_log_write_string() returned error\n");
+ fprintf(stderr, "%s: dlt_user_log_write_string() returned error\n", __func__);
return ret;
}
@@ -120,19 +120,19 @@ DltReturnValue dlt_kpi_log_interrupts(DltContext *ctx, DltLogLevelType log_level
/* message buffer full, start new one */
if((ret = dlt_user_log_write_finish(&ctx_data)) < DLT_RETURN_OK)
{
- fprintf(stderr, "dlt_kpi_log_interrupts(): dlt_user_log_write_finish() returned error\n");
+ fprintf(stderr, "%s: dlt_user_log_write_finish() returned error\n", __func__);
return ret;
}
if((ret = dlt_user_log_write_start(ctx, &ctx_data, log_level)) < DLT_RETURN_OK)
{
- fprintf(stderr, "dlt_kpi_log_interrupts(): dlt_user_log_write_start() returned error\n");
+ fprintf(stderr, "%s: dlt_user_log_write_start() returned error\n", __func__);
return ret;
}
if((ret = dlt_user_log_write_string(&ctx_data, "IRQ")) < DLT_RETURN_OK)
{
- fprintf(stderr, "dlt_kpi_log_interrupts(): dlt_user_log_write_string() returned error\n");
+ fprintf(stderr, "%s: dlt_user_log_write_string() returned error\n", __func__);
return ret;
}
}
@@ -142,7 +142,7 @@ DltReturnValue dlt_kpi_log_interrupts(DltContext *ctx, DltLogLevelType log_level
if((ret = dlt_user_log_write_finish(&ctx_data)) < DLT_RETURN_OK)
{
- fprintf(stderr, "dlt_kpi_log_interrupts(): dlt_user_log_write_finish() returned error\n");
+ fprintf(stderr, "%s: dlt_user_log_write_finish() returned error\n", __func__);
return ret;
}
diff --git a/src/kpi/dlt-kpi-options.c b/src/kpi/dlt-kpi-options.c
index dda36dc..ea15961 100644
--- a/src/kpi/dlt-kpi-options.c
+++ b/src/kpi/dlt-kpi-options.c
@@ -63,7 +63,7 @@ DltReturnValue dlt_kpi_read_command_line(DltKpiOptions *options, int argc, char
{
if(options == NULL)
{
- fprintf(stderr, "dlt_kpi_read_command_line(): Nullpointer parameter\n");
+ fprintf(stderr, "%s: Nullpointer parameter\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
dlt_kpi_init_cli_options(options);
@@ -122,7 +122,7 @@ DltReturnValue dlt_kpi_read_configuration_file(DltKpiConfig *config, char *file_
if(config == NULL || file_name == NULL)
{
- fprintf(stderr, "Nullpointer parameter!\n");
+ fprintf(stderr, "%s: Nullpointer parameter!\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
@@ -132,25 +132,25 @@ DltReturnValue dlt_kpi_read_configuration_file(DltKpiConfig *config, char *file_
if(file == NULL)
{
- fprintf(stderr, "Could not open configuration file!\n");
+ fprintf(stderr, "%s: Could not open configuration file!\n", __func__);
return DLT_RETURN_ERROR;
}
if((line = malloc(COMMAND_LINE_SIZE)) == 0)
{
- fprintf(stderr, "Out of memory!\n");
+ fprintf(stderr, "%s: Out of memory!\n", __func__);
return DLT_RETURN_ERROR;
}
if((token = malloc(COMMAND_LINE_SIZE)) == 0)
{
- fprintf(stderr, "Out of memory!\n");
+ fprintf(stderr, "%s: Out of memory!\n", __func__);
return DLT_RETURN_ERROR;
}
if((value = malloc(COMMAND_LINE_SIZE)) == 0)
{
- fprintf(stderr, "Out of memory!\n");
+ fprintf(stderr, "%s: Out of memory!\n", __func__);
return DLT_RETURN_ERROR;
}
@@ -237,7 +237,7 @@ DltReturnValue dlt_kpi_init(int argc, char **argv, DltKpiConfig *config)
if(config == NULL)
{
- fprintf(stderr, "Nullpointer parameter!");
+ fprintf(stderr, "%s: Invalid Parameter!", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
diff --git a/src/kpi/dlt-kpi-process-list.c b/src/kpi/dlt-kpi-process-list.c
index 7711498..2d77c91 100644
--- a/src/kpi/dlt-kpi-process-list.c
+++ b/src/kpi/dlt-kpi-process-list.c
@@ -31,7 +31,7 @@ DltKpiProcessList *dlt_kpi_create_process_list()
DltKpiProcessList *new_list = malloc(sizeof(DltKpiProcessList));
if(new_list == NULL)
{
- fprintf(stderr, "Cannot create process list, out of memory\n");
+ fprintf(stderr, "%s: Cannot create process list, out of memory\n", __func__);
return NULL;
}
@@ -45,7 +45,7 @@ DltReturnValue dlt_kpi_free_process_list_soft(DltKpiProcessList *list)
{
if(list == NULL)
{
- fprintf(stderr, "dlt_kpi_free_process_list_soft: Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
@@ -58,7 +58,7 @@ DltReturnValue dlt_kpi_free_process_list(DltKpiProcessList *list)
{
if(list == NULL)
{
- fprintf(stderr, "dlt_kpi_free_process_list: Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
@@ -79,7 +79,7 @@ DltKpiProcess *dlt_kpi_get_process_at_cursor(DltKpiProcessList *list)
{
if(list == NULL)
{
- fprintf(stderr, "dlt_kpi_get_process_at_cursor(): Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return NULL;
}
@@ -90,7 +90,7 @@ DltReturnValue dlt_kpi_reset_cursor(DltKpiProcessList *list)
{
if(list == NULL)
{
- fprintf(stderr, "dlt_kpi_reset_cursor(): Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
@@ -102,7 +102,7 @@ DltReturnValue dlt_kpi_set_cursor_at_end(DltKpiProcessList *list)
{
if(list == NULL)
{
- fprintf(stderr, "dlt_kpi_set_cursor_at_end(): Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
@@ -120,7 +120,7 @@ DltReturnValue dlt_kpi_increment_cursor(DltKpiProcessList *list)
{
if(list == NULL)
{
- fprintf(stderr, "dlt_kpi_set_cursor_at_end(): Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
@@ -136,7 +136,7 @@ DltReturnValue dlt_kpi_decrement_cursor(DltKpiProcessList *list)
{
if(list == NULL)
{
- fprintf(stderr, "dlt_kpi_set_cursor_at_end(): Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
@@ -152,7 +152,7 @@ DltReturnValue dlt_kpi_add_process_at_start(DltKpiProcessList *list, DltKpiProce
{
if(list == NULL || process == NULL)
{
- fprintf(stderr, "dlt_kpi_add_process_at_start(): Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
@@ -169,7 +169,7 @@ DltReturnValue dlt_kpi_add_process_before_cursor(DltKpiProcessList *list, DltKpi
{
if(list == NULL || process == NULL)
{
- fprintf(stderr, "dlt_kpi_add_process_before_cursor(): Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
@@ -203,7 +203,7 @@ DltReturnValue dlt_kpi_add_process_after_cursor(DltKpiProcessList *list, DltKpiP
{
if(list == NULL || process == NULL)
{
- fprintf(stderr, "dlt_kpi_add_process_after_cursor: Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_ERROR;
}
@@ -224,13 +224,13 @@ DltReturnValue dlt_kpi_remove_process_at_cursor_soft(DltKpiProcessList *list)
{
if(list == NULL)
{
- fprintf(stderr, "dlt_kpi_set_cursor_at_end(): Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
if(list->cursor == NULL)
{
- fprintf(stderr, "Could not remove process from list - cursor is NULL!\n");
+ fprintf(stderr, "%s: Cursor is Invalid (NULL)\n", __func__);
return DLT_RETURN_ERROR;
}
@@ -266,13 +266,13 @@ DltReturnValue dlt_kpi_remove_process_at_cursor(DltKpiProcessList *list)
{
if(list == NULL)
{
- fprintf(stderr, "dlt_kpi_set_cursor_at_end(): Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
if(list->cursor == NULL)
{
- fprintf(stderr, "Could not remove process from list - cursor is NULL!\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_ERROR;
}
diff --git a/src/kpi/dlt-kpi-process.c b/src/kpi/dlt-kpi-process.c
index 168adf7..ad157e1 100644
--- a/src/kpi/dlt-kpi-process.c
+++ b/src/kpi/dlt-kpi-process.c
@@ -37,7 +37,7 @@ DltReturnValue dlt_kpi_process_update_io_wait(DltKpiProcess *process, unsigned l
{
if(process == NULL)
{
- fprintf(stderr, "dlt_kpi_process_update_io_wait(): Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
@@ -58,7 +58,7 @@ DltReturnValue dlt_kpi_process_update_cpu_time(DltKpiProcess *process, unsigned
{
if(process == NULL)
{
- fprintf(stderr, "dlt_kpi_process_update_cpu_time(): Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
@@ -87,7 +87,7 @@ DltReturnValue dlt_kpi_process_update_rss(DltKpiProcess *process)
{
if(process == NULL)
{
- fprintf(stderr, "dlt_kpi_process_update_rss(): Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
@@ -100,7 +100,7 @@ DltReturnValue dlt_kpi_process_update_ctx_switches(DltKpiProcess *process)
{
if(process == NULL)
{
- fprintf(stderr, "dlt_kpi_process_update_ctx_switches(): Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
@@ -145,7 +145,7 @@ DltReturnValue dlt_kpi_process_update_io_bytes(DltKpiProcess *process)
{
if(process == NULL)
{
- fprintf(stderr, "dlt_kpi_process_update_io_bytes: Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
@@ -189,6 +189,13 @@ DltReturnValue dlt_kpi_process_update_io_bytes(DltKpiProcess *process)
DltReturnValue dlt_kpi_update_process(DltKpiProcess *process, unsigned long int time_dif_ms)
{
+
+ if(process == NULL)
+ {
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
+ return DLT_RETURN_WRONG_PARAMETER;
+ }
+
dlt_kpi_process_update_io_wait(process, time_dif_ms);
dlt_kpi_process_update_cpu_time(process, time_dif_ms);
dlt_kpi_process_update_rss(process);
@@ -201,6 +208,12 @@ DltReturnValue dlt_kpi_update_process(DltKpiProcess *process, unsigned long int
DltKpiProcess *dlt_kpi_create_process(int pid)
{
DltKpiProcess *new_process = malloc(sizeof(DltKpiProcess));
+ if(new_process == NULL)
+ {
+ fprintf(stderr, "%s: Out of Memory \n", __func__);
+ return NULL;
+ }
+
memset(new_process, 0, sizeof(DltKpiProcess));
new_process->pid = pid;
@@ -223,7 +236,7 @@ DltKpiProcess *dlt_kpi_clone_process(DltKpiProcess *original)
{
if(original == NULL)
{
- fprintf(stderr, "dlt_kpi_clone_process: Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return NULL;
}
@@ -231,7 +244,7 @@ DltKpiProcess *dlt_kpi_clone_process(DltKpiProcess *original)
DltKpiProcess *new_process = malloc(sizeof(DltKpiProcess));
if(new_process == NULL)
{
- fprintf(stderr, "Out of memory\n");
+ fprintf(stderr, "%s: Out of Memory\n", __func__);
return NULL;
}
@@ -242,8 +255,8 @@ DltKpiProcess *dlt_kpi_clone_process(DltKpiProcess *original)
new_process->command_line = malloc(strlen(original->command_line) + 1);
if(new_process->command_line == NULL)
{
- fprintf(stderr, "Out of memory\n");
- return NULL;
+ fprintf(stderr, "%s: Out of Memory\n", __func__);
+ return NULL;
}
strncpy(new_process->command_line, original->command_line, strlen(original->command_line) + 1);
}
@@ -259,7 +272,7 @@ DltReturnValue dlt_kpi_free_process(DltKpiProcess *process)
{
if(process == NULL)
{
- fprintf(stderr, "dlt_kpi_free_process: Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
@@ -275,8 +288,8 @@ DltReturnValue dlt_kpi_print_process(DltKpiProcess *process)
{
if(process == NULL)
{
- fprintf(stderr, "Error: Nullpointer parameter\n");
- return DLT_RETURN_ERROR;
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
+ return DLT_RETURN_WRONG_PARAMETER;
}
printf("[PID %d]\n", process->pid);
@@ -295,7 +308,7 @@ DltReturnValue dlt_kpi_read_process_file_to_str(pid_t pid, char **target_str, ch
{
if(target_str == NULL)
{
- fprintf(stderr, "Error: Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_ERROR;
}
@@ -303,13 +316,13 @@ DltReturnValue dlt_kpi_read_process_file_to_str(pid_t pid, char **target_str, ch
if(pid <= 0)
{
- fprintf(stderr, "Error: Invalid PID\n");
+ fprintf(stderr, "%s: Invalid Parameter (PID)\n", __func__);
return DLT_RETURN_ERROR;
}
if(subdir == NULL)
{
- fprintf(stderr, "Error: Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_ERROR;
}
@@ -323,7 +336,7 @@ unsigned long int dlt_kpi_read_process_stat_to_ulong(pid_t pid, unsigned int ind
{
if(pid <= 0)
{
- fprintf(stderr, "dlt_kpi_read_process_stat_to_ulong(): Invalid PID\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return 0;
}
@@ -376,13 +389,13 @@ DltReturnValue dlt_kpi_read_process_stat_cmdline(pid_t pid, char **buffer)
{
if(pid <= 0)
{
- fprintf(stderr, "dlt_kpi_read_process_stat_cmdline(): Invalid PID\n");
+ fprintf(stderr, "%s: Invalid Parameter (PID)\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
if(buffer == NULL)
{
- fprintf(stderr, "dlt_kpi_read_process_stat_cmdline(): Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
@@ -429,7 +442,7 @@ DltReturnValue dlt_kpi_get_msg_process_update(DltKpiProcess *process, char *buff
{
if(process == NULL || buffer == NULL)
{
- fprintf(stderr, "dlt_kpi_log_process_new(): Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
@@ -442,7 +455,7 @@ DltReturnValue dlt_kpi_get_msg_process_new(DltKpiProcess *process, char *buffer,
{
if(process == NULL || buffer == NULL)
{
- fprintf(stderr, "dlt_kpi_log_process_new(): Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
@@ -455,7 +468,7 @@ DltReturnValue dlt_kpi_get_msg_process_stop(DltKpiProcess *process, char *buffer
{
if(process == NULL || buffer == NULL)
{
- fprintf(stderr, "dlt_kpi_log_process_new(): Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
@@ -468,7 +481,7 @@ DltReturnValue dlt_kpi_get_msg_process_commandline(DltKpiProcess *process, char
{
if(process == NULL || buffer == NULL)
{
- fprintf(stderr, "dlt_kpi_log_process_new(): Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
diff --git a/src/kpi/dlt-kpi.c b/src/kpi/dlt-kpi.c
index f315058..8ba019e 100644
--- a/src/kpi/dlt-kpi.c
+++ b/src/kpi/dlt-kpi.c
@@ -124,6 +124,8 @@ int main(int argc, char **argv)
dlt_kpi_free_process_lists();
printf("Done.\n");
+
+ return 0;
}
void dlt_kpi_init_sigterm_handler()
@@ -213,7 +215,7 @@ DltReturnValue dlt_kpi_log_list(DltKpiProcessList *list, DltReturnValue(*process
{
if(list == NULL || process_callback == NULL || title == NULL)
{
- fprintf(stderr, "dlt_kpi_log_list(): Nullpointer parameter\n");
+ fprintf(stderr, "%s: Invalid Parameter (NULL)\n", __func__);
return DLT_RETURN_WRONG_PARAMETER;
}
@@ -232,13 +234,13 @@ DltReturnValue dlt_kpi_log_list(DltKpiProcessList *list, DltReturnValue(*process
if((ret = dlt_user_log_write_start(&kpi_ctx, &data, config.log_level)) < DLT_RETURN_OK)
{
- fprintf(stderr, "dlt_kpi_log_list(): dlt_user_log_write_start() returned error.\n");
+ fprintf(stderr, "%s: dlt_user_log_write_start() returned error.\n", __func__);
return ret;
}
if((ret = dlt_user_log_write_string(&data, title)) < DLT_RETURN_OK)
{
- fprintf(stderr, "dlt_kpi_log_list(): dlt_user_log_write_string() returned error.\n");
+ fprintf(stderr, "%s: dlt_user_log_write_string() returned error.\n", __func__);
return ret;
}
@@ -252,19 +254,19 @@ DltReturnValue dlt_kpi_log_list(DltKpiProcessList *list, DltReturnValue(*process
/* Log buffer full => Write log and start new one*/
if((ret = dlt_user_log_write_finish(&data)) < DLT_RETURN_OK)
{
- fprintf(stderr, "dlt_kpi_log_list(): dlt_user_log_write_finish() returned error.\n");
+ fprintf(stderr, "%s: dlt_user_log_write_finish() returned error.\n",__func__);
return ret;
}
if((ret = dlt_user_log_write_start(&kpi_ctx, &data, config.log_level)) < DLT_RETURN_OK)
{
- fprintf(stderr, "dlt_kpi_log_list(): dlt_user_log_write_start() returned error.\n");
+ fprintf(stderr, "%s: dlt_user_log_write_start() returned error.\n",__func__);
return ret;
}
if((ret = dlt_user_log_write_string(&data, title)) < DLT_RETURN_OK)
{
- fprintf(stderr, "dlt_kpi_log_list(): dlt_user_log_write_string() returned error.\n");
+ fprintf(stderr, "%s: dlt_user_log_write_string() returned error.\n",__func__);
return ret;
}
}
@@ -282,7 +284,7 @@ DltReturnValue dlt_kpi_log_list(DltKpiProcessList *list, DltReturnValue(*process
if((ret = dlt_user_log_write_finish(&data)) < DLT_RETURN_OK)
{
- fprintf(stderr, "dlt_kpi_log_list(): dlt_user_log_write_finish() returned error.\n");
+ fprintf(stderr, "%s: dlt_user_log_write_finish() returned error.\n",__func__);
return ret;
}