Commit Graph

11833 Commits

Author SHA1 Message Date
Sebastian Huber da418955f5 Move common <sys/dirent.h> content to <dirent.h>
Move common content of the various <sys/dirent.h> and the latest FreeBSD
<dirent.h> to <dirent.h>.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-10-11 08:29:16 +02:00
Corinna Vinschen 682c4a9f1e Implement nanl in newlib only
Drop Cygwin-specific nanl in favor of a generic implementation
in newlib.  Requires GCC 3.3 or later.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-10-10 17:49:53 +02:00
Corinna Vinschen 323b48b975 Cygwin: lseek: return ESPIPE rather than EINVAL when called on a fifo
Thanks to Henri for tracking this down:
https://cygwin.com/ml/cygwin/2018-10/msg00062.html

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-10-10 13:20:45 +02:00
Corinna Vinschen d83404e418 Cygwin: console: make sure EnumFontFamiliesExW loop isn't infinite
The current loop condition is borderline.  Make sure it ends and
choose a replacement char in the unlikely case the current console
font isn't recognized at all.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-09-07 13:49:54 +02:00
Corinna Vinschen 7a720bfe08 Cygwin: console: store replacement char directly
Rather than relying on an index variable, store the current
replacement char and use that directly in WriteConsoleW.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-09-07 13:48:35 +02:00
Corinna Vinschen 60471176fd Cygwin: console: don't hang in check_font with raster fonts
EnumFontFamiliesExW fails if the font is "Terminal" (aka "Raster Fonts")
and lfCharSet requests ANSI_CHARSET.  Using DEFAULT_CHARSET fixes this.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-09-07 13:44:44 +02:00
Corinna Vinschen 85c030a75f Cygwin: console: device context is process private
Make sure device context is not copied to forked process.
It is a process-specific datastructure.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-09-06 13:05:55 +02:00
Corinna Vinschen bf8aabe830 Cygwin: console: improve replacement char algorithm
Try various Unicode characters which may be used as a replacement
character in case an invalid character has to be printed.

Current list is 0xfffd "REPLACEMENT CHARACTER", 0x25a1 "WHITE SQUARE",
and 0x2592 "MEDIUM SHADE" in that order.

Additionally workaround a problem with some fonts (namely DejaVu
Sans Mono) which are returned wit ha broken fontname with trailing
stray characters.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-09-05 23:39:25 +02:00
Corinna Vinschen 213d8cac24 Cygwin: console: use UNICODE API throughout
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-09-05 13:08:33 +02:00
Corinna Vinschen 9bbda85e27 Cygwin: Bump DLL version to 2.11.2
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-09-05 13:02:09 +02:00
Corinna Vinschen d1454de7b0 Cygwin: console: Print Unicode REPLACEMENT CHARACTER for invalid input chars
So far we printed a half filled square (0x2592) if the input char is
invalid, but using REPLACEMENT CHARACTER (0xfffd) is apparently the way
to go.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-09-01 21:34:37 +02:00
Corinna Vinschen 3a880bf5e0 Cygwin: fix Win32 path ".." backtracking
Commit 35998fc2fa fixed the buffer underun
in win32 path normalization, but introduced a new bug: A wrong
assumption led to the inability to backtrack the path outside of the
current working directory in case of relative paths.

This patch fixes this problem, together with a minor problem if the CWD
is on a network share: The result erroneously started with tripple
backslash if the src path starts with a single backslash.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-09-01 21:06:24 +02:00
Corinna Vinschen fc3a8ecca5 Cygwin: Bump DLL version to 2.11.1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-31 13:01:23 +02:00
Corinna Vinschen 03cd2c4efa Cygwin: Accommodate logon sessions on Windows 10
Starting with Windows 10, LookupAccountSid/Name return valid
info for the login session with new SID_NAME_USE value
SidTypeLogonSession.  To return the same info as on pre-Windows 10,
we have to handle this type.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-28 11:28:28 +02:00
Corinna Vinschen 3aba266aa9 Cygwin: drop workaround for missing USER_INFO_24 definition
Recent mingw64 provide USER_INFO_24

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-28 11:24:59 +02:00
Corinna Vinschen fc8aaa40fe Cygwin: add release note for previous ACL changes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-27 18:30:59 +02:00
Corinna Vinschen 33b8c406dc Cygwin: Add name->SID conversion for self-constructed names
...as far as it makes sense.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-27 18:28:33 +02:00
Corinna Vinschen fcfcc288c4 Cygwin: don't return valid acl entry type for unknown SID
cygpsid::get_id neglects to set the type to 0 (ACL_UNDEFINED_TAG
in POSIX speak) if the SID can not be translated into a valid
uid or gid.  This in turn leads to incorrect handling of uid/gid -1
entries.

