]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
2 years agoCygwin: Add description of fsync() fix to 3.3.5 release notes.
Takashi Yano [Mon, 14 Mar 2022 23:15:29 +0000 (08:15 +0900)]
Cygwin: Add description of fsync() fix to 3.3.5 release notes.

2 years agoCygwin: path: Convert type of variable 'remlen' to DWORD.
Takashi Yano [Mon, 14 Mar 2022 11:32:53 +0000 (20:32 +0900)]
Cygwin: path: Convert type of variable 'remlen' to DWORD.

- Variable remlen stores the return value of QueryDosDeviceW(), so
  it is better to be DWORD.

2 years agoCygwin: path: Add fallback for DFS mounted drive.
Takashi Yano [Fri, 11 Mar 2022 08:26:30 +0000 (17:26 +0900)]
Cygwin: path: Add fallback for DFS mounted drive.

- If UNC path for DFS is mounted to a drive with drive letter, the
  error "Too many levels of symbolic links" occurs when accessing
  to that drive. This is because GetDosDeviceW() returns unexpected
  string such as "\Device\Mup\DfsClient\;Z:000000000003fb89\dfsserver
  \dfs\linkname" for the mounted UNC path "\??\UNC\fileserver\share".
  This patch adds a workaround for this issue.

  Addresses: https://cygwin.com/pipermail/cygwin/2022-March/250979.html

2 years agoCygwin: fsync: Return EINVAL for special files.
Takashi Yano [Fri, 11 Mar 2022 21:19:53 +0000 (06:19 +0900)]
Cygwin: fsync: Return EINVAL for special files.

- Unlike linux, fsync() calls FlushFileBuffers() even for special
  files. This causes the problem reported in:
    https://cygwin.com/pipermail/cygwin/2022-March/251022.html
  This patch fixes the issue.

2 years agonewlib: xstormy16: move malloc multiplex logic from build to source files
Mike Frysinger [Tue, 1 Mar 2022 06:37:19 +0000 (01:37 -0500)]
newlib: xstormy16: move malloc multiplex logic from build to source files

Rather than define per-object rules in the Makefile, have small files
that define & include the right content.  This simplifies the build
rules, and makes understanding the source a little easier (imo) as it
makes all the subdirs behave the same: you have 1 source file and it
produces 1 object.  It's also about the same amount of boiler plate,
without having to define custom build rules that can fall out of sync.

We also realign the free & pvalloc definitions: common code puts these
in malloc.o & valloc.o respectively, not in free.o & pvalloc.o objects.

This will also be important as we merge the libc.a build into the top
dir since it relies on a single flat list of objects for overrides.

2 years agonewlib: xstormy16: break up mallocr stubs
Mike Frysinger [Tue, 1 Mar 2022 06:02:40 +0000 (01:02 -0500)]
newlib: xstormy16: break up mallocr stubs

Move the multiplex logic out of the build and into source files to
make the build rules a lot simpler.

2 years agonewlib: xstormy16: fix mallopt definition & mstats handling
Mike Frysinger [Tue, 1 Mar 2022 05:58:55 +0000 (00:58 -0500)]
newlib: xstormy16: fix mallopt definition & mstats handling

The mallopt symbol is defined in tiny-malloc.c, not mallocr.c, but
the Makefile in here tries to compile it out of the latter.  This
leads to mallopt never being defined.

The build also creates mallinfo.o & mallopt.o & mallstats.o objects
to override common ones, but the common dir doesn't use these names.
Instead, it places these all in mstats.o.

So move the build define logic to a dedicated file and compile it
directly to make things a bit simpler while fixing the missing func
and aligning objects with the cmomon code.

2 years agoCygwin: console, pty: Fix segfault in child_info_spawn::worker().
Takashi Yano [Thu, 10 Mar 2022 11:20:00 +0000 (20:20 +0900)]
Cygwin: console, pty: Fix segfault in child_info_spawn::worker().

- After the commit "Cygwin: pty, console: Fix handle leak which
  occurs on exec() error.", startxwin cannot start X due to the
  error "Failed to activate virtual core keyboard: 2". The problem
  is access violation in the code retrieving the pgid of the ctty.
  This patch fixes the issue.

  Addresses: https://cygwin.com/pipermail/cygwin/2022-March/251013.html

2 years agonewlib: libc: move stdlib multiplex logic from build to source files
Mike Frysinger [Sat, 26 Feb 2022 04:47:03 +0000 (23:47 -0500)]
newlib: libc: move stdlib multiplex logic from build to source files

Rather than define per-object rules in the Makefile, have small files
that define & include the right content.  This simplifies the build
rules, and makes understanding the source a little easier (imo) as it
makes all the subdirs behave the same: you have 1 source file and it
produces 1 object.  It's also about the same amount of boiler plate,
without having to define custom build rules that can fall out of sync.

This will also be important as we merge the libc.a build into the top
dir since it relies on a single flat list of objects for overrides.

Also take the opportunity to clean up the unnecessary header deps in
here.  Automake provides dependency generation for free now.

2 years agobuild: Avoid length() awk function
Sebastian Huber [Wed, 9 Mar 2022 06:46:13 +0000 (07:46 +0100)]
build: Avoid length() awk function

Some awk implementations such as old versions of mawk do not support the
length() function.  Use the return value of the POSIX split() function instead.

2 years agonewlib: rename mallocr.c to _mallocr.c
Mike Frysinger [Tue, 1 Mar 2022 05:30:46 +0000 (00:30 -0500)]
newlib: rename mallocr.c to _mallocr.c

