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]

Add madvise and mincore




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.

The only question is in which header mincore should be declared.  Should we add it to <sys/mmap.h> ?  What's the normal place for the call?

Here's a declaration ready for copy & paste (copied from the Linux
kernel):

/* mincore returns the memory residency status of the pages in the
   current process's address space specified by [start, start + len).
   The status is returned in a vector of bytes.  The least significant
   bit of each byte is 1 if the referenced page is in memory, otherwise
   it is zero.  */
extern int mincore (void *__start, size_t __len, unsigned char *__vec);

Andreas

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

	* sysdeps/unix/sysv/linux/syscalls.list: Added madvise and
	mincore.

	* sysdeps/unix/sysv/linux/madvise.c: Remove.

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

============================================================
Index: sysdeps/unix/sysv/linux/syscalls.list
--- sysdeps/unix/sysv/linux/syscalls.list	2000/01/18 04:25:38	1.72
+++ sysdeps/unix/sysv/linux/syscalls.list	2000/03/17 07:44:53
@@ -24,6 +24,8 @@
 iopl		-	iopl		1	iopl
 klogctl		EXTRA	syslog		3	klogctl
 lchown		-	lchown		3	__lchown	lchown
+madvise		-	madvise		3	madvise
+mincore		-	mincore		3	mincore
 mlock		EXTRA	mlock		2	__mlock	mlock
 mlockall	EXTRA	mlockall	1	__mlockall	mlockall
 mmap		-	mmap		6	__mmap		mmap
============================================================
Index: sysdeps/unix/sysv/linux/sparc/bits/mman.h
--- sysdeps/unix/sysv/linux/sparc/bits/mman.h	1999/02/07 20:04:00	1.3
+++ sysdeps/unix/sysv/linux/sparc/bits/mman.h	2000/03/17 07:44:53
@@ -75,3 +75,12 @@
 #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/unix/sysv/linux/i386/bits/mman.h
--- sysdeps/unix/sysv/linux/i386/bits/mman.h	1997/11/26 04:09:44	1.2
+++ sysdeps/unix/sysv/linux/i386/bits/mman.h	2000/03/17 07:44:53
@@ -73,3 +73,12 @@
 #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/unix/sysv/linux/madvise.c
--- sysdeps/unix/sysv/linux/madvise.c	Fri Mar 17 09:42:15 2000	1.2
+++ sysdeps/unix/sysv/linux/madvise.c	removed
@@ -1 +0,0 @@
-#include <sysdeps/generic/madvise.c>
-- 
 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]