From ca825085613892fa2eb430cfbbbe1a8f65ce4b38 Mon Sep 17 00:00:00 2001 From: Michal Bloch Date: Fri, 3 Dec 2021 18:57:41 +0100 Subject: [PATCH] Fix compilation (type correctness, makefile) Change-Id: I23ae1f9e58dca2de0a8715e5ca8f63264070879c --- Makefile | 7 +++---- benchmark/gdbus.c | 4 ++-- benchmark/pipe.c | 6 +++--- benchmark/sharedmem.c | 8 ++++---- benchmark/socket.c | 6 +++--- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 62def2e..11d38e9 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,8 @@ CFLAGS= -D_GNU_SOURCE -CFLAGS+= -I/usr/include/dlog -I/usr/lib/glib-2.0/include -I/usr/include/glib-2.0 -CFLAGS+= -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -L/usr/lib +CFLAGS+=`pkg-config --cflags glib-2.0 dbus-1 gio-2.0` CFLAGS+=-Wall -O2 -g -LDFLAGS= -lglib-2.0 -lgobject-2.0 -lgio-2.0 -lgmodule-2.0 -ldbus-1 -lgthread-2.0 -lpthread -lrt -lpcre -LDFLAGS+=-lm +LDFLAGS=`pkg-config --libs glib-2.0 dbus-1 gio-2.0` +LDFLAGS+=-lpthread -lrt -lm DFTSRC=benchmark/common.c all: diff --git a/benchmark/gdbus.c b/benchmark/gdbus.c index 8f05062..f1abff9 100644 --- a/benchmark/gdbus.c +++ b/benchmark/gdbus.c @@ -34,7 +34,7 @@ static GVariant *handle_get_property (GDBusConnection *connection, const gchar *property_name, GError **error, gpointer user_data) -{ } +{ return NULL; } static gboolean handle_set_property (GDBusConnection *connection, const gchar *sender, @@ -44,7 +44,7 @@ static gboolean handle_set_property (GDBusConnection *connection, GVariant *value, GError **error, gpointer user_data) -{ } +{ return TRUE; } static void handle_method_call (GDBusConnection *connection, const gchar *sender, diff --git a/benchmark/pipe.c b/benchmark/pipe.c index 9993a28..5d31e6e 100644 --- a/benchmark/pipe.c +++ b/benchmark/pipe.c @@ -150,7 +150,7 @@ void Measure_bandwidth(void) return; } close(ready_fd); - ready_ptr[0] = "n"; + *ready_ptr = 'n'; for(int i = 0; i < nprocs/2; i++) { if(pipe(returnp[i]) == -1) { @@ -187,7 +187,7 @@ void Measure_bandwidth(void) close(p[child/2][0]); // Wait for parent - while(ready_ptr[0] == "n") { + while (*ready_ptr == 'n') { } if(child % 2 == 0) { @@ -222,7 +222,7 @@ void Measure_bandwidth(void) usleep(100000); close(p[0][1]); - ready_ptr[0] = "y"; + *ready_ptr = 'y'; Receive(0, p[0][0], msize, false); close(p[0][0]); diff --git a/benchmark/sharedmem.c b/benchmark/sharedmem.c index a1056e6..66a6644 100644 --- a/benchmark/sharedmem.c +++ b/benchmark/sharedmem.c @@ -22,7 +22,7 @@ bool lt_on, bw_on; void Receive(void *r1, register char *r2, register int size, bool is_lt) { static int bw_cnt = 0; - unsigned long long start; + unsigned long long start = 0; unsigned long long end; struct timespec clock; register char read_cnt = 0; @@ -163,7 +163,7 @@ void Measure_bandwidth(void) return; } close(ready_fd); - ready_ptr[0] = "n"; + *ready_ptr = 'n'; for(int i = 0; i < nprocs/2; i++) { sprintf(name, "bwsharedmem%d", i); @@ -208,7 +208,7 @@ void Measure_bandwidth(void) } // Wait for parent - while(ready_ptr[0] == "n") { + while (*ready_ptr == 'n') { } if(child % 2 == 0) { @@ -240,7 +240,7 @@ void Measure_bandwidth(void) } sleep(1); - ready_ptr[0] = "y"; + *ready_ptr = 'y'; Receive(NULL, shm_ptr[0], msize, false); for(int child = 1; child < nprocs; child++) { diff --git a/benchmark/socket.c b/benchmark/socket.c index 6945a64..b9c7f3c 100644 --- a/benchmark/socket.c +++ b/benchmark/socket.c @@ -150,7 +150,7 @@ void Measure_bandwidth(void) return; } close(ready_fd); - ready_ptr[0] = "n"; + *ready_ptr = 'n'; for(int i = 0; i < nprocs/2; i++) { if(pipe(returnp[i]) == -1) { @@ -189,7 +189,7 @@ void Measure_bandwidth(void) } // Wait for parent - while(ready_ptr[0] == "n") { + while (*ready_ptr == 'n') { } if(child % 2 == 0) { @@ -223,7 +223,7 @@ void Measure_bandwidth(void) } sleep(1); - ready_ptr[0] = "y"; + *ready_ptr = 'y'; Receive(0, fd[0][1], msize, false); close(fd[0][1]); -- 2.34.1