]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
5 years agonano-vfprintf_float.c: Fix check if negative for nans.
Jon Beniston [Tue, 11 Dec 2018 21:03:03 +0000 (21:03 +0000)]
nano-vfprintf_float.c: Fix check if negative for nans.

5 years agoFix powf overflow handling in non-nearest rounding mode
Szabolcs Nagy [Mon, 10 Dec 2018 14:40:01 +0000 (14:40 +0000)]
Fix powf overflow handling in non-nearest rounding mode

The threshold value at which powf overflows depends on the rounding mode
and the current check did not take this into account. So when the result
was rounded away from zero it could become infinity without setting
errno to ERANGE.

Example: pow(0x1.7ac7cp+5, 23) is 0x1.fffffep+127 + 0.1633ulp

If the result goes above 0x1.fffffep+127 + 0.5ulp then errno is set,
which is fine in nearest rounding mode, but

  powf(0x1.7ac7cp+5, 23) is inf in upward rounding mode
  powf(-0x1.7ac7cp+5, 23) is -inf in downward rounding mode

and the previous implementation did not set errno in these cases.

The fix tries to avoid affecting the common code path or calling a
function that may introduce a stack frame, so float arithmetics is used
to check the rounding mode and the threshold is selected accordingly.

5 years agosys/time.h: Remove KASSERT
Sebastian Huber [Tue, 4 Dec 2018 06:34:25 +0000 (07:34 +0100)]
sys/time.h: Remove KASSERT

The KASSERT is only used by the FreeBSD kernel.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
5 years agoEnsure that all values of ns, us and ms work
imp [Tue, 20 Nov 2018 07:11:23 +0000 (07:11 +0000)]
Ensure that all values of ns, us and ms work

for {n,u,m}stosbt

Integer overflows and wrong constants limited the accuracy of these
functions and created situatiosn where sbttoXs(Xstosbt(Y)) != Y. This
was especailly true in the ns case where we had millions of values
that were wrong.

Instead, used fixed constants because there's no way to say ceil(X)
for integer math. Document what these crazy constants are.

Also, use a shift one fewer left to avoid integer overflow causing
incorrect results, and adjust the equasion accordingly. Document this.

Allow times >= 1s to be well defined for these conversion functions
(at least the Xstosbt). There's too many users in the tree that they
work for >= 1s.

This fixes a failure on boot to program firmware on the mlx4
NIC. There was a msleep(1000) in the code. Prior to my recent rounding
changes, msleep(1000) worked, but msleep(1001) did not because the old
code rounded to just below 2^64 and the new code rounds to just above
it (overflowing, causing the msleep(1000) to really sleep 1ms).

A test program to test all cases will be committed shortly. The test
exaustively tries every value (thanks to bde for the test).

Sponsored by: Netflix, Inc
Differential Revision: https://reviews.freebsd.org/D18051

5 years agoWhen converting ns,us,ms to sbt, return the ceil()
imp [Thu, 15 Nov 2018 16:02:13 +0000 (16:02 +0000)]
When converting ns,us,ms to sbt, return the ceil()

of the result rather than the floor(). Returning the floor means that
sbttoX(Xtosbt(y)) != y for almost all values of y. In practice, this
results in a difference of at most 1 in the lsb of the sbintime_t. This
difference is meaningless for all current users of these functions, but
is important for the newly introduced sysctl conversion routines which
implicitly rely on the transformation being idempotent.

Sponsored by: Netflix, Inc

5 years agoCorrect a misplaced closing paren.
ian [Sat, 3 Mar 2018 22:28:20 +0000 (22:28 +0000)]
Correct a misplaced closing paren.

Does not affect the result, but does clarify (at least for me) that the
multiplication happens before the shift.

5 years agosys: further adoption of SPDX licensing ID tags.
pfg [Mon, 20 Nov 2017 19:43:44 +0000 (19:43 +0000)]
sys: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.

5 years agoAdd inline functions to convert between sbintime_t
ian [Sat, 29 Jul 2017 17:00:23 +0000 (17:00 +0000)]
Add inline functions to convert between sbintime_t

and decimal time units. Use them in some existing code that is
vulnerable to roundoff errors.

The existing constant SBT_1NS is a honeypot, luring unsuspecting folks into
writing code such as long_timeout_ns*SBT_1NS to generate the argument for a
sleep call.  The actual value of 1ns in sbt units is ~4.3, leading to a
large roundoff error giving a shorter sleep than expected when multiplying
by the trucated value of 4 in SBT_1NS.  (The evil honeypot aspect becomes
clear after you waste a whole day figuring out why your sleeps return early.)

5 years agoRenumber copyright clause 4
imp [Tue, 28 Feb 2017 23:42:47 +0000 (23:42 +0000)]
Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96

5 years agoCygwin: mkvers: fix a bug in sed statement
Corinna Vinschen [Sat, 1 Dec 2018 15:50:40 +0000 (16:50 +0100)]
Cygwin: mkvers: fix a bug in sed statement

While reformatting the script, backticks `` were replaced with
brackets $().  This in turn invalidated the \\( ... \\) expressions in the
sed script because backslash resolution in $() works differently from
backslash resolution in ``.  Only a single backslash is valid now.

While at it, fix up the uname(2) date representation when building a
snapshot.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: clocks: fix a hang on pre-Windows 10 machines
Corinna Vinschen [Fri, 30 Nov 2018 21:39:57 +0000 (22:39 +0100)]
Cygwin: clocks: fix a hang on pre-Windows 10 machines

when calling clocks too early in DLL init, the vtables are not correctly
set up for some reason.  Calls to init() from now() fail because the init
pointer in the vtable is NULL.

Real life example is mintty which runs into a minor problem at startup,
triggering a system_printf call.  Strace is another problem, it's called
the first time prior to any class initialization.

Workaround is to make sure that no virtual methods are called in an
early stage.  Make init() non-virtual and convert resolution() to a
virtual method instead.  Add a special non-virtual
clk_monotonic_t::strace_usecs.

While at it:

- Inline internal-only methods.

