/usr/include/diet/pthread.h is in dietlibc-dev 0.33~cvs20120325-6+deb8u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | #ifndef _PTHREAD_H
#define _PTHREAD_H 1
#include <sched.h>
#include <signal.h>
#include <setjmp.h>
__BEGIN_DECLS
#define PTHREAD_STACK_SIZE 16384
#if defined(__alpha__) || defined(__x86_64__) || defined(__sparc64__)
#define PTHREAD_STACK_MAXSIZE (32<<20)
#elif defined(__ia64__)
#define PTHREAD_STACK_MAXSIZE (16<<20)
#else
#define PTHREAD_STACK_MAXSIZE (8<<20)
#endif
#define PTHREAD_STACK_MINSIZE 16384
#define PTHREAD_THREADS_MAX 1024
#define MAX_SPIN_COUNT 50
#define SPIN_SLEEP_DURATION 2000001
#define PTHREAD_DESTRUCTOR_ITERATIONS 1
#define PTHREAD_KEYS_MAX 32
typedef struct _pthread_descr_struct*_pthread_descr;
typedef int pthread_t;
/* Fast locks */
#ifdef __hppa__
struct _pthread_fastlock { int __spinlock; } __attribute__((__aligned__(16)));
#define PTHREAD_SPIN_LOCKED 0
#define PTHREAD_SPIN_UNLOCKED 1
#else
struct _pthread_fastlock { int __spinlock; };
#define PTHREAD_SPIN_LOCKED 1
#define PTHREAD_SPIN_UNLOCKED 0
#endif
/* Mutexes */
typedef struct {
struct _pthread_fastlock lock;
_pthread_descr owner;
int kind;
unsigned int count;
} pthread_mutex_t;
enum {
PTHREAD_MUTEX_FAST_NP,
#define PTHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_FAST_NP
PTHREAD_MUTEX_RECURSIVE_NP,
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE_NP
PTHREAD_MUTEX_ERRORCHECK_NP,
#define PTHREAD_MUTEX_ERRORCHECK_NP PTHREAD_MUTEX_ERRORCHECK_NP
};
enum {
PTHREAD_PROCESS_PRIVATE,
#define PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE
PTHREAD_PROCESS_SHARED
#define PTHREAD_PROCESS_SHARED PTHREAD_PROCESS_SHARED
};
#define PTHREAD_MUTEX_INITIALIZER \
{{PTHREAD_SPIN_UNLOCKED},0,PTHREAD_MUTEX_FAST_NP,0}
#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
{{PTHREAD_SPIN_UNLOCKED},0,PTHREAD_MUTEX_RECURSIVE_NP,0}
#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
{{PTHREAD_SPIN_UNLOCKED},0,PTHREAD_MUTEX_ERRORCHECK_NP,0}
typedef struct {
int __mutexkind;
} pthread_mutexattr_t;
int pthread_mutexattr_init(pthread_mutexattr_t*attr);
int pthread_mutexattr_destroy(pthread_mutexattr_t*attr);
int pthread_mutexattr_getkind_np(const pthread_mutexattr_t*attr,int*kind);
int pthread_mutexattr_setkind_np(pthread_mutexattr_t*attr,int kind);
int pthread_mutex_init(pthread_mutex_t*mutex,
const pthread_mutexattr_t*mutexattr);
int pthread_mutex_lock(pthread_mutex_t*mutex);
int pthread_mutex_unlock(pthread_mutex_t*mutex);
int pthread_mutex_trylock(pthread_mutex_t*mutex);
int pthread_mutex_destroy(pthread_mutex_t*mutex);
/* Conditions */
typedef void* pthread_condattr_t;
typedef struct {
struct _pthread_fastlock lock;
_pthread_descr wait_chain;
} pthread_cond_t;
#define PTHREAD_COND_INITIALIZER \
{{PTHREAD_SPIN_UNLOCKED},0}
int pthread_cond_init(pthread_cond_t*cond,pthread_condattr_t*cond_attr);
int pthread_cond_destroy(pthread_cond_t*cond);
int pthread_cond_signal(pthread_cond_t*cond);
int pthread_cond_broadcast(pthread_cond_t*cond);
int pthread_cond_timedwait(pthread_cond_t*cond,pthread_mutex_t*mutex,
const struct timespec*abstime);
int pthread_cond_wait(pthread_cond_t*cond,pthread_mutex_t*mutex);
/* only for completeness (always return NULL) */
int pthread_condattr_init(pthread_condattr_t*attr);
int pthread_condattr_destroy(pthread_condattr_t*attr);
int pthread_condattr_getpshared(const pthread_condattr_t*attr,int*pshared);
int pthread_condattr_setpshared(pthread_condattr_t*attr,int pshared);
/* thread specific variables */
typedef unsigned int pthread_key_t;
int pthread_key_create(pthread_key_t*key,void(*destructor)(void*));
int pthread_key_delete(pthread_key_t key);
int pthread_setspecific(pthread_key_t key,const void*value);
void*pthread_getspecific(pthread_key_t key);
/* Attributes for threads. */
typedef struct {
int __detachstate;
int __schedpolicy;
struct sched_param __schedparam;
int __inheritsched;
int __scope;
void * __stackaddr;
unsigned long __stacksize;
} pthread_attr_t;
enum {
PTHREAD_CREATE_JOINABLE,
#define PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_JOINABLE
PTHREAD_CREATE_DETACHED
#define PTHREAD_CREATE_DETACHED PTHREAD_CREATE_DETACHED
};
enum {
PTHREAD_EXPLICIT_SCHED,
#define PTHREAD_EXPLICIT_SCHED PTHREAD_EXPLICIT_SCHED
PTHREAD_INHERIT_SCHED
#define PTHREAD_INHERIT_SCHED PTHREAD_INHERIT_SCHED
};
enum { /* for completeness */
PTHREAD_SCOPE_SYSTEM,
#define PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_SYSTEM
PTHREAD_SCOPE_PROCESS
#define PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_PROCESS
};
int pthread_attr_init(pthread_attr_t*attr);
int pthread_attr_destroy(pthread_attr_t*attr);
int pthread_attr_setdetachstate(pthread_attr_t*attr,const int detachstate);
int pthread_attr_getdetachstate(const pthread_attr_t*attr,int*detachstate);
int pthread_attr_setschedpolicy(pthread_attr_t*attr,const int policy);
int pthread_attr_getschedpolicy(const pthread_attr_t*attr,int*policy);
int pthread_attr_setschedparam(pthread_attr_t*attr,
const struct sched_param*param);
int pthread_attr_getschedparam(const pthread_attr_t*attr,
struct sched_param*param);
int pthread_attr_setinheritsched(pthread_attr_t*attr,const int inherit);
int pthread_attr_getinheritsched(const pthread_attr_t*attr,int*inherit);
int pthread_attr_setscope(pthread_attr_t*attr,const int scope);
int pthread_attr_getscope(const pthread_attr_t*attr,int*scope);
int pthread_attr_setstackaddr(pthread_attr_t*attr,void*stack);
int pthread_attr_getstackaddr(const pthread_attr_t*attr,void**stack);
int pthread_attr_setstacksize(pthread_attr_t*attr,const size_t stacksize);
int pthread_attr_getstacksize(const pthread_attr_t*attr,size_t*stacksize);
int pthread_setschedparam(const pthread_t target_thread,const int policy,
const struct sched_param*param);
int pthread_getschedparam(const pthread_t target_thread,int*policy,
struct sched_param*param);
/* ONCE */
typedef int pthread_once_t;
#define PTHREAD_ONCE_INIT PTHREAD_SPIN_UNLOCKED
int pthread_once(pthread_once_t*once_control,void(*init_routine)(void));
/* CANCEL */
enum {
PTHREAD_CANCEL_ENABLE,
#define PTHREAD_CANCEL_ENABLE PTHREAD_CANCEL_ENABLE
PTHREAD_CANCEL_DISABLE,
#define PTHREAD_CANCEL_DISABLE PTHREAD_CANCEL_DISABLE
};
enum {
PTHREAD_CANCEL_DEFERRED,
#define PTHREAD_CANCEL_DEFERRED PTHREAD_CANCEL_DEFERRED
PTHREAD_CANCEL_ASYNCHRONOUS,
#define PTHREAD_CANCEL_ASYNCHRONOUS PTHREAD_CANCEL_ASYNCHRONOUS
};
#define PTHREAD_CANCELED ((void *) -1)
int pthread_kill(pthread_t thread,int sig);
int pthread_cancel(pthread_t thread);
int pthread_setcancelstate(int state,int*oldstate);
int pthread_setcanceltype(int type,int*oldtype);
void pthread_testcancel(void);
/* CLEANUP */
void pthread_cleanup_push(void(*routine)(void*),void*arg);
void pthread_cleanup_pop(int execute);
void pthread_cleanup_push_defer_np(void(*routine)(void*),void*arg);
void pthread_cleanup_pop_restore_np(int execute);
/* FORK */
int pthread_atfork(void(*prepare)(void),void(*parent)(void),
void(*child)(void));
/* THREADS */
pthread_t pthread_self(void);
int pthread_create(pthread_t*__threadarg,
const pthread_attr_t*__attr,
void*(*__start_routine)(void *),
void*__arg);
void pthread_exit(void*__retval) __attribute__((__noreturn__));
int pthread_join(pthread_t __th,void**__thread_return);
int pthread_detach(pthread_t __th);
int pthread_equal(pthread_t __thread1,pthread_t __thread2);
int pthread_sigmask(int how,const sigset_t*newset,sigset_t*oldset);
/* these two aren't actually supported right now */
int pthread_mutexattr_gettype(const pthread_mutexattr_t *restrict attr, int *restrict type);
int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type);
__END_DECLS
#endif
|