This file is a little confusing: it provides all of the mallocr logic,
but is compiled multiple times to produce a unique symbol each time.
For example, building mallocr.c with -DDEFINE_FREER produces freer.o
that only defines _free_r().  This is fine for most symbols, but it's
a little confusing when defining mallocr itself -- we produce a file
with the same symbol name, but we still need -DDEFINE_MALLOCR.  In
order to move the logic from the build rules to source files, using
mallocr.c both as a multiplexer and for defining a single symbol is a
bit tricky.  It's possible (if we add a lot of redundant preprocessor
checks to mallocr.c, or we add complicated build flags just for this
one files), but it's easier if we simply rename this to a dedicated
file.  So let's do that.

We do this as a dedicated commit because the next one will create a
new mallocr.c file and git's automatic diff algorithms can handle
trivial renames, but it can't handle renames+creates in the same
commit.

2 years agonewlib: move nano-malloc logic from build to source files
Mike Frysinger [Tue, 1 Mar 2022 04:46:52 +0000 (23:46 -0500)]
newlib: move nano-malloc logic from build to source files

Simplify the build system logic a bit by moving the mallocr.c ->
nano-mallocr.c redirection from the Makefile to the source files.
This allows for consistent object name usage regardless of the
configuration options used in case a machine dir wants to define
its own override.

2 years agoFix Bug libc/28945
Jeff Johnston [Mon, 7 Mar 2022 20:35:02 +0000 (15:35 -0500)]
Fix Bug libc/28945

- apply fix from Tom de Vries <vries@gcc.gnu.org>
  to have calloc zero out storage for nvptx calloc function

2 years agoCygwin: update 3.3.5 release notes
Takashi Yano [Sat, 5 Mar 2022 09:21:09 +0000 (18:21 +0900)]
Cygwin: update 3.3.5 release notes

2 years agoCygwin: add 3.3.5 release notes
Takashi Yano [Sat, 5 Mar 2022 01:56:50 +0000 (10:56 +0900)]
Cygwin: add 3.3.5 release notes

2 years agoCygwin: pty: Adopt the variable name to the name generally used.
Takashi Yano [Sat, 5 Mar 2022 00:39:26 +0000 (09:39 +0900)]
Cygwin: pty: Adopt the variable name to the name generally used.

- Generally, '\n' is called "line feed" (not "new line"), so the
  variable name p_nl has been changed to p_lf.

2 years agoCygwin: pty: Add several further comments to the pty code.
Takashi Yano [Fri, 4 Mar 2022 23:39:05 +0000 (08:39 +0900)]
Cygwin: pty: Add several further comments to the pty code.

2 years agoCygwin: pty: Take account of CR+NL line feed in input.
Takashi Yano [Fri, 4 Mar 2022 14:57:12 +0000 (23:57 +0900)]
Cygwin: pty: Take account of CR+NL line feed in input.

- Currently, individual CR or NL is treated as line feed in
  accept_input() and transfer_input(). This patch takes account
  of CR+NL as well.

2 years agoCygwin: pty: Fix a possible race issue in initialization of pcon.
Takashi Yano [Fri, 4 Mar 2022 13:02:35 +0000 (22:02 +0900)]
Cygwin: pty: Fix a possible race issue in initialization of pcon.

- Currently, tty::pcon_start flag is cleared before transfer_input()
  in master::write(), however, the code in setup_pseudoconsole()
  waits for transfer_input() using tty::pcon_start. This possibly
  causes the race issue. The patch fixes this potential issue.

2 years agoCygwin: pty: Update some comments in pty code.
Takashi Yano [Fri, 4 Mar 2022 13:00:24 +0000 (22:00 +0900)]
Cygwin: pty: Update some comments in pty code.

2 years agoCygwin: pty: Omit transfer_input() call where it is no longer needed.
Takashi Yano [Fri, 4 Mar 2022 09:54:18 +0000 (18:54 +0900)]
Cygwin: pty: Omit transfer_input() call where it is no longer needed.

- This patch removes the old code which calls transfer_input() but
  is no longer needed. These code was necessary indeed in the past,
  however, as a result of recent frequent code changes, it is no
  longer needed.

2 years agoCygwin: pty: Rearrange reset_switch_to_nat_pipe() calls.
Takashi Yano [Fri, 4 Mar 2022 05:42:46 +0000 (14:42 +0900)]
Cygwin: pty: Rearrange reset_switch_to_nat_pipe() calls.

- Previously, reset_switch_to_nat_pipe() is called from many places
  in pty code. This patch reorganizes that. With this patch, it is
  called only from bg_check() and setpgid_aux(). The calls which
  does not have enough reason have been omitted.

2 years agoCygwin: pty: Treat both CR and NL as line feed in transfer_inpup().
Takashi Yano [Fri, 4 Mar 2022 07:05:35 +0000 (16:05 +0900)]
Cygwin: pty: Treat both CR and NL as line feed in transfer_inpup().

- To make read() work properly in canonical mode, writing to the pty
  pipe should be done line by line. However, only CR was treated as
  line separator previously in transfer_input(). This patch fixes
  the issue.

2 years agolibgloss: add new Build System Internals node to the menu
Mike Frysinger [Fri, 4 Mar 2022 06:04:25 +0000 (01:04 -0500)]
libgloss: add new Build System Internals node to the menu

Seems that some versions of texinfo require the @menu to have all
entries at the top level, so add the new build one to it.

2 years agoCygwin: pty: Stop to use PID_NEW_PG flag as a marker for GDB.
Takashi Yano [Thu, 3 Mar 2022 02:43:07 +0000 (11:43 +0900)]
Cygwin: pty: Stop to use PID_NEW_PG flag as a marker for GDB.

- Previously, the PID_NEW_PG flag was also used as a marker for GDB
  with non-cygwin inferior, unlike its original meaning. With this
  patch, the condition exec_dwProcessId == dwProcessId is used as a
  marker for that instead.

2 years agoCygwin: pty: Simplify the setup code for GDB a bit.
Takashi Yano [Thu, 3 Mar 2022 01:55:12 +0000 (10:55 +0900)]
Cygwin: pty: Simplify the setup code for GDB a bit.

