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]

Re: [patch] mremap


At Mon, 08 Nov 2004 07:35:34 -0800,
Ulrich Drepper <drepper@redhat.com> wrote:
> > Do you want another patch that does what you suggest?
> 
> Yes.

Ok, here it is.

Thanks,
Marcus

2004-11-03  Marcus Brinkmann  <marcus@gnu.org>

	* sysdeps/gnu/_G_config.h (_G_HAVE_MREMAP): Define symbol.
	* sysdeps/mach/hurd/_G_config.h: New file.
	* libio/fileops.c (mmap_remap_check) [__linux__]: Replaced with
	[_G_HAVE_MREMAP].

diff -rupN libc-previous/libio/fileops.c libc/libio/fileops.c
--- libc-previous/libio/fileops.c	2004-11-03 02:14:02.000000000 +0100
+++ libc/libio/fileops.c	2004-11-08 16:52:28.000000000 +0100
@@ -635,7 +635,7 @@ mmap_remap_check (_IO_FILE *fp)
 	{
 	  /* The file added some pages.  We need to remap it.  */
 	  void *p;
-#if defined __linux__		/* XXX */
+#ifdef _G_HAVE_MREMAP
 	  p = __mremap (fp->_IO_buf_base, ROUNDED (fp->_IO_buf_end
 						   - fp->_IO_buf_base),
 			ROUNDED (st.st_size), MREMAP_MAYMOVE);
diff -rupN libc-previous/sysdeps/gnu/_G_config.h libc/sysdeps/gnu/_G_config.h
--- libc-previous/sysdeps/gnu/_G_config.h	2004-11-03 02:14:02.000000000 +0100
+++ libc/sysdeps/gnu/_G_config.h	2004-11-08 16:52:28.000000000 +0100
@@ -69,6 +69,7 @@ typedef unsigned int _G_uint32_t __attri
 
 #define _G_HAVE_PRINTF_FP 1
 #define _G_HAVE_MMAP 1
+#define _G_HAVE_MREMAP 1
 #define _G_HAVE_LONG_DOUBLE_IO 1
 #define _G_HAVE_IO_FILE_OPEN 1
 #define _G_HAVE_IO_GETLINE_INFO 1
diff -rupN libc-previous/sysdeps/mach/hurd/_G_config.h libc/sysdeps/mach/hurd/_G_config.h
--- libc-previous/sysdeps/mach/hurd/_G_config.h	1970-01-01 01:00:00.000000000 +0100
+++ libc/sysdeps/mach/hurd/_G_config.h	2004-11-08 16:52:28.000000000 +0100
@@ -0,0 +1,102 @@
+/* This file is needed by libio to define various configuration parameters.
+   These are always the same in the GNU C library.  */
+
+#ifndef _G_config_h
+#define _G_config_h 1
+
+/* Define types for libio in terms of the standard internal type names.  */
+
+#include <bits/types.h>
+#define __need_size_t
+#define __need_wchar_t
+#define __need_wint_t
+#define __need_NULL
+#include <stddef.h>
+#ifndef _WINT_T
+/* Integral type unchanged by default argument promotions that can
+   hold any value corresponding to members of the extended character
+   set, as well as at least one value that does not correspond to any
+   member of the extended character set.  */
+# define _WINT_T
+typedef unsigned int wint_t;
+#endif
+#define __need_mbstate_t
+#include <wchar.h>
+#define _G_size_t	size_t
+typedef struct
+{
+  __off_t __pos;
+  __mbstate_t __state;
+} _G_fpos_t;
+typedef struct
+{
+  __off64_t __pos;
+  __mbstate_t __state;
+} _G_fpos64_t;
+#define _G_ssize_t	__ssize_t
+#define _G_off_t	__off_t
+#define _G_off64_t	__off64_t
+#define	_G_pid_t	__pid_t
+#define	_G_uid_t	__uid_t
+#define _G_wchar_t	wchar_t
+#define _G_wint_t	wint_t
+#define _G_stat64	stat64
+#include <gconv.h>
+typedef union
+{
+  struct __gconv_info __cd;
+  struct
+  {
+    struct __gconv_info __cd;
+    struct __gconv_step_data __data;
+  } __combined;
+} _G_iconv_t;
+
+typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
+typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
+typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
+typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
+
+#define _G_HAVE_BOOL 1
+
+
+/* These library features are always available in the GNU C library.  */
+#define _G_HAVE_ATEXIT 1
+#define _G_HAVE_SYS_CDEFS 1
+#define _G_HAVE_SYS_WAIT 1
+#define _G_NEED_STDARG_H 1
+#define _G_va_list __gnuc_va_list
+
+#define _G_HAVE_PRINTF_FP 1
+#define _G_HAVE_MMAP 1
+#define _G_HAVE_LONG_DOUBLE_IO 1
+#define _G_HAVE_IO_FILE_OPEN 1
+#define _G_HAVE_IO_GETLINE_INFO 1
+
+#define _G_IO_IO_FILE_VERSION 0x20001
+
+#define _G_OPEN64	__open64
+#define _G_LSEEK64	__lseek64
+#define _G_MMAP64	__mmap64
+#define _G_FSTAT64(fd,buf) __fxstat64 (_STAT_VER, fd, buf)
+
+/* This is defined by <bits/stat.h> if `st_blksize' exists.  */
+#define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE)
+
+#define _G_BUFSIZ 8192
+
+/* These are the vtbl details for ELF.  */
+#define _G_NAMES_HAVE_UNDERSCORE 0
+#define _G_VTABLE_LABEL_HAS_LENGTH 1
+#define _G_USING_THUNKS	1
+#define _G_VTABLE_LABEL_PREFIX "__vt_"
+#define _G_VTABLE_LABEL_PREFIX_ID __vt_
+
+
+#if defined __cplusplus || defined __STDC__
+# define _G_ARGS(ARGLIST) ARGLIST
+#else
+# define _G_ARGS(ARGLIST) ()
+#endif
+
+#endif	/* _G_config.h */


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