1 /* 2 * Copyright (c) 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"), 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 /** 17 * @addtogroup TeeTrusted 18 * @{ 19 * 20 * @brief TEE(Trusted Excution Environment) API. 21 * Provides security capability APIs such as trusted storage, encryption and decryption, 22 * and trusted time for trusted application development. 23 * 24 * @since 20 25 */ 26 27 /** 28 * @file pthread_attr.h 29 * 30 * @brief Provides the attr about TA multi-thread. 31 * 32 * @library NA 33 * @kit TEEKit 34 * @syscap SystemCapability.Tee.TeeClient 35 * @since 20 36 */ 37 38 #ifndef PTHREAD_ATTR_H 39 #define PTHREAD_ATTR_H 40 41 #include <pthread.h> 42 43 #ifdef __cplusplus 44 extern "C" { 45 #endif 46 47 /** 48 * @brief Defines that the thread attribute of ca is not explicitly set (wildcard/default state). 49 * 50 * @since 20 51 */ 52 #define TEESMP_THREAD_ATTR_CA_WILDCARD 0 53 54 /** 55 * @brief Defines that the thread attribute of ca inherit from the parent thread. 56 * 57 * @since 20 58 */ 59 #define TEESMP_THREAD_ATTR_CA_INHERIT (-1U) 60 61 /** 62 * @brief Defines that the task ID attribute inherit from the parent task/thread. 63 * 64 * @since 20 65 */ 66 #define TEESMP_THREAD_ATTR_TASK_ID_INHERIT (-1U) 67 68 /** 69 * @brief Defines that the thread attribute has a shadow. 70 * 71 * @since 20 72 */ 73 #define TEESMP_THREAD_ATTR_HAS_SHADOW 0x1 74 75 /** 76 * @brief Defines that the thread attribute does not have a shadow. 77 * 78 * @since 20 79 */ 80 #define TEESMP_THREAD_ATTR_NO_SHADOW 0x0 81 82 /** 83 * @brief Sets thread attributes for CA, task ID, and shadow settings. 84 * 85 * @param a Pointer to the thread attribute object to be modified. 86 * @param ca Specifies the CA attribute value (e.g., TEESMP_THREAD_ATTR_CA_INHERIT for inheritance). 87 * @param task_id Specifies the task ID attribute value (e.g., TEESMP_THREAD_ATTR_TASK_ID_INHERIT for inheritance). 88 * @param shadow Indicates whether to enable shadow settings (TEESMP_THREAD_ATTR_NO_SHADOW 0x0 for no shadow, 89 * TEESMP_THREAD_ATTR_HAS_SHADOW 0x1 for has shadow). 90 * 91 * @return always return 0. 92 * 93 * @since 20 94 */ 95 int pthread_attr_settee(pthread_attr_t *a, int ca, int task_id, int shadow); 96 97 #ifdef __cplusplus 98 } 99 #endif 100 101 #endif 102 /** @} */