You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2015/11/17 10:16:34 UTC

[1/3] celix git commit: CELIX-272: Remove secure_getenv usage for BSD/APPLE

Repository: celix
Updated Branches:
  refs/heads/feature/CELIX-272_synchronization_service_registry 03da4ec92 -> 530b4f72d


CELIX-272: Remove secure_getenv usage for BSD/APPLE


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/cf7acae8
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/cf7acae8
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/cf7acae8

Branch: refs/heads/feature/CELIX-272_synchronization_service_registry
Commit: cf7acae85a859ca39c7ebccc9e9b16004742dc4c
Parents: 03da4ec
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Tue Nov 17 10:14:26 2015 +0100
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Tue Nov 17 10:14:26 2015 +0100

----------------------------------------------------------------------
 dependency_manager/private/src/dm_shell_list_command.c | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/cf7acae8/dependency_manager/private/src/dm_shell_list_command.c
----------------------------------------------------------------------
diff --git a/dependency_manager/private/src/dm_shell_list_command.c b/dependency_manager/private/src/dm_shell_list_command.c
index ed2c5f0..e174061 100644
--- a/dependency_manager/private/src/dm_shell_list_command.c
+++ b/dependency_manager/private/src/dm_shell_list_command.c
@@ -43,7 +43,11 @@ void dmListCommand_execute(bundle_context_pt context, char * line, FILE *out, FI
     array_list_pt servRefs = NULL;
     int i;
     bundleContext_getServiceReferences(context, DM_INFO_SERVICE_NAME ,NULL, &servRefs);
+#if defined(BSD) || defined(__APPLE__)
+    char *term = getenv("TERM");
+#else
     char *term = secure_getenv("TERM");
+#endif
     bool colors = false;
     if (strcmp("xterm-256color", term) == 0) {
         colors = true;


[2/3] celix git commit: CELIX-272: Introduce celixThread_once code and call in the framwork to ensure a single logger initialization even when runnign mutiple frameworks in the same process

Posted by pn...@apache.org.
CELIX-272: Introduce celixThread_once code and call in the framwork to ensure a single logger initialization even when runnign mutiple frameworks in the same process


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/a40693f5
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/a40693f5
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/a40693f5

Branch: refs/heads/feature/CELIX-272_synchronization_service_registry
Commit: a40693f56a416085f2bca95aa4018ea89057cbe1
Parents: cf7acae
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Tue Nov 17 10:15:05 2015 +0100
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Tue Nov 17 10:15:05 2015 +0100

----------------------------------------------------------------------
 framework/private/src/framework.c    | 10 ++++++++--
 utils/private/src/celix_threads.c    |  4 ++++
 utils/public/include/celix_threads.h |  3 +++
 3 files changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/a40693f5/framework/private/src/framework.c
----------------------------------------------------------------------
diff --git a/framework/private/src/framework.c b/framework/private/src/framework.c
index 84f428d..0823781 100644
--- a/framework/private/src/framework.c
+++ b/framework/private/src/framework.c
@@ -152,6 +152,13 @@ typedef struct request *request_pt;
 
 framework_logger_pt logger;
 
+//TODO introduce a counter + mutex to control the freeing of the logger when mutiple threads are running a framework.
+static celix_thread_once_t loggerInit = CELIX_THREAD_ONCE_INIT;
+static void framework_loggerInit(void) {
+    logger = malloc(sizeof(*logger));
+    logger->logFunction = frameworkLogger_log;
+}
+
 #ifdef _WIN32
     #define handle_t HMODULE
     #define fw_openLibrary(path) LoadLibrary(path)
@@ -179,8 +186,7 @@ celix_status_t framework_create(framework_pt *framework, properties_pt config) {
 
     logger = hashMap_get(config, "logger");
     if (logger == NULL) {
-        logger = malloc(sizeof(*logger));
-        logger->logFunction = frameworkLogger_log;
+        celixThread_once(&loggerInit, framework_loggerInit);
     }
 
     *framework = (framework_pt) malloc(sizeof(**framework));

http://git-wip-us.apache.org/repos/asf/celix/blob/a40693f5/utils/private/src/celix_threads.c
----------------------------------------------------------------------
diff --git a/utils/private/src/celix_threads.c b/utils/private/src/celix_threads.c
index bec374b..64bdf5b 100644
--- a/utils/private/src/celix_threads.c
+++ b/utils/private/src/celix_threads.c
@@ -178,3 +178,7 @@ celix_status_t celixThreadRwlockAttr_create(celix_thread_rwlockattr_t *attr) {
 celix_status_t celixThreadRwlockAttr_destroy(celix_thread_rwlockattr_t *attr) {
 	return pthread_rwlockattr_destroy(attr);
 }
+
+celix_status_t celixThread_once(celix_thread_once_t *once_control, void (*init_routine)(void)) {
+	return pthread_once(once_control, init_routine);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/a40693f5/utils/public/include/celix_threads.h
----------------------------------------------------------------------
diff --git a/utils/public/include/celix_threads.h b/utils/public/include/celix_threads.h
index 1e7a7ad..8fc043e 100644
--- a/utils/public/include/celix_threads.h
+++ b/utils/public/include/celix_threads.h
@@ -38,6 +38,8 @@ struct celix_thread {
 	pthread_t thread;
 };
 
+typedef pthread_once_t celix_thread_once_t;
+#define CELIX_THREAD_ONCE_INIT PTHREAD_ONCE_INIT
 
 typedef struct celix_thread celix_thread_t;
 typedef pthread_attr_t celix_thread_attr_t;
@@ -101,5 +103,6 @@ celix_status_t celixThreadCondition_wait(celix_thread_cond_t *cond, celix_thread
 celix_status_t celixThreadCondition_broadcast(celix_thread_cond_t *cond);
 celix_status_t celixThreadCondition_signal(celix_thread_cond_t *cond);
 
+celix_status_t celixThread_once(celix_thread_once_t *once_control, void (*init_routine)(void));
 
 #endif /* CELIX_THREADS_H_ */


[3/3] celix git commit: CELIX-272: Add missing return status

Posted by pn...@apache.org.
CELIX-272: Add missing return status


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/530b4f72
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/530b4f72
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/530b4f72

Branch: refs/heads/feature/CELIX-272_synchronization_service_registry
Commit: 530b4f72df23291e2764542fad09f96293e769cc
Parents: a40693f
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Tue Nov 17 10:15:52 2015 +0100
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Tue Nov 17 10:15:52 2015 +0100

----------------------------------------------------------------------
 remote_shell/private/src/shell_mediator.c | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/530b4f72/remote_shell/private/src/shell_mediator.c
----------------------------------------------------------------------
diff --git a/remote_shell/private/src/shell_mediator.c b/remote_shell/private/src/shell_mediator.c
index 9b08035..ae4de10 100644
--- a/remote_shell/private/src/shell_mediator.c
+++ b/remote_shell/private/src/shell_mediator.c
@@ -81,6 +81,8 @@ celix_status_t shellMediator_stop(shell_mediator_pt instance) {
 	if (tracker != NULL) {
 		serviceTracker_close(tracker);
 	}
+
+    return CELIX_SUCCESS;
 }
 
 celix_status_t shellMediator_destroy(shell_mediator_pt instance) {