From e108dfe4a521355c454cf4d61b4297840264080b Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Sat, 10 Nov 2018 16:58:07 +0800 Subject: [libc] Fix the _EXFUN issue in newlib --- include/libc/libc_signal.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'include/libc') diff --git a/include/libc/libc_signal.h b/include/libc/libc_signal.h index b592b8227e..61a7e445e9 100644 --- a/include/libc/libc_signal.h +++ b/include/libc/libc_signal.h @@ -76,20 +76,20 @@ typedef struct siginfo siginfo_t; typedef unsigned long sigset_t; #define SIGHUP 1 -// #define SIGINT 2 +/* #define SIGINT 2 */ #define SIGQUIT 3 -// #define SIGILL 4 +/* #define SIGILL 4 */ #define SIGTRAP 5 -// #define SIGABRT 6 +/* #define SIGABRT 6 */ #define SIGEMT 7 -// #define SIGFPE 8 +/* #define SIGFPE 8 */ #define SIGKILL 9 #define SIGBUS 10 -// #define SIGSEGV 11 +/* #define SIGSEGV 11 */ #define SIGSYS 12 #define SIGPIPE 13 #define SIGALRM 14 -// #define SIGTERM 15 +/* #define SIGTERM 15 */ #define SIGURG 16 #define SIGSTOP 17 #define SIGTSTP 18 @@ -99,8 +99,8 @@ typedef unsigned long sigset_t; #define SIGTTOU 22 #define SIGPOLL 23 #define SIGWINCH 24 -// #define SIGUSR1 25 -// #define SIGUSR2 26 +/* #define SIGUSR1 25 */ +/* #define SIGUSR2 26 */ #define SIGRTMIN 27 #define SIGRTMAX 31 #define NSIG 32 @@ -136,7 +136,7 @@ typedef unsigned long sigset_t; #define SIGQUIT 3 #define SIGILL 4 #define SIGTRAP 5 -// #define SIGABRT 6 +/* #define SIGABRT 6 */ #define SIGEMT 7 #define SIGFPE 8 #define SIGKILL 9 -- cgit v1.3.1 From a0ef72ee93f11850e18c5e261cacd3de74348549 Mon Sep 17 00:00:00 2001 From: "chenchaoqun@rt-thread.com" Date: Sat, 24 Nov 2018 14:14:39 +0800 Subject: [unite] header of process --- include/libc/libc_signal.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'include/libc') diff --git a/include/libc/libc_signal.h b/include/libc/libc_signal.h index 61a7e445e9..71f8de125d 100644 --- a/include/libc/libc_signal.h +++ b/include/libc/libc_signal.h @@ -2,10 +2,6 @@ * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * File : libc_signal.h * * Change Logs: * Date Author Notes -- cgit v1.3.1 From 96e6deac294667c2637415c8ddd0fed9cee35ede Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Thu, 27 Dec 2018 09:11:07 +0800 Subject: [Kernel] Fix the errno definitions in armcc/iar. --- components/libc/compilers/dlib/sys/errno.h | 15 -- include/libc/libc_errno.h | 323 ++++++++++++++++------------- 2 files changed, 184 insertions(+), 154 deletions(-) delete mode 100644 components/libc/compilers/dlib/sys/errno.h (limited to 'include/libc') diff --git a/components/libc/compilers/dlib/sys/errno.h b/components/libc/compilers/dlib/sys/errno.h deleted file mode 100644 index 1ecb58b74c..0000000000 --- a/components/libc/compilers/dlib/sys/errno.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - */ -#ifndef SYS_ERRNO_H__ -#define SYS_ERRNO_H__ - -#include - - -#endif diff --git a/include/libc/libc_errno.h b/include/libc/libc_errno.h index 82ae8cf943..e1486048c7 100644 --- a/include/libc/libc_errno.h +++ b/include/libc/libc_errno.h @@ -2,10 +2,6 @@ * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * File : libc_errno.h * * Change Logs: * Date Author Notes @@ -17,145 +13,194 @@ #include -#if defined(RT_USING_NEWLIB) || defined(_WIN32) -/* use errno.h file in newlib */ +#if defined(RT_USING_NEWLIB) || defined(_WIN32) || defined(__CC_ARM) || defined(__IAR_SYSTEMS_ICC__) +/* use errno.h file in toolchains */ #include +#endif + +#if defined(__CC_ARM) +/* +defined in armcc/errno.h + +#define EDOM 1 +#define ERANGE 2 +#define EILSEQ 4 +#define ESIGNUM 3 +#define EINVAL 5 +#define ENOMEM 6 +*/ +#define ERROR_BASE_NO 7 + +#elif defined(__IAR_SYSTEMS_ICC__) +/* defined in iar/errno.h +#define EDOM 33 +#define ERANGE 34 +#define EFPOS 35 +#define EILSEQ 36 +*/ +#define ERROR_BASE_NO 36 + #else -/* define errno self. */ -#define EPERM 1 -#define ENOENT 2 -#define ESRCH 3 -#define EINTR 4 -#define EIO 5 -#define ENXIO 6 -#define E2BIG 7 -#define ENOEXEC 8 -#define EBADF 9 -#define ECHILD 10 -#define EAGAIN 11 -#define ENOMEM 12 -#define EACCES 13 -#define EFAULT 14 -#define ENOTBLK 15 -#define EBUSY 16 -#define EEXIST 17 -#define EXDEV 18 -#define ENODEV 19 -#define ENOTDIR 20 -#define EISDIR 21 -#define EINVAL 22 -#define ENFILE 23 -#define EMFILE 24 -#define ENOTTY 25 -#define ETXTBSY 26 -#define EFBIG 27 -#define ENOSPC 28 -#define ESPIPE 29 -#define EROFS 30 -#define EMLINK 31 -#define EPIPE 32 -#define EDOM 33 -#define ERANGE 34 -#define EDEADLK 35 -#define ENAMETOOLONG 36 -#define ENOLCK 37 -#define ENOSYS 38 -#define ENOTEMPTY 39 -#define ELOOP 40 + +#define ERROR_BASE_NO 0 +#endif + +#if !defined(RT_USING_NEWLIB) && !defined(_WIN32) + +#define EPERM (ERROR_BASE_NO + 1) +#define ENOENT (ERROR_BASE_NO + 2) +#define ESRCH (ERROR_BASE_NO + 3) +#define EINTR (ERROR_BASE_NO + 4) +#define EIO (ERROR_BASE_NO + 5) +#define ENXIO (ERROR_BASE_NO + 6) +#define E2BIG (ERROR_BASE_NO + 7) +#define ENOEXEC (ERROR_BASE_NO + 8) +#define EBADF (ERROR_BASE_NO + 9) +#define ECHILD (ERROR_BASE_NO + 10) +#define EAGAIN (ERROR_BASE_NO + 11) + +#ifndef ENOMEM +#define ENOMEM (ERROR_BASE_NO + 12) +#endif + +#define EACCES (ERROR_BASE_NO + 13) +#define EFAULT (ERROR_BASE_NO + 14) +#define ENOTBLK (ERROR_BASE_NO + 15) +#define EBUSY (ERROR_BASE_NO + 16) +#define EEXIST (ERROR_BASE_NO + 17) +#define EXDEV (ERROR_BASE_NO + 18) +#define ENODEV (ERROR_BASE_NO + 19) +#define ENOTDIR (ERROR_BASE_NO + 20) +#define EISDIR (ERROR_BASE_NO + 21) + +#ifndef EINVAL +#define EINVAL (ERROR_BASE_NO + 22) +#endif + +#define ENFILE (ERROR_BASE_NO + 23) +#define EMFILE (ERROR_BASE_NO + 24) +#define ENOTTY (ERROR_BASE_NO + 25) +#define ETXTBSY (ERROR_BASE_NO + 26) +#define EFBIG (ERROR_BASE_NO + 27) +#define ENOSPC (ERROR_BASE_NO + 28) +#define ESPIPE (ERROR_BASE_NO + 29) +#define EROFS (ERROR_BASE_NO + 30) +#define EMLINK (ERROR_BASE_NO + 31) +#define EPIPE (ERROR_BASE_NO + 32) + +#ifndef EDOM +#define EDOM (ERROR_BASE_NO + 33) +#endif + +#ifndef ERANGE +#define ERANGE (ERROR_BASE_NO + 34) +#endif + +#define EDEADLK (ERROR_BASE_NO + 35) +#define ENAMETOOLONG (ERROR_BASE_NO + 36) +#define ENOLCK (ERROR_BASE_NO + 37) +#define ENOSYS (ERROR_BASE_NO + 38) +#define ENOTEMPTY (ERROR_BASE_NO + 39) +#define ELOOP (ERROR_BASE_NO + 40) #define EWOULDBLOCK EAGAIN -#define ENOMSG 42 -#define EIDRM 43 -#define ECHRNG 44 -#define EL2NSYNC 45 -#define EL3HLT 46 -#define EL3RST 47 -#define ELNRNG 48 -#define EUNATCH 49 -#define ENOCSI 50 -#define EL2HLT 51 -#define EBADE 52 -#define EBADR 53 -#define EXFULL 54 -#define ENOANO 55 -#define EBADRQC 56 -#define EBADSLT 57 +#define ENOMSG (ERROR_BASE_NO + 42) +#define EIDRM (ERROR_BASE_NO + 43) +#define ECHRNG (ERROR_BASE_NO + 44) +#define EL2NSYNC (ERROR_BASE_NO + 45) +#define EL3HLT (ERROR_BASE_NO + 46) +#define EL3RST (ERROR_BASE_NO + 47) +#define ELNRNG (ERROR_BASE_NO + 48) +#define EUNATCH (ERROR_BASE_NO + 49) +#define ENOCSI (ERROR_BASE_NO + 50) +#define EL2HLT (ERROR_BASE_NO + 51) +#define EBADE (ERROR_BASE_NO + 52) +#define EBADR (ERROR_BASE_NO + 53) +#define EXFULL (ERROR_BASE_NO + 54) +#define ENOANO (ERROR_BASE_NO + 55) +#define EBADRQC (ERROR_BASE_NO + 56) +#define EBADSLT (ERROR_BASE_NO + 57) #define EDEADLOCK EDEADLK -#define EBFONT 59 -#define ENOSTR 60 -#define ENODATA 61 -#define ETIME 62 -#define ENOSR 63 -#define ENONET 64 -#define ENOPKG 65 -#define EREMOTE 66 -#define ENOLINK 67 -#define EADV 68 -#define ESRMNT 69 -#define ECOMM 70 -#define EPROTO 71 -#define EMULTIHOP 72 -#define EDOTDOT 73 -#define EBADMSG 74 -#define EOVERFLOW 75 -#define ENOTUNIQ 76 -#define EBADFD 77 -#define EREMCHG 78 -#define ELIBACC 79 -#define ELIBBAD 80 -#define ELIBSCN 81 -#define ELIBMAX 82 -#define ELIBEXEC 83 -#define EILSEQ 84 -#define ERESTART 85 -#define ESTRPIPE 86 -#define EUSERS 87 -#define ENOTSOCK 88 -#define EDESTADDRREQ 89 -#define EMSGSIZE 90 -#define EPROTOTYPE 91 -#define ENOPROTOOPT 92 -#define EPROTONOSUPPORT 93 -#define ESOCKTNOSUPPORT 94 -#define EOPNOTSUPP 95 -#define ENOTSUP EOPNOTSUPP -#define EPFNOSUPPORT 96 -#define EAFNOSUPPORT 97 -#define EADDRINUSE 98 -#define EADDRNOTAVAIL 99 -#define ENETDOWN 100 -#define ENETUNREACH 101 -#define ENETRESET 102 -#define ECONNABORTED 103 -#define ECONNRESET 104 -#define ENOBUFS 105 -#define EISCONN 106 -#define ENOTCONN 107 -#define ESHUTDOWN 108 -#define ETOOMANYREFS 109 -#define ETIMEDOUT 110 -#define ECONNREFUSED 111 -#define EHOSTDOWN 112 -#define EHOSTUNREACH 113 -#define EALREADY 114 -#define EINPROGRESS 115 -#define ESTALE 116 -#define EUCLEAN 117 -#define ENOTNAM 118 -#define ENAVAIL 119 -#define EISNAM 120 -#define EREMOTEIO 121 -#define EDQUOT 122 -#define ENOMEDIUM 123 -#define EMEDIUMTYPE 124 -#define ECANCELED 125 -#define ENOKEY 126 -#define EKEYEXPIRED 127 -#define EKEYREVOKED 128 -#define EKEYREJECTED 129 -#define EOWNERDEAD 130 -#define ENOTRECOVERABLE 131 -#define ERFKILL 132 -#define EHWPOISON 133 +#define EBFONT (ERROR_BASE_NO + 59) +#define ENOSTR (ERROR_BASE_NO + 60) +#define ENODATA (ERROR_BASE_NO + 61) +#define ETIME (ERROR_BASE_NO + 62) +#define ENOSR (ERROR_BASE_NO + 63) +#define ENONET (ERROR_BASE_NO + 64) +#define ENOPKG (ERROR_BASE_NO + 65) +#define EREMOTE (ERROR_BASE_NO + 66) +#define ENOLINK (ERROR_BASE_NO + 67) +#define EADV (ERROR_BASE_NO + 68) +#define ESRMNT (ERROR_BASE_NO + 69) +#define ECOMM (ERROR_BASE_NO + 70) +#define EPROTO (ERROR_BASE_NO + 71) +#define EMULTIHOP (ERROR_BASE_NO + 72) +#define EDOTDOT (ERROR_BASE_NO + 73) +#define EBADMSG (ERROR_BASE_NO + 74) +#define EOVERFLOW (ERROR_BASE_NO + 75) +#define ENOTUNIQ (ERROR_BASE_NO + 76) +#define EBADFD (ERROR_BASE_NO + 77) +#define EREMCHG (ERROR_BASE_NO + 78) +#define ELIBACC (ERROR_BASE_NO + 79) +#define ELIBBAD (ERROR_BASE_NO + 80) +#define ELIBSCN (ERROR_BASE_NO + 81) +#define ELIBMAX (ERROR_BASE_NO + 82) +#define ELIBEXEC (ERROR_BASE_NO + 83) + +#ifndef EILSEQ +#define EILSEQ (ERROR_BASE_NO + 84) +#endif + +#define ERESTART (ERROR_BASE_NO + 85) +#define ESTRPIPE (ERROR_BASE_NO + 86) +#define EUSERS (ERROR_BASE_NO + 87) +#define ENOTSOCK (ERROR_BASE_NO + 88) +#define EDESTADDRREQ (ERROR_BASE_NO + 89) +#define EMSGSIZE (ERROR_BASE_NO + 90) +#define EPROTOTYPE (ERROR_BASE_NO + 91) +#define ENOPROTOOPT (ERROR_BASE_NO + 92) +#define EPROTONOSUPPORT (ERROR_BASE_NO + 93) +#define ESOCKTNOSUPPORT (ERROR_BASE_NO + 94) +#define EOPNOTSUPP (ERROR_BASE_NO + 95) +#define ENOTSUP EOPNOTSUPP ) +#define EPFNOSUPPORT (ERROR_BASE_NO + 96) +#define EAFNOSUPPORT (ERROR_BASE_NO + 97) +#define EADDRINUSE (ERROR_BASE_NO + 98) +#define EADDRNOTAVAIL (ERROR_BASE_NO + 99) +#define ENETDOWN (ERROR_BASE_NO + 100) +#define ENETUNREACH (ERROR_BASE_NO + 101) +#define ENETRESET (ERROR_BASE_NO + 102) +#define ECONNABORTED (ERROR_BASE_NO + 103) +#define ECONNRESET (ERROR_BASE_NO + 104) +#define ENOBUFS (ERROR_BASE_NO + 105) +#define EISCONN (ERROR_BASE_NO + 106) +#define ENOTCONN (ERROR_BASE_NO + 107) +#define ESHUTDOWN (ERROR_BASE_NO + 108) +#define ETOOMANYREFS (ERROR_BASE_NO + 109) +#define ETIMEDOUT (ERROR_BASE_NO + 110) +#define ECONNREFUSED (ERROR_BASE_NO + 111) +#define EHOSTDOWN (ERROR_BASE_NO + 112) +#define EHOSTUNREACH (ERROR_BASE_NO + 113) +#define EALREADY (ERROR_BASE_NO + 114) +#define EINPROGRESS (ERROR_BASE_NO + 115) +#define ESTALE (ERROR_BASE_NO + 116) +#define EUCLEAN (ERROR_BASE_NO + 117) +#define ENOTNAM (ERROR_BASE_NO + 118) +#define ENAVAIL (ERROR_BASE_NO + 119) +#define EISNAM (ERROR_BASE_NO + 120) +#define EREMOTEIO (ERROR_BASE_NO + 121) +#define EDQUOT (ERROR_BASE_NO + 122) +#define ENOMEDIUM (ERROR_BASE_NO + 123) +#define EMEDIUMTYPE (ERROR_BASE_NO + 124) +#define ECANCELED (ERROR_BASE_NO + 125) +#define ENOKEY (ERROR_BASE_NO + 126) +#define EKEYEXPIRED (ERROR_BASE_NO + 127) +#define EKEYREVOKED (ERROR_BASE_NO + 128) +#define EKEYREJECTED (ERROR_BASE_NO + 129) +#define EOWNERDEAD (ERROR_BASE_NO + 130) +#define ENOTRECOVERABLE (ERROR_BASE_NO + 131) +#define ERFKILL (ERROR_BASE_NO + 132) +#define EHWPOISON (ERROR_BASE_NO + 133) + #endif #endif -- cgit v1.3.1 From b7e672e096eed096c1f96c33407e60354798a98f Mon Sep 17 00:00:00 2001 From: MLW <2544047213@qq.com> Date: Sat, 2 Mar 2019 15:12:46 +0800 Subject: 修复libc_errno.h的bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/libc/libc_errno.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/libc') diff --git a/include/libc/libc_errno.h b/include/libc/libc_errno.h index e1486048c7..bb9a4dea2a 100644 --- a/include/libc/libc_errno.h +++ b/include/libc/libc_errno.h @@ -161,7 +161,7 @@ defined in armcc/errno.h #define EPROTONOSUPPORT (ERROR_BASE_NO + 93) #define ESOCKTNOSUPPORT (ERROR_BASE_NO + 94) #define EOPNOTSUPP (ERROR_BASE_NO + 95) -#define ENOTSUP EOPNOTSUPP ) +#define ENOTSUP EOPNOTSUPP #define EPFNOSUPPORT (ERROR_BASE_NO + 96) #define EAFNOSUPPORT (ERROR_BASE_NO + 97) #define EADDRINUSE (ERROR_BASE_NO + 98) -- cgit v1.3.1 From 5885fc414f02fce4be55d26830aa95e7a460048c Mon Sep 17 00:00:00 2001 From: MurphyZhao Date: Thu, 11 Apr 2019 14:24:43 +0800 Subject: [include/libc] 在使用 ARMCC 和 IAR 时,移除对 errno.h 的引入。如果引入了 errno.h,errno 就不会被重定向到 _rt_errno。 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MurphyZhao --- include/libc/libc_errno.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/libc') diff --git a/include/libc/libc_errno.h b/include/libc/libc_errno.h index bb9a4dea2a..0f3bc7635a 100644 --- a/include/libc/libc_errno.h +++ b/include/libc/libc_errno.h @@ -13,7 +13,7 @@ #include -#if defined(RT_USING_NEWLIB) || defined(_WIN32) || defined(__CC_ARM) || defined(__IAR_SYSTEMS_ICC__) +#if defined(RT_USING_NEWLIB) || defined(_WIN32) /* use errno.h file in toolchains */ #include #endif -- cgit v1.3.1 From 00d7cd66f2aaf894585193c61d506906bd1f285c Mon Sep 17 00:00:00 2001 From: zhangjun <2281979437@qq.com> Date: Sat, 10 Aug 2019 16:32:31 +0800 Subject: fixup two macro definition in include/libc/libc_fcntl.h --- include/libc/libc_fcntl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/libc') diff --git a/include/libc/libc_fcntl.h b/include/libc/libc_fcntl.h index 1b7c69b1f4..83b9af9b1e 100644 --- a/include/libc/libc_fcntl.h +++ b/include/libc/libc_fcntl.h @@ -20,7 +20,7 @@ #include #ifndef O_NONBLOCK -#define O_NONBLOCK 0x4000 +#define O_NONBLOCK 04000 #endif #if defined(_WIN32) @@ -35,7 +35,7 @@ #endif #ifndef O_DIRECTORY -#define O_DIRECTORY 0x200000 +#define O_DIRECTORY 0200000 #endif #ifndef O_BINARY -- cgit v1.3.1 From b69ce64286abf6e0401feae5ce82a78d3ed302f7 Mon Sep 17 00:00:00 2001 From: zhangjun <2281979437@qq.com> Date: Tue, 20 Aug 2019 09:16:42 +0800 Subject: 改回O_DIRCTORY与O_NONBLOCK,解决O_DIRCOTY与newlib中O_BINARY的相同定义 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/libc/libc_fcntl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/libc') diff --git a/include/libc/libc_fcntl.h b/include/libc/libc_fcntl.h index 83b9af9b1e..1b7c69b1f4 100644 --- a/include/libc/libc_fcntl.h +++ b/include/libc/libc_fcntl.h @@ -20,7 +20,7 @@ #include #ifndef O_NONBLOCK -#define O_NONBLOCK 04000 +#define O_NONBLOCK 0x4000 #endif #if defined(_WIN32) @@ -35,7 +35,7 @@ #endif #ifndef O_DIRECTORY -#define O_DIRECTORY 0200000 +#define O_DIRECTORY 0x200000 #endif #ifndef O_BINARY -- cgit v1.3.1 From 992d3af3aee1e8567080e33e27011170f60dfab9 Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Mon, 16 Dec 2019 13:59:46 +0800 Subject: [kernel] code and comments cleanup --- include/libc/libc_signal.h | 6 +-- include/rtdef.h | 2 +- include/rthw.h | 2 +- src/clock.c | 2 +- src/device.c | 16 ++++---- src/ipc.c | 94 +++++++++++++++++++++++----------------------- src/kservice.c | 2 +- src/signal.c | 4 +- src/thread.c | 6 +-- 9 files changed, 67 insertions(+), 67 deletions(-) (limited to 'include/libc') diff --git a/include/libc/libc_signal.h b/include/libc/libc_signal.h index 71f8de125d..c77f36798c 100644 --- a/include/libc/libc_signal.h +++ b/include/libc/libc_signal.h @@ -24,7 +24,7 @@ extern "C" { NOTE: P1003.1c/D10, p. 34 adds sigev_notify_function and sigev_notify_attributes to the sigevent structure. */ -union sigval +union sigval { int sival_int; /* Integer signal value */ void *sival_ptr; /* Pointer signal value */ @@ -107,7 +107,7 @@ typedef unsigned long sigset_t; typedef void (*_sig_func_ptr)(int); -struct sigaction +struct sigaction { _sig_func_ptr sa_handler; sigset_t sa_mask; @@ -163,7 +163,7 @@ typedef unsigned long sigset_t; typedef void (*_sig_func_ptr)(int); -struct sigaction +struct sigaction { _sig_func_ptr sa_handler; sigset_t sa_mask; diff --git a/include/rtdef.h b/include/rtdef.h index 3f0b116785..b3aa38d3af 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -522,7 +522,7 @@ typedef siginfo_t rt_siginfo_t; /** * CPUs definitions - * + * */ struct rt_cpu { diff --git a/include/rthw.h b/include/rthw.h index 2a602dcfe7..89877faf90 100644 --- a/include/rthw.h +++ b/include/rthw.h @@ -37,7 +37,7 @@ extern "C" { #endif #ifndef RT_CPU_CACHE_LINE_SZ -#define RT_CPU_CACHE_LINE_SZ 32 +#define RT_CPU_CACHE_LINE_SZ 32 #endif enum RT_HW_CACHE_OPS diff --git a/src/clock.c b/src/clock.c index 9b54101363..97a09ddeaf 100644 --- a/src/clock.c +++ b/src/clock.c @@ -25,7 +25,7 @@ static rt_tick_t rt_tick = 0; #endif /** - * This function will init system tick and set it to zero. + * This function will initialize system tick and set it to zero. * @ingroup SystemInit * * @deprecated since 1.1.0, this function does not need to be invoked diff --git a/src/device.c b/src/device.c index 51fc6176a6..32c06b380c 100644 --- a/src/device.c +++ b/src/device.c @@ -95,7 +95,7 @@ RTM_EXPORT(rt_device_unregister); * @return the error code, RT_EOK on successfully. * * @deprecated since 1.2.x, this function is not needed because the initialization - * of a device is performed when applicaiton opens it. + * of a device is performed when application opens it. */ rt_err_t rt_device_init_all(void) { @@ -162,7 +162,7 @@ rt_device_t rt_device_create(int type, int attach_size) size = RT_ALIGN(sizeof(struct rt_device), RT_ALIGN_SIZE); attach_size = RT_ALIGN(attach_size, RT_ALIGN_SIZE); - /* use the totoal size */ + /* use the total size */ size += attach_size; device = (rt_device_t)rt_malloc(size); @@ -208,7 +208,7 @@ rt_err_t rt_device_init(rt_device_t dev) RT_ASSERT(dev != RT_NULL); - /* get device init handler */ + /* get device_init handler */ if (device_init != RT_NULL) { if (!(dev->flag & RT_DEVICE_FLAG_ACTIVATED)) @@ -269,7 +269,7 @@ rt_err_t rt_device_open(rt_device_t dev, rt_uint16_t oflag) return -RT_EBUSY; } - /* call device open interface */ + /* call device_open interface */ if (device_open != RT_NULL) { result = device_open(dev, oflag); @@ -317,7 +317,7 @@ rt_err_t rt_device_close(rt_device_t dev) if (dev->ref_count != 0) return RT_EOK; - /* call device close interface */ + /* call device_close interface */ if (device_close != RT_NULL) { result = device_close(dev); @@ -357,7 +357,7 @@ rt_size_t rt_device_read(rt_device_t dev, return 0; } - /* call device read interface */ + /* call device_read interface */ if (device_read != RT_NULL) { return device_read(dev, pos, buffer, size); @@ -396,7 +396,7 @@ rt_size_t rt_device_write(rt_device_t dev, return 0; } - /* call device write interface */ + /* call device_write interface */ if (device_write != RT_NULL) { return device_write(dev, pos, buffer, size); @@ -423,7 +423,7 @@ rt_err_t rt_device_control(rt_device_t dev, int cmd, void *arg) RT_ASSERT(dev != RT_NULL); RT_ASSERT(rt_object_get_type(&dev->parent) == RT_Object_Class_Device); - /* call device write interface */ + /* call device_write interface */ if (device_control != RT_NULL) { return device_control(dev, cmd, arg); diff --git a/src/ipc.c b/src/ipc.c index 6a8234a747..e6955bae37 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -60,7 +60,7 @@ extern void (*rt_object_put_hook)(struct rt_object *object); */ rt_inline rt_err_t rt_ipc_object_init(struct rt_ipc_object *ipc) { - /* init ipc object */ + /* initialize ipc object */ rt_list_init(&(ipc->suspend_thread)); return RT_EOK; @@ -159,13 +159,13 @@ rt_inline rt_err_t rt_ipc_list_resume_all(rt_list_t *list) struct rt_thread *thread; register rt_ubase_t temp; - /* wakeup all suspend threads */ + /* wakeup all suspended threads */ while (!rt_list_isempty(list)) { /* disable interrupt */ temp = rt_hw_interrupt_disable(); - /* get next suspend thread */ + /* get next suspended thread */ thread = rt_list_entry(list->next, struct rt_thread, tlist); /* set error code to RT_ERROR */ thread->error = -RT_ERROR; @@ -173,7 +173,7 @@ rt_inline rt_err_t rt_ipc_list_resume_all(rt_list_t *list) /* * resume thread * In rt_thread_resume function, it will remove current thread from - * suspend list + * suspended list */ rt_thread_resume(thread); @@ -191,7 +191,7 @@ rt_inline rt_err_t rt_ipc_list_resume_all(rt_list_t *list) * * @param sem the semaphore object * @param name the name of semaphore - * @param value the init value of semaphore + * @param value the initial value of semaphore * @param flag the flag of semaphore * * @return the operation status, RT_EOK on successful @@ -204,13 +204,13 @@ rt_err_t rt_sem_init(rt_sem_t sem, RT_ASSERT(sem != RT_NULL); RT_ASSERT(value < 0x10000U); - /* init object */ + /* initialize object */ rt_object_init(&(sem->parent.parent), RT_Object_Class_Semaphore, name); - /* init ipc object */ + /* initialize ipc object */ rt_ipc_object_init(&(sem->parent)); - /* set init value */ + /* set initial value */ sem->value = (rt_uint16_t)value; /* set parent */ @@ -236,7 +236,7 @@ rt_err_t rt_sem_detach(rt_sem_t sem) RT_ASSERT(rt_object_get_type(&sem->parent.parent) == RT_Object_Class_Semaphore); RT_ASSERT(rt_object_is_systemobject(&sem->parent.parent)); - /* wakeup all suspend threads */ + /* wakeup all suspended threads */ rt_ipc_list_resume_all(&(sem->parent.suspend_thread)); /* detach semaphore object */ @@ -251,7 +251,7 @@ RTM_EXPORT(rt_sem_detach); * This function will create a semaphore from system resource * * @param name the name of semaphore - * @param value the init value of semaphore + * @param value the initial value of semaphore * @param flag the flag of semaphore * * @return the created semaphore, RT_NULL on error happen @@ -270,10 +270,10 @@ rt_sem_t rt_sem_create(const char *name, rt_uint32_t value, rt_uint8_t flag) if (sem == RT_NULL) return sem; - /* init ipc object */ + /* initialize ipc object */ rt_ipc_object_init(&(sem->parent)); - /* set init value */ + /* set initial value */ sem->value = value; /* set parent */ @@ -301,7 +301,7 @@ rt_err_t rt_sem_delete(rt_sem_t sem) RT_ASSERT(rt_object_get_type(&sem->parent.parent) == RT_Object_Class_Semaphore); RT_ASSERT(rt_object_is_systemobject(&sem->parent.parent) == RT_FALSE); - /* wakeup all suspend threads */ + /* wakeup all suspended threads */ rt_ipc_list_resume_all(&(sem->parent.suspend_thread)); /* delete semaphore object */ @@ -532,10 +532,10 @@ rt_err_t rt_mutex_init(rt_mutex_t mutex, const char *name, rt_uint8_t flag) /* parameter check */ RT_ASSERT(mutex != RT_NULL); - /* init object */ + /* initialize object */ rt_object_init(&(mutex->parent.parent), RT_Object_Class_Mutex, name); - /* init ipc object */ + /* initialize ipc object */ rt_ipc_object_init(&(mutex->parent)); mutex->value = 1; @@ -566,10 +566,10 @@ rt_err_t rt_mutex_detach(rt_mutex_t mutex) RT_ASSERT(rt_object_get_type(&mutex->parent.parent) == RT_Object_Class_Mutex); RT_ASSERT(rt_object_is_systemobject(&mutex->parent.parent)); - /* wakeup all suspend threads */ + /* wakeup all suspended threads */ rt_ipc_list_resume_all(&(mutex->parent.suspend_thread)); - /* detach mutex object */ + /* detach semaphore object */ rt_object_detach(&(mutex->parent.parent)); return RT_EOK; @@ -598,7 +598,7 @@ rt_mutex_t rt_mutex_create(const char *name, rt_uint8_t flag) if (mutex == RT_NULL) return mutex; - /* init ipc object */ + /* initialize ipc object */ rt_ipc_object_init(&(mutex->parent)); mutex->value = 1; @@ -631,7 +631,7 @@ rt_err_t rt_mutex_delete(rt_mutex_t mutex) RT_ASSERT(rt_object_get_type(&mutex->parent.parent) == RT_Object_Class_Mutex); RT_ASSERT(rt_object_is_systemobject(&mutex->parent.parent) == RT_FALSE); - /* wakeup all suspend threads */ + /* wakeup all suspended threads */ rt_ipc_list_resume_all(&(mutex->parent.suspend_thread)); /* delete mutex object */ @@ -917,16 +917,16 @@ rt_err_t rt_event_init(rt_event_t event, const char *name, rt_uint8_t flag) /* parameter check */ RT_ASSERT(event != RT_NULL); - /* init object */ + /* initialize object */ rt_object_init(&(event->parent.parent), RT_Object_Class_Event, name); /* set parent flag */ event->parent.parent.flag = flag; - /* init ipc object */ + /* initialize ipc object */ rt_ipc_object_init(&(event->parent)); - /* init event */ + /* initialize event */ event->set = 0; return RT_EOK; @@ -980,10 +980,10 @@ rt_event_t rt_event_create(const char *name, rt_uint8_t flag) /* set parent */ event->parent.parent.flag = flag; - /* init ipc object */ + /* initialize ipc object */ rt_ipc_object_init(&(event->parent)); - /* init event */ + /* initialize event */ event->set = 0; return event; @@ -1050,7 +1050,7 @@ rt_err_t rt_event_send(rt_event_t event, rt_uint32_t set) event->set |= set; RT_OBJECT_HOOK_CALL(rt_object_put_hook, (&(event->parent.parent))); - + if (!rt_list_isempty(&event->parent.suspend_thread)) { /* search thread list to resume thread */ @@ -1073,7 +1073,7 @@ rt_err_t rt_event_send(rt_event_t event, rt_uint32_t set) { if (thread->event_set & event->set) { - /* save recieved event set */ + /* save the received event set */ thread->event_set = thread->event_set & event->set; /* received an OR event */ @@ -1143,7 +1143,7 @@ rt_err_t rt_event_recv(rt_event_t event, if (set == 0) return -RT_ERROR; - /* init status */ + /* initialize status */ status = -RT_ERROR; /* get current thread */ thread = rt_thread_self(); @@ -1253,7 +1253,7 @@ rt_err_t rt_event_control(rt_event_t event, int cmd, void *arg) /* parameter check */ RT_ASSERT(event != RT_NULL); RT_ASSERT(rt_object_get_type(&event->parent.parent) == RT_Object_Class_Event); - + if (cmd == RT_IPC_CMD_RESET) { /* disable interrupt */ @@ -1262,7 +1262,7 @@ rt_err_t rt_event_control(rt_event_t event, int cmd, void *arg) /* resume all waiting thread */ rt_ipc_list_resume_all(&event->parent.suspend_thread); - /* init event set */ + /* initialize event set */ event->set = 0; /* enable interrupt */ @@ -1299,23 +1299,23 @@ rt_err_t rt_mb_init(rt_mailbox_t mb, { RT_ASSERT(mb != RT_NULL); - /* init object */ + /* initialize object */ rt_object_init(&(mb->parent.parent), RT_Object_Class_MailBox, name); /* set parent flag */ mb->parent.parent.flag = flag; - /* init ipc object */ + /* initialize ipc object */ rt_ipc_object_init(&(mb->parent)); - /* init mailbox */ + /* initialize mailbox */ mb->msg_pool = (rt_ubase_t *)msgpool; mb->size = size; mb->entry = 0; mb->in_offset = 0; mb->out_offset = 0; - /* init an additional list of sender suspend thread */ + /* initialize an additional list of sender suspend thread */ rt_list_init(&(mb->suspend_sender_thread)); return RT_EOK; @@ -1372,10 +1372,10 @@ rt_mailbox_t rt_mb_create(const char *name, rt_size_t size, rt_uint8_t flag) /* set parent */ mb->parent.parent.flag = flag; - /* init ipc object */ + /* initialize ipc object */ rt_ipc_object_init(&(mb->parent)); - /* init mailbox */ + /* initialize mailbox */ mb->size = size; mb->msg_pool = (rt_ubase_t *)RT_KERNEL_MALLOC(mb->size * sizeof(rt_ubase_t)); if (mb->msg_pool == RT_NULL) @@ -1389,7 +1389,7 @@ rt_mailbox_t rt_mb_create(const char *name, rt_size_t size, rt_uint8_t flag) mb->in_offset = 0; mb->out_offset = 0; - /* init an additional list of sender suspend thread */ + /* initialize an additional list of sender suspend thread */ rt_list_init(&(mb->suspend_sender_thread)); return mb; @@ -1791,27 +1791,27 @@ rt_err_t rt_mq_init(rt_mq_t mq, /* parameter check */ RT_ASSERT(mq != RT_NULL); - /* init object */ + /* initialize object */ rt_object_init(&(mq->parent.parent), RT_Object_Class_MessageQueue, name); /* set parent flag */ mq->parent.parent.flag = flag; - /* init ipc object */ + /* initialize ipc object */ rt_ipc_object_init(&(mq->parent)); - /* set messasge pool */ + /* set message pool */ mq->msg_pool = msgpool; /* get correct message size */ mq->msg_size = RT_ALIGN(msg_size, RT_ALIGN_SIZE); mq->max_msgs = pool_size / (mq->msg_size + sizeof(struct rt_mq_message)); - /* init message list */ + /* initialize message list */ mq->msg_queue_head = RT_NULL; mq->msg_queue_tail = RT_NULL; - /* init message empty list */ + /* initialize message empty list */ mq->msg_queue_free = RT_NULL; for (temp = 0; temp < mq->max_msgs; temp ++) { @@ -1824,7 +1824,7 @@ rt_err_t rt_mq_init(rt_mq_t mq, /* the initial entry is zero */ mq->entry = 0; - /* init an additional list of sender suspend thread */ + /* initialize an additional list of sender suspend thread */ rt_list_init(&(mq->suspend_sender_thread)); return RT_EOK; @@ -1887,10 +1887,10 @@ rt_mq_t rt_mq_create(const char *name, /* set parent */ mq->parent.parent.flag = flag; - /* init ipc object */ + /* initialize ipc object */ rt_ipc_object_init(&(mq->parent)); - /* init message queue */ + /* initialize message queue */ /* get correct message size */ mq->msg_size = RT_ALIGN(msg_size, RT_ALIGN_SIZE); @@ -1905,11 +1905,11 @@ rt_mq_t rt_mq_create(const char *name, return RT_NULL; } - /* init message list */ + /* initialize message list */ mq->msg_queue_head = RT_NULL; mq->msg_queue_tail = RT_NULL; - /* init message empty list */ + /* initialize message empty list */ mq->msg_queue_free = RT_NULL; for (temp = 0; temp < mq->max_msgs; temp ++) { @@ -1922,7 +1922,7 @@ rt_mq_t rt_mq_create(const char *name, /* the initial entry is zero */ mq->entry = 0; - /* init an additional list of sender suspend thread */ + /* initialize an additional list of sender suspend thread */ rt_list_init(&(mq->suspend_sender_thread)); return mq; diff --git a/src/kservice.c b/src/kservice.c index 202bd97f83..58f04330f1 100644 --- a/src/kservice.c +++ b/src/kservice.c @@ -316,7 +316,7 @@ RTM_EXPORT(rt_memmove); * This function will compare two areas of memory * * @param cs one area of memory - * @param ct znother area of memory + * @param ct another area of memory * @param count the size of the area * * @return the result diff --git a/src/signal.c b/src/signal.c index bea3615d34..bb9339ab6c 100644 --- a/src/signal.c +++ b/src/signal.c @@ -22,8 +22,8 @@ #define RT_SIG_INFO_MAX 32 #endif -#define DBG_TAG "SIGN" -#define DBG_LVL DBG_WARNING +#define DBG_TAG "SIGN" +#define DBG_LVL DBG_WARNING #include #define sig_mask(sig_no) (1u << sig_no) diff --git a/src/thread.c b/src/thread.c index c5f75a1176..7596906fae 100644 --- a/src/thread.c +++ b/src/thread.c @@ -179,7 +179,7 @@ static rt_err_t _rt_thread_init(struct rt_thread *thread, thread->cleanup = 0; thread->user_data = 0; - /* init thread timer */ + /* initialize thread timer */ rt_timer_init(&(thread->thread_timer), thread->name, rt_thread_timeout, @@ -242,7 +242,7 @@ rt_err_t rt_thread_init(struct rt_thread *thread, RT_ASSERT(thread != RT_NULL); RT_ASSERT(stack_start != RT_NULL); - /* init thread object */ + /* initialize thread object */ rt_object_init((rt_object_t)thread, RT_Object_Class_Thread, name); return _rt_thread_init(thread, @@ -293,7 +293,7 @@ rt_err_t rt_thread_startup(rt_thread_t thread) RT_ASSERT((thread->stat & RT_THREAD_STAT_MASK) == RT_THREAD_INIT); RT_ASSERT(rt_object_get_type((rt_object_t)thread) == RT_Object_Class_Thread); - /* set current priority to init priority */ + /* set current priority to initialize priority */ thread->current_priority = thread->init_priority; /* calculate priority attribute */ -- cgit v1.3.1 From b5e4aa58e0b943e02335ef253a7fbce4e9dda238 Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Wed, 18 Dec 2019 23:06:36 +0800 Subject: [Kernel] Fix the signal compiling issue when using minilibc --- components/libc/compilers/minilibc/signal.h | 20 ++++++++++++++++++++ include/libc/libc_signal.h | 15 +++++---------- 2 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 components/libc/compilers/minilibc/signal.h (limited to 'include/libc') diff --git a/components/libc/compilers/minilibc/signal.h b/components/libc/compilers/minilibc/signal.h new file mode 100644 index 0000000000..f52f1e1009 --- /dev/null +++ b/components/libc/compilers/minilibc/signal.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2017-09-12 Bernard The first version + */ + +#ifndef SIGNAL_H__ +#define SIGNAL_H__ + +#include + +#define SIG_DFL ((_sig_func_ptr)0) /* Default action */ +#define SIG_IGN ((_sig_func_ptr)1) /* Ignore action */ +#define SIG_ERR ((_sig_func_ptr)-1) /* Error return */ + +#endif diff --git a/include/libc/libc_signal.h b/include/libc/libc_signal.h index c77f36798c..898fe13f43 100644 --- a/include/libc/libc_signal.h +++ b/include/libc/libc_signal.h @@ -63,13 +63,14 @@ typedef struct siginfo siginfo_t; #define SI_MESGQ 0x05 /* Signal generated by arrival of a message on an empty message queue. */ -#ifdef RT_USING_NEWLIB -#include +#if !defined(RT_USING_NEWLIB) +typedef void (*_sig_func_ptr)(int); +typedef unsigned long sigset_t; #endif -#if defined(__CC_ARM) || defined(__CLANG_ARM) #include -typedef unsigned long sigset_t; + +#if defined(__CC_ARM) || defined(__CLANG_ARM) #define SIGHUP 1 /* #define SIGINT 2 */ @@ -105,8 +106,6 @@ typedef unsigned long sigset_t; #define SIG_BLOCK 1 /* set of signals to block */ #define SIG_UNBLOCK 2 /* set of signals to, well, unblock */ -typedef void (*_sig_func_ptr)(int); - struct sigaction { _sig_func_ptr sa_handler; @@ -124,8 +123,6 @@ int sigprocmask (int how, const sigset_t *set, sigset_t *oset); int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact); #elif defined(__IAR_SYSTEMS_ICC__) -#include -typedef unsigned long sigset_t; #define SIGHUP 1 #define SIGINT 2 @@ -161,8 +158,6 @@ typedef unsigned long sigset_t; #define SIG_BLOCK 1 /* set of signals to block */ #define SIG_UNBLOCK 2 /* set of signals to, well, unblock */ -typedef void (*_sig_func_ptr)(int); - struct sigaction { _sig_func_ptr sa_handler; -- cgit v1.3.1