]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
2 years agoCygwin: console: Handle setting very long window title correctly.
Takashi Yano [Sun, 19 Jun 2022 03:53:16 +0000 (12:53 +0900)]
Cygwin: console: Handle setting very long window title correctly.

- Previously, the console code could not handle escape sequence
  setting window title longer than 256 byte correctly. This patch
  fixes the issue.
  Addresses: https://cygwin.com/pipermail/cygwin/2022-June/251662.html

2 years agoCygwin: console: Retain ENABLE_VIRTUAL_TERMIANL_PROCESSING flag.
Takashi Yano [Tue, 14 Jun 2022 12:01:58 +0000 (21:01 +0900)]
Cygwin: console: Retain ENABLE_VIRTUAL_TERMIANL_PROCESSING flag.

- Currently, ENABLE_VIRTUAL_TERMINAL_PROCESSING flag is disabled
  unconditionally when exiting from cygwin. This causes ANSI escape
  sequence disabled in Windows Terminal where it is enables by
  default. This patch retains that flag if it is originally enabled.

2 years agoCygwin: restore one more '#ifdef __x86_64__'
Ken Brown [Sat, 11 Jun 2022 12:56:08 +0000 (08:56 -0400)]
Cygwin: restore one more '#ifdef __x86_64__'

2 years agoCygwin: restore '#ifdef __x86_64__' for CPU-specific code
Ken Brown [Thu, 9 Jun 2022 22:42:03 +0000 (18:42 -0400)]
Cygwin: restore '#ifdef __x86_64__' for CPU-specific code

Commit e1ce752a1d, "Cygwin: remove miscellaneous 32-bit code", removed
most occurrences of '#ifdef __x86_64__'.  Restore those occurrences
that guarded code specific to the AMD64 processor, and #error out if
the processor is different.  This will make it easier to find
AMD64-specific code if we ever want to add support for a different
64-bit processor (e.g., ARM64).

2 years agoUse global stdio streams for all configurations
Sebastian Huber [Tue, 17 May 2022 16:28:52 +0000 (18:28 +0200)]
Use global stdio streams for all configurations

The _REENT_GLOBAL_STDIO_STREAMS was introduced by commit
668a4c8722090fffd10869dbb15b879651c1370d in 2017.  Since then it was enabled by
default for RTEMS.  Recently, the option was enabled for Cygwin which
previously used an alternative implementation to use global stdio streams.

In Newlib, the stdio streams are defined to thread-specific pointers
_reent::_stdin, _reent::_stdout and _reent::_stderr.  If the option is disabled
(the default for most systems), then these pointers are initialized to
thread-specific FILE objects which use file descriptors 0, 1, and 2,
respectively.  There are at least three problems with this:

(1) The thread-specific FILE objects are closed by _reclaim_reent().  This
    leads to problems with language run-time libraries that provide wrappers to
    the C/POSIX stdio streams (for example C++ and Ada), since they use the
    thread-specific FILE objects of the initialization thread.  In case the
    initialization thread is deleted, then they use freed memory.

(2) Since thread-specific FILE objects are used with a common output device via
    file descriptors 0, 1 and 2, the locking at FILE object level cannot ensure
    atomicity of the output, e.g. a call to printf().

(3) There are resource managment issues, see:

    https://sourceware.org/pipermail/newlib/2022/019558.html

    https://bugs.linaro.org/show_bug.cgi?id=5841

This patch enables the _REENT_GLOBAL_STDIO_STREAMS behaviour for all Newlib
configurations and removes the option.  This removes a couple of #ifdef blocks.

2 years agoFix __fp_lock_all() and __fp_unlock_all()
Sebastian Huber [Wed, 18 May 2022 11:26:13 +0000 (13:26 +0200)]
Fix __fp_lock_all() and __fp_unlock_all()

For _REENT_GLOBAL_STDIO_STREAMS, lock/unlock all FILE objects.  In the
repository, this function is only used by Cygwin during process forks.  Since
Cygwin enabled _REENT_GLOBAL_STDIO_STREAMS recently, without this fix no FILE
object at all was locked.

2 years agoCygwin: Have gmondump support ssp-generated gmon.out
Mark Geisert [Thu, 9 Jun 2022 04:47:31 +0000 (21:47 -0700)]
Cygwin: Have gmondump support ssp-generated gmon.out

Cygwin tool ssp generates gmon.out files with different address
resolution than other tools do. Two address bytes per bucket rather than
the usual four address bytes. Gprof can deal with the difference but
gmondump can't because the latter's gmon.out header validation fails.

