Commit Graph

17677 Commits

Author SHA1 Message Date
Yaakov Selkowitz 59e09b6419 string: add strverscmp
The actual implementation is from musl (MIT license).

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-06-19 08:16:42 -05:00
Thomas Preud'homme 0c081aa62c Fix guard for siginfo_t and pthread_t definition
Commit 8a3b3bb4d7 changed the guard on
some functions from _POSIX_THREADS to __POSIX_VISIBLE. As a consequence,
some use of siginfo_t and pthread_t became visible under configurations
where _POSIX_THREADS is unset but __POSIX_VISIBLE is. Build then fails
because the definition of those types are still unavailable.

This commit make those type definition visible for __POSIX_VISIBLE
configurations. This requires moving the siginfo_t definition out of the
RTEMS specific definitions in sys/signal.h while still guarding it
against cygwin case.
2017-06-19 13:00:05 +02:00
Corinna Vinschen 14ea06212b Revert "Don't overread or write memory returned by _DTOA_R"
This reverts commit efaef1bba2.
2017-06-19 12:57:16 +02:00
Erik M. Bray 5ca286666a Ensure that send() interrupted by a signal returns sucessfully
When SA_RESTART is not set on a socket, a blocking send() that is
interrupted mid-transition by a signal should return success (and
report just how many bytes were actually transmitted).

The err variable used here was not always guaranteed to be set
correctly in the loop, so better to just remove it and call
WSAGetLastError() explicitly.
2017-06-19 12:51:39 +02:00
Yaakov Selkowitz a5cc86ba13 cygwin: document XSI sigpause
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-06-14 14:30:44 -05:00
Yaakov Selkowitz dde6af6f82 Export XSI sigpause
There are two common sigpause variants, both of which take an int argument.
If you request _XOPEN_SOURCE or _GNU_SOURCE, you get the System V version,
which removes the given signal from the process's signal mask; otherwise
you get the BSD version, which sets the process's signal mask to the given
value.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-06-14 14:23:52 -05:00
Joel Sherrill 40ca6f02ed newlib/MAINTAINERS: Add OS maintainers section and myself for RTEMS and Write After Approval. 2017-06-14 13:44:02 -05:00
Yaakov Selkowitz 6a6c1c52e6 Feature test macros overhaul: Cygwin signal.h
This should match newlib's <sys/signal.h>.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-06-14 10:18:15 -05:00
Yaakov Selkowitz 8a3b3bb4d7 Feature test macros overhaul: signal.h (part 3)
Notably, sigaction and friends are POSIX, but the form of sigpause
currently provided is BSD.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-06-14 10:18:15 -05:00
Yaakov Selkowitz c347bb6469 stdio.h: guard function macros with !__cplusplus
While POSIX allows these functions to also be defined as macros in C, in
C++ this is not allowed, and prevents these names (particularly feof) from
being used in a custom namespace.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-06-14 10:18:14 -05:00
Claudiu Zissulescu 0d79b021a4 Add JLI support.
Initialize the jli_base registers for ARCv2 cpus.

libgloss/
2017-05-23  Claudiu Zissulescu  <claziss@synopsys.com>

	* arc/crt0.S: Initialize the jli_base registers for ARCv2 cpus.
2017-06-14 14:51:22 +02:00
Claudiu Zissulescu 8c8b25e388 Add profile support.
Add profile support for ARC processors.

libgloss/
2016-07-28  Claudiu Zissulescu  <claziss@synopsys.com>

	* arc/crt0.S: Add calls to profiler support routines.
	* Makefile.in (CRT0): Add gcrt0.
	(NSIM_OBJS): Add mcount.
	(CRT0_INSTALL): Install gcrt0, and crt0.
	* arc/gcrt0.S: New file.
	* arc/mcount.c: Likewise.
2017-06-14 14:51:20 +02:00
Corinna Vinschen 8eada33223 cygwin: readdir: don't lookup mount target inodes
So far Cygwin's readdir returned the inode number of a mount target
in d_ino, rather than the actual inode number of the mount point in
the underlying filesystem.  This not only results in a performance
hit if the mount target is a remote FS, it is also not done on other
POSIX systems.

Remove the code evaluating the mount target inode number.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-06-14 13:22:56 +02:00
Joe Lowe 0a9edd73e3 readdir() with mount point dentry, return mount point INO
This patch fixes a minor compatibility issue w/ cygwin mount point handling in
readdir(), compared to equivalent behavior of Linux and MacOS. dentry.d_ino
should indicate the INO of the mount point itself, not the target volume root
folder.

Changed return type from readdir_check_reparse_point to uint8_t, to avoid
unnecessarily being implicitly cast to and from a signed int.

Renamed a related local variable "attr" to "oattr" that was eclipsing a member
variable with the same name.

