summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--perl.h2
-rw-r--r--perlio.c15
-rw-r--r--perliol.h2
3 files changed, 13 insertions, 6 deletions
diff --git a/perl.h b/perl.h
index aab0393000..e81d1afc5a 100644
--- a/perl.h
+++ b/perl.h
@@ -3964,7 +3964,7 @@ typedef Sighandler_t Sigsave_t;
#endif
#ifdef USE_PERLIO
-EXTERN_C void PerlIO_teardown(pTHX);
+EXTERN_C void PerlIO_teardown();
# ifdef USE_ITHREADS
# define PERLIO_INIT MUTEX_INIT(&PL_perlio_mutex)
# define PERLIO_TERM \
diff --git a/perlio.c b/perlio.c
index 2ea86aa87d..c0e73274bc 100644
--- a/perlio.c
+++ b/perlio.c
@@ -2413,7 +2413,7 @@ PerlIO_cleanup(pTHX)
}
}
-void PerlIO_teardown(pTHX) /* Call only from PERL_SYS_TERM(). */
+void PerlIO_teardown() /* Call only from PERL_SYS_TERM(). */
{
dVAR;
#ifdef DEBUGGING
@@ -2421,11 +2421,18 @@ void PerlIO_teardown(pTHX) /* Call only from PERL_SYS_TERM(). */
/* By now all filehandles should have been closed, so any
* stray (non-STD-)filehandles indicate *possible* (PerlIO)
* errors. */
+#define PERLIO_TEARDOWN_MESSAGE_BUF_SIZE 64
+#define PERLIO_TEARDOWN_MESSAGE_FD 2
+ char buf[PERLIO_TEARDOWN_MESSAGE_BUF_SIZE];
int i;
for (i = 3; i < PL_perlio_fd_refcnt_size; i++) {
- if (PL_perlio_fd_refcnt[i])
- PerlIO_debug("PerlIO_cleanup: fd %d refcnt=%d\n",
- i, PL_perlio_fd_refcnt[i]);
+ if (PL_perlio_fd_refcnt[i]) {
+ const STRLEN len =
+ my_snprintf(buf, sizeof(buf),
+ "PerlIO_teardown: fd %d refcnt=%d\n",
+ i, PL_perlio_fd_refcnt[i]);
+ PerlLIO_write(PERLIO_TEARDOWN_MESSAGE_FD, buf, len);
+ }
}
}
#endif
diff --git a/perliol.h b/perliol.h
index 0c57de1505..756db2d6c2 100644
--- a/perliol.h
+++ b/perliol.h
@@ -170,7 +170,7 @@ PERL_EXPORT_C void PerlIO_list_free(pTHX_ PerlIO_list_t *list);
/* PerlIO_teardown doesn't need exporting, but the EXTERN_C is needed
* for compiling as C++. Must also match with what perl.h says. */
-EXTERN_C void PerlIO_teardown(pTHX);
+EXTERN_C void PerlIO_teardown();
/*--------------------------------------------------------------------------------------*/
/* Generic, or stub layer functions */