- This patch omits the unnecessary code path for setup for GDB.

2 years agoCygwin: pty: Rename nat_pipe_owner_alive() to process_alive().
Takashi Yano [Thu, 3 Mar 2022 01:38:05 +0000 (10:38 +0900)]
Cygwin: pty: Rename nat_pipe_owner_alive() to process_alive().

- The function nat_pipe_owner_alive() is used even for the process
  which is not a nat pipe owner, so, it is renamed to process_alive().

2 years agoCygwin: getconf: align -a output to glibc getconf
Corinna Vinschen [Wed, 2 Mar 2022 21:15:02 +0000 (22:15 +0100)]
Cygwin: getconf: align -a output to glibc getconf

glibc getconf doesn't print "undefined" for undefined values
in -a output.  It just prints the empty string.  Do it the
same way.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: sysconf: don't set errno for unsupported options
Corinna Vinschen [Wed, 2 Mar 2022 21:02:24 +0000 (22:02 +0100)]
Cygwin: sysconf: don't set errno for unsupported options

We return -1 with errno set to EINVAL for sysconf options for
values required by POSIX, but not implemented on Cygwin.
This is incorrect.  Return -1, but don't set errno for these options.
Drop the "nsup" enum to indicate unsupported values, it's not
required anymore.

Fixes: 59e3b6ca7dc10 (CVS import)
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: sysconf: belatedly add correct return value for _SC_DELAYTIMER_MAX
Corinna Vinschen [Wed, 2 Mar 2022 20:54:54 +0000 (21:54 +0100)]
Cygwin: sysconf: belatedly add correct return value for _SC_DELAYTIMER_MAX

When adding the timer_getoverrun function, DELAYTIMER_MAX was added
to limits.h, but the return value of sysconf(_SC_DELAYTIMER_MAX) wasn't
changed accordingly.  Fix that now.

Fixes: 9e295a8d193e ("Cygwin: posix timers: implement timer_getoverrun")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: pty: Add still missing acquire/release_attach_mutex.
Takashi Yano [Wed, 2 Mar 2022 19:06:38 +0000 (04:06 +0900)]
Cygwin: pty: Add still missing acquire/release_attach_mutex.

- transfer_input() function uses console api, so it should be guarded
  by attach_mutex. However, in most cases, it is missing. This patch
  fixes the issue.

2 years agoCygwin: pty: Communalize the code for temporary attach to console.
Takashi Yano [Wed, 2 Mar 2022 12:35:40 +0000 (21:35 +0900)]
Cygwin: pty: Communalize the code for temporary attach to console.

- This patch communalizes the code for attaching another console
  temporarily and resuming to the original attach state, because
  there were a plurality of similar codes throughout.

2 years agoCygwin: console, pty: Revamp the acquire/release_attach_mutex timing.
Takashi Yano [Wed, 2 Mar 2022 07:00:31 +0000 (16:00 +0900)]
Cygwin: console, pty: Revamp the acquire/release_attach_mutex timing.

- This patch revises the acquiring/releasing timing for attach_mutex
  to make the period in which it is being acquired shorter. Further,
  acquiring/releasing are added to where they are missing but needed.

2 years agoCygwin: _pinfo::siginfo: fix sig_send call
Corinna Vinschen [Wed, 2 Mar 2022 08:47:38 +0000 (09:47 +0100)]
Cygwin: _pinfo::siginfo: fix sig_send call

Request __SIGPENDINGALL, not __SIGPENDING, when fetching signal info
for the calling process.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: console: Fix a bug from comparison between int and DWORD.
Takashi Yano [Wed, 2 Mar 2022 02:08:27 +0000 (11:08 +0900)]
Cygwin: console: Fix a bug from comparison between int and DWORD.

2 years agonewlib: convert INTERNAL_NEWLIB to _LIBC
Mike Frysinger [Tue, 1 Mar 2022 01:18:39 +0000 (20:18 -0500)]
newlib: convert INTERNAL_NEWLIB to _LIBC

Since we already set up _LIBC to indicate source files are building
for newlib, we don't need this malloc-specific symbol.  Convert it
over to simplify the build a bit.

2 years agonewlib: drop redundant AM_MAINTAINER_MODE call
Mike Frysinger [Tue, 1 Mar 2022 04:32:12 +0000 (23:32 -0500)]
newlib: drop redundant AM_MAINTAINER_MODE call

This is already called earlier in this file, so no need to do it again.

2 years agolibgloss: merge lm32 into top-level Makefile
Mike Frysinger [Tue, 1 Mar 2022 07:03:17 +0000 (02:03 -0500)]
libgloss: merge lm32 into top-level Makefile

Avoid a recursive make to speed things up a bit.

This drops the header install logic because the lm32/ subdir doesn't
actually have any header files to install.

2 years agolibgloss: use m4_foreach_w to simplify the logic a bit
Mike Frysinger [Mon, 7 Feb 2022 11:18:55 +0000 (06:18 -0500)]
libgloss: use m4_foreach_w to simplify the logic a bit

It's functionally the same, but the configure.ac code is simpler and
less boiler plate duplicated.

2 years agoCygwin: console: Prevent special keys processing from drop.
Takashi Yano [Wed, 2 Mar 2022 00:55:52 +0000 (09:55 +0900)]
Cygwin: console: Prevent special keys processing from drop.

- There was a potential risk to drop special key processing when
  process_input_messsage() is called intermittently. This patch
  fixes the issue.

2 years agoCygwin: console: Stop to create struct instance which is not needed.
Takashi Yano [Tue, 1 Mar 2022 23:35:09 +0000 (08:35 +0900)]
Cygwin: console: Stop to create struct instance which is not needed.

- In fhandler_console::cons_master_thread(), a struct which has
  only a static function is used. In this case, struct instance
  is not necessary. So with this patch, the static function is
  invoked without creating instance.

