1 /* Declaration of libc stubs for pthread functions. Hurd version.
2 Copyright (C) 2003-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 #ifndef _PTHREAD_FUNCTIONS_H
20 #define _PTHREAD_FUNCTIONS_H 1
24 int __pthread_attr_destroy (pthread_attr_t
*);
25 int __pthread_attr_init (pthread_attr_t
*);
26 int __pthread_attr_setschedparam (pthread_attr_t
*,
27 const struct sched_param
*);
28 int __pthread_attr_getscope (const pthread_attr_t
*, int *);
29 int __pthread_attr_setscope (pthread_attr_t
*, int);
30 int __pthread_condattr_destroy (pthread_condattr_t
*);
31 int __pthread_condattr_init (pthread_condattr_t
*);
32 int __pthread_cond_broadcast (pthread_cond_t
*);
33 int __pthread_cond_destroy (pthread_cond_t
*);
34 int __pthread_cond_init (pthread_cond_t
*,
35 const pthread_condattr_t
*);
36 int __pthread_cond_signal (pthread_cond_t
*);
37 int __pthread_cond_wait (pthread_cond_t
*, pthread_mutex_t
*);
38 int __pthread_cond_timedwait (pthread_cond_t
*, pthread_mutex_t
*,
39 const struct timespec
*);
40 void __pthread_exit (void *) __attribute__ ((__noreturn__
));
41 int _pthread_mutex_destroy (pthread_mutex_t
*);
42 int _pthread_mutex_init (pthread_mutex_t
*,
43 const pthread_mutexattr_t
*);
44 int __pthread_mutex_lock (pthread_mutex_t
*);
45 int __pthread_mutex_trylock (pthread_mutex_t
*);
46 int __pthread_mutex_unlock (pthread_mutex_t
*);
47 int __pthread_setcancelstate (int, int *);
48 int __pthread_setcanceltype (int, int *);
49 struct __pthread_cancelation_handler
**__pthread_get_cleanup_stack (void);
50 int __pthread_once (pthread_once_t
*, void (*) (void));
51 int __pthread_rwlock_rdlock (pthread_rwlock_t
*);
52 int __pthread_rwlock_wrlock (pthread_rwlock_t
*);
53 int __pthread_rwlock_unlock (pthread_rwlock_t
*);
54 int __pthread_key_create (pthread_key_t
*, void (*) (void *));
55 void *__pthread_getspecific (pthread_key_t
);
56 int __pthread_setspecific (pthread_key_t
, const void *);
58 void _cthreads_flockfile (FILE *);
59 void _cthreads_funlockfile (FILE *);
60 int _cthreads_ftrylockfile (FILE *);
62 /* Data type shared with libc. The libc uses it to pass on calls to
63 the thread functions. Wine pokes directly into this structure,
64 so if possible avoid breaking it and append new hooks to the end. */
65 struct pthread_functions
67 int (*ptr_pthread_attr_destroy
) (pthread_attr_t
*);
68 int (*ptr_pthread_attr_init
) (pthread_attr_t
*);
69 int (*ptr_pthread_attr_setschedparam
) (pthread_attr_t
*,
70 const struct sched_param
*);
71 int (*ptr_pthread_attr_getscope
) (const pthread_attr_t
*, int *);
72 int (*ptr_pthread_attr_setscope
) (pthread_attr_t
*, int);
73 int (*ptr_pthread_condattr_destroy
) (pthread_condattr_t
*);
74 int (*ptr_pthread_condattr_init
) (pthread_condattr_t
*);
75 int (*ptr_pthread_cond_broadcast
) (pthread_cond_t
*);
76 int (*ptr_pthread_cond_destroy
) (pthread_cond_t
*);
77 int (*ptr_pthread_cond_init
) (pthread_cond_t
*,
78 const pthread_condattr_t
*);
79 int (*ptr_pthread_cond_signal
) (pthread_cond_t
*);
80 int (*ptr_pthread_cond_wait
) (pthread_cond_t
*, pthread_mutex_t
*);
81 int (*ptr_pthread_cond_timedwait
) (pthread_cond_t
*, pthread_mutex_t
*,
82 const struct timespec
*);
83 void (*ptr___pthread_exit
) (void *) __attribute__ ((__noreturn__
));
84 int (*ptr_pthread_mutex_destroy
) (pthread_mutex_t
*);
85 int (*ptr_pthread_mutex_init
) (pthread_mutex_t
*,
86 const pthread_mutexattr_t
*);
87 int (*ptr_pthread_mutex_lock
) (pthread_mutex_t
*);
88 int (*ptr_pthread_mutex_trylock
) (pthread_mutex_t
*);
89 int (*ptr_pthread_mutex_unlock
) (pthread_mutex_t
*);
90 int (*ptr___pthread_setcancelstate
) (int, int *);
91 int (*ptr_pthread_setcanceltype
) (int, int *);
92 struct __pthread_cancelation_handler
**(*ptr___pthread_get_cleanup_stack
) (void);
93 int (*ptr_pthread_once
) (pthread_once_t
*, void (*) (void));
94 int (*ptr_pthread_rwlock_rdlock
) (pthread_rwlock_t
*);
95 int (*ptr_pthread_rwlock_wrlock
) (pthread_rwlock_t
*);
96 int (*ptr_pthread_rwlock_unlock
) (pthread_rwlock_t
*);
97 int (*ptr___pthread_key_create
) (pthread_key_t
*, void (*) (void *));
98 void *(*ptr___pthread_getspecific
) (pthread_key_t
);
99 int (*ptr___pthread_setspecific
) (pthread_key_t
, const void *);
100 void (*ptr__IO_flockfile
) (FILE *);
101 void (*ptr__IO_funlockfile
) (FILE *);
102 int (*ptr__IO_ftrylockfile
) (FILE *);
105 /* Variable in libc.so. */
106 extern struct pthread_functions __libc_pthread_functions attribute_hidden
;
107 extern int __libc_pthread_functions_init attribute_hidden
;
109 void __libc_pthread_init (const struct pthread_functions
*functions
);
111 #define PTHFCT_CALL(fct, params) \
112 __libc_pthread_functions.fct params
114 #endif /* pthread-functions.h */