This is the mail archive of the libc-alpha@sourceware.org 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] | |
Hi, just like it is done also for other functions, add a __ASSUME_MREMAP in kernel-features.h (only in the Linux version) to indicate the availability of mremap; this is used to uniform the two existing checks: - malloc.c enables it if linux is defined - libio uses _G_HAVE_MREMAP (from _G_config.h) The comment for __ASSUME_MREMAP in kernel-features.h has been taken from malloc.c, just above the HAVE_MREMAP definition. After this patch, sysdeps/unix/sysv/linux/_G_config.h becomes the same as sysdeps/generic/_G_config.h; after review and commit of this, I will send a new patch to get rid of the linux _G_config.h. Thanks, -- Pino Toscano
Add and use __ASSUME_MREMAP for mremap usage
Introduce a __ASSUME_MREMAP symbol to advertize mremap availability, and use
it also to replace _G_HAVE_MREMAP.
2012-11-10 Pino Toscano <toscano.pino@tiscali.it>
* sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_MREMAP): New
define.
* malloc/malloc.c: Include <kernel-features.h>.
[!HAVE_MREMAP] [linux]: Change condition to
[defined(linux) || defined(__ASSUME_MREMAP)].
* sysdeps/unix/sysv/linux/_G_config.h (_G_HAVE_MREMAP): Remove.
* libio/fileops.c: Include <kernel-features.h> unconditionally.
(mmap_remap_check) [_G_HAVE_MREMAP]: Change condition to
[__ASSUME_MREMAP].
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -168,7 +168,7 @@
Compilation Environment options:
- HAVE_MREMAP 0 unless linux defined
+ HAVE_MREMAP 0 unless linux or __ASSUME_MREMAP defined
Changing default word sizes:
@@ -230,6 +230,8 @@
#include <shlib-compat.h>
+#include <kernel-features.h>
+
/* For uintptr_t. */
#include <stdint.h>
@@ -495,7 +497,7 @@ void *(*__morecore)(ptrdiff_t) = __defau
*/
#ifndef HAVE_MREMAP
-#ifdef linux
+#if defined(linux) || defined(__ASSUME_MREMAP)
#define HAVE_MREMAP 1
#else
#define HAVE_MREMAP 0
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -37,6 +37,9 @@
introduced. If somebody cares these values can afterwards be
corrected. */
+/* A usable mremap is available since 1.3.77. */
+#define __ASSUME_MREMAP 1
+
/* The sendfile syscall was introduced in 2.2.0. */
#define __ASSUME_SENDFILE 1
--- a/sysdeps/unix/sysv/linux/_G_config.h
+++ b/sysdeps/unix/sysv/linux/_G_config.h
@@ -46,7 +46,6 @@ typedef union
#define _G_va_list __gnuc_va_list
#define _G_HAVE_MMAP 1
-#define _G_HAVE_MREMAP 1
#define _G_IO_IO_FILE_VERSION 0x20001
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -39,13 +39,13 @@
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
+#include <kernel-features.h>
#if _LIBC
# include "../wcsmbs/wcsmbsload.h"
# include "../iconv/gconv_charset.h"
# include "../iconv/gconv_int.h"
# include <shlib-compat.h>
# include <not-cancel.h>
-# include <kernel-features.h>
#endif
#ifndef errno
extern int errno;
@@ -658,7 +658,7 @@ mmap_remap_check (_IO_FILE *fp)
{
/* The file added some pages. We need to remap it. */
void *p;
-#ifdef _G_HAVE_MREMAP
+#ifdef __ASSUME_MREMAP
p = __mremap (fp->_IO_buf_base, ROUNDED (fp->_IO_buf_end
- fp->_IO_buf_base),
ROUNDED (st.st_size), MREMAP_MAYMOVE);
Attachment:
signature.asc
Description: This is a digitally signed message part.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |