]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
7 years agocygserver: Only print basename of source in debug output to raise readability
Corinna Vinschen [Fri, 24 Mar 2017 15:12:52 +0000 (16:12 +0100)]
cygserver: Only print basename of source in debug output to raise readability

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agocygserver: Seralize debug output to stdout to raise readability
Corinna Vinschen [Fri, 24 Mar 2017 15:12:00 +0000 (16:12 +0100)]
cygserver: Seralize debug output to stdout to raise readability

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agodlfcn: Remove stray debug output newlib-snapshot-20170323
Corinna Vinschen [Wed, 22 Mar 2017 10:10:15 +0000 (11:10 +0100)]
dlfcn: Remove stray debug output

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoRename <sys/_locale.h> to <xlocale.h>
Yaakov Selkowitz [Tue, 21 Mar 2017 20:21:30 +0000 (15:21 -0500)]
Rename <sys/_locale.h> to <xlocale.h>

The locale_t type is provided by <xlocale.h> on Linux, FreeBSD, and Darwin.
While, like on some of those systems, it is automatically included by
<locale.h> with the proper feature test macros, its presence under this
particular name is still presumed in real-world software.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
7 years agoARM: Fix IEEE-754 sqrt implementation
Sebastian Huber [Tue, 21 Mar 2017 14:47:34 +0000 (15:47 +0100)]
ARM: Fix IEEE-754 sqrt implementation

Older GCC (e.g. 4.9.3) seem to define __ARM_FP even in case soft-float
is used.

7 years agoARM: Optimize IEEE-754 sqrt implementation
Sebastian Huber [Tue, 21 Mar 2017 07:49:00 +0000 (08:49 +0100)]
ARM: Optimize IEEE-754 sqrt implementation

Use the vsqrt.f64 and vsqrt.f32 instructions if available.

7 years agoCygwin: dlfcn: Fix reference counting
Corinna Vinschen [Tue, 21 Mar 2017 13:30:24 +0000 (14:30 +0100)]
Cygwin: dlfcn: Fix reference counting

The original dll_init code was living under the wrong assumption that
dll_dllcrt0_1 and in turn dll_list::alloc will be called for each
LoadLibrary call.  The same wrong assumption was made for
cygwin_detach_dll/dll_list::detach called via FreeLibrary.

In reality, dll_dllcrt0_1 gets only called once at first LoadLibrary
and cygwin_detach_dll once at last FreeLibrary.

In effect, reference counting for DLLs was completely broken after fork:

  parent:
    l1 = dlopen ("lib1");  // LoadLibrary, LoadCount = 1
    l2 = dlopen ("lib1");  // LoadLibrary, LoadCount = 2

    fork ();               // LoadLibrary in the child, LoadCount = 1!
      child:
        dlclose (l1);      // FreeLibrary actually frees the lib
        x = dlsym (l2);    // SEGV

* Move reference counting to dlopen/dlclose since only those functions
  have to keep track of loading/unloading DLLs in the application context.

* Remove broken accounting code from dll_list::alloc and dll_list::detach.

* Fix error handling in dlclose.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agolibc/string/strsignal.c: Use of || not && lead to dead code.
Joel Sherrill [Wed, 15 Mar 2017 17:04:22 +0000 (12:04 -0500)]
libc/string/strsignal.c: Use of || not && lead to dead code.

Coverity Id: 175333

7 years agortems/crt0.c: getentropy() stub did not return a value.
Joel Sherrill [Wed, 15 Mar 2017 14:37:22 +0000 (09:37 -0500)]
rtems/crt0.c: getentropy() stub did not return a value.

Coverity Scan ID: 175342

7 years agoAdd release message for commit 973f766f6
Corinna Vinschen [Tue, 14 Mar 2017 15:54:57 +0000 (16:54 +0100)]
Add release message for commit 973f766f6

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoRevert "Add release message for commit 973f766f6"
Corinna Vinschen [Tue, 14 Mar 2017 15:52:20 +0000 (16:52 +0100)]
Revert "Add release message for commit 973f766f6"

