summaryrefslogtreecommitdiffstats
path: root/winsup
Commit message (Collapse)AuthorAgeFilesLines
* Fix limited Internet speeds caused by inappropriate socket bufferingCorinna Vinschen2017-02-031-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't set SO_RCVBUF/SO_SNDBUF to fixed values, thus disabling autotuning. Patch modeled after a patch suggestion from Daniel Havey <dhavey@gmail.com> in https://cygwin.com/ml/cygwin-patches/2017-q1/msg00010.html: At Windows we love what you are doing with Cygwin. However, we have been getting reports from our hardware vendors that iperf is slow on Windows. Iperf is of course compiled against the cygwin1.dll and we believe we have traced the problem down to the function fdsock in net.cc. SO_RCVBUF and SO_SNDBUF are being manually set. The comments indicate that the idea was to increase the buffer size, but, this code must have been written long ago because Windows has used autotuning for a very long time now. Please do not manually set SO_RCVBUF or SO_SNDBUF as this will limit your internet speed. I am providing a patch, an STC and my cygcheck -svr output. Hope we can fix this. Please let me know if I can help further. Simple Test Case: I have a script that pings 4 times and then iperfs for 10 seconds to debit.k-net.fr With patch $ bash buffer_test.sh 178.250.209.22 usage: bash buffer_test.sh <iperf server name> Pinging 178.250.209.22 with 32 bytes of data: Reply from 178.250.209.22: bytes=32 time=167ms TTL=34 Reply from 178.250.209.22: bytes=32 time=173ms TTL=34 Reply from 178.250.209.22: bytes=32 time=173ms TTL=34 Reply from 178.250.209.22: bytes=32 time=169ms TTL=34 Ping statistics for 178.250.209.22: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 167ms, Maximum = 173ms, Average = 170ms ------------------------------------------------------------ Client connecting to 178.250.209.22, TCP port 5001 TCP window size: 64.0 KByte (default) ------------------------------------------------------------ [ 3] local 10.137.196.108 port 58512 connected with 178.250.209.22 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0- 1.0 sec 768 KBytes 6.29 Mbits/sec [ 3] 1.0- 2.0 sec 9.25 MBytes 77.6 Mbits/sec [ 3] 2.0- 3.0 sec 18.0 MBytes 151 Mbits/sec [ 3] 3.0- 4.0 sec 18.0 MBytes 151 Mbits/sec [ 3] 4.0- 5.0 sec 18.0 MBytes 151 Mbits/sec [ 3] 5.0- 6.0 sec 18.0 MBytes 151 Mbits/sec [ 3] 6.0- 7.0 sec 18.0 MBytes 151 Mbits/sec [ 3] 7.0- 8.0 sec 18.0 MBytes 151 Mbits/sec [ 3] 8.0- 9.0 sec 18.0 MBytes 151 Mbits/sec [ 3] 9.0-10.0 sec 18.0 MBytes 151 Mbits/sec [ 3] 0.0-10.0 sec 154 MBytes 129 Mbits/sec Without patch: dahavey@DMH-DESKTOP ~ $ bash buffer_test.sh 178.250.209.22 Pinging 178.250.209.22 with 32 bytes of data: Reply from 178.250.209.22: bytes=32 time=168ms TTL=34 Reply from 178.250.209.22: bytes=32 time=167ms TTL=34 Reply from 178.250.209.22: bytes=32 time=170ms TTL=34 Reply from 178.250.209.22: bytes=32 time=169ms TTL=34 Ping statistics for 178.250.209.22: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 167ms, Maximum = 170ms, Average = 168ms ------------------------------------------------------------ Client connecting to 178.250.209.22, TCP port 5001 TCP window size: 208 KByte (default) ------------------------------------------------------------ [ 3] local 10.137.196.108 port 58443 connected with 178.250.209.22 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0- 1.0 sec 512 KBytes 4.19 Mbits/sec [ 3] 1.0- 2.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 2.0- 3.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 3.0- 4.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 4.0- 5.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 5.0- 6.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 6.0- 7.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 7.0- 8.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 8.0- 9.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 9.0-10.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 0.0-10.1 sec 14.1 MBytes 11.7 Mbits/sec The output shows that the RTT from my machine to the iperf server is similar in both cases (about 170ms) however with the patch the throughput averages 129 Mbps while without the patch the throughput only averages 11.7 Mbps. If we calculate the maximum throughput using Bandwidth = Queue/RTT we get (212992 * 8)/0.170 = 10.0231 Mbps. This is just about what iperf is showing us without the patch since the buffer size is set to 212992 I believe that the buffer size is limiting the throughput. With the patch we have no buffer limitation (autotuning) and can develop the full potential bandwidth on the link. If you want to duplicate the STC you will have to find an iperf server (I found an extreme case) that has a large enough RTT distance from you and try a few times. I get varying results depending on Internet traffic but without the patch never exceed the limit caused by the buffering. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add release message for commit a1529738Jon Turney2017-01-311-0/+3
| | | | Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
* Fix handling of '+' by 'cygcheck -p'Jon Turney2017-01-311-2/+2
| | | | | | | | | | | The form data sent to the server should be application/x-www-form-urlencoded This replaces spaces with '+' before being RFC 1738 encoded, so a literal '+' must be %-encoded also. See https://cygwin.com/ml/cygwin/2014-01/msg00287.html et seq. Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
* Add release message for commit 095cac4Corinna Vinschen2017-01-311-0/+3
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Add IUTF8 termios iflagCorinna Vinschen2017-01-314-23/+31
| | | | | | | | | | | | | | | | | | | | | | | | | The termios code doesn't handle erasing of multibyte characters in canonical mode, it always erases a single byte. When entering a multibyte character and then pressing VERASE, the input ends up with an invalid character. Following Linux we introduce the IUTF8 input flag now, set by default. When this flag is set, VERASE or VWERASE will check if the just erased input byte is a UTF-8 continuation byte. If so, it erases another byte and checks again until the entire UTF-8 character has been removed from the input buffer. Note that this (just as on Linux) does NOT work with arbitrary multibyte codesets. This only works with UTF-8. For a discussion what happens, see https://cygwin.com/ml/cygwin/2017-01/msg00299.html Sidenote: The eat_readahead function is now member of fhandler_termios, not fhandler_base. That's necessary to get access to the terminal's termios flags. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add release message for commit ca3e3bcCorinna Vinschen2017-01-201-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cleanup fhandler_console::read for readabilityCorinna Vinschen2017-01-191-22/+20
| | | | | | | | | - Drop virtual_key_code (only used once) - Convert macros wch and control_key_state to const vars unicode_char and ctrl_key_state. - Fix formatting Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* miscfuncs.cc: Revert exclusion of inclusion of exception.hCorinna Vinschen2017-01-191-0/+1
| | | | | | x86 still needs it. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Simplify check for Alt-NumpadCorinna Vinschen2017-01-193-39/+35
| | | | | | | | | Create two new inline functions is_alt_numpad_key(PINPUT_RECORD) and is_alt_numpad_event(PINPUT_RECORD) which contain the actual checks. Call these functions from fhandler_console::read and peek_console for better readability. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* miscfuncs.h: Drop now unneeded getentropy declarationCorinna Vinschen2017-01-191-1/+0
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* miscfuncs.cc: Drop unneeded includes and unused global variableCorinna Vinschen2017-01-191-12/+0
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* check_iovec: Change test to be more robust against invalid iovcnt valuesCorinna Vinschen2017-01-191-1/+1
| | | | | | Stop running wild if iovcnt is < 0 to begin with. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Don't assert on sum of iov_len overflowing an ssize_tCorinna Vinschen2017-01-191-3/+3
| | | | | | Rather return EINVAL per POSIX. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Move string functions from miscfunc.cc to strfuncs.ccCorinna Vinschen2017-01-192-192/+193
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Move getentropy/getrandom into own fileCorinna Vinschen2017-01-193-57/+71
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix copy/paste buglet in commentCorinna Vinschen2017-01-191-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add release message for commit 4652cc4Corinna Vinschen2017-01-191-0/+3
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Handle Alt+Numpad key sequences in console input and selectCorinna Vinschen2017-01-192-3/+35
| | | | | | | | | | | | | | | | | | | | {p}select/{p}poll completely ignored Alt+Numpad key sequences in console input which results in newer readline using pselect to fail handling such sequences correctly. See https://cygwin.com/ml/cygwin/2017-01/msg00135.html During debugging and testing it turned out that while reading console input, single key presses during an Alt+Numpad sequences where not ignored, so ultimately a sequence like Alt-down Numpad-1 Numpad-2 Numpad-3 whihc is supposed to result in a single character in the input stream will actually result in 4 chars in the input stream, three control sequences and the actual character. Both problems should be fixed by this patch. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add release message for commit 688d943Corinna Vinschen2017-01-141-0/+4
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Always try to write complete incoming buffer on pipes and fifosCorinna Vinschen2017-01-141-1/+1
| | | | | | | | | | | | | | | | | | | | This patch fixes the following problem: Commit 9636c426 refactored the pipe code especially to make sure to call WriteFile only with chunks matching the maximum atomic write count. This accidentally introduced a small change in behaviour on blocking pipes due to the success case falling through into the error case. Rather then writing atomic chunks until all bytes are written, the code immediately broke from the loop after writing the first chunk, basically the same as in case of non-blocking writes. This behaviour is not compliant to POSIX which requires "Write requests to a pipe or FIFO [...] * If the O_NONBLOCK flag is clear, a write request may cause the thread to block, but on normal completion it shall return nbyte." Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add release message for commit 6ed4753Corinna Vinschen2017-01-121-1/+2
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* rename: Refactor "new file already exists and rename fails" caseCorinna Vinschen2017-01-121-20/+27
| | | | | | | | | | | | | | | | | | | | | | | If newfile already exists and is in use, trying to overwrite it with NtSetInformationFile(FileRenameInformation) fails exactly as if we don't have the permissions to delete it. Unfortunately the return code is the same STATUS_ACCESS_DENIED, so we have no way to distinguish these cases. What we do here so far is to start a transaction to delete newfile. If this open fails with a transactional error we stop the transaction and retry opening the file without transaction. But, here's the problem: If newfile is in use, NtOpenFile(oldfile) naturally does NOT fail with a transactional error. Rather, the subsequent call to unlink_nt(newfile) does, because there's another handle open to newfile outside a transaction. However, the code does not check if unlink_nt fails with a transactional error and so fails to retry without transaction. This patch recifies the problem and checks unlink_nt's status as well. Refactor code to get rid of goto into another code block. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* FAST_CWD: adjust the initial search scopeJohannes Schindelin2017-01-121-2/+2
| | | | | | | | | | | | A *very* recent Windows build adds more code to the preamble of RtlGetCurrentDirectory_U() so that the previous heuristic failed to find the call to the locking routine. This only affects the 64-bit version of ntdll, where the 0xe8 byte is now found at offset 40, not the 32-bit version. However, let's just double the area we search for said byte for good measure. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
* Fix formatting in pinfo.ccCorinna Vinschen2017-01-101-7/+8
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Document latest Cygwin changesCorinna Vinschen2017-01-102-0/+18
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add Erik Bray to Cygwin CONTRIBUTORSCorinna Vinschen2017-01-101-0/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add a /proc/<pid>/environ proc file handler, analogous to /proc/<pid>/cmdline.Erik M. Bray2017-01-101-0/+22
|
* Add a _pinfo.environ() method analogous to _pinfo.cmdline(), and others.Erik M. Bray2017-01-102-3/+84
| | | | | | | Returns the process's environment concatenated into a single block of null-terminated strings, along with the length of the environment block. Adds an associated PICOM_ENVIRON commune_process handler.
* Move the core environment parsing of environ_init into a new ↵Erik M. Bray2017-01-102-35/+51
| | | | | | | | | | win32env_to_cygenv function. win32env_to_cygwenv handles converting wchar to char and some other minor taks. Optionally it handles converting any paths in variables to posix paths. This will be useful for implementing /proc/<pid>/environ
* Return the correct value for getsockopt(SO_REUSEADDR) after setting ↵Erik M. Bray2017-01-091-0/+8
| | | | setsockopt(SO_REUSEADDR, 1).
* Don't free statically allocated sys_privsCorinna Vinschen2017-01-091-2/+2
| | | | | | | | | commit 67fd2101 introduced a bad bug. Changing sys_privs to a static area and just returning a pointer is nice... *if* the calling code doesn't call free() on it. Make sure callers check pointer for sys_privs and refrain from calling free, if so. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Export getentropy and getrandom callsCorinna Vinschen2016-12-165-6/+96
| | | | | | | | | | | | getentropy per OpenBSD http://man.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man2/getentropy.2 getrandom per Linux http://man7.org/linux/man-pages/man2/getrandom.2.html Note that GRND_NONBLOCK is not handled
* Fix some broken links in Cygwin FAQJon Turney2016-12-154-11/+7
| | | | | | | | | | | | | | | | GNU no longer encourages the use of documentation mirrors, to avoid referring to obsolete documentation. Also www.fsf.org/manual/ is just a redirect to www.gnu.org/manual/ Links to using-utils.html #fragments are no longer correct as each utility is now a separate page, since 646745cb. indiana.edu seems to have moved XLiveCD information, without a redirect. Linking to clean_setup.pl on cygwin.com doesn't work, as direct downloads aren't allowed, so instead state where it can be found on a mirror. Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
* Define RtlGenRandom correctly in ntsecapi.h wrapperCorinna Vinschen2016-12-145-6/+29
| | | | | | | Include ntsecapi.h where required and just redefine RtlGenRandom correctly in the ntsecapi.h wrapper. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Rearrange RNG code slightlyCorinna Vinschen2016-12-134-34/+52
| | | | | | | | | | | | | | | In preparation of exporting getentropy/getrandom to userspace, rearrange code a bit: - Define RtlGenRandom in ntdll.h. - Drop calls to getentropy in favor of RtlGenRandom (fhandler_socket, fhandler_dev_random). - Add try/except blocks in fhandler_dev_random to return EFAULT rather than crashing if buffer pointer is invalid. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Add release messages for last two checkinsCorinna Vinschen2016-12-131-0/+7
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix incorrect path conversion on non-existent files on network sharesCorinna Vinschen2016-12-131-0/+7
| | | | | | | | | | | | | | | | | | NtOpenFile/NtCreateFile on non-existent paths on network drives has a bug. Assuming a path Z:\dir\file. Further assuming that Z:\dir does not exist. The first NtOpenFile("Z:\dir\file") correctly returns STATUS_OBJECT_PATH_NOT_FOUND. Subsequent calls incorrectly return STATUS_OBJECT_NAME_NOT_FOUND. This appears to be some kind of caching behaviour. Waiting a while before repeating the call correctly returns STATUS_OBJECT_PATH_NOT_FOUND again. This patch works around the observed misbehaviour. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Check for .exe file in cygwin_conv_pathCorinna Vinschen2016-12-131-2/+2
| | | | | | | | So far, when converting from POSIX to Windows notation, cygwin_conv_path fails to check for .exe suffix, so /path/foo did not return /path/foo.exe even if this file exists. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin 2.6.1: Add missing release textCorinna Vinschen2016-12-061-4/+16
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* path_conv: When encountering a ".(/)+" sequence, skip *all* slashesCorinna Vinschen2016-11-281-1/+6
| | | | | | | The original code only skipped the "./", but missed to test if more trailing slashes are present. This in turn leads to invalid conversion. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* regex: Fix typo in CHaddrangeCorinna Vinschen2016-11-241-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* cygutils: Fix resource leak in get_short_pathsCorinna Vinschen2016-11-241-0/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix typo in kill(1)Corinna Vinschen2016-11-241-1/+1
| | | | | | | buf is just a local buffer, sig is ultimately pointing to the signal string. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* _pinfo::set_ctty: Check potential NULL pointer in debug_printf statementCorinna Vinschen2016-11-241-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Eliminate unused parameter from path_conv::eq_workerCorinna Vinschen2016-11-241-12/+4
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Remove redundant check for NULL pointer in cygwin_exception::dump_exceptionCorinna Vinschen2016-11-241-7/+4
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix copy/paste typo in fhandler_console::scroll_buffer_screenCorinna Vinschen2016-11-241-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Don't allow sending invalid signals from user spaceCorinna Vinschen2016-11-241-12/+22
| | | | | | | | Don't allow signal 0 in signal(2), sigaction(2), siginterrupt(3). Don't allow any signal in sigqueue(3) but explicitely handle signal 0 as in kill(2). Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* raise: Add missing extern "C"Corinna Vinschen2016-11-241-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* login_tty: Rewrite following FreeBSD's tracesCorinna Vinschen2016-11-241-15/+8
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>