- Remove the offending portion of the header validation code.
- Make sure all code can handle differing address resolutions.
- Display address resolution in verbose data dumps.
- Change "rawarc" to "struct rawarc" in certain sizeof expressions to
  avoid buffer overrun faults.
- When "-v" (verbose) is specified, note when there is missing bucket
  data or rawarc data.

2 years agoClarify struct _reent comment
Sebastian Huber [Wed, 8 Jun 2022 08:41:05 +0000 (10:41 +0200)]
Clarify struct _reent comment

2 years agoFix __sglue inititialization
Sebastian Huber [Tue, 7 Jun 2022 05:55:02 +0000 (07:55 +0200)]
Fix __sglue inititialization

Do not initialize __sglue with the FILE objects of _GLOBAL_REENT to avoid a
double use in the !_REENT_SMALL and !_REENT_GLOBAL_STDIO_STREAMS configurations
which didn't use a thread-specific reentrancy structure.

2 years agoCygwin: restore two instances of __stdcall
Ken Brown [Tue, 7 Jun 2022 17:46:31 +0000 (13:46 -0400)]
Cygwin: restore two instances of __stdcall

In the previous commit, __stdcall was removed from _dll_crt0 in
winsup.h and dcrt0.cc but not in lib/cygwin_crt0.c.  For consistency,
restore the first two occurrences of __stdcall.  We could instead
remove it from the declaration in lib/cygwin_crt0.c, but this might
appear to affect binary compatibility, even though it really doesn't.

2 years agoCygwin: remove most occurrences of __stdcall and __cdecl
Ken Brown [Mon, 6 Jun 2022 16:00:45 +0000 (12:00 -0400)]
Cygwin: remove most occurrences of __stdcall and __cdecl

These have no effect on x86_64.  Retain a few occurrences of __cdecl
in files imported from other sources.

Also retain all occurrences of WINAPI, even though the latter is
simply a macro that expands to __stdcall.  Most of these occurrences
are associated with Windows API functions, and removing them might
make the code confusing instead of simpler.

2 years agoCygwin: remove ntsecapi.h
Ken Brown [Mon, 6 Jun 2022 14:44:01 +0000 (10:44 -0400)]
Cygwin: remove ntsecapi.h

This was a wrapper for w32api/ntsecapi.h.  It was introduced to fix a
bug that only affected 32-bit Cygwin, so it is no longer needed.

2 years agoCygwin: child_info.h: remove declaration of init_child_info
Ken Brown [Mon, 6 Jun 2022 14:16:48 +0000 (10:16 -0400)]
Cygwin: child_info.h: remove declaration of init_child_info

The function was removed long ago, but its declaration remained.

2 years agoCygwin: Drop use of loadlib.h in regtool
Jon Turney [Fri, 30 Apr 2021 13:33:21 +0000 (14:33 +0100)]
Cygwin: Drop use of loadlib.h in regtool

Link directly with RegDeleteKeyExW(), available since Vista.

(It's unclear the LoadLibrary wrapper was ever doing anything useful
here, as (i) DLL lookup in PATH was avoided as advapi32 is already
loaded into the process, and (ii) advapi32 is a 'known DLL' which is
only ever loaded from system directory)

2 years agoCygwin: Drop pointless loadlib.h includes in utilities
Jon Turney [Fri, 30 Apr 2021 13:50:02 +0000 (14:50 +0100)]
Cygwin: Drop pointless loadlib.h includes in utilities

These utilities used to LoadLibrary()/GetProcAddress(), but don't
anymore.

2 years agoCygwin: remove miscellaneous 32-bit code
Ken Brown [Tue, 24 May 2022 18:26:33 +0000 (14:26 -0400)]
Cygwin: remove miscellaneous 32-bit code

2 years agoCygwin: remove 32-bit only clipboard code
Ken Brown [Tue, 24 May 2022 14:25:06 +0000 (10:25 -0400)]
Cygwin: remove 32-bit only clipboard code

2 years agoCygwin: remove some 32-bit only environment code
Ken Brown [Tue, 24 May 2022 14:23:39 +0000 (10:23 -0400)]
Cygwin: remove some 32-bit only environment code

2 years agoCygwin: remove some 32-bit only path conversion functions
Ken Brown [Tue, 24 May 2022 14:20:23 +0000 (10:20 -0400)]
Cygwin: remove some 32-bit only path conversion functions

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.

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