This reverts commit 125852d77b65fe2155d0d5fa97e53fc9e2b29984.

Accidentally commited too much.

7 years agoAdd release message for commit 973f766f6
Corinna Vinschen [Tue, 14 Mar 2017 08:24:48 +0000 (09:24 +0100)]
Add release message for commit 973f766f6

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoFix duplocale (libc/locale/duplocale.c) which fails to properly call __loadlocale
Koichi Murase [Sat, 11 Mar 2017 16:27:26 +0000 (01:27 +0900)]
Fix duplocale (libc/locale/duplocale.c) which fails to properly call __loadlocale

Problem:

  After  passing  locales  created  by  'duplocale'   to   'uselocale',
  referencing   'MB_CUR_MAX',   which   is   actually   expanded    to
  '__locale_mb_cur_max()' by preprocessors, causes segmentation faults.
  Direct use of locales from 'newlocale' does not  cause  the  problem.
  This is the problem of 'duplocale'.

  $ echo $LANG
  ja_JP.UTF-8
  $ cat test.c
  #include <stdlib.h>
  #include <locale.h>

  volatile int var;

  int main(void) {
    locale_t const loc = newlocale(LC_ALL_MASK, "", NULL);
    locale_t const dup = duplocale(loc);
    locale_t const old = uselocale(dup);
    var = MB_CUR_MAX; /* <-- crashes here */
    uselocale(old);
    freelocale(dup);
    freelocale(loc);
    return 0;
  }
  $ gcc test.c
  $ ./a
  Segmentation fault (core dumped)

  # Note: "core dumped" in the above message was  actually written  in
  # Japanese, but I translated the part to post a mail in English.

Bug:

  In the beginning of '__loadlocale' (newlib/libc/locale/locale.c:501),
  there is a code which checks if the operations can be skipped:

  > /* Avoid doing everything twice if nothing has changed. */
  > if (!strcmp (new_locale, loc->categories[category]))
  >   return loc->categories[category];

  While,   in   the   function   '_duplocale_r'    (newlib/libc/locale/
  duplocale.c), '__loadlocale'  is  called  as  in  the  quoted  codes:

  > /* If the object is not a "C" locale category, copy it.  Just call
  >    __loadlocale.  It knows what to do to replicate the category. */
  > tmp_locale.lc_cat[i].ptr = NULL;
  > tmp_locale.lc_cat[i].buf = NULL;
  > if (!__loadlocale (&tmp_locale, i, tmp_locale.categories[i]))
  >   goto error;

  This call of '__loadlocale' results in the skip check being

    !strcmp(tmp_locale.categories[i], tmp_locale.categories[i]),

  which is always true. This  means  that  the  actual  operations  of
  '__loadLocale' will never be performed for 'duplocale'.

Fix:

  The call of '__loadlocale' in '_duplocale_r' is modified.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoExtend 2.8.0 release text
Corinna Vinschen [Sun, 12 Mar 2017 11:21:40 +0000 (12:21 +0100)]
Extend 2.8.0 release text

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoImplement fhandler_dev_null::write to workaround a problem with NUL
Corinna Vinschen [Sun, 12 Mar 2017 11:17:43 +0000 (12:17 +0100)]
Implement fhandler_dev_null::write to workaround a problem with NUL

