~ubuntu-branches/ubuntu/natty/eglibc/natty-security

« back to all changes in this revision

Viewing changes to ports/sysdeps/unix/sysv/linux/hppa/nptl/bits/pthreadtypes.h

  • Committer: Bazaar Package Importer
  • Author(s): Aurelien Jarno
  • Date: 2009-05-05 09:54:14 UTC
  • Revision ID: james.westby@ubuntu.com-20090505095414-c45qsg9ixjheohru
ImportĀ upstreamĀ versionĀ 2.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
 
2
   This file is part of the GNU C Library.
 
3
 
 
4
   The GNU C Library is free software; you can redistribute it and/or
 
5
   modify it under the terms of the GNU Lesser General Public
 
6
   License as published by the Free Software Foundation; either
 
7
   version 2.1 of the License, or (at your option) any later version.
 
8
 
 
9
   The GNU C Library is distributed in the hope that it will be useful,
 
10
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
   Lesser General Public License for more details.
 
13
 
 
14
   You should have received a copy of the GNU Lesser General Public
 
15
   License along with the GNU C Library; if not, write to the Free
 
16
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 
17
   02111-1307 USA.  */
 
18
 
 
19
#ifndef _BITS_PTHREADTYPES_H
 
20
#define _BITS_PTHREADTYPES_H    1
 
21
 
 
22
/* Linuxthread type sizes (bytes):
 
23
   sizeof(pthread_attr_t) = 0x24 (36)
 
24
   sizeof(pthread_mutex_t) = 0x30 (48)
 
25
   sizeof(pthread_mutexattr_t) = 0x4 (4)
 
26
   sizeof(pthread_cond_t) = 0x30 (48)
 
27
        = Expanded to 64 bytes in NPTL. 
 
28
   sizeof(pthread_cond_compat_t) = 0xc (12)
 
29
        = Did not exist in Linuxthreads.
 
30
   sizeof(pthread_condattr_t) = 0x4 (4)
 
31
   sizeof(pthread_rwlock_t) = 0x40 (64)
 
32
   sizeof(pthread_rwlockattr_t) = 0x8 (8)
 
33
   sizeof(pthread_barrier_t) = 0x30 (48)
 
34
   sizeof(pthread_barrierattr_t) = 0x4 (4) */
 
35
 
 
36
#define __SIZEOF_PTHREAD_ATTR_T 36
 
37
#define __SIZEOF_PTHREAD_MUTEX_T 48 
 
38
#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
 
39
#define __SIZEOF_PTHREAD_COND_T 64
 
40
#define __SIZEOF_PTHREAD_COND_COMPAT_T 12
 
41
#define __SIZEOF_PTHREAD_CONDATTR_T 4
 
42
#define __SIZEOF_PTHREAD_RWLOCK_T 64
 
43
#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
 
44
#define __SIZEOF_PTHREAD_BARRIER_T 48
 
45
#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
 
46
 
 
47
/* Thread identifiers.  The structure of the attribute type is not
 
48
   exposed on purpose.  */
 
49
typedef unsigned long int pthread_t;
 
50
 
 
51
/* Our old basic lock type, listed here for posterity.
 
52
   We needed self-aligning locks for linuxthreads LDCW 
 
53
   implementation. For NPTL we use LWS Compare and 
 
54
   Exchange to implement primitives. */
 
55
#if 0
 
56
typedef volatile struct {
 
57
        int lock[4];
 
58
} __attribute__ ((aligned(16))) __atomic_lock_t;
 
59
#endif
 
60
 
 
61
typedef union
 
62
{
 
63
  char __size[__SIZEOF_PTHREAD_ATTR_T];
 
64
  long int __align;
 
65
} pthread_attr_t;
 
66
 
 
67
 
 
68
typedef struct __pthread_internal_slist
 
69
{
 
70
  struct __pthread_internal_slist *__next;
 
71
} __pthread_slist_t;
 
72
 
 
73
 
 
74
/* Data structures for mutex handling.  The structure of the attribute
 
75
   type is not exposed on purpose.  */
 