2 years agoCygwin: update 3.4 release text
Corinna Vinschen [Tue, 1 Mar 2022 15:27:10 +0000 (16:27 +0100)]
Cygwin: update 3.4 release text

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: /proc/<PID>/status: Fill SigPnd, SigBlk and SigIgn values with life
Corinna Vinschen [Tue, 1 Mar 2022 15:19:41 +0000 (16:19 +0100)]
Cygwin: /proc/<PID>/status: Fill SigPnd, SigBlk and SigIgn values with life

So far the values of SigPnd and SigBlk were always 0 and SigIgn
was incorrectly set to the block mask of the current thread of
the calling process.

Fix that by adding a _pinfo::siginfo method and a PICOM_SIGINFO
message to allow to request actual signal info of any running process.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: wait_sig: allow to compute process-wide mask of pending signals
Corinna Vinschen [Tue, 1 Mar 2022 15:14:39 +0000 (16:14 +0100)]
Cygwin: wait_sig: allow to compute process-wide mask of pending signals

Add a signal __SIGPENDINGALL to allow computing the mask of all
currently pending signals.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: add init_cygheap::compute_sigblkmask method
Corinna Vinschen [Tue, 1 Mar 2022 15:13:20 +0000 (16:13 +0100)]
Cygwin: add init_cygheap::compute_sigblkmask method

Add method to compute process-wide signal block mask

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: Makefile: fix ctags --extras option
Corinna Vinschen [Tue, 1 Mar 2022 15:09:09 +0000 (16:09 +0100)]
Cygwin: Makefile: fix ctags --extras option

--extra is deprectated, use --extras

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: handle_sigprocmask: If new signal set is NULL, ignore "how"
Corinna Vinschen [Tue, 1 Mar 2022 13:09:56 +0000 (14:09 +0100)]
Cygwin: handle_sigprocmask: If new signal set is NULL, ignore "how"

The "how" value only makes sense if a new set is given.  If we
only read the current signal set, ignore the value of "how" per
POSIX:

"If set is a null pointer, the value of the argument how is not
significant"

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: /proc/<PID>/status: fix format specifier
Corinna Vinschen [Tue, 1 Mar 2022 13:06:09 +0000 (14:06 +0100)]
Cygwin: /proc/<PID>/status: fix format specifier

The format specifier used for the signal masks is incorrectly
assuming 32 bit values.  Fix it.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: pty: Rename some functions/variables with the name *pcon*.
Takashi Yano [Tue, 1 Mar 2022 13:09:01 +0000 (22:09 +0900)]
Cygwin: pty: Rename some functions/variables with the name *pcon*.

- With this patch, some pty functions/variables have been renamed
  so that the name *pcon* is not used for those that are called
  even when the pseudo console is not active.

2 years agoCygwin: sysconf: _SC_TZNAME_MAX: return -1 as valid value
Corinna Vinschen [Tue, 1 Mar 2022 09:14:42 +0000 (10:14 +0100)]
Cygwin: sysconf: _SC_TZNAME_MAX: return -1 as valid value

sysconf incorrectly sets errno to EINVAL for _SC_TZNAME_MAX.
Don't do that.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: pty: Reorganize the code path of setting up and closing pcon.
Takashi Yano [Tue, 1 Mar 2022 09:04:35 +0000 (18:04 +0900)]
Cygwin: pty: Reorganize the code path of setting up and closing pcon.

- This patch reorganizes the code path of setting-up and cleaning-up
  of the pseudo console to improve readability and maintainability
  of pty code.

2 years agoCygwin: pty: Avoid cutting the branch the pty master is sitting on.
Takashi Yano [Tue, 1 Mar 2022 02:34:16 +0000 (11:34 +0900)]
Cygwin: pty: Avoid cutting the branch the pty master is sitting on.

- When Ctrl-C terminates a non-cygwin process on a pseudo console,
  pty master attaches to the pseudo console first, and send
  CTRL_C_EVENT. If the non-cygwin process closes the pseudo console
  before the pty master calls FreeConsole(), the pty master process
  will crash. With this patch, pty master process takes over the
  ownership of the pseudo console, and closes it by myself.

2 years agonewlib: xstormy16: add missing string.h include
Mike Frysinger [Tue, 1 Mar 2022 06:14:33 +0000 (01:14 -0500)]
newlib: xstormy16: add missing string.h include

Some of these functions are using memcpy & memset from string.h but
not including the header leading to implicit declaration warnings.

2 years agonewlib: speed up targ-include setup & add error checking
Mike Frysinger [Sat, 19 Feb 2022 05:54:20 +0000 (00:54 -0500)]
newlib: speed up targ-include setup & add error checking

The current targ-include setup runs `cp` every header file it installs,
in serial.  This can be a little noticeable on systems, so cleanup the
logic to rely on cp's ability to copy multiple files to a directory in
a single call.

