]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
3 years agoCygwin: cfsetspeed: allow speed to be a numerical baud rate
Ken Brown [Sun, 11 Jul 2021 11:04:58 +0000 (07:04 -0400)]
Cygwin: cfsetspeed: allow speed to be a numerical baud rate

The Linux man page for cfsetspeed(3) specifies that the speed argument
must be one of the constants Bnnn (e.g., B9600) defined in termios.h.
But Linux in fact allows the speed to be the numerical baud rate
(e.g., 9600).  For consistency with Linux, we now do the same.

Addresses: https://cygwin.com/pipermail/cygwin/2021-July/248887.html

3 years agoMinimal support for ISO/IEC TS 18661-3.
Kito Cheng [Mon, 12 Jul 2021 09:17:21 +0000 (17:17 +0800)]
Minimal support for ISO/IEC TS 18661-3.

 - GCC will set __FLT_EVAL_METHOD__ to 16 if __fp16 supported, e.g.
   cortex-a55/aarch64.
   - $ aarch64-unknown-elf-gcc -v 2>&1 |grep version
     gcc version 9.2.0 (GCC)
   - $ aarch64-unknown-elf-gcc  -E -dM -mcpu=cortex-a55 - < /dev/null  |grep FLT_EVAL_METHOD
     #define __FLT_EVAL_METHOD__ 16
     #define __FLT_EVAL_METHOD_TS_18661_3__ 16
     #define __FLT_EVAL_METHOD_C99__ 16
 - The behavior of __FLT_EVAL_METHOD__ == 16 is same as
   __FLT_EVAL_METHOD__ == 0 except for float16_t, but newlib didn't
   support float16_t.

ISO/IEC TS 18661-3:
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2405.pdf

V2 Changes:
- List Howland, Craig D as co-author since he provide the draft of comment
  in math.h.

Co-authored-by: "Howland, Craig D" <howland@LGSInnovations.com>
3 years agoCygwin: Define PSAPI_VERSION as 1 before including psapi.h
Jon Turney [Thu, 20 May 2021 17:28:01 +0000 (18:28 +0100)]
Cygwin: Define PSAPI_VERSION as 1 before including psapi.h

The default PSAPI_VERSION is controlled by WIN32_WINNT, which we set to
0x0a00 when building utils since 48a76190 (and is the default in w32api
>= 9.0.0)

