1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

* sysdeps/unix/opendir.c (__opendir): Pass extra argument to

__alloc_dir.
	(__alloc_dir): Only close descriptor on error if new parameter is true.
	* sysdeps/unix/fdopendir.c (fdopendir): Pass extra argument to
	__alloc_dir.  Don't close fd on error.
	* include/dirent.h (__alloc_dir): Adjust prototype.

	* include/sys/mman.h (__mremap): Add ellipsis.
	* malloc/memusage.c: Adjust mremap wrapper for optional additional
	parameter.
This commit is contained in:
Ulrich Drepper
2005-10-14 21:11:09 +00:00
parent f9126cc23e
commit 18b8e054cf
7 changed files with 62 additions and 16 deletions

View File

@ -24,6 +24,7 @@
#include <fcntl.h>
#include <inttypes.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@ -44,7 +45,7 @@ static void (*freep) (void *);
static void *(*mmapp) (void *, size_t, int, int, int, off_t);
static void *(*mmap64p) (void *, size_t, int, int, int, off64_t);
static int (*munmapp) (void *, size_t);
static void *(*mremapp) (void *, size_t, size_t, int);
static void *(*mremapp) (void *, size_t, size_t, int, void *);
enum
{
@ -226,8 +227,8 @@ me (void)
mmap64p =
(void *(*) (void *, size_t, int, int, int, off64_t)) dlsym (RTLD_NEXT,
"mmap64");
mremapp = (void *(*) (void *, size_t, size_t, int)) dlsym (RTLD_NEXT,
"mremap");
mremapp = (void *(*) (void *, size_t, size_t, int, void *)) dlsym (RTLD_NEXT,
"mremap");
munmapp = (int (*) (void *, size_t)) dlsym (RTLD_NEXT, "munmap");
initialized = 1;
@ -649,9 +650,14 @@ mmap64 (void *start, size_t len, int prot, int flags, int fd, off64_t offset)
/* `mmap' replacement. We do not have to keep track of the sizesince
`munmap' will get it as a parameter. */
void *
mremap (void *start, size_t old_len, size_t len, int flags)
mremap (void *start, size_t old_len, size_t len, int flags, ...)
{
void *result = NULL;
va_list ap;
va_start (ap, flags);
void *newaddr = (flags & MREMAP_FIXED) ? va_arg (ap, void *) : NULL;
va_end (ap);
/* Determine real implementation if not already happened. */
if (__builtin_expect (initialized <= 0, 0))
@ -662,7 +668,7 @@ mremap (void *start, size_t old_len, size_t len, int flags)
}
/* Always get a block. We don't need extra memory. */
result = (*mremapp) (start, old_len, len, flags);
result = (*mremapp) (start, old_len, len, flags, newaddr);
if (!not_me && trace_mmap)
{