We still need a check for empty directories with no headers (i.e. the
glob doesn't match anything), so add a helper variable to contain that
logic to reduce the boiler plate a little.

2 years agolibgloss: add a little build system generation documentation
Mike Frysinger [Fri, 25 Feb 2022 04:43:06 +0000 (23:43 -0500)]
libgloss: add a little build system generation documentation

This is a bit of an abbreviated form of what's in the Newlib subdir,
but with emphasis on Libgloss-specific parts, and anything unique to
it.  I haven't put too much effort in.

2 years agonewlib: libc: move stdio multiplex logic from build to source files
Mike Frysinger [Sat, 26 Feb 2022 04:17:42 +0000 (23:17 -0500)]
newlib: libc: move stdio multiplex logic from build to source files

Rather than define per-object rules in the Makefile, have small files
that define & include the right content.  This simplifies the build
rules, and makes understanding the source a little easier (imo) as it
makes all the subdirs behave the same: you have 1 source file and it
produces 1 object.  It's also about the same amount of boiler plate,
without having to define custom build rules that can fall out of sync.
Some of these rules were already unnecessary as they were compiling a
single source file into the same named object w/out custom flags, and
Automake handles that for us completely.

This will also be important as we merge the libc.a build into the top
dir since it relies on a single flat list of objects for overrides.

Also take the opportunity to clean up the unnecessary header deps in
here.  Automake provides dependency generation for free now.

2 years agonewlib: simplify header setup rules
Mike Frysinger [Sat, 19 Feb 2022 05:22:14 +0000 (00:22 -0500)]
newlib: simplify header setup rules

Since POSIX cp requires copying a file to a directory without having
to specify the name explicitly, rely on that to avoid calling basename
on every source file.

We can also drop the stub `true` call if the -f test failed.  The use
of `if` already takes care of that in POSIX shell.

2 years agoCygwin: pty: Isolate CTRL_C_EVENTs between ptys.
Takashi Yano [Mon, 28 Feb 2022 11:25:09 +0000 (20:25 +0900)]
Cygwin: pty: Isolate CTRL_C_EVENTs between ptys.

- With this patch, unique invisible consoles are created for each pty
  to isolate CTRL_C_EVENTs between ptys. This is necessary by Ctrl-C
  handling in fhandler_termios::process_sigs() for non-cygwin apps
  started in pty if the pseudo console is disabled.

2 years agoCygwin: console: Improve the code to avoid typeahead key swapping.
Takashi Yano [Mon, 28 Feb 2022 11:02:01 +0000 (20:02 +0900)]
Cygwin: console: Improve the code to avoid typeahead key swapping.

- The commit "Cygwin: console: Prevent the order of typeahead input
  from swapped." did not fully resolve the issue. If keys are typed
  during input buffer fix, the order of key event may be swapped.
  This patch fixes the issue again.

2 years agoCygwin: pinfo: Fix exit code for non-cygwin apps which reads console.
Takashi Yano [Sat, 26 Feb 2022 06:13:13 +0000 (15:13 +0900)]
Cygwin: pinfo: Fix exit code for non-cygwin apps which reads console.

- The recent commit "Cygwin: pinfo: Fix exit code when non-cygwin app
  exits by Ctrl-C." did not fix enough the issue. If a non-cygwin app
  is reading the console, it will not return STATUS_CONTROL_C_EXIT
  even if it is terminated by Ctrl-C. As a result, the previous patch
  does not take effect.
  This patch solves this issue by setting sigExeced to SIGINT in
  ctrl_c_handler(). In addition, sigExeced will be cleared if the app
  does not terminated within predetermined time period. The reason is
  that the app does not seem to be terminated by the signal sigExeced.

2 years agoCygwin: termios: Ensure detection of GDB inferior in process_sigs().
Takashi Yano [Sun, 27 Feb 2022 22:24:45 +0000 (07:24 +0900)]
Cygwin: termios: Ensure detection of GDB inferior in process_sigs().

- In some situations, some cygwin processes might wrongly identified
  as GDB inferior. This patch ensures the detection of GDB inferior.

2 years agoCygwin: termios: Add comments to the code refactored recently.
Takashi Yano [Sun, 27 Feb 2022 11:40:24 +0000 (20:40 +0900)]
Cygwin: termios: Add comments to the code refactored recently.

- This patch adds some comments to the source code whose intent may
  not be clear enough from the code which is refactored recently.

2 years agoCygwin: console: Correct the past fix for apps which open pty.
Takashi Yano [Sun, 27 Feb 2022 03:33:08 +0000 (12:33 +0900)]
Cygwin: console: Correct the past fix for apps which open pty.

- The commit "Cygwin: console: Fix issues of apps which open pty."
  did not fix the second problem correctly. That commit looked to
  fix the issue, but the actual problem was that ctrl_c_handler()
  should be reregistered *AFTER* FreeConsole()/AttachConsole().
  This patch correct that.

2 years agoCygwin: console: Revert experimental code mixed accidentally.
Takashi Yano [Sat, 26 Feb 2022 14:31:59 +0000 (23:31 +0900)]
Cygwin: console: Revert experimental code mixed accidentally.

- The commit "Cygwin: console: Restore CTRL_BREAK_EVENT handling."
  was accidentally mixed with experimental code in exceptions.cc.
  Due to this, non-cygwin app receives CTRL_C_EVENT twice in the
  following scenario.
   1) Run 'sleep 10 | <non-cygwin app>'
   2) Hit Ctrl-C.
   3) The non-cygwin app receives CTRL_C_EVENT twice.
  This patch reverts the code with the problem.

2 years agoCygwin: console: Prevent the order of typeahead input from swapped.
Takashi Yano [Fri, 25 Feb 2022 08:10:03 +0000 (17:10 +0900)]
Cygwin: console: Prevent the order of typeahead input from swapped.

- If a lot of keys are typed very quickly in the app which does
  not read console, the order of input keys in console input buffer
  occasionally swapped. Although this extremely rarely happens,
  is obviously a bug of cons_master_thread. This patch fixes the
  issue.

2 years agoCygwin: pty: Stop to send CTRL_C_EVENT if pcon activated.
Takashi Yano [Fri, 25 Feb 2022 19:19:03 +0000 (04:19 +0900)]
Cygwin: pty: Stop to send CTRL_C_EVENT if pcon activated.

- The commit "Cygwin: console: Redesign handling of special keys."
  removes special treatment for pty in with pseudo console activated,
  however, it is necessary on second thought. This is because sending
  CTRL_C_EVENT to non-cygwin apps will be done in pseudo console,
  therefore, sending it in fhandler_pty_master::write() duplicates
  that event for non-cygwin apps.

