diff --git a/src/mono/mono/component/debugger-agent.c b/src/mono/mono/component/debugger-agent.c index 58212481cbd74404f03b3f07e55a50960e433adf..b2a979a56802d8ed308bf0ba514308537d70405f 100644 --- a/src/mono/mono/component/debugger-agent.c +++ b/src/mono/mono/component/debugger-agent.c @@ -85,6 +85,7 @@ #include #include #include +#include #include #include "debugger-agent.h" @@ -1144,16 +1145,10 @@ socket_transport_connect (const char *address) PRINT_DEBUG_MSG (1, "Listening on %s:%d (timeout=%d ms)...\n", host, port, agent_config.timeout); if (agent_config.timeout) { - fd_set readfds; - struct timeval tv; - - tv.tv_sec = 0; - tv.tv_usec = agent_config.timeout * 1000; - FD_ZERO (&readfds); - FD_SET (sfd, &readfds); - - res = select ((int)sfd + 1, &readfds, NULL, NULL, &tv); - + mono_pollfd mp; + mp.fd = (int)sfd; + mp.events = MONO_POLLIN; + res = mono_poll (&mp, 1, agent_config.timeout); if (res == 0) { PRINT_ERROR_MSG ("debugger-agent: Timed out waiting to connect.\n"); exit (1); diff --git a/src/mono/mono/utils/mono-poll.c b/src/mono/mono/utils/mono-poll.c index 36c11b80cc2d2ff693fc21a76d02263791486f29..5c5c2c6f30bcd972b476a314d9a8cefc752937ad 100644 --- a/src/mono/mono/utils/mono-poll.c +++ b/src/mono/mono/utils/mono-poll.c @@ -31,7 +31,7 @@ mono_poll (mono_pollfd *ufds, unsigned int nfds, int timeout) #else -#if defined(HAVE_POLL) && !defined(__APPLE__) +#if defined(HAVE_POLL) int mono_poll_can_add (mono_pollfd *ufds, unsigned int nfds, int fd)