Skip to content

Commit 351bfb7

Browse files
committed
add error log when tid depleted, and return correct errno when clone failed
1 parent ba105bc commit 351bfb7

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

components/lwp/lwp_syscall.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -1935,6 +1935,9 @@ long _sys_clone(void *arg[])
19351935
rt_thread_startup(thread);
19361936
return (long)tid;
19371937
fail:
1938+
rt_err_t _errno = GET_ERRNO();
1939+
RT_ASSERT(_errno < 0);
1940+
19381941
lwp_tid_put(tid);
19391942
if (thread)
19401943
{
@@ -1944,7 +1947,7 @@ long _sys_clone(void *arg[])
19441947
{
19451948
lwp_ref_dec(lwp);
19461949
}
1947-
return GET_ERRNO();
1950+
return (long)_errno;
19481951
}
19491952

19501953
rt_weak long sys_clone(void *arg[])

components/lwp/lwp_tid.c

+6
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ int lwp_tid_get(void)
8888
current_tid = tid;
8989
}
9090
lwp_mutex_release_safe(&tid_lock);
91+
92+
if (tid <= 0)
93+
{
94+
LOG_E("resource TID has been depleted.");
95+
}
96+
9197
return tid;
9298
}
9399

0 commit comments

Comments
 (0)