Commit Graph

5 Commits

Author SHA1 Message Date
Thomas Preud'homme fa55c610fa 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.
2017-02-13 17:04:17 -05:00
Freddie Chopin 0eeb4c1d32 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
2017-02-06 16:55:09 -05:00
Thomas Preudhomme cd1b883526 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
2017-01-25 12:36:05 +01:00
Yaakov Selkowitz 8b8952064c Fix compile with GCC 5 -Werror
newlib/libc/
	* stdio64/freopen64.c: Include <string.h> for memset().
	* stdlib/quick_exit.c: Include <unistd.h> for _exit().
	* string/gnu_basename.c (__gnu_basename): Fix discarded const
	qualifier warning.
	* stdlib/strtold.c: Include "mprec.h" for _strtorx_r().

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-02-12 10:16:06 -06:00
Sebastian Huber d67f71ab85 C11 quick_exit() support for <stdlib.h>
Import some <stdlib.h> function declarations from latest FreeBSD and
implement them.  I am not sure if we should call the global reent
cleanup in quick_exit() similar to exit().

newlib/ChangeLog
2015-10-14  Sebastian Huber  <sebastian.huber@embedded-brains.de>

	* libc/include/stdlib.h (at_quick_exit): Declare.
	(quick_exit): Likewise.
	* libc/stdlib/Makefile.am (GENERAL_SOURCES): Add
	quick_exit.c.
	* libc/stdlib/Makefile.in: Regenerate.
	* libc/stdlib/quick_exit.c: New.
2015-10-19 14:09:17 +02:00