Compare commits
11 Commits
OpenHarmon
...
OpenHarmon
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94eb83b74c | ||
|
|
d8d3035084 | ||
|
|
7fb54d9c15 | ||
|
|
91cea8aae0 | ||
|
|
cbea1a0bad | ||
|
|
5ce18115fe | ||
|
|
1c94be9464 | ||
|
|
dd8d48a2bf | ||
|
|
eb51ba63bd | ||
|
|
586d479570 | ||
|
|
6ed09bf19a |
@@ -49,7 +49,7 @@ ShellCB *OsGetShellCb()
|
|||||||
return g_shellCB;
|
return g_shellCB;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ShellDeinit(ShellCB *shellCB)
|
void ShellDeinit(ShellCB *shellCB)
|
||||||
{
|
{
|
||||||
(void)pthread_mutex_destroy(&shellCB->historyMutex);
|
(void)pthread_mutex_destroy(&shellCB->historyMutex);
|
||||||
(void)pthread_mutex_destroy(&shellCB->keyMutex);
|
(void)pthread_mutex_destroy(&shellCB->keyMutex);
|
||||||
@@ -65,23 +65,27 @@ static int OsShellCreateTask(ShellCB *shellCB)
|
|||||||
|
|
||||||
ret = sched_getparam(getpid(), ¶m);
|
ret = sched_getparam(getpid(), ¶m);
|
||||||
if (ret != SH_OK) {
|
if (ret != SH_OK) {
|
||||||
return ret;
|
goto OUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
param.sched_priority = SHELL_PROCESS_PRIORITY_INIT;
|
param.sched_priority = SHELL_PROCESS_PRIORITY_INIT;
|
||||||
|
|
||||||
ret = sched_setparam(getpid(), ¶m);
|
ret = sched_setparam(getpid(), ¶m);
|
||||||
if (ret != SH_OK) {
|
if (ret != SH_OK) {
|
||||||
return ret;
|
goto OUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ShellTaskInit(shellCB);
|
ret = ShellTaskInit(shellCB);
|
||||||
if (ret != SH_OK) {
|
if (ret != SH_OK) {
|
||||||
return ret;
|
goto OUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
shellCB->shellEntryHandle = pthread_self();
|
shellCB->shellEntryHandle = pthread_self();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
OUT:
|
||||||
|
ShellDeinit(shellCB);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int DoShellExec(char **argv)
|
static int DoShellExec(char **argv)
|
||||||
@@ -144,7 +148,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
shellCB = (ShellCB *)malloc(sizeof(ShellCB));
|
shellCB = (ShellCB *)malloc(sizeof(ShellCB));
|
||||||
if (shellCB == NULL) {
|
if (shellCB == NULL) {
|
||||||
return SH_NOK;
|
goto ERR_OUT1;
|
||||||
}
|
}
|
||||||
ret = memset_s(shellCB, sizeof(ShellCB), 0, sizeof(ShellCB));
|
ret = memset_s(shellCB, sizeof(ShellCB), 0, sizeof(ShellCB));
|
||||||
if (ret != SH_OK) {
|
if (ret != SH_OK) {
|
||||||
@@ -172,9 +176,7 @@ int main(int argc, char **argv)
|
|||||||
g_shellCB = shellCB;
|
g_shellCB = shellCB;
|
||||||
ret = OsShellCreateTask(shellCB);
|
ret = OsShellCreateTask(shellCB);
|
||||||
if (ret != SH_OK) {
|
if (ret != SH_OK) {
|
||||||
ShellDeinit(shellCB);
|
goto ERR_OUT3;
|
||||||
g_shellCB = NULL;
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellEntry(shellCB);
|
ShellEntry(shellCB);
|
||||||
|
|||||||
@@ -1465,7 +1465,7 @@ INT32 los_disk_init(const CHAR *diskName, const struct block_operations *bops,
|
|||||||
ret = VnodeLookup(diskName, &blkDriver, 0);
|
ret = VnodeLookup(diskName, &blkDriver, 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
VnodeDrop();
|
VnodeDrop();
|
||||||
PRINT_ERR("disk_init : %s, failed to find the vnode, ERRNO=%d\n", diskName, ret);
|
ret = ENOENT;
|
||||||
goto DISK_FIND_ERROR;
|
goto DISK_FIND_ERROR;
|
||||||
}
|
}
|
||||||
struct block_operations *bops2 = (struct block_operations *)((struct drv_data *)blkDriver->data)->ops;
|
struct block_operations *bops2 = (struct block_operations *)((struct drv_data *)blkDriver->data)->ops;
|
||||||
|
|||||||
@@ -97,5 +97,5 @@ static const struct file_operations_vfs g_memDevOps = {
|
|||||||
|
|
||||||
int DevMemRegister(void)
|
int DevMemRegister(void)
|
||||||
{
|
{
|
||||||
return register_driver("/dev/mem", &g_memDevOps, 0644, 0); /* 0644: file mode */
|
return register_driver("/dev/mem", &g_memDevOps, 0666, 0); /* 0666: file mode */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
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
|
--- 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
|
+++ new/fs/jffs2/file.c 2022-05-10 09:43:14.250000000 +0800
|
||||||
@@ -9,335 +9,30 @@
|
@@ -9,325 +9,34 @@
|
||||||
* For licensing information, see the file 'LICENCE' in this directory.
|
* For licensing information, see the file 'LICENCE' in this directory.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -2336,35 +2336,32 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
|
|||||||
- loff_t pos, unsigned len, unsigned flags,
|
- loff_t pos, unsigned len, unsigned flags,
|
||||||
- struct page **pagep, void **fsdata);
|
- struct page **pagep, void **fsdata);
|
||||||
-static int jffs2_readpage (struct file *filp, struct page *pg);
|
-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
|
+static unsigned char gc_buffer[PAGE_SIZE]; //avoids malloc when user may be under memory pressure
|
||||||
|
|
||||||
-int jffs2_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
|
- return 0;
|
||||||
|
-}
|
||||||
|
|
||||||
|
-const struct file_operations jffs2_file_operations =
|
||||||
+unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c,
|
+unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c,
|
||||||
+ struct jffs2_inode_info *f,
|
+ struct jffs2_inode_info *f,
|
||||||
+ unsigned long offset,
|
+ unsigned long offset,
|
||||||
+ unsigned long *priv)
|
+ 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,
|
- .llseek = generic_file_llseek,
|
||||||
- .open = generic_file_open,
|
- .open = generic_file_open,
|
||||||
- .read_iter = generic_file_read_iter,
|
- .read_iter = generic_file_read_iter,
|
||||||
@@ -2398,8 +2395,9 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
|
|||||||
- struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
|
- struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
|
||||||
- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
|
- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
|
||||||
- unsigned char *pg_buf;
|
- unsigned char *pg_buf;
|
||||||
- int ret;
|
+ /* FIXME: This works only with one file system mounted at a time */
|
||||||
-
|
int ret;
|
||||||
|
|
||||||
- jffs2_dbg(2, "%s(): ino #%lu, page at offset 0x%lx\n",
|
- jffs2_dbg(2, "%s(): ino #%lu, page at offset 0x%lx\n",
|
||||||
- __func__, inode->i_ino, pg->index << PAGE_SHIFT);
|
- __func__, inode->i_ino, pg->index << PAGE_SHIFT);
|
||||||
-
|
-
|
||||||
@@ -2438,15 +2436,18 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
|
|||||||
-{
|
-{
|
||||||
- struct jffs2_inode_info *f = JFFS2_INODE_INFO(pg->mapping->host);
|
- struct jffs2_inode_info *f = JFFS2_INODE_INFO(pg->mapping->host);
|
||||||
- int ret;
|
- 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);
|
- mutex_lock(&f->sem);
|
||||||
- ret = jffs2_do_readpage_unlock(pg->mapping->host, pg);
|
- ret = jffs2_do_readpage_unlock(pg->mapping->host, pg);
|
||||||
- mutex_unlock(&f->sem);
|
- mutex_unlock(&f->sem);
|
||||||
- return ret;
|
- return ret;
|
||||||
+ return ERR_PTR(ret);
|
|
||||||
+ return gc_buffer;
|
+ return gc_buffer;
|
||||||
}
|
}
|
||||||
|
-
|
||||||
-static int jffs2_write_begin(struct file *filp, struct address_space *mapping,
|
-static int jffs2_write_begin(struct file *filp, struct address_space *mapping,
|
||||||
- loff_t pos, unsigned len, unsigned flags,
|
- loff_t pos, unsigned len, unsigned flags,
|
||||||
- struct page **pagep, void **fsdata)
|
- struct page **pagep, void **fsdata)
|
||||||
@@ -2457,15 +2458,20 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
|
|||||||
- struct page *pg;
|
- struct page *pg;
|
||||||
- struct inode *inode = mapping->host;
|
- struct inode *inode = mapping->host;
|
||||||
- struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
|
- 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;
|
- pgoff_t index = pos >> PAGE_SHIFT;
|
||||||
- uint32_t pageofs = index << PAGE_SHIFT;
|
- uint32_t pageofs = index << PAGE_SHIFT;
|
||||||
- int ret = 0;
|
- int ret = 0;
|
||||||
-
|
-
|
||||||
|
- pg = grab_cache_page_write_begin(mapping, index, flags);
|
||||||
|
- if (!pg)
|
||||||
|
- return -ENOMEM;
|
||||||
|
- *pagep = pg;
|
||||||
|
-
|
||||||
- jffs2_dbg(1, "%s()\n", __func__);
|
- jffs2_dbg(1, "%s()\n", __func__);
|
||||||
-
|
-
|
||||||
- if (pageofs > inode->i_size) {
|
- if (pageofs > inode->i_size) {
|
||||||
- /* Make new hole frag from old EOF to new page */
|
- /* 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_raw_inode ri;
|
||||||
- struct jffs2_full_dnode *fn;
|
- struct jffs2_full_dnode *fn;
|
||||||
- uint32_t alloc_len;
|
- uint32_t alloc_len;
|
||||||
@@ -2476,7 +2482,7 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
|
|||||||
- ret = jffs2_reserve_space(c, sizeof(ri), &alloc_len,
|
- ret = jffs2_reserve_space(c, sizeof(ri), &alloc_len,
|
||||||
- ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE);
|
- ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE);
|
||||||
- if (ret)
|
- if (ret)
|
||||||
- goto out_err;
|
- goto out_page;
|
||||||
-
|
-
|
||||||
- mutex_lock(&f->sem);
|
- mutex_lock(&f->sem);
|
||||||
- memset(&ri, 0, sizeof(ri));
|
- memset(&ri, 0, sizeof(ri));
|
||||||
@@ -2506,7 +2512,7 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
|
|||||||
- ret = PTR_ERR(fn);
|
- ret = PTR_ERR(fn);
|
||||||
- jffs2_complete_reservation(c);
|
- jffs2_complete_reservation(c);
|
||||||
- mutex_unlock(&f->sem);
|
- mutex_unlock(&f->sem);
|
||||||
- goto out_err;
|
- goto out_page;
|
||||||
- }
|
- }
|
||||||
- ret = jffs2_add_full_dnode_to_inode(c, f, fn);
|
- ret = jffs2_add_full_dnode_to_inode(c, f, fn);
|
||||||
- if (f->metadata) {
|
- if (f->metadata) {
|
||||||
@@ -2521,7 +2527,7 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
|
|||||||
- jffs2_free_full_dnode(fn);
|
- jffs2_free_full_dnode(fn);
|
||||||
- jffs2_complete_reservation(c);
|
- jffs2_complete_reservation(c);
|
||||||
- mutex_unlock(&f->sem);
|
- mutex_unlock(&f->sem);
|
||||||
- goto out_err;
|
- goto out_page;
|
||||||
- }
|
- }
|
||||||
- jffs2_complete_reservation(c);
|
- jffs2_complete_reservation(c);
|
||||||
- inode->i_size = pageofs;
|
- inode->i_size = pageofs;
|
||||||
@@ -2529,19 +2535,6 @@ 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
|
- * 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
|
- * the whole page write case until jffs2_write_end can handle the
|
||||||
- * case of a short-copy.
|
- * case of a short-copy.
|
||||||
@@ -2550,20 +2543,19 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
|
|||||||
- mutex_lock(&f->sem);
|
- mutex_lock(&f->sem);
|
||||||
- ret = jffs2_do_readpage_nolock(inode, pg);
|
- ret = jffs2_do_readpage_nolock(inode, pg);
|
||||||
- mutex_unlock(&f->sem);
|
- mutex_unlock(&f->sem);
|
||||||
- if (ret) {
|
- if (ret)
|
||||||
- unlock_page(pg);
|
- goto out_page;
|
||||||
- put_page(pg);
|
|
||||||
- goto release_sem;
|
|
||||||
- }
|
|
||||||
- }
|
- }
|
||||||
- jffs2_dbg(1, "end write_begin(). pg->flags %lx\n", pg->flags);
|
- jffs2_dbg(1, "end write_begin(). pg->flags %lx\n", pg->flags);
|
||||||
-
|
|
||||||
-release_sem:
|
|
||||||
- mutex_unlock(&c->alloc_sem);
|
|
||||||
-out_err:
|
|
||||||
- return ret;
|
- return ret;
|
||||||
-}
|
|
||||||
-
|
-
|
||||||
|
-out_page:
|
||||||
|
- unlock_page(pg);
|
||||||
|
- put_page(pg);
|
||||||
|
- return ret;
|
||||||
|
+ /* Do nothing */
|
||||||
|
}
|
||||||
|
|
||||||
-static int jffs2_write_end(struct file *filp, struct address_space *mapping,
|
-static int jffs2_write_end(struct file *filp, struct address_space *mapping,
|
||||||
- loff_t pos, unsigned len, unsigned copied,
|
- loff_t pos, unsigned len, unsigned copied,
|
||||||
- struct page *pg, void *fsdata)
|
- struct page *pg, void *fsdata)
|
||||||
@@ -2661,8 +2653,7 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
|
|||||||
- unlock_page(pg);
|
- unlock_page(pg);
|
||||||
- put_page(pg);
|
- put_page(pg);
|
||||||
- return writtenlen > 0 ? writtenlen : ret;
|
- return writtenlen > 0 ? writtenlen : ret;
|
||||||
+ /* Do nothing */
|
-}
|
||||||
}
|
|
||||||
diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
|
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
|
--- 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
|
+++ new/fs/jffs2/fs.c 2022-05-10 16:13:37.830000000 +0800
|
||||||
|
|||||||
@@ -780,6 +780,7 @@ ssize_t VfsJffs2Readlink(struct Vnode *vnode, char *buffer, size_t bufLen)
|
|||||||
|
|
||||||
cnt = (bufLen - 1) < targetLen ? (bufLen - 1) : targetLen;
|
cnt = (bufLen - 1) < targetLen ? (bufLen - 1) : targetLen;
|
||||||
if (LOS_CopyFromKernel(buffer, bufLen, (const char *)f->target, cnt) != 0) {
|
if (LOS_CopyFromKernel(buffer, bufLen, (const char *)f->target, cnt) != 0) {
|
||||||
|
cnt = 0;
|
||||||
LOS_MuxUnlock(&g_jffs2FsLock);
|
LOS_MuxUnlock(&g_jffs2FsLock);
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ static const struct ProcFileOperations FS_CACHE_PROC_FOPS = {
|
|||||||
|
|
||||||
void ProcFsCacheInit(void)
|
void ProcFsCacheInit(void)
|
||||||
{
|
{
|
||||||
struct ProcDirEntry *pde = CreateProcEntry("fs_cache", 0400, NULL);
|
struct ProcDirEntry *pde = CreateProcEntry("fs_cache", 0, NULL);
|
||||||
if (pde == NULL) {
|
if (pde == NULL) {
|
||||||
PRINT_ERR("create fs_cache error!\n");
|
PRINT_ERR("create fs_cache error!\n");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ static struct file_operations_vfs g_errorFileOps = {
|
|||||||
.unlink = ErrorFopUnlink,
|
.unlink = ErrorFopUnlink,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct Mount* GetDevMountPoint(const struct Vnode *dev)
|
static struct Mount* GetDevMountPoint(struct Vnode *dev)
|
||||||
{
|
{
|
||||||
struct Mount *mnt = NULL;
|
struct Mount *mnt = NULL;
|
||||||
LIST_HEAD *mntList = GetMountList();
|
LIST_HEAD *mntList = GetMountList();
|
||||||
@@ -394,7 +394,7 @@ static void FilePreClose(struct file *filep, const struct file_operations_vfs *o
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FileDisableAndClean(const struct Mount *mnt)
|
static void FileDisableAndClean(struct Mount *mnt)
|
||||||
{
|
{
|
||||||
struct filelist *flist = &tg_filelist;
|
struct filelist *flist = &tg_filelist;
|
||||||
struct file *filep = NULL;
|
struct file *filep = NULL;
|
||||||
@@ -435,7 +435,7 @@ static void VnodeTryFree(struct Vnode *vnode)
|
|||||||
vnode->fop = &g_errorFileOps;
|
vnode->fop = &g_errorFileOps;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void VnodeTryFreeAll(const struct Mount *mount)
|
static void VnodeTryFreeAll(struct Mount *mount)
|
||||||
{
|
{
|
||||||
struct Vnode *vnode = NULL;
|
struct Vnode *vnode = NULL;
|
||||||
struct Vnode *nextVnode = NULL;
|
struct Vnode *nextVnode = NULL;
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ static int iov_trans_to_buf(char *buf, ssize_t totallen, const struct iovec *iov
|
|||||||
} else {
|
} else {
|
||||||
writepart = bytestowrite - ret;
|
writepart = bytestowrite - ret;
|
||||||
curbuf += writepart;
|
curbuf += writepart;
|
||||||
|
totallen -= writepart;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -583,7 +583,7 @@ STATIC INLINE BOOL SwtmrRunqueueFind(SortLinkAttribute *swtmrSortLink, SCHED_TL_
|
|||||||
STATIC BOOL SwtmrTimeListFind(SCHED_TL_FIND_FUNC checkFunc, UINTPTR arg)
|
STATIC BOOL SwtmrTimeListFind(SCHED_TL_FIND_FUNC checkFunc, UINTPTR arg)
|
||||||
{
|
{
|
||||||
for (UINT16 cpuid = 0; cpuid < LOSCFG_KERNEL_CORE_NUM; cpuid++) {
|
for (UINT16 cpuid = 0; cpuid < LOSCFG_KERNEL_CORE_NUM; cpuid++) {
|
||||||
SortLinkAttribute *swtmrSortLink = &g_swtmrRunqueue[cpuid].swtmrSortLink;
|
SortLinkAttribute *swtmrSortLink = &g_swtmrRunqueue[ArchCurrCpuid()].swtmrSortLink;
|
||||||
if (SwtmrRunqueueFind(swtmrSortLink, checkFunc, arg)) {
|
if (SwtmrRunqueueFind(swtmrSortLink, checkFunc, arg)) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ VOID OsVmPhysDump(VOID);
|
|||||||
VOID OsVmPhysUsedInfoGet(UINT32 *usedCount, UINT32 *totalCount);
|
VOID OsVmPhysUsedInfoGet(UINT32 *usedCount, UINT32 *totalCount);
|
||||||
INT32 OsRegionOverlapCheck(LosVmSpace *space, LosVmMapRegion *region);
|
INT32 OsRegionOverlapCheck(LosVmSpace *space, LosVmMapRegion *region);
|
||||||
VOID OsDumpPte(VADDR_T vaddr);
|
VOID OsDumpPte(VADDR_T vaddr);
|
||||||
LosProcessCB *OsGetPIDByAspace(const LosVmSpace *space);
|
LosProcessCB *OsGetPIDByAspace(LosVmSpace *space);
|
||||||
CHAR *OsArchFlagsToStr(const UINT32 archFlags);
|
CHAR *OsArchFlagsToStr(const UINT32 archFlags);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ VOID OsVmmFileRegionFree(struct file *filep, LosProcessCB *processCB);
|
|||||||
|
|
||||||
LosFilePage *OsPageCacheAlloc(struct page_mapping *mapping, VM_OFFSET_T pgoff);
|
LosFilePage *OsPageCacheAlloc(struct page_mapping *mapping, VM_OFFSET_T pgoff);
|
||||||
LosFilePage *OsFindGetEntry(struct page_mapping *mapping, VM_OFFSET_T pgoff);
|
LosFilePage *OsFindGetEntry(struct page_mapping *mapping, VM_OFFSET_T pgoff);
|
||||||
LosMapInfo *OsGetMapInfo(const LosFilePage *page, const LosArchMmu *archMmu, VADDR_T vaddr);
|
LosMapInfo *OsGetMapInfo(LosFilePage *page, LosArchMmu *archMmu, VADDR_T vaddr);
|
||||||
VOID OsAddMapInfo(LosFilePage *page, LosArchMmu *archMmu, VADDR_T vaddr);
|
VOID OsAddMapInfo(LosFilePage *page, LosArchMmu *archMmu, VADDR_T vaddr);
|
||||||
VOID OsDelMapInfo(LosVmMapRegion *region, LosVmPgFault *pgFault, BOOL cleanDirty);
|
VOID OsDelMapInfo(LosVmMapRegion *region, LosVmPgFault *pgFault, BOOL cleanDirty);
|
||||||
VOID OsFileCacheFlush(struct page_mapping *mapping);
|
VOID OsFileCacheFlush(struct page_mapping *mapping);
|
||||||
@@ -208,7 +208,7 @@ VOID OsDeletePageCacheLru(LosFilePage *page);
|
|||||||
VOID OsPageRefDecNoLock(LosFilePage *page);
|
VOID OsPageRefDecNoLock(LosFilePage *page);
|
||||||
VOID OsPageRefIncLocked(LosFilePage *page);
|
VOID OsPageRefIncLocked(LosFilePage *page);
|
||||||
int OsTryShrinkMemory(size_t nPage);
|
int OsTryShrinkMemory(size_t nPage);
|
||||||
VOID OsMarkPageDirty(LosFilePage *fpage, const LosVmMapRegion *region, int off, int len);
|
VOID OsMarkPageDirty(LosFilePage *fpage, LosVmMapRegion *region, int off, int len);
|
||||||
|
|
||||||
#ifdef LOSCFG_DEBUG_VERSION
|
#ifdef LOSCFG_DEBUG_VERSION
|
||||||
VOID ResetPageCacheHitInfo(int *try, int *hit);
|
VOID ResetPageCacheHitInfo(int *try, int *hit);
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ UINT32 LOS_RwlockDestroy(LosRwlock *rwlock)
|
|||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC UINT32 OsRwlockCheck(const LosRwlock *rwlock)
|
STATIC UINT32 OsRwlockCheck(LosRwlock *rwlock)
|
||||||
{
|
{
|
||||||
if (rwlock == NULL) {
|
if (rwlock == NULL) {
|
||||||
return LOS_EINVAL;
|
return LOS_EINVAL;
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ STATIC VOID OsMoveTmpInfoToUnbInfo(sig_cb *sigcb, INT32 signo)
|
|||||||
/* delete tmpinfo from tmpList. */
|
/* delete tmpinfo from tmpList. */
|
||||||
*prevHook = tmpInfoNode->next;
|
*prevHook = tmpInfoNode->next;
|
||||||
(VOID)LOS_MemFree(m_aucSysMem0, tmpInfoNode);
|
(VOID)LOS_MemFree(m_aucSysMem0, tmpInfoNode);
|
||||||
|
tmpInfoNode = *prevHook;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
prevHook = &tmpInfoNode->next;
|
prevHook = &tmpInfoNode->next;
|
||||||
|
|||||||
@@ -918,7 +918,7 @@ STATIC UINT32 OsMemPoolAdd(VOID *pool, UINT32 size)
|
|||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC UINT32 OsMemPoolDelete(const VOID *pool)
|
STATIC UINT32 OsMemPoolDelete(VOID *pool)
|
||||||
{
|
{
|
||||||
UINT32 ret = LOS_NOK;
|
UINT32 ret = LOS_NOK;
|
||||||
VOID *nextPool = NULL;
|
VOID *nextPool = NULL;
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ UINT32 OsKProcessPmUsage(LosVmSpace *kSpace, UINT32 *actualPm)
|
|||||||
LosVmSpace *space = NULL;
|
LosVmSpace *space = NULL;
|
||||||
LOS_DL_LIST *spaceList = NULL;
|
LOS_DL_LIST *spaceList = NULL;
|
||||||
UINT32 UProcessUsed = 0;
|
UINT32 UProcessUsed = 0;
|
||||||
|
UINT32 pmTmp;
|
||||||
|
|
||||||
if (actualPm == NULL) {
|
if (actualPm == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -166,7 +167,8 @@ UINT32 OsKProcessPmUsage(LosVmSpace *kSpace, UINT32 *actualPm)
|
|||||||
if (space == LOS_GetKVmSpace()) {
|
if (space == LOS_GetKVmSpace()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
UProcessUsed += OsUProcessPmUsage(space, NULL, NULL);
|
(VOID)OsUProcessPmUsage(space, NULL, &pmTmp);
|
||||||
|
UProcessUsed += pmTmp;
|
||||||
}
|
}
|
||||||
(VOID)LOS_MuxRelease(vmSpaceListMux);
|
(VOID)LOS_MuxRelease(vmSpaceListMux);
|
||||||
|
|
||||||
@@ -251,7 +253,7 @@ UINT32 OsUProcessPmUsage(LosVmSpace *space, UINT32 *sharePm, UINT32 *actualPm)
|
|||||||
return pmSize;
|
return pmSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
LosProcessCB *OsGetPIDByAspace(const LosVmSpace *space)
|
LosProcessCB *OsGetPIDByAspace(LosVmSpace *space)
|
||||||
{
|
{
|
||||||
UINT32 pid;
|
UINT32 pid;
|
||||||
UINT32 intSave;
|
UINT32 intSave;
|
||||||
|
|||||||
@@ -125,10 +125,10 @@ VOID OsAddMapInfo(LosFilePage *page, LosArchMmu *archMmu, VADDR_T vaddr)
|
|||||||
page->n_maps++;
|
page->n_maps++;
|
||||||
}
|
}
|
||||||
|
|
||||||
LosMapInfo *OsGetMapInfo(const LosFilePage *page, const LosArchMmu *archMmu, VADDR_T vaddr)
|
LosMapInfo *OsGetMapInfo(LosFilePage *page, LosArchMmu *archMmu, VADDR_T vaddr)
|
||||||
{
|
{
|
||||||
LosMapInfo *info = NULL;
|
LosMapInfo *info = NULL;
|
||||||
const LOS_DL_LIST *immap = &page->i_mmap;
|
LOS_DL_LIST *immap = &page->i_mmap;
|
||||||
|
|
||||||
LOS_DL_LIST_FOR_EACH_ENTRY(info, immap, LosMapInfo, node) {
|
LOS_DL_LIST_FOR_EACH_ENTRY(info, immap, LosMapInfo, node) {
|
||||||
if ((info->archMmu == archMmu) && (info->vaddr == vaddr) && (info->page == page)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID OsMarkPageDirty(LosFilePage *fpage, const LosVmMapRegion *region, INT32 off, INT32 len)
|
VOID OsMarkPageDirty(LosFilePage *fpage, LosVmMapRegion *region, INT32 off, INT32 len)
|
||||||
{
|
{
|
||||||
if (region != NULL) {
|
if (region != NULL) {
|
||||||
OsSetPageDirty(fpage->vmPage);
|
OsSetPageDirty(fpage->vmPage);
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ LosVmSpace *OsCreateUserVmSpace(VOID)
|
|||||||
return space;
|
return space;
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC BOOL OsVmSpaceParamCheck(const LosVmSpace *vmSpace)
|
STATIC BOOL OsVmSpaceParamCheck(LosVmSpace *vmSpace)
|
||||||
{
|
{
|
||||||
if (vmSpace == NULL) {
|
if (vmSpace == NULL) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -233,8 +233,14 @@ static int HiLogWriteRingBuffer(unsigned char *buffer, size_t bufLen)
|
|||||||
|
|
||||||
static void HiLogHeadInit(struct HiLogEntry *header, size_t len)
|
static void HiLogHeadInit(struct HiLogEntry *header, size_t len)
|
||||||
{
|
{
|
||||||
struct timespec now = {0};
|
struct timespec now;
|
||||||
(void)clock_gettime(CLOCK_REALTIME, &now);
|
int ret;
|
||||||
|
|
||||||
|
ret = clock_gettime(CLOCK_REALTIME, &now);
|
||||||
|
if (ret != 0) {
|
||||||
|
PRINTK("In %s line %d,clock_gettime fail\n", __FUNCTION__, __LINE__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
header->len = len;
|
header->len = len;
|
||||||
header->pid = LOS_GetCurrProcessID();
|
header->pid = LOS_GetCurrProcessID();
|
||||||
|
|||||||
@@ -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
|
* return TRUE if user haven't specified any taskId(which is supposed
|
||||||
* to instrument the whole system)
|
* to instrument the whole system)
|
||||||
*/
|
*/
|
||||||
STATIC INLINE BOOL OsFilterId(UINT32 id, const UINT32 *ids, UINT8 idsNr)
|
STATIC INLINE BOOL OsFilterId(UINT32 id, UINT32 *ids, UINT8 idsNr)
|
||||||
{
|
{
|
||||||
UINT32 i;
|
UINT32 i;
|
||||||
if (!idsNr) {
|
if (!idsNr) {
|
||||||
|
|||||||
@@ -300,7 +300,7 @@ UINT32 LOS_PmRegister(LOS_PmNodeType type, VOID *node)
|
|||||||
return LOS_EINVAL;
|
return LOS_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC UINT32 OsPmDeviceUnregister(LosPmCB *pm, const LosPmDevice *device)
|
STATIC UINT32 OsPmDeviceUnregister(LosPmCB *pm, LosPmDevice *device)
|
||||||
{
|
{
|
||||||
LOS_SpinLock(&g_pmSpin);
|
LOS_SpinLock(&g_pmSpin);
|
||||||
if (pm->device == device) {
|
if (pm->device == device) {
|
||||||
|
|||||||
@@ -2175,6 +2175,8 @@ u32_t osShellPing6(int argc, const char **argv)
|
|||||||
/* Setting the start time of the entire ping task for statistics */
|
/* Setting the start time of the entire ping task for statistics */
|
||||||
(void)clock_gettime(CLOCK_MONOTONIC_RAW, &first);
|
(void)clock_gettime(CLOCK_MONOTONIC_RAW, &first);
|
||||||
|
|
||||||
|
nsent = 0;
|
||||||
|
|
||||||
for (nsent = 0; nsent < ping6_params.pingcount; nsent++) {
|
for (nsent = 0; nsent < ping6_params.pingcount; nsent++) {
|
||||||
/* capture the start tick to calculate rtt */
|
/* capture the start tick to calculate rtt */
|
||||||
(void)clock_gettime(CLOCK_MONOTONIC_RAW, &start);
|
(void)clock_gettime(CLOCK_MONOTONIC_RAW, &start);
|
||||||
@@ -3168,6 +3170,7 @@ void netstat_internal(void *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* For listen PCBs */
|
/* For listen PCBs */
|
||||||
|
recvQlen = 0;
|
||||||
sendQlen = 0;
|
sendQlen = 0;
|
||||||
|
|
||||||
for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
|
for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
|
||||||
@@ -3667,7 +3670,7 @@ u32_t netdebug_sock(int argc, const char **argv)
|
|||||||
int idx;
|
int idx;
|
||||||
u32_t ret = LOS_NOK;
|
u32_t ret = LOS_NOK;
|
||||||
|
|
||||||
if (argc == 2) { /* 2: Number of command parameters */
|
if (argc == 2) {
|
||||||
if (!strcmp("-i", argv[1])) {
|
if (!strcmp("-i", argv[1])) {
|
||||||
/* netdebug sock -i */
|
/* netdebug sock -i */
|
||||||
for (idx = 0; idx < (int)LWIP_CONFIG_NUM_SOCKETS; idx++) {
|
for (idx = 0; idx < (int)LWIP_CONFIG_NUM_SOCKETS; idx++) {
|
||||||
@@ -3675,9 +3678,10 @@ u32_t netdebug_sock(int argc, const char **argv)
|
|||||||
}
|
}
|
||||||
ret = LOS_OK;
|
ret = LOS_OK;
|
||||||
}
|
}
|
||||||
} else if (argc == 3) { /* 3: Number of command parameters */
|
} else if (argc == 3) {
|
||||||
if (!strcmp("-d", argv[1])) {
|
if (!strcmp("-d", argv[1])) {
|
||||||
idx = atoi(argv[2]); /* 2: netdebug sock -d <idx> */
|
/* netdebug sock -d <idx> */
|
||||||
|
idx = atoi(argv[2]);
|
||||||
if (idx >= 0) {
|
if (idx >= 0) {
|
||||||
debug_socket_info(idx, 1, 1);
|
debug_socket_info(idx, 1, 1);
|
||||||
ret = LOS_OK;
|
ret = LOS_OK;
|
||||||
|
|||||||
@@ -116,8 +116,8 @@ static UINT16 GetFreeVid(VOID)
|
|||||||
for (i = 0; i < mapMaxNum; i++) {
|
for (i = 0; i < mapMaxNum; i++) {
|
||||||
num = idMap->bitMap[i];
|
num = idMap->bitMap[i];
|
||||||
for (j = 0; j < INT_BIT_COUNT; j++) {
|
for (j = 0; j < INT_BIT_COUNT; j++) {
|
||||||
if ((num & (1U << j)) == 0) {
|
if ((num & (1 << j)) == 0) {
|
||||||
num |= 1U << j;
|
num |= 1 << j;
|
||||||
idMap->bitMap[i] = num;
|
idMap->bitMap[i] = num;
|
||||||
return (INT_BIT_COUNT * i + j);
|
return (INT_BIT_COUNT * i + j);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,15 +94,9 @@ int SysMqClose(mqd_t personal)
|
|||||||
int SysMqNotify(mqd_t personal, const struct sigevent *sigev)
|
int SysMqNotify(mqd_t personal, const struct sigevent *sigev)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct sigevent ksigev;
|
|
||||||
|
|
||||||
ret = LOS_ArchCopyFromUser(&ksigev, sigev, sizeof(struct sigevent));
|
|
||||||
if (ret != 0) {
|
|
||||||
return -EFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
MQUEUE_FD_U2K(personal);
|
MQUEUE_FD_U2K(personal);
|
||||||
ret = OsMqNotify(personal, &ksigev);
|
ret = OsMqNotify(personal, sigev);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return -get_errno();
|
return -get_errno();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,13 +49,13 @@ static VOID NestingPrioHigh(INT32 irq, VOID *data)
|
|||||||
UINT64 curTime;
|
UINT64 curTime;
|
||||||
curTime = LOS_CurrNanosec();
|
curTime = LOS_CurrNanosec();
|
||||||
g_recordTime[g_saveIndex] = curTime - g_intPendTime;
|
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("curTime = %lld, pendTime = %lld \n", curTime, g_intPendTime);
|
||||||
dprintf("%lld\n", curTime - g_intPendTime);
|
dprintf("%lld\n", curTime - g_intPendTime);
|
||||||
dprintf("[swtmr] hwi response time : ##%lld \n", g_recordTime[g_saveIndex]);
|
dprintf("[swtmr] hwi response time : ##%lld \n", g_recordTime[g_saveIndex]);
|
||||||
g_saveIndex++;
|
g_saveIndex++;
|
||||||
if (g_saveIndex == MAX_RECORD_SIZE) {
|
|
||||||
g_saveIndex = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID DumpResult()
|
static VOID DumpResult()
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ extern "C" {
|
|||||||
|
|
||||||
static UINT32 TaskF02(VOID)
|
static UINT32 TaskF02(VOID)
|
||||||
{
|
{
|
||||||
UINT32 ret = OS_ERROR, cpupUse;
|
UINT32 ret = OS_ERROR;
|
||||||
|
UINT32 cpupUse;
|
||||||
g_cpupTestCount++;
|
g_cpupTestCount++;
|
||||||
|
|
||||||
// 2, Here, assert that g_cpupTestCount is equal to the expected value.
|
// 2, Here, assert that g_cpupTestCount is equal to the expected value.
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ static void Task01(void)
|
|||||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
|
||||||
|
|
||||||
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
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.pfnTaskEntry = (TSK_ENTRY_FUNC)Task04;
|
||||||
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
|
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
|
||||||
taskInitParam.pcName = "SmpCpup005_task04";
|
taskInitParam.pcName = "SmpCpup005_task04";
|
||||||
|
|||||||
@@ -34,11 +34,9 @@ static int TestCase(void)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
int *test = NULL; // for trggering an exception
|
|
||||||
pid_t pid = fork();
|
pid_t pid = fork();
|
||||||
ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, INVALID_PROCESS_ID, pid);
|
ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, INVALID_PROCESS_ID, pid);
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
*test = 0x1; // Deliberately trigger an exceptioin
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +52,6 @@ static int TestCase(void)
|
|||||||
pid = fork();
|
pid = fork();
|
||||||
ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, INVALID_PROCESS_ID, pid);
|
ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, INVALID_PROCESS_ID, pid);
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
*test = 0x1; // Deliberately trigger an exceptioin
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,16 +36,13 @@
|
|||||||
static int TestThread(void)
|
static int TestThread(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int *test = nullptr; // For triggering an exceptioin
|
|
||||||
|
|
||||||
pid_t pid = fork();
|
pid_t pid = fork();
|
||||||
ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, INVALID_PROCESS_ID, pid);
|
ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, INVALID_PROCESS_ID, pid);
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
*test = 0x1; // Deliberately trigger an exceptioin
|
|
||||||
while (1) {
|
while (1) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*test = 0x1; // Deliberately trigger an exceptioin
|
|
||||||
|
|
||||||
ret = waitpid(pid, NULL, 0);
|
ret = waitpid(pid, NULL, 0);
|
||||||
ICUNIT_ASSERT_EQUAL(ret, pid, ret);
|
ICUNIT_ASSERT_EQUAL(ret, pid, ret);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
* 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-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
* are permitted provided that the following conditions are met:
|
* are permitted provided that the following conditions are met:
|
||||||
@@ -31,46 +31,39 @@
|
|||||||
#include "it_test_shm.h"
|
#include "it_test_shm.h"
|
||||||
|
|
||||||
#define SHMID_MAX 192
|
#define SHMID_MAX 192
|
||||||
#define SHM_FLAG 0777
|
|
||||||
|
|
||||||
static int Testcase(VOID)
|
static int Testcase(VOID)
|
||||||
{
|
{
|
||||||
int shmid[SHMID_MAX + 1] = {-1};
|
int shmid[SHMID_MAX + 1] = {-1};
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
struct shm_info shmInfo;
|
|
||||||
int leftShmIds;
|
|
||||||
|
|
||||||
ret = shmctl(0, SHM_INFO, reinterpret_cast<struct shmid_ds *>(&shmInfo));
|
shmid[0] = shmget((key_t)0x1234, PAGE_SIZE, 0777 | IPC_CREAT);
|
||||||
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]);
|
ICUNIT_ASSERT_NOT_EQUAL(shmid[0], -1, shmid[0]);
|
||||||
|
|
||||||
ret = shmctl(shmid[0], IPC_RMID, NULL);
|
ret = shmctl(shmid[0], IPC_RMID, NULL);
|
||||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||||
|
|
||||||
shmid[0] = shmget(IPC_PRIVATE, PAGE_SIZE, SHM_FLAG | IPC_CREAT);
|
shmid[0] = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT);
|
||||||
ICUNIT_ASSERT_NOT_EQUAL(shmid[0], -1, shmid[0]);
|
ICUNIT_ASSERT_NOT_EQUAL(shmid[0], -1, shmid[0]);
|
||||||
|
|
||||||
ret = shmctl(shmid[0], IPC_RMID, NULL);
|
ret = shmctl(shmid[0], IPC_RMID, NULL);
|
||||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||||
|
|
||||||
for (i = 0; i < leftShmIds; i++) {
|
for (i = 0; i < SHMID_MAX; i++) {
|
||||||
shmid[i] = shmget(IPC_PRIVATE, PAGE_SIZE, SHM_FLAG | IPC_CREAT);
|
shmid[i] = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT);
|
||||||
ICUNIT_ASSERT_NOT_EQUAL(shmid[i], -1, shmid[i]);
|
ICUNIT_ASSERT_NOT_EQUAL(shmid[i], -1, shmid[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
shmid[leftShmIds] = shmget(IPC_PRIVATE, PAGE_SIZE, SHM_FLAG | IPC_CREAT);
|
shmid[SHMID_MAX] = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT);
|
||||||
ICUNIT_ASSERT_EQUAL(shmid[leftShmIds], -1, shmid[leftShmIds]);
|
ICUNIT_ASSERT_EQUAL(shmid[SHMID_MAX], -1, shmid[SHMID_MAX]);
|
||||||
|
|
||||||
for (i = 0; i < leftShmIds; i++) {
|
for (i = 0; i < SHMID_MAX; i++) {
|
||||||
ret = shmctl(shmid[i], IPC_RMID, NULL);
|
ret = shmctl(shmid[i], IPC_RMID, NULL);
|
||||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < leftShmIds; i++) {
|
for (i = 0; i < SHMID_MAX; i++) {
|
||||||
ret = shmctl(shmid[i], IPC_RMID, NULL);
|
ret = shmctl(shmid[i], IPC_RMID, NULL);
|
||||||
ICUNIT_ASSERT_EQUAL(ret, -1, ret);
|
ICUNIT_ASSERT_EQUAL(ret, -1, ret);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ static int Testcase(VOID)
|
|||||||
ICUNIT_GOTO_EQUAL(ds.shm_perm.uid, getuid(), ds.shm_perm.uid, ERROR_OUT);
|
ICUNIT_GOTO_EQUAL(ds.shm_perm.uid, getuid(), ds.shm_perm.uid, ERROR_OUT);
|
||||||
|
|
||||||
ret = shmctl(shmid, SHM_STAT, &ds);
|
ret = shmctl(shmid, SHM_STAT, &ds);
|
||||||
|
// ICUNIT_GOTO_EQUAL(ret, 0x10000, ret, ERROR_OUT);
|
||||||
ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, ERROR_OUT);
|
ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, ERROR_OUT);
|
||||||
ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, ERROR_OUT);
|
ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, ERROR_OUT);
|
||||||
|
|
||||||
@@ -69,7 +70,7 @@ static int Testcase(VOID)
|
|||||||
ICUNIT_GOTO_EQUAL(info.shmmax, 0x1000000, info.shmmax, ERROR_OUT);
|
ICUNIT_GOTO_EQUAL(info.shmmax, 0x1000000, info.shmmax, ERROR_OUT);
|
||||||
ICUNIT_GOTO_EQUAL(info.shmmin, 1, info.shmmin, ERROR_OUT);
|
ICUNIT_GOTO_EQUAL(info.shmmin, 1, info.shmmin, ERROR_OUT);
|
||||||
ICUNIT_GOTO_EQUAL(info.shmmni, 192, info.shmmni, ERROR_OUT);
|
ICUNIT_GOTO_EQUAL(info.shmmni, 192, info.shmmni, ERROR_OUT);
|
||||||
ICUNIT_GOTO_EQUAL(info.shmseg, 128, info.shmseg, ERROR_OUT); // 128: expected value of shmseg
|
ICUNIT_GOTO_EQUAL(info.shmseg, 128, info.shmseg, ERROR_OUT);
|
||||||
ICUNIT_GOTO_EQUAL(info.shmall, 0x1000, info.shmall, ERROR_OUT);
|
ICUNIT_GOTO_EQUAL(info.shmall, 0x1000, info.shmall, ERROR_OUT);
|
||||||
|
|
||||||
ret = shmdt(shm);
|
ret = shmdt(shm);
|
||||||
|
|||||||
@@ -63,11 +63,13 @@ static int LiteIpcTest(void)
|
|||||||
/* testing mmap liteipc mem pool with different size and flag */
|
/* testing mmap liteipc mem pool with different size and flag */
|
||||||
retptr = mmap(nullptr, 1024 * 4096, PROT_READ, MAP_PRIVATE, fd, 0);
|
retptr = mmap(nullptr, 1024 * 4096, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||||
ICUNIT_ASSERT_EQUAL(static_cast<int>(static_cast<intptr_t>(retptr)), -1, retptr);
|
ICUNIT_ASSERT_EQUAL(static_cast<int>(static_cast<intptr_t>(retptr)), -1, retptr);
|
||||||
|
//retptr = mmap(nullptr, 0, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||||
|
//ICUNIT_ASSERT_EQUAL((int)(intptr_t)retptr, -1, retptr);
|
||||||
retptr = mmap(nullptr, -1, PROT_READ, MAP_PRIVATE, fd, 0);
|
retptr = mmap(nullptr, -1, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||||
ICUNIT_ASSERT_EQUAL(static_cast<int>(static_cast<intptr_t>(retptr)), -1, retptr);
|
ICUNIT_ASSERT_EQUAL(static_cast<int>(static_cast<intptr_t>(retptr)), -1, retptr);
|
||||||
retptr = mmap(nullptr, 4096, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
|
retptr = mmap(nullptr, 4096, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
|
||||||
ICUNIT_ASSERT_EQUAL(static_cast<int>(static_cast<intptr_t>(retptr)), -1, retptr);
|
ICUNIT_ASSERT_EQUAL(static_cast<int>(static_cast<intptr_t>(retptr)), -1, retptr);
|
||||||
retptr = mmap(nullptr, 4096, PROT_READ, MAP_SHARED, fd, 0); // 4096: length of mapped memory
|
retptr = mmap(nullptr, 4096, PROT_READ, MAP_SHARED, fd, 0);
|
||||||
ICUNIT_ASSERT_EQUAL(static_cast<int>(static_cast<intptr_t>(retptr)), -1, retptr);
|
ICUNIT_ASSERT_EQUAL(static_cast<int>(static_cast<intptr_t>(retptr)), -1, retptr);
|
||||||
|
|
||||||
retptr = mmap(nullptr, 1, PROT_READ, MAP_PRIVATE, fd, 0);
|
retptr = mmap(nullptr, 1, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||||
@@ -79,7 +81,7 @@ static int LiteIpcTest(void)
|
|||||||
char buf[10] = {0};
|
char buf[10] = {0};
|
||||||
ret = read(fd, buf, 10);
|
ret = read(fd, buf, 10);
|
||||||
ICUNIT_ASSERT_EQUAL(ret, -1, ret);
|
ICUNIT_ASSERT_EQUAL(ret, -1, ret);
|
||||||
ret = write(fd, buf, 10); // 10: size of buf
|
ret = write(fd, buf, 10);
|
||||||
ICUNIT_ASSERT_EQUAL(ret, -1, ret);
|
ICUNIT_ASSERT_EQUAL(ret, -1, ret);
|
||||||
|
|
||||||
/* before set cms, testing ioctl cmd */
|
/* before set cms, testing ioctl cmd */
|
||||||
@@ -94,7 +96,7 @@ static int LiteIpcTest(void)
|
|||||||
|
|
||||||
sleep(2);
|
sleep(2);
|
||||||
/* after set cms, testing set cms cmd */
|
/* after set cms, testing set cms cmd */
|
||||||
ret = ioctl(fd, IPC_SET_CMS, 200); // 200: use 200 for set cms cmd testing
|
ret = ioctl(fd, IPC_SET_CMS, 200);
|
||||||
ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret);
|
ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret);
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|||||||
@@ -60,6 +60,17 @@ static int TestCase()
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* sig = SIGTERM;
|
||||||
|
ret = sigaction(sig, (struct sigaction *)1, &oldAct);
|
||||||
|
printf("ret == %d\n", ret);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, -1, ret);
|
||||||
|
ICUNIT_ASSERT_EQUAL(errno, EFAULT, errno);
|
||||||
|
|
||||||
|
ret = sigaction(sig, &sigAct, (struct sigaction *)1);
|
||||||
|
printf("ret === %d\n", ret);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, -1, ret);
|
||||||
|
ICUNIT_ASSERT_EQUAL(errno, EFAULT, errno); */
|
||||||
|
|
||||||
ret = waitpid(fpid, &status, 0);
|
ret = waitpid(fpid, &status, 0);
|
||||||
ICUNIT_ASSERT_EQUAL(ret, fpid, ret);
|
ICUNIT_ASSERT_EQUAL(ret, fpid, ret);
|
||||||
ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status));
|
ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status));
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ static UINT32 testcase(VOID)
|
|||||||
time_t currtime;
|
time_t currtime;
|
||||||
struct tm *timer = {nullptr};
|
struct tm *timer = {nullptr};
|
||||||
char buffer[80];
|
char buffer[80];
|
||||||
|
//locale_t loc = malloc(sizeof(locale_t);
|
||||||
|
|
||||||
time(&currtime);
|
time(&currtime);
|
||||||
timer = localtime(&currtime);
|
timer = localtime(&currtime);
|
||||||
@@ -45,17 +46,17 @@ static UINT32 testcase(VOID)
|
|||||||
printf("getenv MUSL_LOCPATH=%s\n", getenv("MUSL_LOCPATH"));
|
printf("getenv MUSL_LOCPATH=%s\n", getenv("MUSL_LOCPATH"));
|
||||||
|
|
||||||
printf("Locale is: %s\n", setlocale(LC_TIME, "en_US.UTF-8"));
|
printf("Locale is: %s\n", setlocale(LC_TIME, "en_US.UTF-8"));
|
||||||
(void)strftime(buffer, sizeof(buffer), "%c", timer);
|
strftime(buffer, 80, "%c", timer);
|
||||||
printf("Date is: %s\n", buffer);
|
printf("Date is: %s\n", buffer);
|
||||||
ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1);
|
ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1);
|
||||||
|
|
||||||
printf("Locale is: %s\n", setlocale(LC_TIME, "zh_CN.UTF-8"));
|
printf("Locale is: %s\n", setlocale(LC_TIME, "zh_CN.UTF-8"));
|
||||||
(void)strftime(buffer, sizeof(buffer), "%c", timer);
|
strftime(buffer, 80, "%c", timer);
|
||||||
printf("Date is: %s\n", buffer);
|
printf("Date is: %s\n", buffer);
|
||||||
ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1);
|
ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1);
|
||||||
|
|
||||||
printf("Locale is: %s\n", setlocale(LC_TIME, ""));
|
printf("Locale is: %s\n", setlocale(LC_TIME, ""));
|
||||||
(void)strftime(buffer, sizeof(buffer), "%c", timer);
|
strftime(buffer, 80, "%c", timer);
|
||||||
printf("Date is: %s\n", buffer);
|
printf("Date is: %s\n", buffer);
|
||||||
ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1);
|
ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1);
|
||||||
setlocale(LC_ALL, "C");
|
setlocale(LC_ALL, "C");
|
||||||
|
|||||||
@@ -145,6 +145,26 @@ HWTEST_F(MiscTest, ItTestMisc009, TestSize.Level0)
|
|||||||
ItTestMisc009();
|
ItTestMisc009();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* *
|
||||||
|
* @tc.name: IT_TEST_MISC_010
|
||||||
|
* @tc.desc: function for MiscTest
|
||||||
|
* @tc.type: FUNC
|
||||||
|
*/
|
||||||
|
/*HWTEST_F(MiscTest, ItTestMisc010, TestSize.Level0)
|
||||||
|
{
|
||||||
|
ItTestMisc010();
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/* *
|
||||||
|
* @tc.name: IT_TEST_MISC_011
|
||||||
|
* @tc.desc: function for MiscTest
|
||||||
|
* @tc.type: FUNC
|
||||||
|
*/
|
||||||
|
/*HWTEST_F(MiscTest, ItTestMisc011, TestSize.Level0)
|
||||||
|
{
|
||||||
|
ItTestMisc011();
|
||||||
|
}*/
|
||||||
|
|
||||||
/* *
|
/* *
|
||||||
* @tc.name: IT_TEST_MISC_012
|
* @tc.name: IT_TEST_MISC_012
|
||||||
* @tc.desc: function for MiscTest
|
* @tc.desc: function for MiscTest
|
||||||
@@ -154,6 +174,16 @@ HWTEST_F(MiscTest, ItTestMisc012, TestSize.Level0)
|
|||||||
{
|
{
|
||||||
ItTestMisc012();
|
ItTestMisc012();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* *
|
||||||
|
* @tc.name: IT_TEST_MISC_013
|
||||||
|
* @tc.desc: function for MiscTest
|
||||||
|
* @tc.type: FUNC
|
||||||
|
*/
|
||||||
|
/*HWTEST_F(MiscTest, ItTestMisc013, TestSize.Level0)
|
||||||
|
{
|
||||||
|
ItTestMisc013();
|
||||||
|
}*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
#define TEST_HwiTrigger(HWI_NUM_TEST)
|
#define TEST_HwiTrigger(HWI_NUM_TEST)
|
||||||
#define LOS_TaskLock()
|
#define LOS_TaskLock()
|
||||||
#define LOS_TaskUnlock()
|
#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_HIGHEST 0
|
||||||
#define OS_TASK_PRIORITY_LOWEST 31
|
#define OS_TASK_PRIORITY_LOWEST 31
|
||||||
|
|
||||||
@@ -228,7 +228,12 @@ struct testdata {
|
|||||||
};
|
};
|
||||||
extern struct testdata g_td;
|
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 int map_errno(UINT32 err);
|
||||||
|
extern long sysconf(int name);
|
||||||
extern void posix_signal_start(void);
|
extern void posix_signal_start(void);
|
||||||
|
|
||||||
VOID ScenarInit(VOID);
|
VOID ScenarInit(VOID);
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ static void *pthread_f01(void *tmp)
|
|||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
g_testCount++;
|
g_testCount++;
|
||||||
|
// printf("www\n");
|
||||||
|
|
||||||
/* acquire the mutex */
|
/* acquire the mutex */
|
||||||
rc = pthread_mutex_lock(&g_pthreadMutexTest1);
|
rc = pthread_mutex_lock(&g_pthreadMutexTest1);
|
||||||
@@ -68,7 +69,7 @@ static UINT32 Testcase(VOID)
|
|||||||
|
|
||||||
/* Let the other thread run */
|
/* Let the other thread run */
|
||||||
LosTaskDelay(2);
|
LosTaskDelay(2);
|
||||||
ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); // 2: expected value of g_testCount
|
ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount);
|
||||||
|
|
||||||
/* Try to destroy the cond var. This should return an error */
|
/* Try to destroy the cond var. This should return an error */
|
||||||
rc = pthread_cond_destroy(&g_pthreadCondTest1);
|
rc = pthread_cond_destroy(&g_pthreadCondTest1);
|
||||||
@@ -78,7 +79,7 @@ static UINT32 Testcase(VOID)
|
|||||||
ICUNIT_ASSERT_EQUAL(rc, 0, rc);
|
ICUNIT_ASSERT_EQUAL(rc, 0, rc);
|
||||||
|
|
||||||
LosTaskDelay(2);
|
LosTaskDelay(2);
|
||||||
ICUNIT_ASSERT_EQUAL(g_testCount, 4, g_testCount); // 4: expected value of g_testCount
|
ICUNIT_ASSERT_EQUAL(g_testCount, 4, g_testCount);
|
||||||
|
|
||||||
rc = pthread_cond_destroy(&g_pthreadCondTest1);
|
rc = pthread_cond_destroy(&g_pthreadCondTest1);
|
||||||
ICUNIT_ASSERT_EQUAL(rc, 0, rc);
|
ICUNIT_ASSERT_EQUAL(rc, 0, rc);
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ static UINT32 Testcase(VOID)
|
|||||||
|
|
||||||
tmp = pthread_equal(a, b);
|
tmp = pthread_equal(a, b);
|
||||||
|
|
||||||
|
// pthread_join(a, NULL);
|
||||||
|
|
||||||
|
// pthread_detach(a);
|
||||||
|
|
||||||
pthread_attr_init(&aa);
|
pthread_attr_init(&aa);
|
||||||
|
|
||||||
pthread_attr_getdetachstate(&aa, &detachstate);
|
pthread_attr_getdetachstate(&aa, &detachstate);
|
||||||
@@ -59,6 +63,19 @@ static UINT32 Testcase(VOID)
|
|||||||
|
|
||||||
pthread_attr_destroy(&aa);
|
pthread_attr_destroy(&aa);
|
||||||
|
|
||||||
|
// pthread_mutex_init(&c, NULL);
|
||||||
|
|
||||||
|
// pthread_mutex_destroy(&c);
|
||||||
|
|
||||||
|
// pthread_mutex_lock(&c);
|
||||||
|
|
||||||
|
// pthread_mutex_trylock(&c);
|
||||||
|
|
||||||
|
// pthread_mutex_unlock(&c);
|
||||||
|
|
||||||
|
// pthread_mutexattr_init(&c);
|
||||||
|
|
||||||
|
// pthread_mutexattr_destroy(&c);
|
||||||
ret = pthread_join(aThread, NULL);
|
ret = pthread_join(aThread, NULL);
|
||||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ static void *ThreadF01(void *arg)
|
|||||||
|
|
||||||
/* Shouldn't reach here. If we do, then the pthread_cancel()
|
/* Shouldn't reach here. If we do, then the pthread_cancel()
|
||||||
* function did not succeed. */
|
* function did not succeed. */
|
||||||
|
// uart_printf_func("Could not send cancel request correctly\n");
|
||||||
|
// ICUNIT_TRACK_EQUAL(1, 0, errno);
|
||||||
pthread_exit(nullptr);
|
pthread_exit(nullptr);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -60,6 +62,7 @@ static UINT32 Testcase(VOID)
|
|||||||
|
|
||||||
ret = pthread_join(newTh, (void **)&temp);
|
ret = pthread_join(newTh, (void **)&temp);
|
||||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||||
|
// ICUNIT_ASSERT_EQUAL(temp, (UINTPTR)PTHREAD_CANCELED, temp);
|
||||||
return PTHREAD_NO_ERROR;
|
return PTHREAD_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ static void *ThreadF01(void *arg)
|
|||||||
{
|
{
|
||||||
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
|
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
|
||||||
|
|
||||||
|
// while (1)
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
|
||||||
pthread_exit(nullptr);
|
pthread_exit(nullptr);
|
||||||
@@ -47,6 +48,7 @@ static UINT32 Testcase(VOID)
|
|||||||
pthread_t a;
|
pthread_t a;
|
||||||
|
|
||||||
/* SIGALRM will be sent in 5 seconds. */
|
/* SIGALRM will be sent in 5 seconds. */
|
||||||
|
// alarm(5);//alarm NOT SUPPORT
|
||||||
|
|
||||||
/* Create a new thread. */
|
/* Create a new thread. */
|
||||||
if (pthread_create(&a, NULL, ThreadF01, NULL) != 0) {
|
if (pthread_create(&a, NULL, ThreadF01, NULL) != 0) {
|
||||||
@@ -59,6 +61,7 @@ static UINT32 Testcase(VOID)
|
|||||||
/* If 'main' has reached here, then the test passed because it means
|
/* If 'main' has reached here, then the test passed because it means
|
||||||
* that the thread is truly asynchronise, and main isn't waiting for
|
* that the thread is truly asynchronise, and main isn't waiting for
|
||||||
* it to return in order to move on. */
|
* it to return in order to move on. */
|
||||||
|
// printf("Test PASSED\n");
|
||||||
|
|
||||||
ret = pthread_join(a, &temp);
|
ret = pthread_join(a, &temp);
|
||||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
* 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-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
* are permitted provided that the following conditions are met:
|
* are permitted provided that the following conditions are met:
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
#define CLOCK_RES_NSEC 1000
|
#define CLOCK_RES_NSEC 1000
|
||||||
#define CLOCK_COARSE_RES_SEC 0
|
#define CLOCK_COARSE_RES_SEC 0
|
||||||
#define CLOCK_COARSE_RES_NSEC 1000000
|
#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 ClockTestSmoke(void);
|
||||||
void ClockTest001(void);
|
void ClockTest001(void);
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ static int GetHostByAddrTest(void)
|
|||||||
addr = gethostbyaddr(&ia, sizeof ia, AF_INET);
|
addr = gethostbyaddr(&ia, sizeof ia, AF_INET);
|
||||||
ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno);
|
ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno);
|
||||||
|
|
||||||
RecoveryFileEnv(pathList, file_number);
|
RecoveryFileEnv(pathList, file_number);
|
||||||
return ICUNIT_SUCCESS;
|
return ICUNIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -176,5 +176,16 @@ HWTEST_F(NetSocketTest, NetSocketTest012, TestSize.Level0)
|
|||||||
NetSocketTest012();
|
NetSocketTest012();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* *
|
||||||
|
* @tc.name: NetSocketTest013
|
||||||
|
* @tc.desc: function for NetSocketTest
|
||||||
|
* @tc.type: FUNC
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
HWTEST_F(NetSocketTest, NetSocketTest013, TestSize.Level0)
|
||||||
|
{
|
||||||
|
//NetSocketTest013(); // broadcast to self to be supported.
|
||||||
|
}
|
||||||
|
*/
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ def parse_user_pc_ulr(excinfo_file, rootfs_dir, string, addr2line_cmd, objdump_c
|
|||||||
ret = commands.getoutput(cmd)
|
ret = commands.getoutput(cmd)
|
||||||
print(ret)
|
print(ret)
|
||||||
cmd = "%s%s%s %s" % (addr2line_cmd, rootfs_dir, strlist[4], strlist[6])
|
cmd = "%s%s%s %s" % (addr2line_cmd, rootfs_dir, strlist[4], strlist[6])
|
||||||
|
#print(cmd)
|
||||||
ret = commands.getoutput(cmd)
|
ret = commands.getoutput(cmd)
|
||||||
ret = ret.split('\n')
|
ret = ret.split('\n')
|
||||||
print("<%s>%s<%s><%s>\n" % (string, ret[0], strlist[6], strlist[4]))
|
print("<%s>%s<%s><%s>\n" % (string, ret[0], strlist[6], strlist[4]))
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ get_line()
|
|||||||
{
|
{
|
||||||
SYM_ADDR=$(echo $1 | awk '{print $2}')
|
SYM_ADDR=$(echo $1 | awk '{print $2}')
|
||||||
ELF_OFFSET=$(echo ${SYM_ADDR} | cut -d '[' -f2 | cut -d ']' -f1)
|
ELF_OFFSET=$(echo ${SYM_ADDR} | cut -d '[' -f2 | cut -d ']' -f1)
|
||||||
FILE_LINE=$(${ADDR2LINE} -f -e $2 ${ELF_OFFSET} | awk 'NR==2')
|
FILE_LINE=$(${ADDR2LINE} -f -e $2 ${ELF_OFFSET} | awk 'NR==2'`)
|
||||||
if [[ "${FILE_LINE}" == *"?"* ]]; then
|
if [[ "${FILE_LINE}" == *"?"* ]]; then
|
||||||
typeset ELF_OFFSET=$((ELF_OFFSET+LOAD_BASE))
|
typeset ELF_OFFSET=$((ELF_OFFSET+LOAD_BASE))
|
||||||
ELF_OFFSET=$(echo "obase=16;${ELF_OFFSET}" | bc)
|
ELF_OFFSET=$(echo "obase=16;${ELF_OFFSET}" | bc)
|
||||||
|
|||||||
Reference in New Issue
Block a user