summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2009-11-30 14:53:29 +0100
committerAndreas Schwab <schwab@redhat.com>2009-11-30 14:54:41 +0100
commit488fb43a499982e99915c78bb70f04357ac37463 (patch)
treee356d0f1d327ed3de4a9d5abec1edf346070aa32
parenteab709096f23a4511adfc547450a83008eae5fb2 (diff)
parent20af204581e1ba42738c1bfb69cc2f5350f4ffa4 (diff)
Merge branch 'release/2.11/master' into fedora/2.11/master
-rw-r--r--ChangeLog142
-rw-r--r--csu/elf-init.c21
-rw-r--r--csu/libc-start.c6
-rw-r--r--elf/dl-sym.c9
-rw-r--r--elf/ifuncmain3.c9
-rw-r--r--libio/libio.h14
-rw-r--r--locale/Makefile6
-rw-r--r--locale/duplocale.c6
-rw-r--r--locale/langinfo.h3
-rw-r--r--locale/tst-duplocale.c14
-rw-r--r--locale/tst-locname.c20
-rw-r--r--login/programs/pt_chown.c5
-rw-r--r--malloc/hooks.c37
-rw-r--r--malloc/memusagestat.c2
-rw-r--r--nptl/ChangeLog12
-rw-r--r--nptl/sysdeps/pthread/unwind-forcedunwind.c5
-rw-r--r--nptl/sysdeps/pthread/unwind-resume.c5
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S5
-rw-r--r--posix/Makefile3
-rw-r--r--posix/bug-regex29.c1
-rw-r--r--posix/bug-regex30.c103
-rw-r--r--posix/regcomp.c2
-rw-r--r--resolv/mapv4v6hostent.h12
-rw-r--r--resolv/nss_dns/dns-host.c6
-rw-r--r--string/bits/string3.h5
-rw-r--r--sysdeps/generic/framestate.c3
-rw-r--r--sysdeps/generic/libgcc_s.h2
-rw-r--r--sysdeps/ia64/memchr.S11
-rw-r--r--sysdeps/powerpc/fpu/e_sqrt.c6
-rw-r--r--sysdeps/powerpc/fpu/e_sqrtf.c6
-rw-r--r--sysdeps/unix/grantpt.c4
-rw-r--r--sysdeps/unix/sysv/linux/bits/sched.h12
-rw-r--r--sysdeps/unix/sysv/linux/grantpt.c42
-rw-r--r--sysdeps/unix/sysv/linux/i386/bits/fcntl.h4
-rw-r--r--sysdeps/unix/sysv/linux/i386/bits/mman.h21
-rw-r--r--sysdeps/unix/sysv/linux/i386/fallocate.c6
-rw-r--r--sysdeps/unix/sysv/linux/i386/fallocate64.c6
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/fcntl.h4
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/mman.h22
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h8
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/mman.h22
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/sync_file_range.c44
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/fcntl.h4
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/mman.h21
-rw-r--r--sysdeps/unix/sysv/linux/sh/bits/fcntl.h8
-rw-r--r--sysdeps/unix/sysv/linux/sh/bits/mman.h22
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/fcntl.h4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/mman.h24
-rw-r--r--sysdeps/unix/sysv/linux/sync_file_range.c10
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h8
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/bits/mman.h21
51 files changed, 634 insertions, 164 deletions
diff --git a/ChangeLog b/ChangeLog
index aaa01cb937..f1a0036aa3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,132 @@
+2009-11-24 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/grantpt.c (grantpt): Use CLOSE_ALL_FDS is available
+ before the exec.
+ * sysdeps/unix/sysv/linux/grantpt.c: New file.
+ * login/programs/pt_chown.c (main): Don't print message on errors
+ when doing real work.
+
+ * csu/elf-init.c (__libc_csu_irel): New function. Code to perform
+ irel relocations split out from...
+ (__libc_csu_init): ...here.
+ * csu/libc-start.c [!SHARED]: Call __libc_csu_irel early.
+
+2009-11-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ [BZ #10162]
+ * sysdeps/ia64/memchr.S: Don't use a simple loop on data shorter
+ than software pipeline. Properly recover from shorter read.
+
+2009-11-16 Jakub Jelinek <jakub@redhat.com>
+
+ * sysdeps/unix/sysv/linux/sync_file_range.c (sync_file_range):
+ Implement using sync_file_range2 syscall if __NR_sync_file_range2
+ is defined.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/sync_file_range.c: New
+ file.
+
+2009-11-19 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #10958]
+ * libio/libio.h (_IO_getwc_unlocked): Check for _wide_data being
+ initialized before using it.
+ (_IO_putwc_unlocked): Likewise.
+
+ [BZ #10918]
+ * sysdeps/unix/sysv/linux/bits/sched.h (__CPU_ISSET_S): Use __const
+ in cast to not throw away const-ness of parameters.
+ (__CPU_EQUAL_S): Likewise.
+ (__CPU_OP_S): Likewise.
+
+2009-11-17 Paolo Bonzini <bonzini@gnu.org>
+
+ * posix/bug-regex30.c: New file.
+ * posix/Makefile: Add rules to build and run bug-regex30.
+ * posix/regcomp.c (re_compile_fastmap_iter): Add all multibyte
+ character lead bytes when there is a range in a COMPLEX_BRACKET.
+ Reported by Oleg Bylatov.
+
+2009-11-17 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #10969]
+ * locale/duplocale.c (__duplocale): Handle LC_GLOBAL_LOCALE special.
+ * locale/tst-duplocale.c: New file.
+ * locale/Makefile (tests): Add tst-duplocale.
+
+ [BZ #10968]
+ * locale/langinfo.h (_NL_LOCALE_NAME): Correct definition.
+ Patch by Bruno Haible <bruno@clisp.org>.
+ * locale/tst-locname.c: New file.
+ * locale/Makefile (tests): Add tst-locname.
+
+ [BZ #10972]
+ * sysdeps/unix/sysv/linux/powerpc/bits/mman.h: Add new MADV_*
+ constants from recent kernels.
+ * sysdeps/unix/sysv/linux/i386/bits/mman.h: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/bits/mman.h: Likewise.
+ * sysdeps/unix/sysv/linux/s390/bits/mman.h: Likewise.
+ * sysdeps/unix/sysv/linux/sparc/bits/mman.h: Likewise.
+ * sysdeps/unix/sysv/linux/sh/bits/mman.h: Likewise.
+ * sysdeps/unix/sysv/linux/ia64/bits/mman.h: Likewise.
+
+2009-11-09 Mike Frysinger <vapier@gentoo.org>
+
+ * sysdeps/unix/sysv/linux/i386/fallocate.c: Include errno.h.
+ (fallocate): Return ENOSYS if __NR_fallocate is not defined.
+ * sysdeps/unix/sysv/linux/i386/fallocate64.c: Likewise.
+
+2009-11-06 Mike Frysinger <vapier@gentoo.org>
+
+ * posix/bug-regex29.c: Include stdio.h.
+
+2009-11-14 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/sh/bits/fcntl.h: Update F_SETOWN_EX and
+ F_GETOWN_EX definitions according to corrected kernel definitions.
+ * sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h: Likewise.
+ * sysdeps/unix/sysv/linux/sparc/bits/fcntl.h: Likewise.
+ * sysdeps/unix/sysv/linux/ia64/bits/fcntl.h: Likewise.
+ * sysdeps/unix/sysv/linux/i386/bits/fcntl.h: Likewise.
+ * sysdeps/unix/sysv/linux/s390/bits/fcntl.h: Likewise.
+
+2009-11-10 Andreas Schwab <schwab@redhat.com>
+
+ * resolv/mapv4v6hostent.h (map_v4v6_hostent): Return non-zero if
+ out of buffer space.
+ * resolv/nss_dns/dns-host.c (getanswer_r): Check for
+ map_v4v6_hostent running out of space.
+
+2009-11-10 Ulrich Drepper <drepper@redhat.com>
+
+ * string/bits/string3.h (memset): If the second parameter is constant
+ and zero there is likely no transposition.
+ Patch by Caolan McNamara <caolanm@redhat.com.
+
+2009-11-04 Philippe De Muyter <phdm@macqel.be>
+
+ * sysdeps/powerpc/fpu/e_sqrt.c: Fix spelling of (Newton-)Raphson.
+ * sysdeps/powerpc/fpu/e_sqrtf.c: Likewise.
+
+2009-10-30 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ * malloc/memusagestat.c (main): Fix spelling in an error message.
+
+2009-11-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf/dl-sym.c (do_sym): Properly handle STT_GNU_IFUNC symbols.
+ * elf/ifuncmain3.c (main): Test dlopen STT_GNU_IFUNC symbol.
+
+2009-11-03 Andreas Schwab <schwab@redhat.com>
+
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list: Add
+ readahead.
+
+2009-11-03 Jakub Jelinek <jakub@redhat.com>
+
+ * sysdeps/powerpc/powerpc64/dl-machine.h (resolve_ifunc): Don't
+ relocate opd entry when resolving prelink conflicts.
+
2009-11-04 Jakub Jelinek <jakub@redhat.com>
* misc/sys/uio.h (preadv, pwritev): Fix type of last argument
@@ -12,15 +141,16 @@
* sysdeps/unix/sysv/linux/sparc/bits/fcntl.h (fallocate): Likewise.
* sysdeps/unix/sysv/linux/sh/bits/fcntl.h (fallocate): Likewise.
-2009-11-03 Jakub Jelinek <jakub@redhat.com>
+2009-11-03 Andreas Schwab <schwab@linux-m68k.org>
- * sysdeps/powerpc/powerpc64/dl-machine.h (resolve_ifunc): Don't
- relocate opd entry when resolving prelink conflicts.
+ [BZ #4457]
+ * sysdeps/generic/libgcc_s.h: New file.
+ * sysdeps/generic/framestate.c: Include it and use LIBGCC_S_SO.
-2009-11-03 Andreas Schwab <schwab@redhat.com>
+2009-11-01 Ulrich Drepper <drepper@redhat.com>
- * sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list: Add
- readahead.
+ * malloc/hooks.c (free_check): Restore locking and call _int_free
+ appropriately.
2009-10-30 Ulrich Drepper <drepper@redhat.com>
diff --git a/csu/elf-init.c b/csu/elf-init.c
index 7481e69aa6..f828faa601 100644
--- a/csu/elf-init.c
+++ b/csu/elf-init.c
@@ -89,15 +89,14 @@ extern void _fini (void);
/* These functions are passed to __libc_start_main by the startup code.
These get statically linked into each program. For dynamically linked
programs, this module will come from libc_nonshared.a and differs from
- the libc.a module in that it doesn't call the preinit array. */
+ the libc.a module in that it doesn't call the preinit array and performs
+ explicit IREL{,A} relocations. */
-void
-__libc_csu_init (int argc, char **argv, char **envp)
-{
- /* For dynamically linked executables the preinit array is executed by
- the dynamic linker (before initializing any shared object. */
#ifndef LIBC_NONSHARED
+void
+__libc_csu_irel (void)
+{
# ifdef USE_MULTIARCH
# ifdef ELF_MACHINE_IRELA
{
@@ -115,7 +114,17 @@ __libc_csu_init (int argc, char **argv, char **envp)
}
# endif
# endif
+}
+#endif
+
+void
+__libc_csu_init (int argc, char **argv, char **envp)
+{
+ /* For dynamically linked executables the preinit array is executed by
+ the dynamic linker (before initializing any shared object. */
+
+#ifndef LIBC_NONSHARED
/* For static executables, preinit happens right before init. */
{
const size_t size = __preinit_array_end - __preinit_array_start;
diff --git a/csu/libc-start.c b/csu/libc-start.c
index 80b672f88d..dc7ca55f09 100644
--- a/csu/libc-start.c
+++ b/csu/libc-start.c
@@ -24,6 +24,9 @@
#include <bp-sym.h>
extern void __libc_init_first (int argc, char **argv, char **envp);
+#ifndef SHARED
+extern void __libc_csu_irel (void);
+#endif
extern int __libc_multiple_libcs;
@@ -134,6 +137,9 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
}
# endif
+ /* Performe IREL{,A} relocations. */
+ __libc_csu_irel ();
+
/* Initialize the thread library at least a bit since the libgcc
functions are using thread functions if these are available and
we need to setup errno. */
diff --git a/elf/dl-sym.c b/elf/dl-sym.c
index 459729f0f2..4faf05c00b 100644
--- a/elf/dl-sym.c
+++ b/elf/dl-sym.c
@@ -193,8 +193,13 @@ RTLD_NEXT used in code not dynamically loaded"));
/* Resolve indirect function address. */
if (__builtin_expect (ELFW(ST_TYPE) (ref->st_info) == STT_GNU_IFUNC, 0))
- value
- = ((DL_FIXUP_VALUE_TYPE (*) (void)) DL_FIXUP_VALUE_ADDR (value)) ();
+ {
+ DL_FIXUP_VALUE_TYPE fixup
+ = DL_FIXUP_MAKE_VALUE (result, (ElfW(Addr)) value);
+ fixup =
+ ((DL_FIXUP_VALUE_TYPE (*) (void)) DL_FIXUP_VALUE_ADDR (fixup)) ();
+ value = (void *) DL_FIXUP_VALUE_CODE_ADDR (fixup);
+ }
#ifdef SHARED
/* Auditing checkpoint: we have a new binding. Provide the
diff --git a/elf/ifuncmain3.c b/elf/ifuncmain3.c
index 5d067cced9..1574dd5cbe 100644
--- a/elf/ifuncmain3.c
+++ b/elf/ifuncmain3.c
@@ -46,6 +46,15 @@ main (void)
return 1;
}
+ p = dlsym (h, "foo");
+ if (p == NULL)
+ {
+ printf ("symbol not found: %s\n", dlerror ());
+ return 1;
+ }
+ if ((*p) () != -1)
+ abort ();
+
f = dlsym (h, "get_foo_p");
if (f == NULL)
{
diff --git a/libio/libio.h b/libio/libio.h
index 643812f72b..3c9f2bd3e8 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1995,1997-2006,2007 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1995,1997-2006,2007,2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Per Bothner <bothner@cygnus.com>.
@@ -442,13 +442,15 @@ extern _IO_wint_t __woverflow (_IO_FILE *, _IO_wint_t);
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
# define _IO_getwc_unlocked(_fp) \
- (_IO_BE ((_fp)->_wide_data->_IO_read_ptr >= (_fp)->_wide_data->_IO_read_end,\
- 0) \
+ (_IO_BE ((_fp)->_wide_data == NULL \
+ || ((_fp)->_wide_data->_IO_read_ptr \
+ >= (_fp)->_wide_data->_IO_read_end), 0) \
? __wuflow (_fp) : (_IO_wint_t) *(_fp)->_wide_data->_IO_read_ptr++)
# define _IO_putwc_unlocked(_wch, _fp) \
- (_IO_BE ((_fp)->_wide_data->_IO_write_ptr \
- >= (_fp)->_wide_data->_IO_write_end, 0) \
- ? __woverflow (_fp, _wch) \
+ (_IO_BE ((_fp)->_wide_data == NULL \
+ || ((_fp)->_wide_data->_IO_write_ptr \
+ >= (_fp)->_wide_data->_IO_write_end), 0) \
+ ? __woverflow (_fp, _wch) \
: (_IO_wint_t) (*(_fp)->_wide_data->_IO_write_ptr++ = (_wch)))
#endif
diff --git a/locale/Makefile b/locale/Makefile
index d9ab1947e7..2dbd8dc6a5 100644
--- a/locale/Makefile
+++ b/locale/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991,1992,1995-2003,2005 Free Software Foundation, Inc.
+# Copyright (C) 1991,1992,1995-2003,2005,2009 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
@@ -38,7 +38,7 @@ distribute = localeinfo.h categories.def iso-639.def iso-3166.def \
routines = setlocale findlocale loadlocale loadarchive \
localeconv nl_langinfo nl_langinfo_l mb_cur_max \
newlocale duplocale freelocale uselocale
-tests = tst-C-locale
+tests = tst-C-locale tst-locname tst-duplocale
categories = ctype messages monetary numeric time paper name \
address telephone measurement identification collate
aux = $(categories:%=lc-%) $(categories:%=C-%) SYS_libc C_name \
@@ -104,7 +104,7 @@ CFLAGS-charmap-dir.c = -Wno-write-strings
# This makes sure -DNOT_IN_libc is passed for all these modules.
cpp-srcs-left := $(addsuffix .c,$(localedef-modules) $(localedef-aux) \
- $(locale-modules) $(lib-modules))
+ $(locale-modules) $(lib-modules))
lib := nonlib
include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
diff --git a/locale/duplocale.c b/locale/duplocale.c
index 61782590d7..63513c539c 100644
--- a/locale/duplocale.c
+++ b/locale/duplocale.c
@@ -1,5 +1,5 @@
/* Duplicate handle for selection of locales.
- Copyright (C) 1997,2000,2001,2002,2005,2008 Free Software Foundation, Inc.
+ Copyright (C) 1997,2000-2002,2005,2008,2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -37,6 +37,10 @@ __duplocale (__locale_t dataset)
if (dataset == _nl_C_locobj_ptr)
return dataset;
+ /* Handle a special value. */
+ if (dataset == LC_GLOBAL_LOCALE)
+ dataset = &_nl_global_locale;
+
__locale_t result;
int cnt;
size_t names_len = 0;
diff --git a/locale/langinfo.h b/locale/langinfo.h
index c940c743aa..0a53365071 100644
--- a/locale/langinfo.h
+++ b/locale/langinfo.h
@@ -568,7 +568,8 @@ enum
/* This macro produces an item you can pass to `nl_langinfo' or
`nl_langinfo_l' to get the name of the locale in use for CATEGORY. */
-#define _NL_LOCALE_NAME(category) _NL_ITEM ((category), -1)
+#define _NL_LOCALE_NAME(category) _NL_ITEM ((category), \
+ _NL_ITEM_INDEX (-1))
#ifdef __USE_GNU
# define NL_LOCALE_NAME(category) _NL_LOCALE_NAME (category)
#endif
diff --git a/locale/tst-duplocale.c b/locale/tst-duplocale.c
new file mode 100644
index 0000000000..53e5fbb8fe
--- /dev/null
+++ b/locale/tst-duplocale.c
@@ -0,0 +1,14 @@
+#include <locale.h>
+#include <stdio.h>
+
+static int
+do_test (void)
+{
+ locale_t d = duplocale (LC_GLOBAL_LOCALE);
+ if (d != (locale_t) 0)
+ freelocale (d);
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/locale/tst-locname.c b/locale/tst-locname.c
new file mode 100644
index 0000000000..7eb71adfd8
--- /dev/null
+++ b/locale/tst-locname.c
@@ -0,0 +1,20 @@
+#include <langinfo.h>
+#include <locale.h>
+#include <stdio.h>
+#include <string.h>
+
+static int
+do_test (void)
+{
+ const char *s = nl_langinfo (_NL_LOCALE_NAME (LC_CTYPE));
+ if (s == NULL || strcmp (s, "C") != 0)
+ {
+ printf ("incorrect locale name returned: %s, expected \"C\"\n", s);
+ return 1;
+ }
+
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/login/programs/pt_chown.c b/login/programs/pt_chown.c
index 7e279a5f3b..4c36f2ceac 100644
--- a/login/programs/pt_chown.c
+++ b/login/programs/pt_chown.c
@@ -154,8 +154,7 @@ main (int argc, char *argv[])
# define ncap_list (sizeof (cap_list) / sizeof (cap_list[0]))
cap_t caps = cap_init ();
if (caps == NULL)
- error (FAIL_ENOMEM, errno,
- _("Failed to initialize drop of capabilities"));
+ return FAIL_ENOMEM;
/* There is no reason why these should not work. */
cap_set_flag (caps, CAP_PERMITTED, ncap_list, cap_list, CAP_SET);
@@ -166,7 +165,7 @@ main (int argc, char *argv[])
cap_free (caps);
if (__builtin_expect (res != 0, 0))
- error (FAIL_EXEC, errno, _("cap_set_proc failed"));
+ return FAIL_EXEC;
}
#endif
diff --git a/malloc/hooks.c b/malloc/hooks.c
index 622a815f32..28845eeb49 100644
--- a/malloc/hooks.c
+++ b/malloc/hooks.c
@@ -162,8 +162,8 @@ mem2chunk_check(mem, magic_p) Void_t* mem; unsigned char **magic_p;
((char*)p + sz)>=(mp_.sbrk_base+main_arena.system_mem) )) ||
sz<MINSIZE || sz&MALLOC_ALIGN_MASK || !inuse(p) ||
( !prev_inuse(p) && (p->prev_size&MALLOC_ALIGN_MASK ||
- (contig && (char*)prev_chunk(p)<mp_.sbrk_base) ||
- next_chunk(prev_chunk(p))!=p) ))
+ (contig && (char*)prev_chunk(p)<mp_.sbrk_base) ||
+ next_chunk(prev_chunk(p))!=p) ))
return NULL;
magic = MAGICBYTE(p);
for(sz += SIZE_SZ-1; (c = ((unsigned char*)p)[sz]) != magic; sz -= c) {
@@ -177,9 +177,9 @@ mem2chunk_check(mem, magic_p) Void_t* mem; unsigned char **magic_p;
first. */
offset = (unsigned long)mem & page_mask;
if((offset!=MALLOC_ALIGNMENT && offset!=0 && offset!=0x10 &&
- offset!=0x20 && offset!=0x40 && offset!=0x80 && offset!=0x100 &&
- offset!=0x200 && offset!=0x400 && offset!=0x800 && offset!=0x1000 &&
- offset<0x2000) ||
+ offset!=0x20 && offset!=0x40 && offset!=0x80 && offset!=0x100 &&
+ offset!=0x200 && offset!=0x400 && offset!=0x800 && offset!=0x1000 &&
+ offset<0x2000) ||
!chunk_is_mmapped(p) || (p->size & PREV_INUSE) ||
( (((unsigned long)p - p->prev_size) & page_mask) != 0 ) ||
( (sz = chunksize(p)), ((p->prev_size + sz) & page_mask) != 0 ) )
@@ -276,13 +276,17 @@ free_check(mem, caller) Void_t* mem; const Void_t *caller;
mchunkptr p;
if(!mem) return;
+ (void)mutex_lock(&main_arena.mutex);
p = mem2chunk_check(mem, NULL);
if(!p) {
+ (void)mutex_unlock(&main_arena.mutex);
+
malloc_printerr(check_action, "free(): invalid pointer", mem);
return;
}
#if HAVE_MMAP
if (chunk_is_mmapped(p)) {
+ (void)mutex_unlock(&main_arena.mutex);
munmap_chunk(p);
return;
}
@@ -291,12 +295,11 @@ free_check(mem, caller) Void_t* mem; const Void_t *caller;
memset(mem, 0, chunksize(p) - (SIZE_SZ+1));
#endif
#ifdef ATOMIC_FASTBINS
- _int_free(&main_arena, p, 0);
+ _int_free(&main_arena, p, 1);
#else
- (void)mutex_lock(&main_arena.mutex);
_int_free(&main_arena, p);
- (void)mutex_unlock(&main_arena.mutex);
#endif
+ (void)mutex_unlock(&main_arena.mutex);
}
static Void_t*
@@ -345,13 +348,13 @@ realloc_check(oldmem, bytes, caller)
if(oldsize - SIZE_SZ >= nb)
newmem = oldmem; /* do nothing */
else {
- /* Must alloc, copy, free. */
- if (top_check() >= 0)
+ /* Must alloc, copy, free. */
+ if (top_check() >= 0)
newmem = _int_malloc(&main_arena, bytes+1);
- if (newmem) {
- MALLOC_COPY(BOUNDED_N(newmem, bytes+1), oldmem, oldsize - 2*SIZE_SZ);
- munmap_chunk(oldp);
- }
+ if (newmem) {
+ MALLOC_COPY(BOUNDED_N(newmem, bytes+1), oldmem, oldsize - 2*SIZE_SZ);
+ munmap_chunk(oldp);
+ }
}
}
} else {
@@ -367,7 +370,7 @@ realloc_check(oldmem, bytes, caller)
nb = chunksize(newp);
if(oldp<newp || oldp>=chunk_at_offset(newp, nb)) {
memset((char*)oldmem + 2*sizeof(mbinptr), 0,
- oldsize - (2*sizeof(mbinptr)+2*SIZE_SZ+1));
+ oldsize - (2*sizeof(mbinptr)+2*SIZE_SZ+1));
} else if(nb > oldsize+SIZE_SZ) {
memset((char*)BOUNDED_N(chunk2mem(newp), bytes) + oldsize,
0, nb - (oldsize+SIZE_SZ));
@@ -626,7 +629,7 @@ public_sET_STATe(Void_t* msptr)
mark_bin(&main_arena, i);
} else {
/* Oops, index computation from chunksize must have changed.
- Link the whole list into unsorted_chunks. */
+ Link the whole list into unsorted_chunks. */
first(b) = last(b) = b;
b = unsorted_chunks(&main_arena);
ms->av[2*i+2]->bk = b;
@@ -667,7 +670,7 @@ public_sET_STATe(Void_t* msptr)
/* Check whether it is safe to enable malloc checking, or whether
it is necessary to disable it. */
if (ms->using_malloc_checking && !using_malloc_checking &&
- !disallow_malloc_check)
+ !disallow_malloc_check)
__malloc_check_init ();
else if (!ms->using_malloc_checking && using_malloc_checking) {
__malloc_hook = NULL;
diff --git a/malloc/memusagestat.c b/malloc/memusagestat.c
index 4d57f2cc23..a5a315056b 100644
--- a/malloc/memusagestat.c
+++ b/malloc/memusagestat.c
@@ -181,7 +181,7 @@ main (int argc, char *argv[])
|| st.st_size < 2 * sizeof (struct entry))
{
close (fd);
- error (EXIT_FAILURE, 0, "input file as incorrect size");
+ error (EXIT_FAILURE, 0, "input file has incorrect size");
}
/* Compute number of data entries. */
total = st.st_size / sizeof (struct entry) - 2;
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index f11a47dd0b..a06b456728 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,15 @@
+2009-11-27 Andreas Schwab <schwab@redhat.com>
+
+ * sysdeps/unix/sysv/linux/x86_64/cancellation.S: Reload
+ THREAD_SELF->cancelhandling after returning from futex call.
+
+2009-11-03 Andreas Schwab <schwab@linux-m68k.org>
+
+ [BZ #4457]
+ * sysdeps/pthread/unwind-resume.c: Include <libgcc_s.h> and use
+ LIBGCC_S_SO.
+ * sysdeps/pthread/unwind-forcedunwind.c: Likewise.
+
2009-10-30 Ulrich Drepper <drepper@redhat.com>
* tst-sem11.c (main): Rewrite to avoid aliasing problems.
diff --git a/nptl/sysdeps/pthread/unwind-forcedunwind.c b/nptl/sysdeps/pthread/unwind-forcedunwind.c
index 402591f6e4..ae43f335e7 100644
--- a/nptl/sysdeps/pthread/unwind-forcedunwind.c
+++ b/nptl/sysdeps/pthread/unwind-forcedunwind.c
@@ -22,6 +22,7 @@
#include <unwind.h>
#include <pthreadP.h>
#include <sysdep.h>
+#include <libgcc_s.h>
static void *libgcc_s_handle;
static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
@@ -49,7 +50,7 @@ pthread_cancel_init (void)
return;
}
- handle = __libc_dlopen ("libgcc_s.so.1");
+ handle = __libc_dlopen (LIBGCC_S_SO);
if (handle == NULL
|| (resume = __libc_dlsym (handle, "_Unwind_Resume")) == NULL
@@ -61,7 +62,7 @@ pthread_cancel_init (void)
|| ARCH_CANCEL_INIT (handle)
#endif
)
- __libc_fatal ("libgcc_s.so.1 must be installed for pthread_cancel to work\n");
+ __libc_fatal (LIBGCC_S_SO " must be installed for pthread_cancel to work\n");
PTR_MANGLE (resume);
libgcc_s_resume = resume;
diff --git a/nptl/sysdeps/pthread/unwind-resume.c b/nptl/sysdeps/pthread/unwind-resume.c
index 088f4c6f6c..69f3e04c43 100644
--- a/nptl/sysdeps/pthread/unwind-resume.c
+++ b/nptl/sysdeps/pthread/unwind-resume.c
@@ -20,6 +20,7 @@
#include <dlfcn.h>
#include <stdio.h>
#include <unwind.h>
+#include <libgcc_s.h>
static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
static _Unwind_Reason_Code (*libgcc_s_personality)
@@ -32,12 +33,12 @@ init (void)
void *resume, *personality;
void *handle;
- handle = __libc_dlopen ("libgcc_s.so.1");
+ handle = __libc_dlopen (LIBGCC_S_SO);
if (handle == NULL
|| (resume = __libc_dlsym (handle, "_Unwind_Resume")) == NULL
|| (personality = __libc_dlsym (handle, "__gcc_personality_v0")) == NULL)
- __libc_fatal ("libgcc_s.so.1 must be installed for pthread_cancel to work\n");
+ __libc_fatal (LIBGCC_S_SO " must be installed for pthread_cancel to work\n");
libgcc_s_resume = resume;
libgcc_s_personality = personality;
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S b/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S
index 0d48ec6fcd..680696200a 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S
@@ -96,8 +96,8 @@ ENTRY(__pthread_disable_asynccancel)
cmpxchgl %r11d, %fs:CANCELHANDLING
jnz 2b
-3: movl %r11d, %eax
- andl $(TCB_CANCELING_BITMASK|TCB_CANCELED_BITMASK), %eax
+ movl %r11d, %eax
+3: andl $(TCB_CANCELING_BITMASK|TCB_CANCELED_BITMASK), %eax
cmpl $TCB_CANCELING_BITMASK, %eax
je 4f
1: ret
@@ -111,5 +111,6 @@ ENTRY(__pthread_disable_asynccancel)
addq $CANCELHANDLING, %rdi
LOAD_PRIVATE_FUTEX_WAIT (%esi)
syscall
+ movl %fs:CANCELHANDLING, %eax
jmp 3b
END(__pthread_disable_asynccancel)
diff --git a/posix/Makefile b/posix/Makefile
index c0164effa8..535ed1474d 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -82,7 +82,7 @@ tests := tstgetopt testfnm runtests runptests \
bug-regex17 bug-regex18 bug-regex19 bug-regex20 \
bug-regex21 bug-regex22 bug-regex23 bug-regex24 \
bug-regex25 bug-regex26 bug-regex27 bug-regex28 \
- bug-regex29 \
+ bug-regex29 bug-regex30 \
tst-nice tst-nanosleep tst-regex2 \
transbug tst-rxspencer tst-pcre tst-boost \
bug-ga1 tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \
@@ -195,6 +195,7 @@ bug-regex22-ENV = LOCPATH=$(common-objpfx)localedata
bug-regex23-ENV = LOCPATH=$(common-objpfx)localedata
bug-regex25-ENV = LOCPATH=$(common-objpfx)localedata
bug-regex26-ENV = LOCPATH=$(common-objpfx)localedata
+bug-regex30-ENV = LOCPATH=$(common-objpfx)localedata
tst-rxspencer-ARGS = --utf8 rxspencer/tests
tst-rxspencer-ENV = LOCPATH=$(common-objpfx)localedata
tst-pcre-ARGS = PCRE.tests
diff --git a/posix/bug-regex29.c b/posix/bug-regex29.c
index bd796c6c2a..cfc9f99dbc 100644
--- a/posix/bug-regex29.c
+++ b/posix/bug-regex29.c
@@ -1,4 +1,5 @@
#include <regex.h>
+#include <stdio.h>
static int
do_test (void)
diff --git a/posix/bug-regex30.c b/posix/bug-regex30.c
new file mode 100644
index 0000000000..43df64d9d3
--- /dev/null
+++ b/posix/bug-regex30.c
@@ -0,0 +1,103 @@
+/* Russian regular expression tests.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Paolo Bonzini <pbonzini@redhat.com>, 2009.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <mcheck.h>
+#include <regex.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <locale.h>
+
+/* Tests supposed to match. */
+struct
+{
+ const char *pattern;
+ const char *string;
+ int flags, nmatch;
+ regmatch_t rm[5];
+} tests[] = {
+ /* U+0413 \xd0\x93 CYRILLIC CAPITAL LETTER GHE
+ U+0420 \xd0\xa0 CYRILLIC CAPITAL LETTER ER
+ U+0430 \xd0\xb0 CYRILLIC SMALL LETTER A
+ U+0433 \xd0\xb3 CYRILLIC SMALL LETTER GHE
+ U+0440 \xd1\x80 CYRILLIC SMALL LETTER ER
+ U+044F \xd1\x8f CYRILLIC SMALL LETTER YA */
+ { "[\xd0\xb0-\xd1\x8f]", "\xd0\xb3", 0, 1,
+ { { 0, 2 } } },
+ { "[\xd0\xb0-\xd1\x8f]", "\xd0\x93", REG_ICASE, 1,
+ { { 0, 2 } } },
+ { "[\xd1\x80-\xd1\x8f]", "\xd0\xa0", REG_ICASE, 1,
+ { { 0, 2 } } },
+};
+
+
+static int
+do_test (void)
+{
+ if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL)
+ {
+ puts ("setlocale failed");
+ return 1;
+ }
+
+ int ret = 0;
+
+ for (size_t i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)
+ {
+ regex_t re;
+ regmatch_t rm[5];
+ int n = regcomp (&re, tests[i].pattern, tests[i].flags);
+ if (n != 0)
+ {
+ char buf[500];
+ regerror (n, &re, buf, sizeof (buf));
+ printf ("regcomp %zd failed: %s\n", i, buf);
+ ret = 1;
+ continue;
+ }
+
+ if (regexec (&re, tests[i].string, tests[i].nmatch, rm, 0))
+ {
+ printf ("regexec %zd failed\n", i);
+ ret = 1;
+ regfree (&re);
+ continue;
+ }
+
+ for (n = 0; n < tests[i].nmatch; ++n)
+ if (rm[n].rm_so != tests[i].rm[n].rm_so
+ || rm[n].rm_eo != tests[i].rm[n].rm_eo)
+ {
+ if (tests[i].rm[n].rm_so == -1 && tests[i].rm[n].rm_eo == -1)
+ break;
+ printf ("regexec match failure rm[%d] %d..%d\n",
+ n, rm[n].rm_so, rm[n].rm_eo);
+ ret = 1;
+ break;
+ }
+
+ regfree (&re);
+ }
+
+ return ret;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/posix/regcomp.c b/posix/regcomp.c
index 446fed5445..6966b5da3c 100644
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -377,7 +377,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
applies to multibyte character sets; for single byte character
sets, the SIMPLE_BRACKET again suffices. */
if (dfa->mb_cur_max > 1
- && (cset->nchar_classes || cset->non_match
+ && (cset->nchar_classes || cset->non_match || cset->nranges
# ifdef _LIBC
|| cset->nequiv_classes
# endif /* _LIBC */
diff --git a/resolv/mapv4v6hostent.h b/resolv/mapv4v6hostent.h
index 4151ce3639..c11038adf3 100644
--- a/resolv/mapv4v6hostent.h
+++ b/resolv/mapv4v6hostent.h
@@ -57,13 +57,13 @@ typedef union {
char ac;
} align;
-static void
+static int
map_v4v6_hostent (struct hostent *hp, char **bpp, int *lenp)
{
char **ap;
if (hp->h_addrtype != AF_INET || hp->h_length != INADDRSZ)
- return;
+ return 0;
hp->h_addrtype = AF_INET6;
hp->h_length = IN6ADDRSZ;
for (ap = hp->h_addr_list; *ap; ap++)
@@ -71,11 +71,8 @@ map_v4v6_hostent (struct hostent *hp, char **bpp, int *lenp)
int i = sizeof (align) - ((u_long) *bpp % sizeof (align));
if (*lenp < (i + IN6ADDRSZ))
- {
- /* Out of memory. Truncate address list here. XXX */
- *ap = NULL;
- return;
- }
+ /* Out of memory. */
+ return 1;
*bpp += i;
*lenp -= i;
map_v4v6_address (*ap, *bpp);
@@ -83,4 +80,5 @@ map_v4v6_hostent (struct hostent *hp, char **bpp, int *lenp)
*bpp += IN6ADDRSZ;
*lenp -= IN6ADDRSZ;
}
+ return 0;
}
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 62e67e8b01..818a40a898 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -878,7 +878,8 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
}
bp += n;
linebuflen -= n;
- map_v4v6_hostent (result, &bp, &linebuflen);
+ if (map_v4v6_hostent (result, &bp, &linebuflen))
+ goto too_small;
}
*h_errnop = NETDB_SUCCESS;
return NSS_STATUS_SUCCESS;
@@ -953,7 +954,8 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
}
if (have_to_map)
- map_v4v6_hostent (result, &bp, &linebuflen);
+ if (map_v4v6_hostent (result, &bp, &linebuflen))
+ goto too_small;
*h_errnop = NETDB_SUCCESS;
return NSS_STATUS_SUCCESS;
}
diff --git a/string/bits/string3.h b/string/bits/string3.h
index a5593e3b89..1d759f181b 100644
--- a/string/bits/string3.h
+++ b/string/bits/string3.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005, 2007, 2009 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
@@ -77,7 +77,8 @@ __NTH (mempcpy (void *__restrict __dest, __const void *__restrict __src,
__extern_always_inline void *
__NTH (memset (void *__dest, int __ch, size_t __len))
{
- if (__builtin_constant_p (__len) && __len == 0)
+ if (__builtin_constant_p (__len) && __len == 0
+ && (!__builtin_constant_p (__ch) || __ch != 0))
{
__warn_memset_zero_len ();
return __dest;
diff --git a/sysdeps/generic/framestate.c b/sysdeps/generic/framestate.c
index a912a8c375..80375bba98 100644
--- a/sysdeps/generic/framestate.c
+++ b/sysdeps/generic/framestate.c
@@ -24,6 +24,7 @@
#define __frame_state_for fallback_frame_state_for
#include <unwind-dw2.c>
#undef __frame_state_for
+#include <libgcc_s.h>
typedef struct frame_state * (*framesf)(void *pc, struct frame_state *);
struct frame_state *__frame_state_for (void *pc,
@@ -36,7 +37,7 @@ __frame_state_for (void *pc, struct frame_state *frame_state)
if (frame_state_for == NULL)
{
- void *handle = __libc_dlopen ("libgcc_s.so.1");
+ void *handle = __libc_dlopen (LIBGCC_S_SO);
if (handle == NULL
|| (frame_state_for
diff --git a/sysdeps/generic/libgcc_s.h b/sysdeps/generic/libgcc_s.h
new file mode 100644
index 0000000000..e74a1034ca
--- /dev/null
+++ b/sysdeps/generic/libgcc_s.h
@@ -0,0 +1,2 @@
+/* Name of libgcc_s library provided by gcc. */
+#define LIBGCC_S_SO "libgcc_s.so.1"
diff --git a/sysdeps/ia64/memchr.S b/sysdeps/ia64/memchr.S
index cd062b2dd5..cdd71ca5a5 100644
--- a/sysdeps/ia64/memchr.S
+++ b/sysdeps/ia64/memchr.S
@@ -126,7 +126,16 @@ ENTRY(__memchr)
br.ret.sptk.many b0
.recovery:
- adds ret0 = -((MEMLAT + 1) * 8), ret0;;
+#if MEMLAT != 6
+# error "MEMLAT must be 6!"
+#endif
+(p[MEMLAT-6]) add ret0 = -8, ret0;;
+(p[MEMLAT-5]) add ret0 = -8, ret0;;
+(p[MEMLAT-4]) add ret0 = -8, ret0;;
+(p[MEMLAT-3]) add ret0 = -8, ret0;;
+(p[MEMLAT-2]) add ret0 = -8, ret0;;
+(p[MEMLAT-1]) add ret0 = -8, ret0;;
+(p[MEMLAT]) add ret0 = -8, ret0;;
(p[MEMLAT+1]) add ret0 = -8, ret0;;
(p[MEMLAT+2]) add ret0 = -8, ret0;;
.l4:
diff --git a/sysdeps/powerpc/fpu/e_sqrt.c b/sysdeps/powerpc/fpu/e_sqrt.c
index 24e0dd3523..e95b786a00 100644
--- a/sysdeps/powerpc/fpu/e_sqrt.c
+++ b/sysdeps/powerpc/fpu/e_sqrt.c
@@ -35,7 +35,7 @@ extern const float __t_sqrt[1024];
/* The method is based on a description in
Computation of elementary functions on the IBM RISC System/6000 processor,
P. W. Markstein, IBM J. Res. Develop, 34(1) 1990.
- Basically, it consists of two interleaved Newton-Rhapson approximations,
+ Basically, it consists of two interleaved Newton-Raphson approximations,
one to find the actual square root, and one to find its reciprocal
without the expense of a division operation. The tricky bit here
is the use of the POWER/PowerPC multiply-add operation to get the
@@ -44,7 +44,7 @@ extern const float __t_sqrt[1024];
The argument reduction works by a combination of table lookup to
obtain the initial guesses, and some careful modification of the
generated guesses (which mostly runs on the integer unit, while the
- Newton-Rhapson is running on the FPU). */
+ Newton-Raphson is running on the FPU). */
#ifdef __STDC__
double
@@ -102,7 +102,7 @@ __slow_ieee754_sqrt (x)
/* complete the INSERT_WORDS (sx, sxi, xi1) operation. */
sx = iw_u.value;
- /* Here we have three Newton-Rhapson iterations each of a
+ /* Here we have three Newton-Raphson iterations each of a
division and a square root and the remainder of the
argument reduction, all interleaved. */
sd = -(sg * sg - sx);
diff --git a/sysdeps/powerpc/fpu/e_sqrtf.c b/sysdeps/powerpc/fpu/e_sqrtf.c
index 8e8138a17d..ca44fac559 100644
--- a/sysdeps/powerpc/fpu/e_sqrtf.c
+++ b/sysdeps/powerpc/fpu/e_sqrtf.c
@@ -35,7 +35,7 @@ extern const float __t_sqrt[1024];
/* The method is based on a description in
Computation of elementary functions on the IBM RISC System/6000 processor,
P. W. Markstein, IBM J. Res. Develop, 34(1) 1990.
- Basically, it consists of two interleaved Newton-Rhapson approximations,
+ Basically, it consists of two interleaved Newton-Raphson approximations,
one to find the actual square root, and one to find its reciprocal
without the expense of a division operation. The tricky bit here
is the use of the POWER/PowerPC multiply-add operation to get the
@@ -44,7 +44,7 @@ extern const float __t_sqrt[1024];
The argument reduction works by a combination of table lookup to
obtain the initial guesses, and some careful modification of the
generated guesses (which mostly runs on the integer unit, while the
- Newton-Rhapson is running on the FPU). */
+ Newton-Raphson is running on the FPU). */
#ifdef __STDC__
float
@@ -90,7 +90,7 @@ __slow_ieee754_sqrtf (x)
sg = t_sqrt[0];
sy = t_sqrt[1];
- /* Here we have three Newton-Rhapson iterations each of a
+ /* Here we have three Newton-Raphson iterations each of a
division and a square root and the remainder of the
argument reduction, all interleaved. */
sd = -(sg * sg - sx);
diff --git a/sysdeps/unix/grantpt.c b/sysdeps/unix/grantpt.c
index 8c299e9147..b02bf7cccf 100644
--- a/sysdeps/unix/grantpt.c
+++ b/sysdeps/unix/grantpt.c
@@ -190,6 +190,10 @@ grantpt (int fd)
if (__dup2 (fd, PTY_FILENO) < 0)
_exit (FAIL_EBADF);
+#ifdef CLOSE_ALL_FDS
+ CLOSE_ALL_FDS ();
+#endif
+
execle (_PATH_PT_CHOWN, basename (_PATH_PT_CHOWN), NULL, NULL);
_exit (FAIL_EXEC);
}
diff --git a/sysdeps/unix/sysv/linux/bits/sched.h b/sysdeps/unix/sysv/linux/bits/sched.h
index 95d05b4ab2..18269a99b9 100644
--- a/sysdeps/unix/sysv/linux/bits/sched.h
+++ b/sysdeps/unix/sysv/linux/bits/sched.h
@@ -1,6 +1,6 @@
/* Definitions of constants and data structure for POSIX 1003.1b-1993
scheduling interface.
- Copyright (C) 1996-1999,2001-2003,2005,2006,2007,2008
+ Copyright (C) 1996-1999,2001-2003,2005,2006,2007,2008,2009
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -154,7 +154,7 @@ typedef struct
(__extension__ \
({ size_t __cpu = (cpu); \
__cpu < 8 * (setsize) \
- ? ((((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \
+ ? ((((__const __cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \
& __CPUMASK (__cpu))) != 0 \
: 0; }))
@@ -167,8 +167,8 @@ typedef struct
# else
# define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \
(__extension__ \
- ({ __cpu_mask *__arr1 = (cpusetp1)->__bits; \
- __cpu_mask *__arr2 = (cpusetp2)->__bits; \
+ ({ __const __cpu_mask *__arr1 = (cpusetp1)->__bits; \
+ __const __cpu_mask *__arr2 = (cpusetp2)->__bits; \
size_t __imax = (setsize) / sizeof (__cpu_mask); \
size_t __i; \
for (__i = 0; __i < __imax; ++__i) \
@@ -180,8 +180,8 @@ typedef struct
# define __CPU_OP_S(setsize, destset, srcset1, srcset2, op) \
(__extension__ \
({ cpu_set_t *__dest = (destset); \
- __cpu_mask *__arr1 = (srcset1)->__bits; \
- __cpu_mask *__arr2 = (srcset2)->__bits; \
+ __const __cpu_mask *__arr1 = (srcset1)->__bits; \
+ __const __cpu_mask *__arr2 = (srcset2)->__bits; \
size_t __imax = (setsize) / sizeof (__cpu_mask); \
size_t __i; \
for (__i = 0; __i < __imax; ++__i) \
diff --git a/sysdeps/unix/sysv/linux/grantpt.c b/sysdeps/unix/sysv/linux/grantpt.c
new file mode 100644
index 0000000000..f2fc60f83a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/grantpt.c
@@ -0,0 +1,42 @@
+#include <assert.h>
+#include <ctype.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <paths.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "not-cancel.h"
+#include "pty-private.h"
+
+
+/* Close all file descriptors except the one specified. */
+static void
+close_all_fds (void)
+{
+ DIR *dir = __opendir ("/proc/self/fd");
+ if (dir != NULL)
+ {
+ struct dirent64 *d;
+ while ((d = __readdir64 (dir)) != NULL)
+ if (isdigit (d->d_name[0]))
+ {
+ char *endp;
+ long int fd = strtol (d->d_name, &endp, 10);
+ if (*endp == '\0' && fd != PTY_FILENO && fd != dirfd (dir))
+ close_not_cancel_no_status (fd);
+ }
+
+ __closedir (dir);
+
+ int nullfd = open_not_cancel_2 (_PATH_DEVNULL, O_RDONLY);
+ assert (nullfd == STDIN_FILENO);
+ nullfd = open_not_cancel_2 (_PATH_DEVNULL, O_WRONLY);
+ assert (nullfd == STDOUT_FILENO);
+ __dup2 (STDOUT_FILENO, STDERR_FILENO);
+ }
+}
+#define CLOSE_ALL_FDS() close_all_fds()
+
+#include <sysdeps/unix/grantpt.c>
diff --git a/sysdeps/unix/sysv/linux/i386/bits/fcntl.h b/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
index 6a38dc03fe..a6db8a86b4 100644
--- a/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
@@ -92,8 +92,8 @@
#ifdef __USE_GNU
# define F_SETSIG 10 /* Set number of signal to be sent. */
# define F_GETSIG 11 /* Get number of signal to be sent. */
-# define F_SETOWN_EX 12 /* Get owner (thread receiving SIGIO). */
-# define F_GETOWN_EX 13 /* Set owner (thread receiving SIGIO). */
+# define F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */
+# define F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */
#endif
#ifdef __USE_GNU
diff --git a/sysdeps/unix/sysv/linux/i386/bits/mman.h b/sysdeps/unix/sysv/linux/i386/bits/mman.h
index 2b90c8d7d5..22aa401e02 100644
--- a/sysdeps/unix/sysv/linux/i386/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/i386/bits/mman.h
@@ -1,5 +1,5 @@
/* Definitions for POSIX memory map interface. Linux/i386 version.
- Copyright (C) 1997, 2000, 2003, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1997,2000,2003,2005,2006,2009 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
@@ -84,14 +84,17 @@
/* 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. */
-# define MADV_REMOVE 9 /* Remove these pages and resources. */
-# define MADV_DONTFORK 10 /* Do not inherit across fork. */
-# define MADV_DOFORK 11 /* Do inherit across fork. */
+# 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. */
+# define MADV_REMOVE 9 /* Remove these pages and resources. */
+# define MADV_DONTFORK 10 /* Do not inherit across fork. */
+# define MADV_DOFORK 11 /* Do inherit across fork. */
+# define MADV_MERGEABLE 12 /* KSM may merge identical pages. */
+# define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */
+# define MADV_HWPOISON 100 /* Poison a page for testing. */
#endif
/* The POSIX people had to invent similar names for the same things. */
diff --git a/sysdeps/unix/sysv/linux/i386/fallocate.c b/sysdeps/unix/sysv/linux/i386/fallocate.c
index 7a943e44c0..14e788386c 100644
--- a/sysdeps/unix/sysv/linux/i386/fallocate.c
+++ b/sysdeps/unix/sysv/linux/i386/fallocate.c
@@ -16,6 +16,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <errno.h>
#include <fcntl.h>
#include <sysdep.h>
@@ -28,5 +29,10 @@ extern int __call_fallocate (int fd, int mode, __off64_t offset, __off64_t len)
int
fallocate (int fd, int mode, __off_t offset, __off_t len)
{
+#ifdef __NR_fallocate
return __call_fallocate (fd, mode, offset, len);
+#else
+ __set_errno (ENOSYS);
+ return -1;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/i386/fallocate64.c b/sysdeps/unix/sysv/linux/i386/fallocate64.c
index 4998f5e644..85f315c9b6 100644
--- a/sysdeps/unix/sysv/linux/i386/fallocate64.c
+++ b/sysdeps/unix/sysv/linux/i386/fallocate64.c
@@ -16,6 +16,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <errno.h>
#include <fcntl.h>
#include <sysdep.h>
@@ -28,5 +29,10 @@ extern int __call_fallocate (int fd, int mode, __off64_t offset, __off64_t len)
int
fallocate64 (int fd, int mode, __off64_t offset, __off64_t len)
{
+#ifdef __NR_fallocate
return __call_fallocate (fd, mode, offset, len);
+#else
+ __set_errno (ENOSYS);
+ return -1;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h b/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
index 9a0245a6c4..51c5329ac2 100644
--- a/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
@@ -88,8 +88,8 @@
#ifdef __USE_GNU
# define F_SETSIG 10 /* Set number of signal to be sent. */
# define F_GETSIG 11 /* Get number of signal to be sent. */
-# define F_SETOWN_EX 12 /* Get owner (thread receiving SIGIO). */
-# define F_GETOWN_EX 13 /* Set owner (thread receiving SIGIO). */
+# define F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */
+# define F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */
#endif
#ifdef __USE_GNU
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/mman.h b/sysdeps/unix/sysv/linux/ia64/bits/mman.h
index a27a30fc0c..1b278c79ee 100644
--- a/sysdeps/unix/sysv/linux/ia64/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/ia64/bits/mman.h
@@ -1,5 +1,6 @@
/* Definitions for POSIX memory map interface. Linux/ia64 version.
- Copyright (C) 1997,1998,2000,2003,2005,2006 Free Software Foundation, Inc.
+ Copyright (C) 1997,1998,2000,2003,2005,2006,2009
+ 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
@@ -84,14 +85,17 @@
/* 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. */
-# define MADV_REMOVE 9 /* Remove these pages and resources. */
-# define MADV_DONTFORK 10 /* Do not inherit across fork. */
-# define MADV_DOFORK 11 /* Do inherit across fork. */
+# 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. */
+# define MADV_REMOVE 9 /* Remove these pages and resources. */
+# define MADV_DONTFORK 10 /* Do not inherit across fork. */
+# define MADV_DOFORK 11 /* Do inherit across fork. */
+# define MADV_MERGEABLE 12 /* KSM may merge identical pages. */
+# define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */
+# define MADV_HWPOISON 100 /* Poison a page for testing. */
#endif
/* The POSIX people had to invent similar names for the same things. */
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
index 6c4b66b7ac..4bdaf7bd04 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
@@ -85,15 +85,15 @@
#define F_SETLKW64 14 /* Set record locking info (blocking). */
#if defined __USE_BSD || defined __USE_UNIX98
-# define F_SETOWN 8 /* Get owner (process receiving of SIGIO). */
-# define F_GETOWN 9 /* Set owner (process receiving of SIGIO). */
+# define F_SETOWN 8 /* Get owner (process receiving SIGIO). */
+# define F_GETOWN 9 /* Set owner (process receiving SIGIO). */
#endif
#ifdef __USE_GNU
# define F_SETSIG 10 /* Set number of signal to be sent. */
# define F_GETSIG 11 /* Get number of signal to be sent. */
-# define F_SETOWN_EX 12 /* Get owner (thread receiving SIGIO). */
-# define F_GETOWN_EX 13 /* Set owner (thread receiving SIGIO). */
+# define F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */
+# define F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */
#endif
#ifdef __USE_GNU
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/mman.h b/sysdeps/unix/sysv/linux/powerpc/bits/mman.h
index d5729a1f1c..e6580f8220 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/mman.h
@@ -1,5 +1,6 @@
/* Definitions for POSIX memory map interface. Linux/PowerPC version.
- Copyright (C) 1997,2000,2003,2005,2006,2008 Free Software Foundation, Inc.
+ Copyright (C) 1997,2000,2003,2005,2006,2008,2009
+ 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
@@ -85,14 +86,17 @@
/* 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. */
-# define MADV_REMOVE 9 /* Remove these pages and resources. */
-# define MADV_DONTFORK 10 /* Do not inherit across fork. */
-# define MADV_DOFORK 11 /* Do inherit across fork. */
+# 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. */
+# define MADV_REMOVE 9 /* Remove these pages and resources. */
+# define MADV_DONTFORK 10 /* Do not inherit across fork. */
+# define MADV_DOFORK 11 /* Do inherit across fork. */
+# define MADV_MERGEABLE 12 /* KSM may merge identical pages. */
+# define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */
+# define MADV_HWPOISON 100 /* Poison a page for testing. */
#endif
/* The POSIX people had to invent similar names for the same things. */
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sync_file_range.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sync_file_range.c
new file mode 100644
index 0000000000..1ca4ce66df
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sync_file_range.c
@@ -0,0 +1,44 @@
+/* Selective file content synch'ing.
+ Copyright (C) 2006, 2007, 2009 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/types.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+
+#if defined __NR_sync_file_range2
+int
+sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags)
+{
+ return INLINE_SYSCALL (sync_file_range2, 4, fd, flags, from, to);
+}
+#else
+int
+sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (sync_file_range)
+
+# include <stub-tag.h>
+#endif
diff --git a/sysdeps/unix/sysv/linux/s390/bits/fcntl.h b/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
index d3dddbc368..0af0f93f1e 100644
--- a/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
@@ -107,8 +107,8 @@
#ifdef __USE_GNU
# define F_SETSIG 10 /* Set number of signal to be sent. */
# define F_GETSIG 11 /* Get number of signal to be sent. */
-# define F_SETOWN_EX 12 /* Get owner (thread receiving SIGIO). */
-# define F_GETOWN_EX 13 /* Set owner (thread receiving SIGIO). */
+# define F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */
+# define F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */
#endif
#ifdef __USE_GNU
diff --git a/sysdeps/unix/sysv/linux/s390/bits/mman.h b/sysdeps/unix/sysv/linux/s390/bits/mman.h
index d25531c282..daeafd48ff 100644
--- a/sysdeps/unix/sysv/linux/s390/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/mman.h
@@ -1,5 +1,5 @@
/* Definitions for POSIX memory map interface. Linux/s390 version.
- Copyright (C) 2000,2001,2002,2003,2005,2006 Free Software Foundation, Inc.
+ Copyright (C) 2000-2003,2005,2006,2009 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
@@ -84,14 +84,17 @@
/* 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. */
-# define MADV_REMOVE 9 /* Remove these pages and resources. */
-# define MADV_DONTFORK 10 /* Do not inherit across fork. */
-# define MADV_DOFORK 11 /* Do inherit across fork. */
+# 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. */
+# define MADV_REMOVE 9 /* Remove these pages and resources. */
+# define MADV_DONTFORK 10 /* Do not inherit across fork. */
+# define MADV_DOFORK 11 /* Do inherit across fork. */
+# define MADV_MERGEABLE 12 /* KSM may merge identical pages. */
+# define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */
+# define MADV_HWPOISON 100 /* Poison a page for testing. */
#endif
/* The POSIX people had to invent similar names for the same things. */
diff --git a/sysdeps/unix/sysv/linux/sh/bits/fcntl.h b/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
index d7a21ea2e2..a6db8a86b4 100644
--- a/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
@@ -85,15 +85,15 @@
#define F_SETLKW64 14 /* Set record locking info (blocking). */
#if defined __USE_BSD || defined __USE_UNIX98
-# define F_SETOWN 8 /* Get owner (process receiving of SIGIO). */
-# define F_GETOWN 9 /* Set owner (process receiving of SIGIO). */
+# define F_SETOWN 8 /* Get owner (process receiving SIGIO). */
+# define F_GETOWN 9 /* Set owner (process receiving SIGIO). */
#endif
#ifdef __USE_GNU
# define F_SETSIG 10 /* Set number of signal to be sent. */
# define F_GETSIG 11 /* Get number of signal to be sent. */
-# define F_SETOWN_EX 12 /* Get owner (thread receiving of SIGIO). */
-# define F_GETOWN_EX 13 /* Set owner (thread receiving of SIGIO). */
+# define F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */
+# define F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */
#endif
#ifdef __USE_GNU
diff --git a/sysdeps/unix/sysv/linux/sh/bits/mman.h b/sysdeps/unix/sysv/linux/sh/bits/mman.h
index 7a6b572a4e..aee0011255 100644
--- a/sysdeps/unix/sysv/linux/sh/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/sh/bits/mman.h
@@ -1,5 +1,6 @@
/* Definitions for POSIX memory map interface. Linux/SH version.
- Copyright (C) 1997,1999,2000,2003,2005,2006 Free Software Foundation, Inc.
+ Copyright (C) 1997,1999,2000,2003,2005,2006,2009
+ 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
@@ -83,14 +84,17 @@
/* 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. */
-# define MADV_REMOVE 9 /* Remove these pages and resources. */
-# define MADV_DONTFORK 10 /* Do not inherit across fork. */
-# define MADV_DOFORK 11 /* Do inherit across fork. */
+# 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. */
+# define MADV_REMOVE 9 /* Remove these pages and resources. */
+# define MADV_DONTFORK 10 /* Do not inherit across fork. */
+# define MADV_DOFORK 11 /* Do inherit across fork. */
+# define MADV_MERGEABLE 12 /* KSM may merge identical pages. */
+# define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */
+# define MADV_HWPOISON 100 /* Poison a page for testing. */
#endif
/* The POSIX people had to invent similar names for the same things. */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
index dfa848a377..ad4f48e673 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
@@ -99,8 +99,8 @@
#ifdef __USE_GNU
# define F_SETSIG 10 /* Set number of signal to be sent. */
# define F_GETSIG 11 /* Get number of signal to be sent. */
-# define F_GETOWN_EX 12 /* Get owner (thread receiving SIGIO). */
-# define F_SETOWN_EX 13 /* Set owner (thread receiving SIGIO). */
+# define F_SETOWN_EX 15 /* Set owner (thread receiving SIGIO). */
+# define F_GETOWN_EX 16 /* Get owner (thread receiving SIGIO). */
#endif
#ifdef __USE_GNU
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/mman.h b/sysdeps/unix/sysv/linux/sparc/bits/mman.h
index be2b7eb280..71a3aa6a30 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/mman.h
@@ -1,5 +1,6 @@
/* Definitions for POSIX memory map interface. Linux/SPARC version.
- Copyright (C) 1997,1999,2000,2003,2005,2006 Free Software Foundation, Inc.
+ Copyright (C) 1997,1999,2000,2003,2005,2006,2009
+ 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
@@ -85,15 +86,18 @@
/* 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. */
-# define MADV_FREE 5 /* Content can be freed (Solaris). */
-# define MADV_REMOVE 9 /* Remove these pages and resources. */
-# define MADV_DONTFORK 10 /* Do not inherit across fork. */
-# define MADV_DOFORK 11 /* Do inherit across fork. */
+# 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. */
+# define MADV_FREE 5 /* Content can be freed (Solaris). */
+# define MADV_REMOVE 9 /* Remove these pages and resources. */
+# define MADV_DONTFORK 10 /* Do not inherit across fork. */
+# define MADV_DOFORK 11 /* Do inherit across fork. */
+# define MADV_MERGEABLE 12 /* KSM may merge identical pages. */
+# define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */
+# define MADV_HWPOISON 100 /* Poison a page for testing. */
#endif
/* The POSIX people had to invent similar names for the same things. */
diff --git a/sysdeps/unix/sysv/linux/sync_file_range.c b/sysdeps/unix/sysv/linux/sync_file_range.c
index 4e267a1602..41e08e0281 100644
--- a/sysdeps/unix/sysv/linux/sync_file_range.c
+++ b/sysdeps/unix/sysv/linux/sync_file_range.c
@@ -1,5 +1,5 @@
/* Selective file content synch'ing.
- Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2007, 2009 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
@@ -34,6 +34,14 @@ sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags)
__LONG_LONG_PAIR ((long) (to >> 32), (long) to),
flags);
}
+#elif defined __NR_sync_file_range2
+int
+sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags)
+{
+ return INLINE_SYSCALL (sync_file_range2, 6, fd, flags,
+ __LONG_LONG_PAIR ((long) (from >> 32), (long) from),
+ __LONG_LONG_PAIR ((long) (to >> 32), (long) to));
+}
#else
int
sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags)
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h b/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
index c3eb859e7d..6e96885d55 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
@@ -99,15 +99,15 @@
#endif
#if defined __USE_BSD || defined __USE_UNIX98
-# define F_SETOWN 8 /* Get owner (process receiving of SIGIO). */
-# define F_GETOWN 9 /* Set owner (process receiving of SIGIO). */
+# define F_SETOWN 8 /* Get owner (process receiving SIGIO). */
+# define F_GETOWN 9 /* Set owner (process receiving SIGIO). */
#endif
#ifdef __USE_GNU
# define F_SETSIG 10 /* Set number of signal to be sent. */
# define F_GETSIG 11 /* Get number of signal to be sent. */
-# define F_SETOWN_EX 12 /* Get owner (thread receiving SIGIO). */
-# define F_GETOWN_EX 13 /* Set owner (thread receiving SIGIO). */
+# define F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */
+# define F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */
#endif
#ifdef __USE_GNU
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/mman.h b/sysdeps/unix/sysv/linux/x86_64/bits/mman.h
index 7810682536..3dcbf9c317 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/mman.h
@@ -1,5 +1,5 @@
/* Definitions for POSIX memory map interface. Linux/x86_64 version.
- Copyright (C) 2001, 2003, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003, 2005, 2006, 2009 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
@@ -85,14 +85,17 @@
/* 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. */
-# define MADV_REMOVE 9 /* Remove these pages and resources. */
-# define MADV_DONTFORK 10 /* Do not inherit across fork. */
-# define MADV_DOFORK 11 /* Do inherit across fork. */
+# 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. */
+# define MADV_REMOVE 9 /* Remove these pages and resources. */
+# define MADV_DONTFORK 10 /* Do not inherit across fork. */
+# define MADV_DOFORK 11 /* Do inherit across fork. */
+# define MADV_MERGEABLE 12 /* KSM may merge identical pages. */
+# define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */
+# define MADV_HWPOISON 100 /* Poison a page for testing. */
#endif
/* The POSIX people had to invent similar names for the same things. */