Windows NUL device returns only the lower 32 bit of the number of
bytes written.  Implement a fake write function to ignore the underlying
NUL device.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoReturn value from write is ssize_t, not int
Corinna Vinschen [Sun, 12 Mar 2017 11:16:23 +0000 (12:16 +0100)]
Return value from write is ssize_t, not int

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agogetrandom: it's MIN, not MAX
Yaakov Selkowitz [Sat, 11 Mar 2017 09:01:47 +0000 (10:01 +0100)]
getrandom: it's MIN, not MAX

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoBelatedly bump Cygwin DLL version to 2.8.0
Corinna Vinschen [Fri, 10 Mar 2017 19:50:35 +0000 (20:50 +0100)]
Belatedly bump Cygwin DLL version to 2.8.0

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoDrop now unused child_info_fork::from_main
Corinna Vinschen [Fri, 10 Mar 2017 19:45:19 +0000 (20:45 +0100)]
Drop now unused child_info_fork::from_main

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agofork: Don't copy _main_tls->local_clib from *_impure_ptr
Corinna Vinschen [Fri, 10 Mar 2017 19:44:53 +0000 (20:44 +0100)]
fork: Don't copy _main_tls->local_clib from *_impure_ptr

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>
7 years ago_dll_crt0: Drop incorrect check for being started from parent main thread
Corinna Vinschen [Fri, 10 Mar 2017 19:28:09 +0000 (20:28 +0100)]
_dll_crt0: Drop incorrect check for being started from parent main thread

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>
7 years agoerrno: Stop using _impure_ptr->_errno completely
Corinna Vinschen [Fri, 10 Mar 2017 19:21:09 +0000 (20:21 +0100)]
errno: Stop using _impure_ptr->_errno completely

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>
7 years agoDrop redundant brackets in call to _reclaim_reent
Corinna Vinschen [Fri, 10 Mar 2017 19:16:48 +0000 (20:16 +0100)]
Drop redundant brackets in call to _reclaim_reent

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoImplement dladdr() (partially)
Jon Turney [Mon, 6 Mar 2017 18:30:45 +0000 (18:30 +0000)]
Implement dladdr() (partially)

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>
7 years agoyield: Don't lower thread priority, it leads to starvation
Corinna Vinschen [Wed, 8 Mar 2017 16:44:15 +0000 (17:44 +0100)]
yield: Don't lower thread priority, it leads to starvation

...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>
7 years agoCygwin: Emit correct errno EAGAIN if we can't create another thread
Corinna Vinschen [Wed, 8 Mar 2017 16:43:23 +0000 (17:43 +0100)]
Cygwin: Emit correct errno EAGAIN if we can't create another thread

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoExport timingsafe_bcmp and timingsafe_memcmp
Jon Turney [Mon, 6 Mar 2017 17:54:42 +0000 (17:54 +0000)]
Export timingsafe_bcmp and timingsafe_memcmp

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
7 years agoDocument pthread_cond_wait change in release notes
Corinna Vinschen [Tue, 7 Mar 2017 14:18:03 +0000 (15:18 +0100)]
Document pthread_cond_wait change in release notes

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoCygwin: pthread_cond_wait: Do as Linux and BSD do.
Corinna Vinschen [Tue, 7 Mar 2017 14:15:47 +0000 (15:15 +0100)]
Cygwin: pthread_cond_wait: Do as Linux and BSD do.

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>
7 years agocwdstuff: Don't leave from setting the CWD prematurely on init
Corinna Vinschen [Fri, 3 Mar 2017 12:55:55 +0000 (13:55 +0100)]
cwdstuff: Don't leave from setting the CWD prematurely on init

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>
7 years agoPreserve order of dlopen'd modules in dll_list::topsort newlib-snapshot-20170228
David Allsopp [Mon, 27 Feb 2017 17:06:34 +0000 (17:06 +0000)]
Preserve order of dlopen'd modules in dll_list::topsort

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>
7 years agoAdd 2.7.1 release file
Corinna Vinschen [Fri, 24 Feb 2017 19:57:02 +0000 (20:57 +0100)]
Add 2.7.1 release file

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoGenerate output with Unix line endings even from Mingw64 utils
Corinna Vinschen [Fri, 24 Feb 2017 19:55:14 +0000 (20:55 +0100)]
Generate output with Unix line endings even from Mingw64 utils

This affects cygcheck and strace.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoBump Cygwin version to 2.7.1
Corinna Vinschen [Fri, 24 Feb 2017 19:51:50 +0000 (20:51 +0100)]
Bump Cygwin version to 2.7.1

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agofix parallel build for version.cc and winver.o
Michael Haubenwallner [Thu, 16 Feb 2017 15:57:40 +0000 (16:57 +0100)]
fix parallel build for version.cc and winver.o

