diff options
author | rahul | 2019-10-22 11:28:44 +0530 |
---|---|---|
committer | rahul | 2019-10-22 11:28:44 +0530 |
commit | d472bf02bbb957dafa1227277b0421f52c9d7375 (patch) | |
tree | 1e852cd4ff28e835eaaf009e539334898c50959a /src | |
parent | 76241122c16990ee003df89391c85ee478ea0dca (diff) | |
download | nghdl-d472bf02bbb957dafa1227277b0421f52c9d7375.tar.gz nghdl-d472bf02bbb957dafa1227277b0421f52c9d7375.tar.bz2 nghdl-d472bf02bbb957dafa1227277b0421f52c9d7375.zip |
Multiple models for each instance
Diffstat (limited to 'src')
-rw-r--r-- | src/model_generation.py | 7 | ||||
-rw-r--r-- | src/outitf.c | 19 |
2 files changed, 18 insertions, 8 deletions
diff --git a/src/model_generation.py b/src/model_generation.py index 3df4676..9615f8e 100644 --- a/src/model_generation.py +++ b/src/model_generation.py @@ -241,7 +241,10 @@ client_setup_ip=''' int ip_count = 0; char* my_ip = malloc(16); - fptr = fopen("/tmp/NGHDL_COMMON_IP.txt", "r"); + char ip_filename[40]; + sprintf(ip_filename, "/tmp/NGHDL_COMMON_IP_%d.txt", getpid()); + + fptr = fopen(ip_filename, "r"); if (fptr) { char line[20]; @@ -258,7 +261,7 @@ client_setup_ip=''' sprintf(my_ip, "127.0.%d.1", (ip_count+1)%256); } - fptr = fopen("/tmp/NGHDL_COMMON_IP.txt", "a"); + fptr = fopen(ip_filename, "a"); if (fptr) { fprintf(fptr, "%s\\n", my_ip); diff --git a/src/outitf.c b/src/outitf.c index bedf36d..fba5224 100644 --- a/src/outitf.c +++ b/src/outitf.c @@ -9,6 +9,11 @@ Modified: 2000 AlansFixes, 2013/2015 patch by Krzysztof Blaszkowski * o nghdl_orphan_tb() * o nghdl_tb_SIGUSR1() **************************************************************************/ +/************************************************************************** + * 22.Oct.2019 - RP - Read all the PIDs and send kill signal to all those + * processes. Also, Remove the common file of used IPs and PIDs for this + * Ngspice's instance rather than depending on GHDLServer to do the same. + **************************************************************************/ /* * This module replaces the old "writedata" routines in nutmeg. * Unlike the writedata routines, the OUT routines are only called by @@ -120,7 +125,7 @@ static void nghdl_tb_SIGUSR1(char* pid_file) if (fp) { - /* 15.Oct.2019 - RP - Scan and store all the PIDs in this file */ + /* 22.Oct.2019 - RP - Scan and store all the PIDs in this file */ while (fscanf(fp, "%s", line) == 1) { // PID is converted to a decimal value. @@ -134,7 +139,7 @@ static void nghdl_tb_SIGUSR1(char* pid_file) fclose(fp); } - /* 15.Oct.2019 - RP - Kill all the active PIDs */ + /* 22.Oct.2019 - RP - Kill all the active PIDs */ for(i=0; i<count; i++) { if (pid[i]) @@ -148,7 +153,7 @@ static void nghdl_tb_SIGUSR1(char* pid_file) } } - // 15.Oct.2019 - RP + // 22.Oct.2019 - RP remove(pid_file); } @@ -169,7 +174,7 @@ static void nghdl_orphan_tb(void) return; } -/* Loop through /tmp directories looking for "NGHDL_<my pid>*" files.*/ + /* Loop through /tmp directories looking for "NGHDL_<my pid>*" files.*/ while ((dirp = readdir(dirfd)) != NULL) { struct stat stbuf; @@ -195,8 +200,10 @@ static void nghdl_orphan_tb(void) } } - // 15.Oct.2019 - RP - remove("/tmp/NGHDL_COMMON_IP.txt"); + // 22.Oct.2019 - RP + char ip_filename[40]; + sprintf(ip_filename, "/tmp/NGHDL_COMMON_IP_%d.txt", getpid()); + remove(ip_filename); } /* End 10.Mar.2017 - RM */ |