2 years agoCygwin: console: Fix issues of apps which open pty.
Takashi Yano [Fri, 25 Feb 2022 07:23:58 +0000 (16:23 +0900)]
Cygwin: console: Fix issues of apps which open pty.

- After some recent changes for special keys handling break the
  apps which open pty (such as script command). If the app which
  opens pty is executed in console, the following issues occur.
    1) If the script command was started from non-cygwin shell
       (such as cmd.exe), another cygwin app started in pty slave
       cannot receive Ctrl-C.
    2) If non-cygwin app is executed in pty slave, the app which
       opened the pty (e.g. script command) crashes by Ctrl-C.
  This patch fixes these issues.

2 years agolibgloss: iq2000: fix prototype
Mike Frysinger [Sat, 26 Feb 2022 04:08:45 +0000 (23:08 -0500)]
libgloss: iq2000: fix prototype

2 years agolibgloss: switch to AM_PROG_AR
Mike Frysinger [Sat, 12 Feb 2022 10:36:20 +0000 (05:36 -0500)]
libgloss: switch to AM_PROG_AR

Now that we require Automake 1.15, we can use this macro rather than
set the tool up ourselves.  The current code doesn't properly search
for a prefixed ar tool as-is.

2 years agonewlib: libc: move configure into top-level
Mike Frysinger [Sun, 13 Feb 2022 00:49:23 +0000 (19:49 -0500)]
newlib: libc: move configure into top-level

This kills off the last configure script under libc/ and folds it
into the top newlib configure script.  The a lot of the logic was
already in the top configure script, so move what's left into a
libc/acinclude.m4 file.

2 years agoCygwin: pinfo: Fix exit code when non-cygwin app exits by Ctrl-C.
Takashi Yano [Thu, 24 Feb 2022 12:04:49 +0000 (21:04 +0900)]
Cygwin: pinfo: Fix exit code when non-cygwin app exits by Ctrl-C.

- Previously, if non-cygwin app exits by Ctrl-C, exit code was
  0x00007f00. With this patch, the exit code will be 0x00000002,
  which means process exited by SIGINT.

2 years agonewlib: add silent rules support to top-level rules
Mike Frysinger [Sat, 19 Feb 2022 05:08:32 +0000 (00:08 -0500)]
newlib: add silent rules support to top-level rules

2 years agolibgloss: document & localize custom multi-do rule
Mike Frysinger [Sat, 19 Feb 2022 04:26:51 +0000 (23:26 -0500)]
libgloss: document & localize custom multi-do rule

The multi-build.in file in libgloss duplicates common multilib logic
in the root source tree.  Document it a bit, and rename the rule so
it doesn't clash with the common multi-do rule.  This will let us use
them in the same makefile so we can merge aarch64/ & arm/ up (as the
only targets that use this local multi-build.in atm).

2 years agolibgloss: finish migration to AM_PROG_AS
Mike Frysinger [Sat, 19 Feb 2022 04:46:44 +0000 (23:46 -0500)]
libgloss: finish migration to AM_PROG_AS

When merging iq2000 up a level, it included a partial conversion to
AM_PROG_AS in the common directory.  Finish it for all directories
to kill off the custom LIB_AM_PROG_AS which we no longer need since
we require Automake 1.15 now.

2 years agolibgloss: switch to standard AC_PROG_CC
Mike Frysinger [Sat, 12 Feb 2022 10:29:06 +0000 (05:29 -0500)]
libgloss: switch to standard AC_PROG_CC

Now that we use AC_NO_EXECUTABLES, and we require a recent version of
autoconf, we don't need to define our own copies of these macros.  So
switch to the standard AC_PROG_CC.

2 years agoCygwin: console: Restore CTRL_BREAK_EVENT handling.
Takashi Yano [Thu, 24 Feb 2022 08:28:32 +0000 (17:28 +0900)]
Cygwin: console: Restore CTRL_BREAK_EVENT handling.

- The recent change by the commit "Cygwin: console: Redesign handling
  of special keys." breaks the handling of CTRL_BREAK_EVENT. The login
  shell in console exits on Ctrl-Break key. This patch fixes the issue.

2 years agonewlib: fix multilib libg.a parallel builds
Mike Frysinger [Thu, 24 Feb 2022 03:01:05 +0000 (22:01 -0500)]
newlib: fix multilib libg.a parallel builds

