Commit Graph

8136 Commits

Author SHA1 Message Date
Corinna Vinschen 6c55be9dbb Cygwin: Allow to build without experimental AF_UNIX code by default
Introduce __WITH_AF_UNIX preprocessor flag to enable the new code

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-06-26 16:31:17 +02:00
Corinna Vinschen 17918cc6a6 Cygwin: add Unicode patch to release notes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-06-26 10:21:18 +02:00
Corinna Vinschen dbe905c140 Cygwin: exceptions: fix FPE exception flags
The FPE flags for divisions by zero were not implemented

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-06-26 10:12:19 +02:00
Corinna Vinschen 3dc89bbafe Cygwin: signal.h: improve exception flags definition
- add numbers for readability
- add a preprocessor macro for each flag

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-06-26 10:12:10 +02:00
Takashi Yano 9c84bfd479 Fix the handling of out-of-band (OOB) data in a socket.
* fhandler.h (class fhandler_socket_inet): Add variable bool oobinline.
* fhandler_socket_inet.cc (fhandler_socket_inet::fhandler_socket_inet):
  Initialize variable oobinline.
(fhandler_socket_inet::recv_internal): Make the handling of OOB data
  as consistent with POSIX as possible. Add simulation of inline mode
  for OOB data as a workaround for broken winsock behavior.
(fhandler_socket_inet::setsockopt): Ditto.
(fhandler_socket_inet::getsockopt): Ditto.
(fhandler_socket_wsock::ioctl): Fix return value of SIOCATMARK command.
  The return value of SIOCATMARK of winsock is almost opposite to
  expectation.
* fhandler_socket_local.cc (fhandler_socket_local::recv_internal):
  Remove the handling of OOB data from AF_LOCAL domain socket. Operation
  related to OOB data will result in an error like Linux does.
(fhandler_socket_local::sendto): Ditto.
(fhandler_socket_local::sendmsg): Ditto.

This fixes the issue reported in following post.
https://cygwin.com/ml/cygwin/2018-06/msg00143.html
2018-06-22 10:20:08 +02:00
Ken Brown ebc9171ede Bump Cygwin DLL version to 2.11.0 2018-06-07 09:42:36 +02:00
Ken Brown 2ea436b433 Cygwin: Document clearenv and bump API minor
Also add earlier "What changed" items to new-features.xml.
2018-06-07 09:42:36 +02:00
Ken Brown 3a049236db Cygwin: Remove workaround in environ.cc
Commit ebd645e on 2001-10-03 made environ.cc:_addenv() add unneeded
space at the end of the environment block to "work around problems
with some buggy applications."  This clutters the code and is
presumably no longer needed.
2018-06-07 09:42:36 +02:00
Ken Brown defaa2ca31 Cygwin: Implement the GNU extension clearenv 2018-06-07 09:42:36 +02:00
Ken Brown 9234545e3d Cygwin: Allow the environment pointer to be NULL
Following glibc, interpret this as meaning the environment is empty.
2018-06-07 09:42:36 +02:00
Ken Brown 1ecbb8d7b7 Cygwin: Clarify some code in environ.cc 2018-06-07 09:42:36 +02:00
Ken Brown a7c23d109f Cygwin: Add pthread_rwlock_* fix to release notes 2018-06-01 21:59:42 +02:00
Ken Brown 59847b5d73 Declare the pthread_rwlock_* functions if __cplusplus >= 201402L
Some of these functions are used in the <shared_mutex> C++ header.
2018-06-01 12:09:12 +02:00
Corinna Vinschen 8ac6b15487 Cygwin: Add stack alignment crash after fork fix to release notes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-05-29 18:43:20 +02:00
Sergejs Lukanihins 06797545b3 Cygwin: Fixing the math behind rounding down ch.stacklimit to page size. 2018-05-29 18:37:33 +02:00
Corinna Vinschen efade43bd5 Cygwin: Add buffer underrun fix to release notes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-05-29 18:31:07 +02:00
Corinna Vinschen 35998fc2fa Cygwin: normalize_win32_path: Avoid buffer underruns
Thanks to Ken Harris <Ken.Harris@mathworks.com> for the diagnosis.

