summaryrefslogtreecommitdiff
path: root/daemons
diff options
context:
space:
mode:
authorMounesh Sutar <sutar.mounesh@gmail.com>2017-11-02 16:09:31 +0530
committerMounesh Sutar <sutar.mounesh@gmail.com>2017-11-06 18:05:18 +0530
commit1c87ad9804f6bd33e395b81a4bd6dd99971b200f (patch)
tree7463ed0d55bd4a3e4ba601d510c944211af29177 /daemons
parent63d6e10eac6ba0d3b3b4c19b43b7a1d41a138cae (diff)
downloadOpen-AVB-1c87ad9804f6bd33e395b81a4bd6dd99971b200f.tar.gz
daemons: segmentation fault while executing maap_daemon on aarch64 platform.
For aarch64 platforms PTHREAD_STACK_MIN is 128k, according to it setting THREAD_STACK_SIZE to value of PTHREAD_STACK_MIN instead of 64k.
Diffstat (limited to 'daemons')
-rw-r--r--daemons/maap/linux/src/maap_log_linux.c17
-rw-r--r--daemons/shaper/src/shaper_log_linux.c16
2 files changed, 27 insertions, 6 deletions
diff --git a/daemons/maap/linux/src/maap_log_linux.c b/daemons/maap/linux/src/maap_log_linux.c
index 2d6f02b3..35dcfcbc 100644
--- a/daemons/maap/linux/src/maap_log_linux.c
+++ b/daemons/maap/linux/src/maap_log_linux.c
@@ -27,6 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdarg.h>
#include <string.h>
#include <inttypes.h>
+#include <limits.h>
#include "platform.h"
#include "maap_log_queue.h"
@@ -74,7 +75,14 @@ extern void *loggingThreadFn(void *pv);
THREAD_TYPE(loggingThread);
THREAD_DEFINITON(loggingThread);
-#define THREAD_STACK_SIZE 65536
+#if !defined(PTHREAD_STACK_MIN)
+#error "PTHREAD_STACK_MIN variable not defined"
+#elif (PTHREAD_STACK_MIN > 65536)
+#define THREAD_STACK_SIZE PTHREAD_STACK_MIN
+#else
+#define THREAD_STACK_SIZE 65536
+#endif
+
#define loggingThread_THREAD_STK_SIZE THREAD_STACK_SIZE
static MUTEX_HANDLE_ALT(gLogMutex);
@@ -211,13 +219,16 @@ void maapLogInit(void)
loggingThreadRunning = TRUE;
THREAD_CREATE(loggingThread, loggingThread, NULL, loggingThreadFn, NULL);
THREAD_CHECK_ERROR(loggingThread, "Thread / task creation failed", errResult);
- if (errResult); // Already reported
+ if (errResult) {
+ loggingThreadRunning = FALSE;
+ MAAP_LOG_ERROR("Could not log data: loggingThread create failure");
+ }
}
}
void maapLogExit()
{
- if (MAAP_LOG_FROM_THREAD) {
+ if (MAAP_LOG_FROM_THREAD && loggingThreadRunning ) {
loggingThreadRunning = FALSE;
THREAD_JOIN(loggingThread, NULL);
}
diff --git a/daemons/shaper/src/shaper_log_linux.c b/daemons/shaper/src/shaper_log_linux.c
index d68a79a2..38017c38 100644
--- a/daemons/shaper/src/shaper_log_linux.c
+++ b/daemons/shaper/src/shaper_log_linux.c
@@ -27,6 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdarg.h>
#include <string.h>
#include <inttypes.h>
+#include <limits.h>
#include "platform.h"
#include "shaper_log_queue.h"
@@ -74,7 +75,13 @@ extern void *loggingThreadFn(void *pv);
THREAD_TYPE(loggingThread);
THREAD_DEFINITON(loggingThread);
-#define THREAD_STACK_SIZE 65536
+#if !defined(PTHREAD_STACK_MIN)
+#error "PTHREAD_STACK_MIN variable not defined"
+#elif (PTHREAD_STACK_MIN > 65536)
+#define THREAD_STACK_SIZE PTHREAD_STACK_MIN
+#else
+#define THREAD_STACK_SIZE 65536
+#endif
#define loggingThread_THREAD_STK_SIZE THREAD_STACK_SIZE
static MUTEX_HANDLE_ALT(gLogMutex);
@@ -217,13 +224,16 @@ void shaperLogInit(void)
loggingThreadRunning = TRUE;
THREAD_CREATE(loggingThread, loggingThread, NULL, loggingThreadFn, NULL);
THREAD_CHECK_ERROR(loggingThread, "Thread / task creation failed", errResult);
- if (errResult) {} // Already reported
+ if (errResult) {
+ loggingThreadRunning = FALSE;
+ SHAPER_LOG_ERROR("Could not log data: loggingThread create failure");
+ }
}
}
void shaperLogExit()
{
- if (SHAPER_LOG_FROM_THREAD) {
+ if (SHAPER_LOG_FROM_THREAD && loggingThreadRunning) {
loggingThreadRunning = FALSE;
THREAD_JOIN(loggingThread, NULL);
}