mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
enabled -Wall and fixed some compiler warnings
git-svn-id: https://zerberus.eonerc.rwth-aachen.de:8443/svn/s2ss/trunk@73 8ec27952-4edc-4aab-86aa-e87bb2611832
This commit is contained in:
parent
4bf40bbb03
commit
58a7aed493
10 changed files with 17 additions and 13 deletions
6
Makefile
6
Makefile
|
@ -5,7 +5,7 @@ SRCS = server.c send.c receive.c random.c node.c path.c utils.c msg.c cfg.c if.c
|
|||
all: $(TARGETS)
|
||||
|
||||
# Dependencies for individual binaries
|
||||
server: node.o msg.o utils.o path.o cfg.o
|
||||
server: node.o msg.o utils.o path.o cfg.o if.o
|
||||
send: node.o msg.o utils.o
|
||||
receive: node.o msg.o utils.o
|
||||
random: node.o msg.o utils.o
|
||||
|
@ -25,8 +25,8 @@ GIT_TAG = $(shell git describe --tags --abbrev=0)
|
|||
GIT_REV = $(shell git rev-parse --short HEAD)
|
||||
|
||||
# Compiler and Linker flags
|
||||
LDFLAGS = -pthread -lrt -lm -lconfig -lcap
|
||||
CFLAGS = -g -std=c99 -Iinclude/ -MMD
|
||||
LDFLAGS = -pthread -lrt -lm -lconfig
|
||||
CFLAGS = -g -std=c99 -Iinclude/ -MMD -Wall
|
||||
CFLAGS += -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -DV=$(V)
|
||||
CFLAGS += -D__GIT_REV__='"$(GIT_REV)"' -D__GIT_TAG__='"$(GIT_TAG)"'
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/** Static server configuration
|
||||
*
|
||||
*
|
||||
* This file contains some defines which are not part of the configuration file.
|
||||
*
|
||||
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
|
||||
|
|
|
@ -56,7 +56,7 @@ struct node
|
|||
const char *ifname;
|
||||
/** Index of the local interface */
|
||||
int ifindex;
|
||||
/// Socket Mark
|
||||
/** Socket mark for netem, routing and filtering */
|
||||
int mark;
|
||||
|
||||
/** A short identifier of the node */
|
||||
|
|
|
@ -28,7 +28,7 @@ int msg_fprint(FILE *f, struct msg *msg)
|
|||
|
||||
int msg_fscan(FILE *f, struct msg *msg)
|
||||
{
|
||||
fscanf(f, "%8u %8u ", &msg->device, &msg->sequence);
|
||||
fscanf(f, "%8hu %8u ", &msg->device, &msg->sequence);
|
||||
|
||||
for (int i = 0; i < msg->length / sizeof(double); i++) {
|
||||
fscanf(f, "%12lf ", &msg->data[i]);
|
||||
|
@ -58,6 +58,8 @@ int msg_send(struct msg *m, struct node *n)
|
|||
perror("Failed sendto");
|
||||
|
||||
debug(10, "Message sent to node %s (%s:%u)", n->name, inet_ntoa(n->remote.sin_addr), ntohs(n->remote.sin_port));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int msg_recv(struct msg *m, struct node *n)
|
||||
|
@ -66,4 +68,6 @@ int msg_recv(struct msg *m, struct node *n)
|
|||
perror("Failed recv");
|
||||
|
||||
debug(10, "Message received from node %s", n->name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -51,6 +51,8 @@ int node_connect(struct node *n)
|
|||
int node_disconnect(struct node *n)
|
||||
{
|
||||
close(n->sd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum node_type node_lookup_type(const char *str)
|
||||
|
|
|
@ -55,7 +55,7 @@ static void * path_run(void *arg)
|
|||
|
||||
int path_start(struct path *p)
|
||||
{
|
||||
pthread_create(&p->tid, NULL, &path_run, (void *) p);
|
||||
return pthread_create(&p->tid, NULL, &path_run, (void *) p);
|
||||
}
|
||||
|
||||
int path_stop(struct path *p)
|
||||
|
|
|
@ -34,7 +34,6 @@ int main(int argc, char *argv[])
|
|||
struct msg m;
|
||||
|
||||
memset(&n, 0, sizeof(struct node));
|
||||
struct sockaddr_in sa;
|
||||
|
||||
if (argc != 2) {
|
||||
printf("Usage: %s LOCAL\n", argv[0]);
|
||||
|
|
|
@ -30,8 +30,6 @@ void quit(int sig, siginfo_t *si, void *ptr)
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct sockaddr_in sa;
|
||||
|
||||
if (argc != 3 && argc != 4) {
|
||||
printf("Usage: %s VALUES REMOTE [LOCAL]\n", argv[0]);
|
||||
printf(" REMOTE is a IP:PORT combination of the remote host\n");
|
||||
|
|
|
@ -105,7 +105,7 @@ int main(int argc, char *argv[])
|
|||
printf(" CONFIG is a required path to a configuration file\n\n");
|
||||
printf("Simulator2Simulator Server %s (%s %s)\n", VERSION, __DATE__, __TIME__);
|
||||
printf(" Copyright 2014, Institute for Automation of Complex Power Systems, EONERC\n");
|
||||
printf(" Steffen Vogel <stvogel@eonerc.rwth-aachen.de>\n\n");
|
||||
printf(" Steffen Vogel <stvogel@eonerc.rwth-aachen.de>\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ int main(int argc, char *argv[])
|
|||
/* Check for realtime kernel patch */
|
||||
struct stat st;
|
||||
if (stat("/sys/kernel/realtime", &st))
|
||||
warn("This is not a a realtime patched kernel!");
|
||||
warn("Use a RT-preempt patched Linux for lower latencies!");
|
||||
else
|
||||
debug(3, "This is a realtime patched kernel");
|
||||
|
||||
|
|
|
@ -73,7 +73,8 @@ int resolve_addr(const char *addr, struct sockaddr_in *sa, int flags)
|
|||
.ai_protocol = 0
|
||||
};
|
||||
|
||||
if (getaddrinfo(node, service, &hint, &result))
|
||||
ret = getaddrinfo(node, service, &hint, &result);
|
||||
if (ret)
|
||||
error("Failed to lookup address: %s", gai_strerror(ret));
|
||||
|
||||
memcpy(sa, result->ai_addr, result->ai_addrlen);
|
||||
|
|
Loading…
Add table
Reference in a new issue