summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorShicheng Chu <[email protected]>2023-04-04 21:06:27 +0800
committerGitHub <[email protected]>2023-04-04 09:06:27 -0400
commit93f3cb30e48d5de341bda09fa806120e2bc3f3ad (patch)
treeb23b2343674fecbc3fdfbcd49220488da21472ed /components
parent8a52e65013d1abb7cfc032409000533000ccd0c2 (diff)
[kernel] 将rt_thread结构体改为显式继承rt_object (#7131)
Diffstat (limited to 'components')
-rw-r--r--components/finsh/cmd.c12
-rw-r--r--components/libc/compilers/common/cstdlib.c2
-rw-r--r--components/libc/posix/libdl/dlmodule.c10
-rw-r--r--components/lwp/arch/x86/i386/lwp_arch.c4
-rw-r--r--components/lwp/lwp.c2
-rw-r--r--components/lwp/lwp_pid.c8
-rw-r--r--components/lwp/lwp_syscall.c8
-rw-r--r--components/net/lwip/port/sys_arch.c2
-rw-r--r--components/utilities/ulog/syslog/syslog.c2
-rw-r--r--components/utilities/ulog/ulog.c2
-rw-r--r--components/vbus/watermark_queue.c2
11 files changed, 27 insertions, 27 deletions
diff --git a/components/finsh/cmd.c b/components/finsh/cmd.c
index 57b033cc57..a9a673101e 100644
--- a/components/finsh/cmd.c
+++ b/components/finsh/cmd.c
@@ -204,12 +204,12 @@ long list_thread(void)
#ifdef RT_USING_SMP
if (thread->oncpu != RT_CPU_DETACHED)
- rt_kprintf("%-*.*s %3d %3d %4d ", maxlen, RT_NAME_MAX, thread->name, thread->oncpu, thread->bind_cpu, thread->current_priority);
+ rt_kprintf("%-*.*s %3d %3d %4d ", maxlen, RT_NAME_MAX, thread->parent.name, thread->oncpu, thread->bind_cpu, thread->current_priority);
else
- rt_kprintf("%-*.*s N/A %3d %4d ", maxlen, RT_NAME_MAX, thread->name, thread->bind_cpu, thread->current_priority);
+ rt_kprintf("%-*.*s N/A %3d %4d ", maxlen, RT_NAME_MAX, thread->parent.name, thread->bind_cpu, thread->current_priority);
#else
- rt_kprintf("%-*.*s %3d ", maxlen, RT_NAME_MAX, thread->name, thread->current_priority);
+ rt_kprintf("%-*.*s %3d ", maxlen, RT_NAME_MAX, thread->parent.name, thread->current_priority);
#endif /*RT_USING_SMP*/
stat = (thread->stat & RT_THREAD_STAT_MASK);
if (stat == RT_THREAD_READY) rt_kprintf(" ready ");
@@ -256,7 +256,7 @@ static void show_wait_queue(struct rt_list_node *list)
for (node = list->next; node != list; node = node->next)
{
thread = rt_list_entry(node, struct rt_thread, tlist);
- rt_kprintf("%.*s", RT_NAME_MAX, thread->name);
+ rt_kprintf("%.*s", RT_NAME_MAX, thread->parent.name);
if (node->next != list)
rt_kprintf("/");
@@ -439,7 +439,7 @@ long list_mutex(void)
maxlen, RT_NAME_MAX,
m->parent.parent.name,
RT_NAME_MAX,
- m->owner->name,
+ m->owner->parent.name,
m->hold,
m->priority,
rt_list_len(&m->parent.suspend_thread));
@@ -452,7 +452,7 @@ long list_mutex(void)
maxlen, RT_NAME_MAX,
m->parent.parent.name,
RT_NAME_MAX,
- m->owner->name,
+ m->owner->parent.name,
m->hold,
m->priority,
rt_list_len(&m->parent.suspend_thread));
diff --git a/components/libc/compilers/common/cstdlib.c b/components/libc/compilers/common/cstdlib.c
index 4a978a106c..64bfbb10e0 100644
--- a/components/libc/compilers/common/cstdlib.c
+++ b/components/libc/compilers/common/cstdlib.c
@@ -20,7 +20,7 @@ void __rt_libc_exit(int status)
if (self != RT_NULL)
{
- LOG_W("thread:%s exit:%d!", self->name, status);
+ LOG_W("thread:%s exit:%d!", self->parent.name, status);
#ifdef RT_USING_PTHREADS
if(self->pthread_data != RT_NULL)
{
diff --git a/components/libc/posix/libdl/dlmodule.c b/components/libc/posix/libdl/dlmodule.c
index 723c8b7b73..eebc5be0f9 100644
--- a/components/libc/posix/libdl/dlmodule.c
+++ b/components/libc/posix/libdl/dlmodule.c
@@ -197,7 +197,7 @@ struct rt_dlmodule *dlmodule_create(void)
void dlmodule_destroy_subthread(struct rt_dlmodule *module, rt_thread_t thread)
{
- RT_ASSERT(thread->module_id == module);
+ RT_ASSERT(thread->parent.module_id== module);
/* lock scheduler to prevent scheduling in cleanup function. */
rt_enter_critical();
@@ -225,7 +225,7 @@ void dlmodule_destroy_subthread(struct rt_dlmodule *module, rt_thread_t thread)
rt_thread_free_sig(thread);
#endif
- if (thread->type & RT_Object_Class_Static)
+ if (thread->parent.type & RT_Object_Class_Static)
{
/* detach object */
rt_object_detach((rt_object_t)thread);
@@ -409,7 +409,7 @@ struct rt_dlmodule *dlmodule_self(void)
tid = rt_thread_self();
if (tid)
{
- ret = (struct rt_dlmodule*) tid->module_id;
+ ret = (struct rt_dlmodule*) tid->parent.module_id;
}
return ret;
@@ -555,7 +555,7 @@ struct rt_dlmodule* dlmodule_exec(const char* pgname, const char* cmd, int cmd_s
module->stack_size, module->priority, 10);
if (tid)
{
- tid->module_id = module;
+ tid->parent.module_id= module;
module->main_thread = tid;
rt_thread_startup(tid);
@@ -732,7 +732,7 @@ struct rt_dlmodule* dlmodule_exec_custom(const char* pgname, const char* cmd, in
module->stack_size, module->priority, 10);
if (tid)
{
- tid->module_id = module;
+ tid->parent.module_id= module;
module->main_thread = tid;
rt_thread_startup(tid);
diff --git a/components/lwp/arch/x86/i386/lwp_arch.c b/components/lwp/arch/x86/i386/lwp_arch.c
index aa93abd3f6..9f9e846582 100644
--- a/components/lwp/arch/x86/i386/lwp_arch.c
+++ b/components/lwp/arch/x86/i386/lwp_arch.c
@@ -48,7 +48,7 @@ int arch_expand_user_stack(void *addr)
else /* map failed, send signal SIGSEGV */
{
#ifdef RT_USING_SIGNALS
- dbg_log(DBG_ERROR, "[fault] thread %s mapped addr %p failed!\n", rt_thread_self()->name, addr);
+ dbg_log(DBG_ERROR, "[fault] thread %s mapped addr %p failed!\n", rt_thread_self()->parent.name, addr);
lwp_thread_kill(rt_thread_self(), SIGSEGV);
ret = 1; /* return 1, will return back to intr, then check exit */
#endif
@@ -57,7 +57,7 @@ int arch_expand_user_stack(void *addr)
else /* not stack, send signal SIGSEGV */
{
#ifdef RT_USING_SIGNALS
- dbg_log(DBG_ERROR, "[fault] thread %s access unmapped addr %p!\n", rt_thread_self()->name, addr);
+ dbg_log(DBG_ERROR, "[fault] thread %s access unmapped addr %p!\n", rt_thread_self()->parent.name, addr);
lwp_thread_kill(rt_thread_self(), SIGSEGV);
ret = 1; /* return 1, will return back to intr, then check exit */
#endif
diff --git a/components/lwp/lwp.c b/components/lwp/lwp.c
index 7fe3230ac5..0af0399cc6 100644
--- a/components/lwp/lwp.c
+++ b/components/lwp/lwp.c
@@ -1034,7 +1034,7 @@ void lwp_cleanup(struct rt_thread *tid)
return;
}
- LOG_I("cleanup thread: %s, stack_addr: %08X", tid->name, tid->stack_addr);
+ LOG_I("cleanup thread: %s, stack_addr: %08X", tid->parent.name, tid->stack_addr);
level = rt_hw_interrupt_disable();
lwp = (struct rt_lwp *)tid->lwp;
diff --git a/components/lwp/lwp_pid.c b/components/lwp/lwp_pid.c
index caff790f5e..d22c3f3d68 100644
--- a/components/lwp/lwp_pid.c
+++ b/components/lwp/lwp_pid.c
@@ -709,11 +709,11 @@ static void print_thread_info(struct rt_thread* thread, int maxlen)
#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);
+ rt_kprintf("%-*.*s %3d %3d ", maxlen, RT_NAME_MAX, thread->parent.name, thread->oncpu, thread->current_priority);
else
- rt_kprintf("%-*.*s N/A %3d ", maxlen, RT_NAME_MAX, thread->name, thread->current_priority);
+ rt_kprintf("%-*.*s N/A %3d ", maxlen, RT_NAME_MAX, thread->parent.name, thread->current_priority);
#else
- rt_kprintf("%-*.*s %3d ", maxlen, RT_NAME_MAX, thread->name, thread->current_priority);
+ rt_kprintf("%-*.*s %3d ", maxlen, RT_NAME_MAX, thread->parent.name, thread->current_priority);
#endif /*RT_USING_SMP*/
stat = (thread->stat & RT_THREAD_STAT_MASK);
@@ -787,7 +787,7 @@ long list_process(void)
thread = threads[index];
level = rt_hw_interrupt_disable();
- if ((thread->type & ~RT_Object_Class_Static) != RT_Object_Class_Thread)
+ if ((thread->parent.type & ~RT_Object_Class_Static) != RT_Object_Class_Thread)
{
rt_hw_interrupt_enable(level);
continue;
diff --git a/components/lwp/lwp_syscall.c b/components/lwp/lwp_syscall.c
index da9812d947..77eb77f556 100644
--- a/components/lwp/lwp_syscall.c
+++ b/components/lwp/lwp_syscall.c
@@ -1525,7 +1525,7 @@ long _sys_clone(void *arg[])
goto fail;
}
- thread = rt_thread_create(self->name,
+ thread = rt_thread_create(self->parent.name,
RT_NULL,
RT_NULL,
self->stack_size,
@@ -1713,7 +1713,7 @@ sysret_t _sys_fork(void)
/* create thread */
self_thread = rt_thread_self();
- thread = rt_thread_create(self_thread->name,
+ thread = rt_thread_create(self_thread->parent.name,
RT_NULL,
RT_NULL,
self_thread->stack_size,
@@ -2361,7 +2361,7 @@ sysret_t sys_execve(const char *path, char *const argv[], char *const envp[])
/* load ok, now set thread name and swap the data of lwp and new_lwp */
level = rt_hw_interrupt_disable();
- rt_strncpy(thread->name, run_name + last_backslash, RT_NAME_MAX);
+ rt_strncpy(thread->parent.name, run_name + last_backslash, RT_NAME_MAX);
rt_pages_free(page, 0);
@@ -2420,7 +2420,7 @@ rt_err_t sys_thread_delete(rt_thread_t thread)
#else
rt_err_t ret = 0;
- if(thread->type != RT_Object_Class_Thread)
+ if(thread->parent.type != RT_Object_Class_Thread)
{
ret = -EINVAL;
goto __exit;
diff --git a/components/net/lwip/port/sys_arch.c b/components/net/lwip/port/sys_arch.c
index 145958a0fb..066a75e92a 100644
--- a/components/net/lwip/port/sys_arch.c
+++ b/components/net/lwip/port/sys_arch.c
@@ -525,7 +525,7 @@ void sys_arch_unprotect(sys_prot_t pval)
void sys_arch_assert(const char *file, int line)
{
rt_kprintf("\nAssertion: %d in %s, thread %s\n",
- line, file, rt_thread_self()->name);
+ line, file, rt_thread_self()->parent.name);
RT_ASSERT(0);
}
diff --git a/components/utilities/ulog/syslog/syslog.c b/components/utilities/ulog/syslog/syslog.c
index 474a524b89..213379ee4b 100644
--- a/components/utilities/ulog/syslog/syslog.c
+++ b/components/utilities/ulog/syslog/syslog.c
@@ -213,7 +213,7 @@ rt_weak rt_size_t syslog_formater(char *log_buf, int level, const char *tag, rt_
/* is not in interrupt context */
if (rt_interrupt_get_nest() == 0)
{
- log_len += ulog_strcpy(log_len, log_buf + log_len, rt_thread_self()->name);
+ log_len += ulog_strcpy(log_len, log_buf + log_len, rt_thread_self()->parent.name);
}
else
{
diff --git a/components/utilities/ulog/ulog.c b/components/utilities/ulog/ulog.c
index 49c111a41c..c83d40dbfe 100644
--- a/components/utilities/ulog/ulog.c
+++ b/components/utilities/ulog/ulog.c
@@ -352,7 +352,7 @@ rt_weak rt_size_t ulog_head_formater(char *log_buf, rt_uint32_t level, const cha
const char *thread_name = "N/A";
if (rt_thread_self())
{
- thread_name = rt_thread_self()->name;
+ thread_name = rt_thread_self()->parent.name;
}
name_len = rt_strnlen(thread_name, RT_NAME_MAX);
rt_strncpy(log_buf + log_len, thread_name, name_len);
diff --git a/components/vbus/watermark_queue.c b/components/vbus/watermark_queue.c
index 15c42d8080..6108046905 100644
--- a/components/vbus/watermark_queue.c
+++ b/components/vbus/watermark_queue.c
@@ -46,7 +46,7 @@ void rt_wm_que_dump(struct rt_watermark_queue *wg)
thread = rt_list_entry(wg->suspended_threads.next,
struct rt_thread,
tlist);
- rt_kprintf(" %.*s", RT_NAME_MAX, thread->name);
+ rt_kprintf(" %.*s", RT_NAME_MAX, thread->parent.name);
}
rt_kprintf("\n");
}