Compare commits

..

20 Commits

Author SHA1 Message Date
openharmony_ci
518d448a2f !1093 Fix : 内核告警清理挑单到monthly_20221018
Merge pull request !1093 from yinjiaming/cherry-pick-1672881303
2023-01-06 11:29:40 +00:00
yinjiaming
05b07a29fe fixed ebc3f30 from https://gitee.com/hgbveiu743/kernel_liteos_a/pulls/1089
fix:修复codecheck扫描出的告警
给宏定义中的参数加上了括号,删除了多余的函数声明

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I8853f6a9717ede96578cd674b83b716c8e63f0d8
2023-01-05 01:15:05 +00:00
openharmony_ci
2bef65046a !1081 fix: 【挑单】codecheck问题清零
Merge pull request !1081 from zhushengle/cherry-pick-1669685670
2022-11-29 03:20:11 +00:00
zhushengle
205df75f15 fixed 8d980de from https://gitee.com/zhushengle/kernel_liteos_a/pulls/1078
fix: codecheck问题清零

1.shell初始化异常流程double free
2.los_disk_init中冗余初始化
3.OsKProcessPmUsage 中OsUProcessPmUsage异常退出时,存在使用未初始化的变量
4.HiLogHeadInit异常推出后,存在使用未初始化的变量
5.api_shell.c 中存在冗余初始化

fix #I63H5G

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: If17d8ed1e6f2276e20fbce24b32de169bfd22e54
2022-11-29 01:34:30 +00:00
openharmony_ci
85f1c9e0ca !1067 【挑单】time相关系统调用内核栈信息泄露排查
Merge pull request !1067 from zhushengle/cherry-pick-1668158211
2022-11-14 03:24:57 +00:00
zhushengle
c04ff6b10f fixed 0b05a46 from https://gitee.com/zhushengle/kernel_liteos_a/pulls/1061
task: time相关系统调用内核栈信息泄露排查

解决方案:
    在涉及从内核拷贝数据到用户态的场景时,先将内核的数据进行清零操作,再填充内核数据
Close #I60M1P

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ia61d4e39b9e190accea477ff5b361e41d0eed2af
2022-11-11 09:16:52 +00:00
openharmony_ci
1b61489512 !1048 Fix : 内核告警清理挑单到monthly 分支
Merge pull request !1048 from yinjiaming/cherry-pick-1666774395
2022-10-27 14:24:41 +00:00
yinjiaming
29c459e045 fixed 8d55bb1 from https://gitee.com/hgbveiu743/kernel_liteos_a/pulls/1046
fix: 内核告警清理
【背景】
内核告警清理

【修改方案】
删去了多余的空格,更改了魔数字

【影响】
对现有的产品编译不会有影响。

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Iba21be6cb23027dfb369576847d7d21e85f936b4
2022-10-26 08:53:15 +00:00
openharmony_ci
e7daa28200 !1025 清除一些静态检查工具发现的问题
Merge pull request !1025 from Far/master
2022-10-17 01:39:02 +00:00
Far
987a722d2d fix: 修复一些静态检查工具发现的问题
Signed-off-by: Far <yesiyuan2@huawei.com>
Change-Id: I2b93259d55a9eb1a9dfd5887fd7821c15274bb7f
2022-10-15 17:36:45 +08:00
openharmony_ci
ccdfa72431 !1016 修复执行测试用例执行时间过长等问题
Merge pull request !1016 from 夏不白/fix_unittest
2022-10-12 06:29:16 +00:00
openharmony_ci
557a71c1c3 !1020 jffs2.patch 文件适配LTS补丁升级
Merge pull request !1020 from 闻飞/master
2022-10-08 11:28:25 +00:00
wenfei
569aecb6ea jffs2.patch update
Signed-off-by: wenfei <wenfei9@huawei.com>
2022-09-30 11:23:29 +08:00
xiacong
8c0b7d0f38 <fix>
修复测试用例不过的问题

<body>
1.修复执行liteos_a_basic_unittest.bin时间过长的问题
2.修复测试shm系列系统调用函数用例失败的问题

