summaryrefslogtreecommitdiff
path: root/src/irmd
diff options
context:
space:
mode:
Diffstat (limited to 'src/irmd')
-rw-r--r--src/irmd/CMakeLists.txt22
-rw-r--r--src/irmd/api_table.c3
-rw-r--r--src/irmd/api_table.h3
-rw-r--r--src/irmd/apn_table.c3
-rw-r--r--src/irmd/apn_table.h3
-rw-r--r--src/irmd/ipcp.c7
-rw-r--r--src/irmd/ipcp.h4
-rw-r--r--src/irmd/irm_flow.c3
-rw-r--r--src/irmd/irm_flow.h3
-rw-r--r--src/irmd/main.c65
-rw-r--r--src/irmd/registry.c4
-rw-r--r--src/irmd/registry.h4
-rw-r--r--src/irmd/utils.c4
-rw-r--r--src/irmd/utils.h4
14 files changed, 65 insertions, 67 deletions
diff --git a/src/irmd/CMakeLists.txt b/src/irmd/CMakeLists.txt
index 16b53414..930c7b05 100644
--- a/src/irmd/CMakeLists.txt
+++ b/src/irmd/CMakeLists.txt
@@ -5,23 +5,23 @@ include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${CMAKE_BINARY_DIR}/include)
set(SOURCE_FILES
- # Add source files here
- api_table.c
- apn_table.c
- ipcp.c
- irm_flow.c
- main.c
- registry.c
- utils.c
-)
+ # Add source files here
+ api_table.c
+ apn_table.c
+ ipcp.c
+ irm_flow.c
+ main.c
+ registry.c
+ utils.c
+ )
add_executable (irmd ${SOURCE_FILES})
target_link_libraries (irmd LINK_PUBLIC ouroboros)
-include(MacroAddCompileFlags)
+include(AddCompileFlags)
if (CMAKE_BUILD_TYPE MATCHES Debug)
- MACRO_ADD_COMPILE_FLAGS(irmd -DCONFIG_OUROBOROS_DEBUG)
+ add_compile_flags(irmd -DCONFIG_OUROBOROS_DEBUG)
endif (CMAKE_BUILD_TYPE MATCHES Debug)
install(TARGETS irmd RUNTIME DESTINATION sbin)
diff --git a/src/irmd/api_table.c b/src/irmd/api_table.c
index 83153aac..3b80ac91 100644
--- a/src/irmd/api_table.c
+++ b/src/irmd/api_table.c
@@ -3,7 +3,8 @@
*
* The IPC Resource Manager - Application Instance Table
*
- * Dimitri Staessens <dimitri.staessens@intec.ugent.be>
+ * Dimitri Staessens <dimitri.staessens@ugent.be>
+ * Sander Vrijders <sander.vrijders@ugent.be>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
diff --git a/src/irmd/api_table.h b/src/irmd/api_table.h
index df788bbc..c7998c7f 100644
--- a/src/irmd/api_table.h
+++ b/src/irmd/api_table.h
@@ -3,7 +3,8 @@
*
* The IPC Resource Manager - Application Instance Table
*
- * Dimitri Staessens <dimitri.staessens@intec.ugent.be>
+ * Dimitri Staessens <dimitri.staessens@ugent.be>
+ * Sander Vrijders <sander.vrijders@ugent.be>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
diff --git a/src/irmd/apn_table.c b/src/irmd/apn_table.c
index 955618d8..d265e2f0 100644
--- a/src/irmd/apn_table.c
+++ b/src/irmd/apn_table.c
@@ -3,7 +3,8 @@
*
* The IPC Resource Manager - Application Process Table
*
- * Dimitri Staessens <dimitri.staessens@intec.ugent.be>
+ * Dimitri Staessens <dimitri.staessens@ugent.be>
+ * Sander Vrijders <sander.vrijders@ugent.be>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
diff --git a/src/irmd/apn_table.h b/src/irmd/apn_table.h
index 550012bf..311c0f3d 100644
--- a/src/irmd/apn_table.h
+++ b/src/irmd/apn_table.h
@@ -3,7 +3,8 @@
*
* The IPC Resource Manager - Application Process Names Table
*
- * Dimitri Staessens <dimitri.staessens@intec.ugent.be>
+ * Dimitri Staessens <dimitri.staessens@ugent.be>
+ * Sander Vrijders <sander.vrijders@ugent.be>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
diff --git a/src/irmd/ipcp.c b/src/irmd/ipcp.c
index dcf77eec..06b66d3b 100644
--- a/src/irmd/ipcp.c
+++ b/src/irmd/ipcp.c
@@ -3,7 +3,8 @@
*
* The API to instruct IPCPs
*
- * Sander Vrijders <sander.vrijders@intec.ugent.be>
+ * Dimitri Staessens <dimitri.staessens@ugent.be>
+ * Sander Vrijders <sander.vrijders@ugent.be>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -328,14 +329,13 @@ int ipcp_flow_alloc(pid_t api,
int port_id,
pid_t n_api,
char * dst_name,
- char * src_ae_name,
qoscube_t cube)
{
ipcp_msg_t msg = IPCP_MSG__INIT;
ipcp_msg_t * recv_msg = NULL;
int ret = -1;
- if (dst_name == NULL || src_ae_name == NULL)
+ if (dst_name == NULL)
return -EINVAL;
msg.code = IPCP_MSG_CODE__IPCP_FLOW_ALLOC;
@@ -343,7 +343,6 @@ int ipcp_flow_alloc(pid_t api,
msg.port_id = port_id;
msg.has_api = true;
msg.api = n_api;
- msg.src_ae_name = src_ae_name;
msg.dst_name = dst_name;
msg.has_qoscube = true;
msg.qoscube = cube;
diff --git a/src/irmd/ipcp.h b/src/irmd/ipcp.h
index 658aa2ea..bb868191 100644
--- a/src/irmd/ipcp.h
+++ b/src/irmd/ipcp.h
@@ -3,7 +3,8 @@
*
* The API for the IRM to instruct IPCPs
*
- * Sander Vrijders <sander.vrijders@intec.ugent.be>
+ * Dimitri Staessens <dimitri.staessens@ugent.be>
+ * Sander Vrijders <sander.vrijders@ugent.be>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -52,7 +53,6 @@ int ipcp_flow_alloc(pid_t api,
int port_id,
pid_t n_api,
char * dst_name,
- char * src_ae_name,
qoscube_t qos);
int ipcp_flow_alloc_resp(pid_t api,
diff --git a/src/irmd/irm_flow.c b/src/irmd/irm_flow.c
index d2482391..20d2511c 100644
--- a/src/irmd/irm_flow.c
+++ b/src/irmd/irm_flow.c
@@ -3,7 +3,8 @@
*
* The IPC Resource Manager - Flows
*
- * Dimitri Staessens <dimitri.staessens@intec.ugent.be>
+ * Dimitri Staessens <dimitri.staessens@ugent.be>
+ * Sander Vrijders <sander.vrijders@ugent.be>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
diff --git a/src/irmd/irm_flow.h b/src/irmd/irm_flow.h
index dc60d139..9a439204 100644
--- a/src/irmd/irm_flow.h
+++ b/src/irmd/irm_flow.h
@@ -3,7 +3,8 @@
*
* The IPC Resource Manager - Flows
*
- * Dimitri Staessens <dimitri.staessens@intec.ugent.be>
+ * Dimitri Staessens <dimitri.staessens@ugent.be>
+ * Sander Vrijders <sander.vrijders@ugent.be>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
diff --git a/src/irmd/main.c b/src/irmd/main.c
index cc13ccea..9eb34f38 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -3,8 +3,8 @@
*
* The IPC Resource Manager
*
- * Dimitri Staessens <dimitri.staessens@intec.ugent.be>
- * Sander Vrijders <sander.vrijders@intec.ugent.be>
+ * Dimitri Staessens <dimitri.staessens@ugent.be>
+ * Sander Vrijders <sander.vrijders@ugent.be>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -976,7 +976,6 @@ static int api_announce(pid_t api,
}
static struct irm_flow * flow_accept(pid_t api,
- char ** dst_ae_name,
qoscube_t * cube)
{
struct irm_flow * f = NULL;
@@ -999,8 +998,10 @@ static struct irm_flow * flow_accept(pid_t api,
log_err("Unknown instance %d calling accept.", api);
return NULL;
}
+
log_dbg("New instance (%d) of %s added.", api, e->apn);
log_dbg("This instance accepts flows for:");
+
list_for_each(p, &e->names) {
struct str_el * s = list_entry(p, struct str_el, next);
log_dbg(" %s", s->str);
@@ -1064,9 +1065,6 @@ static struct irm_flow * flow_accept(pid_t api,
*cube = re->qos;
- if (dst_ae_name != NULL)
- *dst_ae_name = re->req_ae_name;
-
log_info("Flow on port_id %d allocated.", f->port_id);
pthread_rwlock_unlock(&irmd->flows_lock);
@@ -1148,7 +1146,6 @@ static int flow_alloc_resp(pid_t n_api,
static struct irm_flow * flow_alloc(pid_t api,
char * dst_name,
- char * src_ae_name,
qoscube_t cube)
{
struct irm_flow * f;
@@ -1197,7 +1194,7 @@ static struct irm_flow * flow_alloc(pid_t api,
pthread_rwlock_unlock(&irmd->state_lock);
if (ipcp_flow_alloc(ipcp, port_id, api,
- dst_name, src_ae_name, cube) < 0) {
+ dst_name, cube) < 0) {
pthread_rwlock_rdlock(&irmd->state_lock);
pthread_rwlock_wrlock(&irmd->flows_lock);
list_del(&f->next);
@@ -1348,7 +1345,6 @@ static pid_t auto_execute(char ** argv)
static struct irm_flow * flow_req_arr(pid_t api,
char * dst_name,
- char * ae_name,
qoscube_t cube)
{
struct reg_entry * re = NULL;
@@ -1363,8 +1359,7 @@ static struct irm_flow * flow_req_arr(pid_t api,
struct timespec wt = {IRMD_REQ_ARR_TIMEOUT / 1000,
(IRMD_REQ_ARR_TIMEOUT % 1000) * MILLION};
- log_dbg("Flow req arrived from IPCP %d for %s on AE %s.",
- api, dst_name, ae_name);
+ log_dbg("Flow req arrived from IPCP %d for %s.", api, dst_name);
pthread_rwlock_rdlock(&irmd->state_lock);
pthread_rwlock_rdlock(&irmd->reg_lock);
@@ -1469,7 +1464,6 @@ static struct irm_flow * flow_req_arr(pid_t api,
pthread_rwlock_unlock(&irmd->flows_lock);
pthread_rwlock_rdlock(&irmd->reg_lock);
- re->req_ae_name = ae_name;
re->qos = cube;
reg_entry_set_state(re, REG_NAME_FLOW_ARRIVED);
@@ -1926,7 +1920,6 @@ void * mainloop(void * o)
case IRM_MSG_CODE__IRM_FLOW_ACCEPT:
ret_msg.has_qoscube = true;
e = flow_accept(msg->api,
- &ret_msg.ae_name,
(qoscube_t *) &ret_msg.qoscube);
if (e == NULL) {
ret_msg.has_result = true;
@@ -1947,7 +1940,6 @@ void * mainloop(void * o)
case IRM_MSG_CODE__IRM_FLOW_ALLOC:
e = flow_alloc(msg->api,
msg->dst_name,
- msg->ae_name,
msg->qoscube);
if (e == NULL) {
ret_msg.has_result = true;
@@ -1970,7 +1962,6 @@ void * mainloop(void * o)
case IRM_MSG_CODE__IPCP_FLOW_REQ_ARR:
e = flow_req_arr(msg->api,
msg->dst_name,
- msg->ae_name,
msg->qoscube);
if (e == NULL) {
ret_msg.has_result = true;
@@ -2077,6 +2068,28 @@ static int irm_create(void)
return -ENOMEM;
}
+ if ((irmd->lf = lockfile_create()) == NULL) {
+ if ((irmd->lf = lockfile_open()) == NULL) {
+ log_err("Lockfile error.");
+ irm_destroy();
+ return -1;
+ }
+
+ if (kill(lockfile_owner(irmd->lf), 0) < 0) {
+ log_info("IRMd didn't properly shut down last time.");
+ shm_rdrbuff_destroy(shm_rdrbuff_open());
+ log_info("Stale resources cleaned.");
+ lockfile_destroy(irmd->lf);
+ irmd->lf = lockfile_create();
+ } else {
+ log_info("IRMd already running (%d), exiting.",
+ lockfile_owner(irmd->lf));
+ lockfile_close(irmd->lf);
+ free(irmd);
+ return -1;
+ }
+ }
+
if (stat(SOCK_PATH, &st) == -1) {
if (mkdir(SOCK_PATH, 0777)) {
log_err("Failed to create sockets directory.");
@@ -2104,28 +2117,6 @@ static int irm_create(void)
return -1;
}
- if ((irmd->lf = lockfile_create()) == NULL) {
- if ((irmd->lf = lockfile_open()) == NULL) {
- log_err("Lockfile error.");
- irm_destroy();
- return -1;
- }
-
- if (kill(lockfile_owner(irmd->lf), 0) < 0) {
- log_info("IRMd didn't properly shut down last time.");
- shm_rdrbuff_destroy(shm_rdrbuff_open());
- log_info("Stale resources cleaned.");
- lockfile_destroy(irmd->lf);
- irmd->lf = lockfile_create();
- } else {
- log_info("IRMd already running (%d), exiting.",
- lockfile_owner(irmd->lf));
- lockfile_close(irmd->lf);
- free(irmd);
- return -1;
- }
- }
-
if (irmd->lf == NULL) {
irm_destroy();
return -1;
diff --git a/src/irmd/registry.c b/src/irmd/registry.c
index 9512d664..a4588963 100644
--- a/src/irmd/registry.c
+++ b/src/irmd/registry.c
@@ -3,7 +3,8 @@
*
* The IPC Resource Manager - Registry
*
- * Dimitri Staessens <dimitri.staessens@intec.ugent.be>
+ * Dimitri Staessens <dimitri.staessens@ugent.be>
+ * Sander Vrijders <sander.vrijders@ugent.be>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -52,7 +53,6 @@ static struct reg_entry * reg_entry_create(void)
e->name = NULL;
e->state = REG_NAME_NULL;
- e->req_ae_name = NULL;
e->response = -1;
return e;
diff --git a/src/irmd/registry.h b/src/irmd/registry.h
index 67e4da40..cf4ea432 100644
--- a/src/irmd/registry.h
+++ b/src/irmd/registry.h
@@ -3,7 +3,8 @@
*
* The IPC Resource Manager - Registry
*
- * Dimitri Staessens <dimitri.staessens@intec.ugent.be>
+ * Dimitri Staessens <dimitri.staessens@ugent.be>
+ * Sander Vrijders <sander.vrijders@ugent.be>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -62,7 +63,6 @@ struct reg_entry {
struct list_head reg_apis;
enum reg_name_state state;
- char * req_ae_name;
qoscube_t qos;
int response;
pthread_cond_t state_cond;
diff --git a/src/irmd/utils.c b/src/irmd/utils.c
index 7d63f020..97193b53 100644
--- a/src/irmd/utils.c
+++ b/src/irmd/utils.c
@@ -3,8 +3,8 @@
*
* The IPC Resource Manager - Utilities
*
- * Dimitri Staessens <dimitri.staessens@intec.ugent.be>
- * Sander Vrijders <sander.vrijders@intec.ugent.be>
+ * Dimitri Staessens <dimitri.staessens@ugent.be>
+ * Sander Vrijders <sander.vrijders@ugent.be>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
diff --git a/src/irmd/utils.h b/src/irmd/utils.h
index 03296259..36ec3d8e 100644
--- a/src/irmd/utils.h
+++ b/src/irmd/utils.h
@@ -3,7 +3,8 @@
*
* Utils of the IPC Resource Manager
*
- * Sander Vrijders <sander.vrijders@intec.ugent.be>
+ * Dimitri Staessens <dimitri.staessens@ugent.be>
+ * Sander Vrijders <sander.vrijders@ugent.be>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -44,6 +45,7 @@ int wildcard_match(const char * pattern,
/* functions for copying and destroying arguments list */
char ** argvdup(char ** argv);
+
void argvfree(char ** argv);
#endif /* OUROBOROS_IRM_UTILS_H */