X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fkernel.c;h=43c6285773847739afc437de35bbb09cb0f6b0e3;hp=d9e047fc3f5cdcc50a72ea68d0a7f29fa49b159b;hb=335a95b7e3fab0d66908594ac7039651c7aaf6f4;hpb=059e1d3d3268391d73bb0dc733629eb8edfeb1ed diff --git a/src/bin/lttng-sessiond/kernel.c b/src/bin/lttng-sessiond/kernel.c index d9e047fc3..43c628577 100644 --- a/src/bin/lttng-sessiond/kernel.c +++ b/src/bin/lttng-sessiond/kernel.c @@ -638,3 +638,30 @@ error_version: error: return ret; } + +/* + * Kernel work-arounds called at the start of sessiond main(). + */ +int init_kernel_workarounds(void) +{ + FILE *fp; + + /* + * boot_id needs to be read once before being used concurrently + * to deal with a Linux kernel race. A fix is proposed for + * upstream, but the work-around is needed for older kernels. + */ + fp = fopen("/proc/sys/kernel/random/boot_id", "r"); + if (!fp) { + goto end_boot_id; + } + while (!feof(fp)) { + char buf[37] = ""; + + (void) fread(buf, 1, sizeof(buf), fp); + } + fclose(fp); +end_boot_id: + + return 0; +}