Compare commits
10 Commits
weekly_202
...
OpenHarmon
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2bef65046a | ||
|
|
205df75f15 | ||
|
|
85f1c9e0ca | ||
|
|
c04ff6b10f | ||
|
|
1b61489512 | ||
|
|
29c459e045 | ||
|
|
e7daa28200 | ||
|
|
987a722d2d | ||
|
|
ccdfa72431 | ||
|
|
8c0b7d0f38 |
@@ -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(), ¶m);
|
||||
if (ret != SH_OK) {
|
||||
goto OUT;
|
||||
return ret;
|
||||
}
|
||||
|
||||
param.sched_priority = SHELL_PROCESS_PRIORITY_INIT;
|
||||
|
||||
ret = sched_setparam(getpid(), ¶m);
|
||||
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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -356,7 +356,7 @@ int print_netif(struct netif *netif, char *print_buf, unsigned int buf_len)
|
||||
buf_len -= (unsigned int)ret;
|
||||
}
|
||||
|
||||
ret = snprintf_s(tmp, buf_len, (buf_len - 1), " %s\n",
|
||||
ret = snprintf_s(tmp, buf_len, (buf_len - 1), " %s\n",
|
||||
(netif->flags & NETIF_FLAG_LINK_UP) ? "Link UP" : "Link Down");
|
||||
if ((ret <= 0) || ((unsigned int)ret >= buf_len))
|
||||
goto out;
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ int SysSetiTimer(int which, const struct itimerval *value, struct itimerval *ova
|
||||
{
|
||||
int ret;
|
||||
struct itimerval svalue;
|
||||
struct itimerval sovalue;
|
||||
struct itimerval sovalue = { 0 };
|
||||
|
||||
if (value == NULL) {
|
||||
errno = EINVAL;
|
||||
@@ -137,7 +137,7 @@ int SysSetiTimer(int which, const struct itimerval *value, struct itimerval *ova
|
||||
int SysGetiTimer(int which, struct itimerval *value)
|
||||
{
|
||||
int ret;
|
||||
struct itimerval svalue;
|
||||
struct itimerval svalue = { 0 };
|
||||
|
||||
if (value == NULL) {
|
||||
errno = EINVAL;
|
||||
@@ -189,7 +189,7 @@ int SysTimerCreate(clockid_t clockID, struct ksigevent *evp, timer_t *timerID)
|
||||
int SysTimerGettime(timer_t timerID, struct itimerspec *value)
|
||||
{
|
||||
int ret;
|
||||
struct itimerspec svalue;
|
||||
struct itimerspec svalue = { 0 };
|
||||
|
||||
if (value == NULL) {
|
||||
errno = EINVAL;
|
||||
@@ -213,7 +213,7 @@ int SysTimerSettime(timer_t timerID, int flags, const struct itimerspec *value,
|
||||
{
|
||||
int ret;
|
||||
struct itimerspec svalue;
|
||||
struct itimerspec soldValue;
|
||||
struct itimerspec soldValue = { 0 };
|
||||
|
||||
if (value == NULL) {
|
||||
errno = EINVAL;
|
||||
@@ -285,7 +285,7 @@ int SysClockSettime(clockid_t clockID, const struct timespec *tp)
|
||||
int SysClockGettime(clockid_t clockID, struct timespec *tp)
|
||||
{
|
||||
int ret;
|
||||
struct timespec stp;
|
||||
struct timespec stp = { 0 };
|
||||
|
||||
if (tp == NULL) {
|
||||
errno = EINVAL;
|
||||
@@ -308,7 +308,7 @@ int SysClockGettime(clockid_t clockID, struct timespec *tp)
|
||||
int SysClockGetres(clockid_t clockID, struct timespec *tp)
|
||||
{
|
||||
int ret;
|
||||
struct timespec stp;
|
||||
struct timespec stp = { 0 };
|
||||
|
||||
if (tp == NULL) {
|
||||
errno = EINVAL;
|
||||
@@ -356,7 +356,7 @@ int SysNanoSleep(const struct timespec *rqtp, struct timespec *rmtp)
|
||||
{
|
||||
int ret;
|
||||
struct timespec srqtp;
|
||||
struct timespec srmtp;
|
||||
struct timespec srmtp = { 0 };
|
||||
|
||||
if (!rqtp || LOS_ArchCopyFromUser(&srqtp, rqtp, sizeof(struct timespec))) {
|
||||
errno = EFAULT;
|
||||
@@ -384,7 +384,7 @@ int SysNanoSleep(const struct timespec *rqtp, struct timespec *rmtp)
|
||||
clock_t SysTimes(struct tms *buf)
|
||||
{
|
||||
clock_t ret;
|
||||
struct tms sbuf;
|
||||
struct tms sbuf = { 0 };
|
||||
|
||||
if (buf == NULL) {
|
||||
errno = EFAULT;
|
||||
@@ -436,7 +436,7 @@ int SysClockGettime64(clockid_t clockID, struct timespec64 *tp)
|
||||
{
|
||||
int ret;
|
||||
struct timespec t;
|
||||
struct timespec64 stp;
|
||||
struct timespec64 stp = { 0 };
|
||||
|
||||
if (tp == NULL) {
|
||||
errno = EINVAL;
|
||||
@@ -463,7 +463,7 @@ int SysClockGetres64(clockid_t clockID, struct timespec64 *tp)
|
||||
{
|
||||
int ret;
|
||||
struct timespec t;
|
||||
struct timespec64 stp;
|
||||
struct timespec64 stp = { 0 };
|
||||
|
||||
if (tp == NULL) {
|
||||
errno = EINVAL;
|
||||
@@ -525,7 +525,7 @@ int SysTimerGettime64(timer_t timerID, struct itimerspec64 *value)
|
||||
{
|
||||
int ret;
|
||||
struct itimerspec val;
|
||||
struct itimerspec64 svalue;
|
||||
struct itimerspec64 svalue = { 0 };
|
||||
|
||||
if (value == NULL) {
|
||||
errno = EINVAL;
|
||||
@@ -584,6 +584,7 @@ int SysTimerSettime64(timer_t timerID, int flags, const struct itimerspec64 *val
|
||||
}
|
||||
|
||||
if (oldValue != NULL) {
|
||||
(void)memset_s(&soldValue, sizeof(struct itimerspec64), 0, sizeof(struct itimerspec64));
|
||||
soldValue.it_interval.tv_sec = oldVal.it_interval.tv_sec;
|
||||
soldValue.it_interval.tv_nsec = oldVal.it_interval.tv_nsec;
|
||||
soldValue.it_value.tv_sec = oldVal.it_value.tv_sec;
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user