Compare commits
6 Commits
master
...
OpenHarmon
Author | SHA1 | Date |
---|---|---|
|
2bef65046a | |
|
205df75f15 | |
|
85f1c9e0ca | |
|
c04ff6b10f | |
|
1b61489512 | |
|
29c459e045 |
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,6 +31,7 @@
|
|||
#include "it_test_shm.h"
|
||||
|
||||
#define SHMID_MAX 192
|
||||
#define SHM_FLAG 0777
|
||||
|
||||
static int Testcase(VOID)
|
||||
{
|
||||
|
@ -44,24 +45,24 @@ static int Testcase(VOID)
|
|||
ICUNIT_ASSERT_EQUAL(ret, SHMID_MAX, ret);
|
||||
leftShmIds = SHMID_MAX - shmInfo.used_ids;
|
||||
|
||||
shmid[0] = shmget((key_t)0x1234, PAGE_SIZE, 0777 | IPC_CREAT);
|
||||
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 < leftShmIds; i++) {
|
||||
shmid[i] = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT);
|
||||
shmid[i] = shmget(IPC_PRIVATE, PAGE_SIZE, SHM_FLAG | IPC_CREAT);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(shmid[i], -1, shmid[i]);
|
||||
}
|
||||
|
||||
shmid[leftShmIds] = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT);
|
||||
shmid[leftShmIds] = shmget(IPC_PRIVATE, PAGE_SIZE, SHM_FLAG | IPC_CREAT);
|
||||
ICUNIT_ASSERT_EQUAL(shmid[leftShmIds], -1, shmid[leftShmIds]);
|
||||
|
||||
for (i = 0; i < leftShmIds; i++) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue