summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Cygwin: cygthread: set thread name before calling thread funcCorinna Vinschen2019-01-232-2/+4
| | | | | | | | | When reusing a cygthread, the stub method fails to set the thread name to the new name. The name is only set when actually creating the thread. Fix that by moving the SetThreadName call right in front of the thread function call. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Use nanf() instead of nan() in single-precision float libm math functionsJozef Lawrynowicz2019-01-234-4/+4
| | | | | This patch reduces code size for a few single-precision float math functions, by using nanf() instead of nan() where required.
* Use HUGE_VALF instead of HUGE_VAL in single-precision float libm math functionsJozef Lawrynowicz2019-01-2316-18/+18
| | | | | This patch replaces instances of "(float).*HUGE_VAL" with a direct usage of HUGE_VALF, which is also defined in math.h.
* Remove HUGE_VAL definition from libm math functionsJozef Lawrynowicz2019-01-2331-186/+0
| | | | | | This patch removes the definitions of HUGE_VAL from some of the float math functions. HUGE_VAL is defined in newlib/libc/include/math.h, so it is not necessary to have a further definition in the math functions.
* Remove matherr, and SVID and X/Open math library configurationsJozef Lawrynowicz2019-01-2390-2350/+433
| | | | Default math library configuration is now IEEE
* Cygwin: posix timers: fix overrun count always being 1 too bigCorinna Vinschen2019-01-222-37/+21
| | | | | | | | | | Combine with a bit of cleanup: - Drop overrun_event_running in favor of overrun_count being -1. - Fix include guard in posix_timer.h. - Drop ununsed function timespec_to_us. - Don't use Interlocked functions without need. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: posix timers: fix error handling in public APICorinna Vinschen2019-01-221-6/+15
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: posix timers: allocate timer_tracker on system heap.Corinna Vinschen2019-01-223-5/+5
| | | | | | | | | Allocating on the cygheap would copy information of the tracker into the child process. A forked child knows the timer id and could simply still access the (free'd but still valid) timer_tracker on the heap, which is dangerous and very certainly doesn't reflect POSIX semantics. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: Add support for CLOCK_REALTIME_ALARM/CLOCK_BOOTTIME_ALARMCorinna Vinschen2019-01-223-8/+9
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: posix timers: Add support for CLOCK_REALTIME_ALARM/CLOCK_BOOTTIME_ALARMCorinna Vinschen2019-01-221-7/+6
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: clocks: Add CLOCK_REALTIME_ALARM/CLOCK_BOOTTIME_ALARM clocksCorinna Vinschen2019-01-222-1/+5
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* time.h: Add CLOCK_REALTIME_ALARM/CLOCK_BOOTTIME_ALARMCorinna Vinschen2019-01-221-8/+12
| | | | | | Slightly reshuffle and add comment Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: posix timers: reimplement using OS timerCorinna Vinschen2019-01-227-239/+289
| | | | | | | | | | | | | | | | - Rename files timer.* to posix_timer.*. - Reimplement using an OS timer rather than a handcrafted wait loop. - Use a Slim R/W Lock for synchronization. - Drop timer chaining. It doesn't server a purpose since all timers are local only. - Rename ttstart to itimer_tracker to better reflect its purpose. It's not the anchor for a timer chain anymore anyway. - Drop fixup_timers_after_fork. Everything is process-local, nothing gets inherited. - Rename timer_tracker::disarm_event to disarm_overrun_event for better readability. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: another overrun computation fix and drop useless variableCorinna Vinschen2019-01-221-6/+4
| | | | | | | | | | | | - When correcting the next expiration timestamp, the number of expirations gets computed correctly, just the expiration timestamp itself is then only incremented by a single interval, rather than the just computed expired intervals. Fix that. - drop the local clock variable in timerfd_tracker::create. It doesn't serve any purpose. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: reset expiry counter in settimeCorinna Vinschen2019-01-211-0/+1
| | | | | | As on Linux, reset the expiry counter when the timer gets rearmed. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: fix gettimeCorinna Vinschen2019-01-211-7/+22
| | | | | | | | | | | | - split into to __try/__except blocks to make sure leave_critical_section is always called when required. - Actually fill time_spec in settime so it_interval is returned correctly. - Return all 0 if timer is disarmed. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: move ioctl error handling into timerfd_trackerCorinna Vinschen2019-01-213-36/+39
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: rename overrun_count to expiration_countCorinna Vinschen2019-01-213-35/+35
| | | | | | | | The value returned by reading from a timerfd is not an overrun count in the same sense as for posix timers, it's an expiry counter. Reflect that in the name. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: fix overrun computationCorinna Vinschen2019-01-211-10/+11
| | | | | | | | | | | | | - Drop erroneous initial computation of overrun count in settime for absolute non-realtime clocks. It's repeated in thread_func and thus counted twice. - Fix overrun computation for timestamp offsets being a multiple of the timer interval. The timestamp has to be corrected after the first offset, otherwise the correction loop counts the intervals again. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: settime: fix computing DueTime on non-realtime clocksCorinna Vinschen2019-01-211-1/+1
| | | | | | | Non-CLOCK_REALTIME counters always use a relative DueTime in NtSetTimer. However, relative DueTime has to be negative, but the code Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: Handle gettime error in settimeCorinna Vinschen2019-01-211-2/+2
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: fill out it_interval on timerfd_gettimeCorinna Vinschen2019-01-212-0/+2
| | | | | | Might not be such a bad idea, after all... Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: implement TFD_TIMER_CANCEL_ON_SETCorinna Vinschen2019-01-203-11/+109
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: convert expiry timestamp to LONG64Corinna Vinschen2019-01-201-4/+4
| | | | | | Turns out we never need it as LARGE_INTEGER. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: Fix entering critical sectionCorinna Vinschen2019-01-201-1/+2
| | | | | | Getting an abandonded mutex is just as well and must be handled. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: fix read(2) running wildCorinna Vinschen2019-01-201-1/+3
| | | | | | | | | | | | | | - On systems with inexact realtime clock, the current timestamp may be fractionally smaller than the desired timestamp. This breaks the computation for incrementing overrun_count so overrun_count may end up as 0. Expiring the timer with an overrun_count of 0 is a no-go. Make sure we always increment overrun_count by at least one after timer expiry. - Do not expire the timer when another process deletes its timer_tracker. This, too, may result in a 0 overrun_count. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: prepare for TFD_TIMER_CANCEL_ON_SETCorinna Vinschen2019-01-192-10/+14
| | | | | | Also drop debugging sleep and make sure overrun count is positive. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: fhandler_pipe: fix commentCorinna Vinschen2019-01-191-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: reimplement from scratchCorinna Vinschen2019-01-197-330/+907
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using posix timers "timer_tracker" as base class for timerfd was flawed. Posix timers are not inherited by child processes and don't survive execve. The method used by posix timers didn't allow to share timers between processes. The timers were still per-process timers and worked entirely separate from each other. Reading from these timers via different descriptors was only synchronized within the same process. This does not reflect the timerfd semantics in Linux: The per-file timers can be dup'ed and survive fork and execve. They are still just descriptors pointing to the same timer object originally created by timerfd_create. Synchronization is performed between all descriptor instances of the same timer, system-wide. Thus, reimplement timerfd using a timer instance in shared memory, a kernel timer, and a handful of sync objects. Every process maintains a per-process timerfd struct on the cygheap maintaining a per-process thread. Every process sharing the same timerfd will run this thread checking the state of the timer, similar to the posix timer thread, just working on the shared objects and synchronizing its job with each other thread. Drop the timerfd implementation in the posix timer code and move the public API to fhandler_timerfd.c. Keep the ttstart timer_tracker anchor out of "NO_COPY" since the fixup_after_fork code should run to avoid memory leakage. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: clock.h: add valid_timespec() to check timespec for validityCorinna Vinschen2019-01-186-23/+19
| | | | | | Use throughout, drop local timespec_bad() in timer.cc. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd/signalfd: return EINVAL from writeCorinna Vinschen2019-01-173-6/+21
| | | | | | | Linux returns EINVAL, "fd is attached to an object which is unsuitable for writing". If we don't handle write locally, write returns EBADF. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: implement TFD_IOC_SET_TICKS ioctlCorinna Vinschen2019-01-163-2/+34
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: implement execve semanticsCorinna Vinschen2019-01-163-15/+28
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: implement fork semanticsCorinna Vinschen2019-01-164-20/+58
| | | | | | | | | | | | | | | | | | | | | | | - Puzzeling: Commit ec98d19a08c2e4678e8a6f40fea0c9bbeaa4a2c7 changed ttstart to NO_COPY but kept all the code to handle fixup after fork. Revert to not-NO_COPY and make timerfd fork work. - On fixup_after_fork, keep timerfd timers and restart thread if they were armed in the parent. - Move timerfd timer_trackers to cygheap. Overload timer_tracker new and delete methods to handle timers accordingly. This is not exactly required for fork, but exec will be grateful. - Give up on TFD_TIMER_CANCEL_ON_SET for now. There's no easy way to recognize a discontinuous change in a clock. - Be paranoid when cleaning out ttstart. - Fix some minor issues. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: fork: move extern declarations to appropriate headersCorinna Vinschen2019-01-163-2/+4
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: posix timers: fix overrun computationCorinna Vinschen2019-01-161-17/+8
| | | | | | | | | | | - Drop initial overrun computation from timer_tracker::settimer. It's performed in timer_tracker::thread_func anyway. - Fix regression in returning correct overrun count narrowed down to int from timer_getoverrun. This has been introduced by changing overrun_count_curr to LONG64. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd_create: add missing typeCorinna Vinschen2019-01-161-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timers: implement timerfdCorinna Vinschen2019-01-1516-51/+591
| | | | | | | | | | | | First cut of a timerfd implementation. Still TODO: - fork/exec semantics - timerfd_settime TFD_TIMER_CANCEL_ON_SET flag - ioctl(TFD_IOC_SET_TICKS) - bug fixes Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: signalfd: set st_mode in fhandler_signalfd::fstatCorinna Vinschen2019-01-152-3/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: signalfd: fix commentCorinna Vinschen2019-01-151-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Update config.guess, config.sub to gcc master branch versionsJeff Johnston2019-01-152-611/+626
|
* AMD GCN Port contributed by Andrew Stubbs <ams@codesourcery.com>Jeff Johnston2019-01-1532-4/+13126
| | | | | | | | | | | | | | Add support for the AMD GCN GPU architecture. This is primarily intended for use with OpenMP and OpenACC offloading. It can also be used for stand-alone programs, but this is intended mostly for testing the compiler and is not expected to be useful in general. The GPU architecture is highly parallel, and therefore Newlib must be configured to use dynamic re-entrancy, and thread-safe malloc. The only I/O available is a via a shared-memory interface provided by libgomp and the gcn-run tool included with GCC. At this time this is limited to stdout, argc/argv, and the return code.
* Cygwin: gentls_offsets: Remove obsolte 'o' regex optionCorinna Vinschen2019-01-151-6/+6
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: tlsoffsets64.h: regenerateCorinna Vinschen2019-01-151-2/+2
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: signalfd: drop incorrect handling of EINTR in read(2)Corinna Vinschen2019-01-151-7/+5
| | | | | | | In case sigwait_common returns EINTR, read wrongly ignores it, so read can't be interrupt by a signal. Fix that. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: document POSIX rename semantics availability with W10 1809 onlyCorinna Vinschen2019-01-142-7/+7
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: wincap: split has_posix_file_infoCorinna Vinschen2019-01-143-13/+49
| | | | | | | | | | | | | While FileRenameInformationEx is defined starting with Windows 10 1709 per MSDN, it only starts working in W10 1809, apparently. Users of 1803 report "Function not implemented". Introduce wincap_10_1809 and change the version check in wincapc::init accordingly. Split has_posix_file_info into has_posix_unlink_semantics and has_posix_rename_semantics. Enable the latter only starting with W10 1809. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: signalfd: implement non-polling selectCorinna Vinschen2019-01-149-33/+129
| | | | | | | | | | | | | | | | Allow the signal thread to recognize we're called in consequence of select on a signalfd. If the signal is part of the wait mask, don't call any signal handler and don't remove the signal from the queue, so a subsequent read (or sigwaitinfo/sigtimedwait) still gets the signal. Instead, just signal the event object at _cygtls::signalfd_select_wait for the thread running select. The addition of signalfd_select_wait to _cygtls unearthed the alignment problem of the context member again. To make sure this doesn't get lost, improve the related comment in the header file so that this (hopefully) doesn't get lost (again). Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: select: always store the running thread's TLS into select_recordCorinna Vinschen2019-01-141-1/+3
| | | | | | This allows select threads to access our current tls if required. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: document wctype changesCorinna Vinschen2019-01-132-0/+9
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>