summaryrefslogtreecommitdiff
path: root/src/ipcpd/local
diff options
context:
space:
mode:
authorSander Vrijders <[email protected]>2016-10-22 11:33:20 +0000
committerSander Vrijders <[email protected]>2016-10-22 11:33:20 +0000
commit727efbe0c5e61862a870c71a2857b28eece3d369 (patch)
tree881da180b8d801c38ba0fbad2fc9f387a70ec016 /src/ipcpd/local
parent482c44232d4deda3f89a7d85fbad99c1c64e80ec (diff)
parent3cafbf3cfe5c58a6988dbfc4c29148ebb804f5c2 (diff)
downloadouroboros-727efbe0c5e61862a870c71a2857b28eece3d369.tar.gz
ouroboros-727efbe0c5e61862a870c71a2857b28eece3d369.zip
Merged in dstaesse/ouroboros/be-extra (pull request #268)
build: Comply with -Wextra compiler flag
Diffstat (limited to 'src/ipcpd/local')
-rw-r--r--src/ipcpd/local/main.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c
index 68c9ae8c..c9ad0ae6 100644
--- a/src/ipcpd/local/main.c
+++ b/src/ipcpd/local/main.c
@@ -38,6 +38,7 @@
#include <pthread.h>
#include <sys/wait.h>
#include <fcntl.h>
+#include <assert.h>
#define EVENT_WAIT_TIMEOUT 100 /* us */
#define THIS_TYPE IPCP_LOCAL
@@ -53,7 +54,7 @@ struct {
pthread_t sduloop;
} local_data;
-int local_data_init()
+static int local_data_init(void)
{
int i;
for (i = 0; i < IRMD_MAX_FLOWS; ++i)
@@ -68,7 +69,7 @@ int local_data_init()
return 0;
}
-void local_data_fini()
+static void local_data_fini(void)
{
pthread_rwlock_destroy(&local_data.lock);
}
@@ -80,6 +81,8 @@ static void * ipcp_local_sdu_loop(void * o)
if (fq == NULL)
return (void *) 1;
+ (void) o;
+
while (true) {
int fd;
int ret;
@@ -89,10 +92,7 @@ static void * ipcp_local_sdu_loop(void * o)
if (ret == -ETIMEDOUT)
continue;
- if (ret < 0) {
- LOG_ERR("Event wait returned error code %d.", -ret);
- continue;
- }
+ assert(!ret);
pthread_rwlock_rdlock(&ipcpi.state_lock);
@@ -106,6 +106,8 @@ static void * ipcp_local_sdu_loop(void * o)
while ((fd = fqueue_next(fq)) >= 0) {
idx = local_flow_read(fd);
+ assert((size_t) idx < (SHM_BUFFER_SIZE));
+
fd = local_data.in_out[fd];
if (fd != -1)
@@ -121,6 +123,8 @@ static void * ipcp_local_sdu_loop(void * o)
void ipcp_sig_handler(int sig, siginfo_t * info, void * c)
{
+ (void) c;
+
switch(sig) {
case SIGINT:
case SIGTERM:
@@ -143,10 +147,7 @@ void ipcp_sig_handler(int sig, siginfo_t * info, void * c)
static int ipcp_local_bootstrap(struct dif_config * conf)
{
- if (conf->type != THIS_TYPE) {
- LOG_ERR("Config doesn't match IPCP type.");
- return -1;
- }
+ assert (conf->type == THIS_TYPE);
pthread_rwlock_wrlock(&ipcpi.state_lock);
@@ -204,12 +205,12 @@ static int ipcp_local_flow_alloc(int fd,
{
int out_fd = -1;
- LOG_DBG("Allocating flow to %s on fd %d.", dst_name, fd);
+ /* This ipcpd has all QoS */
+ (void) qos;
- if (dst_name == NULL || src_ae_name == NULL)
- return -1;
+ LOG_DBG("Allocating flow to %s on fd %d.", dst_name, fd);
- /* This ipcpd has all QoS */
+ assert(dst_name || src_ae_name);
pthread_rwlock_rdlock(&ipcpi.state_lock);
@@ -271,8 +272,7 @@ static int ipcp_local_flow_dealloc(int fd)
{
struct timespec t = {0, 10000};
- if (fd < 0)
- return -EINVAL;
+ assert(!(fd < 0));
flow_set_del(local_data.flows, fd);