commit
f34762c105
|
@ -180,7 +180,8 @@ static void LmsStrcpyTest(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
char *testStr = "bbbbbbbbbbbbbbbbb";
|
char *testStr = "bbbbbbbbbbbbbbbbb";
|
||||||
printf("[LmsStrcpyTest] strcpy overflow error should be triggered, src string buf size:%d\n", strlen(testStr) + 1);
|
printf("[LmsStrcpyTest] strcpy overflow error should be triggered, src string buf size:%d\n",
|
||||||
|
(int)strlen(testStr) + 1);
|
||||||
strcpy(buf, testStr);
|
strcpy(buf, testStr);
|
||||||
free(buf);
|
free(buf);
|
||||||
printf("\n-------- LmsStrcpyTest End --------\n");
|
printf("\n-------- LmsStrcpyTest End --------\n");
|
||||||
|
|
|
@ -62,7 +62,7 @@ int main(int argc, char **argv)
|
||||||
PerfStop(fd);
|
PerfStop(fd);
|
||||||
} else if ((argc == THREE_ARGS) && strcmp(argv[1], "read") == 0) {
|
} else if ((argc == THREE_ARGS) && strcmp(argv[1], "read") == 0) {
|
||||||
size_t size = strtoul(argv[THREE_ARGS - 1], NULL, 0);
|
size_t size = strtoul(argv[THREE_ARGS - 1], NULL, 0);
|
||||||
if (size <= 0) {
|
if (size == 0) {
|
||||||
goto EXIT:
|
goto EXIT:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1437,10 +1437,8 @@ u32_t lwip_tftp_get_file_by_filename_to_rawmem(u32_t ulHostAddr,
|
||||||
{
|
{
|
||||||
s32_t iSockNum = TFTP_NULL_INT32;
|
s32_t iSockNum = TFTP_NULL_INT32;
|
||||||
u32_t ulSrcStrLen;
|
u32_t ulSrcStrLen;
|
||||||
u32_t lDestStrLen;
|
|
||||||
u32_t ulSize;
|
u32_t ulSize;
|
||||||
u32_t ulRecvSize = TFTP_NULL_UINT32;
|
u32_t ulRecvSize = TFTP_NULL_UINT32;
|
||||||
s32_t iErrCode;
|
|
||||||
u32_t ulErrCode;
|
u32_t ulErrCode;
|
||||||
u16_t usReadReq;
|
u16_t usReadReq;
|
||||||
u16_t usTempServPort;
|
u16_t usTempServPort;
|
||||||
|
|
|
@ -70,7 +70,7 @@ static void TraceRead(int fd, size_t size)
|
||||||
{
|
{
|
||||||
ssize_t i;
|
ssize_t i;
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
if (size <= 0) {
|
if (size == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1409,7 +1409,7 @@ DWORD fattime_format(time_t time)
|
||||||
ftime |= ((DWORD)((st.tm_year > YEAR_OFFSET) ? (st.tm_year - YEAR_OFFSET) : 0)) << FTIME_YEAR_OFFSET;
|
ftime |= ((DWORD)((st.tm_year > YEAR_OFFSET) ? (st.tm_year - YEAR_OFFSET) : 0)) << FTIME_YEAR_OFFSET;
|
||||||
ftime <<= FTIME_DATE_OFFSET;
|
ftime <<= FTIME_DATE_OFFSET;
|
||||||
|
|
||||||
ftime = (DWORD)st.tm_sec / SEC_MULTIPLIER;
|
ftime |= (DWORD)st.tm_sec / SEC_MULTIPLIER;
|
||||||
ftime |= ((DWORD)st.tm_min) << FTIME_MIN_OFFSET;
|
ftime |= ((DWORD)st.tm_min) << FTIME_MIN_OFFSET;
|
||||||
ftime |= ((DWORD)st.tm_hour) << FTIME_HR_OFFSET;
|
ftime |= ((DWORD)st.tm_hour) << FTIME_HR_OFFSET;
|
||||||
|
|
||||||
|
@ -2167,7 +2167,7 @@ int fatfs_symlink(struct Vnode *parentVnode, struct Vnode **newVnode, const char
|
||||||
ssize_t fatfs_readlink(struct Vnode *vnode, char *buffer, size_t bufLen)
|
ssize_t fatfs_readlink(struct Vnode *vnode, char *buffer, size_t bufLen)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
FRESULT res = FR_OK;
|
FRESULT res;
|
||||||
DWORD clust;
|
DWORD clust;
|
||||||
QWORD sect;
|
QWORD sect;
|
||||||
DIR_FILE *dfp = (DIR_FILE *)(vnode->data);
|
DIR_FILE *dfp = (DIR_FILE *)(vnode->data);
|
||||||
|
|
|
@ -583,9 +583,6 @@ static OsBcacheBlock *AllocNewBlock(OsBcache *bc, BOOL read, UINT64 num)
|
||||||
|
|
||||||
if (prefer->used) {
|
if (prefer->used) {
|
||||||
MergeSyncBlocks(bc, prefer);
|
MergeSyncBlocks(bc, prefer);
|
||||||
}
|
|
||||||
|
|
||||||
if (prefer->used) {
|
|
||||||
BcacheSyncBlock(bc, prefer);
|
BcacheSyncBlock(bc, prefer);
|
||||||
DelBlock(bc, prefer);
|
DelBlock(bc, prefer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,7 @@ typedef int VfsHashCmp(struct Vnode *vnode, void *arg);
|
||||||
|
|
||||||
int VnodesInit(void);
|
int VnodesInit(void);
|
||||||
int VnodeDevInit(void);
|
int VnodeDevInit(void);
|
||||||
int VnodeAlloc(struct VnodeOps *vop, struct Vnode **vnode);
|
int VnodeAlloc(struct VnodeOps *vop, struct Vnode **newVnode);
|
||||||
int VnodeFree(struct Vnode *vnode);
|
int VnodeFree(struct Vnode *vnode);
|
||||||
int VnodeLookup(const char *path, struct Vnode **vnode, uint32_t flags);
|
int VnodeLookup(const char *path, struct Vnode **vnode, uint32_t flags);
|
||||||
int VnodeLookupFullpath(const char *fullpath, struct Vnode **vnode, uint32_t flags);
|
int VnodeLookupFullpath(const char *fullpath, struct Vnode **vnode, uint32_t flags);
|
||||||
|
|
|
@ -761,11 +761,6 @@ static int os_shell_cmd_do_rmdir(const char *pathname)
|
||||||
}
|
}
|
||||||
if (strcmp(dirent->d_name, "..") && strcmp(dirent->d_name, ".")) {
|
if (strcmp(dirent->d_name, "..") && strcmp(dirent->d_name, ".")) {
|
||||||
size_t fullpath_buf_size = strlen(pathname) + strlen(dirent->d_name) + SEPARATOR_EOF_LEN;
|
size_t fullpath_buf_size = strlen(pathname) + strlen(dirent->d_name) + SEPARATOR_EOF_LEN;
|
||||||
if (fullpath_buf_size <= 0) {
|
|
||||||
PRINTK("buffer size is invalid!\n");
|
|
||||||
(void)closedir(d);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
fullpath = (char *)malloc(fullpath_buf_size);
|
fullpath = (char *)malloc(fullpath_buf_size);
|
||||||
if (fullpath == NULL) {
|
if (fullpath == NULL) {
|
||||||
PRINTK("malloc failure!\n");
|
PRINTK("malloc failure!\n");
|
||||||
|
|
|
@ -260,7 +260,7 @@ int VnodeDrop(void)
|
||||||
static char *NextName(char *pos, uint8_t *len)
|
static char *NextName(char *pos, uint8_t *len)
|
||||||
{
|
{
|
||||||
char *name = NULL;
|
char *name = NULL;
|
||||||
while (*pos != 0 && *pos == '/') {
|
while (*pos == '/') {
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
if (*pos == '\0') {
|
if (*pos == '\0') {
|
||||||
|
|
|
@ -271,7 +271,7 @@ VOID OsLockDepCheckOut(SPIN_LOCK_S *lock)
|
||||||
{
|
{
|
||||||
UINT32 intSave;
|
UINT32 intSave;
|
||||||
INT32 depth;
|
INT32 depth;
|
||||||
enum LockDepErrType checkResult = LOCKDEP_SUCCESS;
|
enum LockDepErrType checkResult;
|
||||||
VOID *requestAddr = (VOID *)__builtin_return_address(1);
|
VOID *requestAddr = (VOID *)__builtin_return_address(1);
|
||||||
LosTaskCB *current = OsCurrTaskGet();
|
LosTaskCB *current = OsCurrTaskGet();
|
||||||
LosTaskCB *owner = NULL;
|
LosTaskCB *owner = NULL;
|
||||||
|
|
|
@ -208,15 +208,12 @@ UINT32 OsUProcessPmUsage(LosVmSpace *space, UINT32 *sharePm, UINT32 *actualPm)
|
||||||
PADDR_T paddr;
|
PADDR_T paddr;
|
||||||
STATUS_T ret;
|
STATUS_T ret;
|
||||||
INT32 shareRef;
|
INT32 shareRef;
|
||||||
|
UINT32 pmSize = 0;
|
||||||
|
|
||||||
if (sharePm != NULL) {
|
if (sharePm != NULL) {
|
||||||
*sharePm = 0;
|
*sharePm = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (actualPm != NULL) {
|
|
||||||
*actualPm = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = LOS_MuxAcquire(&space->regionMux);
|
ret = LOS_MuxAcquire(&space->regionMux);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -240,19 +237,20 @@ UINT32 OsUProcessPmUsage(LosVmSpace *space, UINT32 *sharePm, UINT32 *actualPm)
|
||||||
if (sharePm != NULL) {
|
if (sharePm != NULL) {
|
||||||
*sharePm += PAGE_SIZE;
|
*sharePm += PAGE_SIZE;
|
||||||
}
|
}
|
||||||
if (actualPm != NULL) {
|
pmSize += PAGE_SIZE / shareRef;
|
||||||
*actualPm += PAGE_SIZE / shareRef;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (actualPm != NULL) {
|
pmSize += PAGE_SIZE;
|
||||||
*actualPm += PAGE_SIZE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RB_SCAN_SAFE_END(&oldVmSpace->regionRbTree, pstRbNode, pstRbNodeNext)
|
RB_SCAN_SAFE_END(&oldVmSpace->regionRbTree, pstRbNode, pstRbNodeNext)
|
||||||
|
|
||||||
(VOID)LOS_MuxRelease(&space->regionMux);
|
(VOID)LOS_MuxRelease(&space->regionMux);
|
||||||
return *actualPm;
|
|
||||||
|
if (actualPm != NULL) {
|
||||||
|
*actualPm = pmSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pmSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
LosProcessCB *OsGetPIDByAspace(LosVmSpace *space)
|
LosProcessCB *OsGetPIDByAspace(LosVmSpace *space)
|
||||||
|
@ -305,7 +303,7 @@ UINT32 OsCountRegionPages(LosVmSpace *space, LosVmMapRegion *region, UINT32 *pss
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pssPages != NULL) {
|
if (pssPages != NULL) {
|
||||||
*pssPages = (UINT32)(pss + 0.5);
|
*pssPages = (UINT32)(pss + 0.5); /* 0.5, for page alignment */
|
||||||
}
|
}
|
||||||
|
|
||||||
return regionPages;
|
return regionPages;
|
||||||
|
|
|
@ -297,7 +297,7 @@ int OsTryShrinkMemory(size_t nPage)
|
||||||
LosFilePage *fpage = NULL;
|
LosFilePage *fpage = NULL;
|
||||||
LosFilePage *fnext = NULL;
|
LosFilePage *fnext = NULL;
|
||||||
|
|
||||||
if (nPage <= 0) {
|
if (nPage == 0) {
|
||||||
nPage = VM_FILEMAP_MIN_SCAN;
|
nPage = VM_FILEMAP_MIN_SCAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ MMAP_DONE:
|
||||||
|
|
||||||
STATUS_T LOS_UnMMap(VADDR_T addr, size_t size)
|
STATUS_T LOS_UnMMap(VADDR_T addr, size_t size)
|
||||||
{
|
{
|
||||||
if ((addr <= 0) || (size <= 0)) {
|
if ((addr <= 0) || (size == 0)) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -709,7 +709,6 @@ STATIC ssize_t DoWrite(CirBufSendCB *cirBufSendCB, CHAR *buffer, size_t bufLen)
|
||||||
{
|
{
|
||||||
INT32 cnt;
|
INT32 cnt;
|
||||||
size_t written = 0;
|
size_t written = 0;
|
||||||
size_t toWrite = bufLen;
|
|
||||||
UINT32 intSave;
|
UINT32 intSave;
|
||||||
|
|
||||||
#ifdef LOSCFG_SHELL_DMESG
|
#ifdef LOSCFG_SHELL_DMESG
|
||||||
|
@ -730,7 +729,6 @@ STATIC ssize_t DoWrite(CirBufSendCB *cirBufSendCB, CHAR *buffer, size_t bufLen)
|
||||||
if (cnt <= 0) {
|
if (cnt <= 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
toWrite -= cnt;
|
|
||||||
written += cnt;
|
written += cnt;
|
||||||
}
|
}
|
||||||
LOS_SpinUnlockRestore(&g_consoleWriteSpinLock, intSave);
|
LOS_SpinUnlockRestore(&g_consoleWriteSpinLock, intSave);
|
||||||
|
@ -1536,7 +1534,15 @@ STATIC ssize_t WriteToTerminal(const CONSOLE_CB *consoleCB, const CHAR *buffer,
|
||||||
|
|
||||||
fd = consoleCB->fd;
|
fd = consoleCB->fd;
|
||||||
ret = fs_getfilep(fd, &filep);
|
ret = fs_getfilep(fd, &filep);
|
||||||
|
if (ret < 0) {
|
||||||
|
ret = -EPERM;
|
||||||
|
goto ERROUT;
|
||||||
|
}
|
||||||
ret = GetFilepOps(filep, &privFilep, &fileOps);
|
ret = GetFilepOps(filep, &privFilep, &fileOps);
|
||||||
|
if (ret != ENOERR) {
|
||||||
|
ret = -EINVAL;
|
||||||
|
goto ERROUT;
|
||||||
|
}
|
||||||
|
|
||||||
if ((fileOps == NULL) || (fileOps->write == NULL)) {
|
if ((fileOps == NULL) || (fileOps->write == NULL)) {
|
||||||
ret = EFAULT;
|
ret = EFAULT;
|
||||||
|
|
|
@ -87,7 +87,6 @@ STATIC VOID InitLevelCall(const CHAR *name, const UINT32 level, struct ModuleIni
|
||||||
LOS_SpinUnlock(&g_initLock);
|
LOS_SpinUnlock(&g_initLock);
|
||||||
if (module->hook != NULL) {
|
if (module->hook != NULL) {
|
||||||
#ifdef LOS_INIT_DEBUG
|
#ifdef LOS_INIT_DEBUG
|
||||||
ret = LOS_OK;
|
|
||||||
startNsec = LOS_CurrNanosec();
|
startNsec = LOS_CurrNanosec();
|
||||||
ret = (UINT32)module->hook();
|
ret = (UINT32)module->hook();
|
||||||
endNsec = LOS_CurrNanosec();
|
endNsec = LOS_CurrNanosec();
|
||||||
|
|
|
@ -51,7 +51,7 @@ STATIC BOOL g_srandInit;
|
||||||
|
|
||||||
STATIC INT32 OsELFOpen(const CHAR *fileName, INT32 oflags)
|
STATIC INT32 OsELFOpen(const CHAR *fileName, INT32 oflags)
|
||||||
{
|
{
|
||||||
INT32 ret = -LOS_NOK;
|
INT32 ret;
|
||||||
INT32 procFd;
|
INT32 procFd;
|
||||||
|
|
||||||
procFd = AllocProcessFd();
|
procFd = AllocProcessFd();
|
||||||
|
|
|
@ -124,8 +124,8 @@ ATTRIBUTE_NO_SANITIZE_ADDRESS void LmsSetShadowValue(uintptr_t startAddr, uintpt
|
||||||
uint32_t startOffset;
|
uint32_t startOffset;
|
||||||
uint32_t endOffset;
|
uint32_t endOffset;
|
||||||
|
|
||||||
char shadowValueMask;
|
unsigned char shadowValueMask;
|
||||||
char shadowValue;
|
unsigned char shadowValue;
|
||||||
|
|
||||||
/* endAddr - 1, then we mark [startAddr, endAddr) to value */
|
/* endAddr - 1, then we mark [startAddr, endAddr) to value */
|
||||||
LmsMem2Shadow(startAddr, &shadowStart, &startOffset);
|
LmsMem2Shadow(startAddr, &shadowStart, &startOffset);
|
||||||
|
@ -266,7 +266,7 @@ ATTRIBUTE_NO_SANITIZE_ADDRESS void LmsPrintMemInfo(uintptr_t addr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LMS_OUTPUT_INFO("|\t[0x%x | %2d]: ", shadowAddr, shadowOffset);
|
LMS_OUTPUT_INFO("|\t[0x%x | %2u]: ", shadowAddr, shadowOffset);
|
||||||
|
|
||||||
for (int x = 0; x < printX; x += LMS_MEM_BYTES_PER_SHADOW_CELL) {
|
for (int x = 0; x < printX; x += LMS_MEM_BYTES_PER_SHADOW_CELL) {
|
||||||
LmsGetShadowValue(dumpAddr + x, &shadowValue);
|
LmsGetShadowValue(dumpAddr + x, &shadowValue);
|
||||||
|
@ -339,7 +339,7 @@ ATTRIBUTE_NO_SANITIZE_ADDRESS static void LmsPrintErrInfo(LmsAddrInfo *info, uin
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LMS_OUTPUT_INFO("Shadow memory address: [0x%x : %d] Shadow memory value: [%d] \n", info->shadowAddr,
|
LMS_OUTPUT_INFO("Shadow memory address: [0x%x : %u] Shadow memory value: [%u] \n", info->shadowAddr,
|
||||||
info->shadowOffset, info->shadowValue);
|
info->shadowOffset, info->shadowValue);
|
||||||
|
|
||||||
LMS_OUTPUT_INFO("\n");
|
LMS_OUTPUT_INFO("\n");
|
||||||
|
|
|
@ -342,7 +342,7 @@ int print_netif(struct netif *netif, char *print_buf, unsigned int buf_len)
|
||||||
buf_len -= (unsigned int)ret;
|
buf_len -= (unsigned int)ret;
|
||||||
|
|
||||||
ret = snprintf_s(tmp, buf_len, (buf_len - 1), " MTU:%d %s", netif->mtu,
|
ret = snprintf_s(tmp, buf_len, (buf_len - 1), " MTU:%d %s", netif->mtu,
|
||||||
netif->flags & NETIF_FLAG_UP ? "Running" : "Stop");
|
(netif->flags & NETIF_FLAG_UP) ? "Running" : "Stop");
|
||||||
if ((ret <= 0) || ((unsigned int)ret >= buf_len))
|
if ((ret <= 0) || ((unsigned int)ret >= buf_len))
|
||||||
goto out;
|
goto out;
|
||||||
tmp += ret;
|
tmp += ret;
|
||||||
|
@ -356,7 +356,8 @@ int print_netif(struct netif *netif, char *print_buf, unsigned int buf_len)
|
||||||
buf_len -= (unsigned int)ret;
|
buf_len -= (unsigned int)ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = snprintf_s(tmp, buf_len, (buf_len - 1), " %s\n", netif->flags & NETIF_FLAG_LINK_UP ? "Link UP" : "Link Down");
|
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))
|
if ((ret <= 0) || ((unsigned int)ret >= buf_len))
|
||||||
goto out;
|
goto out;
|
||||||
tmp += ret;
|
tmp += ret;
|
||||||
|
@ -3019,8 +3020,8 @@ int netstat_netconn_sendq(struct netconn *conn)
|
||||||
#if PF_PKT_SUPPORT
|
#if PF_PKT_SUPPORT
|
||||||
case NETCONN_PKT_RAW:
|
case NETCONN_PKT_RAW:
|
||||||
retVal = 0; /* always be 0 as frame send to driver directly */
|
retVal = 0; /* always be 0 as frame send to driver directly */
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case NETCONN_UDP:
|
case NETCONN_UDP:
|
||||||
retVal = netstat_udp_sendq(conn->pcb.udp);
|
retVal = netstat_udp_sendq(conn->pcb.udp);
|
||||||
break;
|
break;
|
||||||
|
@ -3797,8 +3798,9 @@ u32_t osShellIpDebug(int argc, const char **argv)
|
||||||
PRINTK("%-50s ", acIPv6Addr);
|
PRINTK("%-50s ", acIPv6Addr);
|
||||||
|
|
||||||
if (snprintf_s(aclladdr, sizeof(aclladdr), sizeof(aclladdr) - 1, "%02X:%02X:%02X:%02X:%02X:%02X",
|
if (snprintf_s(aclladdr, sizeof(aclladdr), sizeof(aclladdr) - 1, "%02X:%02X:%02X:%02X:%02X:%02X",
|
||||||
neighbor_cache[i].lladdr[0], neighbor_cache[i].lladdr[1], neighbor_cache[i].lladdr[2],
|
neighbor_cache[i].lladdr[0], neighbor_cache[i].lladdr[1], /* 0, 1, member number */
|
||||||
neighbor_cache[i].lladdr[3], neighbor_cache[i].lladdr[4], neighbor_cache[i].lladdr[5]) < 0) {
|
neighbor_cache[i].lladdr[2], neighbor_cache[i].lladdr[3], /* 2, 3, member number */
|
||||||
|
neighbor_cache[i].lladdr[4], neighbor_cache[i].lladdr[5]) < 0) { /* 4, 5, member number */
|
||||||
return LOS_NOK;
|
return LOS_NOK;
|
||||||
}
|
}
|
||||||
PRINTK("%-25s ", aclladdr);
|
PRINTK("%-25s ", aclladdr);
|
||||||
|
|
|
@ -160,7 +160,7 @@ static VOID ReleaseVid(UINT16 vid)
|
||||||
a = vid >> INT_BIT_SHIFT;
|
a = vid >> INT_BIT_SHIFT;
|
||||||
b = vid & (INT_BIT_COUNT - 1);
|
b = vid & (INT_BIT_COUNT - 1);
|
||||||
|
|
||||||
idMap->bitMap[a] &= ~(1 << b);
|
idMap->bitMap[a] &= ~(1U << b);
|
||||||
|
|
||||||
/* shrink bit map */
|
/* shrink bit map */
|
||||||
if (mapMaxNum > 1) {
|
if (mapMaxNum > 1) {
|
||||||
|
|
|
@ -34,9 +34,9 @@
|
||||||
#include "los_typedef.h"
|
#include "los_typedef.h"
|
||||||
#include "los_process_pri.h"
|
#include "los_process_pri.h"
|
||||||
|
|
||||||
#define INT_BIT_COUNT 32
|
#define INT_BIT_COUNT 32U
|
||||||
#define INT_BIT_SHIFT 5
|
#define INT_BIT_SHIFT 5U
|
||||||
#define VID_MAP_MAX_NUM 32
|
#define VID_MAP_MAX_NUM 32U
|
||||||
|
|
||||||
#define MAX_INVALID_TIMER_VID (VID_MAP_MAX_NUM * INT_BIT_COUNT)
|
#define MAX_INVALID_TIMER_VID (VID_MAP_MAX_NUM * INT_BIT_COUNT)
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,7 @@ INT32 CmdLog(INT32 argc, const CHAR **argv)
|
||||||
}
|
}
|
||||||
} else if (!strncmp(argv[0], "module", strlen(argv[0]) + 1)) {
|
} else if (!strncmp(argv[0], "module", strlen(argv[0]) + 1)) {
|
||||||
module = strtoul(argv[1], &p, 0);
|
module = strtoul(argv[1], &p, 0);
|
||||||
if ((*p != 0) || (module > MODULE4) || (module < MODULE0)) {
|
if ((*p != 0) || (module > MODULE4) || (module == MODULE0)) {
|
||||||
PRINTK("log %s can't access %s\n", argv[0], argv[1]);
|
PRINTK("log %s can't access %s\n", argv[0], argv[1]);
|
||||||
PRINTK("not support yet\n");
|
PRINTK("not support yet\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -329,7 +329,7 @@ END:
|
||||||
LITE_OS_SEC_TEXT_MINOR UINT32 ShellEntry(UINTPTR param)
|
LITE_OS_SEC_TEXT_MINOR UINT32 ShellEntry(UINTPTR param)
|
||||||
{
|
{
|
||||||
CHAR ch;
|
CHAR ch;
|
||||||
INT32 n = 0;
|
INT32 n;
|
||||||
ShellCB *shellCB = (ShellCB *)param;
|
ShellCB *shellCB = (ShellCB *)param;
|
||||||
|
|
||||||
CONSOLE_CB *consoleCB = OsGetConsoleByID((INT32)shellCB->consoleID);
|
CONSOLE_CB *consoleCB = OsGetConsoleByID((INT32)shellCB->consoleID);
|
||||||
|
|
|
@ -425,7 +425,7 @@ STATIC VOID OsBufFullWrite(const CHAR *dst, UINT32 logLen)
|
||||||
|
|
||||||
STATIC VOID OsWriteTailToHead(const CHAR *dst, UINT32 logLen)
|
STATIC VOID OsWriteTailToHead(const CHAR *dst, UINT32 logLen)
|
||||||
{
|
{
|
||||||
UINT32 writeLen = 0;
|
UINT32 writeLen;
|
||||||
UINT32 bufSize = g_logBufSize;
|
UINT32 bufSize = g_logBufSize;
|
||||||
UINT32 logSize = g_dmesgInfo->logSize;
|
UINT32 logSize = g_dmesgInfo->logSize;
|
||||||
UINT32 tail = g_dmesgInfo->logTail;
|
UINT32 tail = g_dmesgInfo->logTail;
|
||||||
|
|
|
@ -83,6 +83,10 @@ int GetFullpath(int fd, const char *path, char **fullpath)
|
||||||
fd = GetAssociatedSystemFd(fd);
|
fd = GetAssociatedSystemFd(fd);
|
||||||
}
|
}
|
||||||
ret = fs_getfilep(fd, &file);
|
ret = fs_getfilep(fd, &file);
|
||||||
|
if (ret < 0) {
|
||||||
|
ret = -EPERM;
|
||||||
|
goto OUT;
|
||||||
|
}
|
||||||
if (file) {
|
if (file) {
|
||||||
ret = stat(file->f_path, &bufRet);
|
ret = stat(file->f_path, &bufRet);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
|
|
|
@ -39,8 +39,9 @@ extern "C" {
|
||||||
|
|
||||||
static UINT32 TaskF02(VOID)
|
static UINT32 TaskF02(VOID)
|
||||||
{
|
{
|
||||||
UINT32 ret, cpupUse;
|
UINT32 ret = OS_ERROR, 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.
|
||||||
ICUNIT_GOTO_EQUAL(g_cpupTestCount, 2, g_cpupTestCount, EXIT);
|
ICUNIT_GOTO_EQUAL(g_cpupTestCount, 2, g_cpupTestCount, EXIT);
|
||||||
cpupUse = LOS_HistoryProcessCpuUsage(g_testTaskID01, CPUP_ALL_TIME);
|
cpupUse = LOS_HistoryProcessCpuUsage(g_testTaskID01, CPUP_ALL_TIME);
|
||||||
|
|
|
@ -39,9 +39,10 @@ extern "C" {
|
||||||
|
|
||||||
static UINT32 TaskF01(VOID)
|
static UINT32 TaskF01(VOID)
|
||||||
{
|
{
|
||||||
UINT32 ret;
|
UINT32 ret = OS_ERROR;
|
||||||
UINT32 cpupUse;
|
UINT32 cpupUse;
|
||||||
g_cpupTestCount++;
|
g_cpupTestCount++;
|
||||||
|
|
||||||
ICUNIT_GOTO_EQUAL(g_cpupTestCount, 1, g_cpupTestCount, EXIT);
|
ICUNIT_GOTO_EQUAL(g_cpupTestCount, 1, g_cpupTestCount, EXIT);
|
||||||
|
|
||||||
cpupUse = LOS_HistoryProcessCpuUsage(LOS_GetCurrProcessID(), CPU_USE_MODE0);
|
cpupUse = LOS_HistoryProcessCpuUsage(LOS_GetCurrProcessID(), CPU_USE_MODE0);
|
||||||
|
|
|
@ -33,12 +33,10 @@
|
||||||
static int TestCase(void)
|
static int TestCase(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int *test = NULL;
|
|
||||||
int status = 0;
|
int status = 0;
|
||||||
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;
|
|
||||||
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;
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,19 +35,15 @@
|
||||||
|
|
||||||
static int TestThread(void)
|
static int TestThread(void)
|
||||||
{
|
{
|
||||||
int *test = nullptr;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
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;
|
|
||||||
while (1) {
|
while (1) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*test = 0x1;
|
|
||||||
|
|
||||||
ret = waitpid(pid, NULL, 0);
|
ret = waitpid(pid, NULL, 0);
|
||||||
ICUNIT_ASSERT_EQUAL(ret, pid, ret);
|
ICUNIT_ASSERT_EQUAL(ret, pid, ret);
|
||||||
|
|
||||||
|
@ -56,7 +52,6 @@ static int TestThread(void)
|
||||||
|
|
||||||
static int TestCase(void)
|
static int TestCase(void)
|
||||||
{
|
{
|
||||||
int *test = nullptr;
|
|
||||||
int count = 5;
|
int count = 5;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
|
@ -59,7 +59,7 @@ static int TestMkfifo()
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
write(fd, sentence, sizeof(sentence) + 1);
|
write(fd, sentence, sizeof(sentence));
|
||||||
close(fd);
|
close(fd);
|
||||||
exit(0);
|
exit(0);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -45,7 +45,6 @@ static int TestMkfifoReturn()
|
||||||
int retValue, i;
|
int retValue, i;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
char pathname[NAME_BUF_SIZE];
|
|
||||||
|
|
||||||
retValue = mkfifo("/dev/fifo0", 0777); // 0777, mkfifo config.
|
retValue = mkfifo("/dev/fifo0", 0777); // 0777, mkfifo config.
|
||||||
ICUNIT_ASSERT_EQUAL(retValue, 0, retValue);
|
ICUNIT_ASSERT_EQUAL(retValue, 0, retValue);
|
||||||
|
@ -57,7 +56,6 @@ static int TestMkfifoReturn()
|
||||||
unlink("/dev/fifo0/fifo1");
|
unlink("/dev/fifo0/fifo1");
|
||||||
unlink("/dev/usr/fifo0");
|
unlink("/dev/usr/fifo0");
|
||||||
rmdir("/dev/usr");
|
rmdir("/dev/usr");
|
||||||
unlink(pathname);
|
|
||||||
unlink("/dev/fifo0");
|
unlink("/dev/fifo0");
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
|
|
||||||
|
@ -66,7 +64,6 @@ EXIT:
|
||||||
unlink("/dev/fifo0/fifo1");
|
unlink("/dev/fifo0/fifo1");
|
||||||
unlink("/dev/usr/fifo0");
|
unlink("/dev/usr/fifo0");
|
||||||
rmdir("/dev/usr");
|
rmdir("/dev/usr");
|
||||||
unlink(pathname);
|
|
||||||
unlink("/dev/fifo0");
|
unlink("/dev/fifo0");
|
||||||
return LOS_NOK;
|
return LOS_NOK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ static UINT32 testcase(VOID)
|
||||||
UINT32 ret;
|
UINT32 ret;
|
||||||
|
|
||||||
retval = pipe(pipeFd);
|
retval = pipe(pipeFd);
|
||||||
ICUNIT_GOTO_EQUAL(retval, 0, retval, OUT);
|
ICUNIT_GOTO_EQUAL(retval, 0, retval, OUT4);
|
||||||
|
|
||||||
/* Watch fd to see when it has input. */
|
/* Watch fd to see when it has input. */
|
||||||
FD_ZERO(&rfds);
|
FD_ZERO(&rfds);
|
||||||
|
@ -62,11 +62,11 @@ static UINT32 testcase(VOID)
|
||||||
|
|
||||||
/* Wait up to three seconds. */
|
/* Wait up to three seconds. */
|
||||||
epFd = epoll_create1(100); /* 100, cretae input, */
|
epFd = epoll_create1(100); /* 100, cretae input, */
|
||||||
ICUNIT_GOTO_NOT_EQUAL(epFd, -1, epFd, OUT);
|
ICUNIT_GOTO_NOT_EQUAL(epFd, -1, epFd, OUT2);
|
||||||
|
|
||||||
ev.events = EPOLLIN | EPOLLOUT | EPOLLRDNORM | EPOLLWRNORM;
|
ev.events = EPOLLIN | EPOLLOUT | EPOLLRDNORM | EPOLLWRNORM;
|
||||||
retval = epoll_ctl(epFd, EPOLL_CTL_ADD, pipeFd[0], &ev);
|
retval = epoll_ctl(epFd, EPOLL_CTL_ADD, pipeFd[0], &ev);
|
||||||
ICUNIT_GOTO_NOT_EQUAL(retval, -1, retval, OUT);
|
ICUNIT_GOTO_NOT_EQUAL(retval, -1, retval, OUT1);
|
||||||
|
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
|
@ -86,7 +86,7 @@ static UINT32 testcase(VOID)
|
||||||
sleep(1);
|
sleep(1);
|
||||||
close(pipeFd[0]);
|
close(pipeFd[0]);
|
||||||
retval = write(pipeFd[1], "0123456789012345678901234567890123456789", 40); /* write 40 bytes to stdin(fd 0) */
|
retval = write(pipeFd[1], "0123456789012345678901234567890123456789", 40); /* write 40 bytes to stdin(fd 0) */
|
||||||
ICUNIT_GOTO_EQUAL(retval, 40, retval, OUT);
|
ICUNIT_GOTO_EQUAL(retval, 40, retval, OUT3);
|
||||||
close(pipeFd[1]);
|
close(pipeFd[1]);
|
||||||
|
|
||||||
wait(&status);
|
wait(&status);
|
||||||
|
@ -95,10 +95,20 @@ static UINT32 testcase(VOID)
|
||||||
}
|
}
|
||||||
|
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
OUT:
|
OUT1:
|
||||||
|
close(epFd);
|
||||||
close(pipeFd[0]);
|
close(pipeFd[0]);
|
||||||
close(pipeFd[1]);
|
close(pipeFd[1]);
|
||||||
|
return LOS_NOK;
|
||||||
|
OUT2:
|
||||||
|
close(pipeFd[0]);
|
||||||
|
close(pipeFd[1]);
|
||||||
|
return LOS_NOK;
|
||||||
|
OUT3:
|
||||||
close(epFd);
|
close(epFd);
|
||||||
|
close(pipeFd[1]);
|
||||||
|
return LOS_NOK;
|
||||||
|
OUT4:
|
||||||
return LOS_NOK;
|
return LOS_NOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ static UINT32 testcase(VOID)
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
int epFd;
|
int epFd = 0;
|
||||||
sigset_t mask;
|
sigset_t mask;
|
||||||
void (*retSig)(int);
|
void (*retSig)(int);
|
||||||
struct epoll_event ev;
|
struct epoll_event ev;
|
||||||
|
@ -75,7 +75,7 @@ static UINT32 testcase(VOID)
|
||||||
ICUNIT_ASSERT_EQUAL(retval, 0, retval);
|
ICUNIT_ASSERT_EQUAL(retval, 0, retval);
|
||||||
|
|
||||||
retval = pipe(pipeFd);
|
retval = pipe(pipeFd);
|
||||||
ICUNIT_GOTO_EQUAL(retval, 0, retval, OUT);
|
ICUNIT_GOTO_EQUAL(retval, 0, retval, OUT3);
|
||||||
|
|
||||||
/* Watch fd to see when it has input. */
|
/* Watch fd to see when it has input. */
|
||||||
FD_ZERO(&rfds);
|
FD_ZERO(&rfds);
|
||||||
|
@ -86,12 +86,12 @@ static UINT32 testcase(VOID)
|
||||||
tv.tv_nsec = 5; /* 5, wait timer, nano second */
|
tv.tv_nsec = 5; /* 5, wait timer, nano second */
|
||||||
|
|
||||||
epFd = epoll_create1(100); /* 100, cretae input, */
|
epFd = epoll_create1(100); /* 100, cretae input, */
|
||||||
ICUNIT_GOTO_NOT_EQUAL(epFd, -1, epFd, OUT);
|
ICUNIT_GOTO_NOT_EQUAL(epFd, -1, epFd, OUT2);
|
||||||
|
|
||||||
ev.events = EPOLLRDNORM;
|
ev.events = EPOLLRDNORM;
|
||||||
retval = epoll_ctl(epFd, EPOLL_CTL_ADD, pipeFd[0], &ev);
|
retval = epoll_ctl(epFd, EPOLL_CTL_ADD, pipeFd[0], &ev);
|
||||||
|
|
||||||
ICUNIT_GOTO_NOT_EQUAL(retval, -1, retval, OUT);
|
ICUNIT_GOTO_NOT_EQUAL(retval, -1, retval, OUT1);
|
||||||
|
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
|
@ -125,10 +125,12 @@ static UINT32 testcase(VOID)
|
||||||
}
|
}
|
||||||
|
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
OUT:
|
OUT1:
|
||||||
|
close(epFd);
|
||||||
|
OUT2:
|
||||||
close(pipeFd[0]);
|
close(pipeFd[0]);
|
||||||
close(pipeFd[1]);
|
close(pipeFd[1]);
|
||||||
close(epFd);
|
OUT3:
|
||||||
return LOS_NOK;
|
return LOS_NOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ static int Testcase()
|
||||||
#define CURRENT_PROCESS_POLICY SCHED_RR
|
#define CURRENT_PROCESS_POLICY SCHED_RR
|
||||||
|
|
||||||
struct sched_param param = { 0 };
|
struct sched_param param = { 0 };
|
||||||
int ret;
|
int ret = OS_ERROR;
|
||||||
|
|
||||||
int currProcessPri = getpriority(PRIO_PROCESS, getpid());
|
int currProcessPri = getpriority(PRIO_PROCESS, getpid());
|
||||||
ICUNIT_GOTO_WITHIN_EQUAL(currProcessPri, 0, 31, currProcessPri, ERROR_OUT); // 31, assert function Result equal to this.
|
ICUNIT_GOTO_WITHIN_EQUAL(currProcessPri, 0, 31, currProcessPri, ERROR_OUT); // 31, assert function Result equal to this.
|
||||||
|
|
|
@ -35,7 +35,7 @@ static int TestCase()
|
||||||
{
|
{
|
||||||
#define PROCESS_TEST_PRI1 (currProcessPri + 1)
|
#define PROCESS_TEST_PRI1 (currProcessPri + 1)
|
||||||
struct sched_param param = { 0 };
|
struct sched_param param = { 0 };
|
||||||
int ret;
|
int ret = OS_ERROR;
|
||||||
int val, currPolicy;
|
int val, currPolicy;
|
||||||
int currProcessPri = getpriority(PRIO_PROCESS, getpid());
|
int currProcessPri = getpriority(PRIO_PROCESS, getpid());
|
||||||
ICUNIT_GOTO_WITHIN_EQUAL(currProcessPri, 0, 31, currProcessPri, ERROR_OUT); // 31, assert currProcessPri equal to this.
|
ICUNIT_GOTO_WITHIN_EQUAL(currProcessPri, 0, 31, currProcessPri, ERROR_OUT); // 31, assert currProcessPri equal to this.
|
||||||
|
|
Loading…
Reference in New Issue