]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
2 years agoCygwin: remove regparm.h
Ken Brown [Mon, 23 May 2022 19:52:52 +0000 (15:52 -0400)]
Cygwin: remove regparm.h

This file defines the macros __reg1, __reg2, and __reg3, which are
defined to be empty on 64-bit Cygwin.  Remove all occurrences of these
macros.

2 years agoCygwin: simplify some function names
Ken Brown [Sun, 22 May 2022 19:18:48 +0000 (15:18 -0400)]
Cygwin: simplify some function names

Remove "32" or "64" from each of the following names: acl32,
aclcheck32, aclfrommode32, aclfrompbits32, aclfromtext32, aclsort32,
acltomode32, acltopbits32, acltotext32, facl32, fchown32, fcntl64,
fstat64, _fstat64, _fstat64_r, ftruncate64, getgid32, getgrent32,
getgrgid32, getgrnam32, getgroups32, getpwuid32, getpwuid_r32,
getuid32, getuid32, initgroups32, lseek64, lstat64, mknod32, mmap64,
setegid32, seteuid32, setgid32, setgroups32, setregid32, setreuid32,
setuid32, stat64, _stat64_r, truncate64.

Remove prototypes and macro definitions of these names.

Remove "#ifndef __INSIDE_CYGWIN__" from some headers so that the new
names will be available when compiling Cygwin.

Remove aliases that are no longer needed.

Include <unistd.h> in fhandler_clipboard.cc for the declarations of
geteuid and getegid.

2 years agoCygwin: remove some 32-bit-only function definitions
Ken Brown [Sun, 22 May 2022 19:16:47 +0000 (15:16 -0400)]
Cygwin: remove some 32-bit-only function definitions

Remove the definitions of the following: acl, aclcheck, aclfrommode,
aclfrompbits, aclfromtext, aclsort, acltomode, acltopbits, acltotext,
chown, fchown, _fcntl, fstat, _fstat_r, ftruncate, getegid, geteuid, getgid,
getgrent, getgrgid, getgrnam, getgroups, getpwduid, getpwuid,
getpwuid_r, getuid, initgroups, lacl, lacl32, lchown, lseek, lstat,
mknod, mmap, setegid, seteuid, setgid, setgroups, setregid, setreuid,
setuid, stat, _stat_r, truncate.

[For most of these, the corresponding 64-bit entry points are obtained
by exporting aliases.  For example, acl is an alias for acl32, and
truncate is an alias for truncate64.]

Remove the following structs and all code using them (which is 32-bit
only): __stat32, __group16, __flock32, __aclent16_t.

Remove the typedefs of __blkcnt32_t __dev16_t, __ino32_t, which are
used only in code that has been removed.

Put the typedefs of __uid16_t and __gid16_t in one header, instead of
one header if __INSIDE_CYGWIN__ is defined and a different header
otherwise.

2 years agoCygwin: document last bug fix
Ken Brown [Sun, 29 May 2022 21:42:06 +0000 (17:42 -0400)]
Cygwin: document last bug fix

2 years agoCygwin: cygheap: Fix the issue of cygwin1.dll in the root directory.
Takashi Yano [Fri, 27 May 2022 12:54:36 +0000 (21:54 +0900)]
Cygwin: cygheap: Fix the issue of cygwin1.dll in the root directory.

- After the commit 6d898f43, cygwin fails to start if cygwin1.dll
  is placed in the root directory. This patch fixes the issue.
Addresses: https://cygwin.com/pipermail/cygwin/2022-May/251548.html

2 years agoAdd test cases for parser errors after reworked parsing behavior.
jdoubleu [Fri, 27 May 2022 15:35:27 +0000 (11:35 -0400)]
Add test cases for parser errors after reworked parsing behavior.

2 years agoModify tzset_r.c to handle errors
Jeff Johnston [Wed, 27 Apr 2022 19:27:00 +0000 (15:27 -0400)]
Modify tzset_r.c to handle errors

- change __tzset_r so errors end up setting the timezone to
  unnamed UTC

2 years agofhandler_proc.cc(format_proc_cpuinfo): add Linux 5.18 cpuinfo flags
Brian Inglis [Wed, 25 May 2022 12:30:45 +0000 (06:30 -0600)]
fhandler_proc.cc(format_proc_cpuinfo): add Linux 5.18 cpuinfo flags

0x80000008:0 EBX:31 brs AMD Branch Sampling available
0x80000022:0 EAX:0  perfmon_v2 AMD ExtPerfMonAndDbg Performance Monitoring Version 2
0x00000021:0 EBX|EDX|ECX=="IntelTDX    " tdx_guest Intel Trust Domain Extensions- Guest Support

2 years agoCygwin: fix mknod (64-bit only)
Ken Brown [Sun, 22 May 2022 15:43:44 +0000 (11:43 -0400)]
Cygwin: fix mknod (64-bit only)

The current definition of mknod in syscalls.cc has a third argument of
type __dev16_t instead of dev_t.  Fix this on 64-bit Cygwin by making
the existing mknod 32-bit only and then exporting mknod as an alias
for mknod32.  (No fix is needed on 32-bit because mknod is redirected
to mknod32 via NEW_FUNCTIONS in Makefile.am.)

Addresses: https://cygwin.com/pipermail/cygwin-developers/2022-May/012589.html

2 years agoUse weak reference for _REENT_SMALL
Sebastian Huber [Tue, 17 May 2022 18:39:35 +0000 (20:39 +0200)]
Use weak reference for _REENT_SMALL

