summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Cygwin: path_conv: reorder private method declarationsCorinna Vinschen2019-01-061-3/+5
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: fhandler_base::open: allow to reopen file from handleCorinna Vinschen2019-01-061-1/+6
| | | | | | | | | | | So far io_handle is NULL when calling fhandler_base::open to open or create a file. Add a check for io_handle to allow priming the fhandler with a HANDLE value so we can reopen a file from a HANDLE on file systems supporting it. This allows to open already deleted files for further action. This will be used by open("/proc/PID/fd/DESCRIPTOR") scenarios. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: pipe: use /proc/PID/fd/... or /proc/self/fd/... nameCorinna Vinschen2019-01-051-4/+11
| | | | | | | Don't emit /dev/fd/... filename. This simplifies pipe path handling and avoids another symlink redirection. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: introduce virt_fdsymlink to simplify /proc/PID/fd symlink handlingCorinna Vinschen2019-01-053-2/+6
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: return correct FH_PROCESSFD for files under /proc/PID/fd subdirCorinna Vinschen2019-01-052-3/+11
| | | | | | This allows easier handling of fd symlinks. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: try_to_bin: fix typos in commentsCorinna Vinschen2019-01-051-2/+2
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: path_conv: nobody cares if a path had symlinks after the factCorinna Vinschen2019-01-052-8/+0
| | | | | | | remove set_has_symlinks/has_symlinks/PATH_HAS_SYMLINKS. Nobody's asking for this information. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: drop disabled O_TMPFILE POSIX unlink codeCorinna Vinschen2019-01-041-40/+0
| | | | | | | | | | | | | The commit message of commit 07e0a9584f9a5b2668c767ede0482a5fba498731 and the expectation set therein, are wrong. There's no POSIX semantics allowing to link a file with a link count of 0 and making it available in the file system again. In fact, the Linux linkat extension AT_EMPTY_PATH explicitely disallows to link a file descriptor to a file with a link count of 0, except for O_TMPFILE without O_EXCL. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Improve performance of memmemWilco Dijkstra2019-01-012-51/+137
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch significantly improves performance of memmem using a novel modified Horspool algorithm.  Needles up to size 256 use a bad-character table indexed by hashed pairs of characters to quickly skip past mismatches. Long needles use a self-adapting filtering step to avoid comparing the whole needle repeatedly. By limiting the needle length to 256, the shift table only requires 8 bits per entry, lowering preprocessing overhead and minimizing cache effects. This limit also implies worst-case performance is linear. Small needles up to size 2 use a dedicated linear search.  Very long needles use the Two-Way algorithm (to avoid increasing stack size inlining is now disabled). The performance gain is 6.6 times on English text on AArch64 using random needles with average size 8 (this is even faster than the recently improved strstr algorithm, so I'll update that in the near future). The size-optimized memmem has also been rewritten from scratch to get a 2.7x performance gain. Tested against GLIBC testsuite and randomized tests. Message-Id: <DB5PR08MB1030649D051FA8532A4512C883B20@DB5PR08MB1030.eurprd08.prod.outlook.com>
* Bump release to 3.1.0 for yearly snapshotnewlib-snapshot-20181231newlib-3.1.0Jeff Johnston2018-12-31106-1068/+1135
|
* Cygwin: open(2): Change comment in disabled O_TMPFILE POSIX unlink codeCorinna Vinschen2018-12-261-5/+12
| | | | | | | | | | | - Turns out, the definition of POSIX unlink semantics is half-hearted so far: It's not possible to link an open file HANDLE if it has been deleted with POSIX semantics, nor is it possible to remove the delete disposition. This breaks linkat on an O_TMPFILE. Tested with W10 1809. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Change /proc/$PID/fd/<fd> symlink target for deleted filesCorinna Vinschen2018-12-261-3/+15
| | | | | | - As on Linux, print the file name with an attached " (deleted)" Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Add Christmas hacking release notesCorinna Vinschen2018-12-262-0/+52
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Add documentation for chattr and lsattrCorinna Vinschen2018-12-261-0/+129
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Add lsattr and chattr toolsCorinna Vinschen2018-12-263-1/+652
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Add FS_IOC_GETFLAGS and FS_IOC_SETFLAGS ioctlsCorinna Vinschen2018-12-254-0/+279
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: mkdir: create case-sensitive dirsCorinna Vinschen2018-12-251-0/+34
| | | | | | | On Windows 10 1803 and later, create dirs under the Cygwin installation dir as case sensitive, if WSL is installed. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: wincap: add wincap_10_1803, add has_case_sensitive_dirs itemCorinna Vinschen2018-12-252-1/+38
| | | | | | - Allow to disable the flag by calling disable_case_sensitive_dirs. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: cygheap: convert installation paths to UNICODE_STRINGSCorinna Vinschen2018-12-255-25/+30
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: utilize FILE_DISPOSITION_POSIX_SEMANTICSCorinna Vinschen2018-12-231-3/+76
| | | | | | | | | | | - short-circuit most code in unlink_nt since it's not necessary anymore if FILE_DISPOSITION_POSIX_SEMANTICS is supported. - Immediately remove O_TMPFILE from filesystem after creation. Disable code for now because we have to implement /proc/self/fd opening by handle first, lest linkat fails. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: support exFAT and fix remote FAT/FAT32 recognitionCorinna Vinschen2018-12-234-1/+12
| | | | | | | Newer FAT32 and exFAT add FILE_SUPPORTS_ENCRYPTION to their flags which wasn't handled by Cygwin yet. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: wincap: add wincap_10_1709, add has_posix_file_info itemCorinna Vinschen2018-12-232-6/+38
| | | | | | | | | | | | Various new file info class members adding important POSIX semantics have been added with W10 1709. We may want to utilize them, so add a matching wincaps. Rearrange checking the W10 build number to prefer the latest builds over the older builds. Rename wincap_10 to wincap_10_1507 for enhanced clarity. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: ntdll.h: Update _FILE_INFORMATION_CLASSCorinna Vinschen2018-12-231-309/+348
| | | | | | | | | | | | - Add missing members added in later OS versions - Rearrange accompanying FILE_foo_INFORMATION structs ordered by info class - Add promising FILE_foo_INFORMATION structs of later Windows 10 releases plus accompanying enums - Drop "Checked on 64 bit" comments since that's self-evident these days Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* RTEMS: Use __uint64_t for __ino_tSebastian Huber2018-12-201-1/+1
| | | | | | | FreeBSD uses a 64-bit ino_t since 2017-05-23. We need this for the pipe() support in libbsd. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Plug routing sysctl leaks.markj2018-12-201-1/+5
| | | | | | | | | | | | Various structures exported by sysctl_rtsock() contain padding fields which were not being zeroed. Reported by: Thomas Barabosch, Fraunhofer FKIE Reviewed by: ae MFC after: 3 days Security: kernel memory disclosure Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D18333
* Cygwin: fix heap allocation on WOW64 and /3GB enabled 32 bit machinesCorinna Vinschen2018-12-191-11/+17
| | | | | | | | | The check for the TEB being allocated beyond the first 2GB area is not valid anymore. At least on W10 WOW64, the TEB is allocated in the lower 2GB even in large-address aware executables. Use VirtualQuery instead. It fails for invalid addresses so that's a simple enough test. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* nano-vfprintf_float.c: Fix check if negative for nans.Jon Beniston2018-12-131-1/+2
|
* Fix powf overflow handling in non-nearest rounding modeSzabolcs Nagy2018-12-101-0/+10
| | | | | | | | | | | | | | | | | | | | | 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.
* sys/time.h: Remove KASSERTSebastian Huber2018-12-041-12/+0
| | | | | | The KASSERT is only used by the FreeBSD kernel. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Ensure that all values of ns, us and ms workimp2018-12-041-7/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* When converting ns,us,ms to sbt, return the ceil()imp2018-12-041-3/+7
| | | | | | | | | | | 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
* Correct a misplaced closing paren.ian2018-12-041-3/+3
| | | | | Does not affect the result, but does clarify (at least for me) that the multiplication happens before the shift.
* sys: further adoption of SPDX licensing ID tags.pfg2018-12-041-0/+2
| | | | | | | | | | | | | | 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.
* Add inline functions to convert between sbintime_tian2018-12-041-7/+52
| | | | | | | | | | | | 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.)
* Renumber copyright clause 4imp2018-12-041-1/+1
| | | | | | | | | 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
* Cygwin: mkvers: fix a bug in sed statementCorinna Vinschen2018-12-011-1/+2
| | | | | | | | | | | | 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>
* Cygwin: clocks: fix a hang on pre-Windows 10 machinesCorinna Vinschen2018-12-013-50/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* fix version typoMark Geisert2018-12-011-1/+1
|
* Cygwin: clocks: use either tickcount or tick periodCorinna Vinschen2018-11-292-15/+26
| | | | | | | 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>
* stdio.h: Expose cuserid with __GNU_VISIBLECorinna Vinschen2018-11-291-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: document latest changesCorinna Vinschen2018-11-292-0/+46
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: implement extensible clock interfaceCorinna Vinschen2018-11-2920-295/+539
| | | | | | | | | | | | | | | | | | | | | | | | | | - 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>
* time.h: Introduce Linux-specific CLOCK id valuesCorinna Vinschen2018-11-291-4/+18
| | | | | | | | | | | | | | | - 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>
* Cygwin: timers: clock_setres: make no-opCorinna Vinschen2018-11-291-36/+2
| | | | | | | | 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>
* Cygwin: pthread_cond_timedwait: make sure to wait until abstime finishesCorinna Vinschen2018-11-291-8/+16
|
* Cygwin: timers: use spinlock to prime hires_ns thread-safeCorinna Vinschen2018-11-262-15/+13
| | | | | | | | 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>
* Cygwin: timers: drop error handling for Windows perf timer functionsCorinna Vinschen2018-11-261-30/+7
| | | | | | | Per MSDN, the perf timer functions always succeed on Windows XP or later. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timers: Simplify hires_ms and hires_nsCorinna Vinschen2018-11-262-11/+2
| | | | | | Drop hires_base and move inited into hires_ns. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: spinlock: remove useless get_ll callCorinna Vinschen2018-11-261-1/+1
| | | | | | | 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>
* Builtin enable return code with SYS_EXIT_EXTENDEDMatthew Malcomson2018-11-261-19/+43
| | | | | | | 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.