This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

Re: Add madvise and mincore


>>>>> Ulrich Drepper writes:

Ulrich> Andreas Jaeger <aj@suse.de> writes:
>> Linux 2.3.99pre1 (and pre2-1) add madvise and mincore syscalls.  I'm
>> appending a patch for glibc to support these.  I didn't add MADV_FREE
>> for Sparc since it's not implemented in the kernel.  Sparc folks,
>> please check wether it's needed.

Ulrich> I've added the patch you sent but it seems not to be correct.  First,
Ulrich> you did modify the SPARC file.  Alos, is this stuff not implemented
Ulrich> for anything but x86 and SPARC?

I'm appending patches for Alpha and ARM.

Ulrich> The prototype is in sys/mman.h now (this is where I think it belongs).
Ulrich> We might have to add an appropriate stub file.

A patch is appended.

Andreas


2000-03-20  Andreas Jaeger  <aj@suse.de>

	* sysdeps/generic/mincore.c: New stub file.

	* sysdeps/unix/sysv/linux/alpha/bits/mman.h (MADV_*): Add flags
	from latest Linux kernel.
	* sysdeps/unix/sysv/linux/arm/bits/mman.h (MADV_*): Likewise.

============================================================
Index: sysdeps/unix/sysv/linux/alpha/bits/mman.h
--- sysdeps/unix/sysv/linux/alpha/bits/mman.h	1998/01/26 22:52:51	1.3
+++ sysdeps/unix/sysv/linux/alpha/bits/mman.h	2000/03/20 08:03:50
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/Alpha version.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -80,4 +80,13 @@
 /* Flags for `mremap'.  */
 #ifdef __USE_GNU
 # define MREMAP_MAYMOVE	1
+#endif
+
+/* Advice to `madvise'.  */
+#ifdef __USE_BSD
+# define MADV_NORMAL	 0	/* No further special treatment.  */
+# define MADV_RANDOM	 1	/* Expect random page references.  */
+# define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
+# define MADV_WILLNEED	 3	/* Will need these pages.  */
+# define MADV_DONTNEED	 6	/* Don't need these pages.  */
 #endif
============================================================
Index: sysdeps/unix/sysv/linux/arm/bits/mman.h
--- sysdeps/unix/sysv/linux/arm/bits/mman.h	1997/12/04 00:02:58	1.1
+++ sysdeps/unix/sysv/linux/arm/bits/mman.h	2000/03/20 08:03:50
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/ARM version.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -72,4 +72,13 @@
 /* Flags for `mremap'.  */
 #ifdef __USE_GNU
 # define MREMAP_MAYMOVE	1
+#endif
+
+/* Advice to `madvise'.  */
+#ifdef __USE_BSD
+# define MADV_NORMAL	 0	/* No further special treatment.  */
+# define MADV_RANDOM	 1	/* Expect random page references.  */
+# define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
+# define MADV_WILLNEED	 3	/* Will need these pages.  */
+# define MADV_DONTNEED	 4	/* Don't need these pages.  */
 #endif
============================================================
Index: sysdeps/generic/mincore.c
--- sysdeps/generic/mincore.c	created
+++ sysdeps/generic/mincore.c	Mon Mar 20 09:02:28 2000	1.1
@@ -0,0 +1,30 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sys/mman.h>
+#include <errno.h>
+
+int
+mincore (void *__start, size_t __len, unsigned char *__vec)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (mincore)
+#include <stub-tag.h>

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.rhein-neckar.de

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