Avoid a strong reference to __sfp[] for _impure_data.  The __sfp[] is linked in
if __sinit() is used for example.

2 years agoFix __sFILE::_lock initialization
Sebastian Huber [Tue, 17 May 2022 14:39:34 +0000 (16:39 +0200)]
Fix __sFILE::_lock initialization

The __sFILE::_lock member is present if __SINGLE_THREAD__ is not defined.  In
this case, it is initialized in __sfp().  It is a bug to do it sometimes also
in std().

2 years agoCygwin: make sure exec'ed process exists early in process list
Corinna Vinschen [Thu, 19 May 2022 08:46:33 +0000 (10:46 +0200)]
Cygwin: make sure exec'ed process exists early in process list

killpg(pgid, 0) (or kill_pgrp(pgid, si_signo=0), in signal.cc)
fails (returns -1) even when there is a process in the process
group pgid, if the process is in the middle of spawnve(), see

  https://cygwin.com/pipermail/cygwin/2022-May/251479.html

When exec'ing a process the assumption is that the exec'ed process creates its
own symlink (in pinfo::thisproc() in pinfo.cc). If the exec'ing process
calls NtClose on it's own winpid symlink, but the exec'ed process didn't
progress enough into initialization, there's a slim chance that neither
the exec'ing process, nor the exec'ed process has a winpid symlink
attached.

Always create the winpid symlink in spawn.cc, even for exec'ed Cygwin
processes.  Make sure to dup the handle into the new process, and stop
creating the winpid symlink in exec'ed processes.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: Use two pass parse for tlsoffsets generation.
Takashi Yano [Wed, 18 May 2022 17:51:46 +0000 (02:51 +0900)]
Cygwin: Use two pass parse for tlsoffsets generation.

- The commit "Cygwin: fix new sigfe.o generation in optimized case"
  fixed the wrong tlsoffsets generation by adding -O0 to compile
  options. Current gentls_offsets expects entry of "start_offset"
  is the first entry in the assembler code. However, without -O0,
  entry of "start_offset" goes to the last entry for some reason.
  Currently, -O0 can prevents assembler code from reversing the
  order of the entries, however, there is no guarantee that it will
  retain the order of the entries in the future.

  This patch makes gentls_offsets parse the assembler code in the
  two pass to omit -O0 option dependency.

2 years agonewlib: libc: reent.h: remove unnecessary parentheses
Jia-Wei Chen [Wed, 18 May 2022 10:03:18 +0000 (18:03 +0800)]
newlib: libc: reent.h: remove unnecessary parentheses

The compiler warns the double parentheses are unnecessary in some
target, and cause fail cases when doing some testcases in regression.

gcc/testsuite/g++.dg/warn/Wstringop-overflow-6.C

Remove the unnecessary parentheses will fix it. See more details in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85775

Same like in commit 05425831290c9869bc7987b5df3ce84aa4f19a6c,
Author: Maxim Blinov <maxim.blinov@embecosm.com>
Date:   Thu Jul 22 22:41:42 2021 +0100

     Remove unneccesary parenthesis around declarator

Thanks for Sebastian Huber's remind!

2 years agoUse global atexit data for all configurations
Sebastian Huber [Fri, 13 May 2022 11:44:13 +0000 (13:44 +0200)]
Use global atexit data for all configurations

For the exit processing only members of _GLOBAL_REENT were used by default.  If
the _REENT_GLOBAL_ATEXIT option was enabled, then the data structures were
provided through dedicated global objects.  Make this option the default.
Remove the option.  Rename struct _reent members _atexit and _atexit0 to
_reserved_6 and _reserved_7, respectively.  Provide them only if
_REENT_BACKWARD_BINARY_COMPAT is defined.

2 years agoOptional struct _reent::_new::_unused
Sebastian Huber [Fri, 13 May 2022 12:56:24 +0000 (14:56 +0200)]
Optional struct _reent::_new::_unused

Rename struct _reent::_new::_unused members _nextf and _nmalloc to _reserved_3
and _reserved_4, respectively.   Rename struct _reent::_new member _unused to
_reserved_5.  Provide them only if _REENT_BACKWARD_BINARY_COMPAT is defined.

Remove unused _N_LISTS define.

2 years agoOptional struct _reent::_new::_reent::_unused_rand
Sebastian Huber [Fri, 13 May 2022 13:21:34 +0000 (15:21 +0200)]
Optional struct _reent::_new::_reent::_unused_rand

Rename struct _reent member _unused_rand to _reserved_2.  Provide it only if
_REENT_BACKWARD_BINARY_COMPAT is defined.

2 years agoOptional struct _reent::_unspecified_locale_info
Sebastian Huber [Fri, 13 May 2022 12:53:13 +0000 (14:53 +0200)]
Optional struct _reent::_unspecified_locale_info

Rename struct _reent member _unspecified_locale_info to _reserved_1.  Provide
it only if _REENT_BACKWARD_BINARY_COMPAT is defined.

2 years agoOptional struct _reent::__unused_sdidinit
Sebastian Huber [Fri, 13 May 2022 12:40:07 +0000 (14:40 +0200)]
Optional struct _reent::__unused_sdidinit

Rename struct _reent member __unused_sdidinit to _reserved_0.  Provide it only
if _REENT_BACKWARD_BINARY_COMPAT is defined.

2 years agoCygwin: Enable backward binary compatibility
Sebastian Huber [Fri, 13 May 2022 12:29:17 +0000 (14:29 +0200)]
Cygwin: Enable backward binary compatibility