Fix this by setting type to 0 if the id is unknown.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-27 13:48:07 +02:00
Corinna Vinschen 6706b19a97 Cygwin: Remove union wait
This patch follows glibc.  Original commit message:

Author:	Florian Weimer <fweimer@redhat.com>
Date:   Thu, 14 Apr 2016 06:54:57 +0000

Remove union wait [BZ #19613]

The overloading approach in the W* macros was incompatible with
integer expressions of a type different from int.  Applications
using union wait and these macros will have to migrate to the
POSIX-specified int status type.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-24 20:57:47 +02:00
Sebastian Huber 5d29023c11 Add __nl_item to <sys/_types.h> and use it
Add __nl_item to <sys/_types.h> for FreeBSD compatibility.  Use it in
<langinfo.h> and the Cygwin <nl_types.h>.  Make the enum __nl_item in
<langinfo.h> anonymous.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-08-24 15:00:01 +02:00
Corinna Vinschen 36cb95f602 CYgwin: fix typo in comment
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-24 13:36:06 +02:00
Corinna Vinschen 71b4e3b336 Cygwin: get_mem_values: Fix prototype
Incomplete change unsigned long -> size_t was only visible on 32 bit, sigh.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-17 20:40:18 +02:00
Corinna Vinschen 09c114d7e2 Cygwin: document /proc/<PID>/status and /proc/<PID>/statm patches
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-17 20:33:38 +02:00
Corinna Vinschen c2fa05899d Cygwin: get_mem_values: Return number of Cygwin pages in arguments
Simplify callers accordingly.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-17 20:32:42 +02:00
Corinna Vinschen 7b70195f5d Cygwin: get_mem_values: Convert arguments to call-by-reference
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-17 20:32:42 +02:00
Corinna Vinschen 630294d373 Cygwin: get_mem_values: Return allocation as size_t values
Use size_t in callers, too.  Fix __small_sprintf format specifiers.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-17 20:32:42 +02:00
Corinna Vinschen ca2ec0c5cc Revert "Use allocation granularity as the 'page_size' in /proc/<pid>/status as well, for consistency with /proc/<pid>/statm"
This reverts commit 8a32c24a7b.

Replacing page_size() with allocation_granularity() was incorrect.
The values returned by get_mem_values() are # of pages of size
page_size().  Multiplying with allocation_granularity() here
results in values 16 times too big.
2018-08-17 19:16:42 +02:00
Corinna Vinschen 76d17e6860 Cygwin: Add missing items to release notes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-17 11:49:24 +02:00
Ken Brown ed4d919c24 setfacl: Rename the option --file to --set-file, as on Linux
Retain --file as an undocumented option for backwards compatibility.
2018-08-17 11:35:24 +02:00
Corinna Vinschen ef11dd8b47 Cygwin: Add FE_ALL_EXCEPT change to release notes.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-15 18:02:22 +02:00
J.H. van de Water 4c4c19f548 Keep the denormal-operand exception masked; modify FE_ALL_EXCEPT accordingly.
By excluding the denormal-operand exception from FE_ALL_EXCEPT, it will not
be possible anymore to UNmask this exception by means of the API defined by
/usr/include/fenv.h

Note: terminology has changed since IEEE Std 854-1987; denormalized numbers
are called subnormal numbers nowadays.

This modification has basically been motivated by the fact that it is also
not possible on Linux to manipulate the denormal-operand exception by means
of the interface as defined by /usr/include/fenv.h. This has been the state
of affairs on Linux since 2001 (Andreas Jaeger).

The exceptions required by the standard (IEEE Std 754), in case they can be
supported by the implementation, are:
FE_INEXACT, FE_UNDERFLOW, FE_OVERFLOW, FE_DIVBYZERO and FE_INVALID.

Although it is allowed to define additional exceptions, there is no reason
to support the "denormal-operand exception" in this case (fenv.h), because
the subnormal numbers can be handled almost as fast the normalized numbers
by the hardware of the x86/x86_64 architecture. Said differently, a reason
to trap on the input of subnormal numbers does not exist. At least that is
what William Kahan and others at Intel asserted around 2000.
(that is William Kahan of the K-C-S draft, the precursor to the standard)

This commit modifies winsup/cygwin/include/fenv.h as follows:
 - redefines FE_ALL_EXCEPT from 0x3f to 0x3d
 - removes the definition for FE_DENORMAL
 - introduces __FE_DENORM (0x2) (enum in Linux also uses __FE_DENORM)
 - introduces FE_ALL_EXCEPT_X86 (0x3f), i.e. ALL x86/x86_64 FP exceptions
2018-08-15 18:02:22 +02:00
Corinna Vinschen 9122f82a55 Cygwin: Add J.H. van de Water to CONTRIBUTORS
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-15 18:02:22 +02:00
Corinna Vinschen dbd872f4ad Cygwin: fenv.h: Convert to ASCII-only
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-14 11:48:29 +02:00
Corinna Vinschen 423fc83dfd Cygwin: utils: ps: use fputs to print fixed strings
Avoid gcc warning "format not a string literal and no format arguments"

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-09 08:41:18 +02:00
Corinna Vinschen 8bfb1afd6b Cygwin: utils: strace: fix format string
%ll is long valid for mingw builds.  Use this rather than %I64
to avoid a gcc warning

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-08 10:50:19 +02:00
Corinna Vinschen 37f4fea07c Cygwin: utils: change 3rd readlink param to size_t
Avoid gcc warnings

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-08 10:50:19 +02:00
Corinna Vinschen 13909bc262 Cygwin: utils: cygcheck: fix filesystem output format
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-08 10:50:13 +02:00
Corinna Vinschen 1e0a1f59d9 Cygwin: implement sched_getcpu
* create new function __get_cpus_per_group to evaluate # of CPU groups
* Call from  format_proc_cpuinfo and sched_getcpu
* Bump API minor version

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-07 14:51:10 +02:00
Mark Geisert b1952c03a8 Fix return value on aio_read/write success
Internally track resultant byte counts as ssize_t, but return 0 as int
for success indication, per POSIX.
2018-08-07 09:49:18 +02:00
Corinna Vinschen f16b198c3b Cygwin: Document fegetenv patch
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-03 09:35:31 +02:00
J.H. van de Water d79069d2ff Cygwin: fegetenv() should not disable exceptions
fnstenv MUST be followed by fldenv in fegetenv(), as the former disables all
exceptions in the x87 FPU, which is not appropriate here (fegetenv() ).
fldenv after fnstenv should reload the x87 FPU w/ the configuration that was
saved by fnstenv, i.e. a configuration that might have exceptions enabled.

Note: x86_64 uses SSE for floating-point, not the x87 FPU. However, because
feraiseexcept() attempts to provoke an exception using the x87 FPU, the bug
in fegetenv() will make this attempt futile here (x86_64).

Note: WoW uses the x87 FPU for floating-point, not SSE. Here anything that
would normally result in triggering an exception, not only feraiseexcept(),
will not be able to, as result of the bug in fegetenv().
2018-08-03 09:33:49 +02:00
Yaakov Selkowitz 7e09931ad9 Cygwin: fpathconf: update _PC_ASYNC_IO return value
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-07-25 15:00:43 -05:00
Yaakov Selkowitz f6417be2aa Cygwin: define _POSIX_ASYNCHRONOUS_IO
This feature is now available as of the recent AIO commits.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-07-25 10:48:55 -05:00
Mark Geisert 7f32efbf73 POSIX Asynchronous I/O support: other files
Updates to misc files to integrate AIO into the Cygwin source tree.
Much of it has to be done when adding any new syscalls.  There are
some updates to limits.h for AIO-specific limits.  And some doc mods.
2018-07-25 09:36:24 +02:00
Mark Geisert 87253cbe38 POSIX Asynchronous I/O support: fhandler files
This code is where the AIO implementation is wired into existing Cygwin
mechanisms for file and device I/O: the fhandler* functions.  It makes
use of an existing internal routine prw_open to supply a "shadow fd"
that permits asynchronous operations on a file the user app accesses
via its own fd.  This allows AIO to read or write at arbitrary locations
within a file without disturbing the app's file pointer.  (This was
already the case with normal pread|pwrite; we're just adding "async"
to the mix.)
2018-07-25 09:36:24 +02:00
Mark Geisert a9ffa71a15 POSIX Asynchronous I/O support: aio files
This is the core of the AIO implementation: aio.cc and aio.h.  The
latter is used within the Cygwin DLL by aio.cc and the fhandler* modules,
as well as by user programs wanting the AIO functionality.
2018-07-25 09:36:22 +02:00
Ken Brown 982dd20ed9 getfacl: Simplify by using acl_to_any_text 2018-07-25 09:32:36 +02:00
Ken Brown b610a9cf29 getfacl and setfacl: Align with Linux
Make getfacl print two colons instead of one after "other" and "mask".
Change the help text for setfacl to indicate that there can be either
one colon or two.
2018-07-23 17:31:09 +02:00
Corinna Vinschen e9f223877f Cygwin: move FP environment exports to common.din
We only have the symbols defined for i686 by accident since 2013...

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-07-20 13:55:26 +02:00
Mark Geisert 3e51cc478d fix duration handling in sigtimedwait 2018-07-19 13:18:49 +02:00