1 /* Copyright (C) 2003 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3    Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
4 
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9 
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, write to the Free
17    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18    02111-1307 USA.  */
19 
20 #ifndef _PTHREAD_FUNCTIONS_H
21 #define _PTHREAD_FUNCTIONS_H	1
22 
23 #include <pthread.h>
24 #include <setjmp.h>
25 #include "descr.h"
26 
27 struct fork_block;
28 
29 /* Data type shared with libc.  The libc uses it to pass on calls to
30    the thread functions.  Wine pokes directly into this structure,
31    so if possible avoid breaking it and append new hooks to the end.  */
32 struct pthread_functions
33 {
34   pid_t (*ptr_pthread_fork) (struct fork_block *);
35   int (*ptr_pthread_attr_destroy) (pthread_attr_t *);
36   int (*ptr_pthread_attr_init) (pthread_attr_t *);
37   int (*ptr_pthread_attr_getdetachstate) (const pthread_attr_t *, int *);
38   int (*ptr_pthread_attr_setdetachstate) (pthread_attr_t *, int);
39   int (*ptr_pthread_attr_getinheritsched) (const pthread_attr_t *, int *);
40   int (*ptr_pthread_attr_setinheritsched) (pthread_attr_t *, int);
41   int (*ptr_pthread_attr_getschedparam) (const pthread_attr_t *,
42 					 struct sched_param *);
43   int (*ptr_pthread_attr_setschedparam) (pthread_attr_t *,
44 					 const struct sched_param *);
45   int (*ptr_pthread_attr_getschedpolicy) (const pthread_attr_t *, int *);
46   int (*ptr_pthread_attr_setschedpolicy) (pthread_attr_t *, int);
47   int (*ptr_pthread_attr_getscope) (const pthread_attr_t *, int *);
48   int (*ptr_pthread_attr_setscope) (pthread_attr_t *, int);
49   int (*ptr_pthread_condattr_destroy) (pthread_condattr_t *);
50   int (*ptr_pthread_condattr_init) (pthread_condattr_t *);
51   int (*ptr_pthread_cond_broadcast) (pthread_cond_t *);
52   int (*ptr_pthread_cond_destroy) (pthread_cond_t *);
53   int (*ptr_pthread_cond_init) (pthread_cond_t *,
54 				  const pthread_condattr_t *);
55   int (*ptr_pthread_cond_signal) (pthread_cond_t *);
56   int (*ptr_pthread_cond_wait) (pthread_cond_t *, pthread_mutex_t *);
57   int (*ptr_pthread_equal) (pthread_t, pthread_t);
58   void (*ptr___pthread_exit) (void *);
59   int (*ptr_pthread_getschedparam) (pthread_t, int *, struct sched_param *);
60   int (*ptr_pthread_setschedparam) (pthread_t, int,
61 				    const struct sched_param *);
62   int (*ptr_pthread_mutex_destroy) (pthread_mutex_t *);
63   int (*ptr_pthread_mutex_init) (pthread_mutex_t *,
64 				 const pthread_mutexattr_t *);
65   int (*ptr_pthread_mutex_lock) (pthread_mutex_t *);
66   int (*ptr_pthread_mutex_trylock) (pthread_mutex_t *);
67   int (*ptr_pthread_mutex_unlock) (pthread_mutex_t *);
68   pthread_t (*ptr_pthread_self) (void);
69   int (*ptr_pthread_setcancelstate) (int, int *);
70   int (*ptr_pthread_setcanceltype) (int, int *);
71   void (*ptr_pthread_do_exit) (void *retval, char *currentframe);
72   void (*ptr_pthread_cleanup_upto) (__jmp_buf target,
73 				    char *targetframe);
74   pthread_descr (*ptr_pthread_thread_self) (void);
75   int (*ptr_pthread_internal_tsd_set) (int key, const void *pointer);
76   void * (*ptr_pthread_internal_tsd_get) (int key);
77   void ** __attribute__ ((__const__))
78     (*ptr_pthread_internal_tsd_address) (int key);
79 #ifdef __NOT_FOR_L4__
80   int (*ptr_pthread_sigaction) (int sig, const struct sigaction * act,
81 				struct sigaction *oact);
82   int (*ptr_pthread_sigwait) (const sigset_t *set, int *sig);
83   int (*ptr_pthread_raise) (int sig);
84 #else
85   void *ptr_pthread_sigaction;
86   void *ptr_pthread_sigwait;
87   void *ptr_pthread_raise;
88 #endif
89   int (*ptr_pthread_cond_timedwait) (pthread_cond_t *, pthread_mutex_t *,
90 				       const struct timespec *);
91   void (*ptr__pthread_cleanup_push) (struct _pthread_cleanup_buffer * buffer,
92 				     void (*routine)(void *), void * arg);
93   void (*ptr__pthread_cleanup_push_defer) (struct _pthread_cleanup_buffer * buffer,
94 					   void (*routine)(void *), void * arg);
95   void (*ptr__pthread_cleanup_pop) (struct _pthread_cleanup_buffer * buffer,
96 				    int execute);
97   void (*ptr__pthread_cleanup_pop_restore) (struct _pthread_cleanup_buffer * buffer,
98 					    int execute);
99 };
100 
101 /* Variable in libc.so.  */
102 extern struct pthread_functions __libc_pthread_functions attribute_hidden;
103 
104 #endif	/* pthread-functions.h */
105