!837 同步清除内核告警信息

Merge pull request !837 from 夏不白/cherry-pick-1664026693
This commit is contained in:
openharmony_ci 2022-09-25 08:30:56 +00:00 committed by Gitee
commit 798fbd0212
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
23 changed files with 168 additions and 65 deletions

View File

@ -91,7 +91,7 @@ STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
STATIC UINT64 SysTickCycleGet(UINT32 *period)
{
UINT32 hwCycle = 0
UINT32 hwCycle = 0;
UINT32 intSave = LOS_IntLock();
UINT32 val = SysTick->VAL;
*period = SysTick->LOAD;

View File

@ -51,6 +51,7 @@ VOID HalSecureSVCHandler(UINT32 svcID, UINTPTR arg)
HalSecureContextLoad(g_secureContext);
break;
case OS_SVC_FREE_SECURE_CONTEXT:
LOS_ASSERT(g_secureContext != NULL);
HalSecureContextFree(g_secureContext);
break;
default:

View File

@ -51,6 +51,7 @@ VOID HalSecureSVCHandler(UINT32 svcID, UINTPTR arg)
HalSecureContextLoad(g_secureContext);
break;
case OS_SVC_FREE_SECURE_CONTEXT:
LOS_ASSERT(g_secureContext != NULL);
HalSecureContextFree(g_secureContext);
break;
default:

View File

@ -91,7 +91,7 @@ STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
STATIC UINT64 SysTickCycleGet(UINT32 *period)
{
UINT32 hwCycle = 0
UINT32 hwCycle = 0;
UINT32 intSave = LOS_IntLock();
UINT32 val = SysTick->VAL;
*period = SysTick->LOAD;

View File

@ -51,6 +51,7 @@ VOID HalSecureSVCHandler(UINT32 svcID, UINTPTR arg)
HalSecureContextLoad(g_secureContext);
break;
case OS_SVC_FREE_SECURE_CONTEXT:
LOS_ASSERT(g_secureContext != NULL);
HalSecureContextFree(g_secureContext);
break;
default:

View File

@ -51,6 +51,7 @@ VOID HalSecureSVCHandler(UINT32 svcID, UINTPTR arg)
HalSecureContextLoad(g_secureContext);
break;
case OS_SVC_FREE_SECURE_CONTEXT:
LOS_ASSERT(g_secureContext != NULL);
HalSecureContextFree(g_secureContext);
break;
default:

View File

@ -612,7 +612,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
HalHwiHandleReInit((UINT32)&g_hwiForm);
HalSetVbr((UINT32)&g_hwiForm);
for (int i = 0; i < BYTES_OF_128_INT; i++) {
for (i = 0; i < BYTES_OF_128_INT; i++) {
VIC_REG->IABR[i] = 0x0;
VIC_REG->ICPR[i] = MASK_32_BITS;
}

View File

@ -44,6 +44,7 @@
#include "sys/stat.h"
#include "sys/uio.h"
#include "unistd.h"
#include <stdarg.h>
#ifdef __cplusplus
#if __cplusplus
@ -83,6 +84,9 @@ int LOS_FsMount(const char *source, const char *target,
const char *fsType, unsigned long mountflags,
const void *data);
int OsFcntl(int fd, int cmd, va_list ap);
int OsIoctl(int fd, int req, va_list ap);
struct PartitionCfg {
/* partition low-level read func */
int (*readFunc)(int partition, UINT32 *offset, void *buf, UINT32 size);

View File

@ -582,17 +582,13 @@ static int VfsRename(const char *old, const char *new)
return ret;
}
static int VfsIoctl(int fd, int func, ...)
static int VfsIoctl(int fd, int func, va_list ap)
{
va_list ap;
unsigned long arg;
struct File *file = NULL;
int ret = (int)LOS_NOK;
va_start(ap, func);
arg = va_arg(ap, unsigned long);
va_end(ap);
file = VfsAttachFileReady(fd);
if (file == NULL) {
return ret;
@ -906,6 +902,10 @@ static int MapToPosixRet(int ret)
/* POSIX interface */
int LOS_Open(const char *path, int flags, ...)
{
if (path == NULL) {
errno = EINVAL;
return (int)LOS_NOK;
}
#ifdef LOSCFG_RANDOM_DEV
unsigned flagMask = O_RDONLY | O_WRONLY | O_RDWR | O_APPEND | O_CREAT | O_LARGEFILE \
| O_TRUNC | O_EXCL | O_DIRECTORY;
@ -956,7 +956,7 @@ int LOS_Open(const char *path, int flags, ...)
FREE_AND_SET_NULL(canonicalPath);
#endif
#if (LOSCFG_POSIX_PIPE_API == 1)
if ((path != NULL) && !strncmp(path, PIPE_DEV_PATH, strlen(PIPE_DEV_PATH))) {
if (!strncmp(path, PIPE_DEV_PATH, strlen(PIPE_DEV_PATH))) {
return PipeOpen(path, flags, PIPE_DEV_FD);
}
#endif
@ -1143,29 +1143,25 @@ int LOS_Fstat(int fd, struct stat *buf)
return ret;
}
int LOS_Fcntl(int fd, int cmd, ...)
int OsFcntl(int fd, int cmd, va_list ap)
{
struct File *filep = NULL;
va_list ap;
int ret;
va_start(ap, cmd);
if (fd < CONFIG_NFILE_DESCRIPTORS) {
filep = VfsAttachFileReady(fd);
ret = VfsVfcntl(filep, cmd, ap);
VfsDetachFile(filep);
} else {
#ifndef LOSCFG_NET_LWIP_SACK
ret = -EBADF;
#ifdef LOSCFG_NET_LWIP_SACK
#else
int arg = va_arg(ap, int);
ret = lwip_fcntl(fd, (long)cmd, arg);
va_end(ap);
return ret;
#endif /* LOSCFG_NET_LWIP_SACK */
}
va_end(ap);
if (ret < 0) {
VFS_ERRNO_SET(-ret);
ret = (int)LOS_NOK;
@ -1173,21 +1169,41 @@ int LOS_Fcntl(int fd, int cmd, ...)
return ret;
}
int LOS_Ioctl(int fd, int req, ...)
int LOS_Fcntl(int fd, int cmd, ...)
{
va_list ap;
int ret;
va_start(ap, cmd);
ret = OsFcntl(fd, cmd, ap);
va_end(ap);
return ret;
}
int OsIoctl(int fd, int req, va_list ap)
{
int ret;
va_list ap;
va_start(ap, req);
if (fd < CONFIG_NFILE_DESCRIPTORS) {
ret = VfsIoctl(fd, req, ap);
} else {
#ifndef LOSCFG_NET_LWIP_SACK
ret = -EBADF;
#ifdef LOSCFG_NET_LWIP_SACK
#else
UINTPTR arg = va_arg(ap, UINTPTR);
ret = lwip_ioctl(fd, (long)req, (void *)arg);
#endif /* LOSCFG_NET_LWIP_SACK */
}
return ret;
}
int LOS_Ioctl(int fd, int req, ...)
{
int ret;
va_list ap;
va_start(ap, req);
ret = OsIoctl(fd, req, ap);
va_end(ap);
return ret;
}

View File

@ -47,7 +47,7 @@ int GetPartIdByPartName(const char *partName)
/* the character next to p is the partId */
char *p = strrchr(partName, 'p');
if (p + 1 != NULL) {
if (p != NULL) {
return atoi(p + 1);
}

View File

@ -34,7 +34,7 @@ module_switch = defined(LOSCFG_NET_LWIP_SACK)
module_name = "lwip"
kernel_module(module_name) {
sources = LWIP_PORTING_FILES + LWIPNOAPPSFILES - [ "$LWIPDIR/api/sockets.c" ]
include_dirs = [ "//utils/native/lite/include" ]
include_dirs = [ "//commonlibrary/utils_lite/include" ]
}
config("public") {

View File

@ -529,7 +529,7 @@ u32_t OsShellPing(int argc, const char **argv)
{
int ret;
u32_t i = 0;
u32_t count = 0;
u32_t count;
int count_set = 0;
u32_t interval = 1000; /* default ping interval */
u32_t data_len = 48; /* default data length */

View File

@ -67,7 +67,7 @@ int SysUserTaskCreate(unsigned long entry, unsigned long userArea, unsigned long
int SysSchedSetScheduler(unsigned int tid, int policy, int priority)
{
if ((tid <= 0) || (tid > LOSCFG_BASE_CORE_TSK_LIMIT)) {
if ((tid == 0) || (tid > LOSCFG_BASE_CORE_TSK_LIMIT)) {
return EINVAL;
}
@ -92,7 +92,7 @@ int *SysSchedGetArea(unsigned int tid)
unsigned int intSave;
int *area = NULL;
if ((tid <= 0) || (tid > LOSCFG_BASE_CORE_TSK_LIMIT)) {
if ((tid == 0) || (tid > LOSCFG_BASE_CORE_TSK_LIMIT)) {
return NULL;
}

View File

@ -544,11 +544,6 @@ STATIC INT32 OsShellCmdDoRmdir(const CHAR *pathname)
}
if (strcmp(dirent->d_name, "..") && strcmp(dirent->d_name, ".")) {
size_t fullPathBufSize = strlen(pathname) + strlen(dirent->d_name) + SEPARATOR_EOF_LEN;
if (fullPathBufSize <= 0) {
PRINTK("buffer size is invalid!\n");
(VOID)closedir(d);
return -1;
}
fullpath = (CHAR *)malloc(fullPathBufSize);
if (fullpath == NULL) {
PRINTK("malloc failure!\n");

View File

@ -978,21 +978,17 @@ osStatus_t osEventFlagsDelete(osEventFlagsId_t ef_id)
{
PEVENT_CB_S pstEventCB = (PEVENT_CB_S)ef_id;
UINT32 intSave;
osStatus_t ret;
osStatus_t ret = osOK;
if (OS_INT_ACTIVE) {
return osErrorISR;
}
intSave = LOS_IntLock();
if (LOS_EventDestroy(pstEventCB) == LOS_OK) {
ret = osOK;
} else {
if (LOS_EventDestroy(pstEventCB) != LOS_OK) {
ret = osErrorParameter;
}
LOS_IntRestore(intSave);
if (LOS_MemFree(m_aucSysMem0, (void *)pstEventCB) == LOS_OK) {
ret = osOK;
} else {
if (LOS_MemFree(m_aucSysMem0, (void *)pstEventCB) != LOS_OK) {
ret = osErrorParameter;
}

View File

@ -176,6 +176,28 @@ int access(const char *path, int mode)
return 0;
}
int fcntl(int fd, int cmd, ...)
{
int ret;
va_list vaList;
va_start(vaList, cmd);
ret = OsFcntl(fd, cmd, vaList);
va_end(vaList);
return ret;
}
int ioctl(int fd, int req, ...)
{
int ret;
va_list vaList;
va_start(vaList, req);
ret = OsIoctl(fd, req, vaList);
va_end(vaList);
return ret;
}
#else /* #ifdef LOSCFG_FS_VFS */
int mount(const char *source, const char *target,
@ -295,4 +317,13 @@ int access(const char *path, int mode)
return -1;
}
int fcntl(int fd, int cmd, ...)
{
return -1;
}
int ioctl(int fd, int req, ...)
{
return -1;
}
#endif

View File

@ -148,13 +148,25 @@ int ftruncate(int fd, off_t length)
return LOS_Ftruncate(fd, length);
}
int fcntl(int fd, int cmd, ...)
{
int ret;
va_list vaList;
va_start(vaList, cmd);
ret = OsFcntl(fd, cmd, vaList);
va_end(vaList);
return ret;
}
int ioctl(int fd, int req, ...)
{
va_list ap;
va_start(ap, req);
int ret;
ret = LOS_Ioctl(fd, req, ap);
va_end(ap);
va_list vaList;
va_start(vaList, req);
ret = OsIoctl(fd, req, vaList);
va_end(vaList);
return ret;
}
@ -247,4 +259,13 @@ int remove(const char *filename)
return -1;
}
int fcntl(int fd, int cmd, ...)
{
return -1;
}
int ioctl(int fd, int req, ...)
{
return -1;
}
#endif

View File

@ -501,7 +501,7 @@ time_t time(time_t *timer)
{
UINT64 usec = 0;
time_t sec;
INT32 rtcRet = 0;
INT32 rtcRet;
if (g_rtcTimeFunc.RtcGetTimeHook != NULL) {
rtcRet = g_rtcTimeFunc.RtcGetTimeHook(&usec);

View File

@ -55,7 +55,7 @@ static VOID TaskF01(VOID)
atomicRet = LOS_AtomicAdd(&atomicTestCounter, 0x77777777);
ICUNIT_ASSERT_EQUAL_VOID(atomicRet, 0x22222221, atomicRet);
readCounter = LOS_AtomicRead(&atomicTestCounter);
ICUNIT_ASSERT_EQUAL(readCounter, 0x22222221, readCounter);
ICUNIT_ASSERT_EQUAL_VOID(readCounter, 0x22222221, readCounter);
LOS_AtomicSet(&atomicTestCounter, 0xdddddddd);
atomicRet = LOS_AtomicSub(&atomicTestCounter, 0x99999999);

View File

@ -35,8 +35,6 @@
static VOID TaskF02(VOID)
{
UINT32 ret;
ICUNIT_ASSERT_EQUAL_VOID(ret, 0, ret);
g_testCount++;
return;
}

View File

@ -90,6 +90,7 @@ static BOOL PosixFsFuncTestSuiteTearDown(void)
return TRUE;
}
#if (LOSCFG_LIBC_MUSL == 1)
/* *
* @tc.number SUB_KERNEL_FS_DIRNAME_001
* @tc.name dirname basic function test
@ -162,6 +163,7 @@ LITE_TEST_CASE(PosixFsFuncTestSuite, testFsDirname004, Function | MediumTest | L
TEST_ASSERT_EQUAL_STRING(".", workDir);
return 0;
}
#endif
/* *
* @tc.number SUB_KERNEL_FS_FOPEN_FCLOSE_001
@ -1335,10 +1337,12 @@ LITE_TEST_CASE(PosixFsFuncTestSuite, testFsReaddir002, Function | MediumTest | L
dResult = readdir(dirp);
TEST_ASSERT_NOT_NULL(dirp);
TEST_ASSERT_NOT_NULL(dResult);
tellDir0 = dResult->d_off;
dResult = readdir(dirp);
TEST_ASSERT_NOT_NULL(dirp);
TEST_ASSERT_NOT_NULL(dResult);
tellDir1 = dResult->d_off;
TEST_ASSERT_TRUE(tellDir0 == tellDir1);
@ -1443,7 +1447,7 @@ LITE_TEST_CASE(PosixFsFuncTestSuite, testFsUnlink001, Function | MediumTest | Le
char tmpFileName[]= FILE1;
fd = open(tmpFileName, O_CREAT | O_RDWR, 0777);
TEST_ASSERT_TRUE(ret != -1);
TEST_ASSERT_TRUE(fd != -1);
(void)close(fd);
@ -1454,7 +1458,7 @@ LITE_TEST_CASE(PosixFsFuncTestSuite, testFsUnlink001, Function | MediumTest | Le
/* *
* @tc.number SUB_KERNEL_FS_STAT_001
* @tc.name unlink
* @tc.name stat
* @tc.desc [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(PosixFsFuncTestSuite, testFsStat001, Function | MediumTest | Level1)
@ -1466,7 +1470,7 @@ LITE_TEST_CASE(PosixFsFuncTestSuite, testFsStat001, Function | MediumTest | Leve
remove(FILE1);
fd = open(tmpFileName, O_CREAT | O_RDWR, 0777);
TEST_ASSERT_TRUE(ret != -1);
TEST_ASSERT_TRUE(fd != -1);
(void)close(fd);
@ -1477,7 +1481,7 @@ LITE_TEST_CASE(PosixFsFuncTestSuite, testFsStat001, Function | MediumTest | Leve
/* *
* @tc.number SUB_KERNEL_FS_STAT_002
* @tc.name unlink
* @tc.name stat
* @tc.desc [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(PosixFsFuncTestSuite, testFsStat002, Function | MediumTest | Level1)
@ -1491,12 +1495,11 @@ LITE_TEST_CASE(PosixFsFuncTestSuite, testFsStat002, Function | MediumTest | Leve
remove(FILE1);
fd = open(tmpFileName, O_CREAT | O_RDWR, 0777);
TEST_ASSERT_TRUE(ret != -1);
TEST_ASSERT_TRUE(fd != -1);
size = write(fd, writeBuf, sizeof(writeBuf));
TEST_ASSERT_TRUE(ret != -1);
(void)close(fd);
TEST_ASSERT_TRUE(size != -1);
ret = stat(tmpFileName, &buf);
TEST_ASSERT_TRUE(ret != -1);
@ -1507,7 +1510,7 @@ LITE_TEST_CASE(PosixFsFuncTestSuite, testFsStat002, Function | MediumTest | Leve
/* *
* @tc.number SUB_KERNEL_FS_STAT_003
* @tc.name unlink
* @tc.name stat
* @tc.desc [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(PosixFsFuncTestSuite, testFsStat003, Function | MediumTest | Level1)
@ -1521,11 +1524,11 @@ LITE_TEST_CASE(PosixFsFuncTestSuite, testFsStat003, Function | MediumTest | Leve
(void)memset_s(&buf, sizeof(buf), 0, sizeof(buf));
fd = open(tmpFileName, O_CREAT | O_RDWR, 0777);
TEST_ASSERT_TRUE(ret != -1);
TEST_ASSERT_TRUE(fd != -1);
size = write(fd, writeBuf, sizeof(writeBuf));
TEST_ASSERT_TRUE(ret != -1);
(void)close(fd);
TEST_ASSERT_TRUE(size != -1);
ret = stat(tmpFileName, &buf);
TEST_ASSERT_TRUE(ret != -1);
@ -1541,7 +1544,7 @@ extern off_t lseek(int fd, off_t offset, int whence);
/* *
* @tc.number SUB_KERNEL_FS_WRITE_001
* @tc.name unlink
* @tc.name write
* @tc.desc [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(PosixFsFuncTestSuite, testFsWrite001, Function | MediumTest | Level1)
@ -1557,27 +1560,33 @@ LITE_TEST_CASE(PosixFsFuncTestSuite, testFsWrite001, Function | MediumTest | Lev
}
fd = open(tmpFileName, O_CREAT | O_RDWR, 0777);
TEST_ASSERT_TRUE(ret != -1);
TEST_ASSERT_TRUE(fd != -1);
ret = write(fd, writeBuf, TEST_RW_SIZE);
if (ret == -1) {
(void)close(fd);
}
TEST_ASSERT_TRUE(ret != -1);
reLseek = lseek(fd, 0, SEEK_CUR);
ret = write(fd, writeBuf, TEST_RW_SIZE);
if (ret == -1) {
(void)close(fd);
}
TEST_ASSERT_TRUE(ret != -1);
reLseek = lseek(fd, 0, SEEK_CUR);
(void)close(fd);
TEST_ASSERT_TRUE((TEST_RW_SIZE + TEST_RW_SIZE) == (unsigned int)reLseek);
(void)close(fd);
return 0;
}
/* *
* @tc.number SUB_KERNEL_FS_WRITE_002
* @tc.name unlink
* @tc.name write
* @tc.desc [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(PosixFsFuncTestSuite, testFsWrite002, Function | MediumTest | Level1)
@ -1591,14 +1600,13 @@ LITE_TEST_CASE(PosixFsFuncTestSuite, testFsWrite002, Function | MediumTest | Lev
remove(FILE1);
fd = open(tmpFileName, O_CREAT | O_RDWR, 0777);
TEST_ASSERT_TRUE(ret != -1);
TEST_ASSERT_TRUE(fd != -1);
for (i = 0; i < TEST_LOOPUP_TIME; i++) {
ret = write(fd, writeBuf, sizeof(writeBuf));
}
TEST_ASSERT_TRUE(ret != -1);
(void)close(fd);
TEST_ASSERT_TRUE(ret != -1);
ret = stat(tmpFileName, &statbuf);
TEST_ASSERT_TRUE(ret != -1);
@ -1607,6 +1615,34 @@ LITE_TEST_CASE(PosixFsFuncTestSuite, testFsWrite002, Function | MediumTest | Lev
return 0;
}
#if (LOSCFG_LIBC_MUSL == 1)
/* *
* @tc.number SUB_KERNEL_FS_FCNTL_001
* @tc.name fcntl
* @tc.desc [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(PosixFsFuncTestSuite, testFsFcntl001, Function | MediumTest | Level1)
{
int fd = 0;
int flags = 0;
char tmpFileName[]= FILE1;
fd = open(tmpFileName, O_CREAT | O_RDWR, 0777);
TEST_ASSERT_TRUE(fd != -1);
flags = fcntl(fd, F_GETFL);
TEST_ASSERT_TRUE(flags == O_CREAT | O_RDWR);
fcntl(fd, F_SETFL, flags | O_APPEND);
flags = fcntl(fd, F_GETFL);
TEST_ASSERT_TRUE(flags == O_CREAT | O_RDWR | O_APPEND);
(void)close(fd);
return 0;
}
#endif
RUN_TEST_SUITE(PosixFsFuncTestSuite);
void PosixFsFuncTest()
@ -1621,12 +1657,13 @@ void PosixFsFuncTest()
RUN_ONE_TESTCASE(testFsWrite001);
RUN_ONE_TESTCASE(testFsWrite002);
#if (LOSCFG_LIBC_MUSL == 1)
RUN_ONE_TESTCASE(testFsDirname001);
RUN_ONE_TESTCASE(testFsDirname002);
RUN_ONE_TESTCASE(testFsDirname003);
RUN_ONE_TESTCASE(testFsDirname004);
RUN_ONE_TESTCASE(testFsFcntl001);
#endif
RUN_ONE_TESTCASE(testFsReaddir001);
RUN_ONE_TESTCASE(testFsReaddir002);
@ -1688,6 +1725,5 @@ void PosixFsFuncTest()
RUN_ONE_TESTCASE(testFsFreadFwrite007);
RUN_ONE_TESTCASE(testFsFreadFwrite008);
RUN_ONE_TESTCASE(testFsFreadFwrite009);
return;
}

View File

@ -142,6 +142,7 @@ LITE_TEST_CASE(PosixStringFuncTestSuite, testStrStrdup001, Function | MediumTest
char src[] = "hello world !";
char *ret = strdup(src);
TEST_ASSERT_EQUAL_CHAR_ARRAY(ret, src, sizeof(src) / sizeof(src[0]));
free(ret);
char srcS[] = "This is String1";
ret = strdup(srcS);

View File

@ -31,6 +31,7 @@
#include "ohos_types.h"
#include "posix_test.h"
#include "log.h"
#include "los_config.h"
#include "kernel_test.h"
#include <ctype.h>