- Drop the `inited' member.  Convert period/ticks_per_sec toa union.
  Initialize period/ticks_per_sec via InterlockeExchange64.

- Fix GetTickCount64 usage.  No, it's not returning ticks but
  milliseconds since boot (unbiased).

- Fix comment indentation.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agofix version typo
Mark Geisert [Sat, 1 Dec 2018 06:14:00 +0000 (22:14 -0800)]
fix version typo

5 years agoCygwin: clocks: use either tickcount or tick period
Corinna Vinschen [Thu, 29 Nov 2018 11:56:18 +0000 (12:56 +0100)]
Cygwin: clocks: use either tickcount or tick period

Use whatever native unit the system provides for the resolution of
a timer to avoid rounding problems

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agostdio.h: Expose cuserid with __GNU_VISIBLE
Corinna Vinschen [Thu, 29 Nov 2018 10:22:42 +0000 (11:22 +0100)]
stdio.h: Expose cuserid with __GNU_VISIBLE

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: document latest changes
Corinna Vinschen [Thu, 29 Nov 2018 10:12:05 +0000 (11:12 +0100)]
Cygwin: document latest changes

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: implement extensible clock interface
Corinna Vinschen [Tue, 27 Nov 2018 12:47:02 +0000 (13:47 +0100)]
Cygwin: implement extensible clock interface

- Drop hires_[nm]s clocks, rename hires.h to clock.h.

- Implement clk_t class as an extensible clock class in new file clock.cc.

- Introduce get_clock(clock_id) returning a pointer to the clk_t instance
  for clock_id.  Provide the following methods along the lines of the former
  hires classes:

void clk_t::nsecs (struct timespec *);
ULONGLONG clk_t::nsecs ();
LONGLONG clk_t::usecs ();
LONGLONG clk_t::msecs ();
void  clk_t::resolution (struct timespec *);

- Add CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_RAW, CLOCK_MONOTONIC_COARSE
  and CLOCK_BOOTTIME clocks.

- Allow clock_nanosleep, pthread_condattr_setclock and timer_create to use
  all new clocks (both clocks should be usable with a small tweak, though).

- Bump DLL major version to 2.12.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agotime.h: Introduce Linux-specific CLOCK id values
Corinna Vinschen [Wed, 28 Nov 2018 21:49:30 +0000 (22:49 +0100)]
time.h: Introduce Linux-specific CLOCK id values

- Add CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_RAW,
  CLOCK_MONOTONIC_COARSE and CLOCK_BOOTTIME

- Guard new values with __GNU_VISIBLE

- Add CLOCK_REALTIME_COARSE as (clockid_t) 0 for simplicity
  (It allows to have all values < 8 and so be used as array
   index into an array of clocks)

- Fix macro bracketing

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: timers: clock_setres: make no-op
Corinna Vinschen [Tue, 27 Nov 2018 12:59:37 +0000 (13:59 +0100)]
Cygwin: timers: clock_setres: make no-op

clock_setres is a questionable function only existing on QNX.
Disable the function, just return success for CLOCK_REALTIME
to maintain backward compatibility.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: pthread_cond_timedwait: make sure to wait until abstime finishes
Corinna Vinschen [Wed, 28 Nov 2018 22:49:59 +0000 (23:49 +0100)]
Cygwin: pthread_cond_timedwait: make sure to wait until abstime finishes

5 years agoCygwin: timers: use spinlock to prime hires_ns thread-safe
Corinna Vinschen [Mon, 26 Nov 2018 16:47:53 +0000 (17:47 +0100)]
Cygwin: timers: use spinlock to prime hires_ns thread-safe

The current method to make hires_ns priming thread-safe isn't
thread-safe.  Rather than hoping that running the thread in
TIME_CRITICAL priority is doing the right thing, use a spinlock.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: timers: drop error handling for Windows perf timer functions
Corinna Vinschen [Mon, 26 Nov 2018 16:38:15 +0000 (17:38 +0100)]
Cygwin: timers: drop error handling for Windows perf timer functions

Per MSDN, the perf timer functions always succeed on Windows XP or
later.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: timers: Simplify hires_ms and hires_ns
Corinna Vinschen [Mon, 26 Nov 2018 16:24:35 +0000 (17:24 +0100)]
Cygwin: timers: Simplify hires_ms and hires_ns

Drop hires_base and move inited into hires_ns.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: spinlock: remove useless get_ll call
Corinna Vinschen [Mon, 26 Nov 2018 16:25:47 +0000 (17:25 +0100)]
Cygwin: spinlock: remove useless get_ll call

LARGE_INTEGER has QuadPart anyway, no reason to compute the
64 bit value from HighPart and LowPart.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoBuiltin enable return code with SYS_EXIT_EXTENDED
Matthew Malcomson [Fri, 16 Nov 2018 11:45:48 +0000 (11:45 +0000)]
Builtin enable return code with SYS_EXIT_EXTENDED

A previous commit introduced the ability to use the semi-hosting
SYS_EXIT_EXTENDED operation to libgloss, this commit adds the same
ability to the sys/arm/ backend so that building newlib only will
provide the same capabilities.

5 years agoAdd libgloss install-pdf and install-html targets.
Jim Wilson [Mon, 19 Nov 2018 23:27:05 +0000 (15:27 -0800)]
Add libgloss install-pdf and install-html targets.

The toplevel makefile used by binutils/gcc/newlib/etc has install-pdf and
install-html targets, but they fail because libgloss doesn't support them.
Tested with an arm-eabi combined tree build and install, and verifying that
the install-pdf and install-html targets now work, and that the pdf and html
doc files are now in the install tree.

libgloss/
* Makefile.in (install-html, install-pdf): New.
* doc/Makefile.in (htmldir, pdfdir): New.
(porting.ps): Delete white space on blank line.
(install-pdf, install-html): New.

5 years agoEnable return code with semi-hosting SYS_EXIT_EXTENDED
Matthew Malcomson [Fri, 16 Nov 2018 11:45:48 +0000 (11:45 +0000)]
Enable return code with semi-hosting SYS_EXIT_EXTENDED

The _exit function currently passes -1 as a "sig" to the _kill function as an
invalid signal number so that _kill can distinguish between an abort and a
standard exit.

For boards using the SYS_EXIT_EXTENDED semi-hosting operation to return a
status code, this means that the "status" paramter to _exit is ignored and the
return code is always -1.
https://developer.arm.com/docs/100863/latest/semihosting-operations/sys_exit_extended-0x20

This patch puts shared code between _kill and _exit into a new function
_kill_shared that takes the semi-hosting "reason" to use (if semi-hosting is
available) as an argument.

For semi-hosting _kill_shared provides that "reason".

Without the "sig" argument being used to distinguish between a normal and
abnormal exit, the _exit function can provide the return code to be used if the
SYS_EXIT_EXTENDED operation is available.

Hence the exit code can be returned.

5 years agoFix issue with dst bias in memset
Wilco Dijkstra [Thu, 8 Nov 2018 15:50:42 +0000 (15:50 +0000)]
Fix issue with dst bias in memset

This patch fixes an issue in the previous memset loop change. If the
zva size is >= 256 and there are more than 64 bytes left in the
tail, we could enter the loop and thus need to rebias dst by 32 as
well.

Since no known CPUs use this size this can't be tested natively, so I've
tested it on a simulator initialized with a large zva size.

--

5 years agoCygwin: Bump DLL version to 2.11.3
Corinna Vinschen [Thu, 8 Nov 2018 14:31:25 +0000 (15:31 +0100)]
Cygwin: Bump DLL version to 2.11.3

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoFix v850 target for RTEMS cygwin-2_11_2-release
Sebastian Huber [Wed, 7 Nov 2018 13:59:19 +0000 (14:59 +0100)]
Fix v850 target for RTEMS

Do not define __ATTRIBUTE_IMPURE_PTR__ for RTMES on the v850 target.
The previous definition lead to the following linker error in
combination with -fdata-sections:

relocation truncated to fit: R_V810_GPWLO_1 against symbol
`_global_impure_ptr' defined in .rodata._global_impure_ptr section in
libc.a(lib_a-impure.o)