Signed-off-by: xiacong <xiacong4@huawei.com>
Change-Id: Iabc541cb1c0e97dac0fe13aaeb98e85404e5bf6f
Signed-off-by: xiacong <xiacong4@huawei.com>
2022-09-28 17:24:14 +08:00
openharmony_ci
c488817b32 !1008 修复内核告警信息
Merge pull request !1008 from zhangdengyu/fix_preferused
2022-09-26 12:52:00 +00:00
openharmony_ci
43d47a27e3 !1011 fix: 修复shell_lk.c告警清零带来的逻辑修改
Merge pull request !1011 from 夏不白/module_fix
2022-09-26 11:22:57 +00:00
xiacong
a83f916298 <fix>
恢复告警清零带来的逻辑改变

Signed-off-by: xiacong <xiacong4@huawei.com>
Change-Id: I8d34d2b9c43ea54e5474cbddcde0048658cbb891
Signed-off-by: xiacong <xiacong4@huawei.com>
2022-09-26 17:29:08 +08:00
zhangdengyu
8dbfd3846e fix: 修复告警
Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
2022-09-26 17:08:56 +08:00
openharmony_ci
f34762c105 !1001 修复函数返回错误等问题
Merge pull request !1001 from zhangdengyu/fix_tsacn
2022-09-25 06:42:18 +00:00
zhangdengyu
043e84dfcb fix:修复函数返回错误等问题
Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
2022-09-25 10:09:29 +08:00
28 changed files with 120 additions and 121 deletions

View File

