gmain linux fixes

This commit is contained in:
Ryan Lortie
2014-12-19 12:22:10 -05:00
parent 57204526fa
commit d6bb450e7d

View File

@@ -2867,6 +2867,7 @@ g_get_coarse_monotonic_time (void)
{ {
#ifdef __linux__ #ifdef __linux__
struct timespec ts; struct timespec ts;
gint result;
result = clock_gettime (CLOCK_MONOTONIC_COARSE, &ts); result = clock_gettime (CLOCK_MONOTONIC_COARSE, &ts);
@@ -5710,13 +5711,14 @@ again:
gint gint
g_handle_wait_multiple (const ghandle *handles, g_handle_wait_multiple (const ghandle *handles,
guint n_handles, guint n_handles,
gint64 ready_time) gint64 ready_time,
GError **error)
{ {
struct pollfd *fds; GPollFD *fds;
gint result; gint result;
guint i; guint i;
fds = g_newa (struct pollfd, n_handles); fds = g_newa (GPollFD, n_handles);
for (i = 0; i < n_handles; i++) for (i = 0; i < n_handles; i++)
{ {
fds[i].fd = handles[i]; fds[i].fd = handles[i];
@@ -5724,7 +5726,7 @@ g_handle_wait_multiple (const ghandle *handles,
} }
again: again:
result = poll (fds, n_handles, ready_time_to_timeout (ready_time)); result = g_poll (fds, n_handles, ready_time_to_timeout (ready_time));
if (result == -1) if (result == -1)
{ {
@@ -5739,7 +5741,7 @@ again:
if (result == 0) if (result == 0)
{ {
g_set_error_literal (error, G_FILE_ERROR, G_FILE_ERROR_TIMED_OUT, _("Operation timed out")); g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_TIMED_OUT, _("Operation timed out"));
return -1; return -1;
} }
@@ -5782,13 +5784,14 @@ again:
gint gint
g_unix_fd_wait_multiple (GPollFD *pollfds, g_unix_fd_wait_multiple (GPollFD *pollfds,
guint n_pollfds, guint n_pollfds,
gint64 ready_time) gint64 ready_time,
GError **error)
{ {
gint result; gint result;
guint i; guint i;
again: again:
result = poll (pollfds, n_pollfds, ready_time_to_timeout (ready_time)); result = g_poll (pollfds, n_pollfds, ready_time_to_timeout (ready_time));
if (result == -1) if (result == -1)
{ {
@@ -5808,7 +5811,7 @@ again:
} }
for (i = 0; i < n_pollfds; i++) for (i = 0; i < n_pollfds; i++)
if (fds[i].revents) if (pollfds[i].revents)
{ {
result = i; result = i;
break; break;
@@ -5818,7 +5821,7 @@ again:
/* prevent abuse */ /* prevent abuse */
for (i = 0; i < n_pollfds; i++) for (i = 0; i < n_pollfds; i++)
fds[i].revents = 0; pollfds[i].revents = 0;
return i; return i;
} }