From 5e50c3d8746db4eb8ce69c12aa8086b933f94a55 Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Mon, 23 Jan 2017 05:48:54 -0500 Subject: [PATCH] [aot] Allow the redirection of aot profile output to an already opened fd using outfile=#. --- mono/profiler/mono-profiler-aot.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mono/profiler/mono-profiler-aot.c b/mono/profiler/mono-profiler-aot.c index 05ed0758ed2..59f8aeea2a0 100644 --- a/mono/profiler/mono-profiler-aot.c +++ b/mono/profiler/mono-profiler-aot.c @@ -368,7 +368,12 @@ prof_shutdown (MonoProfiler *prof) printf ("Creating output file: %s\n", prof->outfile_name); - outfile = fopen (prof->outfile_name, "w+"); + if (prof->outfile_name [0] == '#') { + int fd = strtol (prof->outfile_name + 1, NULL, 10); + outfile = fdopen (fd, "a"); + } else { + outfile = fopen (prof->outfile_name, "w+"); + } if (!outfile) { fprintf (stderr, "Unable to create output file '%s': %s.\n", prof->outfile_name, strerror (errno)); return; -- 2.11.4.GIT