/* This function returns the address of the current thread errno.  */
int* _rt_errno(void)
/* This function returns the address of the current thread errno.  */
int* _rt_errno(void)
{
    rt_thread_t tid = RT_NULL;
    if (rt_interrupt_get_nest() != 0)
    {
        return (int *)&__rt_errno;
    }
    tid = rt_thread_self();
    if (tid != RT_NULL)
    {
        return (int *) & (tid->error);
    }
    return (int *)&__rt_errno;
}