From 34bcd67e4811be85e11253e4176ec9fec5c3bbef Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Wed, 22 Jun 2016 16:29:27 +0200 Subject: lib: Remove implementation specific errnos This removes any implementation specific error numbers. Only errors that are implementation independent should be returned. --- include/ouroboros/errno.h | 6 ++---- src/lib/dev.c | 20 ++++++++++---------- src/lib/irm.c | 12 ++++++------ 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/include/ouroboros/errno.h b/include/ouroboros/errno.h index 49720548..62629134 100644 --- a/include/ouroboros/errno.h +++ b/include/ouroboros/errno.h @@ -25,9 +25,7 @@ #include -#define ENOSHM 1000 /* Creation or access of shared memory failed */ -#define EIRM 1001 /* Could not talk to the IPC Resource Manager */ -#define ENOTALLOC 1002 /* Flow is not allocated */ -#define EIPCPTYPE 1003 /* Unknown IPCP type */ +#define ENOTALLOC 1000 /* Flow is not allocated */ +#define EIPCPTYPE 1001 /* Unknown IPCP type */ #endif diff --git a/src/lib/dev.c b/src/lib/dev.c index d0f29ade..ad311f7f 100644 --- a/src/lib/dev.c +++ b/src/lib/dev.c @@ -92,7 +92,7 @@ int ap_init(char * ap_name) instance_name_destroy(_ap_instance->api); bmp_destroy(_ap_instance->fds); free(_ap_instance); - return -ENOSHM; + return -1; } _ap_instance->rb = shm_ap_rbuff_create(); @@ -101,7 +101,7 @@ int ap_init(char * ap_name) shm_du_map_close(_ap_instance->dum); bmp_destroy(_ap_instance->fds); free(_ap_instance); - return -ENOSHM; + return -1; } for (i = 0; i < AP_MAX_FLOWS; ++i) { @@ -175,7 +175,7 @@ int flow_accept(char ** ae_name) recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) { - return -EIRM; + return -1; } if (!recv_msg->has_pid || !recv_msg->has_port_id) { @@ -200,7 +200,7 @@ int flow_accept(char ** ae_name) pthread_rwlock_unlock(&_ap_instance->flows_lock); pthread_rwlock_unlock(&_ap_instance->data_lock); irm_msg__free_unpacked(recv_msg, NULL); - return -ENOSHM; + return -1; } if (ae_name != NULL) { @@ -260,7 +260,7 @@ int flow_alloc_resp(int fd, recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) { pthread_rwlock_unlock(&_ap_instance->data_lock); - return -EIRM; + return -1; } if (!recv_msg->has_result) { @@ -305,7 +305,7 @@ int flow_alloc(char * dst_name, recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) { - return -EIRM; + return -1; } if (!recv_msg->has_pid || !recv_msg->has_port_id) { @@ -330,7 +330,7 @@ int flow_alloc(char * dst_name, pthread_rwlock_unlock(&_ap_instance->flows_lock); pthread_rwlock_unlock(&_ap_instance->data_lock); irm_msg__free_unpacked(recv_msg, NULL); - return -ENOSHM; + return -1; } _ap_instance->flows[fd].port_id = recv_msg->port_id; @@ -372,7 +372,7 @@ int flow_alloc_res(int fd) recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) { - return -EIRM; + return -1; } if (!recv_msg->has_result) { @@ -418,7 +418,7 @@ int flow_dealloc(int fd) recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) { pthread_rwlock_unlock(&_ap_instance->data_lock); - return -EIRM; + return -1; } if (!recv_msg->has_result) { @@ -511,7 +511,7 @@ ssize_t flow_write(int fd, void * buf, size_t count) shm_release_du_buff(_ap_instance->dum, index); pthread_rwlock_unlock(&_ap_instance->flows_lock); pthread_rwlock_unlock(&_ap_instance->data_lock); - return -ENOSHM; + return -1; } } else { /* blocking */ while ((index = shm_create_du_buff(_ap_instance->dum, diff --git a/src/lib/irm.c b/src/lib/irm.c index 01ee498c..8fd0a7e7 100644 --- a/src/lib/irm.c +++ b/src/lib/irm.c @@ -48,7 +48,7 @@ pid_t irm_create_ipcp(char * ipcp_name, recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) - return -EIRM; + return -1; if (recv_msg->has_result == false) { irm_msg__free_unpacked(recv_msg, NULL); @@ -77,7 +77,7 @@ int irm_destroy_ipcp(instance_name_t * api) recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) - return -EIRM; + return -1; if (recv_msg->has_result == false) { irm_msg__free_unpacked(recv_msg, NULL); @@ -149,7 +149,7 @@ int irm_bootstrap_ipcp(instance_name_t * api, recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) { - return -EIRM; + return -1; } if (recv_msg->has_result == false) { @@ -188,7 +188,7 @@ int irm_enroll_ipcp(instance_name_t * api, recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) { free(msg.dif_name); - return -EIRM; + return -1; } if (recv_msg->has_result == false) { @@ -239,7 +239,7 @@ int irm_reg(char * name, recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) - return -EIRM; + return -1; if (recv_msg->has_result == false) { irm_msg__free_unpacked(recv_msg, NULL); @@ -285,7 +285,7 @@ int irm_unreg(char * name, recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) - return -EIRM; + return -1; if (recv_msg->has_result == false) { irm_msg__free_unpacked(recv_msg, NULL); -- cgit v1.2.3