4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-02 12:30:24 +08:00

19606 Commits

Author SHA1 Message Date
Ken Brown
95012189c0 Cygwin: AF_UNIX: sendmsg: fix errno if socket is shut down
Following Posix and Linux, the errno should be EPIPE, not ESHUTDOWN.
2020-10-19 08:56:59 -04:00
Ken Brown
e1beea13e1 Cygwin: AF_UNIX: recvmsg: fix thinko
The pointer 'my_iovptr' was being incremented before it was used.
2020-10-17 14:58:53 -04:00
Jon Turney
039be0a0b4 Cygwin: Remove unused doc/ug-info.xml
Remove doc/ug-info.xml, not used in any document.
2020-10-14 16:02:58 -04:00
Jon Turney
db7375cdab Cygwin: Remove empty MT_SAFE and MT_SAFE_OBJECTS 2020-10-14 16:02:58 -04:00
Jon Turney
affd2cca88 Cygwin: Remove autoconf variable INSTALL_LICENSE
Remove autoconf variable INSTALL_LICENSE, which has a constant value
which is only used once.
2020-10-14 16:02:58 -04:00
Jon Turney
5107953a3a Cygwin: Drop AC_SUBST(LIBSERVER)
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).
2020-10-14 16:02:58 -04:00
Jon Turney
c9c6abfa16 Cygwin: Remove AC_ARG_PROGRAM/program_transform_name
Not done consistently, and probably never used.
2020-10-14 16:02:58 -04:00
Jon Turney
aed1829c54 Cygwin: Remove AC_PROG_MAKE_SET
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.
2020-10-14 16:02:58 -04:00
Jon Turney
fe18bd2728 Cygwin: Drop STDINCFLAGS overrides
This used to turn off -nostdinc on a per-file basis, but has no effect
since 4c36016b5706.
2020-10-14 16:02:58 -04:00
Jon Turney
05d657d7a5 Cygwin: Drop looking for w32api in winsup/w32api
Stop looking for w32api headers in the (no longer existent)
winsup/w32api directory (removed in commit 61746d6ae850).
2020-10-14 16:02:58 -04:00
Brian Inglis
0d65875bed format_proc_cpuinfo: add enqcmd cpuinfo flag
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.
2020-10-14 16:02:57 -04:00
Thomas Wolff
a51546be1a drop ambiguous-wide behaviour from Unicode CJK locales 2020-10-14 16:02:57 -04:00
Ken Brown
c294f50f3d Cygwin: AF_UNIX: add two FIXME comments 2020-10-14 15:00:26 -04:00
Ken Brown
c90e757a6b Cygwin: AF_UNIX: sendmsg: check for 0-length messages
Don't send 0-length messages on a stream socket.
2020-10-14 14:46:26 -04:00
Ken Brown
e974778591 Cygwin: AF_UNIX: support the MSG_PEEK flag
Not yet tested.
2020-10-14 11:39:52 -04:00
Ken Brown
507e9dab26 Cygwin: AF_UNIX: recvmsg, first cut
Tested by running the server/client programs from Kerrisk, "The Linux
Programming Interface", Sections 57.2 and 57.3.

Support for MSG_PEEK is not yet implemented.

Many things have not yet been tested.
2020-10-14 11:28:55 -04:00
Ken Brown
02e2488405 Cygwin: AF_UNIX: add a new peek_pipe_poll method
This is like peek_pipe, except that it polls until there's data in the
pipe, an error, or a signal.
2020-10-14 11:23:45 -04:00
Ken Brown
03c3f5dcfe Cygwin: AF_UNIX: add methods to check for unread data
When reading from a stream socket, it's possible that the caller
requested fewer bytes that are available in the packet.  In this case
there is user data left in the pipe without a packet header.

