* 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

@ -1,5 +1,12 @@
2005-10-14 Ulrich Drepper <drepper@redhat.com>
* 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.
* stdlib/Makefile (tests): Add tst-ucontext-off.
* stdlib/tst-ucontext-off.c: New file.
* sysdeps/unix/sysv/linux/x86_64/ucontext_i.h (TEST): Define.
@ -36,6 +43,9 @@
adjust leading comment.
* sysdeps/unix/sysv/linux/syscalls.list: Add pointer parameter to
mremap syscall.
* include/sys/mman.h (__mremap): Add ellipsis.
* malloc/memusage.c: Adjust mremap wrapper for optional additional
parameter.
2005-10-13 Ulrich Drepper <drepper@redhat.com>

View File

@ -24,5 +24,6 @@ extern int __alphasort64 (const void *a, const void *b)
__attribute_pure__;
extern int __versionsort64 (const void *a, const void *b)
__attribute_pure__;
extern DIR *__alloc_dir (int fd, struct stat64 *statp) internal_function;
extern DIR *__alloc_dir (int fd, bool close_fd, struct stat64 *statp)
internal_function;
#endif

View File

@ -11,5 +11,5 @@ extern int __mprotect (void *__addr, size_t __len, int __prot);
/* This one is Linux specific. */
extern void *__mremap (void *__addr, size_t __old_len,
size_t __new_len, int __may_move);
size_t __new_len, int __flags, ...);
#endif

View File

@ -453,6 +453,33 @@ END LC_COLLATE
LC_CTYPE
copy "i18n"
translit_start
include "translit_combining";""
<U00C1> "<U0041><U0301>";"<U0041><U00B4>";"<U0041><U0027>"
<U00C9> "<U0045><U0301>";"<U0045><U00B4>";"<U0045><U0027>"
<U00CD> "<U0049><U0301>";"<U0049><U00B4>";"<U0049><U0027>"
<U00D3> "<U004F><U0301>";"<U004F><U00B4>";"<U004F><U0027>"
<U00D6> "<U004F><U0308>";"<U004F><U00A8>";"<U004F><U003A>"
<U0150> "<U004F><U030B>";"<U004F><U02DD>";"<U004F><U0022>"
<U00DA> "<U0055><U0301>";"<U0055><U00B4>";"<U0055><U0027>"
<U00DC> "<U0055><U0308>";"<U0055><U00A8>";"<U0055><U003A>"
<U0170> "<U0055><U030B>";"<U0055><U02DD>";"<U0055><U0022>"
<U00E1> "<U0061><U0301>";"<U0061><U00B4>";"<U0061><U0027>"
<U00E9> "<U0065><U0301>";"<U0065><U00B4>";"<U0065><U0027>"
<U00ED> "<U0069><U0301>";"<U0069><U00B4>";"<U0069><U0027>"
<U00F3> "<U006F><U0301>";"<U006F><U00B4>";"<U006F><U0027>"
<U00F6> "<U006F><U0308>";"<U006F><U00A8>";"<U006F><U003A>"
<U0151> "<U006F><U030B>";"<U006F><U02DD>";"<U006F><U0022>"
<U00FA> "<U0075><U0301>";"<U0075><U00B4>";"<U0075><U0027>"
<U00FC> "<U0075><U0308>";"<U0075><U00A8>";"<U0075><U003A>"
<U0171> "<U0075><U030B>";"<U0075><U02DD>";"<U0075><U0022>"
translit_end
END LC_CTYPE
LC_MESSAGES
@ -526,6 +553,7 @@ am_pm "";""
t_fmt_ampm "<U0025><U0048><U002E><U0025><U004D><U002E><U0025><U0053>"
date_fmt "<U0025><U0059><U002E><U0020><U0025><U0062><U002E><U0020><U0025><U0065><U002E><U002C>/
<U0020><U0025><U0041><U002C><U0020><U0025><U0048><U002E><U0025><U004D><U002E><U0025><U0053><U0020><U0025><U005A>"
week 7;19971201;4
END LC_TIME
LC_PAPER

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)
{

View File

@ -29,14 +29,12 @@ fdopendir (int fd)
struct stat64 statbuf;
if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &statbuf), 0) < 0)
goto out;
return NULL;
if (__builtin_expect (! S_ISDIR (statbuf.st_mode), 0))
{
__set_errno (ENOTDIR);
out:
close_not_cancel_no_status (fd);
return NULL;
}
return __alloc_dir (fd, &statbuf);
return __alloc_dir (fd, false, &statbuf);
}

View File

@ -132,14 +132,14 @@ __opendir (const char *name)
}
}
return __alloc_dir (fd, &statbuf);
return __alloc_dir (fd, true, &statbuf);
}
weak_alias (__opendir, opendir)
DIR *
internal_function
__alloc_dir (int fd, struct stat64 *statp)
__alloc_dir (int fd, bool close_fd, struct stat64 *statp)
{
if (__builtin_expect (__fcntl (fd, F_SETFD, FD_CLOEXEC), 0) < 0)
goto lose;
@ -160,9 +160,12 @@ __alloc_dir (int fd, struct stat64 *statp)
if (dirp == NULL)
lose:
{
int save_errno = errno;
close_not_cancel_no_status (fd);
__set_errno (save_errno);
if (close_fd)
{
int save_errno = errno;
close_not_cancel_no_status (fd);
__set_errno (save_errno);
}
return NULL;
}
memset (dirp, '\0', sizeof (DIR));