@@ -49,7 +49,7 @@ ShellCB *OsGetShellCb()
return g_shellCB;
}
void ShellDeinit(ShellCB *shellCB)
static void ShellDeinit(ShellCB *shellCB)
{
(void)pthread_mutex_destroy(&shellCB->historyMutex);
(void)pthread_mutex_destroy(&shellCB->keyMutex);
@@ -65,27 +65,23 @@ static int OsShellCreateTask(ShellCB *shellCB)
ret = sched_getparam(getpid(), &param);
if (ret != SH_OK) {
goto OUT;
return ret;
}
param.sched_priority = SHELL_PROCESS_PRIORITY_INIT;
ret = sched_setparam(getpid(), &param);
if (ret != SH_OK) {
goto OUT;
return ret;
}
ret = ShellTaskInit(shellCB);
if (ret != SH_OK) {
goto OUT;
return ret;
}
shellCB->shellEntryHandle = pthread_self();
return 0;
OUT:
ShellDeinit(shellCB);
return ret;
}
static int DoShellExec(char **argv)
@@ -148,7 +144,7 @@ int main(int argc, char **argv)
shellCB = (ShellCB *)malloc(sizeof(ShellCB));
if (shellCB == NULL) {
goto ERR_OUT1;
return SH_NOK;
}
ret = memset_s(shellCB, sizeof(ShellCB), 0, sizeof(ShellCB));
if (ret != SH_OK) {
@@ -176,7 +172,9 @@ int main(int argc, char **argv)
g_shellCB = shellCB;
ret = OsShellCreateTask(shellCB);
if (ret != SH_OK) {
goto ERR_OUT3;
ShellDeinit(shellCB);
g_shellCB = NULL;
return ret;
}
ShellEntry(shellCB);

View File

@@ -1465,7 +1465,7 @@ INT32 los_disk_init(const CHAR *diskName, const struct block_operations *bops,
ret = VnodeLookup(diskName, &blkDriver, 0);
if (ret < 0) {
VnodeDrop();
ret = ENOENT;
PRINT_ERR("disk_init : %s, failed to find the vnode, ERRNO=%d\n", diskName, ret);
goto DISK_FIND_ERROR;
}
struct block_operations *bops2 = (struct block_operations *)((struct drv_data *)blkDriver->data)->ops;

View File

@@ -2311,7 +2311,7 @@ diff -Nupr old/fs/jffs2/erase.c new/fs/jffs2/erase.c
diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
--- old/fs/jffs2/file.c 2022-05-09 17:22:53.000000000 +0800
+++ new/fs/jffs2/file.c 2022-05-10 09:43:14.250000000 +0800
@@ -9,325 +9,34 @@
@@ -9,335 +9,30 @@
* For licensing information, see the file 'LICENCE' in this directory.
*
*/
@@ -2336,32 +2336,35 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- loff_t pos, unsigned len, unsigned flags,
- struct page **pagep, void **fsdata);
-static int jffs2_readpage (struct file *filp, struct page *pg);
-
-int jffs2_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
-{
- struct inode *inode = filp->f_mapping->host;
- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
- int ret;
-
- ret = file_write_and_wait_range(filp, start, end);
- if (ret)
- return ret;
- inode_lock(inode);
- /* Trigger GC to flush any pending writes for this inode */
- jffs2_flush_wbuf_gc(c, inode->i_ino);
- inode_unlock(inode);
+static unsigned char gc_buffer[PAGE_SIZE]; //avoids malloc when user may be under memory pressure
- return 0;
-}
-const struct file_operations jffs2_file_operations =
-int jffs2_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
+unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c,
+ struct jffs2_inode_info *f,
+ unsigned long offset,
+ unsigned long *priv)
{
- struct inode *inode = filp->f_mapping->host;
- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
+ /* FIXME: This works only with one file system mounted at a time */
int ret;
-
- ret = file_write_and_wait_range(filp, start, end);
+ ret = jffs2_read_inode_range(c, f, gc_buffer,
+ offset & ~(PAGE_SIZE-1), PAGE_SIZE);
if (ret)
- return ret;
-
- inode_lock(inode);
- /* Trigger GC to flush any pending writes for this inode */
- jffs2_flush_wbuf_gc(c, inode->i_ino);
- inode_unlock(inode);
-
- return 0;
-}
-
-const struct file_operations jffs2_file_operations =
-{
- .llseek = generic_file_llseek,
- .open = generic_file_open,
- .read_iter = generic_file_read_iter,
@@ -2395,9 +2398,8 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
- unsigned char *pg_buf;
+ /* FIXME: This works only with one file system mounted at a time */
int ret;
- int ret;
-
- jffs2_dbg(2, "%s(): ino #%lu, page at offset 0x%lx\n",
- __func__, inode->i_ino, pg->index << PAGE_SHIFT);
-
@@ -2436,18 +2438,15 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
-{
- struct jffs2_inode_info *f = JFFS2_INODE_INFO(pg->mapping->host);
- int ret;
+ ret = jffs2_read_inode_range(c, f, gc_buffer,
+ offset & ~(PAGE_SIZE-1), PAGE_SIZE);
+ if (ret)
+ return ERR_PTR(ret);
-
- mutex_lock(&f->sem);
- ret = jffs2_do_readpage_unlock(pg->mapping->host, pg);
- mutex_unlock(&f->sem);
- return ret;
+ return ERR_PTR(ret);
+ return gc_buffer;
}
-
-static int jffs2_write_begin(struct file *filp, struct address_space *mapping,
- loff_t pos, unsigned len, unsigned flags,
- struct page **pagep, void **fsdata)
@@ -2458,20 +2457,15 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- struct page *pg;
- struct inode *inode = mapping->host;
- struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
- pgoff_t index = pos >> PAGE_SHIFT;
- uint32_t pageofs = index << PAGE_SHIFT;
- int ret = 0;
-
- pg = grab_cache_page_write_begin(mapping, index, flags);
- if (!pg)
- return -ENOMEM;
- *pagep = pg;
-
- jffs2_dbg(1, "%s()\n", __func__);
-
- if (pageofs > inode->i_size) {
- /* Make new hole frag from old EOF to new page */
- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
- struct jffs2_raw_inode ri;
- struct jffs2_full_dnode *fn;
- uint32_t alloc_len;
@@ -2482,7 +2476,7 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- ret = jffs2_reserve_space(c, sizeof(ri), &alloc_len,
- ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE);
- if (ret)
- goto out_page;
- goto out_err;
-
- mutex_lock(&f->sem);
- memset(&ri, 0, sizeof(ri));
@@ -2512,7 +2506,7 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- ret = PTR_ERR(fn);
- jffs2_complete_reservation(c);
- mutex_unlock(&f->sem);
- goto out_page;
- goto out_err;
- }
- ret = jffs2_add_full_dnode_to_inode(c, f, fn);
- if (f->metadata) {
@@ -2527,7 +2521,7 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- jffs2_free_full_dnode(fn);
- jffs2_complete_reservation(c);
- mutex_unlock(&f->sem);
- goto out_page;
- goto out_err;
- }
- jffs2_complete_reservation(c);
- inode->i_size = pageofs;
@@ -2535,6 +2529,19 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- }
-
- /*
- * While getting a page and reading data in, lock c->alloc_sem until
- * the page is Uptodate. Otherwise GC task may attempt to read the same
- * page in read_cache_page(), which causes a deadlock.
- */
- mutex_lock(&c->alloc_sem);
- pg = grab_cache_page_write_begin(mapping, index, flags);
- if (!pg) {
- ret = -ENOMEM;
- goto release_sem;
- }
- *pagep = pg;
-
- /*
- * Read in the page if it wasn't already present. Cannot optimize away
- * the whole page write case until jffs2_write_end can handle the
- * case of a short-copy.
@@ -2543,19 +2550,20 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- mutex_lock(&f->sem);
- ret = jffs2_do_readpage_nolock(inode, pg);
- mutex_unlock(&f->sem);
- if (ret)
- goto out_page;
- if (ret) {
- unlock_page(pg);
- put_page(pg);
- goto release_sem;
- }
- }
- jffs2_dbg(1, "end write_begin(). pg->flags %lx\n", pg->flags);
- return ret;
-
-out_page:
- unlock_page(pg);
- put_page(pg);
-release_sem:
- mutex_unlock(&c->alloc_sem);
-out_err:
- return ret;
+ /* Do nothing */
}
-}
-
-static int jffs2_write_end(struct file *filp, struct address_space *mapping,
- loff_t pos, unsigned len, unsigned copied,
- struct page *pg, void *fsdata)
@@ -2653,7 +2661,8 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- unlock_page(pg);
- put_page(pg);
- return writtenlen > 0 ? writtenlen : ret;
-}
+ /* Do nothing */
}
diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
--- old/fs/jffs2/fs.c 2022-05-09 17:22:53.000000000 +0800
+++ new/fs/jffs2/fs.c 2022-05-10 16:13:37.830000000 +0800

