summaryrefslogtreecommitdiff
path: root/src/irmd
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@ugent.be>2017-08-18 15:56:55 +0200
committerdimitri staessens <dimitri.staessens@ugent.be>2017-08-21 10:25:19 +0200
commit8f58e5a3ec0e4a15fc8ae0911cc864f5dbf86c6e (patch)
tree0535742162921dc0d19c16f5b02d2f1c8f4fc493 /src/irmd
parenteefae235dd7af96eef3dc4f82f706170c379d260 (diff)
downloadouroboros-8f58e5a3ec0e4a15fc8ae0911cc864f5dbf86c6e.tar.gz
ouroboros-8f58e5a3ec0e4a15fc8ae0911cc864f5dbf86c6e.zip
build: Revise the build system
This revises the build system to have configuration per system component. System settings can now be set using cmake. The standard compliance defines were removed from configuration header and are set in the sources where needed. Also some small code refactors, such as moving the data for shims out of the ipcp structure to the respective shims were performed.
Diffstat (limited to 'src/irmd')
-rw-r--r--src/irmd/CMakeLists.txt22
-rw-r--r--src/irmd/api_table.c5
-rw-r--r--src/irmd/config.h.in46
-rw-r--r--src/irmd/ipcp.c5
-rw-r--r--src/irmd/irm_flow.c5
-rw-r--r--src/irmd/main.c8
-rw-r--r--src/irmd/registry.c5
-rw-r--r--src/irmd/registry.h1
-rw-r--r--src/irmd/utils.c3
9 files changed, 92 insertions, 8 deletions
diff --git a/src/irmd/CMakeLists.txt b/src/irmd/CMakeLists.txt
index 930c7b05..3339991a 100644
--- a/src/irmd/CMakeLists.txt
+++ b/src/irmd/CMakeLists.txt
@@ -4,6 +4,28 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${CMAKE_BINARY_DIR}/include)
+set(IRMD_ACCEPT_TIMEOUT 100 CACHE STRING
+ "Timeout for accept in IRMD mainloop threads (ms)")
+set(IRMD_REQ_ARR_TIMEOUT 500 CACHE STRING
+ "Timeout for an application to respond to a new flow (ms)")
+set(IRMD_FLOW_TIMEOUT 5000 CACHE STRING
+ "Timeout for a flow allocation response (ms)")
+set(BOOTSTRAP_TIMEOUT 5000 CACHE STRING
+ "Timeout for an IPCP to bootstrap (ms)")
+set(ENROLL_TIMEOUT 60000 CACHE STRING
+ "Timeout for an IPCP to enroll (ms)")
+set(REG_TIMEOUT 10000 CACHE STRING
+ "Timeout for registering a name (ms)")
+set(QUERY_TIMEOUT 3000 CACHE STRING
+ "Timeout to query a name with an IPCP (ms)")
+set(IRMD_MIN_THREADS 8 CACHE STRING
+ "Minimum number of worker threads in the IRMd.")
+set(IRMD_ADD_THREADS 8 CACHE STRING
+ "Number of extra threads to start when the IRMD faces thread starvation")
+
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/config.h" @ONLY)
+
set(SOURCE_FILES
# Add source files here
api_table.c
diff --git a/src/irmd/api_table.c b/src/irmd/api_table.c
index 5765916e..df56dd02 100644
--- a/src/irmd/api_table.c
+++ b/src/irmd/api_table.c
@@ -20,7 +20,10 @@
* Foundation, Inc., http://www.fsf.org/about/contact/.
*/
-#include <ouroboros/config.h>
+#define _POSIX_C_SOURCE 200112L
+
+#include "config.h"
+
#include <ouroboros/list.h>
#include <ouroboros/errno.h>
#include <ouroboros/time_utils.h>
diff --git a/src/irmd/config.h.in b/src/irmd/config.h.in
new file mode 100644
index 00000000..eb396bbc
--- /dev/null
+++ b/src/irmd/config.h.in
@@ -0,0 +1,46 @@
+/*
+ * Ouroboros - Copyright (C) 2016 - 2017
+ *
+ * Configuration for the IPC Resource Manager
+ *
+ * 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
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., http://www.fsf.org/about/contact/.
+ */
+
+#define IPCP_SHIM_UDP_EXEC "@IPCP_SHIM_UDP_TARGET@"
+#define IPCP_SHIM_ETH_LLC_EXEC "@IPCP_SHIM_ETH_LLC_TARGET@"
+#define IPCP_NORMAL_EXEC "@IPCP_NORMAL_TARGET@"
+#define IPCP_LOCAL_EXEC "@IPCP_LOCAL_TARGET@"
+
+#define INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@"
+
+#define PTHREAD_COND_CLOCK @PTHREAD_COND_CLOCK@
+
+#define SOCKET_TIMEOUT @SOCKET_TIMEOUT@
+
+#define IRMD_ACCEPT_TIMEOUT @IRMD_ACCEPT_TIMEOUT@
+#define IRMD_REQ_ARR_TIMEOUT @IRMD_REQ_ARR_TIMEOUT@
+#define IRMD_FLOW_TIMEOUT @IRMD_FLOW_TIMEOUT@
+
+#define BOOTSTRAP_TIMEOUT @BOOTSTRAP_TIMEOUT@
+#define ENROLL_TIMEOUT @ENROLL_TIMEOUT@
+#define REG_TIMEOUT @REG_TIMEOUT@
+#define QUERY_TIMEOUT @QUERY_TIMEOUT@
+
+#define SYS_MAX_FLOWS @SYS_MAX_FLOWS@
+
+#define IRMD_MIN_THREADS @IRMD_MIN_THREADS@
+#define IRMD_ADD_THREADS @IRMD_ADD_THREADS@
diff --git a/src/irmd/ipcp.c b/src/irmd/ipcp.c
index f3f97811..b8f11508 100644
--- a/src/irmd/ipcp.c
+++ b/src/irmd/ipcp.c
@@ -20,9 +20,12 @@
* Foundation, Inc., http://www.fsf.org/about/contact/.
*/
+#define _POSIX_C_SOURCE 199309L
+
+#include "config.h"
+
#define OUROBOROS_PREFIX "irmd/ipcp"
-#include <ouroboros/config.h>
#include <ouroboros/logs.h>
#include <ouroboros/errno.h>
#include <ouroboros/utils.h>
diff --git a/src/irmd/irm_flow.c b/src/irmd/irm_flow.c
index ae5585a2..e335ef48 100644
--- a/src/irmd/irm_flow.c
+++ b/src/irmd/irm_flow.c
@@ -20,9 +20,12 @@
* Foundation, Inc., http://www.fsf.org/about/contact/.
*/
+#define _POSIX_C_SOURCE 199309L
+
+#include "config.h"
+
#define OUROBOROS_PREFIX "irm_flow"
-#include <ouroboros/config.h>
#include <ouroboros/errno.h>
#include <ouroboros/logs.h>
#include <ouroboros/time_utils.h>
diff --git a/src/irmd/main.c b/src/irmd/main.c
index 0c157fd4..4818aa5e 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -20,9 +20,13 @@
* Foundation, Inc., http://www.fsf.org/about/contact/.
*/
+#define _POSIX_C_SOURCE 200812L
+#define __XSI_VISIBLE 500
+
+#include "config.h"
+
#define OUROBOROS_PREFIX "irmd"
-#include <ouroboros/config.h>
#include <ouroboros/hash.h>
#include <ouroboros/errno.h>
#include <ouroboros/sockets.h>
@@ -2052,7 +2056,7 @@ static int irm_init(void)
list_head_init(&irmd.registry);
list_head_init(&irmd.irm_flows);
- irmd.port_ids = bmp_create(IRMD_MAX_FLOWS, 0);
+ irmd.port_ids = bmp_create(SYS_MAX_FLOWS, 0);
if (irmd.port_ids == NULL) {
log_err("Failed to create port_ids bitmap.");
goto fail_port_ids;
diff --git a/src/irmd/registry.c b/src/irmd/registry.c
index ad6a10d4..3cc9b5f5 100644
--- a/src/irmd/registry.c
+++ b/src/irmd/registry.c
@@ -20,9 +20,12 @@
* Foundation, Inc., http://www.fsf.org/about/contact/.
*/
+#define _POSIX_C_SOURCE 200809L
+
+#include "config.h"
+
#define OUROBOROS_PREFIX "registry"
-#include <ouroboros/config.h>
#include <ouroboros/errno.h>
#include <ouroboros/logs.h>
#include <ouroboros/irm.h>
diff --git a/src/irmd/registry.h b/src/irmd/registry.h
index d1733f6c..486843a2 100644
--- a/src/irmd/registry.h
+++ b/src/irmd/registry.h
@@ -23,7 +23,6 @@
#ifndef OUROBOROS_IRMD_REGISTRY_H
#define OUROBOROS_IRMD_REGISTRY_H
-#include <ouroboros/config.h>
#include <ouroboros/hash.h>
#include <ouroboros/ipcp.h>
#include <ouroboros/list.h>
diff --git a/src/irmd/utils.c b/src/irmd/utils.c
index 5a3da732..08699a05 100644
--- a/src/irmd/utils.c
+++ b/src/irmd/utils.c
@@ -20,7 +20,8 @@
* Foundation, Inc., http://www.fsf.org/about/contact/.
*/
-#include <ouroboros/config.h>
+#define _POSIX_C_SOURCE 200809L
+
#include <stdlib.h>
#include <string.h>