When backing up tail to handle a "..", the code only checked that
it didn't underrun the destination buffer while removing path
components.  It did *not* take into account that the first backslash
in the path had to be kept intact.  Example path to trigger the
problem: "C:\A..\..\..\B'

Fix this by moving the dst pointer to the first backslash so subsequent
tests cannot underrun this position.  Also make sure that we always
*have* a backslash.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-05-29 18:23:14 +02:00
Corinna Vinschen 7d00a5e320 Cygwin: TEST only: Add a buffer underrun assertion to symlink_info::check
Thanks to Ken Harris <Ken.Harris@mathworks.com> for the diagnosis
which led to a buffer underrun in this loop.

Revert before release.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-05-29 18:23:14 +02:00
Yaakov Selkowitz 67609efeb0 Cygwin: fix build with GCC 7
GCC 7 is able to see straight through this trick, so use a more formal
method to avoid the warning.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-04-16 22:46:11 -05:00
Corinna Vinschen e206c39bb6 Cygwin: fix guard checking for current user's AuthZ context
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-04-12 09:43:12 +02:00
Corinna Vinschen 5d99256613 Cygwin: add cuinof changes to release text
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-04-11 12:46:18 +02:00
Corinna Vinschen cef1070bcb Cygwin: cpuinfo: Use active CPU count per group
There are systems with a MaximumProcessorCount not
reflecting the actually available CPUs.  The ActiveProcessorCount
is correct though.  So we use ActiveProcessorCount rather than
MaximumProcessorCount per group to set group affinity correctly.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-04-11 12:45:57 +02:00
Corinna Vinschen 92f4e0500b Cygwin: wincap: expose more SYSTEM_INFO members and use as appropriate
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-04-11 11:59:35 +02:00
Corinna Vinschen 402d68af1a Cygwin: cpuinfo: report L3 cache on Intel CPUs
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-04-11 10:06:25 +02:00
Corinna Vinschen 8a91646183 Cygwin: add strtod fix to release notes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-04-09 11:48:33 +02:00
Corinna Vinschen ee49870a7d Cygwin: AF_LOCAL: fix identifing abstract sockets in FS-related functions
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-26 18:11:23 +02:00
Corinna Vinschen cfe5d362fe Cygwin: fix typo in accept on inet and local sockets
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-26 17:21:30 +02:00
Corinna Vinschen 23b5ecdaf3 Cygwin: delete /dev/kmsg and thus fhandler_mailslot without substitution
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-25 12:38:14 +02:00
Corinna Vinschen 4fe086c84f Cygwin: AF_UNIX: Redesign various aspects
* Change set_socket_type/get_socket_type to virtual methods
* Move various variables into af_unix_shmem_t
* Change sun_name_t to match new usage pattern
* Move shut_state definition and add a name for the 0 value
* Allow marking packet as administrative packet.  This allows
  filtering out info packets exchange between peers and tweak
  data accordingly.
* Rename send_my_name to send_sock_info and send credentials
  if not called from bind (so the socket was already connected)
* Handle SO_PASSCRED in setsockopt/getsockopt
* Add input size checking to setsockopt/getsockopt
* Use NT functions where appropriate

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-18 20:46:43 +01:00
Corinna Vinschen a366a8fc42 Cygwin: ntdll.h: Define FSCTL_PIPE_PEEK and NtWaitForSingleObject
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-18 20:07:35 +01:00
Corinna Vinschen 848d5b70db Cygwin: AF_UNIX: Add state_lock to guard manipulating shared state info
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-18 20:06:43 +01:00
Corinna Vinschen 60ca1c1359 Cygwin: AF_UNIX: Use spinlock rather than SRWLOCKs
We need to share socket info between threads *and* processes.
SRWLOCKs are single-process only, unfortunately.  Provide a
sharable low-profile spinlock instead.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-18 18:46:15 +01:00
Corinna Vinschen 1f41bc16f1 Cygwin: tags: drop _EXFUN regex
_EXFUN has been removed a while back

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-17 16:55:22 +01:00
Corinna Vinschen edcf783dc2 Revert "ctype: align size of category bit fields to small targets needs"
This reverts commit e98d3eb3eb.