View File

@@ -780,7 +780,6 @@ ssize_t VfsJffs2Readlink(struct Vnode *vnode, char *buffer, size_t bufLen)
cnt = (bufLen - 1) < targetLen ? (bufLen - 1) : targetLen;
if (LOS_CopyFromKernel(buffer, bufLen, (const char *)f->target, cnt) != 0) {
cnt = 0;
LOS_MuxUnlock(&g_jffs2FsLock);
return -EFAULT;
}

View File

@@ -353,7 +353,7 @@ static struct file_operations_vfs g_errorFileOps = {
.unlink = ErrorFopUnlink,
};
static struct Mount* GetDevMountPoint(struct Vnode *dev)
static struct Mount* GetDevMountPoint(const struct Vnode *dev)
{
struct Mount *mnt = NULL;
LIST_HEAD *mntList = GetMountList();
@@ -394,7 +394,7 @@ static void FilePreClose(struct file *filep, const struct file_operations_vfs *o
}
}
static void FileDisableAndClean(struct Mount *mnt)
static void FileDisableAndClean(const struct Mount *mnt)
{
struct filelist *flist = &tg_filelist;
struct file *filep = NULL;
@@ -435,7 +435,7 @@ static void VnodeTryFree(struct Vnode *vnode)
vnode->fop = &g_errorFileOps;
}
static void VnodeTryFreeAll(struct Mount *mount)
static void VnodeTryFreeAll(const struct Mount *mount)
{
struct Vnode *vnode = NULL;
struct Vnode *nextVnode = NULL;

View File

@@ -66,7 +66,6 @@ static int iov_trans_to_buf(char *buf, ssize_t totallen, const struct iovec *iov
} else {
writepart = bytestowrite - ret;
curbuf += writepart;
totallen -= writepart;
break;
}
}

View File

