mirror of
https://github.com/clearlinux/telemetrics-client.git
synced 2026-09-01 11:15:51 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d75e27a5c4 | ||
|
|
9baf5f821e | ||
|
|
be98da141d |
@@ -38,6 +38,7 @@ autoscan.log
|
||||
configure.scan
|
||||
tprobe
|
||||
hprobe
|
||||
bertprobe
|
||||
crashprobe
|
||||
journalprobe
|
||||
telem-record-gen
|
||||
@@ -45,6 +46,7 @@ klogscanner
|
||||
oopsprobe
|
||||
pstoreclean
|
||||
pstoreprobe
|
||||
telem_journal
|
||||
make.out
|
||||
types_c.taghl
|
||||
src/recomp.sh
|
||||
|
||||
@@ -102,10 +102,5 @@ int main(int argc, char **argv)
|
||||
rc = EXIT_FAILURE;
|
||||
}
|
||||
|
||||
free(classification);
|
||||
free(record_id);
|
||||
free(event_id);
|
||||
free(boot_id);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -432,13 +432,13 @@ int print_journal(TelemJournal *telem_journal, char *classification,
|
||||
if (entry) {
|
||||
/* filter entry out if one is provided */
|
||||
if (record_id != NULL && strcmp(entry->record_id, record_id) != 0) {
|
||||
continue;
|
||||
goto skip_print;
|
||||
}
|
||||
if (boot_id != NULL && strcmp(entry->boot_id, boot_id) != 0) {
|
||||
continue;
|
||||
goto skip_print;
|
||||
}
|
||||
if (event_id != NULL && strcmp(entry->event_id, event_id) != 0) {
|
||||
continue;
|
||||
goto skip_print;
|
||||
}
|
||||
// In the case of class checking prefixes is an option
|
||||
if (classification != NULL) {
|
||||
@@ -460,6 +460,7 @@ int print_journal(TelemJournal *telem_journal, char *classification,
|
||||
fprintf(stdout, "%-30s %s %s %s %s\n", entry->classification, str_time, entry->record_id, entry->event_id, entry->boot_id);
|
||||
count++;
|
||||
}
|
||||
skip_print:
|
||||
free_journal_entry(entry);
|
||||
}
|
||||
free(line);
|
||||
|
||||
+3
-33
@@ -615,37 +615,6 @@ static int set_bios_version_header(struct telem_ref *t_ref)
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an alphanumeric id of length 32
|
||||
*
|
||||
* @param buff pointer to memory buffer, buffer should have
|
||||
* at least 33 bytes of memory
|
||||
*
|
||||
* @return 0 if successful, or -1 if there's a problem
|
||||
*
|
||||
*/
|
||||
static int gen_event_id(char *buff)
|
||||
{
|
||||
int frandom = -1;
|
||||
int result = -1;
|
||||
uint64_t random_id[2] = { 0 };
|
||||
|
||||
frandom = open("/dev/urandom", O_RDONLY);
|
||||
if (frandom < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (read(frandom, &random_id, sizeof(random_id)) == sizeof(random_id)) {
|
||||
if (sprintf(buff, "%.16" PRIx64 "%.16" PRIx64, random_id[0], random_id[1]) == 32) {
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
|
||||
close(frandom);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the event_id header, this id is an identifier that multiple
|
||||
* records can share. This means that one event can lead to multiple
|
||||
@@ -659,9 +628,9 @@ static int gen_event_id(char *buff)
|
||||
static int set_event_id_header(struct telem_ref *t_ref)
|
||||
{
|
||||
int rc = 0;
|
||||
char buff[33];
|
||||
char *buff = NULL;
|
||||
|
||||
rc = gen_event_id(buff);
|
||||
rc = get_random_id(&buff);
|
||||
|
||||
if (rc == 0) {
|
||||
rc = set_header(
|
||||
@@ -669,6 +638,7 @@ static int set_event_id_header(struct telem_ref *t_ref)
|
||||
TM_EVENT_ID_STR, buff,
|
||||
&(t_ref->record->header_size));
|
||||
}
|
||||
free(buff);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user