1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

fixed collision of perror() macro with c sodlib

git-svn-id: https://zerberus.eonerc.rwth-aachen.de:8443/svn/s2ss/trunk@256 8ec27952-4edc-4aab-86aa-e87bb2611832
This commit is contained in:
Steffen Vogel 2014-12-09 15:39:17 +00:00
parent eff4ffead5
commit 735aa94854
7 changed files with 17 additions and 16 deletions

View file

@ -12,6 +12,7 @@
#include <stdarg.h>
#include <errno.h>
#include <sched.h>
#include <string.h>
#ifdef __GNUC__
#define EXPECT(x, v) __builtin_expect(x, v)
@ -126,7 +127,7 @@ int system2(const char* cmd, ...);
} while (0)
/** Print error and strerror(errno). */
#define perror(msg, ...) do { \
#define serror(msg, ...) do { \
print(ERROR, msg ": %s", ##__VA_ARGS__, \
strerror(errno)); \
exit(EXIT_FAILURE); \

View file

@ -205,7 +205,7 @@ int config_parse_socket(config_setting_t *cfg, struct node *n)
struct socket *s = (struct socket *) malloc(sizeof(struct socket));
if (!s)
perror("Failed to allocate memory");
serror("Failed to allocate memory");
memset(s, 0, sizeof(struct socket));

View file

@ -59,7 +59,7 @@ int if_start(struct interface *i, int affinity)
/* Set fwmark for outgoing packets */
if (setsockopt(s->sd, SOL_SOCKET, SO_MARK, &s->mark, sizeof(s->mark)))
perror("Failed to set fwmark for outgoing packets");
serror("Failed to set fwmark for outgoing packets");
else
debug(4, "Set fwmark for socket->sd = %u to %u", s->sd, s->mark);

View file

@ -43,13 +43,13 @@ static void * path_send(void *arg)
sigemptyset(&set);
sigaddset(&set, SIGALRM);
if(pthread_sigmask(SIG_BLOCK, &set, NULL))
perror("Set signal mask");
serror("Set signal mask");
if (timer_create(CLOCK_REALTIME, &sev, &tmr))
perror("Failed to create timer");
serror("Failed to create timer");
if (timer_settime(tmr, 0, &its, NULL))
perror("Failed to start timer");
serror("Failed to start timer");
while (1) {
sigwait(&set, &sig); /* blocking wait for next timer tick */

View file

@ -70,7 +70,7 @@ void realtime_init()
if (settings.priority) {
struct sched_param param = { .sched_priority = settings.priority };
if (sched_setscheduler(0, SCHED_FIFO, &param))
perror("Failed to set realtime priority");
serror("Failed to set realtime priority");
else
debug(3, "Set task priority to %u", settings.priority);
}
@ -79,7 +79,7 @@ void realtime_init()
if (settings.affinity) {
cpu_set_t cset = to_cpu_set(settings.affinity);
if (sched_setaffinity(0, sizeof(cset), &cset))
perror("Failed to set CPU affinity to '%#x'", settings.affinity);
serror("Failed to set CPU affinity to '%#x'", settings.affinity);
else
debug(3, "Set affinity to %#x", settings.affinity);
}

View file

@ -57,11 +57,11 @@ int socket_open(struct node *n)
}
if (s->sd < 0)
perror("Failed to create socket");
serror("Failed to create socket");
/* Bind socket for receiving */
if (bind(s->sd, (struct sockaddr *) &s->local, sizeof(s->local)))
perror("Failed to bind to socket");
serror("Failed to bind socket");
/* Determine outgoing interface */
int index = if_getegress((struct sockaddr *) &s->remote);
@ -84,7 +84,7 @@ int socket_open(struct node *n)
case IP:
prio = IPTOS_LOWDELAY;
if (setsockopt(s->sd, IPPROTO_IP, IP_TOS, &prio, sizeof(prio)))
perror("Failed to set type of service (QoS)");
serror("Failed to set type of service (QoS)");
else
debug(4, "Set QoS/TOS IP option for node '%s' to %#x", n->name, prio);
break;
@ -92,7 +92,7 @@ int socket_open(struct node *n)
default:
prio = SOCKET_PRIO;
if (setsockopt(s->sd, SOL_SOCKET, SO_PRIORITY, &prio, sizeof(prio)))
perror("Failed to set socket priority");
serror("Failed to set socket priority");
else
debug(4, "Set socket priority for node '%s' to %u", n->name, prio);
break;
@ -115,8 +115,8 @@ int socket_read(struct node* n, struct msg *m)
if (errno == EINTR)
return -EINTR;
perror("Failed recv");
}
serror("Failed recv");
/* Convert headers to host byte order */
m->sequence = ntohs(m->sequence);
@ -139,7 +139,7 @@ int socket_write(struct node* n, struct msg *m)
if (sendto(n->socket->sd, m, MSG_LEN(m->length), 0,
(struct sockaddr *) &n->socket->remote,
sizeof(struct sockaddr_in)) < 0)
perror("Failed sendto");
serror("Failed sendto");
debug(10, "Message sent to node '%s': version=%u, type=%u, endian=%u, length=%u, sequence=%u",
n->name, m->version, m->type, m->endian, m->length, ntohs(m->sequence));
@ -167,7 +167,7 @@ int socket_print_addr(char *buf, int len, struct sockaddr *sa)
}
default:
error("Unsupported address family");
error("Unsupported address family: %u", sa->sa_family);
}
return 0;

View file

@ -163,7 +163,7 @@ int system2(const char *cmd, ...)
FILE *f = popen(buf, "r");
if (f == NULL)
perror("Failed to execute: '%s'", cmd);
serror("Failed to execute: '%s'", cmd);
while (!feof(f) && fgets(buf, sizeof(buf), f) != NULL) { INDENT
strtok(buf, "\n"); /* strip trailing newline */