1 /* Declaration of libc stubs for pthread functions. Hurd version. 2 Copyright (C) 2003-2022 Free Software Foundation, Inc. 3 This file is part of the GNU C Library. 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, see 17 <https://www.gnu.org/licenses/>. */ 18 19 #ifndef _PTHREAD_FUNCTIONS_H 20 #define _PTHREAD_FUNCTIONS_H 1 21 22 #include <pthread.h> 23 24 int __pthread_attr_destroy (pthread_attr_t *); 25 int __pthread_attr_init (pthread_attr_t *); 26 int __pthread_attr_getdetachstate (const pthread_attr_t *, int *); 27 int __pthread_attr_setdetachstate (pthread_attr_t *, int); 28 int __pthread_attr_getinheritsched (const pthread_attr_t *, int *); 29 int __pthread_attr_setinheritsched (pthread_attr_t *, int); 30 int __pthread_attr_getschedparam (const pthread_attr_t *, 31 struct sched_param *); 32 int __pthread_attr_setschedparam (pthread_attr_t *, 33 const struct sched_param *); 34 int __pthread_attr_getschedpolicy (const pthread_attr_t *, int *); 35 int __pthread_attr_setschedpolicy (pthread_attr_t *, int); 36 int __pthread_attr_getscope (const pthread_attr_t *, int *); 37 int __pthread_attr_setscope (pthread_attr_t *, int); 38 int __pthread_condattr_destroy (pthread_condattr_t *); 39 int __pthread_condattr_init (pthread_condattr_t *); 40 int __pthread_cond_broadcast (pthread_cond_t *); 41 int __pthread_cond_destroy (pthread_cond_t *); 42 int __pthread_cond_init (pthread_cond_t *, 43 const pthread_condattr_t *); 44 int __pthread_cond_signal (pthread_cond_t *); 45 int __pthread_cond_wait (pthread_cond_t *, pthread_mutex_t *); 46 int __pthread_cond_timedwait (pthread_cond_t *, pthread_mutex_t *, 47 const struct timespec *); 48 int __pthread_equal (pthread_t, pthread_t); 49 void __pthread_exit (void *) __attribute__ ((__noreturn__)); 50 int __pthread_getschedparam (pthread_t, int *, struct sched_param *); 51 int __pthread_setschedparam (pthread_t, int, 52 const struct sched_param *); 53 int _pthread_mutex_destroy (pthread_mutex_t *); 54 int _pthread_mutex_init (pthread_mutex_t *, 55 const pthread_mutexattr_t *); 56 int __pthread_mutex_lock (pthread_mutex_t *); 57 int __pthread_mutex_trylock (pthread_mutex_t *); 58 int __pthread_mutex_unlock (pthread_mutex_t *); 59 pthread_t __pthread_self (void); 60 int __pthread_setcancelstate (int, int *); 61 int __pthread_setcanceltype (int, int *); 62 struct __pthread_cancelation_handler **__pthread_get_cleanup_stack (void); 63 int __pthread_once (pthread_once_t *, void (*) (void)); 64 int __pthread_rwlock_rdlock (pthread_rwlock_t *); 65 int __pthread_rwlock_wrlock (pthread_rwlock_t *); 66 int __pthread_rwlock_unlock (pthread_rwlock_t *); 67 int __pthread_key_create (pthread_key_t *, void (*) (void *)); 68 void *__pthread_getspecific (pthread_key_t); 69 int __pthread_setspecific (pthread_key_t, const void *); 70 71 void _cthreads_flockfile (FILE *); 72 void _cthreads_funlockfile (FILE *); 73 int _cthreads_ftrylockfile (FILE *); 74 75 /* Data type shared with libc. The libc uses it to pass on calls to 76 the thread functions. Wine pokes directly into this structure, 77 so if possible avoid breaking it and append new hooks to the end. */ 78 struct pthread_functions 79 { 80 int (*ptr_pthread_attr_destroy) (pthread_attr_t *); 81 int (*ptr_pthread_attr_init) (pthread_attr_t *); 82 int (*ptr_pthread_attr_getdetachstate) (const pthread_attr_t *, int *); 83 int (*ptr_pthread_attr_setdetachstate) (pthread_attr_t *, int); 84 int (*ptr_pthread_attr_getinheritsched) (const pthread_attr_t *, int *); 85 int (*ptr_pthread_attr_setinheritsched) (pthread_attr_t *, int); 86 int (*ptr_pthread_attr_getschedparam) (const pthread_attr_t *, 87 struct sched_param *); 88 int (*ptr_pthread_attr_setschedparam) (pthread_attr_t *, 89 const struct sched_param *); 90 int (*ptr_pthread_attr_getschedpolicy) (const pthread_attr_t *, int *); 91 int (*ptr_pthread_attr_setschedpolicy) (pthread_attr_t *, int); 92 int (*ptr_pthread_attr_getscope) (const pthread_attr_t *, int *); 93 int (*ptr_pthread_attr_setscope) (pthread_attr_t *, int); 94 int (*ptr_pthread_condattr_destroy) (pthread_condattr_t *); 95 int (*ptr_pthread_condattr_init) (pthread_condattr_t *); 96 int (*ptr_pthread_cond_broadcast) (pthread_cond_t *); 97 int (*ptr_pthread_cond_destroy) (pthread_cond_t *); 98 int (*ptr_pthread_cond_init) (pthread_cond_t *, 99 const pthread_condattr_t *); 100 int (*ptr_pthread_cond_signal) (pthread_cond_t *); 101 int (*ptr_pthread_cond_wait) (pthread_cond_t *, pthread_mutex_t *); 102 int (*ptr_pthread_cond_timedwait) (pthread_cond_t *, pthread_mutex_t *, 103 const struct timespec *); 104 int (*ptr_pthread_equal) (pthread_t, pthread_t); 105 void (*ptr___pthread_exit) (void *) __attribute__ ((__noreturn__)); 106 int (*ptr_pthread_getschedparam) (pthread_t, int *, struct sched_param *); 107 int (*ptr_pthread_setschedparam) (pthread_t, int, 108 const struct sched_param *); 109 int (*ptr_pthread_mutex_destroy) (pthread_mutex_t *); 110 int (*ptr_pthread_mutex_init) (pthread_mutex_t *, 111 const pthread_mutexattr_t *); 112 int (*ptr_pthread_mutex_lock) (pthread_mutex_t *); 113 int (*ptr_pthread_mutex_trylock) (pthread_mutex_t *); 114 int (*ptr_pthread_mutex_unlock) (pthread_mutex_t *); 115 pthread_t (*ptr_pthread_self) (void); 116 int (*ptr___pthread_setcancelstate) (int, int *); 117 int (*ptr_pthread_setcanceltype) (int, int *); 118 struct __pthread_cancelation_handler **(*ptr___pthread_get_cleanup_stack) (void); 119 int (*ptr_pthread_once) (pthread_once_t *, void (*) (void)); 120 int (*ptr_pthread_rwlock_rdlock) (pthread_rwlock_t *); 121 int (*ptr_pthread_rwlock_wrlock) (pthread_rwlock_t *); 122 int (*ptr_pthread_rwlock_unlock) (pthread_rwlock_t *); 123 int (*ptr___pthread_key_create) (pthread_key_t *, void (*) (void *)); 124 void *(*ptr___pthread_getspecific) (pthread_key_t); 125 int (*ptr___pthread_setspecific) (pthread_key_t, const void *); 126 void (*ptr__IO_flockfile) (FILE *); 127 void (*ptr__IO_funlockfile) (FILE *); 128 int (*ptr__IO_ftrylockfile) (FILE *); 129 }; 130 131 /* Variable in libc.so. */ 132 extern struct pthread_functions __libc_pthread_functions attribute_hidden; 133 extern int __libc_pthread_functions_init attribute_hidden; 134 135 void __libc_pthread_init (const struct pthread_functions *functions); 136 137 #define PTHFCT_CALL(fct, params) \ 138 __libc_pthread_functions.fct params 139 140 #endif /* pthread-functions.h */ 141