summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2013-09-06 21:34:38 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2013-09-06 21:34:38 +0000
commit3f53fdce0a27a5c46127517c88c127d7e5904c81 (patch)
treeec1f99ed6263014c23f67fe7ed2cf289527ea1a9
parenta977505d8d09aa864a06433dac8bcb3ff92a30fe (diff)
Merge changes between r23927 and r23946 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@23947 7b3dc134-2b1b-0410-93df-9e9f96275f8d
-rw-r--r--libc/ChangeLog121
-rw-r--r--libc/benchtests/Makefile10
-rw-r--r--libc/benchtests/bench-memchr.c8
-rw-r--r--libc/benchtests/bench-memrchr-ifunc.c20
-rw-r--r--libc/benchtests/bench-memrchr.c40
-rw-r--r--libc/inet/netinet/in.h69
-rw-r--r--libc/locale/programs/locfile.c10
-rw-r--r--libc/localedata/ChangeLog9
-rw-r--r--libc/localedata/locales/nr_ZA5
-rw-r--r--libc/localedata/locales/nso_ZA4
-rw-r--r--libc/localedata/locales/ss_ZA4
-rw-r--r--libc/localedata/locales/tk_TM42
-rw-r--r--libc/localedata/locales/tn_ZA5
-rw-r--r--libc/localedata/locales/ve_ZA4
-rw-r--r--libc/string/Makefile2
-rw-r--r--libc/string/test-memrchr-ifunc.c20
-rw-r--r--libc/string/test-memrchr.c169
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/memrchr.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power7/memrchr.S4
-rw-r--r--libc/sysdeps/unix/sysv/linux/bits/in.h12
-rw-r--r--libc/sysdeps/unix/sysv/linux/tst-fanotify.c13
21 files changed, 491 insertions, 84 deletions
diff --git a/libc/ChangeLog b/libc/ChangeLog
index 1f291278b..81615fb44 100644
--- a/libc/ChangeLog
+++ b/libc/ChangeLog
@@ -1,3 +1,124 @@
+2013-09-06 Richard Sandiford <richard@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
+
+ * locale/programs/locfile.c: Include <assert.h>, <wchar.h> and
+ "localeinfo.h".
+ (obstack_chunk_alloc): New macro.
+ (obstack_chunk_free): Likewise.
+ (record_offset): New function.
+ (init_locale_data): Likewise.
+ (align_locale_data): Likewise.
+ (add_locale_empty): Likewise.
+ (add_locale_raw_data): Likewise.
+ (add_locale_raw_obstack): Likewise.
+ (add_locale_string): Likewise.
+ (add_locale_wstring): Likewise.
+ (add_locale_uint32): Likewise.
+ (add_locale_uint32_array): Likewise.
+ (add_locale_char): Likewise.
+ (start_locale_structure): Likewise.
+ (end_locale_structure): Likewise.
+ (start_locale_prelude): Likewise.
+ (end_locale_prelude): Likewise.
+ (write_locale_data): Take locale_file structure rather than an
+ iovec.
+ * locale/programs/locfile.h: Include "obstack.h".
+ (struct locale_file): Change to store locale file contents instead
+ of header.
+ (init_locale_data): New prototype.
+ (align_locale_data): Likewise.
+ (add_locale_empty): Likewise.
+ (add_locale_raw_data): Likewise.
+ (add_locale_raw_obstack): Likewise.
+ (add_locale_string): Likewise.
+ (add_locale_wstring): Likewise.
+ (add_locale_uint32): Likewise.
+ (add_locale_uint32_array): Likewise.
+ (add_locale_char): Likewise.
+ (start_locale_structure): Likewise.
+ (end_locale_structure): Likewise.
+ (start_locale_prelude): Likewise.
+ (end_locale_prelude): Likewise.
+ (write_locale_data): Update prototype.
+ * locale/programs/3level.h (struct TABLE): Remove result field.
+ (CONCAT(TABLE,_finalize)): Change to CONCAT(add_locale_,TABLE).
+ Use new locale_file interface.
+ [!NO_FINALIZE]: Change condition to [!NO_ADD_LOCALE].
+ (NO_FINALIZE): Change #undef to #undef of NO_ADD_LOCALE.
+ * locale/programs/ld-address.c (address_output): Use new
+ locale_file interface.
+ * locale/programs/ld-collate.c (NO_FINALIZE): Change to
+ NO_ADD_LOCALE.
+ (collate_finish): Don't call collseq_table_finalize.
+ (collate_output): Use new locale_file interface.
+ * locale/programs/ld-ctype.c: Move includes of "3level.h" earlier
+ in file.
+ (NO_FINALIZE): Change to NO_ADD_LOCALE.
+ (TABLE): Move defines earlier in file.
+ (ELEMENT): Likewise.
+ (DEFAULT): Likewise.
+ (wctrans_table_add): Move macro and inline function earlier in
+ file.
+ (struct wctype_table): Move type earlier in file.
+ (add_locale_wctype_table): New static prototype.
+ (struct locale_ctype_t): Use logical types instead of struct iovec
+ pointers for members.
+ (ctype_output): Use new locale_file interface.
+ (wctype_table_finalize): Change to add_locale_wctype_table. Use
+ new locale_file interface.
+ (allocate_arrays): Update for use of new locale_file interface.
+ * locale/programs/ld-identification.c (identification_output): Use
+ new locale_file interface.
+ * locale/programs/ld-measurement.c (measurement_output): Likewise.
+ * locale/programs/ld-messages.c (messages_output): Likewise.
+ * locale/programs/ld-monetary.c (monetary_output): Likewise.
+ * locale/programs/ld-name.c (name_output): Likewise.
+ * locale/programs/ld-numeric.c (numeric_output): Likewise.
+ * locale/programs/ld-paper.c (paper_output): Likewise.
+ * locale/programs/ld-telephone.c (telephone_output): Likewise.
+ * locale/programs/ld-time.c (time_output): Likewise.
+
+2013-09-06 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
+
+ * benchtests/Makefile: Add memrchr benchmark.
+ * benchtests/bench-memchr.c (USE_AS_MEMRCHR): Add define to use
+ benchmark as memrchr.
+ * benchtests/bench-memrchr-ifunc.c: New file.
+ * benchtests/bench-memrchr.c: New file.
+
+2013-09-06 Will Newton <will.newton@linaro.org>
+
+ * benchtests/Makefile (string-bench): Add memcpy.
+
+2013-09-05 Carlos O'Donell <carlos@redhat.com>
+ Cong Wang <amwang@redhat.com>
+
+ * sysdeps/unix/sysv/linux/bits/in.h
+ [_UAPI_LINUX_IN6_H]: Define __USE_KERNEL_IPV6_DEFS.
+ * inet/netinet/in.h: Move in_addr definition and bits/in.h inclusion
+ before __USE_KERNEL_IPV6_DEFS uses.
+ * inet/netinet/in.h [!__USE_KERNEL_IPV6_DEFS]: Define IPPROTO_MH, and
+ IPPROTO_BEETPH.
+ [__USE_KERNEL_IPV6_DEFS]: Don't define any of IPPROTO_*, in6_addr,
+ sockaddr_in6, or ipv6_mreq.
+
+2013-09-05 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
+
+ * sysdeps/powerpc/powerpc32/power7/memrchr.S (__memrchr): Fix invalid
+ memory access for final bytes in some large inputs.
+ * sysdeps/powerpc/powerpc64/power7/memrchr.S (__memrchr): Likewise.
+
+2013-09-05 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
+
+ * string/test-memrchr.c: New file.
+ * string/test-memrchr-ifunc.c: New file.
+ * string/Makefile: Add new memrchr testcase.
+
+2013-09-05 Mike Frysinger <vapier@gentoo.org>
+
+ * sysdeps/unix/sysv/linux/tst-fanotify.c (do_test): Skip test when
+ fanotify_init returns EPERM.
+
2013-09-04 Joseph Myers <joseph@codesourcery.com>
* conform/conformtest.pl (newtoken): Treat tokens not allowed as
diff --git a/libc/benchtests/Makefile b/libc/benchtests/Makefile
index 4d4b909bc..9cb4ff900 100644
--- a/libc/benchtests/Makefile
+++ b/libc/benchtests/Makefile
@@ -24,11 +24,11 @@ bench := acos acosh asin asinh atan atanh cos cosh exp log modf pow rint sin \
sinh tan tanh
# String function benchmarks.
-string-bench := bcopy bzero memccpy memchr memcmp memmem memmove mempcpy \
- memset rawmemchr stpcpy stpncpy strcasecmp strcasestr strcat \
- strchr strchrnul strcmp strcpy strcspn strlen strncasecmp \
- strncat strncmp strncpy strnlen strpbrk strrchr strspn strstr \
- strcpy_chk stpcpy_chk
+string-bench := bcopy bzero memccpy memchr memcmp memcpy memmem memmove \
+ mempcpy memset rawmemchr stpcpy stpncpy strcasecmp strcasestr \
+ strcat strchr strchrnul strcmp strcpy strcspn strlen \
+ strncasecmp strncat strncmp strncpy strnlen strpbrk strrchr \
+ strspn strstr strcpy_chk stpcpy_chk memrchr
string-bench-ifunc := $(addsuffix -ifunc, $(string-bench))
string-bench-all := $(string-bench) $(string-bench-ifunc)
diff --git a/libc/benchtests/bench-memchr.c b/libc/benchtests/bench-memchr.c
index db099ad54..30c472c13 100644
--- a/libc/benchtests/bench-memchr.c
+++ b/libc/benchtests/bench-memchr.c
@@ -16,9 +16,10 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#define TEST_MAIN
-#define TEST_NAME "memchr"
-#include "bench-string.h"
+#ifndef USE_AS_MEMRCHR
+# define TEST_MAIN
+# define TEST_NAME "memchr"
+# include "bench-string.h"
typedef char *(*proto_t) (const char *, int, size_t);
char *simple_memchr (const char *, int, size_t);
@@ -34,6 +35,7 @@ simple_memchr (const char *s, int c, size_t n)
return (char *) s - 1;
return NULL;
}
+#endif
static void
do_one_test (impl_t *impl, const char *s, int c, size_t n, char *exp_res)
diff --git a/libc/benchtests/bench-memrchr-ifunc.c b/libc/benchtests/bench-memrchr-ifunc.c
new file mode 100644
index 000000000..fff8f018d
--- /dev/null
+++ b/libc/benchtests/bench-memrchr-ifunc.c
@@ -0,0 +1,20 @@
+/* Measure IFUNC implementations of memrchr function.
+ Copyright (C) 2013 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "bench-memrchr.c"
diff --git a/libc/benchtests/bench-memrchr.c b/libc/benchtests/bench-memrchr.c
new file mode 100644
index 000000000..96a597f22
--- /dev/null
+++ b/libc/benchtests/bench-memrchr.c
@@ -0,0 +1,40 @@
+/* Measure memrchr functions.
+ Copyright (C) 2013 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_MAIN
+#define TEST_NAME "memrchr"
+#include "bench-string.h"
+
+typedef char *(*proto_t) (const char *, int, size_t);
+char *simple_memrchr (const char *, int, size_t);
+
+IMPL (simple_memrchr, 0)
+IMPL (memrchr, 1)
+
+char *
+simple_memrchr (const char *s, int c, size_t n)
+{
+ s = s + n;
+ while (n--)
+ if (*--s == (char) c)
+ return (char *) s;
+ return NULL;
+}
+
+#define USE_AS_MEMRCHR
+#include "bench-memchr.c"
diff --git a/libc/inet/netinet/in.h b/libc/inet/netinet/in.h
index 89e3813d0..05c77e231 100644
--- a/libc/inet/netinet/in.h
+++ b/libc/inet/netinet/in.h
@@ -26,13 +26,21 @@
__BEGIN_DECLS
+/* Internet address. */
+typedef uint32_t in_addr_t;
+struct in_addr
+ {
+ in_addr_t s_addr;
+ };
+
+/* Get system-specific definitions. */
+#include <bits/in.h>
+
/* Standard well-defined IP protocols. */
enum
{
IPPROTO_IP = 0, /* Dummy protocol for TCP. */
#define IPPROTO_IP IPPROTO_IP
- IPPROTO_HOPOPTS = 0, /* IPv6 Hop-by-Hop options. */
-#define IPPROTO_HOPOPTS IPPROTO_HOPOPTS
IPPROTO_ICMP = 1, /* Internet Control Message Protocol. */
#define IPPROTO_ICMP IPPROTO_ICMP
IPPROTO_IGMP = 2, /* Internet Group Management Protocol. */
@@ -55,10 +63,6 @@ enum
#define IPPROTO_DCCP IPPROTO_DCCP
IPPROTO_IPV6 = 41, /* IPv6 header. */
#define IPPROTO_IPV6 IPPROTO_IPV6
- IPPROTO_ROUTING = 43, /* IPv6 routing header. */
-#define IPPROTO_ROUTING IPPROTO_ROUTING
- IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header. */
-#define IPPROTO_FRAGMENT IPPROTO_FRAGMENT
IPPROTO_RSVP = 46, /* Reservation Protocol. */
#define IPPROTO_RSVP IPPROTO_RSVP
IPPROTO_GRE = 47, /* General Routing Encapsulation. */
@@ -67,14 +71,10 @@ enum
#define IPPROTO_ESP IPPROTO_ESP
IPPROTO_AH = 51, /* authentication header. */
#define IPPROTO_AH IPPROTO_AH
- IPPROTO_ICMPV6 = 58, /* ICMPv6. */
-#define IPPROTO_ICMPV6 IPPROTO_ICMPV6
- IPPROTO_NONE = 59, /* IPv6 no next header. */
-#define IPPROTO_NONE IPPROTO_NONE
- IPPROTO_DSTOPTS = 60, /* IPv6 destination options. */
-#define IPPROTO_DSTOPTS IPPROTO_DSTOPTS
IPPROTO_MTP = 92, /* Multicast Transport Protocol. */
#define IPPROTO_MTP IPPROTO_MTP
+ IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET. */
+#define IPPROTO_BEETPH IPPROTO_BEETPH
IPPROTO_ENCAP = 98, /* Encapsulation Header. */
#define IPPROTO_ENCAP IPPROTO_ENCAP
IPPROTO_PIM = 103, /* Protocol Independent Multicast. */
@@ -90,6 +90,28 @@ enum
IPPROTO_MAX
};
+/* If __USER_KERNEL_IPV6_DEFS is defined then the user has included the kernel
+ network headers first and we should use those ABI-identical definitions
+ instead of our own. */
+#ifndef __USE_KERNEL_IPV6_DEFS
+enum
+ {
+ IPPROTO_HOPOPTS = 0, /* IPv6 Hop-by-Hop options. */
+#define IPPROTO_HOPOPTS IPPROTO_HOPOPTS
+ IPPROTO_ROUTING = 43, /* IPv6 routing header. */
+#define IPPROTO_ROUTING IPPROTO_ROUTING
+ IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header. */
+#define IPPROTO_FRAGMENT IPPROTO_FRAGMENT
+ IPPROTO_ICMPV6 = 58, /* ICMPv6. */
+#define IPPROTO_ICMPV6 IPPROTO_ICMPV6
+ IPPROTO_NONE = 59, /* IPv6 no next header. */
+#define IPPROTO_NONE IPPROTO_NONE
+ IPPROTO_DSTOPTS = 60, /* IPv6 destination options. */
+#define IPPROTO_DSTOPTS IPPROTO_DSTOPTS
+ IPPROTO_MH = 135, /* IPv6 mobility header. */
+#define IPPROTO_MH IPPROTO_MH
+ };
+#endif /* !__USE_KERNEL_IPV6_DEFS */
/* Type to represent a port. */
typedef uint16_t in_port_t;
@@ -134,15 +156,6 @@ enum
IPPORT_USERRESERVED = 5000
};
-
-/* Internet address. */
-typedef uint32_t in_addr_t;
-struct in_addr
- {
- in_addr_t s_addr;
- };
-
-
/* Definitions of the bits in an Internet address integer.
On subnets, host and network parts are found according to
@@ -191,7 +204,7 @@ struct in_addr
#define INADDR_ALLRTRS_GROUP ((in_addr_t) 0xe0000002) /* 224.0.0.2 */
#define INADDR_MAX_LOCAL_GROUP ((in_addr_t) 0xe00000ff) /* 224.0.0.255 */
-
+#ifndef __USE_KERNEL_IPV6_DEFS
/* IPv6 address */
struct in6_addr
{
@@ -209,6 +222,7 @@ struct in6_addr
# define s6_addr32 __in6_u.__u6_addr32
#endif
};
+#endif /* !__USE_KERNEL_IPV6_DEFS */
extern const struct in6_addr in6addr_any; /* :: */
extern const struct in6_addr in6addr_loopback; /* ::1 */
@@ -233,6 +247,7 @@ struct sockaddr_in
sizeof (struct in_addr)];
};
+#ifndef __USE_KERNEL_IPV6_DEFS
/* Ditto, for IPv6. */
struct sockaddr_in6
{
@@ -242,7 +257,7 @@ struct sockaddr_in6
struct in6_addr sin6_addr; /* IPv6 address */
uint32_t sin6_scope_id; /* IPv6 scope-id */
};
-
+#endif /* !__USE_KERNEL_IPV6_DEFS */
#if defined __USE_MISC || defined __USE_GNU
/* IPv4 multicast request. */
@@ -268,7 +283,7 @@ struct ip_mreq_source
};
#endif
-
+#ifndef __USE_KERNEL_IPV6_DEFS
/* Likewise, for IPv6. */
struct ipv6_mreq
{
@@ -278,7 +293,7 @@ struct ipv6_mreq
/* local interface */
unsigned int ipv6mr_interface;
};
-
+#endif /* !__USE_KERNEL_IPV6_DEFS */
#if defined __USE_MISC || defined __USE_GNU
/* Multicast group request. */
@@ -349,10 +364,6 @@ struct group_filter
* sizeof (struct sockaddr_storage)))
#endif
-
-/* Get system-specific definitions. */
-#include <bits/in.h>
-
/* Functions to convert between host and network byte order.
Please note that these functions normally take `unsigned long int' or
diff --git a/libc/locale/programs/locfile.c b/libc/locale/programs/locfile.c
index c91e996f9..f9b26493a 100644
--- a/libc/locale/programs/locfile.c
+++ b/libc/locale/programs/locfile.c
@@ -545,12 +545,12 @@ int swap_endianness_p;
/* The target's value of __align__(uint32_t) - 1. */
unsigned int uint32_align_mask = 3;
-/* When called outside a start_locale_structure()/end_locale_structure()
- or start_locale_prelude()/end_locale_prelude() block, record that the
+/* When called outside a start_locale_structure/end_locale_structure
+ or start_locale_prelude/end_locale_prelude block, record that the
next byte in FILE's obstack will be the first byte of a new element.
- Do likewise for the first call inside a start_locale_structure()/
- end_locale_structure() block. */
-static inline void
+ Do likewise for the first call inside a start_locale_structure/
+ end_locale_structure block. */
+static void
record_offset (struct locale_file *file)
{
if (file->structure_stage < 2)
diff --git a/libc/localedata/ChangeLog b/libc/localedata/ChangeLog
index 039610416..c87b205ca 100644
--- a/libc/localedata/ChangeLog
+++ b/libc/localedata/ChangeLog
@@ -1,3 +1,12 @@
+2013-09-06 Chris Leonard <cjl@sugarlabs,.org>
+
+ * locales/nr_ZA: Deduplicate country_car.
+ * locales/nso_ZA: Likewise.
+ * locales/ss_ZA: Likewise.
+ * locales/tn_ZA: Likewise.
+ * locales/ve_ZA: Likewise.
+ * locales/tk_TM: Comment reformat.
+
2013-09-04 Chris Leonard <cjl@sugarlabs,.org>
[BZ #15923]
diff --git a/libc/localedata/locales/nr_ZA b/libc/localedata/locales/nr_ZA
index 3c9e810b7..32c2e693d 100644
--- a/libc/localedata/locales/nr_ZA
+++ b/libc/localedata/locales/nr_ZA
@@ -227,7 +227,7 @@ country_post "<U005A><U0041>"
% UN Geneve 1949:68 Distinguishing signs of vehicles in international traffic
% http://www.unece.org/trans/conventn/disting-signs-5-2001.pdf
-% "ZA"
+% ZA
country_car "<U005A><U0041>"
% FIXME define the following correctly
@@ -281,7 +281,4 @@ country_ab2 "<U005A><U0041>"
% ZAF
country_ab3 "<U005A><U0041><U0046>"
country_num 710
-% ZA
-country_car "<U005A><U0041>"
-
END LC_ADDRESS
diff --git a/libc/localedata/locales/nso_ZA b/libc/localedata/locales/nso_ZA
index 0094ca726..abe2be23e 100644
--- a/libc/localedata/locales/nso_ZA
+++ b/libc/localedata/locales/nso_ZA
@@ -223,7 +223,7 @@ country_post "<U005A><U0041>"
% UN Geneve 1949:68 Distinguishing signs of vehicles in international traffic
% http://www.unece.org/trans/conventn/disting-signs-5-2001.pdf
-% "ZA"
+% ZA
country_car "<U005A><U0041>"
% FIXME define the following correctly
@@ -277,8 +277,6 @@ country_ab2 "<U005A><U0041>"
% ZAF
country_ab3 "<U005A><U0041><U0046>"
country_num 710
-% ZA
-country_car "<U005A><U0041>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ss_ZA b/libc/localedata/locales/ss_ZA
index 5c87e577c..19cb7413b 100644
--- a/libc/localedata/locales/ss_ZA
+++ b/libc/localedata/locales/ss_ZA
@@ -232,7 +232,7 @@ country_post "<U005A><U0041>"
% UN Geneve 1949:68 Distinguishing signs of vehicles in international traffic
% http://www.unece.org/trans/conventn/disting-signs-5-2001.pdf
-% "ZA"
+% ZA
country_car "<U005A><U0041>"
% FIXME define the following correctly
@@ -284,7 +284,5 @@ postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
country_num 710
country_ab2 "<U005A><U0041>"
country_ab3 "<U005A><U0041><U0046>"
-% ZA
-country_car "<U005A><U0041>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/tk_TM b/libc/localedata/locales/tk_TM
index 43059af29..d76450749 100644
--- a/libc/localedata/locales/tk_TM
+++ b/libc/localedata/locales/tk_TM
@@ -399,18 +399,20 @@ LC_MESSAGES
% (used for "yes" in English, but corresponding to "no" in Turkmen (well,
% ý actually)
%%%%%%%%
-yesstr "<U0068><U0061><U0077><U0061>" % hawa
-nostr "<U00FD><U006F><U006B>" % ýok
+% hawa
+yesstr "<U0068><U0061><U0077><U0061>"
+% ýok
+nostr "<U00FD><U006F><U006B>"
+% [hH]
yesexpr "<U005E><U005B><U0068><U0048>/
-<U005D><U002E><U002A>" % [hH]
+<U005D><U002E><U002A>"
+% [ýÝnN]
noexpr "<U005E><U005B><U00FD><U00DD>/
-<U006E><U004E><U005D><U002E><U002A>" % [ýÝnN]
+<U006E><U004E><U005D><U002E><U002A>"
END LC_MESSAGES
LC_PAPER
-%
% A4 Paper
-%
height 297
width 210
END LC_PAPER
@@ -433,19 +435,27 @@ postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E><U0025>/
<U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073><U0020><U0025>/
<U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025><U004E><U0025>/
<U007A><U0020><U0025><U0054><U0025><U004E><U0025><U0063><U0025><U004E>"
-
+% Türkmenistan
country_name "<U0054><U00FC><U0072><U006B><U006D>/
-<U0065><U006E><U0069><U0073><U0074><U0061><U006E>" % Türkmenistan
-country_post "<U0054><U004D>" % TM
-country_car "<U0054><U004D>" % TM
+<U0065><U006E><U0069><U0073><U0074><U0061><U006E>"
+% TM
+country_post "<U0054><U004D>"
+% TM
+country_car "<U0054><U004D>"
country_num 795
-country_ab2 "<U0054><U004D>" % TM
-country_ab3 "<U0054><U004B><U004D>" % TKM
+% TM
+country_ab2 "<U0054><U004D>"
+% TKM
+country_ab3 "<U0054><U004B><U004D>"
+% Türkmençe
lang_name "<U0054><U00FC><U0072><U006B><U006D>/
-<U0065><U006E><U00E7><U0065>" % Türkmençe
-lang_term "<U0074><U0075><U006B>" % tuk
-lang_lib "<U0074><U0075><U006B>" % tuk
-lang_ab "<U0074><U006B>" % tk
+<U0065><U006E><U00E7><U0065>"
+% tuk
+lang_term "<U0074><U0075><U006B>"
+% tuk
+lang_lib "<U0074><U0075><U006B>"
+% tk
+lang_ab "<U0074><U006B>"
END LC_ADDRESS
LC_TELEPHONE
diff --git a/libc/localedata/locales/tn_ZA b/libc/localedata/locales/tn_ZA
index 134ef0b4f..a3f36db29 100644
--- a/libc/localedata/locales/tn_ZA
+++ b/libc/localedata/locales/tn_ZA
@@ -235,7 +235,7 @@ country_post "<U005A><U0041>"
% UN Geneve 1949:68 Distinguishing signs of vehicles in international traffic
% http://www.unece.org/trans/conventn/disting-signs-5-2001.pdf
-% "ZA"
+% ZA
country_car "<U005A><U0041>"
% FIXME define the following correctly
@@ -288,8 +288,7 @@ country_ab2 "<U005A><U0041>"
% ZAF
country_ab3 "<U005A><U0041><U0046>"
country_num 710
-% ZA
-country_car "<U005A><U0041>"
+
END LC_ADDRESS
diff --git a/libc/localedata/locales/ve_ZA b/libc/localedata/locales/ve_ZA
index 26a68d040..b7cf30347 100644
--- a/libc/localedata/locales/ve_ZA
+++ b/libc/localedata/locales/ve_ZA
@@ -232,7 +232,7 @@ country_post "<U005A><U0041>"
% UN Geneve 1949:68 Distinguishing signs of vehicles in international traffic
% http://www.unece.org/trans/conventn/disting-signs-5-2001.pdf
-% "ZA"
+% ZA
country_car "<U005A><U0041>"
% FIXME define the following correctly
@@ -287,7 +287,5 @@ postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
country_num 710
country_ab2 "<U005A><U0041>"
country_ab3 "<U005A><U0041><U0046>"
-% ZA
-country_car "<U005A><U0041>"
END LC_ADDRESS
diff --git a/libc/string/Makefile b/libc/string/Makefile
index bc9a0cec3..5da0fe983 100644
--- a/libc/string/Makefile
+++ b/libc/string/Makefile
@@ -49,7 +49,7 @@ strop-tests := memchr memcmp memcpy memmove mempcpy memset memccpy \
stpcpy stpncpy strcat strchr strcmp strcpy strcspn \
strlen strncmp strncpy strpbrk strrchr strspn memmem \
strstr strcasestr strnlen strcasecmp strncasecmp \
- strncat rawmemchr strchrnul bcopy bzero
+ strncat rawmemchr strchrnul bcopy bzero memrchr
tests := tester inl-tester noinl-tester testcopy test-ffs \
tst-strlen stratcliff tst-svc tst-inlcall \
bug-strncat1 bug-strspn1 bug-strpbrk1 tst-bswap \
diff --git a/libc/string/test-memrchr-ifunc.c b/libc/string/test-memrchr-ifunc.c
new file mode 100644
index 000000000..100dedbac
--- /dev/null
+++ b/libc/string/test-memrchr-ifunc.c
@@ -0,0 +1,20 @@
+/* Test and measure IFUNC implementations of memrchr function.
+ Copyright (C) 2013 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_IFUNC 1
+#include "test-memrchr.c"
diff --git a/libc/string/test-memrchr.c b/libc/string/test-memrchr.c
new file mode 100644
index 000000000..a4fe81190
--- /dev/null
+++ b/libc/string/test-memrchr.c
@@ -0,0 +1,169 @@
+/* Test and measure memrchr functions.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Written by Jakub Jelinek <jakub@redhat.com>, 1999.
+
+ 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#define TEST_MAIN
+#define TEST_NAME "memrchr"
+#include "test-string.h"
+
+typedef char *(*proto_t) (const char *, int, size_t);
+char *simple_memrchr (const char *, int, size_t);
+
+IMPL (simple_memrchr, 0)
+IMPL (memrchr, 1)
+
+char *
+simple_memrchr (const char *s, int c, size_t n)
+{
+ s = s + n;
+ while (n--)
+ if (*--s == (char) c)
+ return (char *) s;
+ return NULL;
+}
+
+static void
+do_one_test (impl_t *impl, const char *s, int c, size_t n, char *exp_res)
+{
+ char *res = CALL (impl, s, c, n);
+ if (res != exp_res)
+ {
+ error (0, 0, "Wrong result in function %s %p %p", impl->name,
+ res, exp_res);
+ ret = 1;
+ return;
+ }
+}
+
+static void
+do_test (size_t align, size_t pos, size_t len, int seek_char)
+{
+ size_t i;
+ char *result;
+
+ align &= 7;
+ if (align + len >= page_size)
+ return;
+
+ for (i = 0; i < len; ++i)
+ {
+ buf1[align + i] = 1 + 23 * i % 127;
+ if (buf1[align + i] == seek_char)
+ buf1[align + i] = seek_char + 1;
+ }
+ buf1[align + len] = 0;
+
+ if (pos < len)
+ {
+ buf1[align + pos] = seek_char;
+ buf1[align + len] = -seek_char;
+ result = (char *) (buf1 + align + pos);
+ }
+ else
+ {
+ result = NULL;
+ buf1[align + len] = seek_char;
+ }
+
+ FOR_EACH_IMPL (impl, 0)
+ do_one_test (impl, (char *) (buf1 + align), seek_char, len, result);
+}
+
+static void
+do_random_tests (void)
+{
+ size_t i, j, n, align, pos, len;
+ int seek_char;
+ char *result;
+ unsigned char *p = buf1 + page_size - 512;
+
+ for (n = 0; n < ITERATIONS; n++)
+ {
+ align = random () & 15;
+ pos = random () & 511;
+ if (pos + align >= 512)
+ pos = 511 - align - (random () & 7);
+ len = random () & 511;
+ if (pos >= len)
+ len = pos + (random () & 7);
+ if (len + align >= 512)
+ len = 512 - align - (random () & 7);
+ seek_char = random () & 255;
+ j = len + align + 64;
+ if (j > 512)
+ j = 512;
+
+ for (i = 0; i < j; i++)
+ {
+ if (i == pos + align)
+ p[i] = seek_char;
+ else
+ {
+ p[i] = random () & 255;
+ if (p[i] == seek_char)
+ p[i] = seek_char + 13;
+ }
+ }
+
+ if (pos < len)
+ result = (char *) (p + pos + align);
+ else
+ result = NULL;
+
+ FOR_EACH_IMPL (impl, 1)
+ if (CALL (impl, (char *) (p + align), seek_char, len) != result)
+ {
+ error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %d, %zd, %zd) %p != %p, p %p",
+ n, impl->name, align, seek_char, len, pos,
+ CALL (impl, (char *) (p + align), seek_char, len),
+ result, p);
+ ret = 1;
+ }
+ }
+}
+
+int
+test_main (void)
+{
+ size_t i;
+
+ test_init ();
+
+ printf ("%20s", "");
+ FOR_EACH_IMPL (impl, 0)
+ printf ("\t%s", impl->name);
+ putchar ('\n');
+
+ for (i = 1; i < 8; ++i)
+ {
+ do_test (0, 16 << i, 2048, 23);
+ do_test (i, 64, 256, 23);
+ do_test (0, 16 << i, 2048, 0);
+ do_test (i, 64, 256, 0);
+ }
+ for (i = 1; i < 32; ++i)
+ {
+ do_test (0, i, i + 1, 23);
+ do_test (0, i, i + 1, 0);
+ }
+
+ do_random_tests ();
+ return ret;
+}
+
+#include "../test-skeleton.c"
diff --git a/libc/sysdeps/powerpc/powerpc32/power7/memrchr.S b/libc/sysdeps/powerpc/powerpc32/power7/memrchr.S
index d1e3fda12..defd832b0 100644
--- a/libc/sysdeps/powerpc/powerpc32/power7/memrchr.S
+++ b/libc/sysdeps/powerpc/powerpc32/power7/memrchr.S
@@ -101,8 +101,8 @@ L(loop):
/* We're here because the counter reached 0, and that means we
didn't have any matches for BYTE in the whole range. Just return
the original range. */
- addi r9,r8,4
- cmplw cr6,r9,r7
+ addi r8,r8,4
+ cmplw cr6,r8,r7
bgt cr6,L(loop_small)
b L(null)
diff --git a/libc/sysdeps/powerpc/powerpc64/power7/memrchr.S b/libc/sysdeps/powerpc/powerpc64/power7/memrchr.S
index d24fbbb1b..c49995210 100644
--- a/libc/sysdeps/powerpc/powerpc64/power7/memrchr.S
+++ b/libc/sysdeps/powerpc/powerpc64/power7/memrchr.S
@@ -102,8 +102,8 @@ L(loop):
/* We're here because the counter reached 0, and that means we
didn't have any matches for BYTE in the whole range. Just return
the original range. */
- addi r9,r8,8
- cmpld cr6,r9,r7
+ addi r8,r8,8
+ cmpld cr6,r8,r7
bgt cr6,L(loop_small)
b L(null)
diff --git a/libc/sysdeps/unix/sysv/linux/bits/in.h b/libc/sysdeps/unix/sysv/linux/bits/in.h
index e959b33ea..d763ce9fc 100644
--- a/libc/sysdeps/unix/sysv/linux/bits/in.h
+++ b/libc/sysdeps/unix/sysv/linux/bits/in.h
@@ -21,6 +21,18 @@
# error "Never use <bits/in.h> directly; include <netinet/in.h> instead."
#endif
+/* If the application has already included linux/in6.h from a linux-based
+ kernel then we will not define the IPv6 IPPROTO_* defines, in6_addr (nor the
+ defines), sockaddr_in6, or ipv6_mreq. The ABI used by the linux-kernel and
+ glibc match exactly. Neither the linux kernel nor glibc should break this
+ ABI without coordination. */
+#ifdef _UAPI_LINUX_IN6_H
+/* This is not quite the same API since the kernel always defines s6_addr16 and
+ s6_addr32. This is not a violation of POSIX since POSIX says "at least the
+ following member" and that holds true. */
+# define __USE_KERNEL_IPV6_DEFS
+#endif
+
/* Options for use with `getsockopt' and `setsockopt' at the IP level.
The first word in the comment at the right is the data type used;
"bool" means a boolean value stored in an `int'. */
diff --git a/libc/sysdeps/unix/sysv/linux/tst-fanotify.c b/libc/sysdeps/unix/sysv/linux/tst-fanotify.c
index b88995d6f..b21e160ca 100644
--- a/libc/sysdeps/unix/sysv/linux/tst-fanotify.c
+++ b/libc/sysdeps/unix/sysv/linux/tst-fanotify.c
@@ -29,11 +29,14 @@ do_test (void)
fd = fanotify_init (0, 0);
if (fd < 0)
{
- if (errno == ENOSYS)
- {
- puts ("SKIP: missing support for fanotify (check CONFIG_FANOTIFY=y)");
- return 0;
- }
+ switch (errno) {
+ case ENOSYS:
+ puts ("SKIP: missing support for fanotify (check CONFIG_FANOTIFY=y)");
+ return 0;
+ case EPERM:
+ puts ("SKIP: missing proper permissions for runtime test");
+ return 0;
+ }
perror ("fanotify_init (0, 0) failed");
return 1;