summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordimitri staessens <[email protected]>2017-04-10 16:19:29 +0000
committerSander Vrijders <[email protected]>2017-04-10 16:19:29 +0000
commitc020c3b8a81c44e6a67313e502deb6c000d1b577 (patch)
tree772a1f8ad0872b4d5c4ca0367a346a611fa022ed
parentb796ca07a6068b8582b1f39b08eca3582e37dd4f (diff)
parenta3d550ff972121641562d375f75bcf188fc7fe59 (diff)
downloadouroboros-c020c3b8a81c44e6a67313e502deb6c000d1b577.tar.gz
ouroboros-c020c3b8a81c44e6a67313e502deb6c000d1b577.zip
Merged in dstaesse/ouroboros/be-timeo-const (pull request #474)
lib: Make timeout for flow allocation const
-rw-r--r--include/ouroboros/dev.h10
-rw-r--r--src/lib/dev.c30
2 files changed, 20 insertions, 20 deletions
diff --git a/include/ouroboros/dev.h b/include/ouroboros/dev.h
index 4984736c..31c681db 100644
--- a/include/ouroboros/dev.h
+++ b/include/ouroboros/dev.h
@@ -35,13 +35,13 @@ int ap_init(const char * ap_name);
void ap_fini(void);
/* Returns flow descriptor, qs updates to supplied QoS. */
-int flow_alloc(const char * dst_name,
- qosspec_t * qs,
- struct timespec * timeo);
+int flow_alloc(const char * dst_name,
+ qosspec_t * qs,
+ const struct timespec * timeo);
/* Returns flow descriptor, qs updates to supplied QoS. */
-int flow_accept(qosspec_t * qs,
- struct timespec * timeo);
+int flow_accept(qosspec_t * qs,
+ const struct timespec * timeo);
int flow_dealloc(int fd);
diff --git a/src/lib/dev.c b/src/lib/dev.c
index 389ff278..433fb93b 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -381,8 +381,8 @@ void ap_fini()
pthread_rwlock_destroy(&ai.data_lock);
}
-int flow_accept(qosspec_t * qs,
- struct timespec * timeo)
+int flow_accept(qosspec_t * qs,
+ const struct timespec * timeo)
{
irm_msg_t msg = IRM_MSG__INIT;
irm_msg_t * recv_msg = NULL;
@@ -421,7 +421,7 @@ int flow_accept(qosspec_t * qs,
if (!recv_msg->has_api || !recv_msg->has_port_id) {
irm_msg__free_unpacked(recv_msg, NULL);
- return -1;
+ return -EIRMD;
}
pthread_rwlock_rdlock(&ai.data_lock);
@@ -432,7 +432,7 @@ int flow_accept(qosspec_t * qs,
pthread_rwlock_unlock(&ai.flows_lock);
pthread_rwlock_unlock(&ai.data_lock);
irm_msg__free_unpacked(recv_msg, NULL);
- return -1;
+ return -EBADF;
}
ai.flows[fd].rx_rb = shm_rbuff_open(ai.api, recv_msg->port_id);
@@ -441,7 +441,7 @@ int flow_accept(qosspec_t * qs,
pthread_rwlock_unlock(&ai.flows_lock);
pthread_rwlock_unlock(&ai.data_lock);
irm_msg__free_unpacked(recv_msg, NULL);
- return -1;
+ return -ENOMEM;
}
ai.flows[fd].tx_rb = shm_rbuff_open(recv_msg->api, recv_msg->port_id);
@@ -451,7 +451,7 @@ int flow_accept(qosspec_t * qs,
pthread_rwlock_unlock(&ai.flows_lock);
pthread_rwlock_unlock(&ai.data_lock);
irm_msg__free_unpacked(recv_msg, NULL);
- return -1;
+ return -ENOMEM;
}
ai.flows[fd].set = shm_flow_set_open(recv_msg->api);
@@ -461,7 +461,7 @@ int flow_accept(qosspec_t * qs,
pthread_rwlock_unlock(&ai.flows_lock);
pthread_rwlock_unlock(&ai.data_lock);
irm_msg__free_unpacked(recv_msg, NULL);
- return -1;
+ return -ENOMEM;
}
ai.flows[fd].port_id = recv_msg->port_id;
@@ -485,9 +485,9 @@ int flow_accept(qosspec_t * qs,
return fd;
}
-int flow_alloc(const char * dst_name,
- qosspec_t * qs,
- struct timespec * timeo)
+int flow_alloc(const char * dst_name,
+ qosspec_t * qs,
+ const struct timespec * timeo)
{
irm_msg_t msg = IRM_MSG__INIT;
irm_msg_t * recv_msg = NULL;
@@ -530,7 +530,7 @@ int flow_alloc(const char * dst_name,
if (!recv_msg->has_api || !recv_msg->has_port_id) {
irm_msg__free_unpacked(recv_msg, NULL);
- return -1;
+ return -EIRMD;
}
pthread_rwlock_rdlock(&ai.data_lock);
@@ -541,7 +541,7 @@ int flow_alloc(const char * dst_name,
pthread_rwlock_unlock(&ai.flows_lock);
pthread_rwlock_unlock(&ai.data_lock);
irm_msg__free_unpacked(recv_msg, NULL);
- return -1;
+ return -EBADF;
}
ai.flows[fd].rx_rb = shm_rbuff_open(ai.api, recv_msg->port_id);
@@ -550,7 +550,7 @@ int flow_alloc(const char * dst_name,
pthread_rwlock_unlock(&ai.flows_lock);
pthread_rwlock_unlock(&ai.data_lock);
irm_msg__free_unpacked(recv_msg, NULL);
- return -1;
+ return -ENOMEM;
}
ai.flows[fd].tx_rb = shm_rbuff_open(recv_msg->api, recv_msg->port_id);
@@ -560,7 +560,7 @@ int flow_alloc(const char * dst_name,
pthread_rwlock_unlock(&ai.flows_lock);
pthread_rwlock_unlock(&ai.data_lock);
irm_msg__free_unpacked(recv_msg, NULL);
- return -1;
+ return -ENOMEM;
}
ai.flows[fd].set = shm_flow_set_open(recv_msg->api);
@@ -570,7 +570,7 @@ int flow_alloc(const char * dst_name,
pthread_rwlock_unlock(&ai.flows_lock);
pthread_rwlock_unlock(&ai.data_lock);
irm_msg__free_unpacked(recv_msg, NULL);
- return -1;
+ return -ENOMEM;
}
ai.flows[fd].port_id = recv_msg->port_id;