summaryrefslogtreecommitdiff
path: root/src/irmd/main.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@intec.ugent.be>2016-03-15 15:48:52 +0100
committerDimitri Staessens <dimitri.staessens@intec.ugent.be>2016-03-15 15:48:52 +0100
commit04bf4380b30b58252d1d2aab75a9dcc5c084c831 (patch)
treea33ce52d5b71f49c75bc7de3f9549d6257b259e1 /src/irmd/main.c
parentceaea65296a9cb6e2235b0dd429ab3d590b634d3 (diff)
parent7ca8145790db15d7da3c2f1b260ad3421993b67c (diff)
downloadouroboros-04bf4380b30b58252d1d2aab75a9dcc5c084c831.tar.gz
ouroboros-04bf4380b30b58252d1d2aab75a9dcc5c084c831.zip
Merge branch 'be' of bitbucket.org:ouroboros-rina/ouroboros into b-du_buff
Diffstat (limited to 'src/irmd/main.c')
-rw-r--r--src/irmd/main.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c
index 9a072382..b695519a 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -38,7 +38,7 @@
struct name_to_pid_entry {
struct list_head next;
- int pid;
+ pid_t pid;
rina_name_t * name;
};
@@ -46,8 +46,8 @@ struct irm {
struct list_head name_to_pid;
};
-static int find_pid_by_name(struct irm * instance,
- rina_name_t * name)
+static pid_t find_pid_by_name(struct irm * instance,
+ rina_name_t * name)
{
struct list_head * pos;
@@ -68,11 +68,11 @@ static void create_ipcp(struct irm * instance,
rina_name_t name,
char * ipcp_type)
{
- int pid;
+ pid_t pid;
struct name_to_pid_entry * tmp;
pid = ipcp_create(name, ipcp_type);
- if (pid == 0) {
+ if (pid == -1) {
LOG_ERR("Failed to create IPCP");
return;
}
@@ -90,14 +90,17 @@ static void create_ipcp(struct irm * instance,
return;
}
+ LOG_DBG("Created IPC process with pid %d", pid);
+
list_add(&tmp->next, &instance->name_to_pid);
}
static void destroy_ipcp(struct irm * instance,
rina_name_t name)
{
- int pid = 0;
+ pid_t pid = 0;
struct list_head * pos;
+ struct list_head * n;
pid = find_pid_by_name(instance, &name);
if (pid == 0) {
@@ -105,10 +108,12 @@ static void destroy_ipcp(struct irm * instance,
return;
}
+ LOG_DBG("Destroying ipcp with pid %d", pid);
+
if (ipcp_destroy(pid))
LOG_ERR("Could not destroy IPCP");
- list_for_each(pos, &instance->name_to_pid) {
+ list_for_each_safe(pos, n, &(instance->name_to_pid)) {
struct name_to_pid_entry * tmp =
list_entry(pos, struct name_to_pid_entry, next);
@@ -121,7 +126,7 @@ static void bootstrap_ipcp(struct irm * instance,
rina_name_t name,
struct dif_config conf)
{
- int pid = 0;
+ pid_t pid = 0;
pid = find_pid_by_name(instance, &name);
if (pid == 0) {
@@ -137,7 +142,7 @@ static void enroll_ipcp(struct irm * instance,
rina_name_t name,
char * dif_name)
{
- int pid = 0;
+ pid_t pid = 0;
rina_name_t * member;
char ** n_1_difs = NULL;
ssize_t n_1_difs_size = 0;
@@ -166,7 +171,7 @@ static void reg_ipcp(struct irm * instance,
char ** difs,
size_t difs_size)
{
- int pid = 0;
+ pid_t pid = 0;
pid = find_pid_by_name(instance, &name);
if (pid == 0) {
@@ -183,7 +188,7 @@ static void unreg_ipcp(struct irm * instance,
char ** difs,
size_t difs_size)
{
- int pid = 0;
+ pid_t pid = 0;
pid = find_pid_by_name(instance, &name);
if (pid == 0) {