summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Add missing headers to fix implicit function defnsPat Pannuto2017-01-164-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A few files were missing headers for memset/malloc, likely missed because the files don't directly call the functions, rather they come in via macros in libc/include/sys/reent.h: #define _REENT_CHECK(var, what, type, size, init) do { \ struct _reent *_r = (var); \ if (_r->what == NULL) { \ _r->what = (type)malloc(size); \ #define _REENT_CHECK_ASCTIME_BUF(var) \ _REENT_CHECK(var, _asctime_buf, char *, _REENT_ASCTIME_SIZE, \ memset((var)->_asctime_buf, 0, _REENT_ASCTIME_SIZE)) Without these fixes, implicit function signatures are provided, which gcc warns could cause aliasing issues down the line: ../../../../../../../newlib-2.5.0/newlib/libc/time/asctime.c:62:3: warning: type of 'memset' does not match original declaration [-Wlto-type-mismatch] /Volumes/code/external/newlib-cygwin/newlib/libc/include/string.h:29:7: note: return value type mismatch _PTR _EXFUN(memset,(_PTR, int, size_t)); ^ /Volumes/code/external/newlib-cygwin/newlib/libc/include/string.h:29:7: note: 'memset' was previously declared here /Volumes/code/external/newlib-cygwin/newlib/libc/include/string.h:29:7: note: code may be misoptimized unless -fno-strict-aliasing is used ../../../../../../../newlib-2.5.0/newlib/libc/time/asctime.c:62:3: warning: type of 'malloc' does not match original declaration [-Wlto-type-mismatch] /Volumes/code/external/newlib-cygwin/newlib/libc/include/malloc.h:37:13: note: return value type mismatch extern _PTR malloc _PARAMS ((size_t)); ^ /Volumes/code/external/newlib-cygwin/newlib/libc/include/malloc.h:37:13: note: 'malloc' was previously declared here /Volumes/code/external/newlib-cygwin/newlib/libc/include/malloc.h:37:13: note: code may be misoptimized unless -fno-strict-aliasing is used ../../../../../../../newlib-2.5.0/newlib/libc/time/lcltime.c:58:3: warning: type of 'malloc' does not match original declaration [-Wlto-type-mismatch] /Volumes/code/external/newlib-cygwin/newlib/libc/include/malloc.h:37:13: note: return value type mismatch extern _PTR malloc _PARAMS ((size_t)); ^ /Volumes/code/external/newlib-cygwin/newlib/libc/include/malloc.h:37:13: note: 'malloc' was previously declared here /Volumes/code/external/newlib-cygwin/newlib/libc/include/malloc.h:37:13: note: code may be misoptimized unless -fno-strict-aliasing is used ../../../../../../../newlib-2.5.0/newlib/libc/string/strsignal.c:70:3: warning: type of 'malloc' does not match original declaration [-Wlto-type-mismatch] /Volumes/code/external/newlib-cygwin/newlib/libc/include/malloc.h:37:13: note: return value type mismatch extern _PTR malloc _PARAMS ((size_t)); ^ /Volumes/code/external/newlib-cygwin/newlib/libc/include/malloc.h:37:13: note: 'malloc' was previously declared here /Volumes/code/external/newlib-cygwin/newlib/libc/include/malloc.h:37:13: note: code may be misoptimized unless -fno-strict-aliasing is used Including the proper headers elminates the implicit function signatures and these warnings.
* Add release message for commit 688d943Corinna Vinschen2017-01-141-0/+4
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Always try to write complete incoming buffer on pipes and fifosCorinna Vinschen2017-01-141-1/+1
| | | | | | | | | | | | | | | | | | | | This patch fixes the following problem: Commit 9636c426 refactored the pipe code especially to make sure to call WriteFile only with chunks matching the maximum atomic write count. This accidentally introduced a small change in behaviour on blocking pipes due to the success case falling through into the error case. Rather then writing atomic chunks until all bytes are written, the code immediately broke from the loop after writing the first chunk, basically the same as in case of non-blocking writes. This behaviour is not compliant to POSIX which requires "Write requests to a pipe or FIFO [...] * If the O_NONBLOCK flag is clear, a write request may cause the thread to block, but on normal completion it shall return nbyte." Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add _POSIX_SHARED_MEMORY_OBJECTSGedare Bloom2017-01-131-1/+1
|
* Expand comments on padding used by nano_mallocJoe Seymour2017-01-131-14/+37
| | | | | | | | | | | | | | This patch adds further comments to nano-mallocr.c, to more comprehensively explain how padding works in the malloc_chunk structure. It was originally discussed in the following thread: https://sourceware.org/ml/newlib/2017/msg00031.html 2017-01-13 Joe Seymour <joe.s@somniumtech.com> newlib/ * libc/stdlib/nano-mallocr.c (malloc_chunk, get_chunk_from_ptr) (nano_malloc): Add comments.
* Add release message for commit 6ed4753Corinna Vinschen2017-01-121-1/+2
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* rename: Refactor "new file already exists and rename fails" caseCorinna Vinschen2017-01-121-20/+27
| | | | | | | | | | | | | | | | | | | | | | | If newfile already exists and is in use, trying to overwrite it with NtSetInformationFile(FileRenameInformation) fails exactly as if we don't have the permissions to delete it. Unfortunately the return code is the same STATUS_ACCESS_DENIED, so we have no way to distinguish these cases. What we do here so far is to start a transaction to delete newfile. If this open fails with a transactional error we stop the transaction and retry opening the file without transaction. But, here's the problem: If newfile is in use, NtOpenFile(oldfile) naturally does NOT fail with a transactional error. Rather, the subsequent call to unlink_nt(newfile) does, because there's another handle open to newfile outside a transaction. However, the code does not check if unlink_nt fails with a transactional error and so fails to retry without transaction. This patch recifies the problem and checks unlink_nt's status as well. Refactor code to get rid of goto into another code block. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* FAST_CWD: adjust the initial search scopeJohannes Schindelin2017-01-121-2/+2
| | | | | | | | | | | | A *very* recent Windows build adds more code to the preamble of RtlGetCurrentDirectory_U() so that the previous heuristic failed to find the call to the locking routine. This only affects the 64-bit version of ntdll, where the 0xe8 byte is now found at offset 40, not the 32-bit version. However, let's just double the area we search for said byte for good measure. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
* Fix sys/reent.h to remove use of DEBUG flag.Jeff Johnston2017-01-101-2/+2
| | | | | | | | - use of DEBUG flag is non-standard and interferes with other project's using same flag - change to be _REENT_CHECK_DEBUG which means the flag is allowing debugging of _REENT_CHECK macros - use #ifdef instead of #if
* Fix formatting in pinfo.ccCorinna Vinschen2017-01-101-7/+8
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Document latest Cygwin changesCorinna Vinschen2017-01-102-0/+18
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add Erik Bray to Cygwin CONTRIBUTORSCorinna Vinschen2017-01-101-0/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add a /proc/<pid>/environ proc file handler, analogous to /proc/<pid>/cmdline.Erik M. Bray2017-01-101-0/+22
|
* Add a _pinfo.environ() method analogous to _pinfo.cmdline(), and others.Erik M. Bray2017-01-102-3/+84
| | | | | | | Returns the process's environment concatenated into a single block of null-terminated strings, along with the length of the environment block. Adds an associated PICOM_ENVIRON commune_process handler.
* Move the core environment parsing of environ_init into a new ↵Erik M. Bray2017-01-102-35/+51
| | | | | | | | | | win32env_to_cygenv function. win32env_to_cygwenv handles converting wchar to char and some other minor taks. Optionally it handles converting any paths in variables to posix paths. This will be useful for implementing /proc/<pid>/environ
* Return the correct value for getsockopt(SO_REUSEADDR) after setting ↵Erik M. Bray2017-01-091-0/+8
| | | | setsockopt(SO_REUSEADDR, 1).
* Fix versions in documentation (manually for now)Corinna Vinschen2017-01-092-4/+4
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add pthread_setname_np() and pthread_getname_np()Sebastian Huber2017-01-091-0/+6
| | | | | | | The pthread_setname_np() and pthread_getname_np() are GNU extensions and provided by glibc. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Fix incorrect cast in nano mallocJoe Seymour2017-01-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As described in nano-mallocr.c, chunks of heap are represented in memory as a size (of type long), followed by some optional padding containing a negative offset to size, followed by the data area. get_chunk_from_ptr is responsible for taking a pointer to the data area (as returned by malloc) and finding the start of the chunk. It does this by assuming there is no padding and trying to read the size, if the size is negative then it uses that as an offset to find the true size. Crucially, it reads the padding area as a long. nano_malloc is responsible for populating the optional padding area. It does so by casting a pointer to an (int *) and writing the negative offset into it. This means that padding is being written as an int but read as a long. On msp430 an int is 2 bytes, while a long is 4 bytes. This means that 2 bytes are written to the padding, but 4 bytes are read from it: it has only been partially initialised. nano_malloc is the default malloc implementation for msp430. This patch changes the cast from (int *) to (long *). The change to nano_malloc has has been observed to fix a TI Energia project that had been malfunctioning because malloc was returning invalid addresses. The change to nano_memalign is based entirely on code inspection. I've built and tested as follows: Configured (gcc+newlib) with: --target=msp430-elf --enable-languages=c gcc testsuite variations: msp430-sim/-mcpu=msp430 msp430-sim/-mcpu=msp430x msp430-sim/-mcpu=msp430x/-mlarge/-mdata-region=either/-mcode-region=either msp430-sim/-mhwmult=none msp430-sim/-mhwmult=f5series My testing has shown no regressions, however I don't know if the gcc testsuite provides sufficient coverage for this patch? I don't have write access, so if this patch is acceptable after review, I would appreciate it if someone would commit it for me. Thanks, 2017-01-XX Joe Seymour <joe.s@somniumtech.com> newlib/ * libc/stdlib/nano-mallocr.c (nano_malloc): Fix incorrect cast. (nano_memalign): Likewise.
* RTEMS: Add user-defined name to thread queuesSebastian Huber2017-01-091-1/+65
| | | | | | | | Add a user-defined name to the self-contained synchronization objects in order to make system diagnostics, tracing and debugging more user friendly. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Don't free statically allocated sys_privsCorinna Vinschen2017-01-091-2/+2
| | | | | | | | | commit 67fd2101 introduced a bad bug. Changing sys_privs to a static area and just returning a pointer is nice... *if* the calling code doesn't call free() on it. Make sure callers check pointer for sys_privs and refrain from calling free, if so. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Bump release to 2.5.0 for yearly snapshot.newlib-2_5_0Jeff Johnston2016-12-22111-1154/+1123
|
* This is an attempt to fix the problem described here:Jeff Johnston2016-12-224-23/+122
| | | | | | | | | | | | | | | | | | | | | | | | https://sourceware.org/ml/newlib/2016/msg01139.html https://gcc.gnu.org/ml/gcc/2016-12/msg00010.html There is no change if libtool is used. Some run-time support libraries provided by GCC (e.g. libgomp) use configure checks to detect certain features, e.g. availability of thread-local storage. The configure script generates a test program and tries to compile and link it. It should use target libraries and startfiles of the build tree if available and not random ones from the installation prefix for this procedure. The search directories specified by -B are a bit special, see for_each_path() in gcc.c of the GCC sources. First a search is performed on all search paths with the multilib directory appended (if desired), then a second search is performed on demand with the base directory only. For each multilib there is a "newlib" subdirectory. This directory is specified by a -B option for the support libraries. In order to find the newlib artifacts (ctr0.o, libc.a, libg.a and libm.a) they must be located in a proper multilib subdirectory withing the build directory. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* RTEMS: Increase SEM_VALUE_MAXSebastian Huber2016-12-201-1/+1
| | | | | | | RTEMS defined SEM_VALUE_MAX to 32767 unlike other systems like FreeBSD and glibc. A common value is INT_MAX. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Export getentropy and getrandom callsCorinna Vinschen2016-12-165-6/+96
| | | | | | | | | | | | getentropy per OpenBSD http://man.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man2/getentropy.2 getrandom per Linux http://man7.org/linux/man-pages/man2/getrandom.2.html Note that GRND_NONBLOCK is not handled
* Remove extraneous float casts in wcstod.c.Corinna Vinschen2016-12-161-2/+2
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Remove extraneous float casts in strtod.c.Jeff Johnston2016-12-161-2/+2
|
* 2016-12-15 Kyrylo Tkachov <kyrylo.tkachov@arm.com>cygwin-2_6_1-releaseJeff Johnston2016-12-152-8/+29
| | | | | | | | * libc/stdlib/strtod.c (strtof_l): Set errno to ERANGE when double to float conversion results in infinity. (strtof): Likewise. * libc/stdlib/wcstod.c (wcstof_l): Likewise. (wcstof): Likewise.
* 2016-12-15 Giuseppe Musumeci <giuseppe.musumeci@broadcom.com>Jeff Johnston2016-12-151-2/+2
| | | | | | | | | | | | | | __sinit initialises some common file descriptors as line buffered and relies on the first users of such FDs to call __smakebuf_r. If __smakebuf_r realises there's no space for a buffer (malloc returns NULL), it makes them unbuffered. However, while setting the __SNBF bit, it doesn't clear the __SLBF bit in the flags. Depending on the order in which functions check buffering flags in the FD, sometime they assume it's line buffered (e.g. __sfvwrite_r), trashing application memory that's not really been allocated to them. This patch solves the problem by clearing the unbuffered/line buffered flag when setting the line buffered/unbuffered flag.
* Fix some broken links in Cygwin FAQJon Turney2016-12-154-11/+7
| | | | | | | | | | | | | | | | GNU no longer encourages the use of documentation mirrors, to avoid referring to obsolete documentation. Also www.fsf.org/manual/ is just a redirect to www.gnu.org/manual/ Links to using-utils.html #fragments are no longer correct as each utility is now a separate page, since 646745cb. indiana.edu seems to have moved XLiveCD information, without a redirect. Linking to clean_setup.pl on cygwin.com doesn't work, as direct downloads aren't allowed, so instead state where it can be found on a mirror. Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
* Define RtlGenRandom correctly in ntsecapi.h wrapperCorinna Vinschen2016-12-145-6/+29
| | | | | | | Include ntsecapi.h where required and just redefine RtlGenRandom correctly in the ntsecapi.h wrapper. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Rearrange RNG code slightlyCorinna Vinschen2016-12-134-34/+52
| | | | | | | | | | | | | | | In preparation of exporting getentropy/getrandom to userspace, rearrange code a bit: - Define RtlGenRandom in ntdll.h. - Drop calls to getentropy in favor of RtlGenRandom (fhandler_socket, fhandler_dev_random). - Add try/except blocks in fhandler_dev_random to return EFAULT rather than crashing if buffer pointer is invalid. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Add release messages for last two checkinsCorinna Vinschen2016-12-131-0/+7
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix incorrect path conversion on non-existent files on network sharesCorinna Vinschen2016-12-131-0/+7
| | | | | | | | | | | | | | | | | | NtOpenFile/NtCreateFile on non-existent paths on network drives has a bug. Assuming a path Z:\dir\file. Further assuming that Z:\dir does not exist. The first NtOpenFile("Z:\dir\file") correctly returns STATUS_OBJECT_PATH_NOT_FOUND. Subsequent calls incorrectly return STATUS_OBJECT_NAME_NOT_FOUND. This appears to be some kind of caching behaviour. Waiting a while before repeating the call correctly returns STATUS_OBJECT_PATH_NOT_FOUND again. This patch works around the observed misbehaviour. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Check for .exe file in cygwin_conv_pathCorinna Vinschen2016-12-131-2/+2
| | | | | | | | So far, when converting from POSIX to Windows notation, cygwin_conv_path fails to check for .exe suffix, so /path/foo did not return /path/foo.exe even if this file exists. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Big-endian fix for memcpy-armv7m.SJulian Brown2016-12-121-0/+8
| | | | | | | | In the case of memcpy-armv7m.S being built for a big-endian multilib (including armv7 without a specific profile), realignment code made assumptions about the byte ordering being little-endian. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix 'make man' for parallel makeJon Turney2016-12-065-0/+16
| | | | | | | | Ensure the Python Lex/Yacc (PLY) cache used by makedocbook is initialized before it is used by parallelizable rules to make the DocBook XML, as it appears that these can collide in cache generation, leading to errors. Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
* Cygwin 2.6.1: Add missing release textCorinna Vinschen2016-12-061-4/+16
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add <devctl.h> per POSIX 1003.26-2003Joel Sherrill2016-12-053-0/+55
|
* Add missing crt0 symbols for RTEMSSebastian Huber2016-12-051-0/+5
| | | | | | | In order to enable proper detection of thread-local storage availability we have to provide some symbols on ARM. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* path_conv: When encountering a ".(/)+" sequence, skip *all* slashesCorinna Vinschen2016-11-281-1/+6
| | | | | | | The original code only skipped the "./", but missed to test if more trailing slashes are present. This in turn leads to invalid conversion. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Enforce no arguments for __get_current_locale/__get_C_localeCorinna Vinschen2016-11-281-2/+2
| | | | | | Remember: foo() != foo(void) Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Correct argument to __get_current_locale.Douglas2016-11-281-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Self-contained pthread_spinlock_t for RTEMSSebastian Huber2016-11-241-1/+5
| | | | | | | | | | | | | | | | | | | | Turn pthread_spinlock_t into a self-contained object. On uni-processor configurations, interrupts are disabled in the lock/trylock operations and the previous interrupt status is restored in the corresponding unlock operations. On SMP configurations, a ticket lock is a acquired and released in addition. See also: https://devel.rtems.org/ticket/2674 This implementation is simple and efficient. However, this test case of the Linux Test Project would fail due to call of printf() and sleep() during spin lock ownership: https://github.com/linux-test-project/ltp/blob/master/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_lock/1-2.c Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* regex: Fix typo in CHaddrangeCorinna Vinschen2016-11-241-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* cygutils: Fix resource leak in get_short_pathsCorinna Vinschen2016-11-241-0/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix typo in kill(1)Corinna Vinschen2016-11-241-1/+1
| | | | | | | buf is just a local buffer, sig is ultimately pointing to the signal string. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* _pinfo::set_ctty: Check potential NULL pointer in debug_printf statementCorinna Vinschen2016-11-241-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Eliminate unused parameter from path_conv::eq_workerCorinna Vinschen2016-11-241-12/+4
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Remove redundant check for NULL pointer in cygwin_exception::dump_exceptionCorinna Vinschen2016-11-241-7/+4
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>