33 if(filename ==
NULL || target ==
NULL)
35 fprintf(stderr,
"%s: Nullpointer parameter!\n",__func__);
44 if((*target = malloc(strlen(buffer) + 1)) ==
NULL)
46 fprintf(stderr,
"Out of memory!\n");
50 memcpy(*target, buffer, strlen(buffer) + 1);
57 if(filename ==
NULL || buffer ==
NULL)
59 fprintf(stderr,
"%s: Nullpointer parameter!\n",__func__);
63 FILE* file = fopen(filename,
"r");
70 int buflen = fread(buffer, 1, maxLength-1, file);
71 buffer[buflen] =
'\0';
84 fprintf(stderr,
"dlt_kpi_get_cpu_count(): Could not read /proc/cpuinfo\n");
88 char* delim =
"[] \t\n";
89 char* tok = strtok(buffer, delim);
92 fprintf(stderr,
"dlt_kpi_get_cpu_count(): Could not extract token\n");
99 if(strcmp(tok,
"processor") == 0)
102 tok = strtok(
NULL, delim);
116 fprintf(stderr,
"Could not get CPU count\n");
DltReturnValue dlt_kpi_read_file_compact(char *filename, char **target)
static int dlt_kpi_cpu_count
unsigned char buffer[BUFFER_SIZE]
Buffer for dlt file transfer. The size is defined by BUFFER_SIZE.
int dlt_kpi_get_cpu_count()
int dlt_kpi_read_cpu_count()
DltReturnValue dlt_kpi_read_file(char *filename, char *buffer, uint maxLength)