From: Ivan Maidanski Date: Sun, 22 Dec 2013 16:42:50 +0000 (+0400) Subject: Add API function to set/modify GC log file descriptor (Unix) X-Git-Tag: gc7_6_0~294 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f9224baa657b10f176889c7305bf40fc1ff96d46;p=gc 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). --- diff --git a/include/gc.h b/include/gc.h index 5a793395..ff8ff329 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 57307c1a..620f686c 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)