feat: 支持pid容器
BREAKING CHANGE: 支持pid容器对外变更描述: 1.支持pid容器,使用clone(CLONE_NEWPID)创建 2.shell命令 task -a 不再显示线程信息,只显示系统所有进程信息 3.task命令新增参数-p, task -p pid 可查看改进程下的所有线程信息 4.使用LOS_TaskCreateOnly创建任务时, TSK_INIT_PARAM_S中的processID由原来的记录进程ID修改为记录进程控制块PCB Close #I68LVW Signed-off-by: zhushengle <zhushengle@huawei.com> Change-Id: I0895da9099cb285b3195af5e383d0fdeaf5c0087 Change-Id: I46a7642eeee73a4531c241e3ba6290dd302600a7
This commit is contained in:
@@ -240,9 +240,9 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
|
||||
taskInitParam.usTaskPrio = (UINT16)userAttr.schedparam.sched_priority;
|
||||
taskInitParam.uwStackSize = userAttr.stacksize;
|
||||
if (OsProcessIsUserMode(OsCurrProcessGet())) {
|
||||
taskInitParam.processID = OsGetKernelInitProcessID();
|
||||
taskInitParam.processID = (UINTPTR)OsGetKernelInitProcess();
|
||||
} else {
|
||||
taskInitParam.processID = OsCurrProcessGet()->processID;
|
||||
taskInitParam.processID = (UINTPTR)OsCurrProcessGet();
|
||||
}
|
||||
if (userAttr.detachstate == PTHREAD_CREATE_DETACHED) {
|
||||
taskInitParam.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 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-2023 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:
|
||||
@@ -117,7 +117,7 @@ STATIC INLINE BOOL ValidTimerID(UINT16 swtmrID)
|
||||
}
|
||||
|
||||
/* check owner of this timer */
|
||||
if (OS_SWT_FROM_SID(swtmrID)->uwOwnerPid != LOS_GetCurrProcessID()) {
|
||||
if (OS_SWT_FROM_SID(swtmrID)->uwOwnerPid != (UINTPTR)OsCurrProcessGet()) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -484,7 +484,7 @@ static int PthreadGetCputime(clockid_t clockID, struct timespec *ats)
|
||||
|
||||
LosTaskCB *task = OsGetTaskCB(tid);
|
||||
|
||||
if (OsCurrTaskGet()->processID != task->processID) {
|
||||
if (OsCurrTaskGet()->processCB != task->processCB) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -748,7 +748,7 @@ static VOID SwtmrProc(UINTPTR tmrArg)
|
||||
/* Make sure that the para is valid */
|
||||
OS_GOTO_EXIT_IF(OS_TID_CHECK_INVALID(arg->tid), EINVAL);
|
||||
stcb = OsGetTaskCB(arg->tid);
|
||||
ret = OsUserProcessOperatePermissionsCheck(stcb, stcb->processID);
|
||||
ret = OsUserProcessOperatePermissionsCheck(stcb, stcb->processCB);
|
||||
OS_GOTO_EXIT_IF(ret != LOS_OK, -ret);
|
||||
|
||||
/* Dispatch the signal to thread, bypassing normal task group thread
|
||||
@@ -1087,8 +1087,7 @@ clock_t times(struct tms *buf)
|
||||
int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue)
|
||||
{
|
||||
UINT32 intSave;
|
||||
LosTaskCB *taskCB = OS_TCB_FROM_TID(LOS_CurTaskIDGet());
|
||||
LosProcessCB *processCB = OS_PCB_FROM_PID(taskCB->processID);
|
||||
LosProcessCB *processCB = OsCurrProcessGet();
|
||||
timer_t timerID = 0;
|
||||
struct itimerspec spec;
|
||||
struct itimerspec ospec;
|
||||
@@ -1141,8 +1140,7 @@ int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue
|
||||
|
||||
int getitimer(int which, struct itimerval *value)
|
||||
{
|
||||
LosTaskCB *taskCB = OS_TCB_FROM_TID(LOS_CurTaskIDGet());
|
||||
LosProcessCB *processCB = OS_PCB_FROM_PID(taskCB->processID);
|
||||
LosProcessCB *processCB = OsCurrProcessGet();
|
||||
struct itimerspec spec = {};
|
||||
|
||||
int ret = LOS_OK;
|
||||
|
||||
Reference in New Issue
Block a user