• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 #include <errno.h>
17 #include <pthread.h>
18 
19 #include "pthread_util.h"
20 
21 #define DEFAULT_GUARD_SIZE 8192
22 
pthread_guard_size_0100(void)23 static void pthread_guard_size_0100(void)
24 {
25     pthread_attr_t attr = {0};
26     size_t guard_size = 0;
27     pthread_getattr_default_np(&attr);
28     pthread_attr_getguardsize(&attr, &guard_size);
29 #ifdef TARGET_GUARD_SIZE
30     TEST(guard_size == TARGET_GUARD_SIZE);
31 #else
32     TEST(guard_size == DEFAULT_GUARD_SIZE);
33 #endif
34 }
35 
36 TEST_FUN G_Fun_Array[] = {
37     pthread_guard_size_0100,
38 };
39 
main(void)40 int main(void)
41 {
42     int num = sizeof(G_Fun_Array) / sizeof(TEST_FUN);
43     for (int pos = 0; pos < num; ++pos) {
44         G_Fun_Array[pos]();
45     }
46     return t_status;
47 }