This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

not defined MALLOC_FAILURE_ACTION in malloc.c of cvs'sglibc-2.2.5


Hi!

I have problem today cvs's glibc-2.2.5, 
so I used the patch from glibc-2.2.90.

malloc.c: In function `__libc_calloc':
malloc.c:3811: `MALLOC_FAILURE_ACTION' undeclared (first use in this function)
malloc.c:3811: (Each undeclared identifier is reported only once
malloc.c:3811: for each function it appears in.)
make[2]: *** [/usr/src/redhat/BUILD/libc/build-ppc-linux/malloc/malloc.o] Error 1

This is grep result.

[root@g4mpkfukui libc-2.2.5]# grep -rn  MALLOC_FAILURE_ACTION *
malloc/malloc.c:3811:      MALLOC_FAILURE_ACTION;
[root@g4mpkfukui libc-2.2.5]# 

Another question is REALLOC_ZERO_BYTES_FREES.

glibc-2.2.90's REALLOC_ZERO_BYTES_FREES is set 1,
but glibc-2.2.5's REALLOC_ZERO_BYTES_FREES is empty,
Why ?
#define REALLOC_ZERO_BYTES_FREES

Please look those problems around glibc-2.2.5 cvs.

Kaoru
====================================================

--------------My MALLOC_FAILURE_ACTION patch ---------
diff -urN base/malloc/malloc.c fixed/malloc/malloc.c
--- base/malloc/malloc.c	Fri Aug  9 17:06:17 2002
+++ fixed/malloc/malloc.c	Sat Aug 10 01:11:35 2002
@@ -384,7 +384,9 @@
 */
 
 
-#define REALLOC_ZERO_BYTES_FREES
+#ifndef REALLOC_ZERO_BYTES_FREES
+#define REALLOC_ZERO_BYTES_FREES 1
+#endif
 
 
 /*
@@ -423,6 +425,25 @@
 #endif
 #endif
 
+/*
+  MALLOC_FAILURE_ACTION is the action to take before "return 0" when
+  malloc fails to be able to return memory, either because memory is
+  exhausted or because of illegal arguments.
+
+  By default, sets errno if running on STD_C platform, else does nothing.
+*/
+
+#ifndef MALLOC_FAILURE_ACTION
+#if __STD_C
+#define MALLOC_FAILURE_ACTION \
+   errno = ENOMEM;
+
+#else
+#define MALLOC_FAILURE_ACTION
+#endif
+#endif
+
+
 /* The following macros are only invoked with (2n+1)-multiples of
    INTERNAL_SIZE_T units, with a positive integer n. This is exploited
    for fast inline execution when n is small.  If the regions to be



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]