From 543dd51d8f3a11f1d567a948aaca789eda964e7a Mon Sep 17 00:00:00 2001 From: Kevin Sala Date: Tue, 10 Aug 2021 10:16:41 +0200 Subject: [PATCH] Fixing compilation errors --- emu.c | 2 +- emu.h | 2 +- ovni.c | 3 ++- ovni.h | 3 ++- ovnisync.c | 8 +++++--- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/emu.c b/emu.c index 3c23d70..54587b2 100644 --- a/emu.c +++ b/emu.c @@ -483,7 +483,7 @@ load_clock_offsets(struct ovni_emu *emu) char buf[1024]; int i, rank; double offset, std; - char host[HOST_NAME_MAX]; + char host[OVNI_MAX_HOSTNAME]; struct ovni_loom *loom; struct ovni_trace *trace; struct ovni_stream *stream; diff --git a/emu.h b/emu.h index 7cf49c3..e7b3662 100644 --- a/emu.h +++ b/emu.h @@ -138,7 +138,7 @@ struct ovni_cpu { /* State of each loom on post-process */ struct ovni_loom { size_t nprocs; - char hostname[HOST_NAME_MAX]; + char hostname[OVNI_MAX_HOSTNAME]; int max_ncpus; int max_phyid; diff --git a/ovni.c b/ovni.c index 4a15169..1685f84 100644 --- a/ovni.c +++ b/ovni.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -68,7 +69,7 @@ create_trace_stream() char path[PATH_MAX]; fprintf(stderr, "create thread stream tid=%d gettid=%d rproc.proc=%d rproc.ready=%d\n", - rthread.tid, gettid(), rproc.proc, rproc.ready); + rthread.tid, syscall(SYS_gettid), rproc.proc, rproc.ready); snprintf(path, PATH_MAX, "%s/thread.%d", rproc.dir, rthread.tid); diff --git a/ovni.h b/ovni.h index 465214d..37068e7 100644 --- a/ovni.h +++ b/ovni.h @@ -15,6 +15,7 @@ #define OVNI_MAX_THR 32 #define OVNI_MAX_LOOM 4 #define OVNI_TRACEDIR "ovni" +#define OVNI_MAX_HOSTNAME 512 /* Reserved buffer for event allocation per thread */ #define OVNI_MAX_EV_BUF (2 * 1024LL * 1024LL) /* 2 MiB */ @@ -97,7 +98,7 @@ struct ovni_rproc { int app; int proc; - char loom[HOST_NAME_MAX]; + char loom[OVNI_MAX_HOSTNAME]; int ncpus; clockid_t clockid; char procdir[PATH_MAX]; diff --git a/ovnisync.c b/ovnisync.c index 15974c7..70dfd1b 100644 --- a/ovnisync.c +++ b/ovnisync.c @@ -6,6 +6,8 @@ #include #include +#include "ovni.h" + static double get_time() { @@ -37,7 +39,7 @@ cmp_double(const void *pa, const void *pb) /* Called by rank 0 */ static void -get_offset(double *timetable, char (*hosttable)[HOST_NAME_MAX], int nproc, int nsamples) +get_offset(double *timetable, char (*hosttable)[OVNI_MAX_HOSTNAME], int nproc, int nsamples) { int i, j; double median, mean, var, std; @@ -95,7 +97,7 @@ main(int argc, char *argv[]) double *t; double *timetable; int i, rank, nprocs, nsamples; - char (*hosttable)[HOST_NAME_MAX]; + char (*hosttable)[OVNI_MAX_HOSTNAME]; MPI_Init(&argc, &argv); @@ -130,7 +132,7 @@ main(int argc, char *argv[]) t[i] = get_time(); } - if(gethostname(hosttable[rank], HOST_NAME_MAX) != 0) + if(gethostname(hosttable[rank], OVNI_MAX_HOSTNAME) != 0) { perror("gethostname"); exit(EXIT_FAILURE);