@@ -70,7 +70,7 @@ VOID OsVmPhysDump(VOID);
VOID OsVmPhysUsedInfoGet(UINT32 *usedCount, UINT32 *totalCount);
INT32 OsRegionOverlapCheck(LosVmSpace *space, LosVmMapRegion *region);
VOID OsDumpPte(VADDR_T vaddr);
LosProcessCB *OsGetPIDByAspace(LosVmSpace *space);
LosProcessCB *OsGetPIDByAspace(const LosVmSpace *space);
CHAR *OsArchFlagsToStr(const UINT32 archFlags);
#ifdef __cplusplus

View File

@@ -193,7 +193,7 @@ VOID OsVmmFileRegionFree(struct file *filep, LosProcessCB *processCB);
LosFilePage *OsPageCacheAlloc(struct page_mapping *mapping, VM_OFFSET_T pgoff);
LosFilePage *OsFindGetEntry(struct page_mapping *mapping, VM_OFFSET_T pgoff);
LosMapInfo *OsGetMapInfo(LosFilePage *page, LosArchMmu *archMmu, VADDR_T vaddr);
LosMapInfo *OsGetMapInfo(const LosFilePage *page, const LosArchMmu *archMmu, VADDR_T vaddr);
VOID OsAddMapInfo(LosFilePage *page, LosArchMmu *archMmu, VADDR_T vaddr);
VOID OsDelMapInfo(LosVmMapRegion *region, LosVmPgFault *pgFault, BOOL cleanDirty);
VOID OsFileCacheFlush(struct page_mapping *mapping);
@@ -208,7 +208,7 @@ VOID OsDeletePageCacheLru(LosFilePage *page);
VOID OsPageRefDecNoLock(LosFilePage *page);
VOID OsPageRefIncLocked(LosFilePage *page);
int OsTryShrinkMemory(size_t nPage);
VOID OsMarkPageDirty(LosFilePage *fpage, LosVmMapRegion *region, int off, int len);
VOID OsMarkPageDirty(LosFilePage *fpage, const LosVmMapRegion *region, int off, int len);
#ifdef LOSCFG_DEBUG_VERSION
VOID ResetPageCacheHitInfo(int *try, int *hit);

View File