Add a member '_unread' to the af_unix_shmem_t class to keep track of
this, and add corresponding methods 'get_unread' and 'set_unread' to
af_unix_shmem_t and fhandler_socket_unix.
2020-10-14 11:15:16 -04:00
Ken Brown
cd42f043f4 Cygwin: AF_UNIX: peek_pipe: change error handling
Return an NTSTATUS code instead of a ULONG.  Add a new ULONG reference
argument to replace the previous return value.
2020-10-14 10:54:32 -04:00
Ken Brown
1533431754 Cygwin: AF_UNIX: listen_pipe: check for STATUS_SUCCESS
A successful connection can be indicated by STATUS_SUCCESS or
STATUS_PIPE_CONNECTED.  Previously we were checking only for the
latter.
2020-10-14 10:54:32 -04:00
Ken Brown
8559c26186 Cygwin: AF_UNIX: socket: set the O_RDWR flag 2020-10-14 10:54:32 -04:00
Ken Brown
19074f3157 Cygwin: always recognize AF_UNIX sockets as reparse points
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.
2020-10-14 10:54:32 -04:00
Ken Brown
412c761a28 Cygwin: fix handling of known reparse points that are not symlinks
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.
2020-10-14 10:54:32 -04:00
Ken Brown
032f622533 Cygwin: AF_UNIX: use FILE_OPEN_REPARSE_POINT when needed
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.
2020-10-14 10:54:32 -04:00
Torbjörn SVENSSON
2f2e659bf2 libc/include/wchar.h: Remove parameter name
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 removes the 'ptr' parameter name from
wint_t _getwchar_r (struct _reent *);
wint_t _getwchar_unlocked_r (struct _reent *);

to avoid possible clashes with user code in case someone uses
before including Newlib's wchar.h (or uses some other conflicting
definition)

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com>
2020-10-14 10:54:32 -04:00
Torbjörn SVENSSON
3f9bd1bde5 libc/include/inttypes.h: Remove parameter name
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 removes the 'j' parameter name from
extern intmax_t  imaxabs(intmax_t);

to avoid possible clashes with user code in case someone uses
before including Newlib's inttypes.h (or uses some other conflicting
definition)

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com>
2020-10-14 10:54:32 -04:00
Alex Coplan via Newlib
2c792cb780 libgloss: aarch64: Add support for Armv8-R AArch64
This patch adds support for Armv8-R AArch64.

Armv8-R AArch64 has no EL3, so we don't set vbar_el3, and adjust the
code to set up the MPU for Armv8-R.  So build a different flavour of the
startup code to support that.

We also add a specs file that uses this alternative startup code which
can be used with Armv8-R AArch64 models.
2020-10-14 10:54:32 -04:00
Jon Turney
57b622e902 Cygwin: avoid GCC 10 error with -Werror=narrowing
../../../../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.
2020-10-14 10:54:32 -04:00
Jon Turney
a3673a3f67 Cygwin: avoid GCC 10 error with -Werror=narrowing
../../../../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.
2020-10-14 10:54:32 -04:00
Jon Turney
e65b13927e Cygwin: avoid GCC 10 error with -Werror=parentheses
../../../../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]
2020-10-14 10:54:32 -04:00
Ken Brown
79d94bda9e Cygwin: check_reparse_point_target: update comment
Commit aa467e6e, "Cygwin: add AF_UNIX reparse points to path
handling", changed the return values of check_reparse_point_target.
Update the comment accordingly.
2020-10-14 10:54:32 -04:00
Christophe Lyon
79b37d2bf4 libc/include/math.h: Remove parameter name
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 removes the 'x' parameter name from
extern int __isinff (float);
extern int __isinfd (double);
extern int __isnanf (float);
extern int __isnand (double);
extern int __fpclassifyf (float);
extern int __fpclassifyd (double);
extern int __signbitf (float);
extern int __signbitd (double);

to avoid possible clashes with user code in case someone uses
before including Newlib's math.h (or uses some other conflicting
definition)
2020-10-14 10:54:32 -04:00
Jojo R
98e90ec89f Add C-SKY port for libgloss
This patch contain all libgloss for C-SKY

Contributor list:
  - Lifang Xia <lifang_xia@c-sky.com>
  - Jojo R <jiejie_rong@c-sky.com>
  - Xianmiao Qu <xianmiao_qu@c-sky.com>
  - Yunhai Shang <yunhai_shang@c-sky.com>
2020-10-14 10:54:31 -04:00
Ken Brown
09a471ecb1 Cygwin: winlean.h: remove most of the extended memory API
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.
2020-10-14 10:54:31 -04:00
Jojo R
afb8c5e880 Port of C-SKY for newlib
Contributor list:  

  - Lifang Xia <lifang_xia@c-sky.com>  
  - Jojo R <jiejie_rong@c-sky.com>
  - Xianmiao Qu <xianmiao_qu@c-sky.com>
  - Yunhai Shang <yunhai_shang@c-sky.com>