In order for the built executables to run on Windows Vista, we must also
define PSAPI_VERSION as 1 (otherwise '#define GetModuleFileNameExA
K32GetModuleFileNameExA' causes a 'The procedure entry point
K32GetModuleFilenameExA could not be located in the dynamic link library
kernel32.dll' error at run time).

Also drop uneeded psapi.h from dlfcn.cc (31ddf45d), resource.cc
(34a6eeab) and ps.cc (1def2148).

3 years agoCygwin: Use cmdsynopsis element in utils documentation
Jon Turney [Mon, 14 Jun 2021 12:51:41 +0000 (13:51 +0100)]
Cygwin: Use cmdsynopsis element in utils documentation

Use <cmdsynopsis> element markup in utils docbook documentation, rather
than some preformatted text inside <screen>.

(This didn't happen as part of 646745cb, when we first started using
refentry elements to make it possible to generate manpages)

This helps produce better looking manpages:

* uses bold (for command names) and italic (for replaceable items)
* different output formats inconsistently treat tabs inside <screen>
(so we have to be careful to not use them in that preformatted text)

Also clean up various issues:

* Replace '[OPTIONS]' with a real synopsis of the options
* Consistently use 'ITEM...' rather than 'ITEM1 [ITEM2...]' for an item
which should appear 1 or more times (cygcheck -f, getfacl, kill)
* Consistently document the '-h | -V' invocation form
* Since replaceable items are now marked up so they have some formatting
indicating they are replaceable, we can drop wrapping them in angle
brackets, as is done in some places
* Add missing '-W' and '-p PID' options to ps synopsis
* Adjust cygpath synopsis to show that only one 'System information'
option is allowed, possibly modified by -A

Future work:
* Sync up the actual help emitted by the util, where it's been improved
* Also don't use <screen> for formatting 'OPTIONS' section of manpage
* pldd inconsistently uses '-?' rather than '-h'!

3 years agoCygwin: Various minor fixes to utils documentation
Jon Turney [Mon, 14 Jun 2021 20:18:49 +0000 (21:18 +0100)]
Cygwin: Various minor fixes to utils documentation

* Drop duplicate 'Options:' headers (mkgroup, mkpassword)
* Add missing indication that MACHINE is optional with -L (mkgroup, mkpassword)
* Tweak some <refpurpose> which try to be a synopsis, rather than a decription (passwd, ssp)
* Drop some stray '\n' in setfacl options
* Move 'Original Author' note in ssp to an AUTHORS section
* Use <para> to improve formatting of tzset manpage

3 years agostdlib: Make strtod/strtof set ERANGE consistently for underflow.
Keith Packard [Tue, 22 Jun 2021 17:26:26 +0000 (10:26 -0700)]
stdlib: Make strtod/strtof set ERANGE consistently for underflow.

The C standard says that errno may acquire the value ERANGE if the
result from strtod underflows. According to IEEE 754, underflow occurs
whenever the value cannot be represented in normalized form.

Newlib is inconsistent in this, setting errno to ERANGE only if the
value underflows to zero, but not for denorm values, and never for hex
format floats.

This patch attempts to consistently set errno to ERANGE for all
'underflow' conditions, which is to say all values which are not
exactly zero and which cannot be represented in normalized form.

This matches glibc behavior, as well as the Linux, Mac OS X, OpenBSD,
FreeBSD and SunOS strtod man pages.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agotty/pty: support TIOCSWINSZ pixel-size-only change notification
Thomas Wolff [Fri, 2 Jul 2021 22:00:00 +0000 (00:00 +0200)]
tty/pty: support TIOCSWINSZ pixel-size-only change notification

xterm 368 and mintty 3.5.1 implement a new feature to support
notification of terminal scaling via font zooming also if the terminal
text dimensions (rows/columns) stay unchanged, using
ioctl(TIOCSWINSZ), raising SIGWINCH;
this patches cygwin to support that scenario

3 years agoCygwin: respect PC_SYM_FOLLOW and PC_SYM_NOFOLLOW_REP with inner links.
Jeremy Drake [Sat, 29 May 2021 18:48:11 +0000 (11:48 -0700)]
Cygwin: respect PC_SYM_FOLLOW and PC_SYM_NOFOLLOW_REP with inner links.

The new GetFinalPathNameW handling for native symlinks in inner path
components is disabled if caller doesn't want to follow symlinks, or
doesn't want to follow reparse points.

3 years agoRevert "Cygwin: Handle virtual drives as non-symlinks"
Jeremy Drake [Sat, 29 May 2021 20:17:08 +0000 (13:17 -0700)]
Revert "Cygwin: Handle virtual drives as non-symlinks"

This reverts commit c8949d04001e3dbc03651475b6cd1c5623400835.

3 years agoFix builds on iq2000 and visium
Jeff Law [Tue, 6 Jul 2021 14:46:09 +0000 (10:46 -0400)]
Fix builds on iq2000 and visium

visium and iq2000 have libgloss configure bits that reference
target_makefile_frag, but it's never set. This leads to failures during the
configure process and an empty libgloss/<target>/Makefile.  Naturally bad
things happen with an empty Makefile.

This patch initializes target_makefile_frag for both targets in their
configure.in files and updates the generated configure files.  This fixes the
build failures.  I've been using it in my tester for about a week and both
targets have flipped from consistently failing to consistently passing.

    * libgloss/visium/configure.in (target_makefile_frag): Define.
    * libgloss/visium/configure: Regenerated.
    * libgloss/iq2000/configure.in (target_makefile_frag): Define.
    * libgloss/iq2000/configure: Regenerated.

3 years agoformat_proc_cpuinfo: add Linux 5.13 AMD/Hygon rapl
Brian Inglis [Tue, 29 Jun 2021 17:09:24 +0000 (11:09 -0600)]
format_proc_cpuinfo: add Linux 5.13 AMD/Hygon rapl

Linux 5.13 Opossums on Parade added features and changes:
add AMD 0x80000007 EDX:14 rapl runtime average power limit

3 years agoCygwin: console: Fix garbled input for non-ASCII chars.
Takashi Yano [Thu, 24 Jun 2021 03:40:58 +0000 (12:40 +0900)]
Cygwin: console: Fix garbled input for non-ASCII chars.

- After the commit ff4440fc, non-ASCII input may sometimes be garbled.
  This patch fixes the issue.

  Addresses: https://cygwin.com/pipermail/cygwin/2021-June/248775.html

3 years agoRevert "Cygwin: console: Fix garbled input for non-ASCII chars."
Corinna Vinschen [Tue, 6 Jul 2021 14:04:22 +0000 (16:04 +0200)]
Revert "Cygwin: console: Fix garbled input for non-ASCII chars."

This reverts commit 1b242c12aa7f34d89d57023f3c33f5f88d89d476.

3 years agoCygwin: console: Fix garbled input for non-ASCII chars.
Takashi Yano [Wed, 23 Jun 2021 08:42:16 +0000 (17:42 +0900)]
Cygwin: console: Fix garbled input for non-ASCII chars.

- After the commit ff4440fc, non-ASCII input may sometimes be garbled.
  This patch fixes the issue.

  Addresses: https://cygwin.com/pipermail/cygwin/2021-June/248775.html

3 years agofix and amend scripts and makefile rules to generate Unicode data
Thomas Wolff [Fri, 16 Apr 2021 22:00:00 +0000 (00:00 +0200)]
fix and amend scripts and makefile rules to generate Unicode data

3 years agoupdate to Unicode 13.0
Thomas Wolff [Thu, 15 Apr 2021 22:00:00 +0000 (00:00 +0200)]
update to Unicode 13.0

3 years agolibgloss/or1k: Correct the IMMU SXE and UXE flags
Stafford Horne [Thu, 1 Jul 2021 21:24:57 +0000 (06:24 +0900)]
libgloss/or1k: Correct the IMMU SXE and UXE flags

These have been defined incorrectly, as per specification and CPU
implementations SXE is bit 6 and UXE is bit 7.  This was noticed when
tracking down our test suite mmu test failures.

 Test Suite: https://github.com/openrisc/or1k-tests/blob/master/native/or1k/or1k-mmu.c#L68-L72
 Spec: https://raw.githubusercontent.com/openrisc/doc/master/openrisc-arch-1.3-rev1.pdf

See section 8.4.8 Instruction Translation Lookaside Buffer Way y Translate
Registers where these are defined.

Signed-off-by: Stafford Horne <shorne@gmail.com>
3 years agoCygwin: Zero out gmon header before use
Mark Geisert [Wed, 23 Jun 2021 08:56:14 +0000 (01:56 -0700)]
Cygwin: Zero out gmon header before use

Tools that process gmon.out files can be confused by gmon header fields
with garbage in them due to lack of initialization.  Repair that.

3 years agointtypes.h: Use reserved names for function parameters
Jonathan Wakely [Fri, 25 Jun 2021 20:44:22 +0000 (16:44 -0400)]
inttypes.h: Use reserved names for function parameters

3 years agostdio: Parse 0x0p+00 correctly in scanf
Keith Packard [Fri, 18 Jun 2021 18:09:48 +0000 (11:09 -0700)]
stdio: Parse 0x0p+00 correctly in scanf

The scanf code was skipping the '0' after the 'x' causing the
resulting buffer to contain an invalid number when passed to strtod.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agonewlib/doc/makedoc.c: if realloc() fails, exit with an error message.
Joel Sherrill [Thu, 17 Jun 2021 21:48:47 +0000 (16:48 -0500)]
newlib/doc/makedoc.c: if realloc() fails, exit with an error message.

3 years agonewlib/doc/makedoc.c: Fix memory leak identified by Coverity.
Joel Sherrill [Thu, 17 Jun 2021 21:27:49 +0000 (16:27 -0500)]
newlib/doc/makedoc.c: Fix memory leak identified by Coverity.

3 years agolibc/sys/rtems/crt0.c: Fix two warnings.
Joel Sherrill [Mon, 14 Jun 2021 21:31:08 +0000 (16:31 -0500)]
libc/sys/rtems/crt0.c: Fix two warnings.

__assert_func() is marked as noreturn and stub should not.
__tls_get_addr() needed to return a value..

3 years agoCygwin: Fix a stray tab in strace documentation
Mark Geisert [Sun, 13 Jun 2021 14:48:16 +0000 (15:48 +0100)]
Cygwin: Fix a stray tab in strace documentation

3 years agolibgloss: pru: Remove sim ld script
Dimitar Dimitrov [Wed, 3 Mar 2021 09:24:50 +0000 (11:24 +0200)]
libgloss: pru: Remove sim ld script

Binutils LD default linker script was recently fixed to allow memory
sizes to be set via command line. Use this feature to remove the special
sim linker script in libgloss.

It is acceptable to require newer Binutils version here because simulator
target is only used for regression testing the toolchain. Real HW
targets are not affected.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
3 years agolibgloss: pru: Place sim syscalls into their own sections
Dimitar Dimitrov [Sun, 9 May 2021 13:10:45 +0000 (16:10 +0300)]
libgloss: pru: Place sim syscalls into their own sections

This should help reduce final ELF size if using --gc-sections linker
option.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
3 years agopru: Enable -ffunction-sections and -fdata-sections
Dimitar Dimitrov [Sun, 9 May 2021 13:11:36 +0000 (16:11 +0300)]
pru: Enable -ffunction-sections and -fdata-sections

Recent binutils support --gc-sections for pru, so let's make use of
them.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
3 years agoFix rounding issues with sqrt/sqrtf
Jeff Johnston [Fri, 4 Jun 2021 18:36:38 +0000 (14:36 -0400)]
Fix rounding issues with sqrt/sqrtf

- compiler is sometimes optimizing out the rounding check in
  e_sqrt.c and ef_sqrt.c which uses two constants to create
  an inexact operation
- there is a similar constant operation in s_tanh.c/sf_tanh.c
- make the one and tiny constants volatile to stop this

3 years agoCygwin: fhandler_mqueue::mq_open: fix typo
Ken Brown [Wed, 26 May 2021 16:48:58 +0000 (12:48 -0400)]
Cygwin: fhandler_mqueue::mq_open: fix typo

3 years agoaarch64: support binary mode for opening files
Richard Earnshaw [Wed, 26 May 2021 14:17:11 +0000 (15:17 +0100)]
aarch64: support binary mode for opening files

Newlib for aarch64 uses libgloss for the backend.  One common libgloss
implementation is the 'rdimon' implementation, which uses the Arm
Semihosting protocol.  In order to support a remote host that runs on
Windows we need to know whether a file is to be opened in binary or
text mode.  That means that we need to preserve this information via
O_BINARY until we know what the libgloss binding will be.

This patch simply copies the arm implementation from sys/arm/sys and
puts it in machine/aarch64/sys, because we don't have a 'sys' subtree
on aarch64.

3 years agoCygwin: utils: enable -idirafter to fetch Cygwin headers from mingw sources
Corinna Vinschen [Wed, 26 May 2021 08:59:03 +0000 (10:59 +0200)]
Cygwin: utils: enable -idirafter to fetch Cygwin headers from mingw sources

Get rid of the last dreaded relative paths pointing to the cygwin dir.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: utils: set _WIN32_WINNT and NTDDI_VERSION via Makefile
Corinna Vinschen [Wed, 26 May 2021 08:57:47 +0000 (10:57 +0200)]
Cygwin: utils: set _WIN32_WINNT and NTDDI_VERSION via Makefile

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: set NTDDI_VERSION to enable more recent windows definitions
Corinna Vinschen [Wed, 26 May 2021 08:56:02 +0000 (10:56 +0200)]
Cygwin: set NTDDI_VERSION to enable more recent windows definitions

Set to WDK_NTDDI_VERSION since that enables all the latest.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: fhandler_mqueue: add missing __reg2 for 32 bit build
Corinna Vinschen [Wed, 26 May 2021 09:01:20 +0000 (11:01 +0200)]
Cygwin: fhandler_mqueue: add missing  __reg2 for 32 bit build

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: fhandler_mqueue: disable more methods, add fcntl
Corinna Vinschen [Tue, 25 May 2021 21:00:32 +0000 (23:00 +0200)]
Cygwin: fhandler_mqueue: disable more methods, add fcntl

Unsupported functionality returns EPERM, fcntl supports
only F_GETFD and F_GETFL.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: fhandler_mqueue::mq_open: set all required fhandler flags
Corinna Vinschen [Tue, 25 May 2021 20:43:41 +0000 (22:43 +0200)]
Cygwin: fhandler_mqueue::mq_open: set all required fhandler flags

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: disable creating directories below /dev/mqueue
Corinna Vinschen [Tue, 25 May 2021 20:05:13 +0000 (22:05 +0200)]
Cygwin: disable creating directories below /dev/mqueue

...as on Linux.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: fhandler_mqueue: fix method declarations
Corinna Vinschen [Tue, 25 May 2021 20:04:43 +0000 (22:04 +0200)]
Cygwin: fhandler_mqueue: fix method declarations

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: path_conv: fix mqueue path check
Corinna Vinschen [Tue, 25 May 2021 20:03:36 +0000 (22:03 +0200)]
Cygwin: path_conv: fix mqueue path check

The check for a file or dir within /dev/mqueue is accidentally using
the incoming path, which could be a relative path.  Make sure to
restore the absolute POSIX path in path_copy and only then test the
path.

Also, move the actual check for a valid path below /dev/mqueue into
the fhandler_mqueue class.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: cwdstuff: check if /dev exists
Corinna Vinschen [Tue, 25 May 2021 19:46:13 +0000 (21:46 +0200)]
Cygwin: cwdstuff: check if /dev exists

/dev has been handled as virtual dir in cwdstuff, thus not allowing
to start native apps from /dev as CWD, even if /dev actually exists
on disk.  Unfortunately this also affects Cygwin executables started
from a debugger.

When chdir'ing to /dev, check if /dev exists on disk.  If so, treat
it as any other existing path.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: POSIX msg queues: implement read(2)/lseek(2)
Corinna Vinschen [Tue, 25 May 2021 18:19:19 +0000 (20:19 +0200)]
Cygwin: POSIX msg queues: implement read(2)/lseek(2)

reuse fhandler_virtual implementation to implement read and lseek.
The output from read(2) is modelled after the output when reading
from an mq file on Linux.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: POSIX msg queues: implement ioctl(2)
Corinna Vinschen [Tue, 25 May 2021 18:17:07 +0000 (20:17 +0200)]
Cygwin: POSIX msg queues: implement ioctl(2)

Call into fhandler_base::ioctl immediately, thus only allowing
FIONBIO to manipulate blocking behaviour.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: POSIX msg queues: move all mq_* functionality into fhandler_mqueue
Corinna Vinschen [Tue, 25 May 2021 18:15:16 +0000 (20:15 +0200)]
Cygwin: POSIX msg queues: move all mq_* functionality into fhandler_mqueue

The POSIX entry points are just wrappers now, calling into
fhandler_mqueue.  While at it, eliminate mqi_flags, replace with
standard fhandler nonblocking flag.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: POSIX msg queues: allocate section views top down
Corinna Vinschen [Tue, 25 May 2021 14:55:38 +0000 (16:55 +0200)]
Cygwin: POSIX msg queues: allocate section views top down

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: POSIX msg queues: Implement dup
Corinna Vinschen [Tue, 25 May 2021 14:50:16 +0000 (16:50 +0200)]
Cygwin: POSIX msg queues: Implement dup

Create a private method fhandler_mqueue::_dup and call it from
dup and fixup_after_fork methods.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: POSIX msg queues: implement open/mq_open entirely in fhandler
Corinna Vinschen [Tue, 25 May 2021 14:49:04 +0000 (16:49 +0200)]
Cygwin: POSIX msg queues: implement open/mq_open entirely in fhandler

The mq_open call is just a framework now.  This patch moves the
entire functionality into fhandler_mqueue.  To support standard
OS calls (as on Linux), make fhandler_mqueue a derived class from
fhandler_disk_file and keep the base handle the handle to the
default stream, to allow implementing O_PATH functionlaity as well
as reading from the file and NOT reading binary message queue data.

Implement a standard fhandler_mqueue::open method, allowing, for
instance, to touch a file under /dev/mqueue and if it doesn't exist,
to create a message queue file.

FIXME: This introduces a BAD HACK into path_conv::check, which needs
reviewing.

Keep the posix path intact in the fhandler, and change get_proc_fd_name
accordingly to return only the basename plus leading slash for
/proc/<PID>/fd.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: POSIX msg queues: slightly rephrase get_mqinfo
Corinna Vinschen [Tue, 25 May 2021 14:42:44 +0000 (16:42 +0200)]
Cygwin: POSIX msg queues: slightly rephrase get_mqinfo

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: POSIX msg queues: simplify mq_close
Corinna Vinschen [Tue, 25 May 2021 14:36:09 +0000 (16:36 +0200)]
Cygwin: POSIX msg queues: simplify mq_close

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: get_nt_native_path: allow to append suffix
Corinna Vinschen [Tue, 25 May 2021 14:24:58 +0000 (16:24 +0200)]
Cygwin: get_nt_native_path: allow to append suffix

POSIX message queues will be moved into NTFS streams.
Extend get_nt_native_path to provide a filename suffix which is not
subject to special character transposition, to allow specifying
a colon.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: POSIX msg queues: move definition of struct msg_hdr
Corinna Vinschen [Tue, 25 May 2021 14:17:58 +0000 (16:17 +0200)]
Cygwin: POSIX msg queues: move definition of struct msg_hdr

...to mqueue_types.h header.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: POSIX msg queues: improve error output in fixup_after_fork
Corinna Vinschen [Fri, 21 May 2021 15:47:14 +0000 (17:47 +0200)]
Cygwin: POSIX msg queues: improve error output in fixup_after_fork

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: Ensure PSAPI_VERSION is 1 when building ldd
Jon Turney [Thu, 20 May 2021 17:28:01 +0000 (18:28 +0100)]
Cygwin: Ensure PSAPI_VERSION is 1 when building ldd

The default PSAPI_VERSION is controlled by WIN32_WINNT, which we set to
0x0a00 when building ldd, which gets PSAPI_VERSION=2.

This causes K32GetModuleFileNameEx to be used for GetModuleFileNameEx,
which isn't available on Windows Vista.

Define PSAPI_VERSION as 1 for the built executable to work on Windows
Vista.

3 years agoCygwin: POSIX msg queues: destroy msg queue fhandler in case of error
Corinna Vinschen [Fri, 21 May 2021 13:26:51 +0000 (15:26 +0200)]
Cygwin: POSIX msg queues: destroy msg queue fhandler in case of error

...and don't leave a descriptor dangling

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: POSIX msg queues: move handling of memory map into fhandler
Corinna Vinschen [Fri, 21 May 2021 13:25:37 +0000 (15:25 +0200)]
Cygwin: POSIX msg queues: move handling of memory map into fhandler

This encapsulated creation, duplication, and closing of all
Windows objects connected to the message queue in the fhandler.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: POSIX ipc: fix evaluation of naming rules
Corinna Vinschen [Fri, 21 May 2021 13:21:29 +0000 (15:21 +0200)]
Cygwin: POSIX ipc: fix evaluation of naming rules

The function evaluating correctness of ipc object names was a
bit half-hearted.  Fix the tests to follow more closely the
desriptions in the Linux man pages.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: posix_ipc.cc: fix typo
Corinna Vinschen [Fri, 21 May 2021 13:18:38 +0000 (15:18 +0200)]
Cygwin: posix_ipc.cc: fix typo

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: POSIX msg queues: create fhandler with object name
Corinna Vinschen [Fri, 21 May 2021 11:42:40 +0000 (13:42 +0200)]
Cygwin: POSIX msg queues: create fhandler with object name

build_fh_dev can take the POSIX object name as parameter anyway,
so use that and drop from mqinfo call.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: POSIX msg queues: move IPC object creation into fhandler
Corinna Vinschen [Fri, 21 May 2021 11:38:57 +0000 (13:38 +0200)]
Cygwin: POSIX msg queues: move IPC object creation into fhandler

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: fix formatting in mqueue_types.h
Corinna Vinschen [Fri, 21 May 2021 10:55:25 +0000 (12:55 +0200)]
Cygwin: fix formatting in mqueue_types.h

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: POSIX msg queues: use queue name as key
Corinna Vinschen [Fri, 21 May 2021 10:54:49 +0000 (12:54 +0200)]
Cygwin: POSIX msg queues: use queue name as key

Drop creating a unique ID, the queue name itself is already
unique.  This allows to move ipc object generation into the
fhandler in the next step.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: POSIX msg queues: Convert mqd_t to a descriptor
Corinna Vinschen [Fri, 21 May 2021 10:01:56 +0000 (12:01 +0200)]
Cygwin: POSIX msg queues: Convert mqd_t to a descriptor

So far, the mqd_t type returned a pointer to an allocated
area under the hood.  The mutex and event objects attached
to the message queue were implemented as inheritable types.

As unfortunate side effect the HANDLEs to these objects
were inherited by exec'd child processes, even though all
other message queue properties are not inherted, per POSIX.

Fix this by converting an mqd_t to a descriptor, and create a
matching fhandler_mqueue object to handle various aspects of
the message queues inside the fhandler.  Especially, create the
IPC objects as non-inheritable and duplicate the HANDLEs as
part of the fixup_after_fork mechanism.

Drop using mmap and create the memory map with NT functions.
This allows to control duplication of handle and mapping in the
forked child process, without the requirement to regenerate the
map in the same spot.  It also allows to dup() the descriptor,
as on Linux, albeit this isn't implemented yet.

This patch is the first cut.  There's a bit more to do, like
moving more functionality from the POSIX functions into the
fhandler and making sure the mqd_t type can't be used in other
descriptor-related functions willy-nilly.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: utils: chattr: Allow to clear all attributes with '='.
Christian Franke [Fri, 21 May 2021 09:44:32 +0000 (11:44 +0200)]
Cygwin: utils: chattr: Allow to clear all attributes with '='.

Signed-off-by: Christian Franke <christian.franke@t-online.de>
3 years agoCygwin: utils: ldd: use GetFinalPathNameByHandleW
Corinna Vinschen [Thu, 20 May 2021 21:07:05 +0000 (23:07 +0200)]
Cygwin: utils: ldd: use GetFinalPathNameByHandleW

drop replacement function GetFileNameFromHandle which was
only required pre-Vista.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: utils: avoid warning when building path_testsuite-path.o
Corinna Vinschen [Thu, 20 May 2021 20:47:40 +0000 (22:47 +0200)]
Cygwin: utils: avoid warning when building path_testsuite-path.o

Avoid this warning:

[...]/winsup/utils/mingw/../path.cc:569:1: warning: 'void read_mounts() ' defined but not used [-Wunused-function]
  569 | read_mounts ()
      | ^~~~~~~~~~~

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: utils: chattr: do not default to CWD
Corinna Vinschen [Thu, 20 May 2021 20:39:22 +0000 (22:39 +0200)]
Cygwin: utils: chattr: do not default to CWD

Drop the unexpected behaviour to run chattr in the CWD if no file has
been specified on the command line.  Bail out with usage info instead.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: utils: chattr: fix recursive behaviour
Corinna Vinschen [Thu, 20 May 2021 20:32:34 +0000 (22:32 +0200)]
Cygwin: utils: chattr: fix recursive behaviour

  chattr [mode] dir

incorrectly recurses one level into the given directory, even if the
--recursive option has not been used.  This patch adds a test to avoid
this bug.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: utils: chattr: Improve option parsing, fix some messages.
Christian Franke [Thu, 20 May 2021 09:05:29 +0000 (11:05 +0200)]
Cygwin: utils: chattr: Improve option parsing, fix some messages.

Allow multiple characters also in first '-mode' argument.
Use '-H' instead of '-h' for '--help' to fix ambiguity with
hidden attribute.  Fix help and usage texts and documentation.

Signed-off-by: Christian Franke <christian.franke@t-online.de>
3 years agosys/stat.h: Enable UTIME_NOW and UTIME_OMIT for RTEMS
Joel Sherrill [Wed, 19 May 2021 18:43:25 +0000 (13:43 -0500)]
sys/stat.h: Enable UTIME_NOW and UTIME_OMIT for RTEMS

3 years agoCygwin: autoload: fix case in DLL name for sanity
Corinna Vinschen [Thu, 20 May 2021 07:59:00 +0000 (09:59 +0200)]
Cygwin: autoload: fix case in DLL name for sanity

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: Add missing IsWow64Process2 declaration
Corinna Vinschen [Thu, 20 May 2021 08:03:34 +0000 (10:03 +0200)]
Cygwin: Add missing IsWow64Process2 declaration

The previous patch is accidentally missing the declaration of
IsWow64Process2.  Add it belatedly.

Fixes: 1865a41cb383 ("Cygwin: suppress FAST_CWD warnings on ARM64")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: suppress FAST_CWD warnings on ARM64
Jeremy Drake [Wed, 19 May 2021 09:43:48 +0000 (11:43 +0200)]
Cygwin: suppress FAST_CWD warnings on ARM64

The old check was insufficient: new insider preview builds of Windows
allow running x86_64 process on ARM64.  The IsWow64Process2 function
seems to be the intended way to figure this situation out.

3 years agoCygwin: Handle virtual drives as non-symlinks
Jeremy Drake [Wed, 19 May 2021 12:40:23 +0000 (14:40 +0200)]
Cygwin: Handle virtual drives as non-symlinks

This avoids MAX_PATH-related problems in native tools in case the
virtual drive points to a deep directory

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: POSIX message queues: simplify sync object creation
Corinna Vinschen [Wed, 12 May 2021 09:04:44 +0000 (11:04 +0200)]
Cygwin: POSIX message queues: simplify sync object creation

Introduce new inline function mq_ipc_init to create all three
required sync objects.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: Use parallel make on AppVeyor
Jon Turney [Sat, 1 May 2021 00:33:24 +0000 (01:33 +0100)]
Cygwin: Use parallel make on AppVeyor

We're bumping up against the 1hr free job duration limit on AppVeyor, so
use 'make -j$(nproc)' to allow things to build slightly faster.

Restructure the way build_script: is written in YAML, so it's slightly less
repetitive and easier to add that.

Also skip 'make check' on x86, since it currently just hangs. :(

3 years agoGet rid of relative include paths in strace.cc
Jon Turney [Sun, 9 May 2021 15:03:49 +0000 (16:03 +0100)]
Get rid of relative include paths in strace.cc

3 years agoMove source files used in utils/mingw/ into that subdirectory
Jon Turney [Tue, 27 Apr 2021 22:41:07 +0000 (23:41 +0100)]
Move source files used in utils/mingw/ into that subdirectory

Move all the source files used in utils/mingw/ into that subdirectory,
so the built objects are in the expected place.

(path.cc requires some more unpicking, and even then there is genuinely
some shared code, so use a trivial file which includes the real path.cc
so the object file is generated where expected)

3 years agoUnpick cygpath TESTSUITE
Jon Turney [Wed, 28 Apr 2021 13:54:47 +0000 (14:54 +0100)]
Unpick cygpath TESTSUITE

Rather than having testsuite.h do various things, depending on defines,
just have it do one thing, and then explicitly redirect to test stubs in
path.cc when building test.

3 years agoCygwin: fetch Windows directory on all platforms and use throughout
Corinna Vinschen [Fri, 7 May 2021 21:05:24 +0000 (23:05 +0200)]
Cygwin: fetch Windows directory on all platforms and use throughout

Rather than fetching the system Windows directory at dll init time
only on 32 bit, fetch it on all platforms.  Store as WCHAR and
UNICODE_STRING.  Use where appropriate to simplify code.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: path_conv: Rework handling native symlinks as inner path components
Corinna Vinschen [Fri, 7 May 2021 14:07:03 +0000 (16:07 +0200)]
Cygwin: path_conv: Rework handling native symlinks as inner path components

commit 456c3a46386f was only going half-way.  It handled symlinks and
junction points as inner path components and made realpath return the
correct path, but it ignored drive letter substitution, i. e., virtual
drives created with, e. g.

  subst X: C:\foo\bar

It was also too simple.  Just returning an error code from
symlink_info::check puts an unnecessary onus on the symlink evaluation
loop in path_conv::check.

Rework the code to use GetFinalPathNameByHandle, and only do this after
checking the current file for being a symlink failed.

If the final path returned by GetFinalPathNameByHandle is not the same
as the incoming path, replace the incoming path with the POSIXified
final path.  This also short-circuits path evaluation, because
path_conv::check doesn't have to recurse over the inner path components
multiple times if all symlinks are of a native type, while still getting
the final path as end result.

Virtual drives are now handled like symlinks.  This is a necessary change
from before to make sure virtual drives are handled identically across
different access methods.  An example is realpath(1) from coreutils.  It
doesn't call readlink(2), but iterates over all path components using
lstat/readlink calls.  Both methods should result in the same real path.

Fixes: 456c3a46386f ("path_conv: Try to handle native symlinks more sanely")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: revert handwritten tags/ctags target, take 2
Corinna Vinschen [Thu, 6 May 2021 11:35:26 +0000 (13:35 +0200)]
Cygwin: revert handwritten tags/ctags target, take 2

Fix accidental checkin of the wrong test version

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: revert handwritten tags/ctags target
Corinna Vinschen [Thu, 6 May 2021 09:12:46 +0000 (11:12 +0200)]
Cygwin: revert handwritten tags/ctags target

Converting to automake dropped the former, handwritten tags/ctags
target.  This leads to a couple of problems:

- For no good reason the tags file gets written to the builddir
  instead of to the srcdir where it's needed.

- `make tags' requires etags to exist, rather than checking if it
  exists and skipping it.

- Adding the extra ctags arguments to AM_CTAGSFLAGS still results
  in a shortened tags file.

(Temporary?) solution: Revert the old tags/ctags rules and silence
the automake warnings.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: autogen.sh: Allow running from any directory
Corinna Vinschen [Thu, 6 May 2021 08:56:20 +0000 (10:56 +0200)]
Cygwin: autogen.sh: Allow running from any directory

autogen.sh expects to run from within the winsup dir, so
set CWD accordingly before running autotools.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoNano-malloc: Fix for unwanted external heap fragmentation
Ola Olsson [Mon, 26 Apr 2021 08:57:02 +0000 (10:57 +0200)]
Nano-malloc: Fix for unwanted external heap fragmentation

The only reason why it is tough for us to use nano malloc
is because of the small shortcoming where nano_malloc()
splits a bigger chunk from the free list into two pieces
while handing back the second one (the tail) to the user.
This is error prone and especially bad for smaller heaps,
where nano malloc is supposed to be superior. The normal
malloc doesn't have this issue and we need to use it even
though it costs us ~2k bytes compared to nano-malloc.

The problem arise especially after giving back _every_
malloced memory to the heap and then starting to exercise
the heap again by allocating something small. This small
item might split the whole heap in two equally big parts
depending on how the heap has been exercised before.

I have uploaded the smallest possible application
(only tested on ST and Nordic devices) to show the issue
while the real customer applications are far more complicated:
https://drive.google.com/file/d/1kfSC2KOm3Os3mI7EBd-U0j63qVs8xMbt/view?usp=sharing

The application works like the following pseudo code,
where we assume a heap of 100 bytes
(I haven't taken padding and other nitty and gritty
details into account. Everything to simplify understanding):

void *ptr = malloc(52); // We get 52 bytes and we have
                        // 48 bytes to use.
free(ptr); // Hand back the 52 bytes to nano_malloc
           // This is the magic line that shows the issue of
           // nano_malloc
ptr = malloc(1); // Nano malloc will split the 52 bytes
                 // in the free list and hand you a pointer
                 // somewhere in the
                 // middle of the heap.
ptr2 = malloc(52); // Out of memory...

I have done a fix which hands back the first part of the
splitted chunk. Once this is fixed we obviously
have the 1 byte placed in position 0 of the heap instead
of somewhere in the middle.

However, this won't let us malloc 52 new bytes even though
we potentially have 99 bytes left to use in the heap. The
reason is that when we try to do the allocation,
nano-malloc looks into the free list and sees a 51 byte
chunk to be used.
This is not big enough so nano-malloc decides to call
sbrk for _another_ 52 bytes which is not possible since
there is only 48 bytes left to ask for.

The solution for this problem is to check if the last
item in the free list is adjacent to sbrk(0). If it is,
as it is in this case, we can just ask sbrk for the
remainder of what is needed. In this case 1 byte.

NB! I have only tested the solution on our ST device.

3 years agoCygwin: Ensure toollibdir exists before installing a link there
Jon Turney [Fri, 30 Apr 2021 17:14:55 +0000 (18:14 +0100)]
Cygwin: Ensure toollibdir exists before installing a link there

This helps 'make install -j2' work.

3 years agoformat_proc_swaps: ensure space between fields for clarity
Brian Inglis [Fri, 30 Apr 2021 13:19:20 +0000 (07:19 -0600)]
format_proc_swaps: ensure space between fields for clarity

page/swap space name >= 40 or size/used >= 8 leaves no space between fields;
ensure a space after name and add extra tabs after size and used fields;
output appears like Linux 5.8 after changes to mm/swapfile(swap_show);

proc-swaps-space-before.log:
==> /proc/swaps <==
Filename Type Size Used Priority
/mnt/c/pagefile.sys                     file            11567748292920  0
/mnt/d/pagefile.sys                     file            12582912205960  0

proc-swaps-space-after.log:
==> /proc/swaps <==
Filename Type Size Used Priority
/mnt/c/pagefile.sys file 11567748 241024 0
/mnt/d/pagefile.sys file 12582912 182928 0

3 years agoCygwin: mq_open: set filesize using ftruncate
Corinna Vinschen [Fri, 30 Apr 2021 16:15:20 +0000 (18:15 +0200)]
Cygwin: mq_open: set filesize using ftruncate

ftruncate is leaner than lseek/write.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: CI configuration update
Jon Turney [Tue, 27 Oct 2020 16:29:45 +0000 (16:29 +0000)]
Cygwin: CI configuration update

Install autoconf and automake, and run winsup/autogen.sh, and don't have
it silently ignore failures.

On AppVeyor:
- use latest VM image, to reduce time spent installing updates.
- run the testsuite, but ignore the result, as some tests don't work
correctly.
- hardcode the python-lxml and python-ply packages to install, so we get
ones for the right python.
- install texlive collections now needed to build documentation.

On github:
- Use a copr for cocom, since RPMSphere's package updates don't track
fedora:latest very efficently.

3 years agoCygwin: POSIX mq: avoid double calls to ipc_mutex_unlock
Corinna Vinschen [Fri, 30 Apr 2021 08:30:21 +0000 (10:30 +0200)]
Cygwin: POSIX mq: avoid double calls to ipc_mutex_unlock

_mq_send as well as _mq_receive call ipc_mutex_unlock twice in case
of success, after having introduced __try/__except blocks.

Fixes: 3f3bd10104550 ("* Throughout, use __try/__except/__endtry blocks, rather than myfault handler.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: POSIX mq: only allo priority up to MQ_PRIO_MAX - 1
Corinna Vinschen [Thu, 29 Apr 2021 18:04:24 +0000 (20:04 +0200)]
Cygwin: POSIX mq: only allo priority up to MQ_PRIO_MAX - 1

POSIX requires that message priorities range from 0 (low) to
sysconf(_SC_MQ_PRIO_MAX) - 1 (high).  Cygwin's mq_send erroneously
allowed a message priority of sysconf(_SC_MQ_PRIO_MAX).  Fix it.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: FAQ: building-cygwin: accomodate autoconf changes
Corinna Vinschen [Thu, 29 Apr 2021 10:07:00 +0000 (12:07 +0200)]
Cygwin: FAQ: building-cygwin: accomodate autoconf changes

- also, rephrase slightly for better readability and
  remove questionable old cruft

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: automake: change @INCLUDES@ to @AM_CPPFLAGS@ to avoid warnings
Corinna Vinschen [Thu, 29 Apr 2021 09:23:11 +0000 (11:23 +0200)]
Cygwin: automake: change @INCLUDES@ to @AM_CPPFLAGS@ to avoid warnings

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: automake: fix warning in terms of the `ps' target
Corinna Vinschen [Thu, 29 Apr 2021 08:59:29 +0000 (10:59 +0200)]
Cygwin: automake: fix warning in terms of the `ps' target

We are building a ps executable, but the rule to build the target
collides with an auto-generated, documentation-related `ps' rule.

Work around that by naming the executable "cygps" at build time
and use a transform rule to rename it at installation time.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: specify toollibdir toolincludedir in terms of tooldir
Jon Turney [Wed, 28 Apr 2021 09:46:02 +0000 (11:46 +0200)]
Cygwin: specify toollibdir toolincludedir in terms of tooldir

Specify toollibdir and toolincludedir in terms of tooldir, so the
install location is correct if tooldir is the default
($(exec_prefix)/$(target_alias)), or explicitly specified on the 'make'
command line.

3 years agoCygwin: drop all generated autotools files
Corinna Vinschen [Wed, 28 Apr 2021 10:03:52 +0000 (12:03 +0200)]
Cygwin: drop all generated autotools files

- add autotool files generated under winsup to .gitignore

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoformat_proc_cpuinfo: add v_spec_ctrl, bus_lock_detect
Brian Inglis [Tue, 27 Apr 2021 23:28:52 +0000 (17:28 -0600)]
format_proc_cpuinfo: add v_spec_ctrl, bus_lock_detect

Linux 5.12 Frozen Wasteland added features and changes:
add AMD 0x8000000a EDX:20 v_spec_ctrl virtual speculation control support
add Intel 0x00000007 ECX:24 bus_lock_detect bus lock detect debug exception

3 years agoCygwin: tty.h: devices.h is a local header, not a system header
Corinna Vinschen [Tue, 27 Apr 2021 19:25:29 +0000 (21:25 +0200)]
Cygwin: tty.h: devices.h is a local header, not a system header

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: Use automake (v5)
Jon Turney [Tue, 6 Oct 2020 15:11:54 +0000 (16:11 +0100)]
Cygwin: Use automake (v5)

v2:
* Include tzmap.h in BUILT_SOURCES
* Make per-file flags appear after user-supplied CXXFLAGS, so they can
override optimization level.
* Correct .o files used to define symbols exported by libm.a
* Drop gcrt0.o mistakenly included in libgmon.a
* Add missing line continuations in GMON_FILES value

v3:
* use per-file flags for .c compilation
* override C{XX,}FLAGS, as they are set on the command line by top-level make

v4:
* Drop -Wno-error=write-strings from path_testsuite CXXFLAGS

v5:
* Update for changes in master
- Add -fno-threadsafe-statics to CXX flags
- Add hypotl.cc
- Remove fenv.cc (in favour of newlib), add fenv.c stub
- Add proc.5 manpage rules

3 years agoCygwin: connect: implement resetting a connected DGRAM socket
Ken Brown [Fri, 23 Apr 2021 22:17:57 +0000 (18:17 -0400)]
Cygwin: connect: implement resetting a connected DGRAM socket

Following POSIX and Linux, allow a connected DGRAM socket's connection
to be reset (so that the socket becomes unconnected).  This is done by
calling connect and specifing an address whose family is AF_UNSPEC.

3 years agoCygwin: connect: set connect state for DGRAM sockets
Ken Brown [Fri, 23 Apr 2021 18:40:07 +0000 (14:40 -0400)]
Cygwin: connect: set connect state for DGRAM sockets

When connect is called on a DGRAM socket, the call to Winsock's
connect can immediately return successfully rather than failing with
WSAEWOULDBLOCK.  Set the connect state to "connected" in this case.

Previously the connect state remained "connect_pending" after the
successful connection.

3 years agobfin: add myself as maintainer
Mike Frysinger [Sun, 25 Apr 2021 17:23:07 +0000 (13:23 -0400)]
bfin: add myself as maintainer

This page took 0.07551 seconds and 5 git commands to generate.