relocation truncated to fit: R_V810_GPWLO_1 against symbol `_impure_ptr'
defined in .data._impure_ptr section in libc.a(lib_a-impure.o)

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
5 years agoRTEMS: Avoid <machine/param.h> in <sys/_cpuset.h>
Sebastian Huber [Thu, 8 Nov 2018 08:33:13 +0000 (09:33 +0100)]
RTEMS: Avoid <machine/param.h> in <sys/_cpuset.h>

The <machine/param.h> header file exposes some unrelated stuff not
covered by C or POSIX.  Avoid its use in <sys/_cpuset.h> since it is
included in <rtems.h>.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
5 years agoAdjust writeback in non-zero memset
Wilco Dijkstra [Tue, 6 Nov 2018 14:42:10 +0000 (14:42 +0000)]
Adjust writeback in non-zero memset

This fixes an ineffiency in the non-zero memset.  Delaying the writeback
until the end of the loop is slightly faster on some cores - this shows
~5% performance gain on Cortex-A53 when doing large non-zero memsets.

Tested against the GLIBC testsuite.

5 years agoCygwin: honor SOCK_NONBLOCK/SOCK_CLOEXEC in socket(2)/socketpair(2)
Corinna Vinschen [Mon, 5 Nov 2018 20:02:22 +0000 (21:02 +0100)]
Cygwin: honor SOCK_NONBLOCK/SOCK_CLOEXEC in socket(2)/socketpair(2)

fhandler_socket_wsock::set_socket_handle calls set_flags after
setting the O_NONBLOCK/O_CLOEXEC flags, thus overwriting them.

It also turns out that fhandler_socket_wsock::init_events is called
too late.  The inheritence flags are changed before creating the
socket event handling objects.  Thus, inheritence flags for
those objects are wrong with SOCK_CLOEXEC.

Fix this by reordering the calls and setting the file flags through
fhandler_base::set_flags.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agonewlib/configure.host: Set have_init_fini to no for OpenRISC
Stafford Horne [Fri, 2 Nov 2018 22:00:02 +0000 (07:00 +0900)]
newlib/configure.host: Set have_init_fini to no for OpenRISC

The new GCC port for OpenRISC will use the init_fini_array only and not
provide the init() and fini() functions.  Disable the function usage by
default as its no longer needed.

Signed-off-by: Stafford Horne <shorne@gmail.com>
5 years agoInitialize SVE system registers.
Tamar Christina [Fri, 26 Oct 2018 09:18:17 +0000 (10:18 +0100)]
Initialize SVE system registers.

This patch initializes the SVE system registers if available
and initializes the vector length to the maximum supported.

This is done according to the SVE specification [1].

[1] https://developer.arm.com/docs/ddi0584/latest/arm-architecture-reference-manual-supplement-the-scalable-vector-extension-sve-for-armv8-a

5 years agoCygwin: fix memory corruption/SEGV if certain socket functions fail
Corinna Vinschen [Mon, 29 Oct 2018 15:12:54 +0000 (16:12 +0100)]
Cygwin: fix memory corruption/SEGV if certain socket functions fail

Regression introduced with 2.11.0:

The failure paths in socket, socketpair and accept4 functions and
methods accidentally release *unused* cygheap_fdmanip objects.  The
subsequently called dtable::release method was designed to be called for
*used* cygheap_fdmanip objects only.  Using them on unused objects leads
to NULL pointer member dereferencing.

Worse, the inet/local accept4 methods only release the cygheap_fdmanip
object but neglect to delete the just created fhandler_socket_* object.

Fix this by removing the erroneous release calls in the aforementioned
failure paths and delete the fhandler_socket_* object in accept4 instead.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: Fix cygheap corruption caused by cloned atomic buffer
David McFarland [Sun, 28 Oct 2018 19:22:44 +0000 (16:22 -0300)]
Cygwin: Fix cygheap corruption caused by cloned atomic buffer

The fhandler_base_overlapped::copyto clears atomic_write_buf on the
clone, but none of the derived classes were doing this.  This allowed
the destructor to double-free the buffer and corrupt cygheap.
Clear atomic_write_buf in copyto of all derived classes.

5 years agoFix posix_memalign() attributes
Sebastian Huber [Mon, 22 Oct 2018 09:23:15 +0000 (11:23 +0200)]
Fix posix_memalign() attributes

The malloc, alloc_size and alloc_aligned attributes must be only used in
case the function returns the pointer to the allocated memory.

See also:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87683

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
5 years agoRTEMS: Use function and data sections
Sebastian Huber [Mon, 8 Oct 2018 12:29:08 +0000 (14:29 +0200)]
RTEMS: Use function and data sections

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
5 years agonewlib/libc/sys/rtems/include/machine/param.h: Add _KERNEL to stop method leakage
Joel Sherrill [Thu, 18 Oct 2018 22:19:50 +0000 (17:19 -0500)]
newlib/libc/sys/rtems/include/machine/param.h: Add _KERNEL to stop method leakage

The following FreeBSD kernel methods are not in any standard and
prototypes/definitions were leaking into application space:

  + round_page()
  + trunc_page()
  + atop()
  + ptoa()
  + pgtok()

5 years agoImprove performance of strstr
Wilco Dijkstra [Thu, 18 Oct 2018 17:29:36 +0000 (17:29 +0000)]
Improve performance of strstr

v3: Add support for read ahead using strnlen, giving an additional 25% speedup
on large inputs (both short and long needles).

This patch significantly improves performance of strstr by using Sunday's
Quick-Search algorithm.  Due to its simplicity it has the best average
performance of string matching algorithms on almost all inputs.  It uses a
bad-character shift table to skip past mismatches.

The needle length is limited to 254 - this reduces the shift table memory
4 to 8 times, lowering preprocessing overhead and minimizing cache effects.
The limit also implies its worst-case performance is linear.

Larger needles are processed by the Two-Way algorithm.  The macro AVAILABLE
has been improved to use strnlen to read the input in chunks.  This results
in a 2.5 times speedup for large needles, reducing the performance drop when
the Quick-Search algorithm can't be used.

The code for 1-4 byte needles has been simplified and now uses unsigned
char.  Since the optimized code relies on 8-bit chars, we defer to the
size-optimized implementation if CHAR_BIT > 8.

The performance gain of finding a set of randomly chosen words of size 8 in
256 bytes of English text is 14 times on AArch64. For longer haystacks the
gain is well over 20 times.

The size-optimized strstr has also been rewritten from scratch to improve
performance.  On the same test the performance gain is 69%.

Tested against GLIBC testsuite, randomized tests and the GNULIB strstr test
(https://git.savannah.gnu.org/cgit/gnulib.git/tree/tests/test-strstr.c).

--

5 years agonewlib/libc/ctype/jp2uc.c: Declare "cs" variable as "const char *"
Christophe Lyon [Fri, 5 Oct 2018 09:11:05 +0000 (09:11 +0000)]
newlib/libc/ctype/jp2uc.c: Declare "cs" variable as "const char *"

Instead of "char *" to avoid compiler warnings.
This is OK because "cs" is only used as input of strcmp.

5 years agoAdd generic implementation of fdopendir()
Sebastian Huber [Mon, 8 Oct 2018 11:52:14 +0000 (13:52 +0200)]
Add generic implementation of fdopendir()

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
5 years agoAdd generic implementation of dirfd()
Sebastian Huber [Mon, 8 Oct 2018 11:33:08 +0000 (13:33 +0200)]
Add generic implementation of dirfd()

Use existing HAVE_OPENDIR define to determine if a generic
implementation should be provided.  Cygwin for example has its own
implementation of opendir() and dirfd().

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
5 years agoRTEMS: Add struct dirent::d_type member
Sebastian Huber [Mon, 8 Oct 2018 11:10:16 +0000 (13:10 +0200)]
RTEMS: Add struct dirent::d_type member

This is used by the file system support of libstdc++ for example.  Use
content from latest FreeBSD <sys/dirent.h>

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
5 years agoMove common <sys/dirent.h> content to <dirent.h>
Sebastian Huber [Mon, 8 Oct 2018 08:49:26 +0000 (10:49 +0200)]
Move common <sys/dirent.h> content to <dirent.h>

Move common content of the various <sys/dirent.h> and the latest FreeBSD
<dirent.h> to <dirent.h>.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
5 years agoOpen a directory with the usual flags
Sebastian Huber [Mon, 8 Oct 2018 06:56:09 +0000 (08:56 +0200)]
Open a directory with the usual flags

Use O_RDONLY since you are not supposed to write to a directory.

Use O_DIRECTORY as mandated by POSIX (The Open Group Base Specifications
Issue 7, 2018 edition IEEE Std 1003.1-2017):

"If the type DIR is implemented using a file descriptor, the descriptor
shall be obtained as if the O_DIRECTORY flag was passed to open()."

Use O_CLOEXEC as mandated by POSIX:

"When a file descriptor is used to implement the directory stream, it
behaves as if the FD_CLOEXEC had been set for the file descriptor."

Drop the fcntl() call in favour of O_CLOEXEC.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
5 years agoMake some standard open() flags visible
Sebastian Huber [Mon, 8 Oct 2018 12:27:38 +0000 (14:27 +0200)]
Make some standard open() flags visible

Make the POSIX O_CLOEXEC, O_NOFOLLOW, O_DIRECTORY, O_EXEC, and O_SEARCH
open() flags available also to non-Cygwin systems.

Make the BSD/glibc O_DIRECT open() flag  available also to non-Cygwin
systems.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
5 years agonewlib: Build internal strtold code only if HAVE_LONG_DOUBLE defined
Corinna Vinschen [Wed, 10 Oct 2018 16:01:22 +0000 (18:01 +0200)]
newlib: Build internal strtold code only if HAVE_LONG_DOUBLE defined

Commit fbace81684f8cbb80a2048c01dc545af247f5cb7
("Import correctly working strtold from David M. Gay.")
introduced two new files, strtorx.c and strtodg.c.  The functions
are only called from strtold.c.  However, while strtold.c is only
built if HAVE_LONG_DOUBLE is defined, the patch erroneously added
the two new files to GENERAL_SOURCES unconditionally.

Fix this by building both files only if HAVE_LONG_DOUBLE has been
defined.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agonewlib: strtold: use __builtin_nanl to avoid libm dependency
Corinna Vinschen [Wed, 10 Oct 2018 15:53:55 +0000 (17:53 +0200)]
newlib: strtold: use __builtin_nanl to avoid libm dependency

Commit 6c212a8b7873703c4f98c6b68579b234918be83a
("Fix strtod ("nan") and strtold ("nan") returns wrong negative NaN")
introduced an unconditional dependency to nanl and, in turn, to libm.

Rather than including nanl in libc as well, just call __builtin_nanl
from here.  Requires GCC 3.3 or later.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoImplement nanl in newlib only
Corinna Vinschen [Wed, 10 Oct 2018 15:49:53 +0000 (17:49 +0200)]
Implement nanl in newlib only

Drop Cygwin-specific nanl in favor of a generic implementation
in newlib.  Requires GCC 3.3 or later.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: lseek: return ESPIPE rather than EINVAL when called on a fifo
Corinna Vinschen [Wed, 10 Oct 2018 11:20:04 +0000 (13:20 +0200)]
Cygwin: lseek: return ESPIPE rather than EINVAL when called on a fifo

Thanks to Henri for tracking this down:
https://cygwin.com/ml/cygwin/2018-10/msg00062.html

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agonewlib: Drop incorrect const qualifier from __loadlocale parameter
Corinna Vinschen [Wed, 10 Oct 2018 09:18:02 +0000 (11:18 +0200)]
newlib: Drop incorrect const qualifier from __loadlocale parameter

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoAdd attributes to malloc-like functions
Sebastian Huber [Fri, 28 Sep 2018 09:12:48 +0000 (11:12 +0200)]
Add attributes to malloc-like functions

These attributes help static analysis tools to produce less false
positives, e.g. double free warnings.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
5 years ago[Aarch64] Syscalls: fix prototypes
Christophe Lyon [Mon, 1 Oct 2018 19:10:10 +0000 (19:10 +0000)]
[Aarch64] Syscalls: fix prototypes

This patch is similar the arm one committed recently.

2018-10-08  Christophe Lyon  <christophe.lyon@linaro.org>

* libgloss/aarch64/syscalls.c (_sbrk): Fix prototype.
(_getpid, _write, _swiwrite, _lseek, _swilseek, _read, _wriread):
Likewise.

5 years ago[ARM] Make _kill() a noreturn function.
Christophe Lyon [Mon, 1 Oct 2018 15:52:42 +0000 (15:52 +0000)]
[ARM] Make _kill() a noreturn function.

AngelSWI_Reason_ReportException does not return accoring to the ARM
documentation, so it is valid to mark _kill() as noreturn.  This way,
the compiler does not warn about _exit() returning a value despite
being noreturn.

2018-10-01  Christophe Lyon  <christophe.lyon@linaro.org>

* libgloss/arm/_exit.c (_exit): Declare _kill() as noreturn.
* libgloss/arm/_exit.c (_kill): Likewise. Remove the return
statements.
* newlib/libc/sys/arm/syscalls.c (_kill): Likewise..

5 years agoDefine _COMPILING_NEWLIB on aarch64 to define function prototypes from unistd.h.
Christophe Lyon [Mon, 1 Oct 2018 21:16:40 +0000 (21:16 +0000)]
Define _COMPILING_NEWLIB on aarch64 to define function prototypes from unistd.h.

    2018-10-01  Christophe Lyon  <christophe.lyon@linaro.org>

     * newlib/configure.host: Define _COMPILING_NEWLIB for aarch64.

5 years ago [Aarch64] Fix warning in _sbrk
Christophe Lyon [Mon, 1 Oct 2018 19:08:40 +0000 (19:08 +0000)]
[Aarch64] Fix warning in _sbrk

    2018-10-01  Christophe Lyon  <christophe.lyon@linaro.org>

     * libgloss/aarch64/syscalls.c (_sbrk): Cast "__heap_limit" to
     "char *".

5 years ago [ARM] Cast string pointers to int to avoid compiler warnings.
Christophe Lyon [Mon, 1 Oct 2018 17:22:43 +0000 (17:22 +0000)]
[ARM] Cast string pointers to int to avoid compiler warnings.

    2018-10-01  Christophe Lyon  <christophe.lyon@linaro.org>

     * newlib/libc/sys/arm/syscalls.c (_unlink): Cast 'path' to int.
     (_system): Cast 's' to int.
     (_rename): Cast 'newpath' and 'oldpath' to int.

5 years agoUpdate Arm copyright notices in new math files
Wilco Dijkstra [Thu, 27 Sep 2018 17:03:32 +0000 (17:03 +0000)]
Update Arm copyright notices in new math files

While working on the strstr patch I noticed several copyright headers
of the new math functions are missing closing quotes after ``AS IS.
I've added these.  Also update spellings of Arm Ltd in a few places
(but still use ARM LTD in upper case portion).  Finally add SPDX
identifiers to make everything consistent.

5 years agoUpdate Arm entry in COPYING.NEWLIB.
Jeff Johnston [Tue, 25 Sep 2018 19:10:46 +0000 (15:10 -0400)]
Update Arm entry in COPYING.NEWLIB.

- per Wilco Dijkstra's patch
- update Arm copyright notice to not exclude AArch64 and the various generic
  contributions made (like the new math functions).  Also update the date and
  change spelling to Arm Ltd.

5 years agoFix the documentation comment of checkint
Szabolcs Nagy [Tue, 18 Sep 2018 13:14:53 +0000 (14:14 +0100)]
Fix the documentation comment of checkint

checkint in pow is not supposed to be used with 0, inf or nan inputs.

5 years agoCommitted, CRIS port: fix fallout from time_t defaulting to 64 bits, part 2
Hans-Peter Nilsson [Thu, 13 Sep 2018 15:48:48 +0000 (17:48 +0200)]
Committed, CRIS port: fix fallout from time_t defaulting to 64 bits, part 2

It's been a while...  I see the CRIS port broke with the
time_t-default-to-64-bit change, observable by a few test-cases in the gcc
fortran(!) tests failing, regressing when trying a recent newlib.

This is a two-part belt-and-suspenders change: adjust the CRIS port
gettimeofday syscall (the only one in newlib/CRIS passing a time_t or
struct timeval) to handle a userspace 64-bit time_t and secondly default
time_t to 32-bit long anyway.  I considered making the local
"kernel_timeval" copy in _gettimeofday conditional on (userspace) time_t
being 64 bits, but thought it not worth bothering with the few move insns.
The effect of a 64-bit time_t is however observable as longer simulation
time when running the gcc testsuite and as bigger binaries without any
actual upside from the larger time_t size, so I thought better make the
default for this port go back to being a "long" again.

Tested by running the gcc testsuite over the three combinations of two
parts of the patch and observing the expected changes.  Committed.

newlib:
* configure.host (cris, crisv32): Default to "long" time_t.

Signed-off-by: Hans-Peter Nilsson <hp@axis.com>
5 years agoCommitted, CRIS port: fix fallout from time_t defaulting to 64 bits, part 1
Hans-Peter Nilsson [Thu, 13 Sep 2018 15:45:39 +0000 (17:45 +0200)]
Committed, CRIS port: fix fallout from time_t defaulting to 64 bits, part 1

It's been a while...  I see the CRIS port broke with the
time_t-default-to-64-bit change, observable by a few test-cases in the
gcc fortran(!) tests failing, regressing when trying a recent newlib.

This is a two-part belt-and-suspenders change: adjust the CRIS port
gettimeofday syscall (the only one in newlib/CRIS passing a time_t or
struct timeval) to handle a userspace 64-bit time_t and secondly default
time_t to 32-bit long anyway.  I considered making the local
"kernel_timeval" copy in _gettimeofday conditional on (userspace) time_t
being 64 bits, but thought it not worth bothering with the few move insns.
The effect of a 64-bit time_t is however observable as longer simulation
time when running the gcc testsuite and as bigger binaries without any
actual upside from the larger time_t size, so I thought better make the
default for this port go back to being a "long" again.

Tested by running the gcc testsuite over the three combinations of two
parts of the patch and observing the expected changes.  Committed.

libgloss:
Adjust for syscall and userspace having different time_t or timeval.
* cris/linunistd.h (kernel_time_t, kernel_suseconds_t, kernel_timeval):
New types.
(gettimeofday): Change the type of the first argument to be a
pointer to a struct kernel_timeval.
* cris/gensyscalls (_gettimeofday): Use an intermediate struct
kernel_timeval for the syscall and initialize the result from
that.

Signed-off-by: Hans-Peter Nilsson <hp@axis.com>
5 years agoCygwin: console: make sure EnumFontFamiliesExW loop isn't infinite
Corinna Vinschen [Fri, 7 Sep 2018 11:49:54 +0000 (13:49 +0200)]
Cygwin: console: make sure EnumFontFamiliesExW loop isn't infinite

The current loop condition is borderline.  Make sure it ends and
choose a replacement char in the unlikely case the current console
font isn't recognized at all.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: console: store replacement char directly
Corinna Vinschen [Fri, 7 Sep 2018 11:48:35 +0000 (13:48 +0200)]
Cygwin: console: store replacement char directly

Rather than relying on an index variable, store the current
replacement char and use that directly in WriteConsoleW.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: console: don't hang in check_font with raster fonts
Corinna Vinschen [Fri, 7 Sep 2018 11:43:48 +0000 (13:43 +0200)]
Cygwin: console: don't hang in check_font with raster fonts

EnumFontFamiliesExW fails if the font is "Terminal" (aka "Raster Fonts")
and lfCharSet requests ANSI_CHARSET.  Using DEFAULT_CHARSET fixes this.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agosearch: Fix Berkeley DB hash code for 16-bit targets.
Jon Beniston [Thu, 6 Sep 2018 12:53:15 +0000 (13:53 +0100)]
search: Fix Berkeley DB hash code for 16-bit targets.

hash.h: Use 32-bit type for data stored on disk, so code
works for 16 and 64-bit targets. Reduce maximum bucket size on 16-bit
targets, so it fits in available memory.
hash.c: Check bucket size isn't too big for target.
hash_buf.c: Fix overflow warning on 16-bit targets.

5 years agoUse !__HAVE_LOCALE_INFO__ define to use _ctype_ directly [v2]
Keith Packard [Thu, 6 Sep 2018 04:39:40 +0000 (21:39 -0700)]
Use !__HAVE_LOCALE_INFO__ define to use _ctype_ directly [v2]

When __HAVE_LOCALE_INFO__ is not selected, directly access the
existing _ctype_ variable from __locale_ctype_ptr() and
__locale_ctype_ptr_l(), eliminating the need for any locale or reent
structure

Signed-off-by: Keith Packard <keithp@keithp.com>
v2:
locale: fix conflict with __locale_ctype_ptr macro

If we are building without __HAVE_LOCALE_INFO__, there is a
macro providing __locale_ctype_ptr which in turn fouls up this
declaration.

Signed-off-by: Michael Lyle <mlyle@lyle.org>
5 years agostdlib: Use __get_numeric_locale instead of __localeconv_l for decimal_point
Keith Packard [Thu, 6 Sep 2018 04:25:01 +0000 (21:25 -0700)]
stdlib: Use __get_numeric_locale instead of __localeconv_l for decimal_point

The string/float conversion functions need to get the locale decimal
point. Instead of calling __localeconv_l (which copies locale data
into lconv form from __get_numeric_locale), use __get_numeric_locale
directly.

Signed-off-by: Keith Packard <keithp@keithp.com>
5 years agoInclude sys/syslimits.h in limits.h
Keith Packard [Thu, 6 Sep 2018 04:23:46 +0000 (21:23 -0700)]
Include sys/syslimits.h in limits.h

This makes sure any system-defined limits are specified before the
defaults are checked. Without this, ARG_MAX and PATH_MAX end up
getting the default definitions from limits.h rather than the defines
from syslimits.h. This could potentially cause problems when
different files used different values for the same name.

Signed-off-by: Keith Packard <keithp@keithp.com>
5 years agoxdr_private.h needs sys/types.h for u_char
Keith Packard [Thu, 6 Sep 2018 04:21:16 +0000 (21:21 -0700)]
xdr_private.h needs sys/types.h for u_char

u_char is defined in sys/types.h, which doesn't appear to get
included, at least in my environments.

Signed-off-by: Keith Packard <keithp@keithp.com>
5 years agoDocument the log table generation method
Szabolcs Nagy [Wed, 5 Sep 2018 11:15:55 +0000 (12:15 +0100)]
Document the log table generation method

Add comments with enough detail so the log lookup tables can be recreated.

5 years agostdlib/arc4random.c: Fix reseed count for 16-bit targets.
Jon Beniston [Wed, 5 Sep 2018 09:57:33 +0000 (10:57 +0100)]
stdlib/arc4random.c: Fix reseed count for 16-bit targets.

5 years agoCygwin: console: device context is process private
Corinna Vinschen [Thu, 6 Sep 2018 11:05:55 +0000 (13:05 +0200)]
Cygwin: console: device context is process private

Make sure device context is not copied to forked process.
It is a process-specific datastructure.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: console: improve replacement char algorithm
Corinna Vinschen [Wed, 5 Sep 2018 21:39:25 +0000 (23:39 +0200)]
Cygwin: console: improve replacement char algorithm

Try various Unicode characters which may be used as a replacement
character in case an invalid character has to be printed.

Current list is 0xfffd "REPLACEMENT CHARACTER", 0x25a1 "WHITE SQUARE",
and 0x2592 "MEDIUM SHADE" in that order.

Additionally workaround a problem with some fonts (namely DejaVu
Sans Mono) which are returned wit ha broken fontname with trailing
stray characters.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: console: use UNICODE API throughout
Corinna Vinschen [Wed, 5 Sep 2018 11:08:33 +0000 (13:08 +0200)]
Cygwin: console: use UNICODE API throughout

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: Bump DLL version to 2.11.2
Corinna Vinschen [Wed, 5 Sep 2018 11:02:09 +0000 (13:02 +0200)]
Cygwin: Bump DLL version to 2.11.2

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoImprove strstr performance of short needles
Wilco Dijkstra [Tue, 4 Sep 2018 17:54:21 +0000 (17:54 +0000)]
Improve strstr performance of short needles

Improve strstr performance for the common case of short needles.  For a single
character strchr is best, for 2-4 characters a small loop is fastest.  For these
the speedup over the Two-Way algorithm is ~10 times on large strings.

Newlib builds, the new code passes GLIBC testsuite. OK for commit?

5 years agomath_config.h: Fix signed overflow warning for 16-bit targets cygwin-2_11_1-release
Jon Beniston [Fri, 31 Aug 2018 22:10:00 +0000 (23:10 +0100)]
math_config.h: Fix signed overflow warning for 16-bit targets

5 years agoe_scalb.c: Call scalbln instead of scalbn on 16-bit targets to ensure constant fits...
Jon Beniston [Fri, 31 Aug 2018 21:42:29 +0000 (22:42 +0100)]
e_scalb.c: Call scalbln instead of scalbn on 16-bit targets to ensure constant fits in an int.

5 years agoAvoid ARM SWI Seek when querying file position
Andy Koppe [Fri, 31 Aug 2018 11:26:02 +0000 (12:26 +0100)]
Avoid ARM SWI Seek when querying file position

Issuing an ARM semi-hosting Seek command when just querying file
position with SEEK_CUR and offset zero is unnecessary, because unlike
the lseek() Unix system call the Seek command does not actually return
the file position. For that reason, syscalls.c for ARM keeps track of
file position in the 'poslog', so we can just return that.

Moreover, since the Seek command only accepts an absolute file position,
SEEK_CUR operations are implemented by adding the relative offset to the
position in the poslog. If the host implements non-binary files with
implicit carriage return characters but doesn't discount those implicit
CRs when implementing Seek (by just mapping straight to Windows file
operations), this actually ended up wrongly changing file position when
using SEEK_CUR with offset zero or functions like ftell() or fgetpos()
that are based on that.

Also, use off_t rather than int for the poslog.

5 years agoCygwin: console: Print Unicode REPLACEMENT CHARACTER for invalid input chars
Corinna Vinschen [Sat, 1 Sep 2018 19:34:34 +0000 (21:34 +0200)]
Cygwin: console: Print Unicode REPLACEMENT CHARACTER for invalid input chars

So far we printed a half filled square (0x2592) if the input char is
invalid, but using REPLACEMENT CHARACTER (0xfffd) is apparently the way
to go.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: fix Win32 path ".." backtracking
Corinna Vinschen [Sat, 1 Sep 2018 19:01:08 +0000 (21:01 +0200)]
Cygwin: fix Win32 path ".." backtracking

Commit 35998fc2fa6cbb7d761f6d88346246bd3627552b fixed the buffer underun
in win32 path normalization, but introduced a new bug: A wrong
assumption led to the inability to backtrack the path outside of the
current working directory in case of relative paths.

This patch fixes this problem, together with a minor problem if the CWD
is on a network share: The result erroneously started with tripple
backslash if the src path starts with a single backslash.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoAdd --disable-newlib-fno-builtin to allow compilation without -fno-builtin for smalle... newlib-snapshot-20180831
Jon Beniston [Fri, 31 Aug 2018 16:44:33 +0000 (17:44 +0100)]
Add --disable-newlib-fno-builtin to allow compilation without -fno-builtin for smaller and faster code.

5 years agoCygwin: Bump DLL version to 2.11.1
Corinna Vinschen [Fri, 31 Aug 2018 11:01:23 +0000 (13:01 +0200)]
Cygwin: Bump DLL version to 2.11.1

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoDrop non-reserved parameter names from sys/signal.h cygwin-2_11_0-release
Andy Koppe [Wed, 29 Aug 2018 14:37:13 +0000 (15:37 +0100)]
Drop non-reserved parameter names from sys/signal.h

Standard headers shouldn't use non-reserved identifiers as parameter
names in function declarations, because programs could in theory
define macros with such names before including a header.

5 years agoUse __inhibit_loop_to_libcall in all memset/memcpy implementations
Keith Packard [Mon, 27 Aug 2018 18:32:31 +0000 (11:32 -0700)]
Use __inhibit_loop_to_libcall in all memset/memcpy implementations

This macro selects a compiler option that disables recognition of
common memset/memcpy patterns and converting those to direct
memset/memcpy calls.

Signed-off-by: Keith Packard <keithp@keithp.com>
5 years agoRemove unused variable 'one' from sf_cos.c
Keith Packard [Mon, 27 Aug 2018 18:32:29 +0000 (11:32 -0700)]
Remove unused variable 'one' from sf_cos.c

Defined, never mentioned.

Signed-off-by: Keith Packard <keithp@keithp.com>
5 years agoUse nanf("") instead of nanf(NULL)
Keith Packard [Mon, 27 Aug 2018 18:32:28 +0000 (11:32 -0700)]
Use nanf("") instead of nanf(NULL)

Newer GCC versions require a non-NULL argument to this function for
some reason.

Signed-off-by: Keith Packard <keithp@keithp.com>
5 years agoRISC-V: Fix _sbrk, it's failed only when return value is -1.
Denis Ivanov [Fri, 6 Jul 2018 16:03:23 +0000 (19:03 +0300)]
RISC-V: Fix _sbrk, it's failed only when return value is -1.

Signed-off-by: Kito Cheng <kito.cheng@gmail.com>
5 years agoRISC-V: Fixed return code in _times syscall.
Denis Ivanov [Fri, 6 Jul 2018 09:03:15 +0000 (12:03 +0300)]
RISC-V: Fixed return code in _times syscall.

Upon successful completion, times() shall return the elapsed real time,
in clock ticks, since an arbitrary point in the past (for example,
system start-up time).

Signed-off-by: Kito Cheng <kito.cheng@gmail.com>
5 years agoCygwin: Accommodate logon sessions on Windows 10
Corinna Vinschen [Tue, 28 Aug 2018 09:26:52 +0000 (11:26 +0200)]
Cygwin: Accommodate logon sessions on Windows 10

Starting with Windows 10, LookupAccountSid/Name return valid
info for the login session with new SID_NAME_USE value
SidTypeLogonSession.  To return the same info as on pre-Windows 10,
we have to handle this type.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: drop workaround for missing USER_INFO_24 definition
Corinna Vinschen [Tue, 28 Aug 2018 09:24:59 +0000 (11:24 +0200)]
Cygwin: drop workaround for missing USER_INFO_24 definition

Recent mingw64 provide USER_INFO_24

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: add release note for previous ACL changes
Corinna Vinschen [Mon, 27 Aug 2018 16:30:59 +0000 (18:30 +0200)]
Cygwin: add release note for previous ACL changes

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: Add name->SID conversion for self-constructed names
Corinna Vinschen [Mon, 27 Aug 2018 16:28:33 +0000 (18:28 +0200)]
Cygwin: Add name->SID conversion for self-constructed names

...as far as it makes sense.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: don't return valid acl entry type for unknown SID
Corinna Vinschen [Mon, 27 Aug 2018 11:30:55 +0000 (13:30 +0200)]
Cygwin: don't return valid acl entry type for unknown SID

cygpsid::get_id neglects to set the type to 0 (ACL_UNDEFINED_TAG
in POSIX speak) if the SID can not be translated into a valid
uid or gid.  This in turn leads to incorrect handling of uid/gid -1
entries.

Fix this by setting type to 0 if the id is unknown.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: Remove union wait
Corinna Vinschen [Fri, 24 Aug 2018 18:57:47 +0000 (20:57 +0200)]
Cygwin: Remove union wait

This patch follows glibc.  Original commit message:

Author: Florian Weimer <fweimer@redhat.com>
Date:   Thu, 14 Apr 2016 06:54:57 +0000

Remove union wait [BZ #19613]

The overloading approach in the W* macros was incompatible with
integer expressions of a type different from int.  Applications
using union wait and these macros will have to migrate to the
POSIX-specified int status type.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoRTEMS: Add kvaddr_t and ksize_t
Sebastian Huber [Thu, 23 Aug 2018 09:50:46 +0000 (11:50 +0200)]
RTEMS: Add kvaddr_t and ksize_t

These types were introduced by FreeBSD commit:

"Make struct xinpcb and friends word-size independent.

Replace size_t members with ksize_t (uint64_t) and pointer members
(never used as pointers in userspace, but instead as unique
idenitifiers) with kvaddr_t (uint64_t). This makes the structs
identical between 32-bit and 64-bit ABIs.

On 64-bit bit systems, the ABI is maintained. On 32-bit systems,
this is an ABI breaking change. The ABI of most of these structs
was previously broken in r315662.  This also imposes a small API
change on userspace consumers who must handle kernel pointers
becoming virtual addresses.

PR: 228301 (exp-run by antoine)
Reviewed by: jtl, kib, rwatson (various versions)
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15386"

In RTEMS, there is no user/kernel space separation.  So, use the types
size_t and uintptr_t.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
5 years agoRTEMS: Introduce <machine/_kernel_mman.h>
Sebastian Huber [Fri, 10 Aug 2018 05:45:23 +0000 (07:45 +0200)]
RTEMS: Introduce <machine/_kernel_mman.h>

This helps to avoid Newlib updates due to FreeBSD kernel space changes.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
5 years agoRTEMS: Introduce <machine/_kernel_socket.h>
Sebastian Huber [Thu, 9 Aug 2018 05:04:00 +0000 (07:04 +0200)]
RTEMS: Introduce <machine/_kernel_socket.h>

This helps to avoid Newlib updates due to FreeBSD kernel space changes.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
This page took 0.076503 seconds and 5 git commands to generate.