2 * This file, unlike checkers.c, is maintained manually because these
3 * checks for some reason cannot be done manually
5 int fprintf(FILE *stream
, const char *format
, ...)
9 return vfprintf(stream
, format
, ap
);
12 int printf(const char *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
);
34 printf("calloc() is called while in rt section\n");
35 #if ABORT_ON_VIOLATION
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
) {
51 fprintf(stderr
, "Error dlsym'ing calloc\n");
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
);
64 printf("pthread_cond_timedwait() is called while in rt section\n");
65 #if ABORT_ON_VIOLATION
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");
76 fprintf(stderr
, "Error dlsym'ing\n");
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
*);
89 printf("pthread_cond_wait() is called while in rt section\n");
90 #if ABORT_ON_VIOLATION
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");
101 fprintf(stderr
, "Error dlsym'ing\n");
104 return(func(cond
, mutex
));