Debian Codegraph @

psx/wrap/psx_wrap.c

raw
1 #include <pthread.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4
5 extern int __real_pthread_create(pthread_t *thread, const pthread_attr_t *attr,
6 void *(*start_routine) (void *), void *arg);
7
8 extern int __wrap_pthread_create(pthread_t *thread, const pthread_attr_t *attr,
9 void *(*start_routine) (void *), void *arg);
10
11 /*
12 * psx requires this function to be provided by the linkage wrapping.
13 */
14 int __attribute__((weak))
15 __real_pthread_create(pthread_t *thread, const pthread_attr_t *attr,
16 void *(*start_routine) (void *), void *arg) {
17 if (&pthread_create == &__wrap_pthread_create) {
18 fprintf(stderr, "libpsx is not linked correctly\n");
19 exit(1);
20 }
21 return pthread_create(thread, attr, start_routine, arg);
22 }