Commit Graph

11779 Commits

Author SHA1 Message Date
Takashi Yano 0ce27ecd08 Cygwin: Include local ntsecapi.h
Our local ntsecapi.h wrapper corrects a bug in the definition of
SystemFunction036 which otherwise leads to crashes on 32 bit when
using RtlGenRandom.  The fhandler_socket_local.cc file accidentally
included the incorrect w32api version of that file, rather than the
local wrapper.  Fix it.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-07-04 14:17:28 +02:00
Takashi Yano 1c1cec9cdf Fix a bug of psiginfo() that changes the orientation of stderr.
* strsig.cc (psiginfo): Fix the problem that psiginfo() changes
  the orientation of stderr to byte-oriented mode if stderr is
  not oriented yet.
2018-07-03 15:38:47 +02:00
Corinna Vinschen 995d2a824a Cygwin: tape: Handle non-standard "no medium" error code
Certain tape drives (known example: QUANTUM_ULTRIUM-HH6) return
the non-standard ERROR_NOT_READY rather than ERROR_NO_MEDIA_IN_DRIVE
if no media is present.  ERROR_NOT_READY is not documented as valid
return code from GetTapeStatus.  Without handling this error code
Cygwin's tape code can't report an offline state to user space.

Fix this by converting ERROR_NOT_READY to ERROR_NO_MEDIA_IN_DRIVE
where appropriate.

Add a debug_printf to mtinfo_drive::get_status to allow requesting
user info without having to rebuild the DLL.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-06-29 15:31:15 +02:00
Corinna Vinschen 4b97244d12 Cygwin: define pthread_tryjoin_np/pthread_timedjoin_np _GNU_VISIBLE
These functions are GNU extensions.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-06-27 18:20:47 +02:00
Corinna Vinschen c9d6787e76 Cygwin: doc: add pthread_tryjoin_np, pthread_timedjoin_np
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-06-27 18:20:11 +02:00
Corinna Vinschen cb3ddf9e2a Cygwin: pthread_timedjoin_np: return ETIMEDOUT, not EBUSY
pthread_timedjoin_np returns ETIMEDOUT if a thread is still running,
not EBUSY as pthread_tryjoin_np.

Also, clean up initializing timeout in pthread_tryjoin_np.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-06-27 18:19:18 +02:00
Corinna Vinschen 732e0b395d Cygwin: Implement pthread_tryjoin_np and pthread_timedjoin_np
- Move pthread_join to thread.cc to have all `join' calls in
  the same file (pthread_timedjoin_np needs pthread_convert_abstime
  which is static inline in thread.cc)
- Bump API version

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-06-27 17:56:59 +02:00
Corinna Vinschen 6497fdfaf4 Cygwin: fix bumptious GCC 7 warnings
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-06-26 17:20:48 +02:00
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 53960db861 Cygwin: Add Sergejs Lukanihins to contributors
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-05-29 18:34:54 +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