Document that SMP is supported from gcc 3.3 onward
[jack_interposer.git] / manual.c
blob06d707cb079cfe2a1d48bce4e60490995fe6c1a2
1 /*
2 * This file, unlike checkers.c, is maintained manually because these
3 * checks for some reason cannot be done manually
4 */
5 int fprintf(FILE *stream, const char *format, ...)
7 va_list ap;
8 va_start(ap, format);
9 return vfprintf(stream, format, ap);
12 int printf(const char *format, ...)
14 va_list ap;
15 va_start(ap, format);
16 return vprintf(format, ap);
19 // see http://sourceware.org/ml/libc-hacker/2001-08/msg00018.html
20 bool in_calloc_dlsym = false;
22 void * calloc(size_t nmemb, size_t size)
24 static void * (*callocp)(size_t nmemb, size_t size);
25 char* error;
27 if (in_calloc_dlsym)
29 return NULL;
32 if (in_rt)
34 printf("calloc() is called while in rt section\n");
35 #if ABORT_ON_VIOLATION
36 abort();
37 #endif
39 if(!callocp)
41 in_calloc_dlsym = true;
42 callocp = (void * (*)(size_t nmemb, size_t size)) dlsym(RTLD_NEXT, "calloc");
43 in_calloc_dlsym = false;
44 if ((error = dlerror()) != NULL) {
45 fputs(error, stderr);
46 abort();
49 if(!callocp)
51 fprintf(stderr, "Error dlsym'ing calloc\n");
52 abort();
54 return(callocp(nmemb, size));
58 int pthread_cond_timedwait(pthread_cond_t * cond, pthread_mutex_t * mutex, const struct timespec* abstime)
60 static int (*func)(pthread_cond_t*, pthread_mutex_t*, const struct timespec* abstime);
62 if (in_rt)
64 printf("pthread_cond_timedwait() is called while in rt section\n");
65 #if ABORT_ON_VIOLATION
66 abort();
67 #endif
70 if(!func)
71 //func = (int (*)(pthread_cond_t*, pthread_mutex_t*)) dlsym(RTLD_NEXT, "pthread_cond_wait");
72 // see http://forums.novell.com/novell-product-support-forums/suse-linux-enterprise-server-sles/sles-configure-administer/385705-sles-10-2-java-hung-calling-pthread_cond_timedwait.html
73 func = (int (*)()) dlvsym(RTLD_NEXT, "pthread_cond_timedwait", "GLIBC_2.3.2");
74 if (func == NULL)
76 fprintf(stderr, "Error dlsym'ing\n");
77 abort();
79 return(func(cond, mutex, abstime));
83 int pthread_cond_wait(pthread_cond_t * cond, pthread_mutex_t * mutex)
85 static int (*func)(pthread_cond_t*, pthread_mutex_t*);
87 if (in_rt)
89 printf("pthread_cond_wait() is called while in rt section\n");
90 #if ABORT_ON_VIOLATION
91 abort();
92 #endif
95 if(!func)
96 //func = (int (*)(pthread_cond_t*, pthread_mutex_t*)) dlsym(RTLD_NEXT, "pthread_cond_wait");
97 // see http://forums.novell.com/novell-product-support-forums/suse-linux-enterprise-server-sles/sles-configure-administer/385705-sles-10-2-java-hung-calling-pthread_cond_timedwait.html
98 func = (int (*)(pthread_cond_t*, pthread_mutex_t*)) dlvsym(RTLD_NEXT, "pthread_cond_wait", "GLIBC_2.3.2");
99 if (func == NULL)
101 fprintf(stderr, "Error dlsym'ing\n");
102 abort();
104 return(func(cond, mutex));