mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-22 19:44:24 +08:00
@@ -890,9 +890,9 @@ int access(const char *path, int amode)
|
||||
char *getcwd(char *buf, size_t size)
|
||||
{
|
||||
#ifdef DFS_USING_WORKDIR
|
||||
rt_enter_critical();
|
||||
dfs_lock();
|
||||
strncpy(buf, working_directory, size);
|
||||
rt_exit_critical();
|
||||
dfs_unlock();
|
||||
#else
|
||||
rt_kprintf(NO_WORKING_DIR);
|
||||
#endif
|
||||
|
||||
+21
-2
@@ -25,8 +25,10 @@
|
||||
* 2012-06-02 lgnq add list_memheap
|
||||
* 2012-10-22 Bernard add MS VC++ patch.
|
||||
* 2016-06-02 armink beautify the list_thread command
|
||||
* 2018-11-22 Jesven list_thread add smp support
|
||||
*/
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
@@ -87,14 +89,26 @@ static long _list_thread(struct rt_list_node *list)
|
||||
|
||||
maxlen = object_name_maxlen(item_title, list);
|
||||
|
||||
#ifdef RT_USING_SMP
|
||||
rt_kprintf("%-*.s cpu pri status sp stack size max used left tick error\n", maxlen, item_title); object_split(maxlen);
|
||||
rt_kprintf( " --- --- ------- ---------- ---------- ------ ---------- ---\n");
|
||||
#else
|
||||
rt_kprintf("%-*.s pri status sp stack size max used left tick error\n", maxlen, item_title); object_split(maxlen);
|
||||
rt_kprintf( " --- ------- ---------- ---------- ------ ---------- ---\n");
|
||||
#endif /*RT_USING_SMP*/
|
||||
for (node = list->next; node != list; node = node->next)
|
||||
{
|
||||
rt_uint8_t stat;
|
||||
thread = rt_list_entry(node, struct rt_thread, list);
|
||||
rt_kprintf("%-*.*s %3d ", maxlen, RT_NAME_MAX, thread->name, thread->current_priority);
|
||||
#ifdef RT_USING_SMP
|
||||
if (thread->oncpu != RT_CPU_DETACHED)
|
||||
rt_kprintf("%-*.*s %3d %3d ", maxlen, RT_NAME_MAX, thread->name, thread->oncpu, thread->current_priority);
|
||||
else
|
||||
rt_kprintf("%-*.*s N/A %3d ", maxlen, RT_NAME_MAX, thread->name, thread->current_priority);
|
||||
|
||||
#else
|
||||
rt_kprintf("%-*.*s %3d ", maxlen, RT_NAME_MAX, thread->name, thread->current_priority);
|
||||
#endif /*RT_USING_SMP*/
|
||||
stat = (thread->stat & RT_THREAD_STAT_MASK);
|
||||
if (stat == RT_THREAD_READY) rt_kprintf(" ready ");
|
||||
else if (stat == RT_THREAD_SUSPEND) rt_kprintf(" suspend");
|
||||
@@ -130,10 +144,15 @@ static long _list_thread(struct rt_list_node *list)
|
||||
|
||||
long list_thread(void)
|
||||
{
|
||||
rt_ubase_t level;
|
||||
struct rt_object_information *info;
|
||||
long ret;
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
info = rt_object_get_information(RT_Object_Class_Thread);
|
||||
return _list_thread(&info->object_list);
|
||||
ret = _list_thread(&info->object_list);
|
||||
rt_hw_interrupt_enable(level);
|
||||
return ret;
|
||||
}
|
||||
FINSH_FUNCTION_EXPORT(list_thread, list thread);
|
||||
MSH_CMD_EXPORT(list_thread, list thread);
|
||||
|
||||
Reference in New Issue
Block a user