Fixing compilation errors

This commit is contained in:
Kevin Sala 2021-08-10 10:16:41 +02:00
parent 1da0f1a096
commit 543dd51d8f
5 changed files with 11 additions and 7 deletions

2
emu.c
View File

@ -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;

2
emu.h
View File

@ -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;

3
ovni.c
View File

@ -9,6 +9,7 @@
#include <linux/limits.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/mman.h>
#include <stdatomic.h>
#include <assert.h>
@ -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);

3
ovni.h
View File

@ -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];

View File

@ -6,6 +6,8 @@
#include <math.h>
#include <unistd.h>
#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);