76
typedef union
 
77
{
 
78
  struct __pthread_mutex_s
 
79
  {
 
80
    int __lock;
 
81
    unsigned int __count;
 
82
    int __owner;
 
83
    /* KIND must stay at this position in the structure to maintain
 
84
       binary compatibility.  */
 
85
    int __kind;
 
86
    unsigned int __nusers;
 
87
    __extension__ union
 
88
    {
 
89
      int __spins;
 
90
      __pthread_slist_t __list;
 
91
    };
 
92
  } __data;
 
93
  char __size[__SIZEOF_PTHREAD_MUTEX_T];
 
94
  long int __align;
 
95
} pthread_mutex_t;
 
96
 
 
97
typedef union
 
98
{
 
99
  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
 
100
  long int __align;
 
101
} pthread_mutexattr_t;
 
102
 
 
103
 
 
104
/* Data structure for conditional variable handling.  The structure of
 
105
   the attribute type is not exposed on purpose.  */
 
106
typedef union
 
107
{
 
108
  struct
 
109
  {
 
110
    int __lock;
 
111
    unsigned int __futex;
 
112
    __extension__ unsigned long long int __total_seq;
 
113
    __extension__ unsigned long long int __wakeup_seq;
 
114
    __extension__ unsigned long long int __woken_seq;
 
115
    void *__mutex;
 
116
    unsigned int __nwaiters;
 
117
    unsigned int __broadcast_seq;
 
118
  } __data;
 
119
  char __size[__SIZEOF_PTHREAD_COND_T];
 
120
  __extension__ long long int __align;
 
121
} pthread_cond_t;
 
122
 
 
123
typedef union
 
124
{
 
125
  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
 
126
  long int __align;
 
127
} pthread_condattr_t;
 
128
 
 
129
 
 
130
/* Keys for thread-specific data */
 
131
typedef unsigned int pthread_key_t;
 
132
 
 
133
 
 
134
/* Once-only execution */
 
135
typedef int pthread_once_t;
 
136
 
 
137
 
 
138
#if defined __USE_UNIX98 || defined __USE_XOPEN2K
 
139
/* Data structure for read-write lock variable handling.  The
 
140
   structure of the attribute type is not exposed on purpose.  */
 
141
typedef union
 
142
{
 
143
  struct
 
144
  {
 
145
    int __lock;
 
146
    unsigned int __nr_readers;
 
147
    unsigned int __readers_wakeup;
 
148
    unsigned int __writer_wakeup;
 
149
    unsigned int __nr_readers_queued;
 
150
    unsigned int __nr_writers_queued;
 
151
    /* FLAGS must stay at this position in the structure to maintain
 
152
       binary compatibility.  */
 
153
    unsigned char __pad2;
 
154
    unsigned char __pad1;
 
155
    unsigned char __shared;
 
156
    unsigned char __flags;
 
157
    int __writer;
 
158
  } __data;
 
159
  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
 
160
  long int __align;
 
161
} pthread_rwlock_t;
 
162
 
 
163
typedef union
 
164
{
 
165
  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
 
166
  long int __align;
 
167
} pthread_rwlockattr_t;
 
168
#endif
 
169
 
 
170
 
 
171
#ifdef __USE_XOPEN2K
 
172
/* POSIX spinlock data type.  */
 
173
typedef volatile int pthread_spinlock_t;
 
174
 
 
175
 
 
176
/* POSIX barriers data type.  The structure of the type is
 
177
   deliberately not exposed.  */
 
178
typedef union
 
179
{
 
180
  char __size[__SIZEOF_PTHREAD_BARRIER_T];
 
181
  long int __align;
 
182
} pthread_barrier_t;
 
183
 
 
184
typedef union
 
185
{
 
186
  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
 
187
  int __align;
 
188
} pthread_barrierattr_t;
 
189
#endif
 
190
 
 
191
 
 
192
#endif  /* bits/pthreadtypes.h */