1 /*
2  * Copyright (C) 2008 The Android Open Source Project
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *  * Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  *  * Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in
12  *    the documentation and/or other materials provided with the
13  *    distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  */
28 
29 #pragma once
30 
31 #include <sys/cdefs.h>
32 #include <sys/types.h>
33 
34 typedef struct {
35   uint32_t flags;
36   void* stack_base;
37   size_t stack_size;
38   size_t guard_size;
39   int32_t sched_policy;
40   int32_t sched_priority;
41 #ifdef __LP64__
42   char __reserved[16];
43 #endif
44 } pthread_attr_t;
45 
46 #if __ANDROID_API__ >= 24
47 typedef struct {
48 #if defined(__LP64__)
49   int64_t __private[4];
50 #else
51   int32_t __private[8];
52 #endif
53 } pthread_barrier_t;
54 #endif
55 
56 #if __ANDROID_API__ >= 24
57 typedef int pthread_barrierattr_t;
58 #endif
59 
60 typedef struct {
61 #if defined(__LP64__)
62   int32_t __private[12];
63 #else
64   int32_t __private[1];
65 #endif
66 } pthread_cond_t;
67 
68 typedef long pthread_condattr_t;
69 
70 typedef int pthread_key_t;
71 
72 typedef struct {
73 #if defined(__LP64__)
74   int32_t __private[10];
75 #else
76   int32_t __private[1];
77 #endif
78 } pthread_mutex_t;
79 
80 typedef long pthread_mutexattr_t;
81 
82 typedef int pthread_once_t;
83 
84 typedef struct {
85 #if defined(__LP64__)
86   int32_t __private[14];
87 #else
88   int32_t __private[10];
89 #endif
90 } pthread_rwlock_t;
91 
92 typedef long pthread_rwlockattr_t;
93 
94 #if __ANDROID_API__ >= 24
95 typedef struct {
96 #if defined(__LP64__)
97   int64_t __private;
98 #else
99   int32_t __private[2];
100 #endif
101 } pthread_spinlock_t;
102 #endif
103 
104 typedef long pthread_t;
105