Joe L.
2017-06-14 10:57:02 +02:00
Aditya Upadhyay 35cd6863fb ccoshl: Align formatting to upstream
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-06-14 10:36:38 +02:00
Aditya Upadhyay ed82849b8f Importing ccoshl.c from netbsd.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-06-13 10:41:06 +02:00
Sebastian Huber 0fbd27dd1e Remove FreeBSD specifics from RTEMS <arpa/inet.h>
For whatever reason FreeBSD renames several functions provided by
<arpa/inet.h> and uses weak references to provide the standard function
names.  This causes problems on targets lacking proper support for weak
references.  We do not need this function renaming on RTEMS.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-06-12 08:41:24 +02:00
Silviu Baranga efaef1bba2 Don't overread or write memory returned by _DTOA_R
Don't over-read memory returned by _DTOA_R, and never write to it
since the result might be a string literal.

For example, when doing:
  swprintf(tt, 20, L"%.*f", 6, 0.0);

we will get back "0".

Instead, write the result returned by _DTOA_R to the output buffer.
After this, write the 0 chars directly to the the output buffer
(if there are any). This also has the (marginal) advantage that
we read/write less memory overall.
2017-06-09 15:30:47 +02:00
David Macek 5562000225 Add COMODO Internet Security and ConEmu to BLODA
ConEmu: There has been at least one report of it causing crashes <https://github.com/Maximus5/ConEmu/issues/1158>

COMODO Internet Security: Causing GPG failures <https://github.com/msys2/msys2/issues/38>
2017-06-09 11:10:54 +02:00
Sebastian Huber e9085e0ccd Fix RTEMS ioctl() declaration
Using uint32_t for ioctl_command_t does not work well on 64-bit targets.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-06-07 15:46:20 +02:00
Sebastian Huber dc93d7adff Update FreeBSD revision of RTEMS <sys/bitset.h>
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-06-07 15:46:20 +02:00
Sebastian Huber fd5d052d40 Fix some RTEMS CPUSET(9) macros
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-06-07 15:46:19 +02:00
Sebastian Huber c29f5b219d Fix RTEMS CPU_EQUAL_S()
According to the FreeBSD man page BIT_CMP() returns true in case the two
sets are NOT equal.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-06-07 15:46:19 +02:00
Sebastian Huber ffcaf32108 Add myself to Write After Approval 2017-06-07 14:36:51 +02:00
Prakhar Bahuguna 21ff2cf930 Fix minor issues in memchr NEON implementation 2017-06-07 12:16:15 +02:00
Kito Cheng beb17b264b Print sign of NaN values. 2017-06-07 11:50:31 +02:00
Corinna Vinschen 105436dead cygwin: document lrint bugfix
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-06-07 11:07:52 +02:00
Corinna Vinschen e4094e49c1 cygwin: Fix lrint{f,l} to return a 64 bit long on x86_64
Mingw-w64 (where the code has been taken from) has 4 byte longs
independently of the architecture but x86_64 Cygwin has 64 bit longs.
So use fistpll instead of fistpl on x86_64 Cygwin.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-06-07 11:03:16 +02:00
Corinna Vinschen 163066a1a5 cygwin: document env var crash fix
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-06-06 21:11:52 +02:00
Corinna Vinschen 7afc1124b6 cygwin: Fix crash if env var name starts with non-ASCII char
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-06-06 21:10:23 +02:00
Corinna Vinschen 41b7ef9e1f cygwin: document wcsxfrm fix
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-06-06 18:39:41 +02:00
Corinna Vinschen c0d7d3e1a2 cygwin wcsxfrm: byte swap result ourselves
Workaround a bug (or undocumented behaviour) in LCMapStringW:

It's documented(*) that the cchDest parameter is a byte count with
LCMAP_SORTKEY, but a character count otherwise.  But the docs don't
state what happens if you combine LCMAP_SORTKEY with LCMAP_BYTEREV.

Tests indicate that LCMAP_SORTKEY treats cchDest as byte count, but
then LCMAP_BYTEREV treats it as char count in the same call.  So the
latter swaps twice as much bytes in the destination buffer than the
byte count it returns, which potentially results in writing past the
end of the given output buffer.

Solution: Don't specify LCMAP_BYTEREV in the LCMapStringW(LCMAP_SORTKEY)
call, rather byte swap afterwards.

(*) https://msdn.microsoft.com/en-us/library/windows/desktop/dd318702(v=vs.85).aspx

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-06-06 18:27:47 +02:00
Martin Young 780503f6ac Fix thinko in MSP430 libgloss implementation of write() system call. 2017-05-26 11:35:13 +01:00
Jeff Johnston 9b7bbd0313 Update COPYING.NEWLIB appropriately. 2017-05-25 12:52:18 -04:00
Sebastian Huber d70983ea1b Add de-facto standard <sys/ioctl.h> for RTEMS
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-05-25 12:42:08 -04:00
Sebastian Huber fa88e93d3d Add some POSIX header files for RTEMS
Add the POSIX header files

  * arpa/inet.h
  * net/if.h
  * netdb.h
  * netinet/in.h
  * netinet/tcp.h
  * sys/socket.h
  * sys/syslog.h
  * sys/uio.h
  * sys/un.h
  * syslog.h
  * termios.h

