From a815a56e5bae8df3d467ddc3e43f3d26e8bfbeb8 Mon Sep 17 00:00:00 2001 From: Bladen Martin Date: Thu, 28 May 2020 22:20:01 +0530 Subject: change to outitf.c, to iterate all the IPs and ports and send close message to all the ghdl-server --- src/outitf.c | 148 +++++++++++++++++++++-------------------------------------- 1 file changed, 53 insertions(+), 95 deletions(-) (limited to 'src') diff --git a/src/outitf.c b/src/outitf.c index fba5224..9a656c1 100644 --- a/src/outitf.c +++ b/src/outitf.c @@ -49,6 +49,12 @@ Modified: 2000 AlansFixes, 2013/2015 patch by Krzysztof Blaszkowski #include #include #include +// 27.May.2020 - BM - Added the following #include +#include +#include +#include +#include +#include extern char *spice_analysis_get_name(int index); extern char *spice_analysis_get_description(int index); @@ -112,102 +118,46 @@ static double *valueold, *valuenew; static bool savenone = FALSE; #endif -/* 10.Mar.2017 - RM - Added nghdl_tb_SIGUSR1().*/ -static void nghdl_tb_SIGUSR1(char* pid_file) -{ - int ret; - char line[80]; - char* nptr; - pid_t pid[256], tmp; - int count=0, i; - - FILE* fp = fopen(pid_file, "r"); - - if (fp) - { - /* 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. - tmp = (pid_t) strtol(line, &nptr, 10); - if ((errno != ERANGE) && (errno!= EINVAL)) - { - pid[count++] = tmp; - } - } - - fclose(fp); - } - - /* 22.Oct.2019 - RP - Kill all the active PIDs */ - for(i=0; i*" files.*/ - while ((dirp = readdir(dirfd)) != NULL) - { - struct stat stbuf; - sprintf(filename_tmp, "/tmp/%s", dirp->d_name); - if (strstr(filename_tmp, pid_file_prefix)) - { - if (stat(filename_tmp, &stbuf) == -1) - { - fprintf(stderr, - "nghdl_orphan_tb: stat() failed; ERRNO=%d on file:%s\n", - errno, filename_tmp); - continue; - } - - if ((stbuf.st_mode & S_IFMT) == S_IFDIR) - { - continue; - } - else - { - nghdl_tb_SIGUSR1(filename_tmp); - } - } - } - - // 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 */ - -/* The two "begin plot" routines share all their internals... */ +// The two "begin plot" routines share all their internals... int OUTpBeginPlot(CKTcircuit *circuitPtr, JOB *analysisPtr, @@ -1136,10 +1086,13 @@ fileEnd(runDesc *run) /* 10.Mar.2017 - RM - Check if any orphan test benches are running. If any are * found, force them to exit. */ - nghdl_orphan_tb(); - + //nghdl_orphan_tb(); /* End 10.Mar.2017 */ + /* 28.MaY.2020 - BM */ + close_server; + /* End 28.MaY.2020 */ + if (run->fp != stdout) { long place = ftell(run->fp); @@ -1294,9 +1247,14 @@ static void plotEnd(runDesc *run) { /* 10.Mar.2017 - RM */ - nghdl_orphan_tb(); + //nghdl_orphan_tb(); /* End 10.Mar.2017 */ + /* 28.MaY.2020 - BM */ + close_server; + /* End 28.MaY.2020 */ + + fprintf(stdout, "\nNo. of Data Rows : %d\n", run->pointCount); } -- cgit