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 #ifndef _BITS_PTHREAD_TYPES_H_
30 #define _BITS_PTHREAD_TYPES_H_
31 
32 #include <sys/cdefs.h>
33 #include <sys/types.h>
34 
35 typedef struct {
36   uint32_t flags;
37   void* stack_base;
38   size_t stack_size;
39   size_t guard_size;
40   int32_t sched_policy;
41   int32_t sched_priority;
42 #ifdef __LP64__
43   char __reserved[16];
44 #endif
45 } pthread_attr_t;
46 
47 #if __ANDROID_API__ >= __ANDROID_API_N__
48 typedef struct {
49 #if defined(__LP64__)
50   int64_t __private[4];
51 #else
52   int32_t __private[8];
53 #endif
54 } pthread_barrier_t;
55 #endif
56 
57 #if __ANDROID_API__ >= __ANDROID_API_N__
58 typedef int pthread_barrierattr_t;
59 #endif
60 
61 typedef struct {
62 #if defined(__LP64__)
63   int32_t __private[12];
64 #else
65   int32_t __private[1];
66 #endif
67 } pthread_cond_t;
68 
69 typedef long pthread_condattr_t;
70 
71 typedef int pthread_key_t;
72 
73 typedef struct {
74 #if defined(__LP64__)
75   int32_t __private[10];
76 #else
77   int32_t __private[1];
78 #endif
79 } pthread_mutex_t;
80 
81 typedef long pthread_mutexattr_t;
82 
83 typedef int pthread_once_t;
84 
85 typedef struct {
86 #if defined(__LP64__)
87   int32_t __private[14];
88 #else
89   int32_t __private[10];
90 #endif
91 } pthread_rwlock_t;
92 
93 typedef long pthread_rwlockattr_t;
94 
95 #if __ANDROID_API__ >= __ANDROID_API_N__
96 typedef struct {
97 #if defined(__LP64__)
98   int64_t __private;
99 #else
100   int32_t __private[2];
101 #endif
102 } pthread_spinlock_t;
103 #endif
104 
105 typedef long pthread_t;
106 
107 #endif
108