2020-10-14 10:54:31 -04:00
Keith Packard
2bd71cbf91 libm: Make tgamma(-small) = -INFINITY
Need to copy the argument sign to the output for tgamma(finite)
overflow case.

Signed-off-by: Keith Packard <keithp@keithp.com>
2020-10-14 10:54:31 -04:00
Brian Inglis
b7c1137941 winsup/doc/faq-what.xml: FAQ 1.2 Windows versions supported
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
2020-10-14 10:54:31 -04:00
Brian Inglis
9f712c1cef fhandler_proc.cc(format_proc_cpuinfo): add tsxldtrk, sev_es flags
Add linux-next cpuinfo flags for Intel TSX suspend load address tracking
instructions and AMD Secure Encrypted Virtualization with Encrypted State.
2020-10-14 10:54:31 -04:00
Takashi Yano
ef08f91b2c Cygwin: pty: Drop handling for UTF-7 in convert_mb_str().
- 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.
2020-10-14 10:54:31 -04:00
Jon Turney
bc2c403907 Cygwin: ldd: Also look for not found DLLs when exit status is non-zero
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.
2020-10-14 10:54:31 -04:00
Takashi Yano via Cygwin-patches
4a69ba1c9a Cygwin: pty: Prevent garbled output for existing non-cygwin apps.
- 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.
2020-10-14 10:54:31 -04:00
Corinna Vinschen
522ef1b94c Cygwin: pty: setup new pty on opening the master, not in constructor
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>
2020-10-14 10:54:31 -04:00
Takashi Yano via Cygwin-patches
e79d9d5b59 Cygwin: pty: Fix input charset for non-cygwin apps with disable_pcon.
- If the non-cygwin apps is executed under pseudo console disabled,
  multibyte input for the apps are garbled. This patch fixes the
  issue.
2020-10-14 10:54:31 -04:00
Takashi Yano via Cygwin-patches
4bb14b2ee5 Cygwin: pty: Revise convert_mb_str() function.
- 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.
2020-10-14 10:54:31 -04:00
Ken Brown
e1e3cc1ccb Cygwin: document last bug fix 2020-10-14 10:54:31 -04:00
Ken Brown
047d0bf04a Cygwin: path_conv::check: handle error from fhandler_process::exists
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.
2020-10-14 10:54:31 -04:00
Ken Brown
60d5d14010 Cygwin: format_process_fd: add directory check
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.
2020-10-14 10:54:31 -04:00
Corinna Vinschen
66d8857677 Cygwin: pty: move codepage evaluation to nlsfuncs.cc
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>
2020-10-14 10:54:31 -04:00
Corinna Vinschen
9fddfa3d16 Cygwin: drop internal O_NOSYMLINK and O_DIROPEN flags
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>
2020-10-14 10:54:30 -04:00
Keith Packard via Newlib
63c71d3ae4 libm: Fix 'gamma' and 'gammaf' functions. Clean up other gamma code. [v2]
The current gamma, gamma_r, gammaf and gammaf_r functions return
|gamma(x)| instead of ln(|gamma(x)|) due to a change made back in 2002
to the __ieee754_gamma_r implementation. This patch fixes that, making
all of these functions map too their lgamma equivalents.

To fix the underlying bug, the __ieee754_gamma functions have been
changed to return gamma(x), removing the _r variants as those are no
longer necessary. Their names have been changed to __ieee754_tgamma to
avoid potential confusion from users.

Now that the __ieee754_tgamma functions return the correctly signed
value, the tgamma functions have been modified to use them.

libm.a now exposes the following gamma functions:

    ln(|gamma(x)|):

	__ieee754_lgamma_r
	__ieee754_lgammaf_r

	lgamma
	lgamma_r
	gamma
	gamma_r

	lgammaf
	lgammaf_r
	gammaf
	gammaf_r

	lgammal	(on machines where long double is double)

    gamma(x):

	__ieee754_tgamma
	__ieee754_tgammaf
	tgamma
	tgammaf
	tgammal (on machines where long double is double)

Additional aliases for any of the above functions can be added if
necessary; in particular, I'm not sure if we need to include
__ieee754_gamma*_r functions (which would return ln(|(gamma(x)|).

Signed-off-by: Keith Packard <keithp@keithp.com>

----

v2:
	Switch commit message to ASCII
2020-10-14 10:54:30 -04:00