From d06420e1d7eda43fb7e76a726be7ee4a06018ed0 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sun, 21 Feb 2021 17:25:36 +0800 Subject: implement getuid and getpid --- components/libc/compilers/armlibc/sys/unistd.h | 3 +++ components/libc/compilers/common/unistd.c | 12 ++++++++++++ components/libc/compilers/dlib/sys/unistd.h | 3 +++ 3 files changed, 18 insertions(+) (limited to 'components/libc/compilers') diff --git a/components/libc/compilers/armlibc/sys/unistd.h b/components/libc/compilers/armlibc/sys/unistd.h index 73a73a267e..e1a1ad92f4 100644 --- a/components/libc/compilers/armlibc/sys/unistd.h +++ b/components/libc/compilers/armlibc/sys/unistd.h @@ -73,4 +73,7 @@ char * ttyname (int desc); unsigned int sleep(unsigned int seconds); int usleep(useconds_t usec); +uid_t getuid(void); +pid_t getpid(void); + #endif /* _SYS_UNISTD_H */ diff --git a/components/libc/compilers/common/unistd.c b/components/libc/compilers/common/unistd.c index 48e6beee4e..c7ad654da7 100644 --- a/components/libc/compilers/common/unistd.c +++ b/components/libc/compilers/common/unistd.c @@ -49,3 +49,15 @@ int usleep(useconds_t usec) return 0; } RTM_EXPORT(usleep); + +uid_t getuid(void) +{ + return -1; +} +RTM_EXPORT(getuid); + +pid_t getpid(void) +{ + return -1; +} +RTM_EXPORT(getuid); diff --git a/components/libc/compilers/dlib/sys/unistd.h b/components/libc/compilers/dlib/sys/unistd.h index 6d99cd6c55..5ca56ad136 100644 --- a/components/libc/compilers/dlib/sys/unistd.h +++ b/components/libc/compilers/dlib/sys/unistd.h @@ -47,4 +47,7 @@ char * ttyname (int desc); unsigned int sleep(unsigned int seconds); int usleep(useconds_t usec); +uid_t getuid(void); +pid_t getpid(void); + #endif /* _SYS_UNISTD_H */ -- cgit v1.3.1 From c13c00e45cb7af93c3e2b697555778844d1ebaec Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sun, 21 Feb 2021 18:01:29 +0800 Subject: update --- components/libc/compilers/armlibc/sys/unistd.h | 6 ++++- components/libc/compilers/common/unistd.c | 32 ++++++++++++++++++++++---- components/libc/compilers/dlib/sys/unistd.h | 6 ++++- 3 files changed, 38 insertions(+), 6 deletions(-) (limited to 'components/libc/compilers') diff --git a/components/libc/compilers/armlibc/sys/unistd.h b/components/libc/compilers/armlibc/sys/unistd.h index e1a1ad92f4..ee1e1c4db9 100644 --- a/components/libc/compilers/armlibc/sys/unistd.h +++ b/components/libc/compilers/armlibc/sys/unistd.h @@ -73,7 +73,11 @@ char * ttyname (int desc); unsigned int sleep(unsigned int seconds); int usleep(useconds_t usec); -uid_t getuid(void); pid_t getpid(void); +pid_t getppid(void); +uid_t getuid(void); +uid_t geteuid(void); +gid_t getgid(void); +gid_t getegid(void); #endif /* _SYS_UNISTD_H */ diff --git a/components/libc/compilers/common/unistd.c b/components/libc/compilers/common/unistd.c index c7ad654da7..b3efc386e9 100644 --- a/components/libc/compilers/common/unistd.c +++ b/components/libc/compilers/common/unistd.c @@ -50,14 +50,38 @@ int usleep(useconds_t usec) } RTM_EXPORT(usleep); +pid_t getpid(void) +{ + return 0; +} +RTM_EXPORT(getpid); + +pid_t getppid(void) +{ + return 0; +} +RTM_EXPORT(getppid); + uid_t getuid(void) { - return -1; + return 0; } RTM_EXPORT(getuid); -pid_t getpid(void) +uid_t geteuid(void) { - return -1; + return 0; } -RTM_EXPORT(getuid); +RTM_EXPORT(geteuid); + +gid_t getgid(void) +{ + return 0; +} +RTM_EXPORT(getgid); + +gid_t getegid(void) +{ + return 0; +} +RTM_EXPORT(getegid); diff --git a/components/libc/compilers/dlib/sys/unistd.h b/components/libc/compilers/dlib/sys/unistd.h index 5ca56ad136..5b86822635 100644 --- a/components/libc/compilers/dlib/sys/unistd.h +++ b/components/libc/compilers/dlib/sys/unistd.h @@ -47,7 +47,11 @@ char * ttyname (int desc); unsigned int sleep(unsigned int seconds); int usleep(useconds_t usec); -uid_t getuid(void); pid_t getpid(void); +pid_t getppid(void); +uid_t getuid(void); +uid_t geteuid(void); +gid_t getgid(void); +gid_t getegid(void); #endif /* _SYS_UNISTD_H */ -- cgit v1.3.1 From 3ebb48fae1c7765670bf248c80e12e657aa4f040 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sun, 21 Feb 2021 18:05:47 +0800 Subject: add comment --- components/libc/compilers/common/unistd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'components/libc/compilers') diff --git a/components/libc/compilers/common/unistd.c b/components/libc/compilers/common/unistd.c index b3efc386e9..0966242e55 100644 --- a/components/libc/compilers/common/unistd.c +++ b/components/libc/compilers/common/unistd.c @@ -52,6 +52,7 @@ RTM_EXPORT(usleep); pid_t getpid(void) { + /*TODO*/ return 0; } RTM_EXPORT(getpid); @@ -64,24 +65,24 @@ RTM_EXPORT(getppid); uid_t getuid(void) { - return 0; + return 0; /*ROOT*/ } RTM_EXPORT(getuid); uid_t geteuid(void) { - return 0; + return 0; /*ROOT*/ } RTM_EXPORT(geteuid); gid_t getgid(void) { - return 0; + return 0; /*ROOT*/ } RTM_EXPORT(getgid); gid_t getegid(void) { - return 0; + return 0; /*ROOT*/ } RTM_EXPORT(getegid); -- cgit v1.3.1 From 19ef11201620038724b9ce0c464f63713134fc2b Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sun, 21 Feb 2021 18:20:45 +0800 Subject: improve and beautify syscalls --- components/libc/compilers/armlibc/sys/types.h | 4 +- components/libc/compilers/dlib/sys/types.h | 4 +- components/libc/compilers/newlib/syscalls.c | 57 +++++++++++++++++---------- 3 files changed, 42 insertions(+), 23 deletions(-) (limited to 'components/libc/compilers') diff --git a/components/libc/compilers/armlibc/sys/types.h b/components/libc/compilers/armlibc/sys/types.h index 78fee1bb99..d1e457b36f 100644 --- a/components/libc/compilers/armlibc/sys/types.h +++ b/components/libc/compilers/armlibc/sys/types.h @@ -15,7 +15,9 @@ typedef int32_t clockid_t; typedef int32_t key_t; /* Used for interprocess communication. */ -typedef int32_t pid_t; /* Used for process IDs and process group IDs. */ +typedef int pid_t; /* Used for process IDs and process group IDs. */ +typedef unsigned short uid_t; +typedef unsigned short gid_t; #ifndef ARCH_CPU_64BIT typedef signed int ssize_t; /* Used for a count of bytes or an error indication. */ #else diff --git a/components/libc/compilers/dlib/sys/types.h b/components/libc/compilers/dlib/sys/types.h index 7dbeddcaa9..3af15ba251 100644 --- a/components/libc/compilers/dlib/sys/types.h +++ b/components/libc/compilers/dlib/sys/types.h @@ -14,7 +14,9 @@ typedef int32_t clockid_t; typedef int32_t key_t; /* Used for interprocess communication. */ -typedef int32_t pid_t; /* Used for process IDs and process group IDs. */ +typedef int pid_t; /* Used for process IDs and process group IDs. */ +typedef unsigned short uid_t; +typedef unsigned short gid_t; #ifndef ARCH_CPU_64BIT typedef signed int ssize_t; /* Used for a count of bytes or an error indication. */ #else diff --git a/components/libc/compilers/newlib/syscalls.c b/components/libc/compilers/newlib/syscalls.c index aee8ac360d..d751ab17b8 100644 --- a/components/libc/compilers/newlib/syscalls.c +++ b/components/libc/compilers/newlib/syscalls.c @@ -7,12 +7,13 @@ * Date Author Notes * 2021-02-11 Meco Man remove _gettimeofday_r() and _times_r() * 2020-02-13 Meco Man re-implement exit() and abort() + * 2020-02-21 Meco Man improve and beautify syscalls */ #include -#include -#include +#include #include +#include #include @@ -38,7 +39,9 @@ int _close_r(struct _reent *ptr, int fd) { #ifndef RT_USING_DFS - return 0; + /* return "not supported" */ + ptr->_errno = ENOTSUP; + return -1; #else return close(fd); #endif @@ -85,11 +88,11 @@ _getpid_r(struct _reent *ptr) int _isatty_r(struct _reent *ptr, int fd) { - if (fd >=0 && fd < 3) return 1; + if (fd >=0 && fd < 3) + return 1; - /* return "not supported" */ - ptr->_errno = ENOTSUP; - return -1; + ptr->_errno = ENOTTY ; + return 0; } int @@ -112,7 +115,9 @@ _off_t _lseek_r(struct _reent *ptr, int fd, _off_t pos, int whence) { #ifndef RT_USING_DFS - return 0; + /* return "not supported" */ + ptr->_errno = ENOTSUP; + return -1; #else _off_t rc; @@ -125,7 +130,9 @@ int _mkdir_r(struct _reent *ptr, const char *name, int mode) { #ifndef RT_USING_DFS - return 0; + /* return "not supported" */ + ptr->_errno = ENOTSUP; + return -1; #else int rc; @@ -138,7 +145,9 @@ int _open_r(struct _reent *ptr, const char *file, int flags, int mode) { #ifndef RT_USING_DFS - return 0; + /* return "not supported" */ + ptr->_errno = ENOTSUP; + return -1; #else int rc; @@ -151,7 +160,9 @@ _ssize_t _read_r(struct _reent *ptr, int fd, void *buf, size_t nbytes) { #ifndef RT_USING_DFS - return 0; + /* return "not supported" */ + ptr->_errno = ENOTSUP; + return -1; #else _ssize_t rc; @@ -164,7 +175,9 @@ int _rename_r(struct _reent *ptr, const char *old, const char *new) { #ifndef RT_USING_DFS - return 0; + /* return "not supported" */ + ptr->_errno = ENOTSUP; + return -1; #else int rc; @@ -184,7 +197,9 @@ int _stat_r(struct _reent *ptr, const char *file, struct stat *pstat) { #ifndef RT_USING_DFS - return 0; + /* return "not supported" */ + ptr->_errno = ENOTSUP; + return -1; #else int rc; @@ -197,6 +212,8 @@ int _unlink_r(struct _reent *ptr, const char *file) { #ifndef RT_USING_DFS + /* return "not supported" */ + ptr->_errno = ENOTSUP; return -1; #else return unlink(file); @@ -211,11 +228,11 @@ _wait_r(struct _reent *ptr, int *status) return -1; } -#ifdef RT_USING_DEVICE _ssize_t _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes) { #ifndef RT_USING_DFS +#ifdef RT_USING_DEVICE if (fileno(stdout) == fd) { rt_device_t console; @@ -225,7 +242,11 @@ _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes) } return 0; - +#else + /* return "not supported" */ + ptr->_errno = ENOTSUP; + return -1; +#endif /*RT_USING_DEVICE*/ #else _ssize_t rc; @@ -233,7 +254,6 @@ _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes) return rc; #endif } -#endif /* Memory routine */ void * @@ -304,11 +324,6 @@ void __libc_init_array(void) /* we not use __libc init_aray to initialize C++ objects */ } -uid_t getuid(void) -{ - return 0; -} - mode_t umask(mode_t mask) { return 022; -- cgit v1.3.1 From 46b5eb378f6ea55963f5795762f2b7e5c97626f1 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Mon, 22 Feb 2021 16:30:10 +0800 Subject: remove _getpid_r() --- components/libc/compilers/newlib/syscalls.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'components/libc/compilers') diff --git a/components/libc/compilers/newlib/syscalls.c b/components/libc/compilers/newlib/syscalls.c index d751ab17b8..3eabad9b55 100644 --- a/components/libc/compilers/newlib/syscalls.c +++ b/components/libc/compilers/newlib/syscalls.c @@ -79,12 +79,6 @@ _fstat_r(struct _reent *ptr, int fd, struct stat *pstat) return -1; } -int -_getpid_r(struct _reent *ptr) -{ - return 0; -} - int _isatty_r(struct _reent *ptr, int fd) { @@ -335,7 +329,10 @@ int flock(int fd, int operation) } /* -These functions will be implemented and replaced by the 'common/time.c' file +These functions are implemented and replaced by the 'common/time.c' file int _gettimeofday_r(struct _reent *ptr, struct timeval *__tp, void *__tzp); _CLOCK_T_ _times_r(struct _reent *ptr, struct tms *ptms); + +These functions are implemented and replaced by the "common/unistd.c" file +int _getpid_r(struct _reent *ptr); */ -- cgit v1.3.1 From 69dc37e1aa8806d3ef17b8f6fa3d33284b26ef60 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Mon, 22 Feb 2021 16:53:54 +0800 Subject: update --- components/libc/compilers/common/unistd.c | 8 +++++++- components/libc/compilers/newlib/syscalls.c | 10 +++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'components/libc/compilers') diff --git a/components/libc/compilers/common/unistd.c b/components/libc/compilers/common/unistd.c index 0966242e55..7ecd455480 100644 --- a/components/libc/compilers/common/unistd.c +++ b/components/libc/compilers/common/unistd.c @@ -50,7 +50,13 @@ int usleep(useconds_t usec) } RTM_EXPORT(usleep); -pid_t getpid(void) +pid_t +#if defined (RT_USING_NEWLIB) +__rt_libc_getpid +#else +getpid +#endif +(void) { /*TODO*/ return 0; diff --git a/components/libc/compilers/newlib/syscalls.c b/components/libc/compilers/newlib/syscalls.c index 3eabad9b55..28e1808e3f 100644 --- a/components/libc/compilers/newlib/syscalls.c +++ b/components/libc/compilers/newlib/syscalls.c @@ -35,6 +35,13 @@ __errno () } #endif +int +_getpid_r(struct _reent *ptr) +{ + extern pid_t __rt_libc_getpid(void); + return __rt_libc_getpid(); +} + int _close_r(struct _reent *ptr, int fd) { @@ -332,7 +339,4 @@ int flock(int fd, int operation) These functions are implemented and replaced by the 'common/time.c' file int _gettimeofday_r(struct _reent *ptr, struct timeval *__tp, void *__tzp); _CLOCK_T_ _times_r(struct _reent *ptr, struct tms *ptms); - -These functions are implemented and replaced by the "common/unistd.c" file -int _getpid_r(struct _reent *ptr); */ -- cgit v1.3.1 From 19c8cab8bd4dcb9f0e36e4502d7a8ec7337d664b Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Mon, 22 Feb 2021 17:02:45 +0800 Subject: update --- components/libc/compilers/common/unistd.c | 8 +------- components/libc/compilers/newlib/syscalls.c | 3 +-- 2 files changed, 2 insertions(+), 9 deletions(-) (limited to 'components/libc/compilers') diff --git a/components/libc/compilers/common/unistd.c b/components/libc/compilers/common/unistd.c index 7ecd455480..0966242e55 100644 --- a/components/libc/compilers/common/unistd.c +++ b/components/libc/compilers/common/unistd.c @@ -50,13 +50,7 @@ int usleep(useconds_t usec) } RTM_EXPORT(usleep); -pid_t -#if defined (RT_USING_NEWLIB) -__rt_libc_getpid -#else -getpid -#endif -(void) +pid_t getpid(void) { /*TODO*/ return 0; diff --git a/components/libc/compilers/newlib/syscalls.c b/components/libc/compilers/newlib/syscalls.c index 28e1808e3f..45aa4a34de 100644 --- a/components/libc/compilers/newlib/syscalls.c +++ b/components/libc/compilers/newlib/syscalls.c @@ -38,8 +38,7 @@ __errno () int _getpid_r(struct _reent *ptr) { - extern pid_t __rt_libc_getpid(void); - return __rt_libc_getpid(); + return 0; } int -- cgit v1.3.1 From bf7a3af6fd8e1012cc0e07ecfde059956c2f75c9 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Tue, 23 Feb 2021 11:28:25 +0800 Subject: update readme --- components/libc/compilers/common/readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'components/libc/compilers') diff --git a/components/libc/compilers/common/readme.md b/components/libc/compilers/common/readme.md index 99797d933c..81bb005d0a 100644 --- a/components/libc/compilers/common/readme.md +++ b/components/libc/compilers/common/readme.md @@ -1,8 +1,8 @@ ## Attentions -1. This folder is "common" for armlibc newlibc and dlib. It's not "common" for minilibc. +1. This folder is "common" for armlibc newlibc and dlib. -2. If you want to add new .c files, please do not forget to fix SConscript file too. eg: +2. If you want to add new `.c` files, please do not forget to fix SConscript file too. eg: ```python if GetDepend('RT_USING_POSIX') == False: -- cgit v1.3.1 From 2b98ac215a4e07401464bfcd6ad00957ff03bd72 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Wed, 24 Feb 2021 16:29:43 +0800 Subject: [kernel] rearrange rt_thread_control() - schedule the thread when close it --- components/libc/compilers/common/stdlib.c | 10 +-- src/thread.c | 141 ++++++++++++++++-------------- 2 files changed, 77 insertions(+), 74 deletions(-) (limited to 'components/libc/compilers') diff --git a/components/libc/compilers/common/stdlib.c b/components/libc/compilers/common/stdlib.c index 9f801ab966..48a86098cd 100644 --- a/components/libc/compilers/common/stdlib.c +++ b/components/libc/compilers/common/stdlib.c @@ -14,18 +14,10 @@ void __rt_libc_exit(int status) { rt_thread_t self = rt_thread_self(); -#ifdef RT_USING_MODULE - if (dlmodule_self()) - { - dlmodule_exit(status); - } -#endif - if (self != RT_NULL) { rt_kprintf("thread:%s exit:%d!\n", self->name, status); - rt_thread_suspend(self); - rt_schedule(); + rt_thread_control(self, RT_THREAD_CTRL_CLOSE, RT_NULL); } } diff --git a/src/thread.c b/src/thread.c index 0db9dd8e4d..2681eca59f 100644 --- a/src/thread.c +++ b/src/thread.c @@ -26,6 +26,7 @@ * bug when thread has not startup. * 2018-11-22 Jesven yield is same to rt_schedule * add support for tasks bound to cpu + * 2021-02-24 Meco Man rearrange rt_thread_control() - schedule the thread when close it */ #include @@ -670,83 +671,93 @@ rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg) switch (cmd) { - case RT_THREAD_CTRL_CHANGE_PRIORITY: - /* disable interrupt */ - temp = rt_hw_interrupt_disable(); - - /* for ready thread, change queue */ - if ((thread->stat & RT_THREAD_STAT_MASK) == RT_THREAD_READY) + case RT_THREAD_CTRL_CHANGE_PRIORITY: { - /* remove thread from schedule queue first */ - rt_schedule_remove_thread(thread); - - /* change thread priority */ - thread->current_priority = *(rt_uint8_t *)arg; - - /* recalculate priority attribute */ -#if RT_THREAD_PRIORITY_MAX > 32 - thread->number = thread->current_priority >> 3; /* 5bit */ - thread->number_mask = 1 << thread->number; - thread->high_mask = 1 << (thread->current_priority & 0x07); /* 3bit */ -#else - thread->number_mask = 1 << thread->current_priority; -#endif - - /* insert thread to schedule queue again */ - rt_schedule_insert_thread(thread); + /* disable interrupt */ + temp = rt_hw_interrupt_disable(); + + /* for ready thread, change queue */ + if ((thread->stat & RT_THREAD_STAT_MASK) == RT_THREAD_READY) + { + /* remove thread from schedule queue first */ + rt_schedule_remove_thread(thread); + + /* change thread priority */ + thread->current_priority = *(rt_uint8_t *)arg; + + /* recalculate priority attribute */ + #if RT_THREAD_PRIORITY_MAX > 32 + thread->number = thread->current_priority >> 3; /* 5bit */ + thread->number_mask = 1 << thread->number; + thread->high_mask = 1 << (thread->current_priority & 0x07); /* 3bit */ + #else + thread->number_mask = 1 << thread->current_priority; + #endif + + /* insert thread to schedule queue again */ + rt_schedule_insert_thread(thread); + } + else + { + thread->current_priority = *(rt_uint8_t *)arg; + + /* recalculate priority attribute */ + #if RT_THREAD_PRIORITY_MAX > 32 + thread->number = thread->current_priority >> 3; /* 5bit */ + thread->number_mask = 1 << thread->number; + thread->high_mask = 1 << (thread->current_priority & 0x07); /* 3bit */ + #else + thread->number_mask = 1 << thread->current_priority; + #endif + } + + /* enable interrupt */ + rt_hw_interrupt_enable(temp); + break; } - else - { - thread->current_priority = *(rt_uint8_t *)arg; - /* recalculate priority attribute */ -#if RT_THREAD_PRIORITY_MAX > 32 - thread->number = thread->current_priority >> 3; /* 5bit */ - thread->number_mask = 1 << thread->number; - thread->high_mask = 1 << (thread->current_priority & 0x07); /* 3bit */ -#else - thread->number_mask = 1 << thread->current_priority; -#endif + case RT_THREAD_CTRL_STARTUP: + { + return rt_thread_startup(thread); } - /* enable interrupt */ - rt_hw_interrupt_enable(temp); - break; - - case RT_THREAD_CTRL_STARTUP: - return rt_thread_startup(thread); - - case RT_THREAD_CTRL_CLOSE: - - if (rt_object_is_systemobject((rt_object_t)thread) == RT_TRUE) + case RT_THREAD_CTRL_CLOSE: { - return rt_thread_detach(thread); + rt_err_t rt_err; + + if (rt_object_is_systemobject((rt_object_t)thread) == RT_TRUE) + { + rt_err = rt_thread_detach(thread); + } + #ifdef RT_USING_HEAP + else + { + rt_err = rt_thread_delete(thread); + } + #endif + rt_schedule(); + return rt_err; } -#ifdef RT_USING_HEAP - else + + #ifdef RT_USING_SMP + case RT_THREAD_CTRL_BIND_CPU: { - return rt_thread_delete(thread); - } -#endif + rt_uint8_t cpu; -#ifdef RT_USING_SMP - case RT_THREAD_CTRL_BIND_CPU: - { - rt_uint8_t cpu; + if ((thread->stat & RT_THREAD_STAT_MASK) != RT_THREAD_INIT) + { + /* we only support bind cpu before started phase. */ + return RT_ERROR; + } - if ((thread->stat & RT_THREAD_STAT_MASK) != RT_THREAD_INIT) - { - /* we only support bind cpu before started phase. */ - return RT_ERROR; + cpu = (rt_uint8_t)(size_t)arg; + thread->bind_cpu = cpu > RT_CPUS_NR? RT_CPUS_NR : cpu; + break; } + #endif /*RT_USING_SMP*/ - cpu = (rt_uint8_t)(size_t)arg; - thread->bind_cpu = cpu > RT_CPUS_NR? RT_CPUS_NR : cpu; - break; - } -#endif /*RT_USING_SMP*/ - default: - break; + default: + break; } return RT_EOK; -- cgit v1.3.1