summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* fork: Don't copy _main_tls->local_clib from *_impure_ptrCorinna Vinschen2017-03-101-7/+2
| | | | | | | | | | | So far we copy *_impure_ptr into _main_tls->local_clib if the child process has been forked from a pthread. But that's not required. The local_clib area of the new thread is on the stack and the stack gets copied from the parent anyway (in frok::parent). So we only have to make sure _main_tls is pointing to the right address and do the simple post-fork thread init. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* _dll_crt0: Drop incorrect check for being started from parent main threadCorinna Vinschen2017-03-101-1/+1
| | | | | | | | | | | This test was broken from the start. It leads to creating a completely new stack for the main thread of the child process when started from the main thread of the parent. However, the main thread of a process can easily running on a completely different stack, if the parent's main thread was created by calling fork() from a pthread. For an example, see https://cygwin.com/ml/cygwin/2017-03/msg00113.html Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* errno: Stop using _impure_ptr->_errno completelyCorinna Vinschen2017-03-103-6/+5
| | | | | | | | We use errno AKA _REENT->_errno since the last century and only set _impure_ptr->_errno for backward compat. Stop that. Also, remove the last check for _impure_ptr->_errno in Cygwin code. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Drop redundant brackets in call to _reclaim_reentCorinna Vinschen2017-03-101-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Implement dladdr() (partially)Jon Turney2017-03-086-1/+61
| | | | | | | Note that this always returns with dli_sname and dli_saddr set to NULL, indicating no symbol matching addr could be found. Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
* yield: Don't lower thread priority, it leads to starvationCorinna Vinschen2017-03-081-5/+6
| | | | | | | ...and it's not required anymore to have the same effect as the original code post-XP. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Emit correct errno EAGAIN if we can't create another threadCorinna Vinschen2017-03-081-0/+2
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Export timingsafe_bcmp and timingsafe_memcmpJon Turney2017-03-074-1/+7
| | | | Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
* Document pthread_cond_wait change in release notesCorinna Vinschen2017-03-071-0/+3
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: pthread_cond_wait: Do as Linux and BSD do.Corinna Vinschen2017-03-071-22/+5
| | | | | | | | | | | | | | | POSIX states as follows about pthread_cond_wait: If a signal is delivered to a thread waiting for a condition variable, upon return from the signal handler the thread resumes waiting for the condition variable as if it was not interrupted, or it returns zero due to spurious wakeup. Cygwin so far employs the latter behaviour, while Linux and BSD employ the former one. Align Cygwin behaviour to Linux and BSD. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* cwdstuff: Don't leave from setting the CWD prematurely on initCorinna Vinschen2017-03-031-8/+42
| | | | | | | | | | | | | | | | | | | | There are certain, very obscure scenarios, which render the Windows CWD handle inaccessible for reopening. An easy one is, the handle can be NULL if the permissions of the CWD changed under the parent processes feet. Originally we just set errno and returned, but in case of init at process startup that left the "posix" member NULL and subsequent calls to getcwd failed with EFAULT. We now check for a NULL handle and change the reopen approach accordingly. If that doesn't work, try to duplicate the handle instead. If duplicating fails, too, we set the dir handle to NULL and carry on. This will at least set posix to some valid path and subsequent getcwd calls won't fail. A NULL dir handle is ok, because we already do this for virtual paths. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Preserve order of dlopen'd modules in dll_list::topsortnewlib-snapshot-20170228David Allsopp2017-02-283-5/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch alters the behaviour of dll_list::topsort to preserve the order of dlopen'd units. The load order of unrelated DLLs is reversed every time fork is called, since dll_list::topsort finds the tail of the list and then unwinds to reinsert items. My change takes advantage of what should be undefined behaviour in dll_list::populate_deps (ndeps non-zero and ndeps and deps not initialised) to allow the deps field to be initialised prior to the call and appended to, rather than overwritten. All DLLs which have been dlopen'd have their deps list initialised with the list of all previously dlopen'd units. These extra dependencies mean that the unwind preserves the order of dlopen'd units. The motivation for this is the FlexDLL linker used in OCaml. The FlexDLL linker allows a dlopen'd unit to refer to symbols in previously dlopen'd units and it resolves these symbols in DllMain before anything else has initialised (including the Cygwin DLL). This means that dependencies may exist between dlopen'd units (which the OCaml runtime system understands) but which Windows is unaware of. During fork, the process-level table which FlexDLL uses to get the symbol table of each DLL is copied over but because the load order of dlopen'd DLLs is reversed, it is possible for FlexDLL to attempt to access memory in the DLL before it has been loaded and hence it fails with an access violation. Because the list is reversed on each call to fork, it means that a subsequent call to fork puts the DLLs back into the correct order, hence "even" invocations of fork work! An interesting side-effect is that this only occurs if the DLLs load at their preferred base address - if they have to be rebased, then FlexDLL works because at the time that the dependent unit is loaded out of order, there is still in memory the "dummy" DONT_RESOLVE_DLL_REFERENCES version of the dependency which, as it happens, will contain the correct symbol table in the data section. For my tests, this initially appeared to be an x86-only problem, but that was only because the two DLLs on x64 should have been rebased. Signed-off-by: David Allsopp <david.allsopp@metastack.com>
* Add 2.7.1 release fileCorinna Vinschen2017-02-241-0/+14
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Generate output with Unix line endings even from Mingw64 utilsCorinna Vinschen2017-02-242-0/+8
| | | | | | This affects cygcheck and strace. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Bump Cygwin version to 2.7.1Corinna Vinschen2017-02-241-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* fix parallel build for version.cc and winver.oMichael Haubenwallner2017-02-161-1/+3
| | | | Creating both version.cc and winver.o at once really should run once only.
* Update makedocbook for bd547490Jon Turney2017-02-151-3/+4
| | | | | | | | Teach makedocbook how to handle some new things seen in the makedoc markup since bd547490: - struct lines appearing in the synopsis - use of @strong{} texinfo markup
* Fix elf-nano.specs to work without -save-tempsThomas Preud'homme2017-02-151-3/+3
| | | | | | | | | | | | The changes in af272aca591fe1dc0f1be64ae5bda147ea98a047 only works when using gcc/g++ with -E or -save-temps, otherwise newlib's newlib.h gets used even if -specs=nano.specs is specified. This is because the driver only use cpp_options spec for the external cpp tool, not for the integrated one. This patch uses instead cpp_unique_options which is used in all cases: it is used directly when the integrated preprocessor is used, and indirectly by expansion of cpp_options otherwise.
* Improve wording on special charactersKenneth Nellis2017-02-141-1/+2
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Allow locking routine to be retargetedThomas Preud'homme2017-02-1310-14/+316
| | | | | | | | | | | | | | | | | | | | | | | | | | | | At the moment when targeting bare-metal targets or systems without definition for the locking primitives newlib, uses dummy empty macros. This has the advantage of reduced size and faster implementation but does not allow the application to retarget the locking routines. Retargeting is useful for a single toolchain to support multiple systems since then it's only at link time that you know which system you are targeting. This patch adds a new configure option --enable-newlib-retargetable-locking to use dummy empty functions instead of dummy empty macros. The default is to keep the current behavior to not have any size or speed impact on targets not interested in this feature. To allow for any size of lock, the _LOCK_T type is changed into pointer to struct _lock and the _init function are tasked with allocating the locks. The platform being targeted must provide the static locks. A dummy implementation of the locking routines and static lock is provided for single-threaded applications to link successfully out of the box. To ensure that the behavior is consistent (either no locking whatsoever or working locking), the dummy implementation is strongly defined such that a partial retargeting will cause a doubly defined link error. Indeed, the linker will only pull in the file providing the dummy implementation if it cannot find an implementation for one of the routine or lock.
* Only define static locks in multithreaded modeThomas Preud'homme2017-02-135-6/+28
| | | | | | | | | | | | | Newlib build system defines __SINGLE_THREAD__ to allow concurrency code to be only compiled when newlib is configured for multithread. One such example are locks which become useless in single thread mode. Although most static locks are indeed guarded by !defined(__SINGLE_THREAD__), some are not. This commit adds these missing guards to __dd_hash_mutex, __atexit_recursive_mutex, __at_quick_exit_mutex and __arc4random_mutex. It also makes sure locking macros in lock.h are noop in single thread mode.
* Fix cpp invocation for C++ in nano specThomas Preudhomme2017-02-131-3/+3
| | | | | | | | | | | Hi, The changes in c028685518a261f6d0dab0d7ed15f9570ab9b3d0 to use newlib-nano's include directory work for cc1 but not cc1plus. cc1plus comes with its own cpp spec which does not have a name attached to it. This patch uses the renaming trick on cpp_options instead of cpp, as cpp_options is used both by cc1 and cc1plus.
* libgloss: Remove duplicate definition of environStafford Horne2017-02-131-3/+0
| | | | | | | | | | | | | | | | Environ is defined in libgloss and libc: - libgloss/or1k/syscalls.c - libc/stdlib/environ.c When linking we sometimes get errors: or1k-elf-g++ test.o -mnewlib -mboard=or1ksim -lm -o test /opt/shorne/software/or1k/lib/gcc/or1k-elf/5.3.0/../../../../or1k-elf/lib/libor1k.a(syscalls.o):(.data+0x0): multiple definition of `environ' /opt/shorne/software/or1k/lib/gcc/or1k-elf/5.3.0/../../../../or1k-elf/lib/libc.a(lib_a-environ.o):(.data+0x0): first defined here collect2: error: ld returned 1 exit status This doesnt happen after the fix. Basic things build fine too.
* libgloss: or1k: If available call the init for init_arrayStafford Horne2017-02-131-0/+6
| | | | | | | | | There was an issue revealed in gdb testing where C++ virtual tables were not getting properly initialized. This seems to be due to the c++ global constructors moving from ctors to init_array. This fix makes sure we call the proper method for initializing the constructors in all places.
* or1k: Make open reentrantOlof Kindgren2017-02-131-1/+1
| | | | | | | | | | | or1k uses reentrant calls by default, but there was no open_r defined which caused failure in C++/C code such as: int main() { std::cout << "test\n"; return 0; } or int main() {open(".", 0);}
* Add IBM Security Trusteer Rapport to BLODA listcygwin-2_7_0-releaseCorinna Vinschen2017-02-121-0/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: create separate bits/byteswap.hYaakov Selkowitz2017-02-083-37/+51
| | | | | | | | Match glibc behaviour to expose the public bswap_* macros only with an explicity #include <byteswap.h>; #include'ing <endian.h> should not expose them. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Unify names of all lock objectsFreddie Chopin2017-02-069-40/+40
| | | | | | | | | | | | | | | | | | In preparation for the patch that would allow retargeting of locking routines, rename all lock objects to follow this pattern: "__<name>_[recursive_]mutex". Following locks were renamed: __dd_hash_lock -> __dd_hash_mutex __sfp_lock -> __sfp_recursive_mutex __sinit_lock -> __sinit_recursive_mutex __atexit_lock -> __atexit_recursive_mutex _arc4random_mutex -> __arc4random_mutex __env_lock_object -> __env_recursive_mutex __malloc_lock_object -> __malloc_recursive_mutex __atexit_mutex -> __at_quick_exit_mutex __tz_lock_object -> __tz_mutex
* Make anchors stable in generated Cygwin HTML documentationJon Turney2017-02-064-63/+63
| | | | | | | Give more elements ids, so random ids aren't assigned to them, so anchors are stable between builds. Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
* Add release message for commit 609d2b2Corinna Vinschen2017-02-031-0/+3
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix limited Internet speeds caused by inappropriate socket bufferingCorinna Vinschen2017-02-031-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't set SO_RCVBUF/SO_SNDBUF to fixed values, thus disabling autotuning. Patch modeled after a patch suggestion from Daniel Havey <dhavey@gmail.com> in https://cygwin.com/ml/cygwin-patches/2017-q1/msg00010.html: At Windows we love what you are doing with Cygwin. However, we have been getting reports from our hardware vendors that iperf is slow on Windows. Iperf is of course compiled against the cygwin1.dll and we believe we have traced the problem down to the function fdsock in net.cc. SO_RCVBUF and SO_SNDBUF are being manually set. The comments indicate that the idea was to increase the buffer size, but, this code must have been written long ago because Windows has used autotuning for a very long time now. Please do not manually set SO_RCVBUF or SO_SNDBUF as this will limit your internet speed. I am providing a patch, an STC and my cygcheck -svr output. Hope we can fix this. Please let me know if I can help further. Simple Test Case: I have a script that pings 4 times and then iperfs for 10 seconds to debit.k-net.fr With patch $ bash buffer_test.sh 178.250.209.22 usage: bash buffer_test.sh <iperf server name> Pinging 178.250.209.22 with 32 bytes of data: Reply from 178.250.209.22: bytes=32 time=167ms TTL=34 Reply from 178.250.209.22: bytes=32 time=173ms TTL=34 Reply from 178.250.209.22: bytes=32 time=173ms TTL=34 Reply from 178.250.209.22: bytes=32 time=169ms TTL=34 Ping statistics for 178.250.209.22: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 167ms, Maximum = 173ms, Average = 170ms ------------------------------------------------------------ Client connecting to 178.250.209.22, TCP port 5001 TCP window size: 64.0 KByte (default) ------------------------------------------------------------ [ 3] local 10.137.196.108 port 58512 connected with 178.250.209.22 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0- 1.0 sec 768 KBytes 6.29 Mbits/sec [ 3] 1.0- 2.0 sec 9.25 MBytes 77.6 Mbits/sec [ 3] 2.0- 3.0 sec 18.0 MBytes 151 Mbits/sec [ 3] 3.0- 4.0 sec 18.0 MBytes 151 Mbits/sec [ 3] 4.0- 5.0 sec 18.0 MBytes 151 Mbits/sec [ 3] 5.0- 6.0 sec 18.0 MBytes 151 Mbits/sec [ 3] 6.0- 7.0 sec 18.0 MBytes 151 Mbits/sec [ 3] 7.0- 8.0 sec 18.0 MBytes 151 Mbits/sec [ 3] 8.0- 9.0 sec 18.0 MBytes 151 Mbits/sec [ 3] 9.0-10.0 sec 18.0 MBytes 151 Mbits/sec [ 3] 0.0-10.0 sec 154 MBytes 129 Mbits/sec Without patch: dahavey@DMH-DESKTOP ~ $ bash buffer_test.sh 178.250.209.22 Pinging 178.250.209.22 with 32 bytes of data: Reply from 178.250.209.22: bytes=32 time=168ms TTL=34 Reply from 178.250.209.22: bytes=32 time=167ms TTL=34 Reply from 178.250.209.22: bytes=32 time=170ms TTL=34 Reply from 178.250.209.22: bytes=32 time=169ms TTL=34 Ping statistics for 178.250.209.22: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 167ms, Maximum = 170ms, Average = 168ms ------------------------------------------------------------ Client connecting to 178.250.209.22, TCP port 5001 TCP window size: 208 KByte (default) ------------------------------------------------------------ [ 3] local 10.137.196.108 port 58443 connected with 178.250.209.22 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0- 1.0 sec 512 KBytes 4.19 Mbits/sec [ 3] 1.0- 2.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 2.0- 3.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 3.0- 4.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 4.0- 5.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 5.0- 6.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 6.0- 7.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 7.0- 8.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 8.0- 9.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 9.0-10.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 0.0-10.1 sec 14.1 MBytes 11.7 Mbits/sec The output shows that the RTT from my machine to the iperf server is similar in both cases (about 170ms) however with the patch the throughput averages 129 Mbps while without the patch the throughput only averages 11.7 Mbps. If we calculate the maximum throughput using Bandwidth = Queue/RTT we get (212992 * 8)/0.170 = 10.0231 Mbps. This is just about what iperf is showing us without the patch since the buffer size is set to 212992 I believe that the buffer size is limiting the throughput. With the patch we have no buffer limitation (autotuning) and can develop the full potential bandwidth on the link. If you want to duplicate the STC you will have to find an iperf server (I found an extreme case) that has a large enough RTT distance from you and try a few times. I get varying results depending on Internet traffic but without the patch never exceed the limit caused by the buffering. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add release message for commit a1529738Jon Turney2017-01-311-0/+3
| | | | Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
* Fix handling of '+' by 'cygcheck -p'Jon Turney2017-01-311-2/+2
| | | | | | | | | | | The form data sent to the server should be application/x-www-form-urlencoded This replaces spaces with '+' before being RFC 1738 encoded, so a literal '+' must be %-encoded also. See https://cygwin.com/ml/cygwin/2014-01/msg00287.html et seq. Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
* Add release message for commit 095cac4Corinna Vinschen2017-01-311-0/+3
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Add IUTF8 termios iflagCorinna Vinschen2017-01-314-23/+31
| | | | | | | | | | | | | | | | | | | | | | | | | The termios code doesn't handle erasing of multibyte characters in canonical mode, it always erases a single byte. When entering a multibyte character and then pressing VERASE, the input ends up with an invalid character. Following Linux we introduce the IUTF8 input flag now, set by default. When this flag is set, VERASE or VWERASE will check if the just erased input byte is a UTF-8 continuation byte. If so, it erases another byte and checks again until the entire UTF-8 character has been removed from the input buffer. Note that this (just as on Linux) does NOT work with arbitrary multibyte codesets. This only works with UTF-8. For a discussion what happens, see https://cygwin.com/ml/cygwin/2017-01/msg00299.html Sidenote: The eat_readahead function is now member of fhandler_termios, not fhandler_base. That's necessary to get access to the terminal's termios flags. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Committed, libgloss: hook up cris-elf to the initfini-array support.Hans-Peter Nilsson2017-01-292-2/+15
| | | | | | | | | | | | | | | | | | After a binutils change "a while ago" (2015-12) to default to --enable-initfini-array, i.e. to merge .ctors and .dtors into .init_array and .fini_array, this is needed for cdtors to run at all. Based on what goes on in arm/ and aarch64/. Tested for cris-elf by running the gcc testsuite. By the way, the configure test doesn't detect this change, so the HAVE_INITFINI_ARRAY ifdeffery is somewhat redundant. Still, the change is tested to be safe with older binutils too. libgloss/ * cris/crt0.S, cris/lcrt0.c: Include newlib.h. [HAVE_INITFINI_ARRAY] (_init): Define to __libc_init_array. [HAVE_INITFINI_ARRAY] (_fini): Ditto __libc_fini_array.
* arm: Fix addressing in optpld macroKyrill Tkachov2017-01-262-4/+4
| | | | | | | | | | | | | | | In patch b219285f873cc79361355938bd2a994957b4a6ef you have a syntax error in the PLD instruction. The syntax for the pld argument should be in square brackets as it's a memory address like so: pld [r1]. With your patch the newlib build fails for armv7-a targets. This patch fixes the build failures. Tested by making sure the newlib build completes successfully. 2016-01-26 Kyrylo Tkachov <kyrylo.tkachov@arm.com> * libc/machine/arm/strcpy.c (strcpy): Fix PLD assembly syntax. * libc/machine/arm/strlen-stub.c (strlen): Likewise.
* arm: Remove RETURN macroPat Pannuto2017-01-256-33/+23
| | | | | | | | | | | | | | LTO can re-order top-level assembly blocks, which can cause this macro definition to appear after its use (or not at all), causing compilation failures. On modern toolchains (armv4t+), assembly should write `bx lr` in all cases, and linkers will transparently convert them to `mov pc, lr`, allowing us to simply remove the macro. (source: https://groups.google.com/forum/#!topic/comp.sys.arm/3l7fVGX-Wug and verified empirically) For the armv4.S file, preserve this macro to maximize backwards compatibility.
* arm: Remove optpld macroPat Pannuto2017-01-253-18/+11
| | | | | | | | | | | LTO can re-order top-level assembly blocks, which can cause this macro definition to appear after its use (or not at all), causing compilation failures. As the macro has very few uses, simply removing it by inlining is a simple fix. n.b. one of the macro invocations in strlen-stub.c was already guarded by the relevant #define, so it is simply converted directly to a pld
* Remove unneeded references to arm_asm.hPat Pannuto2017-01-258-10/+4
| | | | | This should result in no functional changes, it simply removes references to arm_asm.h that did not use anything from that file.
* devctl.h: Fix typo and include proper headerSebastian Huber2017-01-251-6/+6
| | | | | | | Remove stray commas. Include <sys/cdefs.h> for __restrict (includes <stddef.h> indirectly). Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* RTEMS: Harmonize MAXNAMLEN and NAME_MAXSebastian Huber2017-01-251-0/+4
| | | | | | | Override MAXNAMLEN definition in <dirent.h> and make sure it equals NAME_MAX. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Prefix consistenly target-independent locks with __Thomas Preudhomme2017-01-252-11/+11
| | | | | | | | | | | | | | | | | | | Hi, With the patch to allow newlib's locking routine to be retargeted currently under discussion, we need to start thinking of locks as part of newlib's ABI since newlib depends on specific names being provided by the OS. This patch renames 2 locks so that they follow the same naming convention as other locks. It needs to be applied before the retargeting patch, while locks are still an internal consideration. Newlib builds successfully with this change. Ok for master branch? Best regards, Thomas
* Add release message for commit ca3e3bcCorinna Vinschen2017-01-201-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* nl_langinfo: Add NL_LOCALE_NAME macroEric Blake2017-01-202-1/+18
| | | | | | | | | | | | | | | | | | | | | Provide an extension NL_LOCALE_NAME() macro, with semantics matching glibc, which can be used as: nl_langinfo_l(NL_LOCALE_NAME(LC_MESSAGES), locale); to get back the locale string that locale was originally created with during newlocale(). This in turn allows a library (such as gettext) to determine what thread-local locale settings it has inherited from the main program without having to be told what parameters were passed to newlocale(), for less overall coupling between parts of the program. gnulib is set up to use the extension: https://lists.gnu.org/archive/html/bug-gnulib/2017-01/msg00129.html * libc/include/langinfo.h (NL_LOCALE_NAME): New macro * libc/locale/nl_langinfo.c (nl_langinfo_l): Expose locale names of a locale_t's category components. Signed-off-by: Eric Blake <eblake@redhat.com>
* Cleanup fhandler_console::read for readabilityCorinna Vinschen2017-01-191-22/+20
| | | | | | | | | - Drop virtual_key_code (only used once) - Convert macros wch and control_key_state to const vars unicode_char and ctrl_key_state. - Fix formatting Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* miscfuncs.cc: Revert exclusion of inclusion of exception.hCorinna Vinschen2017-01-191-0/+1
| | | | | | x86 still needs it. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Simplify check for Alt-NumpadCorinna Vinschen2017-01-193-39/+35
| | | | | | | | | Create two new inline functions is_alt_numpad_key(PINPUT_RECORD) and is_alt_numpad_event(PINPUT_RECORD) which contain the actual checks. Call these functions from fhandler_console::read and peek_console for better readability. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* miscfuncs.h: Drop now unneeded getentropy declarationCorinna Vinschen2017-01-191-1/+0
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* miscfuncs.cc: Drop unneeded includes and unused global variableCorinna Vinschen2017-01-191-12/+0
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>