and their dependencies for RTEMS.  The origin of these files is the
latest FreeBSD.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-05-25 12:41:33 -04:00
Sebastian Huber 0b915d6be0 FreeBSD compatibility for RTEMS <sys/cpuset.h>
Make the RTEMS <sys/cpuset.h> compatible with the latest FreeBSD
version.

Fix the CPU_COPY() parameter order, see also:

https://devel.rtems.org/ticket/3023

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-05-25 12:36:27 -04:00
Sebastian Huber 764eda728f Add __bitcount*() to RTEMS <machine/types.h>
Use a dedicated header file <machine/_bitcount.h> to avoid cyclic header
dependencies in future changes.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-05-25 12:35:38 -04:00
Sebastian Huber 2693c1db69 Move ARM access.c from machine to sys
The implementation of the POSIX access() function is nothing machine
specific like memcpy(), etc.  Move it back to the system domain.  This
avoids problems due to the include search order of the Newlib/GCC build
which picks up machine includes before system includes.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-05-25 12:34:53 -04:00
Sebastian Huber 0008601042 Increase MSIZE for RTEMS
Increase the MSIZE for RTEMS to be in line with the latest FreeBSD
version.  The legacy network stack of RTEMS will provides its own
definition.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-05-25 12:33:59 -04:00
Sebastian Huber 2efb117047 FreeBSD compatibility for RTEMS <sys/param.h>
Update the RTEMS <machine/param.h> and <sys/param.h> to be compatible
with the latest FreeBSD version.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-05-25 12:33:40 -04:00
Sebastian Huber 15b59a15b4 Add generic <machine/_align.h> for RTEMS
It uses __BIGGEST_ALIGNMENT__ which is available in recent GCC and
LLVM/clang.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-05-25 12:33:02 -04:00
Laurent ALFONSI 9b1167219a ARM/AArch64: Fix GetCmdLine semihosting directives
When simulating arm code, the target program startup code (crt0) uses
semihosting invocations to get the command line from the simulator. The
simulator returns the command line and its size into the area passed in
parameter. (ARM 32-bit specifications :
http://infocenter.arm.com/help/topic/com.arm.doc.dui0058d/DUI0058.pdf
chapter "5.4.19 SYS_GET_CMDLINE").

The memory area pointed by the semihosting register argument is located
in .text section (usually not writtable (RX)).

If we run this code on a simulator that respects this rights properties
(qemu user-mode for instance), the command line will not be written to
the .text program memory, in particular the length of the string. The
program runs with an empty command line. This problem hasn't been seen
earlier probably because qemu user-mode is not so much used, but this can
happen with another simulator that refuse to write in a read-only segment.

With this modification, the command line can be correctly passed to the
target program.

Changes:
- libgloss/arm/crt0.S : Arguments passed to the AngelSWI_Reason_GetCmdLine
  semihosting invocation are placed into .data section instead of .text
- libgloss/aarch64/crt0.S : Idem for aarch64 AngelSVC_Reason_GetCmdLine
  semihosting.
2017-05-19 15:45:58 -04:00
Corinna Vinschen 9d32147e35 cygwin CONTRIBUTORS: Add Daniel Santos
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-04-25 14:26:36 +02:00
Jon Turney fe7a7709ef Fix transposed lines in 2.8.1 release text 2017-04-24 17:17:38 +01:00
Jon Turney 2980e76ae3 Update 2.8.1 release text 2017-04-24 17:13:04 +01:00
Corinna Vinschen fccaaee026 cygwin: add 2.8.1 release file
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-04-24 17:36:54 +02:00
Corinna Vinschen 7437d656cb cygwin TEST: Add nagging debug output to pinfo
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-04-24 17:35:06 +02:00
Corinna Vinschen 5ef0399ddd cygwin: pinfo: do not wait for setting ppid on a transitional procinfo
This leads to excessive lag when stracing processes if the inferior
process checks the process table.  The reason is that ppid isn't set
in the procinfo memory of the dynamically loading strace itself.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-04-24 17:34:31 +02:00
Corinna Vinschen ffcfbf4b66 cygwin: try unprivileged symlink creation on W10 1703 and later
Add new SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE flag to
CreateSymbolicLinkW call when running on W10 1703 or later.
Don't do that on older versions to avoid ERROR_INVALID_PARAMETER.

Preliminary, needs testing.  There's an off-chance that the
flag results in the same ERROR_INVALID_PARAMETER on 1703 if the
developer settings are not enabled.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-04-24 17:17:29 +02:00