X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=converter%2Fbabeltrace-log.c;h=6ac94e69236c3cb7f29d806aa0369b63bf5b2d4b;hp=53826c33ee32e12838e952ac680a5127c41fe985;hb=b4b292cc76e04e9efda111e492251d8e7aefe451;hpb=3394d22e104e2f6511b656773ef4e74506842f3e diff --git a/converter/babeltrace-log.c b/converter/babeltrace-log.c index 53826c33..6ac94e69 100644 --- a/converter/babeltrace-log.c +++ b/converter/babeltrace-log.c @@ -20,6 +20,7 @@ * Depends on glibc 2.10 for getline(). */ +#define _GNU_SOURCE #include #include #include @@ -31,25 +32,21 @@ #include #include #include -#include #include -#include #include #include +#include +#include #define USEC_PER_SEC 1000000UL -#ifndef UUID_STR_LEN -#define UUID_STR_LEN 37 /* With \0 */ -#endif - int babeltrace_debug, babeltrace_verbose; static char *s_outputname; static int s_timestamp; static int s_help; -static uuid_t s_uuid; +static unsigned char s_uuid[BABELTRACE_UUID_LEN]; /* Metadata format string */ static const char metadata_fmt[] = @@ -90,14 +87,14 @@ static const char metadata_stream_event_header_timestamp[] = static void print_metadata(FILE *fp) { - char uuid_str[UUID_STR_LEN]; + char uuid_str[BABELTRACE_UUID_STR_LEN]; unsigned int major = 0, minor = 0; int ret; ret = sscanf(VERSION, "%u.%u", &major, &minor); if (ret != 2) fprintf(stderr, "[warning] Incorrect babeltrace version format\n."); - uuid_unparse(s_uuid, uuid_str); + babeltrace_uuid_unparse(s_uuid, uuid_str); fprintf(fp, metadata_fmt, major, minor, @@ -107,7 +104,7 @@ void print_metadata(FILE *fp) } static -void write_packet_header(struct ctf_stream_pos *pos, uuid_t uuid) +void write_packet_header(struct ctf_stream_pos *pos, unsigned char *uuid) { struct ctf_stream_pos dummy; @@ -128,8 +125,8 @@ void write_packet_header(struct ctf_stream_pos *pos, uuid_t uuid) assert(!ctf_pos_packet(&dummy)); ctf_align_pos(pos, sizeof(uint8_t) * CHAR_BIT); - memcpy(ctf_get_pos_addr(pos), uuid, 16); - ctf_move_pos(pos, 16 * CHAR_BIT); + memcpy(ctf_get_pos_addr(pos), uuid, BABELTRACE_UUID_LEN); + ctf_move_pos(pos, BABELTRACE_UUID_LEN * CHAR_BIT); } static @@ -340,7 +337,7 @@ int main(int argc, char **argv) goto error_closemetadatafd; } - uuid_generate(s_uuid); + babeltrace_uuid_generate(s_uuid); print_metadata(metadata_fp); trace_text(stdin, fd);