#include <stdint.h>
#include <stddef.h>
#include <stdio.h>
-
-/*
- * Includes final \0.
- */
-#define CLOCK_UUID_LEN 37
+#include "lttng-ust-uuid.h"
/* TRACE CLOCK */
{
struct timespec ts;
- clock_gettime(CLOCK_MONOTONIC, &ts);
+ if (caa_unlikely(clock_gettime(CLOCK_MONOTONIC, &ts))) {
+ ts.tv_sec = 0;
+ ts.tv_nsec = 0;
+ }
return ((uint64_t) ts.tv_sec * 1000000000ULL) + ts.tv_nsec;
}
}
static __inline__
-const int trace_clock_uuid(char *uuid)
+int trace_clock_uuid(char *uuid)
{
int ret = 0;
size_t len;
if (!fp) {
return -ENOENT;
}
- len = fread(uuid, 1, CLOCK_UUID_LEN - 1, fp);
- if (len < CLOCK_UUID_LEN - 1) {
+ len = fread(uuid, 1, LTTNG_UST_UUID_STR_LEN - 1, fp);
+ if (len < LTTNG_UST_UUID_STR_LEN - 1) {
ret = -EINVAL;
goto end;
}
- uuid[CLOCK_UUID_LEN - 1] = '\0';
+ uuid[LTTNG_UST_UUID_STR_LEN - 1] = '\0';
end:
fclose(fp);
return ret;