@@ -96,7 +96,7 @@ UINT32 LOS_RwlockDestroy(LosRwlock *rwlock)
return LOS_OK;
}
STATIC UINT32 OsRwlockCheck(LosRwlock *rwlock)
STATIC UINT32 OsRwlockCheck(const LosRwlock *rwlock)
{
if (rwlock == NULL) {
return LOS_EINVAL;

View File

@@ -78,7 +78,6 @@ STATIC VOID OsMoveTmpInfoToUnbInfo(sig_cb *sigcb, INT32 signo)
/* delete tmpinfo from tmpList. */
*prevHook = tmpInfoNode->next;
(VOID)LOS_MemFree(m_aucSysMem0, tmpInfoNode);
tmpInfoNode = *prevHook;
break;
}
prevHook = &tmpInfoNode->next;

View File

@@ -918,7 +918,7 @@ STATIC UINT32 OsMemPoolAdd(VOID *pool, UINT32 size)
return LOS_OK;
}
STATIC UINT32 OsMemPoolDelete(VOID *pool)
STATIC UINT32 OsMemPoolDelete(const VOID *pool)
{
UINT32 ret = LOS_NOK;
VOID *nextPool = NULL;

View File

@@ -146,7 +146,6 @@ UINT32 OsKProcessPmUsage(LosVmSpace *kSpace, UINT32 *actualPm)
LosVmSpace *space = NULL;
LOS_DL_LIST *spaceList = NULL;
UINT32 UProcessUsed = 0;
UINT32 pmTmp;
if (actualPm == NULL) {
return 0;
@@ -167,8 +166,7 @@ UINT32 OsKProcessPmUsage(LosVmSpace *kSpace, UINT32 *actualPm)
if (space == LOS_GetKVmSpace()) {
continue;
}
(VOID)OsUProcessPmUsage(space, NULL, &pmTmp);
UProcessUsed += pmTmp;
UProcessUsed += OsUProcessPmUsage(space, NULL, NULL);
}
(VOID)LOS_MuxRelease(vmSpaceListMux);
@@ -253,7 +251,7 @@ UINT32 OsUProcessPmUsage(LosVmSpace *space, UINT32 *sharePm, UINT32 *actualPm)
return pmSize;
}
LosProcessCB *OsGetPIDByAspace(LosVmSpace *space)
LosProcessCB *OsGetPIDByAspace(const LosVmSpace *space)
{
UINT32 pid;
UINT32 intSave;

View File

@@ -125,10 +125,10 @@ VOID OsAddMapInfo(LosFilePage *page, LosArchMmu *archMmu, VADDR_T vaddr)
page->n_maps++;
}
LosMapInfo *OsGetMapInfo(LosFilePage *page, LosArchMmu *archMmu, VADDR_T vaddr)
LosMapInfo *OsGetMapInfo(const LosFilePage *page, const LosArchMmu *archMmu, VADDR_T vaddr)
{
LosMapInfo *info = NULL;
LOS_DL_LIST *immap = &page->i_mmap;
const LOS_DL_LIST *immap = &page->i_mmap;
LOS_DL_LIST_FOR_EACH_ENTRY(info, immap, LosMapInfo, node) {
if ((info->archMmu == archMmu) && (info->vaddr == vaddr) && (info->page == page)) {
@@ -214,7 +214,7 @@ VOID OsVmmFileRemove(LosVmMapRegion *region, LosArchMmu *archMmu, VM_OFFSET_T pg
return;
}
VOID OsMarkPageDirty(LosFilePage *fpage, LosVmMapRegion *region, INT32 off, INT32 len)
VOID OsMarkPageDirty(LosFilePage *fpage, const LosVmMapRegion *region, INT32 off, INT32 len)
{
if (region != NULL) {
OsSetPageDirty(fpage->vmPage);

View File

@@ -233,7 +233,7 @@ LosVmSpace *OsCreateUserVmSpace(VOID)
return space;
}
STATIC BOOL OsVmSpaceParamCheck(LosVmSpace *vmSpace)
STATIC BOOL OsVmSpaceParamCheck(const LosVmSpace *vmSpace)
{
if (vmSpace == NULL) {
return FALSE;

View File

@@ -233,14 +233,8 @@ static int HiLogWriteRingBuffer(unsigned char *buffer, size_t bufLen)
static void HiLogHeadInit(struct HiLogEntry *header, size_t len)
{
struct timespec now;
int ret;
ret = clock_gettime(CLOCK_REALTIME, &now);
if (ret != 0) {
PRINTK("In %s line %d,clock_gettime fail\n", __FUNCTION__, __LINE__);
return;
}
struct timespec now = {0};
(void)clock_gettime(CLOCK_REALTIME, &now);
header->len = len;
header->pid = LOS_GetCurrProcessID();

View File

@@ -289,7 +289,7 @@ STATIC UINT32 OsPerfCollectData(Event *event, PerfSampleData *data, PerfRegs *re
* return TRUE if user haven't specified any taskId(which is supposed
* to instrument the whole system)
*/
STATIC INLINE BOOL OsFilterId(UINT32 id, UINT32 *ids, UINT8 idsNr)
STATIC INLINE BOOL OsFilterId(UINT32 id, const UINT32 *ids, UINT8 idsNr)
{
UINT32 i;
if (!idsNr) {

View File

@@ -300,7 +300,7 @@ UINT32 LOS_PmRegister(LOS_PmNodeType type, VOID *node)
return LOS_EINVAL;
}
STATIC UINT32 OsPmDeviceUnregister(LosPmCB *pm, LosPmDevice *device)
STATIC UINT32 OsPmDeviceUnregister(LosPmCB *pm, const LosPmDevice *device)
{
LOS_SpinLock(&g_pmSpin);
if (pm->device == device) {

View File

@@ -2175,8 +2175,6 @@ u32_t osShellPing6(int argc, const char **argv)
/* Setting the start time of the entire ping task for statistics */
(void)clock_gettime(CLOCK_MONOTONIC_RAW, &first);
nsent = 0;
for (nsent = 0; nsent < ping6_params.pingcount; nsent++) {
/* capture the start tick to calculate rtt */
(void)clock_gettime(CLOCK_MONOTONIC_RAW, &start);
@@ -3170,7 +3168,6 @@ void netstat_internal(void *ctx)
}
/* For listen PCBs */
recvQlen = 0;
sendQlen = 0;
for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
@@ -3670,7 +3667,7 @@ u32_t netdebug_sock(int argc, const char **argv)
int idx;
u32_t ret = LOS_NOK;
if (argc == 2) {
if (argc == 2) { /* 2: Number of command parameters */
if (!strcmp("-i", argv[1])) {
/* netdebug sock -i */
for (idx = 0; idx < (int)LWIP_CONFIG_NUM_SOCKETS; idx++) {
@@ -3678,10 +3675,9 @@ u32_t netdebug_sock(int argc, const char **argv)
}
ret = LOS_OK;
}
} else if (argc == 3) {
} else if (argc == 3) { /* 3: Number of command parameters */
if (!strcmp("-d", argv[1])) {
/* netdebug sock -d <idx> */
idx = atoi(argv[2]);
idx = atoi(argv[2]); /* 2: netdebug sock -d <idx> */
if (idx >= 0) {
debug_socket_info(idx, 1, 1);
ret = LOS_OK;

View File

@@ -116,8 +116,8 @@ static UINT16 GetFreeVid(VOID)
for (i = 0; i < mapMaxNum; i++) {
num = idMap->bitMap[i];
for (j = 0; j < INT_BIT_COUNT; j++) {
if ((num & (1 << j)) == 0) {
num |= 1 << j;
if ((num & (1U << j)) == 0) {
num |= 1U << j;
idMap->bitMap[i] = num;
return (INT_BIT_COUNT * i + j);
}

View File

@@ -49,13 +49,13 @@ static VOID NestingPrioHigh(INT32 irq, VOID *data)
UINT64 curTime;
curTime = LOS_CurrNanosec();
g_recordTime[g_saveIndex] = curTime - g_intPendTime;
if (g_saveIndex == MAX_RECORD_SIZE) {
g_saveIndex = 0;
}
dprintf("curTime = %lld, pendTime = %lld \n", curTime, g_intPendTime);
dprintf("%lld\n", curTime - g_intPendTime);
dprintf("[swtmr] hwi response time : ##%lld \n", g_recordTime[g_saveIndex]);
g_saveIndex++;
if (g_saveIndex == MAX_RECORD_SIZE) {
g_saveIndex = 0;
}
}
static VOID DumpResult()

View File

@@ -39,8 +39,7 @@ extern "C" {
static UINT32 TaskF02(VOID)
{
UINT32 ret = OS_ERROR;
UINT32 cpupUse;
UINT32 ret = OS_ERROR, cpupUse;
g_cpupTestCount++;
// 2, Here, assert that g_cpupTestCount is equal to the expected value.

View File

@@ -76,7 +76,7 @@ static void Task01(void)
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2;
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task04;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup005_task04";

View File

@@ -34,9 +34,11 @@ static int TestCase(void)
{
int ret;
int status = 0;
int *test = NULL; // for trggering an exception
pid_t pid = fork();
ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, INVALID_PROCESS_ID, pid);
if (pid == 0) {
*test = 0x1; // Deliberately trigger an exceptioin
exit(0);
}
@@ -52,6 +54,7 @@ static int TestCase(void)
pid = fork();
ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, INVALID_PROCESS_ID, pid);
if (pid == 0) {
*test = 0x1; // Deliberately trigger an exceptioin
exit(0);
}

View File

@@ -36,13 +36,16 @@
static int TestThread(void)
{
int ret;
int *test = nullptr; // For triggering an exceptioin
pid_t pid = fork();
ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, INVALID_PROCESS_ID, pid);
if (pid == 0) {
*test = 0x1; // Deliberately trigger an exceptioin
while (1) {
}
}
*test = 0x1; // Deliberately trigger an exceptioin
ret = waitpid(pid, NULL, 0);
ICUNIT_ASSERT_EQUAL(ret, pid, ret);

View File

@@ -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-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:
@@ -31,39 +31,46 @@
#include "it_test_shm.h"
#define SHMID_MAX 192
#define SHM_FLAG 0777
static int Testcase(VOID)
{
int shmid[SHMID_MAX + 1] = {-1};
int ret;
int i;
struct shm_info shmInfo;
int leftShmIds;
shmid[0] = shmget((key_t)0x1234, PAGE_SIZE, 0777 | IPC_CREAT);
ret = shmctl(0, SHM_INFO, reinterpret_cast<struct shmid_ds *>(&shmInfo));
ICUNIT_ASSERT_EQUAL(ret, SHMID_MAX, ret);
leftShmIds = SHMID_MAX - shmInfo.used_ids;
shmid[0] = shmget((key_t)0x1234, PAGE_SIZE, SHM_FLAG | IPC_CREAT); // 0x1234: a key used to create shared memory
ICUNIT_ASSERT_NOT_EQUAL(shmid[0], -1, shmid[0]);
ret = shmctl(shmid[0], IPC_RMID, NULL);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
shmid[0] = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT);
shmid[0] = shmget(IPC_PRIVATE, PAGE_SIZE, SHM_FLAG | IPC_CREAT);
ICUNIT_ASSERT_NOT_EQUAL(shmid[0], -1, shmid[0]);
ret = shmctl(shmid[0], IPC_RMID, NULL);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
for (i = 0; i < SHMID_MAX; i++) {
shmid[i] = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT);
for (i = 0; i < leftShmIds; i++) {
shmid[i] = shmget(IPC_PRIVATE, PAGE_SIZE, SHM_FLAG | IPC_CREAT);
ICUNIT_ASSERT_NOT_EQUAL(shmid[i], -1, shmid[i]);
}
shmid[SHMID_MAX] = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT);
ICUNIT_ASSERT_EQUAL(shmid[SHMID_MAX], -1, shmid[SHMID_MAX]);
shmid[leftShmIds] = shmget(IPC_PRIVATE, PAGE_SIZE, SHM_FLAG | IPC_CREAT);
ICUNIT_ASSERT_EQUAL(shmid[leftShmIds], -1, shmid[leftShmIds]);
for (i = 0; i < SHMID_MAX; i++) {
for (i = 0; i < leftShmIds; i++) {
ret = shmctl(shmid[i], IPC_RMID, NULL);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
}
for (i = 0; i < SHMID_MAX; i++) {
for (i = 0; i < leftShmIds; i++) {
ret = shmctl(shmid[i], IPC_RMID, NULL);
ICUNIT_ASSERT_EQUAL(ret, -1, ret);
}

View File

@@ -56,7 +56,7 @@
#define TEST_HwiTrigger(HWI_NUM_TEST)
#define LOS_TaskLock()
#define LOS_TaskUnlock()
#define LOS_MS2Tick(ms) (ms / 10)
#define LOS_MS2Tick(ms) ((ms) / 10)
#define OS_TASK_PRIORITY_HIGHEST 0
#define OS_TASK_PRIORITY_LOWEST 31
@@ -228,12 +228,7 @@ struct testdata {
};
extern struct testdata g_td;
extern unsigned int sleep(unsigned int seconds);
extern unsigned int alarm(unsigned int seconds);
extern int map_errno(UINT32 err);
extern long sysconf(int name);
extern void posix_signal_start(void);
VOID ScenarInit(VOID);

View File

@@ -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-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:
@@ -41,7 +41,7 @@
#define CLOCK_RES_NSEC 1000
#define CLOCK_COARSE_RES_SEC 0
#define CLOCK_COARSE_RES_NSEC 1000000
#define CLOCK_GET_CPU_CLOCKID(pid) ((-pid - 1) * 8U + 2)
#define CLOCK_GET_CPU_CLOCKID(pid) ((-(pid) - 1) * 8U + 2)
void ClockTestSmoke(void);
void ClockTest001(void);

View File

@@ -65,7 +65,7 @@ static int GetHostByAddrTest(void)
addr = gethostbyaddr(&ia, sizeof ia, AF_INET);
ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno);
    RecoveryFileEnv(pathList, file_number);
RecoveryFileEnv(pathList, file_number);
return ICUNIT_SUCCESS;
}