Creating both version.cc and winver.o at once really should run once only.

7 years agoUpdate makedocbook for bd547490
Jon Turney [Tue, 14 Feb 2017 20:01:48 +0000 (20:01 +0000)]
Update makedocbook for bd547490

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

7 years agoFix elf-nano.specs to work without -save-temps
Thomas Preud'homme [Wed, 15 Feb 2017 10:51:54 +0000 (10:51 +0000)]
Fix elf-nano.specs to work without -save-temps

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.

7 years agoImprove wording on special characters
Kenneth Nellis [Tue, 14 Feb 2017 08:46:56 +0000 (09:46 +0100)]
Improve wording on special characters

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoAllow locking routine to be retargeted
Thomas Preud'homme [Tue, 25 Oct 2016 16:38:19 +0000 (17:38 +0100)]
Allow locking routine to be retargeted

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.

7 years agoOnly define static locks in multithreaded mode
Thomas Preud'homme [Mon, 30 Jan 2017 11:23:00 +0000 (11:23 +0000)]
Only define static locks in multithreaded mode

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.

7 years agoFix cpp invocation for C++ in nano spec
Thomas Preudhomme [Tue, 7 Feb 2017 16:58:27 +0000 (16:58 +0000)]
Fix cpp invocation for C++ in nano spec

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.

7 years agolibgloss: Remove duplicate definition of environ
Stafford Horne [Mon, 6 Feb 2017 14:38:40 +0000 (23:38 +0900)]
libgloss: Remove duplicate definition of environ

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.

7 years agolibgloss: or1k: If available call the init for init_array
Stafford Horne [Mon, 6 Feb 2017 14:38:39 +0000 (23:38 +0900)]
libgloss: or1k: If available call the init for init_array

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.

7 years agoor1k: Make open reentrant
Olof Kindgren [Mon, 6 Feb 2017 14:38:38 +0000 (23:38 +0900)]
or1k: Make open reentrant

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);}

7 years agoAdd IBM Security Trusteer Rapport to BLODA list cygwin-2_7_0-release
Corinna Vinschen [Sun, 12 Feb 2017 11:15:32 +0000 (12:15 +0100)]
Add IBM Security Trusteer Rapport to BLODA list

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoCygwin: create separate bits/byteswap.h
Yaakov Selkowitz [Wed, 8 Feb 2017 23:01:34 +0000 (17:01 -0600)]
Cygwin: create separate bits/byteswap.h

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>
7 years agoUnify names of all lock objects
Freddie Chopin [Sun, 29 Jan 2017 09:27:17 +0000 (10:27 +0100)]
Unify names of all lock objects

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

7 years agoMake anchors stable in generated Cygwin HTML documentation
Jon Turney [Sat, 7 Jan 2017 20:21:59 +0000 (20:21 +0000)]
Make anchors stable in generated Cygwin HTML documentation

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>
7 years agoAdd release message for commit 609d2b2
Corinna Vinschen [Fri, 3 Feb 2017 20:54:25 +0000 (21:54 +0100)]
Add release message for commit 609d2b2

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoFix limited Internet speeds caused by inappropriate socket buffering
Corinna Vinschen [Fri, 3 Feb 2017 20:46:01 +0000 (21:46 +0100)]
Fix limited Internet speeds caused by inappropriate socket buffering

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>
7 years agoAdd release message for commit a1529738
Jon Turney [Tue, 31 Jan 2017 20:16:10 +0000 (20:16 +0000)]
Add release message for commit a1529738

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
7 years agoFix handling of '+' by 'cygcheck -p'
Jon Turney [Mon, 30 Jan 2017 15:04:28 +0000 (15:04 +0000)]
Fix handling of '+' by 'cygcheck -p'

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>
7 years agoAdd release message for commit 095cac4
Corinna Vinschen [Tue, 31 Jan 2017 14:40:03 +0000 (15:40 +0100)]
Add release message for commit 095cac4

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoCygwin: Add IUTF8 termios iflag
Corinna Vinschen [Tue, 31 Jan 2017 14:36:24 +0000 (15:36 +0100)]
Cygwin: Add IUTF8 termios iflag

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>
7 years agoCommitted, libgloss: hook up cris-elf to the initfini-array support.
Hans-Peter Nilsson [Sun, 29 Jan 2017 20:23:32 +0000 (21:23 +0100)]
Committed, libgloss: hook up cris-elf to the initfini-array support.

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.

