aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2012-10-04 16:31:43 -0700
committerRoland McGrath <roland@hack.frob.com>2012-10-04 16:31:43 -0700
commit9043e2288e8f61bf36b90f5790abf549782d1957 (patch)
tree71c186093ba4a1d1fe71ec63bb1901d54973946d
parentf57f805541562734a40088b8be93e3bc9e86be54 (diff)
downloadglibc-9043e2288e8f61bf36b90f5790abf549782d1957.zip
glibc-9043e2288e8f61bf36b90f5790abf549782d1957.tar.gz
glibc-9043e2288e8f61bf36b90f5790abf549782d1957.tar.bz2
Name space hygeine for madvise.
-rw-r--r--ChangeLog15
-rw-r--r--include/sys/mman.h5
-rw-r--r--malloc/arena.c2
-rw-r--r--malloc/malloc.c2
-rw-r--r--misc/Versions3
-rw-r--r--misc/madvise.c9
-rw-r--r--nptl/ChangeLog4
-rw-r--r--nptl/pthread_create.c2
-rw-r--r--sysdeps/mach/hurd/malloc-machine.h5
-rw-r--r--sysdeps/unix/syscalls.list2
-rw-r--r--sysdeps/unix/sysv/linux/syscalls.list2
11 files changed, 38 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index c0726ea..e24bcfe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2012-10-04 Roland McGrath <roland@hack.frob.com>
+
+ * misc/Versions (GLIBC_PRIVATE): New set, add __madvise.
+ * misc/madvise.c (madvise): Renamed to __madvise.
+ Make madvise a weak alias.
+ * include/sys/mman.h: Declare __madvise.
+ Replace libc_hidden_proto (madvise) with libc_hidden_proto (__madvise).
+ * sysdeps/unix/syscalls.list
+ (madvise): Make __madvise the strong name, and madvise a weak alias.
+ * sysdeps/unix/sysv/linux/syscalls.list
+ (madvise, mmap): Remove redundant entries.
+ * malloc/arena.c (shrink_heap): Use __madvise, not madvise.
+ * malloc/malloc.c (mtrim): Likewise.
+ * sysdeps/mach/hurd/malloc-machine.h (madvise): Renamed to __madvise.
+
2012-10-03 Roland McGrath <roland@hack.frob.com>
* sysdeps/mach/hurd/dl-cache.c: File removed.
diff --git a/include/sys/mman.h b/include/sys/mman.h
index 0a0e4a6..fd125ec 100644
--- a/include/sys/mman.h
+++ b/include/sys/mman.h
@@ -10,11 +10,12 @@ extern void *__mmap64 (void *__addr, size_t __len, int __prot,
extern int __munmap (void *__addr, size_t __len);
extern int __mprotect (void *__addr, size_t __len, int __prot);
+extern int __madvise (void *__addr, size_t __len, int __advice);
+libc_hidden_proto (__madvise)
+
/* This one is Linux specific. */
extern void *__mremap (void *__addr, size_t __old_len,
size_t __new_len, int __flags, ...);
-
-libc_hidden_proto (madvise);
#endif
#endif
diff --git a/malloc/arena.c b/malloc/arena.c
index b209e3b..eb9180e 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -634,7 +634,7 @@ shrink_heap(heap_info *h, long diff)
h->mprotect_size = new_size;
}
else
- madvise ((char *)h + new_size, diff, MADV_DONTNEED);
+ __madvise ((char *)h + new_size, diff, MADV_DONTNEED);
/*fprintf(stderr, "shrink %p %08lx\n", h, new_size);*/
h->size = new_size;
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 892bc64..3f0b6b1 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -4450,7 +4450,7 @@ static int mtrim(mstate av, size_t pad)
content. */
memset (paligned_mem, 0x89, size & ~psm1);
#endif
- madvise (paligned_mem, size & ~psm1, MADV_DONTNEED);
+ __madvise (paligned_mem, size & ~psm1, MADV_DONTNEED);
result = 1;
}
diff --git a/misc/Versions b/misc/Versions
index 7f525ea..b2a9147 100644
--- a/misc/Versions
+++ b/misc/Versions
@@ -149,4 +149,7 @@ libc {
GLIBC_2.16 {
__getauxval; getauxval;
}
+ GLIBC_PRIVATE {
+ __madvise;
+ }
}
diff --git a/misc/madvise.c b/misc/madvise.c
index 8f1c873..4e9681a 100644
--- a/misc/madvise.c
+++ b/misc/madvise.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1994,1995,1996,1997,2000,2007 Free Software Foundation, Inc.
+/* Advise system about intentions for a memory region. Stub version.
+ Copyright (C) 1994-2012 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
@@ -23,11 +24,13 @@
for the region starting at ADDR and extending LEN bytes. */
int
-madvise (__ptr_t addr, size_t len, int advice)
+__madvise (void *addr, size_t len, int advice)
{
__set_errno (ENOSYS);
return -1;
}
-libc_hidden_def (madvise)
+libc_hidden_def (__madvise)
+weak_alias (__madvise, madvise)
+
stub_warning (madvise)
#include <stub-tag.h>
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index afcf491..586e282 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,7 @@
+2012-10-04 Roland McGrath <roland@hack.frob.com>
+
+ * pthread_create.c (start_thread): Use __madvise, not madvise.
+
2012-10-02 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/i386/tls.h: Update copyright years.
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index 6ba9c6f..197dfa7 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -399,7 +399,7 @@ start_thread (void *arg)
#endif
assert (freesize < pd->stackblock_size);
if (freesize > PTHREAD_STACK_MIN)
- madvise (pd->stackblock, freesize - PTHREAD_STACK_MIN, MADV_DONTNEED);
+ __madvise (pd->stackblock, freesize - PTHREAD_STACK_MIN, MADV_DONTNEED);
/* If the thread is detached free the TCB. */
if (IS_DETACHED (pd))
diff --git a/sysdeps/mach/hurd/malloc-machine.h b/sysdeps/mach/hurd/malloc-machine.h
index 4a8bd16..16e054f 100644
--- a/sysdeps/mach/hurd/malloc-machine.h
+++ b/sysdeps/mach/hurd/malloc-machine.h
@@ -66,8 +66,9 @@ __libc_tsd_define (static, void *, MALLOC) /* declaration/common definition */
#include <sys/mman.h>
-#undef madvise
-#define madvise(addr, len, advice) ((void) (addr), (void) (len), (void) (advice))
+#undef __madvise
+#define __madvise(addr, len, advice) \
+ ((void) (addr), (void) (len), (void) (advice))
#include <sysdeps/generic/malloc-machine.h>
diff --git a/sysdeps/unix/syscalls.list b/sysdeps/unix/syscalls.list
index b38b03e..4620582 100644
--- a/sysdeps/unix/syscalls.list
+++ b/sysdeps/unix/syscalls.list
@@ -41,7 +41,7 @@ kill - kill i:ii __kill kill
link - link i:ss __link link
listen - listen i:ii __listen listen
lseek - lseek i:iii __libc_lseek __lseek lseek
-madvise - madvise i:pii madvise
+madvise - madvise i:pii __madvise madvise
mkdir - mkdir i:si __mkdir mkdir
mmap - mmap b:aniiii __mmap mmap
mprotect - mprotect i:aii __mprotect mprotect
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index 6343272..2e6cf9c 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -36,11 +36,9 @@ ioperm - ioperm i:iii ioperm
iopl - iopl i:i iopl
klogctl EXTRA syslog i:isi klogctl
lchown - lchown i:sii __lchown lchown
-madvise - madvise i:pii madvise
mincore - mincore i:anV mincore
mlock - mlock i:bn mlock
mlockall - mlockall i:i mlockall
-mmap - mmap b:aniiii __mmap mmap
mount EXTRA mount i:sssip __mount mount
mremap EXTRA mremap b:ainip __mremap mremap
munlock - munlock i:ai munlock