- After commit bb428520, there has been the disadvantage:
7) Pseudo console cannot be activated if it is already activated for
another process on same pty.
This patch clears this disadvantage.
- After commit bb428520, there has been the disadvantage:
2) The apps which use console API cannot be debugged with gdb. This
is because pseudo console is not activated since gdb uses
CreateProcess() rather than exec(). Even with this limitation,
attaching gdb to native app, in which pseudo console is already
activated, works.
This patch clears this disadvantage.
- After commit bb428520, there has been the disadvantage:
4) Code page cannot be changed by chcp.com. Acctually, chcp works
itself and changes code page of its own pseudo console. However,
since pseudo console is recreated for another process, it cannot
inherit the code page.
This patch clears this disadvantage.
- PTY has a problem that the key input, which is typed during windows
native app is running, disappears when it returns to shell. This is
beacuse pty has two input pipes, one is for cygwin apps and the other
one is for native windows apps. The key input during windows native
program is running is sent to the second input pipe while cygwin
shell reads input from the first input pipe. This issue had been
fixed once by commit 29431fcb, however, the new implementation of
pseudo console support by commit bb428520 could not inherit this
feature. This patch realize transfering input data between these
two pipes bidirectionally by utilizing cygwin-console-helper process.
The helper process is launched prior to starting the non-cygwin app,
however, exits immediately unlike previous implementation.
Following POSIX, ensure that ctime is updated if chown succeeds,
unless the new owner is specified as (uid_t)-1 and the new group is
specified as (gid_t)-1. Previously, ctime was unchanged whenever the
owner and group were both unchanged.
Aside from POSIX compliance, this fix makes gnulib report that chown
works on Cygwin. This improves the efficiency of packages like GNU
tar that use gnulib's chown module. Previously such packages would
use a gnulib replacement for chown on Cygwin.
I think we don't need an extra flag as we can utilize: access & FILE_WRITE_ATTRIBUTES
What do you think?
Ben Wijen (1):
syscalls.cc: unlink_nt: Try FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE
winsup/cygwin/ntdll.h | 3 ++-
winsup/cygwin/syscalls.cc | 22 +++++++--------
winsup/cygwin/wincap.cc | 11 ++++++++
winsup/cygwin/wincap.h | 56 ++++++++++++++++++++-------------------
4 files changed, 53 insertions(+), 39 deletions(-)
--
2.30.0
>From 2d0ff6fec10d03c24d11c747852018b7bc1136ac Mon Sep 17 00:00:00 2001
In-Reply-To: <20210122105201.GD810271@calimero.vinschen.de>
References: <20210122105201.GD810271@calimero.vinschen.de>
From: Ben Wijen <ben@wijen.net>
Date: Tue, 17 Dec 2019 15:15:25 +0100
Subject: [PATCH v3 1/8] syscalls.cc: unlink_nt: Try
FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE
Implement wincap.has_posix_unlink_semantics_with_ignore_readonly and when set
skip setting/clearing of READONLY attribute and instead use
FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE
Move post-dir unlink check from fhandler_disk_file::rmdir to
_unlink_nt_post_dir_check
If a directory is not removed through fhandler_disk_file::rmdir
we can now make sure the post dir check is performed.
- After the commit 72770148, script command exits occasionally with
the error "Bad file descriptor" if it is started in console on Win7
and non-cygwin process is executed. This patch fixes the issue.
- The buffer used in get_console_process_id(), introduced by commit
72770148, is too large and ERROR_NOT_ENOUGH_MEMORY occurs in Win7.
Therefore, the buffer size has been reduced.
The isdev_dev check in rmdir is unclean. Create a virtual method
fhandler_dev::rmdir to handle this transparently.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
- cat exits immediately in the following senario.
1) Execute env CYGWIN=disable_pcon script
2) Execute cmd.exe
3) Execute cat in cmd.exe.
This is caused by setting input_available_event for the pipe for
non-cygwin app. This patch fixes the issue.
- The functions pty_master_thread() and pty_master_fwd_thread()
should be static (i.e. should not access class member) because
the instance is deleted if the master is dup()'ed and the first
master is closed. In this case, because the dup()'ed instance
still exists, these master threads are also still alive even
though the instance has been deleted. As a result, accesing
class members in these functions causes accessi violation.
Addresses:
https://cygwin.com/pipermail/cygwin-developers/2021-January/012030.html
- After commit 232fde0e, pty changes console code page when the first
non-cygwin app is executed. If pty is started in real console device,
pty changes the code page of root console. This causes very annoying
result because changing code page changes the font of command prompt
if console is in legacy mode. This patch avoids this by creating a
new invisible console for the first pty started in console device.
The old implementation for __cxa_guard_acquire did not return 1,
therefore dynamic initialization was never performed.
If concurrent-safe dynamic initialisation is ever needed, CXX ABI
must be followed when re-implementing __cxa_guard_acquire (et al.)
- The function close_pseudoconsole() should be static so that it
can be safely called in spawn.cc even after the fhandler_pty_slave
instance has been deleted. That is, there is a problem with the
current code. This patch fixes the issue.
- If application changes the console mode, mode management introduced
by commit 10d8c278 will be corrupted. For example, stdout of jansi
v2.0.1 or later is piped to less, jansi resets the xterm mode flag
ENABLE_VIRTUAL_TERMINA_PROCESSING when jansi is terminated. This
causes garbled output in less because less needs this flag enabled.
This patch fixes the issue.
- The workaround for rlwrap introduced by commit 8199b0cc does not
take effect for rlwrap 0.40 or later. This patch add a workaround
for rlwrap 0.40 or later as well.
Update to Linux next 5.10 cpuinfo flags for Intel SDM 36.7.1 Software
Guard Extensions, and 38.1.4 SGX Launch Control Configuration.
Launch control restricts what software can run with enclave protections,
which helps protect the system from bad enclaves.
- Previous workaround has a problem that screen is distorted if up
arrow key is pressed at the first line after running "rlwrap cmd".
This patch fixes the issue.
- Previous code to read response for CSI6n allows invalid response
such as "CSI Pl; Pc H" other than correct response "CSI Pl; Pc R".
With this patch, the response is checked more strictly.
if an application built after API version 334 loads uname dynamically,
it actually gets the old uname, rather than the new uname_x. Fix this by
checking the apps API version in uname and call uname_x instead, if it's
a newer app.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
- Sometimes timeout period in term_has_pcon_cap() may not be enough
when the machine slows down for some reason. This patch eases the
issue. In the new code, effective timeout period is expected to be
extended as a result due to slowing-down the wait loop as well when
the machine gets into busy.
The comment and debug output became obsolete in commit 23771fa1f7 when
dup_worker started calling fhandler_base::clone instead of build_fh_pc
and fhandler_base::operator=.
The existing code errors as EINVAL any attempt to set a value for
SO_PEERCRED via setsockopt() on an AF_UNIX/AF_LOCAL socket. But to
enable the workaround set_no_getpeereid behavior for Python one has
to be able to set SO_PEERCRED to zero. Ergo, this patch. Python has
no way to specify a NULL pointer for 'optval'.
This v2 of patch allows the original working (i.e., allow NULL,0 for
optval,optlen to mean turn off SO_PEERCRED) in addition to the new
working described above. The sense of the 'if' stmt is reversed for
readability.
On some systems /bin/sh is not /bin/bash and cygmagic has bash-isms in
it. So even though cygmagic has a /bin/bash shebang, it also needs to be
launched with bash from within Makefile.in.
https://cygwin.com/pipermail/cygwin/2020-December/246938.html
reports a problem where, when adding a Cygwin default symlink
to $PATH since Cygwin 3.1.5, $PATH handling appears to be broken.
3.1.5 switched to WSL symlinks as Cygwin default symlinks.
A piece of code in path handling skips resolving reparse points
if they are the last component in the path. Thus a reparse point
in $PATH is not resolved but converted to Windows path syntax
verbatim.
If you do this with a WSL symlink, certain WinAPI functions fail.
The underlying $PATH handling fails to recognize the reparse
point in $PATH and returns with STATUS_IO_REPARSE_TAG_NOT_HANDLED.
As a result, the calling WinAPI function fails, most prominently
so CreateProcess.
Fix this problem by adding a PATH_REP_NOAPI bit to path_types
and a matching method path_conv::is_winapi_reparse_point().
Right now this flag is set for WSL symlinks and Cygwin AF_UNIX
sockets (new type implemented as reparse points).
The aforementioned code skipping repare point path resolution calls
is_winapi_reparse_point() rather than is_known_reparse_point(),
so now path resolution is only skipped for reparse points known
to WinAPI.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This libltp is old as old dirt and still using K&R style.
If it's really to be used again at all, it needs a serious
refresh.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Network filesystems are not block devices. Apparently this code
hasn't been executed anyway, given how network filesystems are
hidden behind \Device\Mup.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Use fhandler_dev_floppy instead of fhandler_procsys for such devices.
The read()/write() functions from fhandler_procsys do not ensure
sector aligned transfers and lseek() fails always.
Signed-off-by: Christian Franke <franke@computer.org>
- If vim is executed in WSL in mintty, some garbage string caused
by "OSC Ps;? BEL/ST" will be shown in some situations. This patch
fixes the issue by removing "OSC Ps;? BEL/ST" from pseudo console
output.
Since we are now only configuring once, in winsup, with
AC_CONFIG_AUX_DIR(..), the auxiliary files are taken from the top-level.
(Previously we had a random assorment of AC_CONFIG_AUX_DIR(..) and
AC_CONFIG_AUX_DIR(../..) in winsup subdirectories, so auxiliary files
would be taken from winsup or the top-level.)
There's doesn't seem to be much use in independently distributing these
subdirectories, so allowing them to be independently configured seems
pointless and overcomplicated.
The order in which the subdirectories are built is still a little odd,
as cygwin is linked with libcygserver, and cygserver is then linked with
cygwin. So, we build the cygwin directory first, which invokes a build
of libcygserver in the cygserver directory, and then build in the
cygserver directory to build the cygserver executable.
Drop AC_CONFIGURE_ARGS, since we don't need to recursively call
configure with the same arguments anymore.
Slightly refine when we build utils: Previously we didn't build any
utils if MinGW compiler use was avoided, now we just avoid building
those utils which require that compiler.
Greatly simplify how winsup_srcdir and target_builddir are set, since
we're only configuring from one directory. (These are still kept
absolute, since we don't adjust them where used for being used in a
subdirectory).
Remove configure.cygwin and put it's (greatly reduced) contents inline
in the one place it's used now.
Remove generated configure and aclocal.m4 in subdirectories.
This has a test of the path translation code used in various utilities
(mount, cygpath, strace).
MOUNT_BINARY is replaced with the absence of MOUNT_TEXT since 26e0b37e.
The issys member of mnt_t struct was removed in b677a99b.
> $ make check
[...]
> total tests: 63
> pass : 63 (100.0%)
> fail : 0 (0.0%)
'-fno-exceptions -fno-rtti' are already present in the compile command
COMPILE.cc set by Makefile.common, so we don't need to add them to
CXXFLAGS as well.
Invoke grep in text mode when looking for version strings inside the
cygwin DLL, so it outputs something more informative than:
Binary file ../cygwin/cygwin0.dll matches
The overflow check in mEMALIGn erroneously checks for INT_MAX,
albeit the input parameter is size_t. Fix this to check for
__SIZE_MAX__ instead. Also, it misses to check the req against
adding the alignment before calling mALLOc.
While at it, add out-of-bounds checks to pvALLOc, nano_memalign,
nano_valloc, and Cygwin's (unused) dlpvalloc.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Replace the 'WCHAR pipe_name_buf[48]' class member by 'PWCHAR
pipe_name_buf', and allocate space for the latter as needed.
Change the default constructor to accommodate this change, and add a
destructor that frees the allocated space.
Also change get_pipe_name and clone to accommodate this change.
By default, libltp tests will create temporary files in a subdirectory
of /tmp, which will (nowadays) be located relative to the test DLL (by
assuming that it is in /bin). This will evaluate to the directory
$target_builddir/winsup/tmp, which doesn't exist.
The location used for these temporary files can be explicitly controlled
by setting the TDIRECTORY env var. Arrange to set that env var to the
/cygdrive path of a tmp subdirectory of the build directory.
Unfortunately, libltp doesn't clean the temporary directory if
TDIRECTORY is set, and some tests assume they are started in a clean
directory, so we need to do that in tcl.
Set the PATH so that tests can pick up cygwin0.dll. Looks like this was
dropped by accident in 2e488e95 ("Don't rely on in-build tools"), so
restore it as it was prior to 9d89f634.
Drop MINGW_FE, which I can't find any trace of, and instead detect and
use MinGW compilers.
This requires adding AC_CANONICAL_TARGET, to set $target_cpu.
This is now required as cygwin_build is defined in terms of
target_builddir.
(Note that in other subdirectories, the autoconf variable
target_builddir is AC_SUBST-ed as a side-effect of using a macro from
winsup/acinclude.m4, which is perhaps less than ideal)
The autoconf variable all_host is used to make building of the stub
library used by the testsuite conditional on not cross-compiling.
Make it unconditional, so we will notice if it's broken when
cross-compiling.
b55e3f19 was a bit too aggressive in dropping, rather than just
un-exporting these Makefile variables. We need to set these to the
configured host compiler if we are cross-compiling, otherwise they
default to the build compiler.
Also export CC to the mkvers.sh script (which requires it since
4eca5e6a). It's unclear why we can't just cause windres to use the
build 'cpp' as the pre-processor there.
The return value is now -NaN.
This fixes a bug in the mingw-w64 code that was imported into Cygwin.
The fix is consistent with Posix and Linux. It is also consistent
with the current mingw-w64 code, with one exception: The mingw-w64
code sets errno to EDOM if the input is -NaN, but this appears to
differ from Posix and Linux.
Addresses: https://cygwin.com/pipermail/cygwin/2020-October/246606.html
- Calling ResizePseudoConsole() generates some escape sequences.
Due to this behaviour, if the output of non-cygwin app is piped
to less, screen is sometimes distorted when the screen is resized.
With this patch, ResizePseudoConsole() is not called if stdout is
redirected.
- If output of non-cygwin process is piped to cygwin process, such
as less, the non-cygwin process sometimes fails to start and hangs.
This patch fixes the issue.
If MSG_WAITALL is set, recv_internal calls WSARecv or WSARecvFrom in a
loop, in an effort to fill all the scatter-gather buffers. The test
for whether all the buffers are full was previously incorrect.
ccwrap massages the compiler's standard include directories to remove
'/usr/include/w32api', with the intent of allowing it to be overriden by
'--with-windows-headers' (See 4c36016b).
I'm not 100% convinced that this is always working as desired, since in
some places w32api includes are done using <w32api/something.h>, which
will find them via the path /usr/include.
If this does turn out to be needed, this could also be implemented by
constructing the appropriate compiler flags once, rather than on every
compiler invocation.
As discussed in GCC bug 97088
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97088), parameters in
prototypes of library functions should use reserved names, or no name
at all.
This patch moves the internal struct __tzrule_struct to its own
internal header sys/_tz_structs.h. This is included from newlib's
time code as well as from Cygwin's localtime wrapper.
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
The autoconf variable LIBSERVER isn't defined, and it's value isn't
used. (The Makefile.in contains a literal value for the name of this
library instead).
This is only needed if we are using an ancient make which doesn't set
${MAKE}, but we say "This makefile requires GNU make." everywhere.
It only has an effect if @SET_MAKE@ is used, which we aren't doing
consistently.
Add linux-next 5.9 cpuinfo flag for Intel enqcmd/s instructions:
x86/cpufeatures: Enumerate ENQCMD and ENQCMDS instructions:
Work submission instruction comes in two flavors. ENQCMD can be called
both in ring 3 and ring 0 and always uses the contents of a PASID MSR
when shipping the command to the device. ENQCMDS allows a kernel driver
to submit commands on behalf of a user process. The driver supplies the
PASID value in ENQCMDS. There isn't any usage of ENQCMD in the kernel as
of now.
The CPU feature flag is shown as "enqcmd" in /proc/cpuinfo.
If __WITH_AF_UNIX is defined when Cygwin is built, then a named
AF_UNIX socket is represented by a reparse point with a
Cygwin-specific tag and GUID. Make such files recognizable as reparse
points (but not as sockets) even if __WITH_AF_UNIX is not defined.
That way utilities such as 'ls' and 'rm' still behave reasonably.
This requires two changes:
- Define the GUID __cygwin_socket_guid unconditionally.
- Make check_reparse_point_target return PATH_REP on a reparse point
of this type if __WITH_AF_UNIX is not defined.
Commit aa467e6e, "Cygwin: add AF_UNIX reparse points to path
handling", changed check_reparse_point_target so that it could return
a positive value on a known reparse point that is not a symlink. But
some of the code in check_reparse_point that handles this positive
return value was executed unconditionally, when it should have been
executed only for symlinks.
As a result, posixify could be called on a buffer containing garbage,
and check_reparse_point could erroneously return a positive value on a
non-symlink. This is now fixed so that posixify is only called if the
reparse point is a symlink, and check_reparse_point returns 0 if the
reparse point is not a symlink.
Also fix symlink_info::check to handle this last case, in which
check_reparse_point returns 0 on a known reparse point.
The following Windows system calls currently fail with
STATUS_IO_REPARSE_TAG_NOT_HANDLED when called on an AF_UNIX socket:
- NtOpenFile in get_file_sd
- NtOpenFile in set_file_sd
- NtCreateFile in fhandler_base::open
Fix this by adding the FILE_OPEN_REPARSE_POINT flag to those calls
when the file is a known reparse point.
../../../../src/winsup/cygwin/pinfo.cc: In member function 'DWORD pinfo::status_exit(DWORD)':
../../../../src/winsup/cygwin/ntdll.h:21:68: error: narrowing conversion of '-536870295' from 'NTSTATUS' {aka 'int'} to 'unsigned int' [-Wnarrowing]
../../../../src/winsup/cygwin/pinfo.cc:136:10: note: in expansion of macro 'STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION'
../../../../src/winsup/cygwin/sigproc.cc: In member function 'DWORD child_info::proc_retry(HANDLE)':
../../../../src/winsup/cygwin/ntdll.h:21:68: error: narrowing conversion of '-536870295' from 'NTSTATUS' {aka 'int'} to 'unsigned int' [-Wnarrowing]
../../../../src/winsup/cygwin/sigproc.cc:1120:10: note: in expansion of macro 'STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION'
NT error statuses seem to be variously DWORD (unsigned) or NTSTATUS
(signed)? So use the one which doesn't cause problems here.
../../../../src/winsup/cygwin/fhandler_console.cc: In member function 'const unsigned char* fhandler_console::write_normal(const unsigned char*, const unsigned char*)':
../../../../src/winsup/cygwin/fhandler_console.cc:2782:8: error: narrowing conversion of '-2' from 'int' to 'long unsigned int' [-Wnarrowing]
../../../../src/winsup/cygwin/fhandler_console.cc:2786:8: error: narrowing conversion of '-1' from 'int' to 'long unsigned int' [-Wnarrowing]
../../../../src/winsup/cygwin/fhandler_console.cc:2836:8: error: narrowing conversion of '-2' from 'int' to 'long unsigned int' [-Wnarrowing]
../../../../src/winsup/cygwin/fhandler_console.cc:2840:8: error: narrowing conversion of '-1' from 'int' to 'long unsigned int' [-Wnarrowing]
A mbtowc_p function returns an int, so that seems the correct type to use here.
../../../../src/winsup/cygwin/fhandler_socket_inet.cc: In member function 'ssize_t fhandler_socket_wsock::send_internal(_WSAMSG*, int)':
../../../../src/winsup/cygwin/fhandler_socket_inet.cc:1381:69: error: suggest parentheses around assignment used as truth value [-Werror=parentheses]
Commit aa467e6e, "Cygwin: add AF_UNIX reparse points to path
handling", changed the return values of check_reparse_point_target.
Update the comment accordingly.
This was added as a temporary measure in commit e18f7f99 because it
wasn't yet in the mingw-w64 headers. With one exception, it is now in
the current release of the headers (version 8.0.0), so we don't need
it in winlean.h.
The exception is that VirtualAlloc2 is declared conditionally in
<w32api/memoryapi.h>, but the compilation of Cygwin requires it to
always be declared, even though it will only be executed on systems
that support it. So retain the declaration in winlean.h. And add
"WINAPI" to the declaration, as in memoryapi.h.
Add a check that version >= 8 of the mingw-w64 headers is intalled.
Also revert commit 3d136011, which was a related temporary workaround.
enumerate Vista, 7, 8, 10 progression to be clear, and earliest server 2008;
add 8.1, exclude S mode, add Cygwin32 on ARM, specify 64 bit only AMD/Intel
- Charset conversion for UTF-7, ISO-2022 and ISCII, which are not
supported in cygwin, does not work properly as a result. At the
expense of the above, the code has been simplified a bit.
If the process exited with e.g. STATUS_DLL_NOT_FOUND, also process the
file to look for not found DLLs.
(We currently only do this when a STATUS_DLL_NOT_FOUND exception occurs,
which I haven't managed to observe)
This still isn't 100% correct, as it only examines the specified file
for missing DLLs, not recursively on the DLLs it depends upon.
- If pseudo console is disabled, non-cygwin apps do not detect
console device. In this case, some apps output UTF-8 regardless
of the locale setting. At least git-for-windows, rust-based apps
and node.js do that. This patch provides backward compatibility
as default behaviour by setting console codepage to the charset of
the locale. Even in the cases above, garbled output is prevented
with this patch in most cases because mintty uses UTF-8 by default.
I beleave this is not really a problem in cygwin side but that in
app side, however, some users complain about garbled output with
existing apps in MSYS2 (which is based on cygwin) in which pseudo
console is disabled by default.
Setting up the pty in the master constructor ends up creating a new pty
on every stat(2) call on /dev/ptmx. Only do this when actually opening
the device, not when using the device class in another, non-opening
context.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
- Use tmp_pathbuf instead of HeapAlloc()/HeapFree().
- Remove mb_str_free() function.
- Consider the case where the multibyte string stops in the middle
of a multibyte char.
fhandler_process::exists is called when we are checking a path
starting with "/proc/<pid>/fd". If it returns virt_none and sets an
errno, there is no need for further checking. Just set 'error' and
return.
The incoming path is allowed to have the form "$PID/fd/[0-9]*/.*"
provided the descriptor symlink points to a directory. Check that
this is indeed the case.
The new function __eval_codepage_from_internal_charset
is a simplified version of the former code in
fhandler_tty.cc. It probably needs some extension,
but the gist is to use knowledge of internals to
be as quick as possible.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Both flags are outdated and collide with official flags in
sys/_default_fcntl.h, which may result in weird misbehaviour
of file functions.
O_NOSYMLINK is not used anyway.
O_DIROPEN is used in fhandler_virtual and derived classes.
The collision with O_NOFOLLOW results in spurious EISDIR
errors when, e. g., reading files in the registry.
fhandler_base::open_fs uses O_DIROPEN in the call to
fhandler_base::open, but it's not used in this context
further down the road.
Drop both flags and create an alternative "diropen" bool
flag in fhandler_virtual.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
...as on glibc right now. This is supposed to support autoconf scripts
checking for existence of these symbols in libpthread.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
GLibc will change this code in the forseeable future to align more
with FreeBSD, so this hack is not actually desired.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
- Pseudo console internally sends escape sequence CSI6n (query cursor
position) on startup of non-cygwin apps. If the terminal does not
support CSI6n, CreateProcess() hangs waiting for response. To prevent
hang, this patch disables pseudo console if the terminal does not
have CSI6n. This is checked on the first execution of non-cygwin
app using the following steps.
1) Check if the terminal support ANSI escape sequences by looking
into terminfo database. If terminfo has cursor_home (ESC [H),
the terminal is supposed to support ANSI escape sequences.
2) If the terminal supports ANSI escape sequneces, send CSI6n for
a test and wait for a responce for 40ms.
3) If there is a responce within 40ms, CSI6n is supposed to be
supported.
Also set-title capability is checked, and removes escape sequence
for setting window title if the terminal does not have the set-
title capability.
Currently, when using CYGWIN's error_start facility, the faulting
process isn't stopped while the error_start process is started when the
fault is caused by an exception. (it even seems possible in theory that
the faulting process could have exited before the error_start process
attaches).
This leads to e.g. the core dump written by CYGWIN='error_start=dumper'
in response to an exception being non-deterministic.
Remove the waitloop argument from try_to_debug(), only used in the
exception case, so the faulting process busy-waits until the error_start
process attaches.
Code archaeology to determine why the code is this way didn't really
turn up any answers, but this seems a low-risk change, as this only
changes the behaviour when:
- a debugger isn't already attached
- an error_start is specified in CYGWIN env var
- an exception has occurred which will be translated to a signal
If error_start invokes something which doesn't attach using
DebugActiveProcess(), we will spin indefinitely, but that will also
currently occur for any of the existing other uses of try_to_debug(),
which default to waitloop=TRUE.
On 32 bit x86, clang seems to miss loading input parameters based
on asm constraints for inline assembly that uses the x87 floating
registers, unless the snippet has got the volatile keyword.
Signed-off-by: Martin Storsjö <martin@martin.st>
Code taken from FreeBSD, which implements C11 threads as
wrapper around pthreads. Fix up machine/_threads.h which
is called from newlib's machine-independent threads.h to
match Cygwin's pthreads types.
Add the FreeBSD source files to libc subdir and take
opportunity to define LIBC_OFILES var in Makefile.
Add new symbols to common.din and sort symbols.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
In preparation of importing FreeBSDs stdthreads functions,
change the way pthread_yield is exported, so that the symbol
can be used internally as well.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>