From ff644a69874380d066388b4002c946a4144a974f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Techet?= Date: Thu, 19 Dec 2024 19:05:19 +0100 Subject: [PATCH] Drop poll() support for windows streams --- lsp/src/spawn/lspunixinputstream.c | 36 ----------------------------- lsp/src/spawn/lspunixoutputstream.c | 36 ----------------------------- 2 files changed, 72 deletions(-) diff --git a/lsp/src/spawn/lspunixinputstream.c b/lsp/src/spawn/lspunixinputstream.c index 3fe0ff8c1..b7b6aea95 100644 --- a/lsp/src/spawn/lspunixinputstream.c +++ b/lsp/src/spawn/lspunixinputstream.c @@ -296,47 +296,13 @@ lsp_unix_input_stream_read (GInputStream *stream, { LspUnixInputStream *unix_stream; gssize res = -1; - GPollFD poll_fds[2]; - int nfds; - int poll_ret; unix_stream = LSP_UNIX_INPUT_STREAM (stream); - poll_fds[0].fd = unix_stream->priv->fd; - poll_fds[0].events = G_IO_IN; - if (unix_stream->priv->can_poll && - g_cancellable_make_pollfd (cancellable, &poll_fds[1])) - nfds = 2; - else - nfds = 1; - while (1) { int errsv; - poll_fds[0].revents = poll_fds[1].revents = 0; - do - { - poll_ret = g_poll (poll_fds, nfds, -1); - errsv = errno; - } - while (poll_ret == -1 && errsv == EINTR); - - if (poll_ret == -1) - { - g_set_error (error, G_IO_ERROR, - g_io_error_from_errno (errsv), - "Error reading from file descriptor: %s", - g_strerror (errsv)); - break; - } - - if (g_cancellable_set_error_if_cancelled (cancellable, error)) - break; - - if (!poll_fds[0].revents) - continue; - res = read (unix_stream->priv->fd, buffer, count); if (res == -1) { @@ -354,8 +320,6 @@ lsp_unix_input_stream_read (GInputStream *stream, break; } - if (nfds == 2) - g_cancellable_release_fd (cancellable); return res; } diff --git a/lsp/src/spawn/lspunixoutputstream.c b/lsp/src/spawn/lspunixoutputstream.c index b798eefa9..47ae96fae 100644 --- a/lsp/src/spawn/lspunixoutputstream.c +++ b/lsp/src/spawn/lspunixoutputstream.c @@ -282,47 +282,13 @@ lsp_unix_output_stream_write (GOutputStream *stream, { LspUnixOutputStream *unix_stream; gssize res = -1; - GPollFD poll_fds[2]; - int nfds = 0; - int poll_ret; unix_stream = LSP_UNIX_OUTPUT_STREAM (stream); - poll_fds[0].fd = unix_stream->priv->fd; - poll_fds[0].events = G_IO_OUT; - nfds++; - - if (unix_stream->priv->can_poll && - g_cancellable_make_pollfd (cancellable, &poll_fds[1])) - nfds++; - while (1) { int errsv; - poll_fds[0].revents = poll_fds[1].revents = 0; - do - { - poll_ret = g_poll (poll_fds, nfds, -1); - errsv = errno; - } - while (poll_ret == -1 && errsv == EINTR); - - if (poll_ret == -1) - { - g_set_error (error, G_IO_ERROR, - g_io_error_from_errno (errsv), - "Error writing to file descriptor: %s", - g_strerror (errsv)); - break; - } - - if (g_cancellable_set_error_if_cancelled (cancellable, error)) - break; - - if (!poll_fds[0].revents) - continue; - res = write (unix_stream->priv->fd, buffer, count); errsv = errno; if (res == -1) @@ -339,8 +305,6 @@ lsp_unix_output_stream_write (GOutputStream *stream, break; } - if (nfds == 2) - g_cancellable_release_fd (cancellable); return res; }