summaryrefslogtreecommitdiff
path: root/components/libc/compilers/common
diff options
context:
space:
mode:
authorMan, Jianting (Meco) <[email protected]>2022-11-22 21:40:50 -0500
committerGitHub <[email protected]>2022-11-22 21:40:50 -0500
commitbdd663a33fb0af8864344a7bf568a706669d96d4 (patch)
treebae6015a528c29a38a2630670aa382d07322b771 /components/libc/compilers/common
parentfc83546cf5b7a412b9f191488cd50c90d22c93c6 (diff)
[libc][musl] support arm-linux-musleabi toolchain
目前基本功能已经可以在QEMU上跑起来,但是pthread和内核signal选中会报冲突。先合并一版本,后续解决这些问题。
Diffstat (limited to 'components/libc/compilers/common')
-rw-r--r--components/libc/compilers/common/include/sys/select.h2
-rw-r--r--components/libc/compilers/common/include/sys/signal.h15
-rw-r--r--components/libc/compilers/common/include/sys/time.h31
3 files changed, 22 insertions, 26 deletions
diff --git a/components/libc/compilers/common/include/sys/select.h b/components/libc/compilers/common/include/sys/select.h
index 9004658be9..32ce39c287 100644
--- a/components/libc/compilers/common/include/sys/select.h
+++ b/components/libc/compilers/common/include/sys/select.h
@@ -12,7 +12,7 @@
#ifndef __SYS_SELECT_H__
#define __SYS_SELECT_H__
-#include <rtthread.h>
+#include <rtconfig.h>
#include <sys/types.h>
#include <sys/time.h>
diff --git a/components/libc/compilers/common/include/sys/signal.h b/components/libc/compilers/common/include/sys/signal.h
index dbd947acb9..b92276ecb1 100644
--- a/components/libc/compilers/common/include/sys/signal.h
+++ b/components/libc/compilers/common/include/sys/signal.h
@@ -14,12 +14,11 @@
#ifdef __cplusplus
extern "C" {
-#endif
+#endif /* __cplusplus */
#include <stdint.h>
#include <sys/types.h>
-
/* sigev_notify values
NOTE: P1003.1c/D10, p. 34 adds SIGEV_THREAD. */
@@ -54,7 +53,6 @@ struct siginfo
{
uint16_t si_signo;
uint16_t si_code;
-
union sigval si_value;
};
typedef struct siginfo siginfo_t;
@@ -216,17 +214,16 @@ int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact)
#define SIGUSR2 31 /* user defined signal 2 */
#define NSIG 32 /* signal 0 implied */
-#ifndef _SIGNAL_H_
+#if defined(RT_USING_NEWLIBC)
/* 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
-
-#endif
+#endif /* defined(RT_USING_NEWLIBC) */
+#endif /* __ARMCC_VERSION */
#ifdef __cplusplus
}
-#endif
+#endif /* __cplusplus */
-#endif
+#endif /* __SYS_SIGNAL_H__ */
diff --git a/components/libc/compilers/common/include/sys/time.h b/components/libc/compilers/common/include/sys/time.h
index 346320bff0..e3bf3ee4ef 100644
--- a/components/libc/compilers/common/include/sys/time.h
+++ b/components/libc/compilers/common/include/sys/time.h
@@ -22,7 +22,7 @@ typedef __time64_t time_t;
#ifdef __cplusplus
extern "C" {
-#endif
+#endif /* __cplusplus */
#undef CLOCKS_PER_SEC
#define CLOCKS_PER_SEC RT_TICK_PER_SECOND
@@ -79,22 +79,21 @@ int stime(const time_t *t);
time_t timegm(struct tm * const t);
int gettimeofday(struct timeval *tv, struct timezone *tz);
int settimeofday(const struct timeval *tv, const struct timezone *tz);
-#if defined(__ARMCC_VERSION) || defined (__ICCARM__)
+
+#if defined(__ARMCC_VERSION) || defined (__ICCARM__) || defined(_WIN32)
struct tm *gmtime_r(const time_t *timep, struct tm *r);
-struct tm* localtime_r(const time_t* t, struct tm* r);
char* asctime_r(const struct tm *t, char *buf);
char *ctime_r(const time_t * tim_p, char * result);
-#elif defined(_WIN32)
-struct tm* gmtime_r(const time_t* timep, struct tm* r);
-struct tm* gmtime(const time_t* t);
struct tm* localtime_r(const time_t* t, struct tm* r);
+#endif /* defined(__ARMCC_VERSION) || defined (__ICCARM__) || defined(_WIN32) */
+
+#ifdef _WIN32
+struct tm* gmtime(const time_t* t);
struct tm* localtime(const time_t* t);
time_t mktime(struct tm* const t);
-char* asctime_r(const struct tm* t, char* buf);
-char* ctime_r(const time_t* tim_p, char* result);
char* ctime(const time_t* tim_p);
time_t time(time_t* t);
-#endif
+#endif /* _WIN32 */
#ifdef RT_USING_POSIX_DELAY
int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
@@ -112,20 +111,21 @@ int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
#ifndef CLOCK_REALTIME
#define CLOCK_REALTIME 1
-#endif
+#endif /* CLOCK_REALTIME */
#define CLOCK_CPUTIME_ID 2
#ifndef CLOCK_PROCESS_CPUTIME_ID
#define CLOCK_PROCESS_CPUTIME_ID CLOCK_CPUTIME_ID
-#endif
+#endif /* CLOCK_PROCESS_CPUTIME_ID */
+
#ifndef CLOCK_THREAD_CPUTIME_ID
#define CLOCK_THREAD_CPUTIME_ID CLOCK_CPUTIME_ID
-#endif
+#endif /* CLOCK_THREAD_CPUTIME_ID */
#ifndef CLOCK_MONOTONIC
#define CLOCK_MONOTONIC 4
-#endif
+#endif /* CLOCK_MONOTONIC */
#endif /* defined(RT_USING_POSIX_CLOCK) || defined (RT_USING_POSIX_TIMER) */
#ifdef RT_USING_POSIX_CLOCK
@@ -142,8 +142,7 @@ int timer_create(clockid_t clockid, struct sigevent *evp, timer_t *timerid);
int timer_delete(timer_t timerid);
int timer_getoverrun(timer_t timerid);
int timer_gettime(timer_t timerid, struct itimerspec *its);
-int timer_settime(timer_t timerid, int flags, const struct itimerspec *value,
- struct itimerspec *ovalue);
+int timer_settime(timer_t timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue);
#endif /* RT_USING_POSIX_TIMER */
/* timezone */
@@ -153,6 +152,6 @@ int8_t tz_is_dst(void);
#ifdef __cplusplus
}
-#endif
+#endif /* __cplusplus */
#endif /* _SYS_TIME_H_ */