Commit Graph

8082 Commits

Author SHA1 Message Date
Mark Geisert 24ff42d79a Cygwin: Implement sigtimedwait
Abstract out common code from sigwait/sigwaitinfo/sigtimedwait to
implement the latter.
2017-12-18 19:46:18 +01:00
Corinna Vinschen 32988bd409 cygwin: add mmap fork fix to 2.10.0 release test
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-12-10 14:32:34 +01:00
Corinna Vinschen 0c201166f5 cygwin: mmap: fix comment and formatting, drop unused code
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-12-10 14:14:28 +01:00
Corinna Vinschen 67a657cb1d cygwin: mmap: fix a fork failure with private, anonymous mappings
Rounddown incoming addr on a page boundary. Without this, we may end
up with a fork error for private, anonymous maps.  The reason is, we
use VirtualAlloc in this case which will potentially overcommit if
addr is not on a page boundary.  This isn't taken into account in
bookkeeping, but fixup_mmaps_after_fork will eventually stumble over
this when trying to reproduce the copy-on-write pages: VirtualQuery
returns a region reaching beyond the supposedly allocated address
range and from there it goes downhill.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-12-10 14:14:24 +01:00
Corinna Vinschen 08d77e5154 cygwin: document %l[ and bump API minor
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-12-01 18:21:59 +01:00
Corinna Vinschen 10b57ba8d0 cygwin: Document latest changes, bump API minor
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-30 21:57:16 +01:00
Corinna Vinschen 27c1a7972c cygwin: [w]mempcpy: fix global symbol
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-30 21:34:29 +01:00
Corinna Vinschen aea710b5fb cygwin: x86_64: implement mempcpy/wmempcpy in assembler
* change memcpy to internal _memcpy not setting the return value in %rax
* implement all memcpy-like functions as caller to _memcpy, setting %rax
  to correct return value beforehand.  This is possible because _memcpy
  does not use %rax at all

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-30 21:15:28 +01:00
Yaakov Selkowitz f636eae26f cygwin: export wmempcpy
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-11-30 04:06:51 -06:00
Yaakov Selkowitz da4839ec18 cygwin: add Object Size Checking to sys/socket.h
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-11-30 04:06:48 -06:00
Yaakov Selkowitz b3281de25f cygwin: add Object Size Checking to sys/poll.h
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-11-30 04:06:47 -06:00
Yaakov Selkowitz 552a20ab4e cygwin: create libssp compatibility import library
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-11-29 11:25:49 -06:00
Yaakov Selkowitz 6a848db442 cygwin: export SSP functions
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-11-29 11:25:48 -06:00
Yaakov Selkowitz f2b27ce620 cygwin: define _POSIX_TIMEOUTS
Since commit 8128f5482f, we have all the
non-tracing functions listed in posixoptions(7).  The tracing functions
are gated by their own option, and are obsolecent anyway.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-11-28 10:26:00 -06:00
Corinna Vinschen 76bd5cab33 cygwin: don't allow empty strings in __ASMNAME tags
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-28 13:31:20 +01:00
Corinna Vinschen df75aedc20 cygwin: improve _EXFUN tags generation
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-28 13:26:37 +01:00
Corinna Vinschen 2d2833dfab cygwin: remove accidentally committed debug statments
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-28 13:12:07 +01:00
Corinna Vinschen 662740b3d0 cygwin: further improve tags generation
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-28 13:10:34 +01:00
Yaakov Selkowitz 032aa2dba5 Feature test macros overhaul: Cygwin limits.h, part 2
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html
https://sourceware.org/ml/newlib/2017/msg01133.html

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-11-28 04:11:33 -06:00
Corinna Vinschen 76f06705be cygwin: convert most #ifndef __x86_64__ to #ifdef __i386__
Address the real offender

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-27 14:36:06 +01:00
Corinna Vinschen bc14f1c174 cygwin: improve tags generation
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-27 14:34:40 +01:00
Corinna Vinschen 9789cdffde cygwin: cleanup fhandler_socket::release_events
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-27 13:38:21 +01:00
Corinna Vinschen 57732f9b4b Cygwin: pipe_data_available: cleanup code
* Don't use a bool var to store three states (-1, 0, 1).
* Correctly check for NT_SUCCESS of a function returning NTSTATUS.
* Straighten out code for better readability.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-15 21:49:28 +01:00
Corinna Vinschen 0d57ef9de5 Cygwin: open: Remove unused code to handle HIDDEN and SYSTEM files
Commit 603ef545bd broke this snippet and
commit 5b312b4747 didn't help at all since
FILE_CREATE is exactly *not* the situation the test was originally
supposed to handle.

In fact, none of the open flags used by fhandler_base::open actually
hits this problem anymore, so just drop the code.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-14 21:50:32 +01:00
Corinna Vinschen 0b0b2b96f2 Cygwin: link: Simplify an expression
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-14 21:45:32 +01:00
Corinna Vinschen ce0b11f9c4 Cygwin: Bump DLL version to 2.10.0, bump API minor to 319
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-14 21:45:32 +01:00
Corinna Vinschen 0aa99373c1 Cygwin: fcntl.h: Define O_TMPFILE and implement it
Difference to Linux: We can't create files which don't show up
in the filesystem due to OS restrictions.  As a kludge, make a
(half-hearted) attempt to hide the file in the filesystem.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-14 21:45:25 +01:00
Corinna Vinschen f94fe74aad Cygwin: open: cleanup code in preparation of O_TMPFILE
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-14 16:30:44 +01:00
Corinna Vinschen 181fe5d2ed cygwin: pread: Remove incorrect comment
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-08 13:36:34 +01:00
Corinna Vinschen c983aa4879 cygwin: fhandler_disk_file::pread: always print debug info on return
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-08 13:30:42 +01:00
Xiaofeng Liu 46702f92ea cygwin: pread() returns non-zero if read beyond EOF
NtReadFile returns EOF status but doesn't set information to 0.
Set return value explicitly on EOF.
2017-11-08 13:21:30 +01:00
Corinna Vinschen 2e989b2129 cygwin: fix stray semicolon
introduced by patch 1c50e0d1ab

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-07 16:34:29 +01:00
Corinna Vinschen 2640628b09 cygwin: add socket bugfix to release notes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-07 16:11:08 +01:00
Erik M. Bray 1c50e0d1ab Fix two bugs in the limit of large numbers of sockets:
* Fix the maximum number of sockets allowed in the session to 2048,
  instead of making it relative to sizeof(wsa_event).

  The original choice of 2048 was in order to fit the wsa_events array
  in the .cygwin_dll_common shared section, but there is still enough
  room to grow there to have 2048 sockets on 64-bit as well.

* Return an error and set errno=ENOBUF if a socket can't be created
  due to this limit being reached.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-07 16:08:14 +01:00
Corinna Vinschen ad15b8ccee cygwin: ftruncate64: add missing braces
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-02 19:13:09 +01:00
Corinna Vinschen 09d60f6444 cygwin: add 2.9.1 release messages file
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-02 18:09:39 +01:00
Erik M. Bray 94854321bb posix_fallocate() *returns* error codes but does not set errno
Also updates the fhandler_*::ftruncate implementations to adhere to the same
semantics.  The error handling semantics of those syscalls that use
fhandler_*::ftruncate are moved to the implementations of those syscalls (
in particular ftruncate() and friends still set errno and return -1 on error
but that logic is handled in the syscall implementation).
2017-11-02 18:01:01 +01:00
Erik M. Bray 8c8cdd9ad7 posix_fadvise() *returns* error codes but does not set errno
Also updates the fhandler_*::fadvise implementations to adhere to the same
semantics.
2017-11-02 17:58:18 +01:00
Corinna Vinschen 3bdd484103 cygwin: belatedly bump DLL minor version
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-10-18 16:40:56 +02:00
Corinna Vinschen 88cfcda06b cygwin: unlink: workaround NFS non-ability to move file in certain cases
Under some not quite clear conditions, NFS fails to use its
unlink workaround to rename a file to ".nfsXYZ".  The problem has been
reproduced with the GAWK testext.awk testcase.  To workaround this in
Cygwin, we now call try_to_bin on NFS, too.  For some reason NFS doesn't
fail to rename the .cygXYZ file to .nfsXYZ after this Cygwin rename.
Fix comment in unlink_nt accordingly.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-10-18 16:27:17 +02:00
Corinna Vinschen 5b7921523d cygwin: unlink: don't try "final trick" in try_to_bin on NFS
Doesn't work.  Just another STATUS_SHARING_VIOLATION.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-10-18 16:22:14 +02:00
Corinna Vinschen e6c79e7a2a cygwin: unlink: fix "final trick" overwrite method on remote drives
The "final trick" code in try_to_bin accidentally never worked on
remote drives because it relies on rootdir.  Which isn't set for
remote unlinks.  The code now creates a full path for remote files.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-10-18 16:21:12 +02:00
Corinna Vinschen 3dda58f157 cygwin: unlink: improve debug messages in try_to_bin
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-10-18 16:18:12 +02:00
Corinna Vinschen 9ac4c0325f cygwin: unlink: simplify rootdir handling
In try_to_bin, rootdir is NULL for remote drives anyway.  No extra
check required.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-10-18 16:15:08 +02:00
Corinna Vinschen 5224eb7517 cygwin: unlink: drop redundant check for netapp FS
The try_to_bin function isn't called for netapp FSes anyway, so testing
for this FS type in the function is moot.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-10-18 16:13:48 +02:00
Corinna Vinschen 7127e8ef3b cygwin: unlink: Fix typos in comments
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-10-18 16:12:42 +02:00
Yaakov Selkowitz 747f31854a cygwin: fix gethostbyaddr argument types
The first argument of gethostbyaddr needs to accept a generic pointer
to be compatible with e.g. struct in_addr *.  This caused an issue
compiling krb5-1.15.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-10-10 13:51:23 -05:00
Yaakov Selkowitz 0b45b053e8 Feature test macros overhaul: Cygwin netdb.h
herror etc. are MISC, rcmd etc. are BSD, addrinfo functions are
POSIX.1-2001, except for IDN functionality which is GNU.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-10-10 13:50:46 -05:00
Michael Haubenwallner 1adbd77cab cygwin: fix potential buffer overflow in fork
When fork fails, we can use "%s" now with system_sprintf for the errmsg
rather than a (potentially too small) buffer for the format string.

* fork.cc (fork): Use "%s" with system_printf now.
2017-10-10 15:51:06 +02:00
Michael Haubenwallner 4449971295 cygwin: fix potential buffer overflow in small_sprintf
With "%C" format string, argument may convert in up to MB_LEN_MAX bytes.
Relying on sys_wcstombs to add a trailing zero here requires us to
provide a large enough buffer.

* smallprint.c (__small_vsprintf): Use MB_LEN_MAX+1 bufsize for "%C".
2017-10-10 13:35:16 +02:00
Michael Haubenwallner 4bee8c48df cygwin: initialize variable for stack unwinding
The third argument of RtlLookupFunctionEntry actually is documented as
_Inout_opt_ for both x64 and ARM, although generic doc says _Out_ only.

* exceptions.cc (__unwind_single_frame): Initialize hist variable.
2017-10-09 18:58:52 +02:00
Corinna Vinschen 7346a162f2 cygwin: disable -Wframe-address warning only on GCC 6 or later
This is required as long as we don't have a GCC 6.x cross compiler
on Linux.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-10-09 18:08:10 +02:00
Ken Brown 51c6ef6b82 cygwin: Remove workaround for GCC 6 null pointer check warnings 2017-10-09 11:44:11 +02:00
Ken Brown 7212b571a5 cygwin: Remove comparison of 'this' to NULL in _pinfo::exists
Fix all callers.
2017-10-09 11:44:11 +02:00
Ken Brown 5952d5f08f cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::kill
Fix all callers.
2017-10-09 11:44:11 +02:00
Ken Brown d17c45f200 cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::environ
Fix all callers.
2017-10-09 11:44:11 +02:00
Ken Brown 6cd1978fc8 cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::fd
Fix all callers.
2017-10-09 11:44:11 +02:00
Ken Brown 56f23a5107 cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::pipe_fhandler
Fix all callers.
2017-10-09 11:44:11 +02:00
Ken Brown d1ea8f4a46 cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::commune_request
Fix all callers.
2017-10-09 11:44:11 +02:00
Ken Brown 911f7d628d cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::cmdline
Fix all callers.
2017-10-09 11:44:11 +02:00
Ken Brown 571b7689bb cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::cwd
Fix all callers.
2017-10-09 11:44:11 +02:00
Ken Brown be436ad2a3 cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::root
Fix all callers.
2017-10-09 11:44:11 +02:00
Ken Brown 504959d8fc cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::fds
Fix all callers.
2017-10-09 11:44:11 +02:00
Ken Brown 47bbe23105 cygwin: Remove comparisons of 'this' to 'NULL' in fhandler_dsp.cc
Fix all callers.
2017-10-09 11:44:10 +02:00
Yaakov Selkowitz 05cfd1aed8 cygwin: workaround GCC 6 changes
GCC 6 includes a number of new warnings which cause Cygwin to either not
compile, or not work properly even if said warnings are ignored:

https://cygwin.com/ml/cygwin-developers/2017-09/msg00000.html
https://gcc.gnu.org/gcc-6/porting_to.html

For now, we use the flags necessary to revert to GCC 5 behaviour until we
can fix the code properly.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-09-12 14:30:34 -05:00
Yaakov Selkowitz 21a39b20a5 Revert "cygwin: only expose /dev/con{in,out,sole} when started from a Windows console"
This caused serious regressions when running from a cmd window:

https://cygwin.com/ml/cygwin/2017-09/msg00114.html

This reverts commit b706c6b479.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-09-11 23:07:55 -05:00
Sebastian Huber 4de8754bac Change time_t to 64-bit by default
In order to avoid the year 2038 problem, define time_t to a signed
integer with at least 64-bits.  The type for time_t can be forced to
long with the --enable-newlib-long-time_t configure option or with the
_USE_LONG_TIME_T system configuration define.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-09-07 15:39:34 +02:00
Corinna Vinschen cdbec10e79 cygwin: add strptime %F fix to release notes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-08-29 21:12:21 +02:00
Brian Inglis d8e2463c75 winsup/cygwin/libc/strptime.cc(__strptime) fix %F width 2017-08-29 21:10:06 +02:00
Corinna Vinschen 4dfaef8141 cygwin: document %s support in strptime
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-08-29 11:16:13 +02:00
Corinna Vinschen cf8bf843f8 cygwin: export strnstr
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-08-25 18:00:46 +02:00
Brian Inglis 8324ab5e2a winsup/cygwin/libc/strptime.cc(__strptime) add %s support to strptime 2017-08-25 11:39:11 +02:00
Corinna Vinschen b706c6b479 cygwin: only expose /dev/con{in,out,sole} when started from a Windows console
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-08-23 17:43:41 +02:00
Ken Brown 3012e251fa Document renameat2 2017-08-19 19:43:15 +02:00
Ken Brown f665b1cef3 cygwin: Implement renameat2
Define the RENAME_NOREPLACE flag in <cygwin/fs.h> as defined on Linux
in <linux/fs.h>.  The other RENAME_* flags defined on Linux are not
supported.
2017-08-19 18:06:49 +02:00
Eric Blake 7b3d8b9485 headers: avoid bareword attributes
Always use the __-decorated form of an attribute name in public
headers, as the bareword form is in the user's namespace, and we
don't want compilation to break just because the user defines the
bareword to mean something else.

Signed-off-by: Eric Blake <eblake@redhat.com>
2017-08-17 07:10:03 -05:00
Corinna Vinschen 65c13851b3 cygwin: pthread timed locks: actually timeout on timeout
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-08-03 23:14:21 +02:00
Corinna Vinschen f378384804 cygwin: pthread_rwlock_rdlock: don't set errno, just return error code
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-08-03 23:09:57 +02:00
Corinna Vinschen 8128f5482f cygwin: Implement pthread_rwlock_timedrdlock, pthread_rwlock_timedwrlock
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-08-03 21:31:38 +02:00
Corinna Vinschen eb206317a8 cygwin: Bump DLL version to 2.9.0
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-08-03 19:17:45 +02:00
Corinna Vinschen 37738448a0 cygwin: Implement pthread_mutex_timedlock
- pthread_mutex::lock now takes a PLARGE_INTEGER timeout pointer
  and uses that in the call to cygwait.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-08-03 19:13:21 +02:00
Corinna Vinschen 68217c3178 cygwin: simplify pthread timedwait handling
- Introduce inline helper pthread_convert_abstime.  It converts
  an absolute timespec to a Windows LARGE_INTEGER timestamp,
  depending on the used clock.

- Use this function from pthread_cond_timedwait and semaphore::timedwait

- Merge semaphore::_wait and semaphore::_timedwait into single _wait
  method, taking a LARGER_INTEGER timestamp.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-08-03 19:08:31 +02:00
Corinna Vinschen a346a26790 cygwin/signal.h: Remove SI_QUEUE unimplemented comment
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-08-03 14:56:24 +02:00
Corinna Vinschen f41d402bd4 Revert "cygwin/signal.h: Remove SI_QUEUE unimplemented comment"
This reverts commit 54ed68a781.
2017-08-03 14:55:21 +02:00
Corinna Vinschen 54ed68a781 cygwin/signal.h: Remove SI_QUEUE unimplemented comment
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-08-03 14:54:02 +02:00
Yaakov Selkowitz 109a3a02a3 cygwin: add explicit_bzero, elf.h changes to release
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-08-02 04:38:01 -05:00
Yaakov Selkowitz 4aaec3cb88 Add elf.h to newlib
This is copied from musl (MIT license).  This is newer and more thorough
than that of FreeBSD currently shipped only on Cygwin.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-08-02 01:18:55 -05:00
Yaakov Selkowitz 2c83bc950f cygwin: Export explicit_bzero
This was added to newlib together with timingsafe_*cmp but never exported.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-08-02 01:09:49 -05:00
Corinna Vinschen 60546ae529 cygwin: generate Alt-Numpad characters independent of NumLock state
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-08-01 14:10:50 +02:00
Corinna Vinschen 8c4f86dd8e cygwin: add console issues to release notes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-07-31 23:08:19 +02:00
Corinna Vinschen e6c75c1de1 cygwin: select: use UNICODE console functions
For historical reasons peek_console was calling the functions
PeekConsoleInputA and ReadConsoleInputA.  However, these functions are
not working correctly under at least codepage 65001 (UTF-8) on systems
prior to Windows 10.

Use PeekConsoleInputW and ReadConsoleInputW instead, which work
correctly under all systems and all codepages.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-07-31 22:57:06 +02:00
Corinna Vinschen 7b9bfb4136 cygwin: console: Use memset to clear an array
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-07-31 11:44:02 +02:00
Corinna Vinschen 9374e7f65d cygwin: clear screen using wide char function
FillConsoleOutputCharacterA doesn't work correctly in codepage 65001
(UTF-8).  Looks like the character conversion function from ascii char
to unicode char works incorrectly then.  Use FillConsoleOutputCharacterW
instead.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-07-31 11:43:35 +02:00
Corinna Vinschen 4bccfcca5b cygwin: add release notes for reparse point patches
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-07-24 23:04:34 +02:00
Corinna Vinschen 3e80cefb16 cygwin: unify reparse point checking code into single function
So far we had two functions checking the content of a reparse point,
readdir_check_reparse_point in fhandler_disk_file.cc for the sake of
readdir, and symlink_info::check_reparse_point for the sake of
generic path checking.

* Rename check_reparse_point_target helper to check_reparse_point_string
  and convert to static function.
* Create new check_reparse_point_target helper containing the core
  reparse point checking code
* Just call check_reparse_point_target from readdir_check_reparse_point
  and symlink_info::check_reparse_point and only perform the unique
  task in those functions.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-07-24 17:33:20 +02:00
Corinna Vinschen 42f1be581c cygwin: fix formatting in check_reparse_point_target
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-07-24 17:32:20 +02:00
Corinna Vinschen be1485191f cygwin: Fix resource leak in readdir reparse point handling
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-07-24 17:26:17 +02:00
Corinna Vinschen d2ae2f00b8 cygwin: add fflush fix to release notes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-07-19 10:41:36 +02:00
Corinna Vinschen a674199fc9 cygwin: Bump DLL version to 2.8.3
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-07-19 10:38:15 +02:00
Corinna Vinschen 9cc89b0438 cygwin: Use errno instead of _impure_ptr->_errno
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-07-19 10:30:47 +02:00
Corinna Vinschen 78ade082fe Revert "errno: Stop using _impure_ptr->_errno completely"
This reverts commit 44b1746a41.

Bad idea.  _impure_ptr->_errno is used by newlib

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-07-19 10:28:39 +02:00
Corinna Vinschen e09a25c01b cygwin: 2.8.2: add missing release message text
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-07-12 10:49:10 +02:00
Yaakov Selkowitz 5fac663b29 cygwin: document signal.h fixes
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-07-12 03:24:50 -05:00
Corinna Vinschen 2d9c69da1c cygwin: export fls, flsl, flsll
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-07-11 10:31:44 +02:00
Yaakov Selkowitz 187066dcad Cygwin: fix guard on struct siginfo_t
Add line breaks to make it clearer that the struct packing applies to more
than one struct.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-07-10 07:53:26 -05:00
David Macek bf61b38d98 Rename __in and __out in headers to avoid collision with Windows APIs
* string.h: Local variables in expansion of strdupa and strndupa
* sys/wait.h: Fields in anonymous union in expansion of __wait_status_to_int
2017-07-07 16:37:44 +02:00
Sebastian Huber 461152e4eb Add ffsl(), ffsll(), fls(), flsl(), flsll()
Use compiler builtin for ffs().  Remove duplicate implementation from
Cygwin.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-07-05 13:49:48 +02:00
Yaakov Selkowitz 8a508f301c Cygwin: fix signal.h with _POSIX_C_SOURCE=1
struct sigaction is POSIX.1-1990 but siginfo_t, which is used by its
sa_sigaction member, is POSIX.1b-1993.  Therefore it needs to be guarded
as well, and as part of a union, the struct size is protected.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-07-04 19:22:23 -05:00
Corinna Vinschen 56c1cfa009 add scandirat patch to release notes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-07-04 15:13:31 +02:00
Corinna Vinschen 1a942680bf cygwin: scandirat: fix path given to scandir
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-07-04 15:11:06 +02:00
Corinna Vinschen 055daff132 Bump DLL minor version
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-07-04 15:10:27 +02:00
Corinna Vinschen 92fc6ea7e3 Note regtool fix in release message
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-06-22 14:48:43 +02:00
Corinna Vinschen 185cd97d24 cygwin: readdir: Activate check for remote reparse points
Fix and move comment accordingly.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-06-20 10:06:45 +02:00
Joe_Lowe 7a4e299a18 Compatibility improvements to reparse point handling. 2017-06-20 09:57:36 +02:00
Yaakov Selkowitz f698efbce1 cygwin: export strverscmp, add versionsort
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-06-19 08:16:42 -05:00
Erik M. Bray 5ca286666a Ensure that send() interrupted by a signal returns sucessfully
When SA_RESTART is not set on a socket, a blocking send() that is
interrupted mid-transition by a signal should return success (and
report just how many bytes were actually transmitted).

The err variable used here was not always guaranteed to be set
correctly in the loop, so better to just remove it and call
WSAGetLastError() explicitly.
2017-06-19 12:51:39 +02:00
Yaakov Selkowitz a5cc86ba13 cygwin: document XSI sigpause
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-06-14 14:30:44 -05:00
Yaakov Selkowitz dde6af6f82 Export XSI sigpause
There are two common sigpause variants, both of which take an int argument.
If you request _XOPEN_SOURCE or _GNU_SOURCE, you get the System V version,
which removes the given signal from the process's signal mask; otherwise
you get the BSD version, which sets the process's signal mask to the given
value.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-06-14 14:23:52 -05:00
Yaakov Selkowitz 6a6c1c52e6 Feature test macros overhaul: Cygwin signal.h
This should match newlib's <sys/signal.h>.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-06-14 10:18:15 -05:00
Corinna Vinschen 8eada33223 cygwin: readdir: don't lookup mount target inodes
So far Cygwin's readdir returned the inode number of a mount target
in d_ino, rather than the actual inode number of the mount point in
the underlying filesystem.  This not only results in a performance
hit if the mount target is a remote FS, it is also not done on other
POSIX systems.

Remove the code evaluating the mount target inode number.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-06-14 13:22:56 +02:00
Joe Lowe 0a9edd73e3 readdir() with mount point dentry, return mount point INO
This patch fixes a minor compatibility issue w/ cygwin mount point handling in
readdir(), compared to equivalent behavior of Linux and MacOS. dentry.d_ino
should indicate the INO of the mount point itself, not the target volume root
folder.

Changed return type from readdir_check_reparse_point to uint8_t, to avoid
unnecessarily being implicitly cast to and from a signed int.

Renamed a related local variable "attr" to "oattr" that was eclipsing a member
variable with the same name.

Joe L.
2017-06-14 10:57:02 +02:00
Corinna Vinschen 105436dead cygwin: document lrint bugfix
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-06-07 11:07:52 +02:00
Corinna Vinschen e4094e49c1 cygwin: Fix lrint{f,l} to return a 64 bit long on x86_64
Mingw-w64 (where the code has been taken from) has 4 byte longs
independently of the architecture but x86_64 Cygwin has 64 bit longs.
So use fistpll instead of fistpl on x86_64 Cygwin.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-06-07 11:03:16 +02:00
Corinna Vinschen 163066a1a5 cygwin: document env var crash fix
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-06-06 21:11:52 +02:00
Corinna Vinschen 7afc1124b6 cygwin: Fix crash if env var name starts with non-ASCII char
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-06-06 21:10:23 +02:00
Corinna Vinschen 41b7ef9e1f cygwin: document wcsxfrm fix
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-06-06 18:39:41 +02:00
Corinna Vinschen c0d7d3e1a2 cygwin wcsxfrm: byte swap result ourselves
Workaround a bug (or undocumented behaviour) in LCMapStringW:

It's documented(*) that the cchDest parameter is a byte count with
LCMAP_SORTKEY, but a character count otherwise.  But the docs don't
state what happens if you combine LCMAP_SORTKEY with LCMAP_BYTEREV.

Tests indicate that LCMAP_SORTKEY treats cchDest as byte count, but
then LCMAP_BYTEREV treats it as char count in the same call.  So the
latter swaps twice as much bytes in the destination buffer than the
byte count it returns, which potentially results in writing past the
end of the given output buffer.

Solution: Don't specify LCMAP_BYTEREV in the LCMapStringW(LCMAP_SORTKEY)
call, rather byte swap afterwards.

(*) https://msdn.microsoft.com/en-us/library/windows/desktop/dd318702(v=vs.85).aspx

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-06-06 18:27:47 +02:00
Jon Turney fe7a7709ef Fix transposed lines in 2.8.1 release text 2017-04-24 17:17:38 +01:00
Jon Turney 2980e76ae3 Update 2.8.1 release text 2017-04-24 17:13:04 +01:00
Corinna Vinschen fccaaee026 cygwin: add 2.8.1 release file
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-04-24 17:36:54 +02:00
Corinna Vinschen 7437d656cb cygwin TEST: Add nagging debug output to pinfo
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-04-24 17:35:06 +02:00
Corinna Vinschen 5ef0399ddd cygwin: pinfo: do not wait for setting ppid on a transitional procinfo
This leads to excessive lag when stracing processes if the inferior
process checks the process table.  The reason is that ppid isn't set
in the procinfo memory of the dynamically loading strace itself.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-04-24 17:34:31 +02:00
Corinna Vinschen ffcfbf4b66 cygwin: try unprivileged symlink creation on W10 1703 and later
Add new SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE flag to
CreateSymbolicLinkW call when running on W10 1703 or later.
Don't do that on older versions to avoid ERROR_INVALID_PARAMETER.

Preliminary, needs testing.  There's an off-chance that the
flag results in the same ERROR_INVALID_PARAMETER on 1703 if the
developer settings are not enabled.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-04-24 17:17:29 +02:00
Corinna Vinschen e7bcf4633e cygwin: wincap: handle W10 1703
Add has_unprivileged_createsymlink flag and set to true on 1703 and
later.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-04-24 17:14:03 +02:00
Corinna Vinschen 63f19278b9 cygwin: wincap: fix evaluation of build number
RtlGetNtVersionNumbers returns the build number with some upper bits
set for no apparent reason.  The fact that RtlGetNtVersionNumbers is
undocumented doesn't exactly help.

Just filter out the upper WORD for now.  If build numbers are in
danger to become 6 digit numbers, re-evaluate.
2017-04-24 17:12:16 +02:00
Corinna Vinschen 3885c06c4f cygwin: remov unused winpids constructor
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-04-24 14:22:02 +02:00
Christian Franke b8523353d7 Fix stat.st_blocks for files compressed with CompactOS method
Always retrieve FileCompressionInformation for non-empty
files if FileStandardInformation returns 0 allocated blocks.
This fixes stat.st_blocks for files compressed with CompactOS method.

Signed-off-by: Christian Franke <franke@computer.org>
2017-04-22 16:12:36 +02:00
Corinna Vinschen bdb017b30c newlib: remove __infinity{f,ld} constants
previous commit 4c90db7bc8 introduced
a compile time error because libm/common/s_infconst.c used the remove
__fmath, __dmath, and __ldmath union types.

Since this is very old, and unused for a very long time, just drop the
file and thus the __infinity constants entirely.

Exception: Cygwin exports __infinity from the beginning.  There's a very,
VERY low probability that any existing executable or lib still uses this
constant, but we just keep it in for backward compat, nevertheless.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-04-18 12:17:26 +02:00
Jon Turney c84697c259 Avoid decimal point localization in /proc/loadavg
Explicitly format the contents of /proc/loadavg to avoid the decimal point
getting localized according to LC_NUMERIC. Using anything other than '.' is
wrong and breaks top.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2017-04-10 10:59:54 +01:00
Mark Geisert c6c7dfc493 mkvers.sh: Remove "function" to avoid dash objecting to bash-ism. 2017-04-06 18:17:08 +02:00
Corinna Vinschen 961a6909d9 Cygwin: Export reallocarray
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-04-04 12:23:18 +02:00
Corinna Vinschen 6f88e6b2d5 Bump Cygwin to 2.8.1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-04-04 12:23:09 +02:00
Corinna Vinschen 577c9d55da Add latest changes to Cygwin release information
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-03-28 13:42:11 +02:00
Corinna Vinschen b5b03d2d5f Change CURR_SHARED_MAGIC to account for getloadavg patch
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-03-28 13:41:31 +02:00
Jon Turney d0a359f6d2 Implement getloadavg()
v2:
autoload PerfDataHelper functions
Keep loadavg in shared memory
Guard loadavg access by a mutex
Initialize loadavg to the current load

v3:
Shared memory version bump isn't needed if we are only extending it
Remove unused autoload
Mark inititalized flags as NO_COPY for correct behaviour in fork child

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2017-03-27 22:03:58 +01:00
Jon Turney b568f92c50 declaration of ppoll() by poll.h should be guarded by _GNU_SOURCE
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2017-03-27 22:03:01 +01:00
Corinna Vinschen bbffd7ce7a Recognize Netapp mode supporting reparse points
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-03-27 20:28:03 +02:00
Corinna Vinschen fa4fcf7373 cygwin: Do not generate surrogate chars on netapp
Just like Samba, Netapp FSes seem to dislike invalid surrogate usage in
filenames.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-03-24 20:52:25 +01:00
Corinna Vinschen 0accc5332a Document cygserver changes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-03-24 18:13:08 +01:00
Corinna Vinschen 8259db586a dlfcn: Remove stray debug output
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-03-22 11:10:15 +01:00