2 years agoAdd --enable-newlib-reent-binary-compat
Sebastian Huber [Fri, 13 May 2022 11:55:06 +0000 (13:55 +0200)]
Add --enable-newlib-reent-binary-compat

Add the --enable-newlib-reent-binary-compat configure option.  This option is
disabled by default.  If enabled, then unused members in struct _reent are
preserved to maintain the structure layout.

2 years agoUse right lock release in __register_exitproc()
Sebastian Huber [Tue, 17 May 2022 16:48:34 +0000 (18:48 +0200)]
Use right lock release in __register_exitproc()

2 years agoFix stdio exit handling
Sebastian Huber [Tue, 17 May 2022 09:52:24 +0000 (11:52 +0200)]
Fix stdio exit handling

Make sure that the stdio exit handler is set in all stdio initialization paths.

The bug was introduced by commit 26747c47bc0a1137e02e0377306d721cc3478855.

2 years agoCygwin: drop i686 exception handling
Corinna Vinschen [Tue, 17 May 2022 12:12:32 +0000 (14:12 +0200)]
Cygwin: drop i686 exception handling

Leave x86_64 CPU-specific code and #error out when trying to build
for another target. Access special registers CPU-agnostic.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: drop PROCESSOR_ARCHITECTURE_INTEL from uname
Corinna Vinschen [Mon, 16 May 2022 16:17:01 +0000 (18:17 +0200)]
Cygwin: drop PROCESSOR_ARCHITECTURE_INTEL from uname

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: document why we can't drop the _pei386_runtime_relocator dummy
Corinna Vinschen [Mon, 16 May 2022 15:54:51 +0000 (17:54 +0200)]
Cygwin: document why we can't drop the _pei386_runtime_relocator dummy

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: drop i386 refs from header files where source isn't affected
Corinna Vinschen [Mon, 16 May 2022 15:51:14 +0000 (17:51 +0200)]
Cygwin: drop i386 refs from header files where source isn't affected

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: drop 32 bit considerations in crt0 code
Corinna Vinschen [Mon, 16 May 2022 15:24:48 +0000 (17:24 +0200)]
Cygwin: drop 32 bit considerations in crt0 code

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: CI: Drop i686 builds
Jon Turney [Mon, 16 May 2022 12:32:52 +0000 (13:32 +0100)]
Cygwin: CI: Drop i686 builds

i686 builds just fail with 'Invalid target processor "i686"' since
commit fcb32b7.

2 years agoCygwin: add 3.3.6 release notes
Takashi Yano [Mon, 16 May 2022 11:10:23 +0000 (20:10 +0900)]
Cygwin: add 3.3.6 release notes

2 years agonewlib: Regenerate Makefile.in
Sebastian Huber [Fri, 13 May 2022 12:12:00 +0000 (14:12 +0200)]
newlib: Regenerate Makefile.in

Regenerate Makefile.in to include changes in Makefile.am of commit
81b7cf09faa523e7bb438abe24e6e5376e45a0e5.

2 years agoCygwin: pty: Fix script command crash on console in Win7.
Takashi Yano [Sat, 14 May 2022 11:39:42 +0000 (20:39 +0900)]
Cygwin: pty: Fix script command crash on console in Win7.

- Previously, the command "cmd /c script -c cmd" in console of Win7
  crashes. This seems to be due to a bug (?) of AttachConsole().
  This patch adds workaround for this issue.

  Currently, pty reattaches to the console of the process which is
  predetermined by ConsoleProcessList() after temporarily attaching
  to another console. After that, the console output handle opened
  with the name "CONOUT$" may not be accessible in Win7.
  This seems to happen when the attached process does not have the
  same handle even if the console attached is the same. With this
  patch, cygwin-console-helper which is started when pty master is
  opened in console, is utilized to be a target process to which
  pty reattaches if the OS is Win7.

2 years agoCygwin: fix new sigfe.o generation in optimized case
Corinna Vinschen [Fri, 13 May 2022 19:22:44 +0000 (21:22 +0200)]
Cygwin: fix new sigfe.o generation in optimized case

Commit 0597c84b9bdb ("Cygwin: revamp TLS offsets computation")
introduced a really weird problem when building Cygwin with
optimization.

First of all, the tlsoffsets file is broken with -O2.  This
can easily be fixed by running the compiler with -O0 when called
from the gentls_offsets script.

But it gets worse:

When creating sigfe.o with optimization, the generated machine code
uses incorrect offsets: For some reason the assembler codes using
_cygtls.stackptr as offset value are assembled into machine code
using _cygtls.pstackptr as offsets.

And as if that isn't already absurd enough, renaming _cygtls.pstackptr
to, say, _cygtls.blurb, fixes the assembled machine code expressions;
they use the value of _cygtls.stackptr again.

So I changed gentls_offsets and gendef to use _cygtls.foo_p rather
than _cygtls.pfoo and that fixes the assembled code in the optimized
case.

No, I can't explain that.  There's no system in that behaviour.
It looks absolutely crazy.

