/* This function gets the global errno for the current thread.  */
rt_err_t rt_get_errno(void)
/* This function gets the global errno for the current thread.  */
rt_err_t rt_get_errno(void)
{
    rt_thread_t tid = RT_NULL;
    if (rt_interrupt_get_nest() != 0)
    {
        return __rt_errno;
    }
    tid = rt_thread_self();
    if (tid == RT_NULL)
    {
        return __rt_errno;
    }
    return tid->error;
}