It has accidentally included some work in progress.
2018-03-14 11:36:06 +01:00
Corinna Vinschen e98d3eb3eb ctype: align size of category bit fields to small targets needs
E.g. arm ABI requires -fshort-enums for bare-metal toolchains.
Given there are only 29 category enums, the compiler chooses an
8 bit enum type, so a size of 11 bits for the bitfield leads to
a compile time error:

  error: width of 'cat' exceeds its type
    enum category cat: 11;
                  ^~~

Fix this by aligning the size of the category members to byte
borders.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-14 10:36:38 +01:00
Corinna Vinschen 4d1a356f7b Cygwin: mark muto object as NO_COPY
muto in smallprint.cc is missing a NO_COPY.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-12 22:13:20 +01:00
Corinna Vinschen 725176612d Cygwin: AF_UNIX: store per-socket info in shared memory
Per-socket info in fhandler isn't correctly shared between multiple
instances of th same descriptor.  Implement a basic shared info which
is shared between all instances of a socket.

This also requires to move the fhandler_socket status bits into
fhandler_socket_wsock since the data is moved to the shared region
for AF_UNIX sockets.

Also, drop backing file requirement for socketpair server socket.
This will be handled differently in recvmsg/sendmsg.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-12 15:26:12 +01:00
Corinna Vinschen 99796906ab Cygwin: AF_UNIX: fix up thread parameter block allocation
* don't abort on failing allocation, just return with error
* make sure the allocation is restricted to a single process

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-11 14:56:02 +01:00
Corinna Vinschen de29476ed5 Cygwin: AF_UNIX: use get_unique_id to create pipe name
It's the same as get_plain_ino in this case, but it's cleaner
and easier to understand.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-11 14:54:20 +01:00
Corinna Vinschen 4f1ee1a3e7 Cygwin: AF_UNIX: fix dup
Reorder so fhandler_socket::dup is called first.  Add missing
duplication of backing_file_handle.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-10 21:12:27 +01:00
Corinna Vinschen 7b1028974b Cygwin: AF_UNIX: Add fixup_after_exec method
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-10 21:09:28 +01:00
Corinna Vinschen 1bb3d65182 Cygwin: AF_UNIX: fix creating abstract socket symlink name
Add missing NUL termination when creating symlink representing
abstract socket.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-10 21:07:46 +01:00
Corinna Vinschen 8b6804b8a8 Cygwin: don't skip O_TMPFILE files in readdir
Bad idea.  A file hidden from directory listings is not seen by
rm either, so it never calls unlink for the file and a recursive
removal of the parent directory fails with "directory not empty".

Fix comments accordingly.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-09 21:13:28 +01:00
Corinna Vinschen b194d65615 Cygwin: AF_UNIX: Implemant socketpair
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-09 14:19:36 +01:00
Corinna Vinschen f4a1a186f9 Cygwin: fix socketpair prototype
Last parameter is a vector of 2 ints, not a pointer to int

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-09 14:17:39 +01:00
Corinna Vinschen 7d525c171f Cygwin: AF_UNIX: implement getsockopt SO_RCVBUF/SO_SNDBUF
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-07 21:56:42 +01:00
Corinna Vinschen 483cbf8954 Cygwin: AF_UNIX: define AF_UNIX_CONNECT_TIMEOUT
Use macro AF_UNIX_CONNECT_TIMEOUT instead of numerical constant
for connect timeout.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-07 21:55:34 +01:00
Corinna Vinschen 2f48ddb1ca Cygwin: Define FSCTL_PIPE_FLUSH
This fsctl might come in handy at one point...

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-07 21:54:46 +01:00
Corinna Vinschen 5bb4cc1e6c Cygwin: AF_UNIX: Implement read, readv, recvfrom, write, writev, sendto
All of these functions just call recvfrom/sendmsg which are still TODO

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-07 21:53:56 +01:00
Corinna Vinschen d7f7d292d8 Cygwin: reorder read/write calls in fhandler_socket_unix
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-07 21:52:29 +01:00