Fixes: 0597c84b9bdb ("Cygwin: revamp TLS offsets computation")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: utils: drop unnecessary wow64 checks
Corinna Vinschen [Sat, 19 Mar 2022 11:54:07 +0000 (12:54 +0100)]
Cygwin: utils: drop unnecessary wow64 checks

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: drop a few minor references to WOW64
Corinna Vinschen [Mon, 7 Mar 2022 12:11:34 +0000 (13:11 +0100)]
Cygwin: drop a few minor references to WOW64

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: wincap: drop has_gaa_largeaddress_bug flag and related code
Corinna Vinschen [Mon, 7 Mar 2022 11:51:40 +0000 (12:51 +0100)]
Cygwin: wincap: drop has_gaa_largeaddress_bug flag and related code

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: wincap: drop has_broken_prefetchvm flag and related code
Corinna Vinschen [Mon, 7 Mar 2022 11:30:32 +0000 (12:30 +0100)]
Cygwin: wincap: drop has_broken_prefetchvm flag and related code

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: drop system_wow64_directory and related code
Corinna Vinschen [Mon, 7 Mar 2022 11:20:00 +0000 (12:20 +0100)]
Cygwin: drop system_wow64_directory and related code

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: drop create_token and dependent functions
Corinna Vinschen [Mon, 7 Mar 2022 10:29:42 +0000 (11:29 +0100)]
Cygwin: drop create_token and dependent functions

Given we only called create_token on W7 WOW64 anyway, we can now
drop this function and all other functions only called from there
entirely.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: wincap: drop no_msv1_0_s4u_logon_in_wow64 flag and related code
Corinna Vinschen [Mon, 7 Mar 2022 09:42:08 +0000 (10:42 +0100)]
Cygwin: wincap: drop no_msv1_0_s4u_logon_in_wow64 flag and related code

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: wincap: set def_guard_pages to x86_64 value right away
Corinna Vinschen [Mon, 7 Mar 2022 09:35:20 +0000 (10:35 +0100)]
Cygwin: wincap: set def_guard_pages to x86_64 value right away

Drop conditional code in wincapc::init.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: wincap: drop wow64 flag and all conditions depending on it
Corinna Vinschen [Mon, 7 Mar 2022 09:31:15 +0000 (10:31 +0100)]
Cygwin: wincap: drop wow64 flag and all conditions depending on it

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: revamp TLS offsets computation
Corinna Vinschen [Wed, 2 Feb 2022 16:27:34 +0000 (17:27 +0100)]
Cygwin: revamp TLS offsets computation

- convert gentls_offsets to a shell script, only running the target
  compiler and gawk.

- Simplify cygtls.h.  The new gentls_offsets script only requires two
  lines with the "public:" keyword as markers.  The comments are not
  used anymore, the output is a preprocesses file without comments.
  Align Makefile rules accordingly.

- Rather than generating perl variables and C #defines, just generate
  .ecu statements and .include the TLS offsets file right from the
  generated assembler file sigfe.s.  It's the only place we really
  need (some of) the offsets.

- Drop the target-specific name of the TLS offsets file and generate
  it on the fly in the build dir.  Fix configure and Makefile rules
  accordingly.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: configure: Define default valus for target specific variables
Corinna Vinschen [Thu, 27 Jan 2022 11:41:55 +0000 (12:41 +0100)]
Cygwin: configure: Define default valus for target specific variables

Define default values for DLL_ENTRY, DIN_FILE, and TLSOFFSETS_H
and drop them from the x86_64-specific branch.  Keep the mechanism
intact to allow other target CPUs if there ever will be.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: config.h: stop including auto-generated tlsoffsets.h file
Corinna Vinschen [Thu, 27 Jan 2022 11:39:57 +0000 (12:39 +0100)]
Cygwin: config.h: stop including auto-generated tlsoffsets.h file

This was a hack to begin with.  Clean this mess up:

- Move definition of CYGTLS_PADSIZE to cygwin/config.h and drop
  local cygtls_padsize.h
- Rename CYGTLS_PADSIZE to __CYGTLS_PADSIZE__ to keep namespace
  clean.  Redefine as macro, rather than as const.
- Move struct _reent first in struct _cygtls to allow using
  __CYGTLS_PADSIZE__ as offset in __getreent().

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: drop i686-only files
Corinna Vinschen [Wed, 26 Jan 2022 16:30:43 +0000 (17:30 +0100)]
Cygwin: drop i686-only files

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: configure: drop unused DEF_DLL_ENTRY variable
Corinna Vinschen [Wed, 26 Jan 2022 16:28:04 +0000 (17:28 +0100)]
Cygwin: configure: drop unused DEF_DLL_ENTRY variable

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: configure: disable i686 builds
Corinna Vinschen [Wed, 26 Jan 2022 16:20:13 +0000 (17:20 +0100)]
Cygwin: configure: disable i686 builds

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: switch to _REENT_GLOBAL_STDIO_STREAMS
Corinna Vinschen [Fri, 13 May 2022 11:26:54 +0000 (13:26 +0200)]
Cygwin: switch to _REENT_GLOBAL_STDIO_STREAMS

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoMake cleanup_glue() static
Sebastian Huber [Fri, 13 May 2022 10:46:56 +0000 (12:46 +0200)]
Make cleanup_glue() static

Remove cleanup_glue from the list of symbols exported by Cygwin.

2 years agoRemove __sglue member for one configuration
Matt Joyce [Mon, 2 May 2022 07:00:12 +0000 (09:00 +0200)]
Remove __sglue member for one configuration

Remove __sglue member of struct reent when _REENT_GLOBAL_STDIO_STREAMS is
defined.

2 years agoAdd global __sglue object for all configurations
Matt Joyce [Mon, 2 May 2022 06:58:25 +0000 (08:58 +0200)]
Add global __sglue object for all configurations

Added a new global __sglue object for all configurations.
Decouples the global file object list from the _GLOBAL_REENT
structure by using this new object instead of the __sglue member
of _GLOBAL_REENT in __sfp() and _fwalk_sglue().

