From e63c75d1a3f5c18041dcfaf9eb257cb123de0ac6 Mon Sep 17 00:00:00 2001 From: Cary R Date: Thu, 30 Jul 2009 17:51:09 -0700 Subject: [PATCH] Add a warning when we reach 1024 files. It's not too likely we will ever reach this, but we should be nice and print a message instead of just failing. We could set errno, but for now the warning will have to be enough. (cherry picked from commit b0ac550791595a1261b85647643b18b090501481) --- vvp/vpi_mcd.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vvp/vpi_mcd.cc b/vvp/vpi_mcd.cc index 9a0a71139..a10fc539f 100644 --- a/vvp/vpi_mcd.cc +++ b/vvp/vpi_mcd.cc @@ -258,7 +258,10 @@ extern "C" PLI_INT32 vpi_fopen(const char*name, const char*mode) } /* We need to allocate more table entries, but to keep things */ /* sane we'll hard limit this to 1024 file descriptors total. */ - if (fd_table_len >= 1024) return 0; + if (fd_table_len >= 1024) { + vpi_printf("WARNING: Icarus only supports 1024 open files!\n"); + return 0; + } fd_table_len += FD_INCR; fd_table = (mcd_entry_s *) realloc(fd_table, fd_table_len*sizeof(mcd_entry_s));