1 /* 2 * Copyright (c) 2009-2022 Huawei Technologies Co., Ltd. All rights reserved. 3 * 4 * UniProton is licensed under Mulan PSL v2. 5 * You can use this software according to the terms and conditions of the Mulan PSL v2. 6 * You may obtain a copy of Mulan PSL v2 at: 7 * http://license.coscl.org.cn/MulanPSL2 8 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 9 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 10 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 11 * See the Mulan PSL v2 for more details. 12 * Create: 2009-12-22 13 * Description: Task Self ID Get implementation 14 */ 15 #include "prt_task_external.h" 16 17 /* 18 * 描述:获取当前任务ID 19 */ PRT_TaskSelf(TskHandle * taskPid)20OS_SEC_L2_TEXT U32 PRT_TaskSelf(TskHandle *taskPid) 21 { 22 struct TagTskCb *tskCb = RUNNING_TASK; 23 24 if (taskPid == NULL) { 25 return OS_ERRNO_TSK_PTR_NULL; 26 } 27 28 /* 任务的 PID 非法 */ 29 if (tskCb == NULL) { 30 return OS_ERRNO_TSK_ID_INVALID; 31 } 32 33 *taskPid = tskCb->taskPid; 34 return OS_OK; 35 } 36