libc/localtime: tz_lock/unlock should not touch tcb except FLAT

Causing kernel build report undefined reference 'g_nx_initstate'
Also protect build, as user elf have no access of kernel objects.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
This commit is contained in:
buxiasen
2025-02-19 16:48:50 +08:00
committed by Matteo Golin
parent 63a036ff6a
commit bda9ab9287
+2 -2
View File
@@ -392,7 +392,7 @@ static int tzparse(FAR const char *name, FAR struct state_s *sp,
static inline void tz_lock(FAR rmutex_t *lock)
{
#ifndef __KERNEL__
#if defined(__KERNEL__) || defined(CONFIG_BUILD_FLAT)
if (up_interrupt_context() || (sched_idletask() && OSINIT_IDLELOOP()))
{
return;
@@ -404,7 +404,7 @@ static inline void tz_lock(FAR rmutex_t *lock)
static inline void tz_unlock(FAR rmutex_t *lock)
{
#ifndef __KERNEL__
#if defined(__KERNEL__) || defined(CONFIG_BUILD_FLAT)
if (up_interrupt_context() || (sched_idletask() && OSINIT_IDLELOOP()))
{
return;