From f9224baa657b10f176889c7305bf40fc1ff96d46 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Sun, 22 Dec 2013 20:42:50 +0400 Subject: [PATCH] Add API function to set/modify GC log file descriptor (Unix) * include/gc.h (GC_set_log_fd): New API function declaration. * misc.c (GC_set_log_fd): New function definition (except for OS/2, MacOS, Win32/CE and Android). --- include/gc.h | 3 +++ misc.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/include/gc.h b/include/gc.h index 5a79339..ff8ff32 100644 --- a/include/gc.h +++ b/include/gc.h @@ -1162,6 +1162,9 @@ GC_API GC_warn_proc GC_CALL GC_get_warn_proc(void); /* to suppress all warnings (unless statistics printing is turned on). */ GC_API void GC_CALLBACK GC_ignore_warn_proc(char *, GC_word); +/* Change file descriptor of GC log. Unavailable on some targets. */ +GC_API void GC_CALL GC_set_log_fd(int); + /* abort_func is invoked on GC fatal aborts (just before OS-dependent */ /* abort or exit(1) is called). Must be non-NULL. The default one */ /* outputs msg to stderr provided msg is non-NULL. msg is NULL if */ diff --git a/misc.c b/misc.c index 57307c1..620f686 100644 --- a/misc.c +++ b/misc.c @@ -786,6 +786,11 @@ GC_INNER GC_bool GC_is_initialized = FALSE; STATIC int GC_stdout = GC_DEFAULT_STDOUT_FD; STATIC int GC_stderr = GC_DEFAULT_STDERR_FD; STATIC int GC_log = GC_DEFAULT_STDERR_FD; + + GC_API void GC_CALL GC_set_log_fd(int fd) + { + GC_log = fd; + } #endif STATIC word GC_parse_mem_size_arg(const char *str) -- 2.7.4