2 years agostdio: Replace _fwalk_reent() with _fwalk_sglue()
Sebastian Huber [Fri, 1 Apr 2022 11:32:32 +0000 (13:32 +0200)]
stdio: Replace _fwalk_reent() with _fwalk_sglue()

Replaced _fwalk_reent() with _fwalk_sglue(). The change adds an
extra __sglue object as a parameter, which will allow the passing
of a global __sglue object separate from the __sglue member of
struct _reent. The global __sglue object will be added in a
follow-on patch.

2 years agoAdd stdio_exit_handler()
Matt Joyce [Tue, 3 May 2022 04:51:22 +0000 (06:51 +0200)]
Add stdio_exit_handler()

Add a dedicated stdio exit handler to avoid using _GLOBAL_REENT in exit().

2 years agoAdd CLEANUP_FILE define
Matt Joyce [Tue, 3 May 2022 04:29:36 +0000 (06:29 +0200)]
Add CLEANUP_FILE define

Define the configuration-dependent constant CLEANUP_FILE for use in
cleanup_stdio(). This will reduce duplicate code during the addition
of a dedicated stdio atexit handler in a follow-on patch.

2 years agoMove __sglue initializations to __sfp()
Matt Joyce [Tue, 3 May 2022 04:17:15 +0000 (06:17 +0200)]
Move __sglue initializations to __sfp()

Moved last remaining  __sglue initializations from __sinit() to
__sfp(). The move better encapsulates access to __sglue and
facilitates its decoupling from struct _reent in a follow-on patch.

2 years agoRemove __sinit_locks / __sinit_recursive_mutex
Matt Joyce [Fri, 8 Apr 2022 09:24:38 +0000 (11:24 +0200)]
Remove __sinit_locks / __sinit_recursive_mutex

Remove __sinit_lock_acquire() and __sinit_lock_release().  Replace these with
__sfp_lock_acquire() and __sfp_lock_release(), respectively.  This eliminates a
potential deadlock issue between __sinit() and __sfp().  Remove now unused
__sinit_recursive_mutex and __lock___sinit_recursive_mutex.

2 years agoAdd two __sglue initialization macros
Matt Joyce [Tue, 5 Apr 2022 09:40:19 +0000 (11:40 +0200)]
Add two __sglue initialization macros

Added _REENT_INIT_SGLUE and _REENT_INIT_SGLUE_ZEROED macros
to initialize __sglue member of struct _reent. This allows
further simplification of __sinit() and facilitates the removal
of __sglue as a member of struct _reent for certain configurations
in a follow-on patch.

2 years agoDeclare global __sf[] only once
Sebastian Huber [Mon, 2 May 2022 07:25:44 +0000 (09:25 +0200)]
Declare global __sf[] only once

Reduced number of global __sf[] declarations from two to one,
simplifying initializations in sys/reent.h.

2 years agoRemove duplicate sglue initializations
Matt Joyce [Fri, 1 Apr 2022 09:32:00 +0000 (11:32 +0200)]
Remove duplicate sglue initializations

Removed duplicate sglue initializations from __sinit(). These
are already initialized in the _REENT_INIT macro in sys/reent.h.
This simplification enables the reduction of _GLOBAL_REENT
dependency in a follow-on patch.

2 years agoRemove duplicate stdio initializations
Matt Joyce [Fri, 1 Apr 2022 09:30:00 +0000 (11:30 +0200)]
Remove duplicate stdio initializations

Removed duplicate stdio initializations from __sinit(). These
are already initialized in the _REENT_INIT macro in sys/reent.h.
This simplification enables the reduction of _GLOBAL_REENT
dependency in a follow-on patch.

2 years agoCygwin: Implement GSO/GRO support
Corinna Vinschen [Thu, 5 May 2022 19:56:57 +0000 (21:56 +0200)]
Cygwin: Implement GSO/GRO support

- getsockopt (SOL_UDP, UDP_SEGMENT)
- setsockopt (SOL_UDP, UDP_SEGMENT)
- getsockopt (SOL_UDP, UDP_GRO)
- setsockopt (SOL_UDP, UDP_GRO)
- sendmsg with SOL_UDP/UDP_SEGMENT control message
- recvmsg, convert Winsock UDP_COALESCED_INFO (DWORD) control message to
  Linux compatible SOL_UDP/UDP_GRO (uint16_t)

2 years agoCygwin: socket.h: add socket options added in recent Windows releases
Corinna Vinschen [Wed, 4 May 2022 18:24:06 +0000 (20:24 +0200)]
Cygwin: socket.h: add socket options added in recent Windows releases

Add new socket options equivalent to their Linux counterpart.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: signal.cc: Include <unistd.h>
Sebastian Huber [Thu, 12 May 2022 09:21:08 +0000 (11:21 +0200)]
Cygwin: signal.cc: Include <unistd.h>

Include <unistd.h> for sleep() and usleep() declarations.  Fix return type of
usleep().

2 years agofhandler_process.cc(format_process_stat): fix /proc/pid/stat issues
Brian Inglis [Tue, 10 May 2022 14:44:42 +0000 (08:44 -0600)]
fhandler_process.cc(format_process_stat): fix /proc/pid/stat issues

fix tty_nr maj/min bits, vmmaxrss units, and x86 format mismatch:
ctty maj is 31:16, min is 15:0; tty_nr s/b maj 15:8, min 31:20, 7:0;
vmmaxrss s/b bytes not pages;
times all 64 bit - change formats of first two instances from %lu to %U;
realign sprintf formats and variables/values in more logical groups

