summaryrefslogtreecommitdiff
path: root/src/ipcpd/shim-udp
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-04-26 14:42:05 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-04-26 14:42:05 +0200
commit6be9ae98877f23b05f69e6006036fec0f6c9d338 (patch)
tree4ff4fe417d021c67d9173b4add47c4f2b3403f30 /src/ipcpd/shim-udp
parenta5e2a4cb3ce7bb47ce6b0ad74f11f062bde40e1d (diff)
downloadouroboros-6be9ae98877f23b05f69e6006036fec0f6c9d338.tar.gz
ouroboros-6be9ae98877f23b05f69e6006036fec0f6c9d338.zip
lib: instance ID's are now set to the process PID
All instance-id's in ouroboros will be set by the system to the pid of the process associated with this application process instance. This means that the user has no way to choose the instance id's. Function calls that assumed manually defined instance id's have been replaced throughout the system.
Diffstat (limited to 'src/ipcpd/shim-udp')
-rw-r--r--src/ipcpd/shim-udp/main.c29
-rw-r--r--src/ipcpd/shim-udp/tests/shim_udp_test.c3
2 files changed, 7 insertions, 25 deletions
diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c
index f67c66ca..785f2344 100644
--- a/src/ipcpd/shim-udp/main.c
+++ b/src/ipcpd/shim-udp/main.c
@@ -96,7 +96,7 @@ void ipcp_sig_handler(int sig, siginfo_t * info, void * c)
case SIGHUP:
LOG_DBG("Terminating by order of %d. Bye.", info->si_pid);
if (info->si_pid == irmd_pid) {
- shm_du_map_close(_ipcp->data->dum);
+ /* shm_du_map_close(_ipcp->data->dum); */
exit(0);
}
default:
@@ -104,29 +104,13 @@ void ipcp_sig_handler(int sig, siginfo_t * info, void * c)
}
}
-struct ipcp_udp_data * ipcp_udp_data_create(char * ap_name,
- char * ap_id)
+struct ipcp_udp_data * ipcp_udp_data_create(char * ap_name)
{
struct ipcp_udp_data * udp_data;
struct ipcp_data * data;
- instance_name_t * instance_name;
enum ipcp_type ipcp_type;
int n;
- instance_name = instance_name_create();
- if (instance_name == NULL) {
- LOG_ERR("Failed to create instance name struct.");
- return NULL;
- }
-
- instance_name = instance_name_init_with(
- instance_name, ap_name, (uint16_t) atoi(ap_id));
-
- if (instance_name == NULL) {
- LOG_ERR("Failed to create instance name struct.");
- return NULL;
- }
-
udp_data = malloc(sizeof *udp_data);
if (udp_data == NULL) {
LOG_DBGF("Failed to allocate.");
@@ -135,7 +119,7 @@ struct ipcp_udp_data * ipcp_udp_data_create(char * ap_name,
ipcp_type = THIS_TYPE;
data = (struct ipcp_data *) udp_data;
- if (ipcp_data_init(data, instance_name, ipcp_type) == NULL) {
+ if (ipcp_data_init(data, ap_name, ipcp_type) == NULL) {
free(udp_data);
return NULL;
}
@@ -548,7 +532,7 @@ int ipcp_udp_du_read(uint32_t port_id,
return 0;
}
-struct ipcp * ipcp_udp_create(char * ap_name, char * i_id)
+struct ipcp * ipcp_udp_create(char * ap_name)
{
struct ipcp * i;
struct ipcp_udp_data * data;
@@ -558,7 +542,7 @@ struct ipcp * ipcp_udp_create(char * ap_name, char * i_id)
if (i == NULL)
return NULL;
- data = ipcp_udp_data_create(ap_name, i_id);
+ data = ipcp_udp_data_create(ap_name);
if (data == NULL) {
free(i);
return NULL;
@@ -597,7 +581,6 @@ int main (int argc, char * argv[])
{
/* argument 1: pid of irmd ? */
/* argument 2: ap name */
- /* argument 3: instance id */
struct sigaction sig_act;
if (ipcp_arg_check(argc, argv)) {
@@ -619,7 +602,7 @@ int main (int argc, char * argv[])
sigaction(SIGTERM, &sig_act, NULL);
sigaction(SIGHUP, &sig_act, NULL);
- _ipcp = ipcp_udp_create(argv[2], argv[3]);
+ _ipcp = ipcp_udp_create(argv[2]);
if (_ipcp == NULL) {
LOG_ERR("Won't.");
exit(1);
diff --git a/src/ipcpd/shim-udp/tests/shim_udp_test.c b/src/ipcpd/shim-udp/tests/shim_udp_test.c
index 0fcf9f4d..4e0c2dd6 100644
--- a/src/ipcpd/shim-udp/tests/shim_udp_test.c
+++ b/src/ipcpd/shim-udp/tests/shim_udp_test.c
@@ -39,7 +39,6 @@ int shim_udp_test(int argc, char ** argv)
/* argument 3: instance id */
struct shm_du_map * dum;
char * ipcp_name = "test-shim-ipcp";
- char * i_id = "1";
int i = 0;
char bogus[15];
@@ -57,7 +56,7 @@ int shim_udp_test(int argc, char ** argv)
exit(1);
}
- _ipcp = ipcp_udp_create(ipcp_name, i_id);
+ _ipcp = ipcp_udp_create(ipcp_name);
if (_ipcp == NULL) {
LOG_ERR("Could not instantiate shim IPCP.");
shm_du_map_close(dum);