From dc0bc6941130c89db3d2d7b61479dc2ef9185b5c Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Mon, 30 Jul 2007 16:51:48 +0000 Subject: introduce __uc_malloc, so that users can intercept libc internal OOM. --- include/malloc.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/malloc.h b/include/malloc.h index 354f153d4..05eac9fdd 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -183,6 +183,13 @@ extern int mallopt __MALLOC_P ((int __param, int __val)); #endif /* __MALLOC_STANDARD__ */ +/* uClibc may use malloc internally in situations where user can not be + * notified about out-of-memory condition. In this situation uClibc will + * call __uc_malloc_failed if it is non-NULL, and retry allocation + * if it returns. If __uc_malloc_failed is NULL, uclubc will _exit(1). + * NB: do not use stdio in __uc_malloc_failed handler! */ +extern void *__uc_malloc(size_t size); +extern void (*__uc_malloc_failed)(size_t size); #ifdef __cplusplus } /* end of extern "C" */ -- cgit v1.2.3