aboutsummaryrefslogtreecommitdiff
path: root/win32/poll.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* win32: update poll(2) to match latest gnulib versionRon Yorston2024-10-251-5/+6
|
* win32: workaround for pipe writability in poll(2)Ron Yorston2024-10-251-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | A CGI script was found to hang when a large amount of data was posted: #!/bin/sh echo "Content-type: text/plain;" echo if [ "$REQUEST_METHOD" = "POST" ]; then dd of=my.dat bs=1 count=${CONTENT_LENGTH} echo -n "success." else echo -n "error!" fi This appears to be due to problems determining whether a pipe is writable on Windows. The Git for Windows project has a workaround in their copy of GNUlib's poll(2) implementation. The details are in the commit message: https://github.com/git-for-windows/git/commit/94f4d01932279c419844aa708bec31a26056bc6b Apply the same workaround here. Saves 220-272 bytes. (GitHub issue #468)
* win32: avoid crashing the console with poll(2)Ron Yorston2023-07-171-1/+1
| | | | | | | | | | | | | | | Commit 8e6991733 (ash: fix 'read' shell built-in (1)) introduced the use of poll(2) in the shell 'read' built-in. When the UTF8 code page is in use this results in the console crashing if a 3 or more byte UTF8 character is entered. The crash is caused by the use of PeekConsoleInputA() which, like ReadConsoleInputA(), is broken. It can be avoided by using PeekConsoleInputW() instead. The number of key events will differ but this doesn't matter in this case as poll(2) effectively runs in a busy loop with a 1ms sleep.
* ash: fix 'read' shell built-in (2)Ron Yorston2023-07-121-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | Enabling polling in the previous commit resulted in the following incorrect behaviour: { echo -n te; sleep 3; echo st; } | (read -t 1 x; echo "$x") An empty "$x" is echoed immediately, not after 1 second. { echo -n te; sleep 1; echo st; } | (read -t 3 x; echo "$x") An empty "$x" is echoed immediately. "test" should be echoed after 1 second. This arises because poll(2) from gnulib is unable to handle anonymous pipes properly due do deficiencies in Microsoft Windows. These have been acknowledged and fixed in relation to select(2): https://lists.gnu.org/archive/html/bug-gnulib/2014-06/msg00051.html Apply a similar fix to poll(2). Costs 104-156 bytes.
* win32: revise poll(2) for use in ncRon Yorston2023-03-031-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upstream commit 5b3b468ec (nc: use poll() instead of select()) changed `nc` to use poll(2) instead of select(2), obviously. In busybox-w32 select(2) had already been hacked to support `nc`. To avoid hacking poll(2) too the upstream change was reverted (c2002eae3). Later `nc` was altered to include the code for both poll and select (3c85cc0c4). Make the changes necessary for poll(2) to work with `nc` on Windows. These are all in the function windows_compute_revents(). Treat a character file that isn't a console as a normal file. Without this `nc 127.0.0.1 1234 </dev/null` doesn't work. Return 0 instead of POLLHUP if GetNumberOfConsoleInputEvents() indicates no events are available. Without this communication between two instances of `nc` which are both using keyboard input isn't as asynchronous as one would like. Only process key press events: key releases are ignored. Without this `nc 127.0.0.1 1234` won't receive anything from the server until the local user presses a key. In the default case, which now includes disk files and character files, detect polling for reads as well as writes. Without this `nc 127.0.0.1 1234 <local_file` doesn't work.
* win32: update poll(2) to match latest gnulib versionRon Yorston2023-03-031-12/+37
|
* win32: fixes to build on Windows/MSYS2/mingw-w64Ron Yorston2021-02-211-3/+1
| | | | | | | | | | | | | To investigate GitHub issue #200 it was necessary to perform build on Window using the MSYS2/mingw-w64 toolchain. This threw up some issues: - The settings for _WIN32_WINNT and __USE_MINGW_ANSI_STDIO differ from those in Fedora resulting in compiler errors and warnings. Force the defaults I'm used to. - The workaround to allow native compilation of mconf.c was broken by a subsequent upstream change. Make it work again.
* win32: update poll implementation to match latest gnulib versionRon Yorston2018-02-131-209/+207
|
* win32/poll: avoid assumption that pointers are equivalent to longsJohannes Schindelin2017-08-311-1/+1
| | | | | | | | | This is a companion patch to 4319368c6 (Use gnulib poll, importing the version from git, 2012-03-30) (Git's implementation of IsConsoleHandle() was adjusted in the meantime). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Ron Yorston <rmy@pobox.com>
* Move mingw32 poll.h from sysRon Yorston2014-01-021-1/+1
|
* Use gnulib poll, importing the version from gitRon Yorston2012-03-301-0/+606