2 years agoCygwin: pty: Avoid script command crash in console.
Takashi Yano [Mon, 9 May 2022 10:45:18 +0000 (19:45 +0900)]
Cygwin: pty: Avoid script command crash in console.

- Previously, script command sometimes crashes by Ctrl-C in Win 7
  if it is running in console, and non-cygwin app is foreground.
  This patch fixes the issue.

2 years agoCygwin: pty: Not to change code page of parent console.
Takashi Yano [Mon, 9 May 2022 03:23:57 +0000 (12:23 +0900)]
Cygwin: pty: Not to change code page of parent console.

- The recent commit "Cygwin: pty: Fix timing of creating invisible
  console." breaks the feature added by commit 72770148, which
  prevents pty from changing code page of parent console. This patch
  restores that.

2 years agoCygwin: pty: Add missing attach_mutex guard.
Takashi Yano [Sun, 8 May 2022 15:54:35 +0000 (00:54 +0900)]
Cygwin: pty: Add missing attach_mutex guard.

2 years agoCygwin: pty: Avoid deadlock when pcon is started on console.
Takashi Yano [Sun, 8 May 2022 15:19:47 +0000 (00:19 +0900)]
Cygwin: pty: Avoid deadlock when pcon is started on console.

- Previously, "env SHELL=cmd script" command in console caused
  deadlock when starting cmd.exe. This patch fixes the issue.

2 years agoCygwin: pty: Change the condition to send Ctrl-C event.
Takashi Yano [Sun, 8 May 2022 13:04:38 +0000 (22:04 +0900)]
Cygwin: pty: Change the condition to send Ctrl-C event.

- Previously, non-cygwin app started by "script -c <non-cygwin app>"
  receives Ctrl-C twice. This patch fixes the issue.

2 years agoCygwin: pty: Fix timing of creating invisible console.
Takashi Yano [Sun, 8 May 2022 10:47:05 +0000 (19:47 +0900)]
Cygwin: pty: Fix timing of creating invisible console.

- Previously, invisible console was created in fixup_after_exec().
  However, actually this should be done in fixup_after_fork(). this
  patch fixes the issue.

2 years agoCygwin: pty: Fix acquiring attach_mutex timing.
Takashi Yano [Sun, 8 May 2022 10:45:31 +0000 (19:45 +0900)]
Cygwin: pty: Fix acquiring attach_mutex timing.

- When temporarily attaching a console, the timing of acquiring
  attach_mutex was not appropriate. This sometimes caused master
  forwarding thread to crash on Ctrl-C in Windows 7. This patch
  fixes the issue.

2 years agoCygwin: sigproc: Avoid segfault caused by signal just after fork().
Takashi Yano [Thu, 5 May 2022 12:12:26 +0000 (21:12 +0900)]
Cygwin: sigproc: Avoid segfault caused by signal just after fork().

- The commit "Cygwin: always add sigmask to child info" also tries
  to fix this issue, however, did not fix enough. This patch fixes
  that.

2 years agoGenerate manpages for functions in chapter sys.tex
Jon Turney [Mon, 2 May 2022 12:55:17 +0000 (13:55 +0100)]
Generate manpages for functions in chapter sys.tex

Also generate manpages for functions in chapter sys.tex, omitted in
error.

2 years agoFix warning about duplicate id in docbook XML
Jon Turney [Mon, 2 May 2022 12:55:16 +0000 (13:55 +0100)]
Fix warning about duplicate id in docbook XML

../newlib/libc/libc.xml:22242: element refentry: validity error : ID iconv already defined
    <refentry id="iconv">

Use a separate namespace for chaper ids, to avoid collision between the
ids for the chapter and function 'iconv', now that iconv documentation
is generated unconditionally.

2 years agoSilence xsltproc when writing manpages
Jon Turney [Mon, 2 May 2022 12:55:15 +0000 (13:55 +0100)]
Silence xsltproc when writing manpages

Unless make is invoked with V=1, have xmlto pass the parameter
'man.output.quietly=1' to xsltproc to suppress "Note: Writing foo.N"
output from the manpages stylesheet.

(This doesn't quite do what it says: The output is not silenced if V has
any value, including 0.  You could consider that either a bug or a
feature.)

2 years agoAdd build avoidance for 'make man'
Jon Turney [Mon, 2 May 2022 12:55:14 +0000 (13:55 +0100)]
Add build avoidance for 'make man'

This will generate multiple manpage files as an output, but we don't
know what they will be called, so use a timestamp for build avoidance.

2 years agoSimplify rules for creating man pages
Jon Turney [Mon, 2 May 2022 12:55:13 +0000 (13:55 +0100)]
Simplify rules for creating man pages

Simplify rules for creating docbook XML used to create manpages:
Updating the output using move-if-change and then unconditionally
touching the .stamp file doesn't make much sense.

2 years agoFix ndbm.c build break
Dimitar Dimitrov [Wed, 4 May 2022 17:03:04 +0000 (20:03 +0300)]
Fix ndbm.c build break

The ndbm.c build broke with:
  Commit 357d7fcc6
  In <stdio.h> provide only necessary types

The above commit exposed a latent missing-header bug:
  newlib/newlib/libc/include/ndbm.h:83:38: error: unknown type name ‘mode_t’

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2 years agoFix nano-malloc build
Dimitar Dimitrov [Wed, 4 May 2022 16:31:43 +0000 (19:31 +0300)]
Fix nano-malloc build