7 years agoarm: Fix addressing in optpld macro
Kyrill Tkachov [Thu, 26 Jan 2017 10:26:10 +0000 (10:26 +0000)]
arm: Fix addressing in optpld macro

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.

7 years agoarm: Remove RETURN macro
Pat Pannuto [Thu, 12 Jan 2017 04:50:19 +0000 (23:50 -0500)]
arm: Remove RETURN macro

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.

7 years agoarm: Remove optpld macro
Pat Pannuto [Thu, 12 Jan 2017 04:50:18 +0000 (23:50 -0500)]
arm: Remove optpld macro

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

7 years agoRemove unneeded references to arm_asm.h
Pat Pannuto [Thu, 12 Jan 2017 04:50:17 +0000 (23:50 -0500)]
Remove unneeded references to arm_asm.h

This should result in no functional changes, it simply removes references
to arm_asm.h that did not use anything from that file.

7 years agodevctl.h: Fix typo and include proper header
Sebastian Huber [Wed, 25 Jan 2017 06:13:54 +0000 (07:13 +0100)]
devctl.h: Fix typo and include proper header

Remove stray commas.  Include <sys/cdefs.h> for __restrict (includes
<stddef.h> indirectly).

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
7 years agoRTEMS: Harmonize MAXNAMLEN and NAME_MAX
Sebastian Huber [Wed, 25 Jan 2017 06:07:12 +0000 (07:07 +0100)]
RTEMS: Harmonize MAXNAMLEN and NAME_MAX

Override MAXNAMLEN definition in <dirent.h> and make sure it equals
NAME_MAX.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
7 years agoPrefix consistenly target-independent locks with __
Thomas Preudhomme [Tue, 24 Jan 2017 16:05:01 +0000 (16:05 +0000)]
Prefix consistenly target-independent locks with __

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

7 years agoAdd release message for commit ca3e3bc
Corinna Vinschen [Fri, 20 Jan 2017 09:33:12 +0000 (10:33 +0100)]
Add release message for commit ca3e3bc

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agonl_langinfo: Add NL_LOCALE_NAME macro
Eric Blake [Fri, 20 Jan 2017 02:45:16 +0000 (20:45 -0600)]
nl_langinfo: Add NL_LOCALE_NAME macro

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>
7 years agoCleanup fhandler_console::read for readability
Corinna Vinschen [Thu, 19 Jan 2017 20:58:05 +0000 (21:58 +0100)]
Cleanup fhandler_console::read for readability

- 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>
7 years agomiscfuncs.cc: Revert exclusion of inclusion of exception.h
Corinna Vinschen [Thu, 19 Jan 2017 20:51:38 +0000 (21:51 +0100)]
miscfuncs.cc: Revert exclusion of inclusion of exception.h

x86 still needs it.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoSimplify check for Alt-Numpad
Corinna Vinschen [Thu, 19 Jan 2017 20:41:21 +0000 (21:41 +0100)]
Simplify check for Alt-Numpad

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>
7 years agomiscfuncs.h: Drop now unneeded getentropy declaration
Corinna Vinschen [Thu, 19 Jan 2017 20:35:12 +0000 (21:35 +0100)]
miscfuncs.h: Drop now unneeded getentropy declaration

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agomiscfuncs.cc: Drop unneeded includes and unused global variable
Corinna Vinschen [Thu, 19 Jan 2017 20:11:55 +0000 (21:11 +0100)]
miscfuncs.cc: Drop unneeded includes and unused global variable

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agocheck_iovec: Change test to be more robust against invalid iovcnt values
Corinna Vinschen [Thu, 19 Jan 2017 20:11:22 +0000 (21:11 +0100)]
check_iovec: Change test to be more robust against invalid iovcnt values

