diff --git a/apps/c/iperf/axbuild.mk b/apps/c/iperf/axbuild.mk index 842dbb4482..7c4dcf7aa9 100644 --- a/apps/c/iperf/axbuild.mk +++ b/apps/c/iperf/axbuild.mk @@ -28,4 +28,5 @@ $(APP)/%.c: @echo "Download iperf source code" wget https://downloads.es.net/pub/iperf/$(iperf_pkg).tar.gz -P $(APP) tar -zxvf $(APP)/$(iperf_pkg).tar.gz -C $(APP) && rm -f $(APP)/$(iperf_pkg).tar.gz + cd $(iperf_dir) && git init && git add . patch -p1 -N -d $(iperf_dir) --no-backup-if-mismatch -r - < $(APP)/iperf.patch diff --git a/ulib/axlibc/c/fcntl.c b/ulib/axlibc/c/fcntl.c index f6fce7051f..517c3ff301 100644 --- a/ulib/axlibc/c/fcntl.c +++ b/ulib/axlibc/c/fcntl.c @@ -1,5 +1,5 @@ -#include #include +#include #include #include diff --git a/ulib/axlibc/c/network.c b/ulib/axlibc/c/network.c index de5065665e..c00da7b45a 100644 --- a/ulib/axlibc/c/network.c +++ b/ulib/axlibc/c/network.c @@ -48,18 +48,18 @@ void freeaddrinfo(struct addrinfo *__restrict res) } static const char gai_msgs[] = "Invalid flags\0" - "Name does not resolve\0" - "Try again\0" - "Non-recoverable error\0" - "Unknown error\0" - "Unrecognized address family or invalid length\0" - "Unrecognized socket type\0" - "Unrecognized service\0" - "Unknown error\0" - "Out of memory\0" - "System error\0" - "Overflow\0" - "\0Unknown error"; + "Name does not resolve\0" + "Try again\0" + "Non-recoverable error\0" + "Unknown error\0" + "Unrecognized address family or invalid length\0" + "Unrecognized socket type\0" + "Unrecognized service\0" + "Unknown error\0" + "Out of memory\0" + "System error\0" + "Overflow\0" + "\0Unknown error"; const char *gai_strerror(int ecode) { diff --git a/ulib/axlibc/c/resource.c b/ulib/axlibc/c/resource.c index e22e3839e4..df7e6ee61e 100644 --- a/ulib/axlibc/c/resource.c +++ b/ulib/axlibc/c/resource.c @@ -1,5 +1,5 @@ -#include #include +#include #include #include diff --git a/ulib/axlibc/c/select.c b/ulib/axlibc/c/select.c index 3289ae2997..74dacfaf01 100644 --- a/ulib/axlibc/c/select.c +++ b/ulib/axlibc/c/select.c @@ -1,7 +1,7 @@ #ifdef AX_CONFIG_SELECT -#include #include +#include #include #include #include diff --git a/ulib/axlibc/c/stdio.c b/ulib/axlibc/c/stdio.c index 9a8cfdb8f0..98a32811a4 100644 --- a/ulib/axlibc/c/stdio.c +++ b/ulib/axlibc/c/stdio.c @@ -271,10 +271,9 @@ int fclose(FILE *f) } // TODO -int rename(const char *__old, const char *__new) +int rename(const char *old, const char *new) { - unimplemented(); - return 0; + return ax_rename(old, new); } int fileno(FILE *f) diff --git a/ulib/axlibc/c/time.c b/ulib/axlibc/c/time.c index 98490b35cf..a670c93e91 100644 --- a/ulib/axlibc/c/time.c +++ b/ulib/axlibc/c/time.c @@ -106,7 +106,7 @@ int __secs_to_tm(long long t, struct tm *tm) return 0; } -struct tm *__gmtime_r(const time_t *restrict t, struct tm *restrict tm) +struct tm *gmtime_r(const time_t *restrict t, struct tm *restrict tm) { if (__secs_to_tm(*t, tm) < 0) { errno = EOVERFLOW; @@ -114,15 +114,14 @@ struct tm *__gmtime_r(const time_t *restrict t, struct tm *restrict tm) } tm->tm_isdst = 0; tm->__tm_gmtoff = 0; - // TODO: set timezone - // tm->__tm_zone = __utc; + tm->__tm_zone = __utc; return tm; } struct tm *gmtime(const time_t *timer) { static struct tm tm; - return __gmtime_r(timer, &tm); + return gmtime_r(timer, &tm); } struct tm *localtime_r(const time_t *restrict t, struct tm *restrict tm) @@ -139,7 +138,7 @@ struct tm *localtime_r(const time_t *restrict t, struct tm *restrict tm) tm->tm_isdst = 0; tm->__tm_gmtoff = 0; - tm->__tm_zone = 0; + tm->__tm_zone = __utc; return tm; } diff --git a/ulib/axlibc/c/unistd.c b/ulib/axlibc/c/unistd.c index fc0210b167..ceb5fde841 100644 --- a/ulib/axlibc/c/unistd.c +++ b/ulib/axlibc/c/unistd.c @@ -1,6 +1,6 @@ +#include #include #include -#include #include #include #include diff --git a/ulib/axlibc/include/pthread.h b/ulib/axlibc/include/pthread.h index 0849622259..5f8cd98aa0 100644 --- a/ulib/axlibc/include/pthread.h +++ b/ulib/axlibc/include/pthread.h @@ -1,9 +1,8 @@ #ifndef _PTHREAD_H #define _PTHREAD_H -#include -#include #include +#include #define PTHREAD_CANCEL_ENABLE 0 #define PTHREAD_CANCEL_DISABLE 1 diff --git a/ulib/axlibc/include/stdbool.h b/ulib/axlibc/include/stdbool.h index af90479064..e3325f24c7 100644 --- a/ulib/axlibc/include/stdbool.h +++ b/ulib/axlibc/include/stdbool.h @@ -3,9 +3,9 @@ /* Represents true-or-false values */ #ifndef __cplusplus -#define true 1 +#define true 1 #define false 0 -#define bool _Bool +#define bool _Bool #endif #endif // __STDBOOL_H__ diff --git a/ulib/axlibc/include/stdio.h b/ulib/axlibc/include/stdio.h index 429f08999e..12aca2a885 100644 --- a/ulib/axlibc/include/stdio.h +++ b/ulib/axlibc/include/stdio.h @@ -35,7 +35,9 @@ extern FILE *const stderr; ##__VA_ARGS__) #else -#define unimplemented(fmt, ...) do {} while (0) +#define unimplemented(fmt, ...) \ + do { \ + } while (0) #endif @@ -58,7 +60,7 @@ FILE *freopen(const char *__restrict, const char *__restrict, FILE *__restrict); int fclose(FILE *); int remove(const char *); -int rename(const char *__old, const char *__new); +int rename(const char *, const char *); int feof(FILE *__stream); int ferror(FILE *); diff --git a/ulib/axlibc/include/stdlib.h b/ulib/axlibc/include/stdlib.h index e2a38ab3c6..411ea48b17 100644 --- a/ulib/axlibc/include/stdlib.h +++ b/ulib/axlibc/include/stdlib.h @@ -1,8 +1,8 @@ #ifndef __STDLIB_H__ #define __STDLIB_H__ -#include #include +#include #define RAND_MAX (0x7fffffff) @@ -51,7 +51,7 @@ int abs(int); long labs(long); long long llabs(long long); -int mkstemp (char *); +int mkstemp(char *); int mkostemp(char *, int); int setenv(const char *, const char *, int); int unsetenv(const char *); diff --git a/ulib/axlibc/include/sys/time.h b/ulib/axlibc/include/sys/time.h index f444b0c560..5eeaf4c6b6 100644 --- a/ulib/axlibc/include/sys/time.h +++ b/ulib/axlibc/include/sys/time.h @@ -33,6 +33,9 @@ struct itimerval { }; int gettimeofday(struct timeval *tv, struct timezone *tz); + +int getitimer(int, struct itimerval *); +int setitimer(int, const struct itimerval *__restrict, struct itimerval *__restrict); int utimes(const char *filename, const struct timeval times[2]); #endif diff --git a/ulib/axlibc/include/time.h b/ulib/axlibc/include/time.h index e07867000f..356edf9206 100644 --- a/ulib/axlibc/include/time.h +++ b/ulib/axlibc/include/time.h @@ -22,25 +22,22 @@ struct tm { const char *__tm_zone; }; -size_t strftime(char *__restrict__ _Buf, size_t _SizeInBytes, const char *__restrict__ _Format, - const struct tm *__restrict__ _Tm); - -struct tm *gmtime(const time_t *timer); +clock_t clock(void); +time_t time(time_t *); +double difftime(time_t, time_t); +time_t mktime(struct tm *); +size_t strftime(char *__restrict, size_t, const char *__restrict, const struct tm *__restrict); +struct tm *gmtime(const time_t *); +struct tm *localtime(const time_t *); -struct tm *localtime(const time_t *timep); -struct tm *localtime_r(const time_t *__restrict__ __timer, struct tm *__restrict__ __tp); +struct tm *gmtime_r(const time_t *__restrict, struct tm *__restrict); +struct tm *localtime_r(const time_t *__restrict, struct tm *__restrict); +char *asctime_r(const struct tm *__restrict, char *__restrict); +char *ctime_r(const time_t *, char *); -time_t time(time_t *t); -int clock_gettime(clockid_t _clk, struct timespec *ts); -int nanosleep(const struct timespec *requested_time, struct timespec *remaining); void tzset(void); -int setitimer(int which, const struct itimerval *restrict new, struct itimerval *restrict old); -char *ctime_r(const time_t *t, char *buf); -clock_t clock(void); - -double difftime(time_t, time_t); - -time_t mktime(struct tm *); +int nanosleep(const struct timespec *requested_time, struct timespec *remaining); +int clock_gettime(clockid_t _clk, struct timespec *ts); #endif // __TIME_H__ diff --git a/ulib/axlibc/include/unistd.h b/ulib/axlibc/include/unistd.h index e0d1919193..46b580df82 100644 --- a/ulib/axlibc/include/unistd.h +++ b/ulib/axlibc/include/unistd.h @@ -1,8 +1,8 @@ #ifndef __UNISTD_H__ #define __UNISTD_H__ -#include #include +#include #include #define STDIN_FILENO 0