I split libg.a out into a sep target from libc.a for the main dir in
commit f2b053f49ed2bd7b4da8cf4ed3a608dc2f425c2b ("newlib: separate out
libg from libc"), but missed the multilib dirs.  That leads to an
uncommon parallel build failure:
- libc.a rule runs & finishes
- $(BUILD_MULTISUBDIR)/libc.a rule runs
  -> failure due to libg.a not yet existing
- libg.a rule runs & finishes

Split the multilib libg rule out from libc too so it can depend on the
main libg directly and avoid this race.

2 years agonewlib: libm: workaround ar duplicate member behavior
Mike Frysinger [Mon, 21 Feb 2022 20:42:18 +0000 (15:42 -0500)]
newlib: libm: workaround ar duplicate member behavior

GNU ar has undocumented behavior where it doesn't dedupe its inputs if
they're all on the same command line, so we have to dedupe ourselves.

2 years agolibgloss: merge sparc configure script up a level
Mike Frysinger [Fri, 18 Feb 2022 02:23:40 +0000 (21:23 -0500)]
libgloss: merge sparc configure script up a level

Move the minor sparc-specific logic to a dedicated variable so we can
merge its configure logic up a level.

2 years agoCygwin: pty, console: Add a workaround for GDB SIGINT handling.
Takashi Yano [Wed, 23 Feb 2022 15:57:37 +0000 (00:57 +0900)]
Cygwin: pty, console: Add a workaround for GDB SIGINT handling.

- The inferior of the GDB cannot be continued after SIGINT even
  though nopass option is set. This seems because cygwin GDB does
  not support hooking cygwin signal. Therefore, a workaround for
  GDB is added. With this patch, only CTRL_C_EVENT is sent to the
  GDB inferior by Ctrl-C and sending SIGINT is omitted. Note that
  "handle SIGINT (no)pass" command does not take effect even with
  or without this patch.

2 years agoCygwin: console: Redesign handling of special keys.
Takashi Yano [Wed, 23 Feb 2022 04:24:39 +0000 (13:24 +0900)]
Cygwin: console: Redesign handling of special keys.

- This patch rearranges the cooperation between cons_master_thread,
  line_edit, and ctrl_c_handler so that only one of them operates
  at the same time. Since these handle Ctrl-C individually, so the
  signal may be sent multiple times to the process. This patch fixes
  the issue.

2 years agolibgloss: enable maintainer mode support
Mike Frysinger [Tue, 22 Feb 2022 22:09:16 +0000 (17:09 -0500)]
libgloss: enable maintainer mode support

Use AM_MAINTAINER_MODE so devs have to opt-in to automatic rebuilds
of autotools.  This matches what newlib (and most every other GNU
toolchain package) does with automake.

2 years agoCygwin: unlink: filter out virtual files and devices early on
Corinna Vinschen [Tue, 22 Feb 2022 12:32:29 +0000 (13:32 +0100)]
Cygwin: unlink: filter out virtual files and devices early on

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: Implicitly support the /dev/fd symlink and friends
Johannes Schindelin [Mon, 21 Feb 2022 13:36:37 +0000 (14:36 +0100)]
Cygwin: Implicitly support the /dev/fd symlink and friends

Bash has a very convenient feature that is called process substitution
(e.g. `diff -u <(seq 0 10) <(seq 1 11)`). To make this work, Bash
requires the `/dev/fd` symlink to exist, and Cygwin therefore creates
this symlink (together with the `stdin`, `stdout` and `stderr` ones)
upon start-up.

This strategy is incompatible with the idea of providing a subset of
Cygwin in a `.zip` file (because there is no standard way to represent
symlinks in `.zip` files, and besides, older Windows versions would
potentially lack support for them anyway).

That type of `.zip` file is what Git for Windows wants to use, though,
bundling a minimal subset for third-party applications in MinGit (see
https://github.com/git-for-windows/git/wiki/MinGit for details).

Let's side-step this problem completely by creating those symlinks
implicitly, similar to the way `/dev/` is populated with special
devices.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2 years agoCygwin: Adjust path to newlib libc.a, too
Corinna Vinschen [Tue, 22 Feb 2022 11:45:23 +0000 (12:45 +0100)]
Cygwin: Adjust path to newlib libc.a, too

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: Adjust path to newlib libm.a in builddir
Jon Turney [Sat, 19 Feb 2022 18:18:51 +0000 (18:18 +0000)]
Cygwin: Adjust path to newlib libm.a in builddir

Adjust path to newlib libm.a in builddir, changed by ac9f8c46

2 years agoMake __sdidinit unused
Matt Joyce [Tue, 22 Feb 2022 10:18:38 +0000 (11:18 +0100)]
Make __sdidinit unused

Remove dependency on __sdidinit member of struct _reent to check
object initialization. Like __sdidinit, the __cleanup member of
struct _reent is initialized in the __sinit() function. Checking
initialization against __cleanup serves the same purpose and will
reduce overhead in the __sfp() function in a follow up patch.

2 years agoCygwin: pty: Encapsulate pty code in tty::setpgid().
Takashi Yano [Mon, 21 Feb 2022 13:40:48 +0000 (22:40 +0900)]
Cygwin: pty: Encapsulate pty code in tty::setpgid().

- This patch hides complex pty codes in tty::setpgid() to transfer
  input into the class fhandler_pty_slave by encapsulating it.

2 years agoCygwin: pty, console: Fix handle leak which occurs on exec() error.
Takashi Yano [Mon, 21 Feb 2022 12:20:48 +0000 (21:20 +0900)]
Cygwin: pty, console: Fix handle leak which occurs on exec() error.

- This patch fixes the handle leak which occurs when exec() fails
  with an error. The duplicated handles will be closed when the
  exec'ed process is terminated. However, if exec() fails, the code
  path does not reach to the code closing the duplicated handles.
  To implement this fix more appropriately, the setup, cleanup and
  closing pty codes which was previously located in spawn.cc are
  encapsulated into the fhandler_pty_slave class functions.

2 years agoCygwin: console: Call fix_tab_position() only if having broken tabs.
Takashi Yano [Wed, 16 Feb 2022 15:34:40 +0000 (00:34 +0900)]
Cygwin: console: Call fix_tab_position() only if having broken tabs.

- Calling fix_tab_position() is necessary in Windows 10 with xterm
  compatible mode enabled, because it has a problem that the tab
  positions will be broken when the window size is changed. Fortunately,
  this problem has been fixed in Windows 11. Therefore, with this patch,
  necessity of fix_tab_position() call is determined by referring to
  wincap.has_con_broken_tabs(), which is recently introduced.

2 years agoCygwin: console: Rearrange set_(in|out)put_mode() calls.
Takashi Yano [Wed, 16 Feb 2022 06:43:42 +0000 (15:43 +0900)]
Cygwin: console: Rearrange set_(in|out)put_mode() calls.

- With this patch, all set_(in|out)put_mode() calls are rearranged
  as follows.

  1) Setup for cygwin apps, started from non-cygwin app, is done
     in fhandler_console::post_open_setup(), which overrides
     fhandler_base::post_open_setup() called from dtable.cc.
  2) Cleanup for cygwin app is done in fhandler_console::close().
  3) Setup for cygwin apps is also in fhandler_console::bg_check(),
     which overrides fhandler_termios::bg_check(). This is called
     on read(), write() and select() for console. It is necessary
     if cygwin and non-cygwin apps are started simultaneously in
     the same process group.
  4) Setup for non-cygwin apps is done in spawn.cc via
     fhandler_console::setup_console_for_non_cygwin_app().
  5) Cleanup for non-cygwin app is done in spawn.cc vid
     fhandler_console::cleanup_console_for_non_cygwin_app().
  6) Setup for non-cygwin app started by GDB is done in
     fhandler_console::set_console_mode_to_native().
  7) No explicit cleanup for non-cygwin app started by GDB, because
     console mode is automatically reset to tty::cygwin on read()/
     write() in GDB thanks to 3).

