提交 65d5526c 编写于 作者: Z zhushengle

fix: 修复类型不匹配问题

Signed-off-by: Nzhushengle <zhushengle@huawei.com>
Change-Id: I31e16c9716de1223db7e4de916af3e010ca5f4e4
上级 33c4e194
...@@ -1249,19 +1249,19 @@ EXIT: ...@@ -1249,19 +1249,19 @@ EXIT:
return err; return err;
} }
UINT32 OsUserTaskOperatePermissionsCheck(LosTaskCB *taskCB) INT32 OsUserTaskOperatePermissionsCheck(const LosTaskCB *taskCB)
{ {
return OsUserProcessOperatePermissionsCheck(taskCB, OsCurrProcessGet()->processID); return OsUserProcessOperatePermissionsCheck(taskCB, OsCurrProcessGet()->processID);
} }
UINT32 OsUserProcessOperatePermissionsCheck(LosTaskCB *taskCB, UINT32 processID) INT32 OsUserProcessOperatePermissionsCheck(const LosTaskCB *taskCB, UINT32 processID)
{ {
if (taskCB == NULL) { if (taskCB == NULL) {
return LOS_EINVAL; return LOS_EINVAL;
} }
if (processID == OS_INVALID_VALUE) { if (processID == OS_INVALID_VALUE) {
return OS_INVALID_VALUE; return LOS_EINVAL;
} }
if (taskCB->taskStatus & OS_TASK_STATUS_UNUSED) { if (taskCB->taskStatus & OS_TASK_STATUS_UNUSED) {
......
...@@ -323,8 +323,8 @@ extern UINT32 OsCreateUserTask(UINT32 processID, TSK_INIT_PARAM_S *initParam); ...@@ -323,8 +323,8 @@ extern UINT32 OsCreateUserTask(UINT32 processID, TSK_INIT_PARAM_S *initParam);
extern INT32 OsSetTaskName(LosTaskCB *taskCB, const CHAR *name, BOOL setPName); extern INT32 OsSetTaskName(LosTaskCB *taskCB, const CHAR *name, BOOL setPName);
extern VOID OsTaskCBRecycleToFree(VOID); extern VOID OsTaskCBRecycleToFree(VOID);
extern VOID OsRunningTaskToExit(LosTaskCB *runTask, UINT32 status); extern VOID OsRunningTaskToExit(LosTaskCB *runTask, UINT32 status);
extern UINT32 OsUserTaskOperatePermissionsCheck(LosTaskCB *taskCB); extern INT32 OsUserTaskOperatePermissionsCheck(const LosTaskCB *taskCB);
extern UINT32 OsUserProcessOperatePermissionsCheck(LosTaskCB *taskCB, UINT32 processID); extern INT32 OsUserProcessOperatePermissionsCheck(const LosTaskCB *taskCB, UINT32 processID);
extern INT32 OsTcbDispatch(LosTaskCB *stcb, siginfo_t *info); extern INT32 OsTcbDispatch(LosTaskCB *stcb, siginfo_t *info);
extern VOID OsWriteResourceEvent(UINT32 events); extern VOID OsWriteResourceEvent(UINT32 events);
extern VOID OsWriteResourceEventUnsafe(UINT32 events); extern VOID OsWriteResourceEventUnsafe(UINT32 events);
......
...@@ -112,16 +112,16 @@ STATIC VOID OsFutexShowTaskNodeAttr(const LOS_DL_LIST *futexList) ...@@ -112,16 +112,16 @@ STATIC VOID OsFutexShowTaskNodeAttr(const LOS_DL_LIST *futexList)
LOS_DL_LIST *queueList = NULL; LOS_DL_LIST *queueList = NULL;
tempNode = OS_FUTEX_FROM_FUTEXLIST(futexList); tempNode = OS_FUTEX_FROM_FUTEXLIST(futexList);
PRINTK("key(pid) : 0x%x(%d) : ->", tempNode->key, tempNode->pid); PRINTK("key(pid) : 0x%x(%u) : ->", tempNode->key, tempNode->pid);
for (queueList = &tempNode->queueList; ;) { for (queueList = &tempNode->queueList; ;) {
lastNode = OS_FUTEX_FROM_QUEUELIST(queueList); lastNode = OS_FUTEX_FROM_QUEUELIST(queueList);
if (!LOS_ListEmpty(&(lastNode->pendList))) { if (!LOS_ListEmpty(&(lastNode->pendList))) {
taskCB = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&(lastNode->pendList))); taskCB = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&(lastNode->pendList)));
PRINTK(" %d(%d) ->", taskCB->taskID, taskCB->priority); PRINTK(" %u(%u) ->", taskCB->taskID, taskCB->priority);
} else { } else {
taskCB = LOS_DL_LIST_ENTRY(lastNode, LosTaskCB, futex); taskCB = LOS_DL_LIST_ENTRY(lastNode, LosTaskCB, futex);
PRINTK(" %d(%d) ->", taskCB->taskID, -1); PRINTK(" %u(%d) ->", taskCB->taskID, -1);
} }
queueList = queueList->pstNext; queueList = queueList->pstNext;
if (queueList == &tempNode->queueList) { if (queueList == &tempNode->queueList) {
......
...@@ -173,7 +173,7 @@ LITE_OS_SEC_TEXT_MINOR VOID OsShellCmdDumpSched(VOID) ...@@ -173,7 +173,7 @@ LITE_OS_SEC_TEXT_MINOR VOID OsShellCmdDumpSched(VOID)
affinity = (UINT32)taskCB->cpuAffiMask; affinity = (UINT32)taskCB->cpuAffiMask;
PRINTK("%-30s0x%-6x%+16lf ms %10d\n", taskCB->taskName, taskCB->taskID, PRINTK("%-30s0x%-6x%+16lf ms %10u\n", taskCB->taskName, taskCB->taskID,
(DOUBLE)(taskCB->schedStat.allRuntime) / NS_PER_MS, (DOUBLE)(taskCB->schedStat.allRuntime) / NS_PER_MS,
taskCB->schedStat.allContextSwitch); taskCB->schedStat.allContextSwitch);
...@@ -183,7 +183,7 @@ LITE_OS_SEC_TEXT_MINOR VOID OsShellCmdDumpSched(VOID) ...@@ -183,7 +183,7 @@ LITE_OS_SEC_TEXT_MINOR VOID OsShellCmdDumpSched(VOID)
} }
PRINTK(" " PRINTK(" "
"CPU%d %+16lf ms %12d\n", cpuid, "CPU%u %+16lf ms %12u\n", cpuid,
(DOUBLE)(taskCB->schedStat.schedPercpu[cpuid].runtime) / NS_PER_MS, (DOUBLE)(taskCB->schedStat.schedPercpu[cpuid].runtime) / NS_PER_MS,
taskCB->schedStat.schedPercpu[cpuid].contexSwitch); taskCB->schedStat.schedPercpu[cpuid].contexSwitch);
} }
...@@ -251,7 +251,7 @@ LITE_OS_SEC_TEXT_MINOR VOID OsMpStaticShow(UINT64 mpStaticPastTime) ...@@ -251,7 +251,7 @@ LITE_OS_SEC_TEXT_MINOR VOID OsMpStaticShow(UINT64 mpStaticPastTime)
"---------- ---------- ---------- ----------\n"); "---------- ---------- ---------- ----------\n");
for (cpuid = 0; cpuid < LOSCFG_KERNEL_CORE_NUM; cpuid++) { for (cpuid = 0; cpuid < LOSCFG_KERNEL_CORE_NUM; cpuid++) {
PRINTK("CPU%d %+10lf%14d%14d%14d %+11lf %+11lf %+11lf%14d %+11lf\n", cpuid, PRINTK("CPU%u %+10lf%14u%14u%14u %+11lf %+11lf %+11lf%14u %+11lf\n", cpuid,
((DOUBLE)(g_mpStatPercpu[cpuid].idleRuntime) / mpStaticPastTime) * DECIMAL_TO_PERCENTAGE, ((DOUBLE)(g_mpStatPercpu[cpuid].idleRuntime) / mpStaticPastTime) * DECIMAL_TO_PERCENTAGE,
g_mpStatPercpu[cpuid].contexSwitch, g_mpStatPercpu[cpuid].contexSwitch,
g_mpStatPercpu[cpuid].hwiNum, g_mpStatPercpu[cpuid].hwiNum,
......
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
#include "capability_api.h" #include "capability_api.h"
#endif #endif
static int OsPermissionToCheck(unsigned int pid, unsigned int who) static int OsPermissionToCheck(unsigned int pid, unsigned int who)
{ {
int ret = LOS_GetProcessGroupID(pid); int ret = LOS_GetProcessGroupID(pid);
...@@ -78,8 +77,8 @@ static int OsUserTaskSchedulerSet(unsigned int tid, unsigned short policy, unsig ...@@ -78,8 +77,8 @@ static int OsUserTaskSchedulerSet(unsigned int tid, unsigned short policy, unsig
return EINVAL; return EINVAL;
} }
SCHEDULER_LOCK(intSave);
LosTaskCB *taskCB = OS_TCB_FROM_TID(tid); LosTaskCB *taskCB = OS_TCB_FROM_TID(tid);
SCHEDULER_LOCK(intSave);
ret = OsUserTaskOperatePermissionsCheck(taskCB); ret = OsUserTaskOperatePermissionsCheck(taskCB);
if (ret != LOS_OK) { if (ret != LOS_OK) {
SCHEDULER_UNLOCK(intSave); SCHEDULER_UNLOCK(intSave);
...@@ -100,13 +99,14 @@ static int OsUserTaskSchedulerSet(unsigned int tid, unsigned short policy, unsig ...@@ -100,13 +99,14 @@ static int OsUserTaskSchedulerSet(unsigned int tid, unsigned short policy, unsig
void SysSchedYield(int type) void SysSchedYield(int type)
{ {
(void)type;
(void)LOS_TaskYield(); (void)LOS_TaskYield();
return; return;
} }
int SysSchedGetScheduler(int id, int flag) int SysSchedGetScheduler(int id, int flag)
{ {
LosTaskCB *taskCB = NULL;
unsigned int intSave; unsigned int intSave;
int policy; int policy;
int ret; int ret;
...@@ -116,15 +116,15 @@ int SysSchedGetScheduler(int id, int flag) ...@@ -116,15 +116,15 @@ int SysSchedGetScheduler(int id, int flag)
return -EINVAL; return -EINVAL;
} }
LosTaskCB *taskCB = OS_TCB_FROM_TID(id);
SCHEDULER_LOCK(intSave); SCHEDULER_LOCK(intSave);
taskCB = OS_TCB_FROM_TID(id);
ret = OsUserTaskOperatePermissionsCheck(taskCB); ret = OsUserTaskOperatePermissionsCheck(taskCB);
if (ret != LOS_OK) { if (ret != LOS_OK) {
SCHEDULER_UNLOCK(intSave); SCHEDULER_UNLOCK(intSave);
return -ret; return -ret;
} }
policy = taskCB->policy; policy = (int)taskCB->policy;
SCHEDULER_UNLOCK(intSave); SCHEDULER_UNLOCK(intSave);
return policy; return policy;
} }
...@@ -158,8 +158,7 @@ int SysSchedSetScheduler(int id, int policy, int prio, int flag) ...@@ -158,8 +158,7 @@ int SysSchedSetScheduler(int id, int policy, int prio, int flag)
int SysSchedGetParam(int id, int flag) int SysSchedGetParam(int id, int flag)
{ {
LosTaskCB *taskCB = NULL; int prio;
int pri;
unsigned int intSave; unsigned int intSave;
if (flag < 0) { if (flag < 0) {
...@@ -167,17 +166,17 @@ int SysSchedGetParam(int id, int flag) ...@@ -167,17 +166,17 @@ int SysSchedGetParam(int id, int flag)
return -EINVAL; return -EINVAL;
} }
LosTaskCB *taskCB = OS_TCB_FROM_TID(id);
SCHEDULER_LOCK(intSave); SCHEDULER_LOCK(intSave);
taskCB = OS_TCB_FROM_TID(id); prio = OsUserTaskOperatePermissionsCheck(taskCB);
pri = OsUserTaskOperatePermissionsCheck(taskCB); if (prio != LOS_OK) {
if (pri != LOS_OK) {
SCHEDULER_UNLOCK(intSave); SCHEDULER_UNLOCK(intSave);
return -pri; return -prio;
} }
pri = taskCB->priority; prio = (int)taskCB->priority;
SCHEDULER_UNLOCK(intSave); SCHEDULER_UNLOCK(intSave);
return pri; return prio;
} }
if (id == 0) { if (id == 0) {
...@@ -894,17 +893,15 @@ unsigned int SysCreateUserThread(const TSK_ENTRY_FUNC func, const UserTaskParam ...@@ -894,17 +893,15 @@ unsigned int SysCreateUserThread(const TSK_ENTRY_FUNC func, const UserTaskParam
int SysSetThreadArea(const char *area) int SysSetThreadArea(const char *area)
{ {
unsigned int intSave; unsigned int intSave;
LosTaskCB *taskCB = NULL; int ret = LOS_OK;
LosProcessCB *processCB = NULL;
unsigned int ret = LOS_OK;
if (!LOS_IsUserAddress((unsigned long)(uintptr_t)area)) { if (!LOS_IsUserAddress((unsigned long)(uintptr_t)area)) {
return EINVAL; return EINVAL;
} }
LosTaskCB *taskCB = OsCurrTaskGet();
SCHEDULER_LOCK(intSave); SCHEDULER_LOCK(intSave);
taskCB = OsCurrTaskGet(); LosProcessCB *processCB = OS_PCB_FROM_PID(taskCB->processID);
processCB = OS_PCB_FROM_PID(taskCB->processID);
if (processCB->processMode != OS_USER_MODE) { if (processCB->processMode != OS_USER_MODE) {
ret = EPERM; ret = EPERM;
goto OUT; goto OUT;
...@@ -925,20 +922,19 @@ int SysUserThreadSetDetach(unsigned int taskID) ...@@ -925,20 +922,19 @@ int SysUserThreadSetDetach(unsigned int taskID)
{ {
unsigned int intSave; unsigned int intSave;
int ret; int ret;
LosTaskCB *taskCB = NULL;
if (OS_TID_CHECK_INVALID(taskID)) { if (OS_TID_CHECK_INVALID(taskID)) {
return EINVAL; return EINVAL;
} }
LosTaskCB *taskCB = OS_TCB_FROM_TID(taskID);
SCHEDULER_LOCK(intSave); SCHEDULER_LOCK(intSave);
taskCB = OS_TCB_FROM_TID(taskID);
ret = OsUserTaskOperatePermissionsCheck(taskCB); ret = OsUserTaskOperatePermissionsCheck(taskCB);
if (ret != LOS_OK) { if (ret != LOS_OK) {
goto EXIT; goto EXIT;
} }
ret = OsTaskSetDetachUnsafe(taskCB); ret = (int)OsTaskSetDetachUnsafe(taskCB);
EXIT: EXIT:
SCHEDULER_UNLOCK(intSave); SCHEDULER_UNLOCK(intSave);
...@@ -948,7 +944,7 @@ EXIT: ...@@ -948,7 +944,7 @@ EXIT:
int SysUserThreadDetach(unsigned int taskID) int SysUserThreadDetach(unsigned int taskID)
{ {
unsigned int intSave; unsigned int intSave;
unsigned int ret; int ret;
if (OS_TID_CHECK_INVALID(taskID)) { if (OS_TID_CHECK_INVALID(taskID)) {
return EINVAL; return EINVAL;
...@@ -961,8 +957,7 @@ int SysUserThreadDetach(unsigned int taskID) ...@@ -961,8 +957,7 @@ int SysUserThreadDetach(unsigned int taskID)
return ret; return ret;
} }
ret = LOS_TaskDelete(taskID); if (LOS_TaskDelete(taskID) != LOS_OK) {
if (ret != LOS_OK) {
return ESRCH; return ESRCH;
} }
...@@ -972,21 +967,20 @@ int SysUserThreadDetach(unsigned int taskID) ...@@ -972,21 +967,20 @@ int SysUserThreadDetach(unsigned int taskID)
int SysThreadJoin(unsigned int taskID) int SysThreadJoin(unsigned int taskID)
{ {
unsigned int intSave; unsigned int intSave;
unsigned int ret; int ret;
LosTaskCB *taskCB = NULL;
if (OS_TID_CHECK_INVALID(taskID)) { if (OS_TID_CHECK_INVALID(taskID)) {
return EINVAL; return EINVAL;
} }
LosTaskCB *taskCB = OS_TCB_FROM_TID(taskID);
SCHEDULER_LOCK(intSave); SCHEDULER_LOCK(intSave);
taskCB = OS_TCB_FROM_TID(taskID);
ret = OsUserTaskOperatePermissionsCheck(taskCB); ret = OsUserTaskOperatePermissionsCheck(taskCB);
if (ret != LOS_OK) { if (ret != LOS_OK) {
goto EXIT; goto EXIT;
} }
ret = OsTaskJoinPendUnsafe(OS_TCB_FROM_TID(taskID)); ret = (int)OsTaskJoinPendUnsafe(OS_TCB_FROM_TID(taskID));
EXIT: EXIT:
SCHEDULER_UNLOCK(intSave); SCHEDULER_UNLOCK(intSave);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册