The nano malloc build broke with:
  Commit 357d7fcc6
  In <stdio.h> provide only necessary types

The above commit exposed a latent missing-header bug:
  newlib/libc/stdlib/nano-mallocr.c:220:33: error: ‘uintptr_t’ undeclared (first use in this function)

Fix by including <stdint.h>.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2 years agoRemove _global_impure_ptr indirection
Sebastian Huber [Tue, 3 May 2022 12:51:55 +0000 (14:51 +0200)]
Remove _global_impure_ptr indirection

Remove the pointer indirection through the read-only _global_impure_ptr and
directly use a externally visible _impure_data object of type struct _reent.
This enables the static initialization of global data structures in a follow up
patch.  In addition, we get rid of a machine-specific file.

2 years agoIn <stdio.h> provide only necessary types
Sebastian Huber [Wed, 4 May 2022 08:10:48 +0000 (10:10 +0200)]
In <stdio.h> provide only necessary types

2 years agoRevert "sys/types.h: Don't include sys/_stdint.h"
Corinna Vinschen [Wed, 4 May 2022 13:08:44 +0000 (15:08 +0200)]
Revert "sys/types.h: Don't include sys/_stdint.h"

This reverts commit 4232d171a620662aaed650879936eac60aefd9e0.

2 years agosys/types.h: Don't include sys/_stdint.h
Corinna Vinschen [Tue, 3 May 2022 16:58:18 +0000 (18:58 +0200)]
sys/types.h: Don't include sys/_stdint.h

By including sys/_stdint.h, all types from stdint.h are
exposed even if stdint.h isn't pulled in explicitely. Include
<machine/_default_types.h instead. Fix up newlib and Cygwin
files which rely on stdint.h types, too.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: always add sigmask to child info
Corinna Vinschen [Tue, 3 May 2022 13:16:18 +0000 (15:16 +0200)]
Cygwin: always add sigmask to child info

Even after fork, we might need the parent sigmask without having
access to the real _main_tls. There's a short time at process startup,
when _main_tls points to the system-allocated stack, but wait_sig is
already running. If we can't lock _main_tls, because find_tls can't
find it yet, we now access the parent's sigmask via child_info.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: move x86_64 thread stack area
Corinna Vinschen [Tue, 3 May 2022 13:10:24 +0000 (15:10 +0200)]
Cygwin: move x86_64 thread stack area

The x86_64 thread stack area collides with the share user data in
recent versions of Windows. Let's get ourselvels get out of the
way and move the thread stack area in the former slack space
between DLL area and heap, from 0x6:00000000 to 0x8:00000000.
That quadruplicates the stack area, so allow bigger maximum stack
sizes.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: simplify create_new_main_thread_stack
Corinna Vinschen [Tue, 3 May 2022 12:34:42 +0000 (14:34 +0200)]
Cygwin: simplify create_new_main_thread_stack

Originally the function was designed to be used in forked
processes as well, but it has never been used this way. Drop
the parameter only required for forkees.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: Fix typo KERB_S4U_LOGON_FLAG_IDENTITY -> IDENTIFY
Jon Turney [Tue, 12 Apr 2022 10:48:54 +0000 (11:48 +0100)]
Cygwin: Fix typo KERB_S4U_LOGON_FLAG_IDENTITY -> IDENTIFY

2 years agoCygwin: Fix build with w32api 10.0.0
Jon Turney [Tue, 12 Apr 2022 10:41:13 +0000 (11:41 +0100)]
Cygwin: Fix build with w32api 10.0.0

> ../../../../src/winsup/cygwin/sec_auth.cc:1240:16: error: redefinition of ‘struct _MSV1_0_S4U_LOGON’
>  1240 | typedef struct _MSV1_0_S4U_LOGON
>       |                ^~~~~~~~~~~~~~~~~
> In file included from ../../../../src/winsup/cygwin/ntsecapi.h:10,
>                  from ../../../../src/winsup/cygwin/sec_auth.cc:13:
> /usr/include/w32api/ntsecapi.h:1425:18: note: previous definition of ‘struct _MSV1_0_S4U_LOGON’
>  1425 |   typedef struct _MSV1_0_S4U_LOGON {
>       |                  ^~~~~~~~~~~~~~~~~
> ../../../../src/winsup/cygwin/sec_auth.cc:1246:3: error: conflicting declaration ‘typedef int MSV1_0_S4U_LOGON’
>  1246 | } MSV1_0_S4U_LOGON, *PMSV1_0_S4U_LOGON;
>       |   ^~~~~~~~~~~~~~~~
> In file included from ../../../../src/winsup/cygwin/ntsecapi.h:10,
>                  from ../../../../src/winsup/cygwin/sec_auth.cc:13:
> /usr/include/w32api/ntsecapi.h:1430:5: note: previous declaration as ‘typedef struct _MSV1_0_S4U_LOGON MSV1_0_S4U_LOGON’
>  1430 |   } MSV1_0_S4U_LOGON, *PMSV1_0_S4U_LOGON;
>       |     ^~~~~~~~~~~~~~~~
> ../../../../src/winsup/cygwin/sec_auth.cc:1246:22: error: conflicting declaration ‘typedef int* PMSV1_0_S4U_LOGON’
>  1246 | } MSV1_0_S4U_LOGON, *PMSV1_0_S4U_LOGON;
>       |                      ^~~~~~~~~~~~~~~~~
> In file included from ../../../../src/winsup/cygwin/ntsecapi.h:10,
>                  from ../../../../src/winsup/cygwin/sec_auth.cc:13:
> /usr/include/w32api/ntsecapi.h:1430:24: note: previous declaration as ‘typedef struct _MSV1_0_S4U_LOGON* PMSV1_0_S4U_LOGON’
>  1430 |   } MSV1_0_S4U_LOGON, *PMSV1_0_S4U_LOGON;