2 years agoCygwin: pty, console: Refactor the code processing special keys.
Takashi Yano [Tue, 15 Feb 2022 14:23:50 +0000 (23:23 +0900)]
Cygwin: pty, console: Refactor the code processing special keys.

- This patch commonize the code which processes special keys in pty
  and console to improve maintanancibility. As a result, some small
  bugs have been fixed.

2 years agonewlib: libc: delete crt0.o duplication
Mike Frysinger [Sun, 13 Feb 2022 01:28:26 +0000 (20:28 -0500)]
newlib: libc: delete crt0.o duplication

The crt0.o was handled in a subdir-by-subdir basis: it would be compiled
in one (e.g. libc/sys/$arch/), then copied up one level (libc/sys/), then
copied up another (libc/) before finally being copied & installed in the
top newlib dir.  The libc/sys/ copy was cleaned up, and then the top dir
was changed to copy it directly out of the libc/sys/$arch/ dir.  But the
libc/sys/ copy to libc/ was left behind.  Clean that up now too.

2 years agonewlib: posix: use local includes for local headers
Mike Frysinger [Sun, 13 Feb 2022 10:43:42 +0000 (05:43 -0500)]
newlib: posix: use local includes for local headers

These headers aren't installed, so use "" includes instead of <> so
we don't search system header paths.  This matches the style used
elsewhere in the tree for these local headers, and makes it work
w/out explicit -I flags (as needed with non-recursive make).

2 years agonewlib: libm: merge build up a directory
Mike Frysinger [Thu, 10 Feb 2022 05:50:36 +0000 (00:50 -0500)]
newlib: libm: merge build up a directory

Convert all the libm/ subdir makes into the top-level Makefile.  This
allows us to build all of libm from the top Makefile without using any
recursive make calls.  This is faster and avoids the funky lib.a logic
where we unpack subdir archives to repack into a single libm.a.  The
machine override logic is maintained though by way of Makefile include
ordering, and source file accumulation in libm_a_SOURCES.

One thing to note is that this will require GNU Make because of:
libm_a_CFLAGS = ... $(libm_a_CFLAGS_$(subst /,_,$(@D)))
This was the only way I could find to supporting per-dir compiler
settings, and I couldn't find a POSIX compatible way of transforming
the variable content.  I don't think this is a big deal as other
Makefiles in the tree are using GNU Make-specific syntax, but I call
this out as it's the only one so far in the new automake code that
I've been writing.

Automake doesn't provide precise control over the output object names
(by design).  This is fine by default as we get consistent names in all
the subdirs: libm_a-<source>.o.  But this relies on using the same set
of compiler flags for all objects.  We currently compile libm/common/
with different optimizations than the rest.

If we want to compile objects differently, we can create an intermediate
archive with the subset of objects with unique flags, and then add those
objects to the main archive.  But Automake will use a different prefix
for the objects, and thus we can't rely on ordering to override.

But if we leverage $@, we can turn Automake's CFLAGS into a multiplex
on a per-dir (and even per-file if we wanted) basis.  Unfortunately,
since $@ contains /, Automake complains it's an invalid name.  While
GNU Make supports this, it's a POSIX extension, so Automake flags it.
Using $(subst) avoids the Automake warning to get a POSIX compliant
name, albeit with a GNU Make extension.

2 years agonewlib: separate out libg from libc
Mike Frysinger [Sun, 13 Feb 2022 08:03:12 +0000 (03:03 -0500)]
newlib: separate out libg from libc

Make this a separate target from libc so that we can migrate libc over
to automake more easily.  Having it integrated into the libc target is
difficult to handle when using automake rules which expect a one-to-one
mapping between names & inputs.

2 years agonewlib: libc: reshuffle include order for the manual
Mike Frysinger [Sun, 13 Feb 2022 07:44:31 +0000 (02:44 -0500)]
newlib: libc: reshuffle include order for the manual

When migrating the manual to the top-level, the include order was
sorted by name of the subdir.  But this changed the chapter order
of the manual in the process.  Change the sorting back to match
existing chapters and update the comments to explain.

2 years agonewlib: powerpc: switch to Automake conditionals
Mike Frysinger [Tue, 15 Feb 2022 02:37:38 +0000 (21:37 -0500)]
newlib: powerpc: switch to Automake conditionals

Using xxx_LIBADD, xxx_DEPENDENCIES, and EXTRA_xxx_SOURCES is one way of
conditionally including files into a target.  But it's meant more for the
cases where the variables added to LIBADD & DEPENDENCIES are constructed
via substitution (e.g. AC_SUBST) or other dynamic methods.  With Automake
conditionals, then the much simpler form is to conditionally append to
the xxx_SOURCES variable and let Automake sort everything out.

2 years agolibgloss: have README point to the manual
Mike Frysinger [Sun, 13 Feb 2022 07:35:45 +0000 (02:35 -0500)]
libgloss: have README point to the manual

The README has such little info in it, so point people to the much
more extensive porting manual.

2 years agolibgloss: merge mips configure script up a level
Mike Frysinger [Sat, 12 Feb 2022 10:17:15 +0000 (05:17 -0500)]
libgloss: merge mips configure script up a level

Move the minor mips-specific logic to a dedicated file & namespace
them so we can merge its configure logic up a level.

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