Stop running wild if iovcnt is < 0 to begin with.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoDon't assert on sum of iov_len overflowing an ssize_t
Corinna Vinschen [Thu, 19 Jan 2017 20:08:53 +0000 (21:08 +0100)]
Don't assert on sum of iov_len overflowing an ssize_t

Rather return EINVAL per POSIX.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoMove string functions from miscfunc.cc to strfuncs.cc
Corinna Vinschen [Thu, 19 Jan 2017 20:01:41 +0000 (21:01 +0100)]
Move string functions from miscfunc.cc to strfuncs.cc

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoMove getentropy/getrandom into own file
Corinna Vinschen [Thu, 19 Jan 2017 19:58:06 +0000 (20:58 +0100)]
Move getentropy/getrandom into own file

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoFix copy/paste buglet in comment
Corinna Vinschen [Thu, 19 Jan 2017 18:22:47 +0000 (19:22 +0100)]
Fix copy/paste buglet in comment

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoAdd release message for commit 4652cc4
Corinna Vinschen [Thu, 19 Jan 2017 18:01:09 +0000 (19:01 +0100)]
Add release message for commit 4652cc4

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoHandle Alt+Numpad key sequences in console input and select
Corinna Vinschen [Thu, 19 Jan 2017 17:59:48 +0000 (18:59 +0100)]
Handle Alt+Numpad key sequences in console input and select

{p}select/{p}poll completely ignored Alt+Numpad key sequences in console
input which results in newer readline using pselect to fail handling such
sequences correctly.  See https://cygwin.com/ml/cygwin/2017-01/msg00135.html

During debugging and testing it turned out that while reading console
input, single key presses during an Alt+Numpad sequences where not
ignored, so ultimately a sequence like

  Alt-down Numpad-1 Numpad-2 Numpad-3

whihc is supposed to result in a single character in the input stream
will actually result in 4 chars in the input stream, three control
sequences and the actual character.

Both problems should be fixed by this patch.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agodevctl.h: Use __restrict not restrict
Joel Sherrill [Tue, 17 Jan 2017 22:10:58 +0000 (16:10 -0600)]
devctl.h: Use __restrict not restrict

7 years agoAdd missing headers to fix implicit function defns
Pat Pannuto [Mon, 16 Jan 2017 00:12:02 +0000 (19:12 -0500)]
Add missing headers to fix implicit function defns

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.

7 years agoAdd release message for commit 688d943
Corinna Vinschen [Sat, 14 Jan 2017 15:47:47 +0000 (16:47 +0100)]
Add release message for commit 688d943

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoAlways try to write complete incoming buffer on pipes and fifos
Corinna Vinschen [Sat, 14 Jan 2017 15:29:06 +0000 (16:29 +0100)]
Always try to write complete incoming buffer on pipes and fifos

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>
7 years agoAdd _POSIX_SHARED_MEMORY_OBJECTS
Gedare Bloom [Fri, 13 Jan 2017 19:07:40 +0000 (13:07 -0600)]
Add _POSIX_SHARED_MEMORY_OBJECTS

7 years agoExpand comments on padding used by nano_malloc
Joe Seymour [Fri, 13 Jan 2017 15:35:26 +0000 (15:35 +0000)]
Expand comments on padding used by nano_malloc

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.

