From 6b1328777821dd686113a22bf9204bac91d7e4b7 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 13 Jan 2017 11:28:35 +0100 Subject: configure: Remove envlock support This is provided by Newlib itself. --- cpukit/configure.ac | 3 - cpukit/libcsupport/Makefile.am | 2 +- cpukit/libcsupport/src/envlock.c | 120 --------------------------------------- 3 files changed, 1 insertion(+), 124 deletions(-) delete mode 100644 cpukit/libcsupport/src/envlock.c diff --git a/cpukit/configure.ac b/cpukit/configure.ac index 444b886d63..407093dcaf 100644 --- a/cpukit/configure.ac +++ b/cpukit/configure.ac @@ -70,9 +70,6 @@ AC_CHECK_DECLS([funlockfile],[AC_CHECK_FUNCS([funlockfile])],,[#include ]) # Newlib proprietary -AC_CHECK_HEADERS([envlock.h]) -AC_CHECK_DECLS([__env_lock],,,[#include ]) -AC_CHECK_DECLS([__env_unlock],,,[#include ]) AC_CHECK_TYPES([struct _Thread_queue_Queue],[],[],[#include ]) AC_CHECK_MEMBER([struct _Thread_queue_Queue._name],[],[RTEMS_TOOL_CHAIN_ERROR],[#include ]) diff --git a/cpukit/libcsupport/Makefile.am b/cpukit/libcsupport/Makefile.am index 7110e9f594..43d34c4a23 100644 --- a/cpukit/libcsupport/Makefile.am +++ b/cpukit/libcsupport/Makefile.am @@ -139,7 +139,7 @@ libcsupport_a_SOURCES += src/printertask.c libcsupport_a_SOURCES += $(LIBC_GLUE_C_FILES) $(PASSWORD_GROUP_C_FILES) \ $(TERMINAL_IDENTIFICATION_C_FILES) $(SYSTEM_CALL_C_FILES) \ - $(DIRECTORY_SCAN_C_FILES) $(ID_C_FILES) src/envlock.c \ + $(DIRECTORY_SCAN_C_FILES) $(ID_C_FILES) \ $(TERMIOS_C_FILES) src/getpagesize.c src/getrusage.c src/posix_devctl.c diff --git a/cpukit/libcsupport/src/envlock.c b/cpukit/libcsupport/src/envlock.c deleted file mode 100644 index 48cb2e0f1b..0000000000 --- a/cpukit/libcsupport/src/envlock.c +++ /dev/null @@ -1,120 +0,0 @@ -/** - * @file - * - * @brief Global Environment Lock Support - * @ingroup libcsupport - */ - -/* - * Author: Till Straumann , 3/2002 - */ - -/* provide locking for the global environment 'environ' */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#if defined(HAVE_ENVLOCK_H) \ - && defined(HAVE_DECL___ENV_LOCK) && defined(HAVE_DECL___ENV_UNLOCK) - -#include - -#include -#include - -#include - -/* - * NOTES: - * - although it looks like a classical multiple-readers / single writer (MRSW) - * locking problem, we still use a single lock for the following reasons: - * 1) newlib has no provision / hook for calling different locking routines - * from setenv/putenv and getenv, respectively. - * 2) MRSW involves calling several semaphore-primitives, even in the most - * likely case of a first-reader's access. This probably takes more CPU - * time than just waiting until another reader is done; environment - * access is fast. - * - the lock implementation must allow nesting (same thread may call - * lock-lock-unlock-unlock). - * - NEWLIB-1.8.2 has an ugly BUG: if environ is NULL, _findenv_r() bails - * out leaving the lock held :-( - * - * Used by the following functions: - * findenv_r(), setenv_r(), and unsetenv_r() which are called by - * getenv(), getenv_r(), setenv(), and unsetenv(). - * - */ - -#if defined(ENVLOCK_DEDICATED_MUTEX) -static rtems_id envLock=0; - -static void -__rtems_envlock_init(void) -{ - extern char **environ; - rtems_status_code rc; - - if (envLock) /* already initialized */ - return; - - assert(environ && "MUST have non-NULL 'environ' due to newlib bug"); - - rc = rtems_semaphore_create( - rtems_build_name('E','N','V','S'), - 1, - RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY, - 0, - &envLock); - if (RTEMS_SUCCESSFUL!=rc) - rtems_fatal_error_occurred(rc); -} - -void -__env_lock(struct _reent *r) -{ - /* Do lazy init */ - if (!envLock) - __rtems_envlock_init(); - /* - * Must not use a semaphore before pre-tasking hook is called. - * - it will corrupt memory :-( - */ - - if (_Thread_Executing) - rtems_semaphore_obtain(envLock, RTEMS_WAIT, RTEMS_NO_TIMEOUT); -} - -void -__env_unlock(struct _reent *r) -{ - /* - * Must not use a semaphore before pre-tasking hook is called. - * - it will corrupt memory :-( - */ - if (_Thread_Executing) - rtems_semaphore_release(envLock); -} -#else - -/* - * Reuse the libio mutex -- it is always initialized before we - * could possibly run. - */ - -#include - -void -__env_lock(struct _reent *r RTEMS_UNUSED) -{ - rtems_libio_lock(); -} - -void -__env_unlock(struct _reent *r RTEMS_UNUSED) -{ - rtems_libio_unlock(); -} -#endif /* ENVLOCK_DEDICATED_MUTEX */ - -#endif /* HAVE_ENVLOCK_H ... */ -- cgit v1.2.3