Compare commits
18 Commits
weekly_202
...
weekly_202
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6d021bede | ||
|
|
d7f3aef326 | ||
|
|
59fbe91d8b | ||
|
|
c7088f4d0f | ||
|
|
705bfbdc76 | ||
|
|
9a4e9677bd | ||
|
|
6134d4bd22 | ||
|
|
c119b7e9e2 | ||
|
|
dbf0498bab | ||
|
|
68b142cf78 | ||
|
|
22b7eb87ca | ||
|
|
ed50f7e373 | ||
|
|
2f2a0b7a75 | ||
|
|
1ae62ebf2e | ||
|
|
25278a02eb | ||
|
|
52bc16c3db | ||
|
|
733b6e6c6c | ||
|
|
6562536db7 |
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
@@ -63,12 +63,13 @@ STATIC INLINE UINTPTR ArchMspGet(VOID)
|
||||
return msp;
|
||||
}
|
||||
|
||||
STATIC INLINE UINTPTR ArchLRGet(VOID)
|
||||
{
|
||||
UINTPTR lr;
|
||||
__asm("mov %0, lr" : "=r" (lr));
|
||||
return lr;
|
||||
}
|
||||
#define ARCH_LR_GET() \
|
||||
({ \
|
||||
UINTPTR lr; \
|
||||
__asm("mov %0, lr" : "=r" (lr)); \
|
||||
(lr); \
|
||||
})
|
||||
#define ArchLRGet ARCH_LR_GET
|
||||
#elif defined(__CLANG_ARM) || defined(__GNUC__)
|
||||
STATIC INLINE UINTPTR ArchSpGet(VOID)
|
||||
{
|
||||
@@ -91,12 +92,13 @@ STATIC INLINE UINTPTR ArchMspGet(VOID)
|
||||
return msp;
|
||||
}
|
||||
|
||||
STATIC INLINE UINTPTR ArchLRGet(VOID)
|
||||
{
|
||||
UINTPTR lr;
|
||||
__asm volatile("mov %0, lr" : "=r" (lr));
|
||||
return lr;
|
||||
}
|
||||
#define ARCH_LR_GET() \
|
||||
({ \
|
||||
UINTPTR lr; \
|
||||
__asm volatile("mov %0, lr" : "=r" (lr)); \
|
||||
(lr); \
|
||||
})
|
||||
#define ArchLRGet ARCH_LR_GET
|
||||
#else
|
||||
/* Other platforms to be improved */
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
@@ -50,14 +50,6 @@
|
||||
#include "vfs_mount.h"
|
||||
#include "vfs_operations.h"
|
||||
|
||||
#if (LOSCFG_LIBC_NEWLIB == 1)
|
||||
#define ALIAS_OF(of) __attribute__((alias(#of)))
|
||||
#define FUNC_ALIAS(real_func, new_alias, args_list, return_type) \
|
||||
return_type new_alias args_list ALIAS_OF(real_func)
|
||||
#else
|
||||
#define FUNC_ALIAS(real_func, new_alias, args_list, return_type)
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_NET_LWIP_SACK
|
||||
#include "lwipopts.h"
|
||||
#include "lwip/sockets.h"
|
||||
@@ -563,7 +555,9 @@ int open(const char *path, int flags, ...)
|
||||
int ret = VfsOpen(path, flags);
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
#if (LOSCFG_LIBC_NEWLIB == 1)
|
||||
FUNC_ALIAS(open, _open, (const char *path, int flags, ...), int);
|
||||
#endif
|
||||
|
||||
int close(int fd)
|
||||
{
|
||||
@@ -589,7 +583,9 @@ int close(int fd)
|
||||
}
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
#if (LOSCFG_LIBC_NEWLIB == 1)
|
||||
FUNC_ALIAS(close, _close, (int fd), int);
|
||||
#endif
|
||||
|
||||
ssize_t read(int fd, void *buff, size_t bytes)
|
||||
{
|
||||
@@ -632,7 +628,9 @@ ssize_t read(int fd, void *buff, size_t bytes)
|
||||
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
#if (LOSCFG_LIBC_NEWLIB == 1)
|
||||
FUNC_ALIAS(read, _read, (int fd, void *buff, size_t bytes), ssize_t);
|
||||
#endif
|
||||
|
||||
ssize_t write(int fd, const void *buff, size_t bytes)
|
||||
{
|
||||
@@ -662,7 +660,9 @@ ssize_t write(int fd, const void *buff, size_t bytes)
|
||||
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
#if (LOSCFG_LIBC_NEWLIB == 1)
|
||||
FUNC_ALIAS(write, _write, (int fd, const void *buff, size_t bytes), ssize_t);
|
||||
#endif
|
||||
|
||||
off_t lseek(int fd, off_t off, int whence)
|
||||
{
|
||||
@@ -683,7 +683,9 @@ off_t lseek(int fd, off_t off, int whence)
|
||||
VfsDetachFile(file);
|
||||
return ret;
|
||||
}
|
||||
#if (LOSCFG_LIBC_NEWLIB == 1)
|
||||
FUNC_ALIAS(lseek, _lseek, (int fd, off_t off, int whence), off_t);
|
||||
#endif
|
||||
|
||||
int stat(const char *path, struct stat *stat)
|
||||
{
|
||||
@@ -721,7 +723,9 @@ int stat(const char *path, struct stat *stat)
|
||||
LOS_FsUnlock();
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
#if (LOSCFG_LIBC_NEWLIB == 1)
|
||||
FUNC_ALIAS(stat, _stat, (const char *path, struct stat *stat), int);
|
||||
#endif
|
||||
|
||||
int statfs(const char *path, struct statfs *buf)
|
||||
{
|
||||
@@ -750,7 +754,7 @@ int statfs(const char *path, struct statfs *buf)
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
|
||||
if (mp->mFs->fsFops->stat != NULL) {
|
||||
if (mp->mFs->fsMops->statfs != NULL) {
|
||||
ret = mp->mFs->fsMops->statfs(pathInMp, buf);
|
||||
} else {
|
||||
VFS_ERRNO_SET(ENOTSUP);
|
||||
@@ -788,7 +792,9 @@ int unlink(const char *path)
|
||||
LOS_FsUnlock();
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
#if (LOSCFG_LIBC_NEWLIB == 1)
|
||||
FUNC_ALIAS(unlink, _unlink, (const char *path), int);
|
||||
#endif
|
||||
|
||||
int rename(const char *oldpath, const char *newpath)
|
||||
{
|
||||
@@ -1082,7 +1088,9 @@ int fstat(int fd, struct stat *buf)
|
||||
VfsDetachFile(filep);
|
||||
return ret;
|
||||
}
|
||||
#if (LOSCFG_LIBC_NEWLIB == 1)
|
||||
FUNC_ALIAS(fstat, _fstat, (int fd, struct stat *buf), int);
|
||||
#endif
|
||||
|
||||
int fcntl(int fd, int cmd, ...)
|
||||
{
|
||||
|
||||
@@ -250,7 +250,7 @@ STATIC int VfsRemount(const char *source, const char *target,
|
||||
STATIC int VfsMountPathCheck(const char *target)
|
||||
{
|
||||
/* target must begin with '/', for example /system, /data, etc. */
|
||||
if ((target == NULL) || (target[0] != '/') || (target[0] == '\0')) {
|
||||
if ((target == NULL) || (target[0] != '/')) {
|
||||
errno = EINVAL;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
@@ -181,6 +181,7 @@ VOID OsLs(const CHAR *pathname)
|
||||
d = opendir(path);
|
||||
if (d == NULL) {
|
||||
PRINT_ERR("No such directory = %s\n", path);
|
||||
free(path);
|
||||
} else {
|
||||
PRINTK("Directory %s:\n", path);
|
||||
do {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
@@ -38,11 +38,9 @@ config LIBC_MUSL
|
||||
|
||||
config LIBC_NEWLIB
|
||||
bool "newlibc"
|
||||
rsource "newlib/Kconfig"
|
||||
|
||||
config LIBC_ICCARM
|
||||
bool "iar libc"
|
||||
depends on COMPILER_ICCARM
|
||||
rsource "iccarm/Kconfig"
|
||||
|
||||
endchoice
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
if LIBC_ICCARM
|
||||
|
||||
config LIBC_ICCARM_MALLOC
|
||||
bool "Enable POSIX malloc/free API support"
|
||||
default y
|
||||
help
|
||||
This enables POSIX malloc/free related APIs.
|
||||
|
||||
endif # LIBC_ICCARM
|
||||
@@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
@@ -33,7 +33,6 @@ import("//third_party/musl/porting/liteos_m/kernel/musl.gni")
|
||||
module_switch = defined(LOSCFG_LIBC_MUSL)
|
||||
module_name = get_path_info(rebase_path("."), "name")
|
||||
kernel_module(module_name) {
|
||||
sources = [ "malloc.c" ]
|
||||
configs += [ "$LITEOSTOPDIR:warn_config" ]
|
||||
|
||||
deps = [ "//third_party/musl/porting/liteos_m/kernel" ]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
@@ -33,13 +33,11 @@ module_switch = defined(LOSCFG_LIBC_NEWLIB)
|
||||
module_name = get_path_info(rebase_path("."), "name")
|
||||
kernel_module(module_name) {
|
||||
sources = [
|
||||
"porting/src/malloc.c",
|
||||
"porting/src/hook_adapt.c",
|
||||
"porting/src/network/htonl.c",
|
||||
"porting/src/network/htons.c",
|
||||
"porting/src/network/ntohl.c",
|
||||
"porting/src/network/ntohs.c",
|
||||
"porting/src/other_adapt.c",
|
||||
"porting/src/time.c",
|
||||
]
|
||||
configs += [ "$LITEOSTOPDIR:warn_config" ]
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
if LIBC_NEWLIB
|
||||
|
||||
config LIBC_NEWLIB_MALLOC
|
||||
bool "Enable POSIX malloc/free API support"
|
||||
default y
|
||||
help
|
||||
This enables POSIX malloc/free related APIs.
|
||||
|
||||
endif # LIBC_NEWLIB
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
@@ -35,6 +35,12 @@
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
|
||||
/*
|
||||
* fs adapter interface, such as _read, see component/fs
|
||||
* time adapter interface, such as _gettimeofday, see posix/src/time.c
|
||||
* malloc adapter interface, such as _malloc_r, see posix/src/malloc.c
|
||||
*/
|
||||
|
||||
int _isatty(int file)
|
||||
{
|
||||
return (int)(file <= 2); // 2: stderr
|
||||
@@ -1,115 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "securec.h"
|
||||
#include "los_config.h"
|
||||
#include "los_memory.h"
|
||||
#include <malloc.h>
|
||||
|
||||
#ifdef LOSCFG_LIBC_NEWLIB_MALLOC
|
||||
void *zalloc(size_t size)
|
||||
{
|
||||
void *ptr = NULL;
|
||||
|
||||
if (size == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ptr = LOS_MemAlloc(OS_SYS_MEM_ADDR, size);
|
||||
if (ptr != NULL) {
|
||||
(void)memset_s(ptr, size, 0, size);
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void __wrap__free_r(struct _reent *reent, void *aptr)
|
||||
{
|
||||
if (aptr == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOS_MemFree(OS_SYS_MEM_ADDR, aptr);
|
||||
}
|
||||
|
||||
size_t __wrap__malloc_usable_size_r(struct _reent *reent, void *aptr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *__wrap__malloc_r(struct _reent *reent, size_t nbytes)
|
||||
{
|
||||
if (nbytes == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return LOS_MemAlloc(OS_SYS_MEM_ADDR, nbytes);
|
||||
}
|
||||
|
||||
void *__wrap__memalign_r(struct _reent *reent, size_t align, size_t nbytes)
|
||||
{
|
||||
if (nbytes == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return LOS_MemAllocAlign(OS_SYS_MEM_ADDR, nbytes, align);
|
||||
}
|
||||
|
||||
void *__wrap__realloc_r(struct _reent *reent, void *aptr, size_t nbytes)
|
||||
{
|
||||
if (aptr == NULL) {
|
||||
return malloc(nbytes);
|
||||
}
|
||||
|
||||
if (nbytes == 0) {
|
||||
free(aptr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return LOS_MemRealloc(OS_SYS_MEM_ADDR, aptr, nbytes);
|
||||
}
|
||||
|
||||
void *__wrap__calloc_r(struct _reent *reent, size_t nitems, size_t size)
|
||||
{
|
||||
size_t real_size;
|
||||
void *ptr = NULL;
|
||||
|
||||
if (nitems == 0 || size == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
real_size = (size_t)(nitems * size);
|
||||
ptr = LOS_MemAlloc(OS_SYS_MEM_ADDR, real_size);
|
||||
if (ptr != NULL) {
|
||||
(void)memset_s(ptr, real_size, 0, real_size);
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
#endif
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "los_tick.h"
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#define SECS_PER_MIN 60
|
||||
|
||||
int _gettimeofday(struct timeval *__tp, void *__tzp)
|
||||
{
|
||||
struct timespec ts;
|
||||
struct timezone *tz = (struct timezone *)__tzp;
|
||||
|
||||
if (__tp != NULL) {
|
||||
if (-1 == clock_gettime(CLOCK_REALTIME, &ts)) {
|
||||
return -1;
|
||||
}
|
||||
__tp->tv_sec = ts.tv_sec;
|
||||
__tp->tv_usec = ts.tv_nsec / OS_SYS_NS_PER_US;
|
||||
}
|
||||
if (tz != NULL) {
|
||||
tz->tz_minuteswest = _timezone / SECS_PER_MIN;
|
||||
tz->tz_dsttime = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
@@ -67,6 +67,10 @@ kernel_module(module_name) {
|
||||
if (defined(LOSCFG_POSIX_SIGNAL_API)) {
|
||||
sources += [ "src/signal.c" ]
|
||||
}
|
||||
|
||||
if (defined(LOSCFG_POSIX_MALLOC_API)) {
|
||||
sources += [ "src/malloc.c" ]
|
||||
}
|
||||
}
|
||||
|
||||
config("public") {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
@@ -80,4 +80,10 @@ config POSIX_FS_API
|
||||
help
|
||||
Answer Y to enable LiteOS support POSIX FS API.
|
||||
|
||||
config POSIX_MALLOC_API
|
||||
bool "Enable POSIX MALLOC API"
|
||||
default y
|
||||
help
|
||||
Answer Y to enable LiteOS support POSIX MALLOC API.
|
||||
|
||||
endif # POSIX_API
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
@@ -34,8 +34,15 @@
|
||||
#include "los_config.h"
|
||||
#include "los_memory.h"
|
||||
|
||||
#if (LOSCFG_LIBC_NEWLIB == 1)
|
||||
void *__wrap__calloc_r(struct _reent *reent, size_t nitems, size_t size)
|
||||
#else
|
||||
void *calloc(size_t nitems, size_t size)
|
||||
#endif
|
||||
{
|
||||
#if (LOSCFG_LIBC_NEWLIB == 1)
|
||||
(void)reent;
|
||||
#endif
|
||||
size_t real_size;
|
||||
void *ptr = NULL;
|
||||
|
||||
@@ -51,8 +58,15 @@ void *calloc(size_t nitems, size_t size)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#if (LOSCFG_LIBC_NEWLIB == 1)
|
||||
void __wrap__free_r(struct _reent *reent, void *ptr)
|
||||
#else
|
||||
void free(void *ptr)
|
||||
#endif
|
||||
{
|
||||
#if (LOSCFG_LIBC_NEWLIB == 1)
|
||||
(void)reent;
|
||||
#endif
|
||||
if (ptr == NULL) {
|
||||
return;
|
||||
}
|
||||
@@ -60,8 +74,24 @@ void free(void *ptr)
|
||||
LOS_MemFree(OS_SYS_MEM_ADDR, ptr);
|
||||
}
|
||||
|
||||
void *malloc(size_t size)
|
||||
#if (LOSCFG_LIBC_NEWLIB == 1)
|
||||
size_t __wrap__malloc_usable_size_r(struct _reent *reent, void *aptr)
|
||||
{
|
||||
(void)reent;
|
||||
(void)aptr;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_LIBC_NEWLIB == 1)
|
||||
void *__wrap__malloc_r(struct _reent *reent, size_t size)
|
||||
#else
|
||||
void *malloc(size_t size)
|
||||
#endif
|
||||
{
|
||||
#if (LOSCFG_LIBC_NEWLIB == 1)
|
||||
(void)reent;
|
||||
#endif
|
||||
if (size == 0) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -84,8 +114,15 @@ void *zalloc(size_t size)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#if (LOSCFG_LIBC_NEWLIB == 1)
|
||||
void *__wrap__memalign_r(struct _reent *reent, size_t boundary, size_t size)
|
||||
#else
|
||||
void *memalign(size_t boundary, size_t size)
|
||||
#endif
|
||||
{
|
||||
#if (LOSCFG_LIBC_NEWLIB == 1)
|
||||
(void)reent;
|
||||
#endif
|
||||
if (size == 0) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -93,8 +130,15 @@ void *memalign(size_t boundary, size_t size)
|
||||
return LOS_MemAllocAlign(OS_SYS_MEM_ADDR, size, boundary);
|
||||
}
|
||||
|
||||
#if (LOSCFG_LIBC_NEWLIB == 1)
|
||||
void *__wrap__realloc_r(struct _reent *reent, void *ptr, size_t size)
|
||||
#else
|
||||
void *realloc(void *ptr, size_t size)
|
||||
#endif
|
||||
{
|
||||
#if (LOSCFG_LIBC_NEWLIB == 1)
|
||||
(void)reent;
|
||||
#endif
|
||||
if (ptr == NULL) {
|
||||
return malloc(size);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
@@ -50,7 +50,6 @@
|
||||
/* accumulative time delta from discontinuous modify */
|
||||
STATIC struct timespec g_accDeltaFromSet;
|
||||
|
||||
#ifndef __USE_NEWLIB__
|
||||
STATIC const UINT16 g_daysInMonth[2][13] = {
|
||||
/* Normal years. */
|
||||
{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
|
||||
@@ -59,20 +58,18 @@ STATIC const UINT16 g_daysInMonth[2][13] = {
|
||||
};
|
||||
|
||||
STATIC const UINT8 g_montbl[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
#endif
|
||||
|
||||
#ifndef __USE_NEWLIB__
|
||||
#define g_timezone timezone
|
||||
#if (LOSCFG_LIBC_NEWLIB == 1)
|
||||
#define TIMEZONE _timezone
|
||||
#else
|
||||
#define g_Timezone _timezone
|
||||
#endif
|
||||
|
||||
#define TIMEZONE timezone
|
||||
/*
|
||||
* Time zone information, stored in seconds,
|
||||
* negative values indicate the east of UTC,
|
||||
* positive values indicate the west of UTC.
|
||||
*/
|
||||
long g_timezone = -8 * 60 * 60; // set default to CST(UTC+8)
|
||||
long TIMEZONE = -8 * 60 * 60; // set default to CST(UTC+8)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* store register rtc func
|
||||
@@ -529,7 +526,6 @@ time_t time(time_t *timer)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef __USE_NEWLIB__
|
||||
/*
|
||||
* Compute the `struct tm' representation of T,
|
||||
* offset OFFSET seconds east of UTC,
|
||||
@@ -621,7 +617,7 @@ struct tm *localtime_r(const time_t *timep, struct tm *result)
|
||||
errno = EFAULT;
|
||||
return NULL;
|
||||
}
|
||||
if (!ConvertSecs2Utc(*timep, -g_timezone, result)) {
|
||||
if (!ConvertSecs2Utc(*timep, -TIMEZONE, result)) {
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
@@ -664,7 +660,7 @@ static time_t ConvertUtc2Secs(struct tm *tm)
|
||||
seconds += (tm->tm_mday - 1) * SECS_PER_DAY;
|
||||
seconds += tm->tm_hour * SECS_PER_HOUR + tm->tm_min * SECS_PER_MIN + tm->tm_sec;
|
||||
|
||||
seconds += g_timezone;
|
||||
seconds += TIMEZONE;
|
||||
return seconds;
|
||||
}
|
||||
|
||||
@@ -690,7 +686,7 @@ time_t mktime(struct tm *tmptr)
|
||||
}
|
||||
timeInSeconds = ConvertUtc2Secs(tmptr);
|
||||
/* normalize tm_wday and tm_yday */
|
||||
ConvertSecs2Utc(timeInSeconds, -g_timezone, tmptr);
|
||||
ConvertSecs2Utc(timeInSeconds, -TIMEZONE, tmptr);
|
||||
return timeInSeconds;
|
||||
}
|
||||
|
||||
@@ -724,18 +720,20 @@ int gettimeofday(struct timeval *tv, void *ptz)
|
||||
}
|
||||
|
||||
if (tz != NULL) {
|
||||
INT32 timeZone = 0;
|
||||
if (g_rtcTimeFunc.RtcGetTimezoneHook != NULL) {
|
||||
g_rtcTimeFunc.RtcGetTimezoneHook(&timeZone);
|
||||
tz->tz_minuteswest = timezone / SECS_PER_MIN;
|
||||
INT32 tempTimezone = 0;
|
||||
g_rtcTimeFunc.RtcGetTimezoneHook(&tempTimezone);
|
||||
tz->tz_minuteswest = tempTimezone / SECS_PER_MIN;
|
||||
} else {
|
||||
tz->tz_minuteswest = g_timezone / SECS_PER_MIN;
|
||||
tz->tz_minuteswest = TIMEZONE / SECS_PER_MIN;
|
||||
}
|
||||
|
||||
tz->tz_dsttime = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#if (LOSCFG_LIBC_NEWLIB == 1)
|
||||
FUNC_ALIAS(gettimeofday, _gettimeofday, (struct timeval *tv, void *ptz), int);
|
||||
#endif
|
||||
|
||||
int settimeofday(const struct timeval *tv, const struct timezone *tz)
|
||||
@@ -755,14 +753,14 @@ int settimeofday(const struct timeval *tv, const struct timezone *tz)
|
||||
if (tz != NULL) {
|
||||
if ((tz->tz_minuteswest >= TIME_ZONE_MIN) &&
|
||||
(tz->tz_minuteswest <= TIME_ZONE_MAX)) {
|
||||
g_timezone = tz->tz_minuteswest * SECS_PER_MIN;
|
||||
TIMEZONE = tz->tz_minuteswest * SECS_PER_MIN;
|
||||
} else {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (g_rtcTimeFunc.RtcSetTimezoneHook != NULL) {
|
||||
g_rtcTimeFunc.RtcSetTimezoneHook(g_timezone);
|
||||
g_rtcTimeFunc.RtcSetTimezoneHook(TIMEZONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -352,15 +352,10 @@ LITE_TEST_CASE(CmsisFuncTestSuite, TestCmsis004, Function | MediumTest | Level1)
|
||||
ret = strcmp(staticBuff, strbuff);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
|
||||
|
||||
ret = osMessageQueueDelete(msgQueueId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
#endif
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
ret = osMessageQueueDelete(msgQueueId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
#endif
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ static VOID TaskF01(VOID)
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testAtomicID03, i, g_testAtomicID03);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, g_testAtomicID03, ret);
|
||||
|
||||
LOS_AtomicAdd(&g_testCount, 1);
|
||||
LOS_AtomicAdd((Atomic *)(&g_testCount), 1);
|
||||
}
|
||||
|
||||
static UINT32 TestCase(VOID)
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01()
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ static int g_uwIndex;
|
||||
#else
|
||||
#define TEST_MAX_NUMBER_HWI (OS_USER_HWI_MAX - HWI_NUM_INT0)
|
||||
#define TEST_HWI_COUNT (TEST_MAX_NUMBER_HWI - 2)
|
||||
#undef HWI_NUM_INT0
|
||||
#define HWI_NUM_INT0 HWI_NUM_INT1
|
||||
#endif
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ static VOID HwiF01(VOID)
|
||||
|
||||
return;
|
||||
}
|
||||
#undef HWI_NUM_INT0
|
||||
#define HWI_NUM_INT0 HWI_NUM_TEST1
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "los_timer.h"
|
||||
#include "los_sched.h"
|
||||
|
||||
#define myprintf // printf
|
||||
#define myprintf printf
|
||||
#define TEST_LOOP 5
|
||||
static EVENT_CB_S g_pmTestEvent;
|
||||
static UINT32 g_taskID1, g_taskID2;
|
||||
|
||||
@@ -36,6 +36,15 @@ EVENT_CB_S g_eventCB0;
|
||||
EVENT_CB_S g_eventCB1;
|
||||
EVENT_CB_S g_eventCB2;
|
||||
EVENT_CB_S g_eventCB3;
|
||||
UINT32 g_swtmrId1;
|
||||
UINT32 g_swtmrId2;
|
||||
UINT32 g_swtmrId3;
|
||||
UINT32 g_swtmrCountA;
|
||||
UINT32 g_swtmrCountB;
|
||||
UINT32 g_swtmrCountC;
|
||||
UINT32 g_uwsTick1;
|
||||
UINT32 g_uwsTick2;
|
||||
UINT32 g_uwsTick3;
|
||||
|
||||
VOID ItSuiteLosSwtmr(void)
|
||||
{
|
||||
|
||||
@@ -56,17 +56,17 @@ extern EVENT_CB_S g_eventCB3;
|
||||
|
||||
extern UINT32 g_idleTaskID;
|
||||
|
||||
static UINT32 g_swtmrId1;
|
||||
static UINT32 g_swtmrId2;
|
||||
static UINT32 g_swtmrId3;
|
||||
extern UINT32 g_swtmrId1;
|
||||
extern UINT32 g_swtmrId2;
|
||||
extern UINT32 g_swtmrId3;
|
||||
|
||||
static UINT32 g_swtmrCountA;
|
||||
static UINT32 g_swtmrCountB;
|
||||
static UINT32 g_swtmrCountC;
|
||||
extern UINT32 g_swtmrCountA;
|
||||
extern UINT32 g_swtmrCountB;
|
||||
extern UINT32 g_swtmrCountC;
|
||||
|
||||
static UINT32 g_uwsTick1;
|
||||
static UINT32 g_uwsTick2;
|
||||
static UINT32 g_uwsTick3;
|
||||
extern UINT32 g_uwsTick1;
|
||||
extern UINT32 g_uwsTick2;
|
||||
extern UINT32 g_uwsTick3;
|
||||
|
||||
extern VOID LOS_GetCpuTick(UINT32 *puwCntHi, UINT32 *puwCntLo);
|
||||
extern VOID ItSuiteLosSwtmr(VOID);
|
||||
|
||||
@@ -48,7 +48,7 @@ static VOID Case1(UINT32 arg)
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID Case2()
|
||||
static VOID Case2(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ static VOID Case1(UINT32 arg)
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID Case2()
|
||||
static VOID Case2(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 uwloop = 1000;
|
||||
|
||||
@@ -41,7 +41,7 @@ static VOID Case1(UINT32 arg)
|
||||
g_testCount = 30;
|
||||
}
|
||||
|
||||
static VOID Case2()
|
||||
static VOID Case2(VOID)
|
||||
{
|
||||
// 10, Here, assert that g_testCount is equal to this .
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 10, g_testCount);
|
||||
@@ -49,7 +49,7 @@ static VOID Case2()
|
||||
g_testCount = 20;
|
||||
}
|
||||
|
||||
static VOID Case3()
|
||||
static VOID Case3(VOID)
|
||||
{
|
||||
// 10, Set the number to determine whether the process is as expected.
|
||||
g_testCount = 10;
|
||||
|
||||
@@ -51,7 +51,7 @@ EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
static VOID Case2()
|
||||
static VOID Case2(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
|
||||
@@ -50,14 +50,14 @@ static VOID Case1(UINT32 arg)
|
||||
g_testCount = 10;
|
||||
}
|
||||
|
||||
static VOID Case2()
|
||||
static VOID Case2(VOID)
|
||||
{
|
||||
// 20, Here, assert that g_testCount is equal to this .
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 20, g_testCount);
|
||||
g_testCount++;
|
||||
}
|
||||
|
||||
static VOID Case3()
|
||||
static VOID Case3(VOID)
|
||||
{
|
||||
UINT32 index;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "It_los_swtmr.h"
|
||||
|
||||
|
||||
static VOID Case1()
|
||||
static VOID Case1(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
@@ -43,7 +43,7 @@ static VOID Case1()
|
||||
}
|
||||
}
|
||||
|
||||
static VOID Case2()
|
||||
static VOID Case2(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
@@ -53,7 +53,7 @@ static VOID Case2()
|
||||
}
|
||||
}
|
||||
|
||||
static VOID Case3()
|
||||
static VOID Case3(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
@@ -64,7 +64,7 @@ static VOID Case3()
|
||||
}
|
||||
}
|
||||
|
||||
VOID Case4()
|
||||
static VOID Case4(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
@@ -77,7 +77,7 @@ VOID Case4()
|
||||
}
|
||||
}
|
||||
|
||||
VOID Case5()
|
||||
static VOID Case5(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
@@ -90,7 +90,7 @@ VOID Case5()
|
||||
}
|
||||
}
|
||||
|
||||
VOID Case6()
|
||||
static VOID Case6(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ mqd_t g_mqueueId[LOSCFG_BASE_IPC_QUEUE_CONFIG + 1];
|
||||
SEM_HANDLE_T g_mqueueSem;
|
||||
mqd_t g_messageQId;
|
||||
mqd_t g_gqueue;
|
||||
TSK_HANDLE_T g_mqueueTaskPID;
|
||||
|
||||
VOID TestAssertWaitDelay(UINT32 *testCount, UINT32 flag)
|
||||
{
|
||||
|
||||
@@ -57,18 +57,19 @@
|
||||
#define MQUEUE_PRIORITY_TEST 0
|
||||
#define MQUEUE_TIMEOUT_TEST 7
|
||||
#define MQUEUE_PRIORITY_NUM_TEST 3
|
||||
#define MQUEUE_MAX_NUM_TEST (LOSCFG_BASE_IPC_QUEUE_CONFIG - QUEUE_EXISTED_NUM)
|
||||
#define MQ_MAX_MSG_NUM 16
|
||||
#define MQ_MAX_MSG_LEN 64
|
||||
#undef HWI_NUM_TEST
|
||||
#define HWI_NUM_TEST 1
|
||||
#undef HWI_NUM_TEST1
|
||||
#define HWI_NUM_TEST1 2
|
||||
|
||||
#if (LOSCFG_LIBC_NEWLIB == 1)
|
||||
#define MQ_PRIO_MAX 1
|
||||
#endif
|
||||
|
||||
#undef LOSCFG_BASE_IPC_QUEUE_CONFIG
|
||||
#define LOSCFG_BASE_IPC_QUEUE_CONFIG 1024
|
||||
|
||||
#define LOS_AtomicInc(a) (++*(a))
|
||||
#define MqueueTaskDelay(tick) (usleep((tick) * 10000))
|
||||
|
||||
@@ -91,7 +92,7 @@ typedef UINT32 SEM_HANDLE_T ;
|
||||
|
||||
extern SEM_HANDLE_T g_mqueueSem;
|
||||
|
||||
static TSK_HANDLE_T g_mqueueTaskPID;
|
||||
extern TSK_HANDLE_T g_mqueueTaskPID;
|
||||
extern CHAR g_gqname[MQUEUE_STANDARD_NAME_LENGTH];
|
||||
extern CHAR g_mqueueName[LOSCFG_BASE_IPC_QUEUE_CONFIG + 1][MQUEUE_STANDARD_NAME_LENGTH];
|
||||
extern mqd_t g_mqueueId[LOSCFG_BASE_IPC_QUEUE_CONFIG + 1];
|
||||
|
||||
@@ -34,8 +34,6 @@ static UINT32 Testcase(VOID)
|
||||
CHAR qname[MQUEUE_STANDARD_NAME_LENGTH] = "";
|
||||
const CHAR *msgptr = MQUEUE_SEND_STRING_TEST;
|
||||
mqd_t queue;
|
||||
INT32 unresolved = 0;
|
||||
INT32 failure = 0;
|
||||
INT32 ret = 0;
|
||||
|
||||
ret = snprintf_s(qname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1, \
|
||||
|
||||
@@ -34,8 +34,6 @@ static UINT32 Testcase(VOID)
|
||||
CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH], msgrv[MQUEUE_STANDARD_NAME_LENGTH];
|
||||
mqd_t mqdes;
|
||||
struct mq_attr attr = {0};
|
||||
INT32 unresolved = 0;
|
||||
INT32 failure = 0;
|
||||
INT32 ret = 0;
|
||||
|
||||
ret = snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1, \
|
||||
|
||||
@@ -35,8 +35,6 @@ static UINT32 Testcase(VOID)
|
||||
mqd_t mqdes;
|
||||
CHAR msgrv[MQUEUE_STANDARD_NAME_LENGTH];
|
||||
struct mq_attr attr = {0};
|
||||
INT32 unresolved = 0;
|
||||
INT32 failure = 0;
|
||||
INT32 ret = 0;
|
||||
|
||||
ret = snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1, \
|
||||
|
||||
@@ -34,8 +34,6 @@ static UINT32 Testcase(VOID)
|
||||
CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = "";
|
||||
mqd_t mqdes;
|
||||
struct mq_attr mqstat;
|
||||
INT32 unresolved = 0;
|
||||
INT32 failure = 0;
|
||||
INT32 ret = 0;
|
||||
|
||||
ret = snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1, \
|
||||
|
||||
@@ -34,8 +34,6 @@ static UINT32 Testcase(VOID)
|
||||
CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = "";
|
||||
mqd_t mqdes;
|
||||
struct mq_attr mqstat, nmqstat;
|
||||
INT32 unresolved = 0;
|
||||
INT32 failure = 0;
|
||||
INT32 ret = 0;
|
||||
|
||||
ret = snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1, \
|
||||
|
||||
@@ -35,8 +35,6 @@ static UINT32 Testcase(VOID)
|
||||
mqd_t mqdes;
|
||||
struct mq_attr mqstat = {0};
|
||||
struct mq_attr nmqstat = {0};
|
||||
INT32 unresolved = 0;
|
||||
INT32 failure = 0;
|
||||
INT32 ret = 0;
|
||||
|
||||
ret = snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1, \
|
||||
|
||||
@@ -38,23 +38,7 @@
|
||||
#include "semaphore.h"
|
||||
#include "unistd.h"
|
||||
|
||||
#ifdef LOSCFG_DEBUG_DEADLOCK
|
||||
#define TEST_MUTEX_INIT \
|
||||
{ \
|
||||
{ 0, 0, 0, 0 }, \
|
||||
{ \
|
||||
{ 0, 0 }, { 0, 0 }, 0, 0 \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define TEST_MUTEX_INIT \
|
||||
{ \
|
||||
{ 0, 0, 0, 0 }, \
|
||||
{ \
|
||||
{ 0, 0 }, 0, 0 \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
#define TEST_MUTEX_INIT {0}
|
||||
|
||||
#define MUTEX_TEST_DEFAULT_PRIO LOSCFG_BASE_CORE_TSK_DEFAULT_PRIO
|
||||
#define MUTEX_TEST_HIGH_PRIO (MUTEX_TEST_DEFAULT_PRIO - 6)
|
||||
|
||||
@@ -42,11 +42,6 @@
|
||||
#include "mqueue.h"
|
||||
#include "signal.h"
|
||||
|
||||
/* Some routines are part of the XSI Extensions */
|
||||
#ifndef WITHOUT_XOPEN
|
||||
#define _XOPEN_SOURCE 600
|
||||
#endif
|
||||
|
||||
#define PTHREAD_IS_ERROR (-1)
|
||||
#define PTHREAD_PRIORITY_TEST 20
|
||||
#define PTHREAD_DEFAULT_STACK_SIZE (LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE)
|
||||
@@ -71,9 +66,6 @@
|
||||
/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */
|
||||
#define _POSIX_C_SOURCE 200112L
|
||||
|
||||
#define PTHREAD_MUTEX_RECURSIVE 0
|
||||
#define PTHREAD_MUTEX_ERRORCHECK 0
|
||||
|
||||
#define PRIORITY_OTHER (-1)
|
||||
#define PRIORITY_FIFO 20
|
||||
#define PRIORITY_RR 20
|
||||
|
||||
@@ -102,7 +102,7 @@ char *g_strType[] = {
|
||||
"FUNCTION", "PRESSURE", "PERFORMANCE"
|
||||
};
|
||||
|
||||
iUINT32 ICunitRunF()
|
||||
iUINT32 ICunitRunF(void)
|
||||
{
|
||||
iUINT32 idx, idx1;
|
||||
ICUNIT_CASE_S *psubCaseArray;
|
||||
|
||||
@@ -231,7 +231,7 @@ void TestCmsis2(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
VOID TestTaskEntry()
|
||||
VOID TestTaskEntry(VOID)
|
||||
{
|
||||
PRINTF("\t\n --- Test Start --- \n\n");
|
||||
ICunitInit();
|
||||
|
||||
@@ -68,7 +68,10 @@ static_library("posix_test") {
|
||||
sources += [ "src/fs/posix_fs_func_test.c" ]
|
||||
}
|
||||
if (!defined(LOSCFG_COMPILER_ICCARM)) {
|
||||
cflags = [ "-Wno-error" ]
|
||||
cflags = [
|
||||
"-Wno-error",
|
||||
"-Wno-unused-function",
|
||||
]
|
||||
} else {
|
||||
cflags = [ "--no_warnings" ]
|
||||
}
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef COMMON_TEST_H
|
||||
#define COMMON_TEST_H
|
||||
|
||||
#define TESTCOUNT_NUM_1 1
|
||||
#define TESTCOUNT_NUM_2 2
|
||||
#define TESTCOUNT_NUM_3 3
|
||||
#define TESTCOUNT_NUM_4 4
|
||||
#define TESTCOUNT_NUM_5 5
|
||||
|
||||
#define DELAY_TICKS_1 1
|
||||
#define DELAY_TICKS_5 5
|
||||
#define DELAY_TICKS_10 10
|
||||
|
||||
#define TEST_TASK_STACK_SIZE 0x600
|
||||
#define TASK_LOOP_NUM 0x10000000
|
||||
#define TEST_TIME 10
|
||||
#define THREAD_COUNT_MIN 3
|
||||
#define THREAD_COUNT_MAX 30
|
||||
#define THREAD_STACK_SPACE_MAX 4096
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
#endif
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
@@ -42,8 +42,6 @@
|
||||
#define DELAY_TICKS_5 5
|
||||
#define DELAY_TICKS_10 10
|
||||
|
||||
#define TEST_TASK_STACK_SIZE 0x600
|
||||
#define TASK_LOOP_NUM 0x10000000
|
||||
#define TEST_TIME 10
|
||||
#define THREAD_COUNT_MIN 3
|
||||
#define THREAD_COUNT_MAX 30
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include "posix_test.h"
|
||||
#include <mqueue.h>
|
||||
#include <fcntl.h>
|
||||
#include "common_test.h"
|
||||
#include "kernel_test.h"
|
||||
#include "log.h"
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "hctest.h"
|
||||
#include "los_config.h"
|
||||
#include "cmsis_os2.h"
|
||||
#include "common_test.h"
|
||||
#include "kernel_test.h"
|
||||
#include "pthread.h"
|
||||
#include "log.h"
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <sys/time.h>
|
||||
#include <sys/times.h>
|
||||
#include <time.h>
|
||||
@@ -45,6 +46,7 @@
|
||||
|
||||
#define RET_OK 0
|
||||
|
||||
#define SECS_PER_MIN 60
|
||||
#define SLEEP_ACCURACY 21000 // 20 ms, with 1ms deviation
|
||||
#define ACCURACY_TEST_LOOPS 3 // loops for accuracy test, than count average value
|
||||
#define MILLISECONDS_PER_SECOND 1000
|
||||
@@ -125,13 +127,13 @@ static int CheckValueClose(double target, double actual, double accuracy)
|
||||
return (pct <= accuracy);
|
||||
}
|
||||
|
||||
static char *TmToStr(const struct tm *stm, char *timeStr, unsigned len)
|
||||
static char *TmToStr(const struct tm *timePtr, char *timeStr, unsigned len)
|
||||
{
|
||||
if (stm == NULL || timeStr == NULL) {
|
||||
if (timePtr == NULL || timeStr == NULL) {
|
||||
return "";
|
||||
}
|
||||
sprintf_s(timeStr, len, "%ld/%d/%d %02d:%02d:%02d WEEK(%d)", stm->tm_year + TM_BASE_YEAR, stm->tm_mon + 1,
|
||||
stm->tm_mday, stm->tm_hour, stm->tm_min, stm->tm_sec, stm->tm_wday);
|
||||
sprintf_s(timeStr, len, "%ld/%d/%d %02d:%02d:%02d WEEK(%d)", timePtr->tm_year + TM_BASE_YEAR, timePtr->tm_mon + 1,
|
||||
timePtr->tm_mday, timePtr->tm_hour, timePtr->tm_min, timePtr->tm_sec, timePtr->tm_wday);
|
||||
return timeStr;
|
||||
}
|
||||
|
||||
@@ -195,28 +197,28 @@ LITE_TEST_CASE(PosixTimeFuncTestSuite, testTimeGmtime001, Function | MediumTest
|
||||
time_t time1 = 18880;
|
||||
char timeStr[TIME_STR_LEN] = {0};
|
||||
LOG("\nsizeof(time_t) = %d, sizeof(struct tm) = %d", sizeof(time_t), sizeof(struct tm));
|
||||
struct tm *stm = gmtime(&time1);
|
||||
TEST_ASSERT_EQUAL_STRING("1970/1/1 05:14:40 WEEK(4)", TmToStr(stm, timeStr, TIME_STR_LEN));
|
||||
struct tm *timePtr = gmtime(&time1);
|
||||
TEST_ASSERT_EQUAL_STRING("1970/1/1 05:14:40 WEEK(4)", TmToStr(timePtr, timeStr, TIME_STR_LEN));
|
||||
|
||||
time1 = LONG_MAX;
|
||||
stm = gmtime(&time1);
|
||||
LOG("\n LONG_MAX = %lld, cvt result : %s", time1, TmToStr(stm, timeStr, TIME_STR_LEN));
|
||||
TEST_ASSERT_EQUAL_STRING("2038/1/19 03:14:07 WEEK(2)", TmToStr(stm, timeStr, TIME_STR_LEN));
|
||||
timePtr = gmtime(&time1);
|
||||
LOG("\n LONG_MAX = %lld, cvt result : %s", time1, TmToStr(timePtr, timeStr, TIME_STR_LEN));
|
||||
TEST_ASSERT_EQUAL_STRING("2038/1/19 03:14:07 WEEK(2)", TmToStr(timePtr, timeStr, TIME_STR_LEN));
|
||||
|
||||
time1 = LONG_MAX - 1;
|
||||
stm = gmtime(&time1);
|
||||
LOG("\n LONG_MAX - 1 = %lld, cvt result : %s", time1, TmToStr(stm, timeStr, TIME_STR_LEN));
|
||||
TEST_ASSERT_EQUAL_STRING("2038/1/19 03:14:06 WEEK(2)", TmToStr(stm, timeStr, TIME_STR_LEN));
|
||||
timePtr = gmtime(&time1);
|
||||
LOG("\n LONG_MAX - 1 = %lld, cvt result : %s", time1, TmToStr(timePtr, timeStr, TIME_STR_LEN));
|
||||
TEST_ASSERT_EQUAL_STRING("2038/1/19 03:14:06 WEEK(2)", TmToStr(timePtr, timeStr, TIME_STR_LEN));
|
||||
|
||||
time1 = LONG_MIN;
|
||||
stm = gmtime(&time1);
|
||||
LOG("\n LONG_MIN = %lld, cvt result : %s", time1, TmToStr(stm, timeStr, TIME_STR_LEN));
|
||||
TEST_ASSERT_EQUAL_STRING("1901/12/13 20:45:52 WEEK(5)", TmToStr(stm, timeStr, TIME_STR_LEN));
|
||||
timePtr = gmtime(&time1);
|
||||
LOG("\n LONG_MIN = %lld, cvt result : %s", time1, TmToStr(timePtr, timeStr, TIME_STR_LEN));
|
||||
TEST_ASSERT_EQUAL_STRING("1901/12/13 20:45:52 WEEK(5)", TmToStr(timePtr, timeStr, TIME_STR_LEN));
|
||||
|
||||
time1 = LONG_MIN + 1;
|
||||
stm = gmtime(&time1);
|
||||
LOG("\n LONG_MIN + 1 = %lld, cvt result : %s", time1, TmToStr(stm, timeStr, TIME_STR_LEN));
|
||||
TEST_ASSERT_EQUAL_STRING("1901/12/13 20:45:53 WEEK(5)", TmToStr(stm, timeStr, TIME_STR_LEN));
|
||||
timePtr = gmtime(&time1);
|
||||
LOG("\n LONG_MIN + 1 = %lld, cvt result : %s", time1, TmToStr(timePtr, timeStr, TIME_STR_LEN));
|
||||
TEST_ASSERT_EQUAL_STRING("1901/12/13 20:45:53 WEEK(5)", TmToStr(timePtr, timeStr, TIME_STR_LEN));
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -369,38 +371,47 @@ LITE_TEST_CASE(PosixTimeFuncTestSuite, testTimeLocaltimer002, Function | MediumT
|
||||
*/
|
||||
LITE_TEST_CASE(PosixTimeFuncTestSuite, testTimeMktime001, Function | MediumTest | Level1)
|
||||
{
|
||||
// default time zone east 8
|
||||
struct tm timeptr = { 0 };
|
||||
struct tm testTM = { 0 };
|
||||
time_t testTime = 18880;
|
||||
char timeStr[TIME_STR_LEN] = {0};
|
||||
struct timeval tv;
|
||||
struct timezone tz;
|
||||
|
||||
INIT_TM(timeptr, 2020, 7, 9, 18, 10, 0, 7);
|
||||
time_t timeRet = mktime(&timeptr);
|
||||
// get system timezone
|
||||
int ret = gettimeofday(&tv, &tz);
|
||||
TEST_ASSERT_EQUAL_INT(0, ret);
|
||||
long sysTimezone = (long)(-tz.tz_minuteswest) * SECS_PER_MIN;
|
||||
LOG("\n system timezone = %ld\n", sysTimezone);
|
||||
|
||||
INIT_TM(testTM, 2020, 7, 9, 18, 10, 0, 7);
|
||||
time_t timeRet = mktime(&testTM);
|
||||
LOG("\n 2020-7-9 18:10:00, mktime Ret = %lld", timeRet);
|
||||
TEST_ASSERT_EQUAL_INT(1596967800, timeRet);
|
||||
TEST_ASSERT_EQUAL_INT(sysTimezone, testTM.__tm_gmtoff);
|
||||
TEST_ASSERT_EQUAL_INT(1596996600 - testTM.__tm_gmtoff, timeRet);
|
||||
|
||||
INIT_TM(timeptr, 1970, 0, 1, 8, 0, 0, 0);
|
||||
timeRet = mktime(&timeptr);
|
||||
INIT_TM(testTM, 1970, 0, 1, 8, 0, 0, 0);
|
||||
timeRet = mktime(&testTM);
|
||||
LOG("\n 1970-1-1 08:00:00, mktime Ret = %lld", timeRet);
|
||||
TEST_ASSERT_EQUAL_INT(0, timeRet);
|
||||
TEST_ASSERT_EQUAL_INT(sysTimezone, testTM.__tm_gmtoff);
|
||||
TEST_ASSERT_EQUAL_INT(28800 - testTM.__tm_gmtoff, timeRet);
|
||||
|
||||
struct tm *stm = localtime(&testTime);
|
||||
LOG("\n testTime 18880, tm : %s", TmToStr(stm, timeStr, TIME_STR_LEN));
|
||||
timeRet = mktime(stm);
|
||||
struct tm *timePtr = localtime(&testTime);
|
||||
LOG("\n testTime 18880, tm : %s", TmToStr(timePtr, timeStr, TIME_STR_LEN));
|
||||
timeRet = mktime(timePtr);
|
||||
TEST_ASSERT_EQUAL_INT(18880, timeRet);
|
||||
LOG("\n input 18880, mktime Ret = %lld", timeRet);
|
||||
|
||||
testTime = LONG_MAX;
|
||||
stm = localtime(&testTime);
|
||||
LOG("\n testTime LONG_MAX, tm : %s", TmToStr(stm, timeStr, TIME_STR_LEN));
|
||||
timeRet = mktime(stm);
|
||||
timePtr = localtime(&testTime);
|
||||
LOG("\n testTime LONG_MAX, tm : %s", TmToStr(timePtr, timeStr, TIME_STR_LEN));
|
||||
timeRet = mktime(timePtr);
|
||||
TEST_ASSERT_EQUAL_INT(LONG_MAX, timeRet);
|
||||
LOG("\n input LONG_MAX, mktime Ret = %lld", timeRet);
|
||||
|
||||
testTime = 0;
|
||||
stm = localtime(&testTime);
|
||||
LOG("\n testTime 0, tm : %s", TmToStr(stm, timeStr, TIME_STR_LEN));
|
||||
timeRet = mktime(stm);
|
||||
timePtr = localtime(&testTime);
|
||||
LOG("\n testTime 0, tm : %s", TmToStr(timePtr, timeStr, TIME_STR_LEN));
|
||||
timeRet = mktime(timePtr);
|
||||
TEST_ASSERT_EQUAL_INT(0, timeRet);
|
||||
LOG("\n input 0, mktime Ret = %lld", timeRet);
|
||||
return 0;
|
||||
@@ -413,10 +424,10 @@ LITE_TEST_CASE(PosixTimeFuncTestSuite, testTimeMktime001, Function | MediumTest
|
||||
*/
|
||||
LITE_TEST_CASE(PosixTimeFuncTestSuite, testTimeMktime002, Function | MediumTest | Level1)
|
||||
{
|
||||
struct tm timeptr = { 0 };
|
||||
struct tm testTM = { 0 };
|
||||
LOG("\n sizeof(time_t) = %d", sizeof(time_t));
|
||||
INIT_TM(timeptr, 1969, 7, 9, 10, 10, 0, 7);
|
||||
time_t timeRet = mktime(&timeptr);
|
||||
INIT_TM(testTM, 1969, 7, 9, 10, 10, 0, 7);
|
||||
time_t timeRet = mktime(&testTM);
|
||||
LOG("\n 1800-8-9 10:10:00, mktime Ret lld = %lld", timeRet);
|
||||
#if (LOSCFG_LIBC_MUSL == 1)
|
||||
TEST_ASSERT_EQUAL_INT(-1, timeRet);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
@@ -525,8 +525,17 @@ static inline UINT64 __atomic_exchange_8(volatile void *mem, UINT64 val, int mod
|
||||
free_lock (memP, model);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif /* __XTENSA_LX6__ */
|
||||
|
||||
#define ALIAS_OF(of) __attribute__((alias(#of)))
|
||||
#define FUNC_ALIAS(real_func, new_alias, args_list, return_type) \
|
||||
return_type new_alias args_list ALIAS_OF(real_func)
|
||||
|
||||
#else
|
||||
|
||||
#define FUNC_ALIAS(real_func, new_alias, args_list, return_type)
|
||||
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user