diff --git a/include/nuttx/sched.h b/include/nuttx/sched.h index a80af294e02..beb202e5f47 100644 --- a/include/nuttx/sched.h +++ b/include/nuttx/sched.h @@ -45,6 +45,7 @@ #include #include #include +#include #include @@ -401,8 +402,6 @@ struct stackinfo_s * the struct task_group_s is free. */ -struct task_info_s; - #ifndef CONFIG_DISABLE_PTHREAD struct join_s; /* Forward reference */ /* Defined in sched/pthread/pthread.h */ @@ -480,6 +479,9 @@ struct task_group_s /* Thread local storage ***************************************************/ +#ifndef CONFIG_MM_KERNEL_HEAP + struct task_info_s tg_info_; +#endif FAR struct task_info_s *tg_info; /* POSIX Signal Control Fields ********************************************/ diff --git a/include/nuttx/tls.h b/include/nuttx/tls.h index 1e8e4724a8e..c57c311516e 100644 --- a/include/nuttx/tls.h +++ b/include/nuttx/tls.h @@ -27,7 +27,14 @@ #include -#include +#include +#include + +#include +#include + +#include +#include #include #include #include diff --git a/libs/libc/tls/tls_getinfo.c b/libs/libc/tls/tls_getinfo.c index 25ed601280c..8f65df48d91 100644 --- a/libs/libc/tls/tls_getinfo.c +++ b/libs/libc/tls/tls_getinfo.c @@ -28,6 +28,7 @@ #include #include +#include #if !defined(up_tls_info) && (defined(__KERNEL__) || !defined(CONFIG_TLS_ALIGNED)) diff --git a/sched/tls/task_initinfo.c b/sched/tls/task_initinfo.c index 15f2380ecb2..adbe84c185d 100644 --- a/sched/tls/task_initinfo.c +++ b/sched/tls/task_initinfo.c @@ -119,11 +119,15 @@ int task_init_info(FAR struct task_group_s *group) /* Allocate task info for group */ +#ifdef CONFIG_MM_KERNEL_HEAP info = group_zalloc(group, sizeof(struct task_info_s)); if (info == NULL) { return -ENOMEM; } +#else + info = &group->tg_info_; +#endif /* Initialize user space mutex */ diff --git a/sched/tls/task_uninitinfo.c b/sched/tls/task_uninitinfo.c index 9e7ae8b1524..4bd35b047cd 100644 --- a/sched/tls/task_uninitinfo.c +++ b/sched/tls/task_uninitinfo.c @@ -142,5 +142,7 @@ void task_uninit_info(FAR struct task_group_s *group) #endif /* CONFIG_FILE_STREAM */ nxmutex_destroy(&info->ta_lock); +#ifdef CONFIG_MM_KERNEL_HEAP group_free(group, info); +#endif } diff --git a/sched/tls/tls.h b/sched/tls/tls.h index 474085ba0f1..913761b74d8 100644 --- a/sched/tls/tls.h +++ b/sched/tls/tls.h @@ -25,6 +25,7 @@ * Included Files ****************************************************************************/ +#include #include #include