#include <mono/utils/mono-dl.h>
#include <mono/utils/mono-error-internals.h>
#include <mono/utils/mono-logger-internals.h>
+#include <mono/utils/w32subset.h>
MonoProfilerState mono_profiler_state;
mname = libname = NULL;
if (!desc || !strcmp ("default", desc))
+#if HAVE_API_SUPPORT_WIN32_PIPE_OPEN_CLOSE && !defined (HOST_WIN32)
desc = "log:report";
+#else
+ desc = "log";
+#endif
if ((col = strchr (desc, ':')) != NULL) {
mname = (char *) g_memdup (desc, col - desc + 1);
#include <config.h>
#include <mono/utils/mono-logger-internals.h>
#include <mono/utils/mono-proclib.h>
+#include <mono/utils/w32subset.h>
#include "log.h"
#ifdef HAVE_UNISTD_H
} else if (match_option (arg, "nodefaults", NULL)) {
mono_profiler_printf_err ("The nodefaults option can only be used as the first argument.");
} else if (match_option (arg, "report", NULL)) {
+#if HAVE_API_SUPPORT_WIN32_PIPE_OPEN_CLOSE && !defined (HOST_WIN32)
config->do_report = TRUE;
+#else
+ mono_profiler_printf_err ("'report' argument not supported on platform.");
+#endif
} else if (match_option (arg, "debug", NULL)) {
config->do_debug = TRUE;
} else if (match_option (arg, "heapshot", &val)) {
#include <mono/utils/mono-error-internals.h>
#include <mono/utils/mono-publib.h>
#include <mono/utils/os-event.h>
+#include <mono/utils/w32subset.h>
#include "log.h"
#include "helper.h"
LARGE_INTEGER pcounter_freq;
#endif
+#if HAVE_API_SUPPORT_WIN32_PIPE_OPEN_CLOSE && !defined (HOST_WIN32)
int pipe_output;
+#endif
int command_port;
int server_socket;
if (client_socket != INVALID_SOCKET) {
struct sockaddr_in client_addr;
client_addr.sin_family = AF_INET;
- client_addr.sin_addr.s_addr = inet_addr("127.0.0.1");
client_addr.sin_port = htons(log_profiler.command_port);
+ inet_pton (client_addr.sin_family, "127.0.0.1", &client_addr.sin_addr);
gulong non_blocking = 1;
ioctlsocket (client_socket, FIONBIO, &non_blocking);
if (prof->gzfile)
gzclose (prof->gzfile);
#endif
+#if HAVE_API_SUPPORT_WIN32_PIPE_OPEN_CLOSE && !defined (HOST_WIN32)
if (prof->pipe_output)
pclose (prof->file);
else
+#endif
fclose (prof->file);
mono_conc_hashtable_destroy (prof->method_table);
int fd = accept (log_profiler.server_socket, NULL, NULL);
if (fd != -1) {
+#ifndef HOST_WIN32
if (fd >= FD_SETSIZE)
mono_profhelper_close_socket_fd (fd);
else
+#endif
g_array_append_val (command_sockets, fd);
}
}
}
}
if (*nf == '|') {
+#if HAVE_API_SUPPORT_WIN32_PIPE_OPEN_CLOSE && !defined (HOST_WIN32)
log_profiler.file = popen (nf + 1, "w");
log_profiler.pipe_output = 1;
+#else
+ mono_profiler_printf_err ("Platform doesn't support popen");
+#endif
} else if (*nf == '#') {
int fd = strtol (nf + 1, NULL, 10);
log_profiler.file = fdopen (fd, "a");