Browse Source

[libc][musl]解决signal.h报错的问题

Meco Man 2 years ago
parent
commit
3e2beebe43
1 changed files with 15 additions and 7 deletions
  1. 15 7
      components/libc/compilers/common/include/sys/signal.h

+ 15 - 7
components/libc/compilers/common/include/sys/signal.h

@@ -139,8 +139,6 @@ int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact)
 #define SIGRTMAX    31
 #define NSIG        32
 
-#include <signal.h>
-
 #elif defined(__IAR_SYSTEMS_ICC__)
 #define SIGHUP       1
 #define SIGINT       2
@@ -175,8 +173,6 @@ int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact)
 #define SIGRTMAX    31
 #define NSIG        32
 
-#include <signal.h>
-
 #elif defined(__GNUC__)
 #define SIGHUP  1   /* hangup */
 #define SIGINT  2   /* interrupt */
@@ -213,13 +209,25 @@ int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact)
 #define SIGUSR1 30  /* user defined signal 1 */
 #define SIGUSR2 31  /* user defined signal 2 */
 #define NSIG    32      /* signal 0 implied */
+#endif /* __ARMCC_VERSION */
 
-#if defined(RT_USING_NEWLIBC)
+#ifndef RT_USING_MUSLLIBC
 /* Some applications take advantage of the fact that <sys/signal.h>
  * and <signal.h> are equivalent in glibc.  Allow for that here.  */
 #include <signal.h>
-#endif /* defined(RT_USING_NEWLIBC) */
-#endif /* __ARMCC_VERSION */
+#endif /* RT_USING_MUSLLIBC */
+
+#ifndef SIG_ERR
+#define SIG_ERR  ((void (*)(int))-1)
+#endif
+
+#ifndef SIG_DFL
+#define SIG_DFL  ((void (*)(int)) 0)
+#endif
+
+#ifndef SIG_IGN
+#define SIG_IGN  ((void (*)(int)) 1)
+#endif
 
 #ifdef __cplusplus
 }