7 years agoAdd release message for commit 6ed4753
Corinna Vinschen [Thu, 12 Jan 2017 21:46:21 +0000 (22:46 +0100)]
Add release message for commit 6ed4753

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agorename: Refactor "new file already exists and rename fails" case
Corinna Vinschen [Thu, 12 Jan 2017 21:42:11 +0000 (22:42 +0100)]
rename: Refactor "new file already exists and rename fails" case

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>
7 years agoFAST_CWD: adjust the initial search scope
Johannes Schindelin [Wed, 11 Jan 2017 13:21:31 +0000 (14:21 +0100)]
FAST_CWD: adjust the initial search scope

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>
7 years agoFix sys/reent.h to remove use of DEBUG flag.
Jeff Johnston [Mon, 9 Jan 2017 23:21:19 +0000 (18:21 -0500)]
Fix sys/reent.h to remove use of DEBUG flag.

- 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

7 years agoFix formatting in pinfo.cc
Corinna Vinschen [Tue, 10 Jan 2017 15:38:01 +0000 (16:38 +0100)]
Fix formatting in pinfo.cc

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoDocument latest Cygwin changes
Corinna Vinschen [Tue, 10 Jan 2017 15:33:21 +0000 (16:33 +0100)]
Document latest Cygwin changes

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoAdd Erik Bray to Cygwin CONTRIBUTORS
Corinna Vinschen [Tue, 10 Jan 2017 15:32:45 +0000 (16:32 +0100)]
Add Erik Bray to Cygwin CONTRIBUTORS

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoAdd a /proc/<pid>/environ proc file handler, analogous to /proc/<pid>/cmdline.
Erik M. Bray [Tue, 10 Jan 2017 15:03:10 +0000 (16:03 +0100)]
Add a /proc/<pid>/environ proc file handler, analogous to /proc/<pid>/cmdline.

7 years agoAdd a _pinfo.environ() method analogous to _pinfo.cmdline(), and others.
Erik M. Bray [Tue, 10 Jan 2017 15:03:09 +0000 (16:03 +0100)]
Add a _pinfo.environ() method analogous to _pinfo.cmdline(), and others.

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.

7 years agoMove the core environment parsing of environ_init into a new win32env_to_cygenv function.
Erik M. Bray [Tue, 10 Jan 2017 15:03:08 +0000 (16:03 +0100)]
Move the core environment parsing of environ_init into a new 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

7 years agoReturn the correct value for getsockopt(SO_REUSEADDR) after setting setsockopt(SO_REU...
Erik M. Bray [Mon, 9 Jan 2017 16:36:47 +0000 (17:36 +0100)]
Return the correct value for getsockopt(SO_REUSEADDR) after setting setsockopt(SO_REUSEADDR, 1).

7 years agoFix versions in documentation (manually for now)
Corinna Vinschen [Mon, 9 Jan 2017 15:22:02 +0000 (16:22 +0100)]
Fix versions in documentation (manually for now)

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoAdd pthread_setname_np() and pthread_getname_np()
Sebastian Huber [Mon, 9 Jan 2017 14:14:42 +0000 (15:14 +0100)]
Add pthread_setname_np() and pthread_getname_np()

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>
7 years agoFix incorrect cast in nano malloc
Joe Seymour [Tue, 3 Jan 2017 14:50:53 +0000 (14:50 +0000)]
Fix incorrect cast in nano malloc

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.

7 years agoRTEMS: Add user-defined name to thread queues
Sebastian Huber [Wed, 21 Dec 2016 07:56:41 +0000 (08:56 +0100)]
RTEMS: Add user-defined name to thread queues

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>
7 years agoDon't free statically allocated sys_privs
Corinna Vinschen [Mon, 9 Jan 2017 13:02:19 +0000 (14:02 +0100)]
Don't free statically allocated sys_privs

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>
7 years agoBump release to 2.5.0 for yearly snapshot. newlib-2_5_0
Jeff Johnston [Fri, 23 Dec 2016 02:33:54 +0000 (21:33 -0500)]
Bump release to 2.5.0 for yearly snapshot.

7 years agoThis is an attempt to fix the problem described here:
Jeff Johnston [Thu, 22 Dec 2016 19:50:00 +0000 (14:50 -0500)]
This is an attempt to fix the problem described here:

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>
This page took 0.07573 seconds and 5 git commands to generate.