2 years agolibgloss: pru: Fix _open syscal arguments
Dimitar Dimitrov [Sun, 3 Apr 2022 18:57:39 +0000 (21:57 +0300)]
libgloss: pru: Fix _open syscal arguments

The _open() C function is declared as having variable arguments in
newlib, so second and third arguments are passed on stack. Add code to
move them into registers, since that's where the PRU simulator expects
them.

Issue was exposed by the GCC test gcc.c-torture/execute/fprintf-2.c,
which relies on tmpnam implementation to pass correct flags to _open.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2 years agoCygwin: Fix "0x0x" in gmondump and ssp man pages
Mark Geisert [Fri, 22 Apr 2022 05:36:33 +0000 (22:36 -0700)]
Cygwin: Fix "0x0x" in gmondump and ssp man pages

A recent patch fixed gmondump to stop printing "0x0x" as an address
prefix.  It turns out the Cygwin User's Guide and the gmondump and
ssp man pages (all from utils.xml) have examples of the same error.

2 years agoCygwin: pty: Fix Ctrl-C behaviour in latest GDB.
Takashi Yano [Mon, 18 Apr 2022 11:07:48 +0000 (20:07 +0900)]
Cygwin: pty: Fix Ctrl-C behaviour in latest GDB.

- In the latest GDB (11.2-1), Ctrl-C behaviour is broken a bit for
  non-cygwin inferior. For example, Ctrl-C on GDB prompt is not sent
  to GDB but to the inferior. This patch fixes the issue.

2 years agoCygwin: pty: Fix deadlock caused by Ctrl-C in setup_pseudoconsole().
Takashi Yano [Mon, 18 Apr 2022 10:56:14 +0000 (19:56 +0900)]
Cygwin: pty: Fix deadlock caused by Ctrl-C in setup_pseudoconsole().

- If Ctrl-C is pressed just after setup_pseudoconsole() is called,
  mintty stops to respond a while when CPU load is high. This patch
  fixes the issue.

Addresses: https://cygwin.com/pipermail/cygwin/2022-April/251272.html

2 years agoCygwin: pty: Do not set internal handles in HPCON inheritable.
Takashi Yano [Mon, 11 Apr 2022 01:44:41 +0000 (10:44 +0900)]
Cygwin: pty: Do not set internal handles in HPCON inheritable.

- The internal handles in HPCON should not be inheritable, however,
  the current code duplicates them as inheritable when handing over
  ownership of the pseudo console. This patch fixes the issue.

Addresses: https://cygwin.com/pipermail/cygwin/2022-April/251222.html

2 years agoAarch32/64: Support __FLT_EVAL_METHOD__ values other than 0, 1, 2
Andrea Corallo [Wed, 30 Mar 2022 13:40:59 +0000 (15:40 +0200)]
Aarch32/64: Support __FLT_EVAL_METHOD__ values other than 0, 1, 2

2022-03-30  Andrea Corallo  <andrea.corallo@arm.com>

* libc/include/machine/ieeefp.h (__FLOAT_TYPE, __DOUBLE_TYPE): New
macros.
* libc/include/math.h: Uses __DOUBLE_TYPE __FLOAT_TYPE to define
double_t float_t if possible.

2 years agoCygwin: pty: Close pseudo console only if the process is the owner.
Takashi Yano [Sat, 9 Apr 2022 03:59:54 +0000 (12:59 +0900)]
Cygwin: pty: Close pseudo console only if the process is the owner.

- Currently, close_pseudoconsole() is called unconditionally from
  fhandler_termios::process_sigs() on Ctrl-C. This causes deadlock
  if Ctrl-C is pressed while setup_pseudoconsole() is called. With
  this patch, close_pseudoconsole() is called only if the master
  process is the owner of the nat-pipe to avoid the deadlock.

2 years agoAdd tests for tzset POSIX timezone string compliance
Jeff Johnston [Fri, 8 Apr 2022 21:19:16 +0000 (17:19 -0400)]
Add tests for tzset POSIX timezone string compliance

- patch from jdbouleu <hi@jdoubleu.de>

  - create time.exp and tzset.c files in newlib/testsuite/newlib.time

2 years agoAdd angle TZ angle bracket support to tzset_r
Jeff Johnston [Fri, 8 Apr 2022 19:06:37 +0000 (15:06 -0400)]
Add angle TZ angle bracket support to tzset_r

- from Brian Inglis <Brian.Inglis@systematicsw.ab.ca>

  - add support to _tzset_unlocked_r() to support quoting std and dst
    names with angle brackets <> as per Posix
  - modify documentation of tzset.c

2 years agofix testsuite cannot compile tests
jdoubleu [Thu, 7 Apr 2022 09:31:40 +0000 (11:31 +0200)]
fix testsuite cannot compile tests

DEJAGNU could not find the function 'newlib_target_compile', because it was defined in another file.

2 years agonewlib: Remove superfluous CHECK_STD_INIT() macro
Sebastian Huber [Thu, 31 Mar 2022 06:43:49 +0000 (08:43 +0200)]
newlib: Remove superfluous CHECK_STD_INIT() macro

This macro is unused or expands to nothing.

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