summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2009-10-30 16:11:14 +0100
committerAndreas Schwab <schwab@redhat.com>2009-10-30 16:11:14 +0100
commit017dd87448e913383a8be5773569f218e8c661c5 (patch)
treed9124fdbb290416e60553c87aa9f9f1750d7acb8
parentf8e81cec78280ef92014305c1e10a808b1260683 (diff)
parent3a83202db6e5591f2b72974c1ad98602c6620770 (diff)
Merge remote branch 'origin/master' into fedora/master
-rw-r--r--ChangeLog254
-rw-r--r--Makefile63
-rw-r--r--Makerules3
-rw-r--r--NEWS11
-rw-r--r--elf/dl-sym.c5
-rw-r--r--elf/elf.h23
-rw-r--r--elf/ifuncdep2.c34
-rw-r--r--elf/ifuncmain1.c2
-rw-r--r--elf/ifuncmain1vis.c2
-rw-r--r--elf/ifuncmain2.c2
-rw-r--r--elf/ifuncmain5.c2
-rw-r--r--elf/ifuncmain6pie.c3
-rw-r--r--elf/ifuncmain7.c3
-rw-r--r--elf/ifuncmod1.c41
-rw-r--r--elf/ifuncmod3.c1
-rw-r--r--elf/ifuncmod5.c33
-rw-r--r--include/math.h3
-rw-r--r--include/stdio.h3
-rw-r--r--libio/ioputs.c5
-rw-r--r--libio/oldtmpfile.c4
-rw-r--r--locale/iso-639.def1
-rw-r--r--locale/programs/locale-spec.c2
-rw-r--r--localedata/ChangeLog35
-rw-r--r--localedata/SUPPORTED1
-rw-r--r--localedata/locales/POSIX4
-rw-r--r--localedata/locales/ast_ES1
-rw-r--r--localedata/locales/crh_UA37
-rw-r--r--localedata/locales/en_US2
-rw-r--r--localedata/locales/es_CO7
-rw-r--r--localedata/locales/it_CH6
-rw-r--r--localedata/locales/it_IT6
-rw-r--r--localedata/locales/ps_AF282
-rw-r--r--localedata/locales/shs_CA56
-rw-r--r--login/utmp_file.c4
-rw-r--r--malloc/malloc.c4
-rw-r--r--malloc/memusage.c9
-rw-r--r--malloc/memusagestat.c32
-rw-r--r--math/w_coshl.c4
-rw-r--r--misc/Makefile2
-rw-r--r--misc/Versions3
-rw-r--r--misc/mkdtemp.c4
-rw-r--r--misc/mkostemp.c4
-rw-r--r--misc/mkostemp64.c4
-rw-r--r--misc/mkostemps.c44
-rw-r--r--misc/mkostemps64.c41
-rw-r--r--misc/mkstemp.c4
-rw-r--r--misc/mkstemp64.c4
-rw-r--r--misc/mkstemps.c43
-rw-r--r--misc/mkstemps64.c40
-rw-r--r--misc/mktemp.c4
-rw-r--r--nis/nss_nis/nis-grp.c21
-rw-r--r--nptl/ChangeLog8
-rw-r--r--nptl/allocatestack.c123
-rw-r--r--nptl/nptl-init.c16
-rw-r--r--nscd/aicache.c6
-rw-r--r--nscd/dbg_log.c17
-rw-r--r--nscd/grpcache.c6
-rw-r--r--nscd/hstcache.c2
-rw-r--r--nscd/initgrcache.c6
-rw-r--r--nscd/pwdcache.c6
-rw-r--r--nss/nss_files/files-hosts.c7
-rw-r--r--resolv/res_send.c55
-rw-r--r--stdio-common/tempnam.c4
-rw-r--r--stdio-common/tempname.c5
-rw-r--r--stdio-common/tmpfile.c4
-rw-r--r--stdio-common/tmpnam.c4
-rw-r--r--stdio-common/tmpnam_r.c4
-rw-r--r--stdlib/stdlib.h50
-rw-r--r--sysdeps/generic/elf/ifunc-sel.h26
-rw-r--r--sysdeps/generic/netinet/ip.h38
-rw-r--r--sysdeps/gnu/getutmp.c10
-rw-r--r--sysdeps/gnu/netinet/udp.h12
-rw-r--r--sysdeps/i386/fpu/s_expm1.S6
-rw-r--r--sysdeps/i386/fpu/s_expm1f.S6
-rw-r--r--sysdeps/i386/fpu/s_expm1l.S3
-rw-r--r--sysdeps/ieee754/dbl-64/w_exp.c1
-rw-r--r--sysdeps/ieee754/flt-32/w_expf.c1
-rw-r--r--sysdeps/ieee754/ldbl-128/w_expl.c1
-rw-r--r--sysdeps/ieee754/ldbl-96/w_expl.c1
-rw-r--r--sysdeps/posix/tempname.c14
-rw-r--r--sysdeps/powerpc/elf/ifunc-sel.h46
-rw-r--r--sysdeps/powerpc/powerpc32/dl-irel.h45
-rw-r--r--sysdeps/powerpc/powerpc32/dl-machine.c6
-rw-r--r--sysdeps/powerpc/powerpc32/dl-machine.h8
-rw-r--r--sysdeps/powerpc/powerpc64/dl-irel.h58
-rw-r--r--sysdeps/powerpc/powerpc64/dl-machine.h39
-rw-r--r--sysdeps/pthread/aio_misc.c26
-rw-r--r--sysdeps/unix/sysv/linux/faccessat.c8
-rw-r--r--sysdeps/unix/sysv/linux/fchmodat.c8
-rw-r--r--sysdeps/unix/sysv/linux/fchownat.c8
-rw-r--r--sysdeps/unix/sysv/linux/fcntl.c42
-rw-r--r--sysdeps/unix/sysv/linux/futimesat.c8
-rw-r--r--sysdeps/unix/sysv/linux/fxstatat.c8
-rw-r--r--sysdeps/unix/sysv/linux/fxstatat64.c8
-rw-r--r--sysdeps/unix/sysv/linux/getpt.c7
-rw-r--r--sysdeps/unix/sysv/linux/i386/bits/fcntl.h19
-rw-r--r--sysdeps/unix/sysv/linux/i386/fchownat.c8
-rw-r--r--sysdeps/unix/sysv/linux/i386/fcntl.c29
-rw-r--r--sysdeps/unix/sysv/linux/i386/fxstatat.c8
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/fcntl.h19
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/siginfo.h6
-rw-r--r--sysdeps/unix/sysv/linux/kernel-features.h5
-rw-r--r--sysdeps/unix/sysv/linux/linkat.c8
-rw-r--r--sysdeps/unix/sysv/linux/mkdirat.c8
-rw-r--r--sysdeps/unix/sysv/linux/openat.c8
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h19
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/fchownat.c8
-rw-r--r--sysdeps/unix/sysv/linux/readlinkat.c8
-rw-r--r--sysdeps/unix/sysv/linux/renameat.c14
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/fcntl.h19
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/siginfo.h10
-rw-r--r--sysdeps/unix/sysv/linux/sh/bits/fcntl.h19
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/fcntl.h19
-rw-r--r--sysdeps/unix/sysv/linux/symlinkat.c8
-rw-r--r--sysdeps/unix/sysv/linux/ttyname.c7
-rw-r--r--sysdeps/unix/sysv/linux/unlinkat.c8
-rw-r--r--sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c8
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h19
-rw-r--r--sysdeps/unix/sysv/linux/xmknodat.c8
-rw-r--r--sysdeps/x86_64/multiarch/Makefile3
-rw-r--r--sysdeps/x86_64/multiarch/strchr.S177
-rw-r--r--sysdeps/x86_64/multiarch/strend-sse4.S49
-rw-r--r--sysdeps/x86_64/multiarch/strrchr.S278
123 files changed, 2375 insertions, 399 deletions
diff --git a/ChangeLog b/ChangeLog
index a14cabf7e2..389761eacd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,257 @@
+2009-10-30 Ulrich Drepper <drepper@redhat.com>
+
+ * misc/mkostemps.c: New file.
+ * misc/mkostemps64.c: New file.
+
+2009-10-30 Andreas Schwab <schwab@redhat.com>
+
+ * locale/programs/locale-spec.c: Include <error.h> and
+ <libintl.h>.
+
+ * sysdeps/unix/sysv/linux/readlinkat.c: Fix last change.
+
+2009-10-28 Roland McGrath <roland@redhat.com>
+
+ * Makefile (dist-prepare): New target.
+ (tag-for-dist): Target removed.
+ (glibc-%.tar): Pattern rule removed.
+ (%.tar): New pattern rule, does simple use of git archive.
+ (dist-version): Remove variable definition.
+ (dist): Just depend on that. Add .tar.xz dependency.
+ If dist-version variable not set on command line, depend on
+ dist-prepare, re-invoke with dist-version set via git describe.
+
+ * Makerules (%.xz): New pattern rule.
+
+2009-10-28 Alan Modra <amodra@bigpond.net.au>
+
+ * elf/ifuncdep2.c: Include ifunc-sel.h.
+ (global): Delete.
+ (foo1_ifunc, foo2_ifunc, foo3_ifunc): Use ifunc_sel.
+ * elf/ifuncmain1.c (global): Delete.
+ * elf/ifuncmain1vis.c: Likewise.
+ * elf/ifuncmain2.c: Likewise.
+ * elf/ifuncmain5.c: Likewise.
+ * elf/ifuncmod3.c: Likewise.
+ * elf/ifuncmain6pie.c: Include ifunc-sel.h.
+ (foo_ifunc): Use ifunc_one.
+ * elf/ifuncmain7.c: Likewise.
+ * elf/ifuncmod1.c: Include ifunc-sel.h.
+ (global): Define protected var.
+ (foo_ifunc, foo_hidden_ifunc, foo_protected_ifunc): Use ifunc_sel.
+ * elf/ifuncmod5.c: Likewise.
+ * sysdeps/generic/elf/ifunc-sel.h: New file.
+ * sysdeps/powerpc/elf/ifunc-sel.h: New file.
+
+2009-07-30 Alan Modra <amodra@bigpond.net.au>
+
+ * elf/elf.h (R_PPC_NUM, R_PPC64_NUM): Delete unused and incorrect.
+ (R_PPC_REL16*): Correct comments.
+ (R_PPC_IRELATIVE, R_PPC64_IRELATIVE, R_PPC64_JMP_IREL): Define.
+ (R_PPC64_REL16, R_PPC64_REL16_LO, R_PPC64_REL16_HI,
+ R_PPC64_REL16_HA): Define.
+ * sysdeps/powerpc/powerpc32/dl-irel.h: New file.
+ * sysdeps/powerpc/powerpc64/dl-irel.h: New file.
+ * sysdeps/powerpc/powerpc32/dl-machine.c (__elf_machine_fixup_plt):
+ Delete unused "reloc" param.
+ (__process_machine_rela): Handle R_PPC_IRELATIVE.
+ * sysdeps/powerpc/powerpc32/dl-machine.h (__elf_machine_fixup_plt):
+ Delete "reloc" param.
+ (elf_machine_rela): Handle STT_GNU_IFUNC functions and
+ R_PPC_IRELATIVE.
+ * sysdeps/powerpc/powerpc64/dl-machine.h (resolve_ifunc): New function.
+ (elf_machine_rela): Handle STT_GNU_IFUNC functions and new ifunc
+ relocations.
+
+d2009-10-30 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #10315]
+ * sysdeps/gnu/netinet/udp.h: Define UDP_CORK, UDP_ENCAP,
+ UDP_ENCAP_ESPINUDP_NON_IKE, UDP_ENCAP_ESPINUDP, and
+ UDP_ENCAP_L2TPINUDP.
+
+ [BZ #10349]
+ * sysdeps/posix/tempname.c (__gen_tempname): Take new second
+ parameter, specifying length of prefix.
+ * stdio-common/tempname.c: Likewise.
+ * include/stdio.h: Adjust prototypes.
+ * libio/oldtmpfile.c: Adjust caller.
+ * misc/mkdtemp.c: Likewise.
+ * misc/mkostemp.c: Likewise.
+ * misc/mkostemp64.c: Likewise.
+ * misc/mkstemp.c: Likewise.
+ * misc/mkstemp64.c: Likewise.
+ * misc/mktemp.c: Likewise.
+ * stdio-common/tempnam.c: Likewise.
+ * stdio-common/tmpfile.c: Likewise.
+ * stdio-common/tmpnam.c: Likewise.
+ * stdio-common/tmpnam_r.c: Likewise.
+ * misc/mkstemps.c: New file.
+ * misc/mkstemps64.c: New file.
+ * stdlib/stdlib.h: Add prototypes.
+ * misc/Makefile (routines): Add mkstemps and mkstemps64.
+ * misc/Versions: Export mkstemps and mkstemps64 for GLIBC_2.11.
+
+2009-10-29 Ulrich Drepper <drepper@redhat.com>
+
+ * locale/iso-639.def: Add sml entry.
+
+ [BZ #10391]
+ * resolv/res_send.c (send_dg): Initialize resplen.
+
+ [BZ #10446]
+ * sysdeps/unix/sysv/linux/ia64/bits/siginfo.h: Match sigevent
+ definition to the kernel's.
+ * sysdeps/unix/sysv/linux/s390/bits/siginfo.h: Likewise.
+
+2009-08-18 Anders Johansson <ajohansson@novell.com>
+
+ * nscd/aicache.c: Fix mixing up dataset and dataset->resp
+ offsets and record sizes in assert()s and response sending.
+ * nscd/grpcache.c: Likewise.
+ * nscd/hstcache.c: Likewise.
+ * nscd/initgrcache.c: Likewise.
+ * nscd/pwdcache.c: Likewise.
+
+2009-10-29 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #10540]
+ * nss/nss_files/files-hosts.c (_nss_files_gethostbyname4_r): If
+ /etc/hosts does not exist set errnop and herrnop appropriately.
+ Patch by Steve Langasek <vorlon@debian.org>.
+
+ [BZ #10553]
+ * malloc/malloc.c (malloc_info): Fix typos in format strings.
+ Patch by John Sullivan <jsrhbz@kanargh.force9.co.uk>.
+
+ [BZ #10564]
+ * login/utmp_file.c (TIMEOUT): Increase to 10.
+
+ [BZ #10609]
+ * sysdeps/unix/sysv/linux/faccessat.c: Fix handling of empty parameters
+ for file names in case the syscall is not available.
+ * sysdeps/unix/sysv/linux/fchmodat.c: Likewise.
+ * sysdeps/unix/sysv/linux/fchownat.c: Likewise.
+ * sysdeps/unix/sysv/linux/futimesat.c: Likewise.
+ * sysdeps/unix/sysv/linux/fxstatat.c: Likewise.
+ * sysdeps/unix/sysv/linux/fxstatat64.c: Likewise.
+ * sysdeps/unix/sysv/linux/i386/fchownat.c: Likewise.
+ * sysdeps/unix/sysv/linux/i386/fxstatat.c: Likewise.
+ * sysdeps/unix/sysv/linux/linkat.c: Likewise.
+ * sysdeps/unix/sysv/linux/mkdirat.c: Likewise.
+ * sysdeps/unix/sysv/linux/openat.c: Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/fchownat.c: Likewise.
+ * sysdeps/unix/sysv/linux/readlinkat.c: Likewise.
+ * sysdeps/unix/sysv/linux/renameat.c: Likewise.
+ * sysdeps/unix/sysv/linux/symlinkat.c: Likewise.
+ * sysdeps/unix/sysv/linux/unlinkat.c: Likewise.
+ * sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c: Likewise.
+ * sysdeps/unix/sysv/linux/xmknodat.c: Likewise.
+
+ [BZ #10643]
+ * sysdeps/pthread/aio_misc.c (__aio_enqueue_request): If thread
+ creation filed, remove the request from the 'requests' list and signal
+ the caller that the request is finished.
+
+ [BZ #10692]
+ * nis/nss_nis/nis-grp.c (internal_nis_getgrent_r): Don't free buffer
+ in error if batch_read. Patch by Joe Landers <jlanders@vmware.com>.
+
+ [BZ #10713]
+ * nis/nss_nis/nis-grp.c (internal_nis_endgrent): Start freeing blocks
+ from intern.start. Patch by Joe Landers <jlanders@vmware.com>.
+
+ [BZ #10780]
+ * libio/ioputs.c (_IO_puts): Make sure to not return a number which
+ overflows the int return type.
+
+ [BZ #10717]
+ * malloc/memusagestat.c (main): Fix repairing of trace files. We also
+ have to compute maxsize_total, we have to update the variables, and
+ the also_total handling must happen after the repair.
+
+ [BZ #10742]
+ * nscd/dbg_log.c (dbg_log): Print timestamp before the message text.
+ Based on patch by Jeffrey Bastian <jbastian@redhat.com>.
+
+2009-10-27 Andreas Schwab <schwab@redhat.com>
+
+ * sysdeps/unix/sysv/linux/getpt.c (__posix_openpt): Make sure
+ errno is always set when returning unsuccessfully.
+
+2009-10-29 Andreas Schwab <schwab@redhat.com>
+
+ * malloc/memusage.c (update_data): Fix index wraparound handling
+ so that buffer_cnt is actually reset.
+
+2009-10-29 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #10784]
+ * sysdeps/unix/sysv/linux/ttyname.c (getttyname): Always copy name
+ of the directory we look at into the static buffer if there is one
+ at the start of the loop.
+
+ [BZ #10789]
+ * sysdeps/generic/netinet/ip.h: Define IPTOS_ENC* and IPTOS_DSCP*
+ macros. Patch by Philip Prindeville <philipp@redfish-solutions.com>.
+
+ [BZ #10840]
+ * sysdeps/unix/sysv/linux/kernel-features.h: Define
+ __ASSUME_F_GETOWN_EX.
+ * sysdeps/unix/sysv/linux/fcntl.c: Implement F_GETOWN using F_GETOWN_EX
+ if possible.
+ * sysdeps/unix/sysv/linux/i386/fcntl.c: Likewise.
+
+ * sysdeps/unix/sysv/linux/sh/bits/fcntl.h: Define F_OWNER_*
+ and f_owner_ex.
+ * 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.
+
+ [BZ #10847]
+ * sysdeps/gnu/getutmp.c: Allow compatibility code to play around with
+ getutmpx symbol.
+
+ [BZ #10823]
+ * resolv/res_send.c (__libc_res_nsend): Fix copying of IPv4 server
+ addresses. Patch by Petar Bogdanovic <petar@smokva.net>.
+
+2009-10-24 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/ieee754/ldbl-128/w_expl.c: Add hidden_def (__expl).
+
+2009-10-27 Jakub Jelinek <jakub@redhat.com>
+
+ [BZ #10817]
+ * math/w_coshl.c (__coshl): Use __finitel instead of __finite.
+ Reported by Ray Chason.
+
+2009-10-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ * sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
+ strend-sse4.
+ * sysdeps/x86_64/multiarch/strchr.S: New file.
+ * sysdeps/x86_64/multiarch/strend-sse4.S: New file.
+ * sysdeps/x86_64/multiarch/strrchr.S: New file.
+
+2009-10-21 Andreas Schwab <schwab@redhat.com>
+
+ * elf/dl-sym.c (do_sym): Resolve STT_GNU_IFUNC symbols.
+
+2009-10-19 Andreas Schwab <schwab@redhat.com>
+
+ * include/math.h: Add hidden protos for __exp/__expf/__expl.
+ * sysdeps/ieee754/dbl-64/w_exp.c: Add hidden alias.
+ * sysdeps/ieee754/flt-32/w_expf.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/w_expl.c: Likewise.
+ * sysdeps/i386/fpu/s_expm1.S: Call __exp to handle overflow.
+ * sysdeps/i386/fpu/s_expm1f.S: Call __expf to handle overflow.
+ * sysdeps/i386/fpu/s_expm1l.S: Call __expl instead of
+ __ieee751_expl to handle overflow.
+
2009-10-14 David S. Miller <davem@davemloft.net>
* sysdeps/unix/sysv/linux/sparc/sparc32/____longjmp_chk.S: New file.
diff --git a/Makefile b/Makefile
index 6a384ade3c..61cfa436c4 100644
--- a/Makefile
+++ b/Makefile
@@ -347,51 +347,38 @@ TAGS:
| $(ETAGS) -o $@ -
# Make the distribution tarfile.
-.PHONY: dist tag-for-dist
+.PHONY: dist dist-prepare
generated := $(generated) stubs.h
-files-for-dist := README FAQ INSTALL NOTES configure
-
-tag-of-stem = glibc-$(subst .,_,$*)
-dist-selector = -r $(tag-of-stem)
-
-# Add-ons in the main repository but distributed in their own tar files.
-dist-separate = libidn
-
-glibc-%.tar $(dist-separate:%=glibc-%-%.tar): $(files-for-dist) \
- $(foreach D,$(dist-separate),\
- $D/configure)
- @rm -fr glibc-$*
- $(MAKE) -q `find sysdeps $(addsuffix /sysdeps,$(sysdeps-add-ons)) \
- -name configure`
- cvs $(CVSOPTS) -Q export -d glibc-$* $(dist-selector) libc
-# Touch all the configure scripts going into the tarball since cvs export
-# might have delivered configure.in newer than configure.
- find glibc-$* -name configure -print | xargs touch
- $(dist-do-separate-dirs)
- tar cf glibc-$*.tar glibc-$*
- rm -fr glibc-$*
-define dist-do-separate-dirs
-$(foreach dir,$(dist-separate),
- @rm -fr glibc-$(dir)-$*
- mv glibc-$*/$(dir) glibc-$(dir)-$*
- tar cf glibc-$(dir)-$*.tar glibc-$(dir)-$*
- rm -fr glibc-$(dir)-$*
-)
-endef
+files-for-dist := README FAQ INSTALL NOTES configure ChangeLog NEWS
+
+# Regenerate stuff, then error if these things are not committed yet.
+dist-prepare: $(files-for-dist)
+ conf=`find sysdeps $(addsuffix /sysdeps,$(sysdeps-add-ons)) \
+ -name configure`; \
+ $(MAKE) $$conf && \
+ git diff --stat HEAD -- $^ $$conf \
+ | $(AWK) '{ print; rc=1 } END { exit rc }'
+
+%.tar: FORCE
+ git archive --prefix=$*/ $* > $@.new
+ mv -f $@.new $@
# Do `make dist dist-version=X.Y.Z' to make tar files of an older version.
-dist-version = $(version)
-dist: $(foreach Z,.bz2 .gz,glibc-$(dist-version).tar$Z \
- $(foreach D,$(dist-separate),\
- glibc-$D-$(dist-version).tar$Z))
+ifneq (,$(strip $(dist-version)))
+dist: $(foreach Z,.bz2 .gz .xz,$(dist-version).tar$Z)
md5sum $^
-
-tag-for-dist: tag-$(dist-version)
-tag-%: $(files-for-dist)
- cvs $(CVSOPTS) -Q tag -c $(tag-of-stem)
+else
+dist: dist-prepare
+ @if v=`git describe`; then \
+ echo Distribution version $$v; \
+ $(MAKE) dist dist-version=$$v; \
+ else \
+ false; \
+ fi
+endif
define format-me
@rm -f $@
diff --git a/Makerules b/Makerules
index ab36e2f178..43fa5a701b 100644
--- a/Makerules
+++ b/Makerules
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2006, 2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 1991-2006,2007,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
@@ -1335,6 +1335,7 @@ echo-headers:
%.bz2: %; bzip2 -9vk $<
%.gz: %; gzip -9vnc $< > $@.new && mv -f $@.new $@
+%.xz: %; xz -9evk $<
# Common cleaning targets.
diff --git a/NEWS b/NEWS
index d2ac1aa02b..500936e80b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes. 2009-8-8
+GNU C Library NEWS -- history of user-visible changes. 2009-10-29
Copyright (C) 1992-2008, 2009 Free Software Foundation, Inc.
See the end for copying conditions.
@@ -7,7 +7,8 @@ using `glibc' in the "product" field.
Version 2.11
-* New interfaces: execvpe, pthread_sigqueue
+* New interfaces: execvpe, pthread_sigqueue, mkstemps, mkstemps64, mkostemps,
+ mkostemps64
Implemented by Ulrich Drepper.
* Checking version of longjmp added that fails if an uninitialized stack
@@ -16,9 +17,11 @@ Version 2.11
* STT_GNU_IFUNC is now supported in static executables.
Implemented by H.J. Lu.
+* STT_GNU_IFUNC implemented for PPC by Alan Modra.
+
* New optimized string functions for x86-64: strstr, strcasestr, memcmp,
strcspn, strpbrk, strspn, strcpy, stpcpy, strncpy, strcmp (SSE2, SSE4.2),
- strncmp (SSE2, SSE4.2).
+ strncmp (SSE2, SSE4.2), strchr (SSE4.2), strrchr (SSE4.2).
Contributed by H.J. Lu.
strlen, rawmemchr, strcmp (SSSE3), strncmp (SSSE3).
@@ -55,6 +58,8 @@ Version 2.11
support for requeueing to PI futexes. NPTL support added for x86-64.
Implemented by Ulrich Drepper.
+* New locale: ps_AF
+
Version 2.10
diff --git a/elf/dl-sym.c b/elf/dl-sym.c
index 740bb9a892..459729f0f2 100644
--- a/elf/dl-sym.c
+++ b/elf/dl-sym.c
@@ -191,6 +191,11 @@ RTLD_NEXT used in code not dynamically loaded"));
#endif
value = DL_SYMBOL_ADDRESS (result, ref);
+ /* 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)) ();
+
#ifdef SHARED
/* Auditing checkpoint: we have a new binding. Provide the
auditing libraries the possibility to change the value and
diff --git a/elf/elf.h b/elf/elf.h
index ce6de07e91..c772ff41ad 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -2041,9 +2041,6 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */
#define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */
-/* Keep this the last entry. */
-#define R_PPC_NUM 95
-
/* The remaining relocs are from the Embedded ELF ABI, and are not
in the SVR4 ELF ABI. */
#define R_PPC_EMB_NADDR32 101
@@ -2071,11 +2068,14 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */
#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */
+/* GNU extension to support local ifunc. */
+#define R_PPC_IRELATIVE 248
+
/* GNU relocs used in PIC code sequences. */
-#define R_PPC_REL16 249 /* word32 (sym-.) */
-#define R_PPC_REL16_LO 250 /* half16 (sym-.)@l */
-#define R_PPC_REL16_HI 251 /* half16 (sym-.)@h */
-#define R_PPC_REL16_HA 252 /* half16 (sym-.)@ha */
+#define R_PPC_REL16 249 /* half16 (sym+add-.) */
+#define R_PPC_REL16_LO 250 /* half16 (sym+add-.)@l */
+#define R_PPC_REL16_HI 251 /* half16 (sym+add-.)@h */
+#define R_PPC_REL16_HA 252 /* half16 (sym+add-.)@ha */
/* This is a phony reloc to handle any old fashioned TOC16 references
that may still be in object files. */
@@ -2197,8 +2197,13 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */
#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */
-/* Keep this the last entry. */
-#define R_PPC64_NUM 107
+/* GNU extension to support local ifunc. */
+#define R_PPC64_JMP_IREL 247
+#define R_PPC64_IRELATIVE 248
+#define R_PPC64_REL16 249 /* half16 (sym+add-.) */
+#define R_PPC64_REL16_LO 250 /* half16 (sym+add-.)@l */
+#define R_PPC64_REL16_HI 251 /* half16 (sym+add-.)@h */
+#define R_PPC64_REL16_HA 252 /* half16 (sym+add-.)@ha */
/* PowerPC64 specific values for the Dyn d_tag field. */
#define DT_PPC64_GLINK (DT_LOPROC + 0)
diff --git a/elf/ifuncdep2.c b/elf/ifuncdep2.c
index fb21eef5cb..758bae1932 100644
--- a/elf/ifuncdep2.c
+++ b/elf/ifuncdep2.c
@@ -1,6 +1,8 @@
/* Test 3 STT_GNU_IFUNC symbols. */
-extern int global;
+#include "ifunc-sel.h"
+
+int global __attribute__ ((visibility ("protected"))) = -1;
static int
one (void)
@@ -26,15 +28,7 @@ __asm__(".type foo1, %gnu_indirect_function");
void *
foo1_ifunc (void)
{
- switch (global)
- {
- case 1:
- return one;
- case -1:
- return minus_one;
- default:
- return zero;
- }
+ return ifunc_sel (one, minus_one, zero);
}
void * foo2_ifunc (void) __asm__ ("foo2");
@@ -43,15 +37,7 @@ __asm__(".type foo2, %gnu_indirect_function");
void *
foo2_ifunc (void)
{
- switch (global)
- {
- case 1:
- return minus_one;
- case -1:
- return one;
- default:
- return zero;
- }
+ return ifunc_sel (minus_one, one, zero);
}
void * foo3_ifunc (void) __asm__ ("foo3");
@@ -60,13 +46,5 @@ __asm__(".type foo3, %gnu_indirect_function");
void *
foo3_ifunc (void)
{
- switch (global)
- {
- case 1:
- return one;
- case -1:
- return zero;
- default:
- return minus_one;
- }
+ return ifunc_sel (one, zero, minus_one);
}
diff --git a/elf/ifuncmain1.c b/elf/ifuncmain1.c
index de7ffe8779..cc1e5ec5ba 100644
--- a/elf/ifuncmain1.c
+++ b/elf/ifuncmain1.c
@@ -7,8 +7,6 @@
#include <stdlib.h>
-int global = -1;
-
int ret_foo;
int ret_foo_hidden;
int ret_foo_protected;
diff --git a/elf/ifuncmain1vis.c b/elf/ifuncmain1vis.c
index a239d2dd0d..81cd12288e 100644
--- a/elf/ifuncmain1vis.c
+++ b/elf/ifuncmain1vis.c
@@ -7,8 +7,6 @@
#include <stdlib.h>
-int global = -1;
-
int ret_foo;
int ret_foo_hidden;
int ret_foo_protected;
diff --git a/elf/ifuncmain2.c b/elf/ifuncmain2.c
index cd9b2c8352..db3ba56a02 100644
--- a/elf/ifuncmain2.c
+++ b/elf/ifuncmain2.c
@@ -3,8 +3,6 @@
#include <stdlib.h>
-int global = -1;
-
extern int foo1 (void);
int
diff --git a/elf/ifuncmain5.c b/elf/ifuncmain5.c
index 7f128d006e..f398085cb4 100644
--- a/elf/ifuncmain5.c
+++ b/elf/ifuncmain5.c
@@ -2,8 +2,6 @@
#include <stdlib.h>
-int global = -1;
-
extern int foo (void);
extern int foo_protected (void);
diff --git a/elf/ifuncmain6pie.c b/elf/ifuncmain6pie.c
index 06f179bf9d..8478d4c408 100644
--- a/elf/ifuncmain6pie.c
+++ b/elf/ifuncmain6pie.c
@@ -6,6 +6,7 @@
*/
#include <stdlib.h>
+#include "ifunc-sel.h"
typedef int (*foo_p) (void);
extern foo_p foo_ptr;
@@ -22,7 +23,7 @@ __asm__(".type foo, %gnu_indirect_function");
void *
foo_ifunc (void)
{
- return one;
+ return ifunc_one (one);
}
extern int foo (void);
diff --git a/elf/ifuncmain7.c b/elf/ifuncmain7.c
index 099e929ffc..617a596d5e 100644
--- a/elf/ifuncmain7.c
+++ b/elf/ifuncmain7.c
@@ -5,6 +5,7 @@
*/
#include <stdlib.h>
+#include "ifunc-sel.h"
extern int foo (void);
@@ -21,7 +22,7 @@ static void *
__attribute__ ((used))
foo_ifunc (void)
{
- return one;
+ return ifunc_one (one);
}
typedef int (*foo_p) (void);
diff --git a/elf/ifuncmod1.c b/elf/ifuncmod1.c
index a1697b596d..2b8195ce55 100644
--- a/elf/ifuncmod1.c
+++ b/elf/ifuncmod1.c
@@ -4,8 +4,9 @@
2. Function pointer.
3. Visibility.
*/
+#include "ifunc-sel.h"
-extern int global;
+int global __attribute__ ((visibility ("protected"))) = -1;
static int
one (void)
@@ -20,7 +21,7 @@ minus_one (void)
}
static int
-zero (void)
+zero (void)
{
return 0;
}
@@ -28,52 +29,28 @@ zero (void)
void * foo_ifunc (void) __asm__ ("foo");
__asm__(".type foo, %gnu_indirect_function");
-void *
+void *
foo_ifunc (void)
{
- switch (global)
- {
- case 1:
- return one;
- case -1:
- return minus_one;
- default:
- return zero;
- }
+ return ifunc_sel (one, minus_one, zero);
}
void * foo_hidden_ifunc (void) __asm__ ("foo_hidden");
__asm__(".type foo_hidden, %gnu_indirect_function");
-void *
+void *
foo_hidden_ifunc (void)
{
- switch (global)
- {
- case 1:
- return minus_one;
- case -1:
- return one;
- default:
- return zero;
- }
+ return ifunc_sel (minus_one, one, zero);
}
void * foo_protected_ifunc (void) __asm__ ("foo_protected");
__asm__(".type foo_protected, %gnu_indirect_function");
-void *
+void *
foo_protected_ifunc (void)
{
- switch (global)
- {
- case 1:
- return one;
- case -1:
- return zero;
- default:
- return minus_one;
- }
+ return ifunc_sel (one, zero, minus_one);
}
/* Test hidden indirect function. */
diff --git a/elf/ifuncmod3.c b/elf/ifuncmod3.c
index 379d2c8d53..ca2d962600 100644
--- a/elf/ifuncmod3.c
+++ b/elf/ifuncmod3.c
@@ -5,4 +5,3 @@
int ret_foo;
int ret_foo_hidden;
int ret_foo_protected;
-int global = -1;
diff --git a/elf/ifuncmod5.c b/elf/ifuncmod5.c
index 2ca1c71541..9a08e8cf53 100644
--- a/elf/ifuncmod5.c
+++ b/elf/ifuncmod5.c
@@ -1,6 +1,7 @@
/* Test STT_GNU_IFUNC symbols without direct function call. */
+#include "ifunc-sel.h"
-extern int global;
+int global __attribute__ ((visibility ("protected"))) = -1;
static int
one (void)
@@ -26,15 +27,7 @@ __asm__(".type foo, %gnu_indirect_function");
void *
foo_ifunc (void)
{
- switch (global)
- {
- case 1:
- return one;
- case -1:
- return minus_one;
- default:
- return zero;
- }
+ return ifunc_sel (one, minus_one, zero);
}
void * foo_hidden_ifunc (void) __asm__ ("foo_hidden");
@@ -43,15 +36,7 @@ __asm__(".type foo_hidden, %gnu_indirect_function");
void *
foo_hidden_ifunc (void)
{
- switch (global)
- {
- case 1:
- return minus_one;
- case -1:
- return one;
- default:
- return zero;
- }
+ return ifunc_sel (minus_one, one, zero);
}
void * foo_protected_ifunc (void) __asm__ ("foo_protected");
@@ -60,15 +45,7 @@ __asm__(".type foo_protected, %gnu_indirect_function");
void *
foo_protected_ifunc (void)
{
- switch (global)
- {
- case 1:
- return one;
- case -1:
- return zero;
- default:
- return minus_one;
- }
+ return ifunc_sel (one, zero, minus_one);
}
/* Test hidden indirect function. */
diff --git a/include/math.h b/include/math.h
index 1005804273..eb29ef1a56 100644
--- a/include/math.h
+++ b/include/math.h
@@ -22,9 +22,12 @@ hidden_proto (__isnanl)
libm_hidden_proto (__fpclassify)
libm_hidden_proto (__fpclassifyf)
+libm_hidden_proto (__exp)
+libm_hidden_proto (__expf)
# ifndef __NO_LONG_DOUBLE_MATH
libm_hidden_proto (__fpclassifyl)
+libm_hidden_proto (__expl)
libm_hidden_proto (__expm1l)
# endif
diff --git a/include/stdio.h b/include/stdio.h
index 444aa39006..6b053b8aee 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -80,7 +80,8 @@ extern int __path_search (char *__tmpl, size_t __tmpl_len,
__const char *__dir, __const char *__pfx,
int __try_tempdir);
-extern int __gen_tempname (char *__tmpl, int __flags, int __kind);
+extern int __gen_tempname (char *__tmpl, int __suffixlen, int __flags,
+ int __kind);
/* The __kind argument to __gen_tempname may be one of: */
# define __GT_FILE 0 /* create a file */
# define __GT_DIR 1 /* create a directory */
diff --git a/libio/ioputs.c b/libio/ioputs.c
index 2f43e994e3..7fa5db5f1f 100644
--- a/libio/ioputs.c
+++ b/libio/ioputs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993,1996,1997,1998,1999,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1993,1996-1999,2003,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
@@ -27,6 +27,7 @@
#include "libioP.h"
#include <string.h>
+#include <limits.h>
int
_IO_puts (str)
@@ -40,7 +41,7 @@ _IO_puts (str)
|| _IO_fwide (_IO_stdout, -1) == -1)
&& _IO_sputn (_IO_stdout, str, len) == len
&& _IO_putc_unlocked ('\n', _IO_stdout) != EOF)
- result = len + 1;
+ result = MIN (INT_MAX, len + 1);
_IO_release_lock (_IO_stdout);
return result;
diff --git a/libio/oldtmpfile.c b/libio/oldtmpfile.c
index d85467a392..c9e4750cba 100644
--- a/libio/oldtmpfile.c
+++ b/libio/oldtmpfile.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1993,1996-2000,2003,2004,2007
+/* Copyright (C) 1991,1993,1996-2000,2003,2004,2007,2009
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -39,7 +39,7 @@ __old_tmpfile (void)
if (__path_search (buf, FILENAME_MAX, NULL, "tmpf", 0))
return NULL;
- fd = __gen_tempname (buf, 0, __GT_FILE);
+ fd = __gen_tempname (buf, 0, 0, __GT_FILE);
if (fd < 0)
return NULL;
diff --git a/locale/iso-639.def b/locale/iso-639.def
index de78aa1c0d..bb12d82692 100644
--- a/locale/iso-639.def
+++ b/locale/iso-639.def
@@ -84,6 +84,7 @@ DEFINE_LANGUAGE_CODE3 ("Caucasian (Other)", cau, cau)
DEFINE_LANGUAGE_CODE3 ("Cebuano", ceb, ceb)
DEFINE_LANGUAGE_CODE3 ("Celtic (Other)", cel, cel)
DEFINE_LANGUAGE_CODE3 ("Central American Indian (Other)", cai, cai)
+DEFINE_LANGUAGE_CODE3 ("Central Sama", sml, sml)
DEFINE_LANGUAGE_CODE3 ("Chagatai", chg, chg)
DEFINE_LANGUAGE_CODE3 ("Chamic languages", cmc, cmc)
DEFINE_LANGUAGE_CODE ("Chamorro", ch, cha, cha)
diff --git a/locale/programs/locale-spec.c b/locale/programs/locale-spec.c
index 63a7a32e05..43df46bb38 100644
--- a/locale/programs/locale-spec.c
+++ b/locale/programs/locale-spec.c
@@ -21,6 +21,8 @@
# include <config.h>
#endif
+#include <error.h>
+#include <libintl.h>
#include <stdio.h>
#include <string.h>
#include <wchar.h>
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index 11d78fde3f..0de7cccb87 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,3 +1,38 @@
+2009-10-30 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #10286]
+ * locales/ast_ES: Define first_weekday.
+
+ [BZ #10312]
+ * locales/es_CO: Define am_pm , t_fmt_ampm, first_weekday.
+ Patch by Jorge Guerrero <geojorg@gmail.com>.
+
+ [BZ #10319]
+ * locales/shs_CA: Fix accents.
+ Patch by Neskie Manuel <neskiem@gmail.com>.
+
+2009-10-29 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #10425]
+ * locales/it_IT: Fix date_fmt.
+ * locales/it_CH: Likewise.
+ Patch by Nicolo' Chieffo <nicolo.chieffo@gmail.com>.
+
+ * locales/POSIX: Define yesstr and nostr.
+ * locales/en_US: Likewise.
+ Patch by Petr Machata <pmachata@redhat.com>.
+
+ * locales/crh_UA: Fix first day of week and a few spellings.
+ Patch by Reþat SABIQ <tilde.birlik@gmail.com>.
+
+2009-10-15 Ulrich Drepper <drepper@redhat.com>
+
+ * SUPPORTED (SUPPORTED-LOCALES): Add ps_AF.UTF-8.
+
+ * locale/ps_AF: New file.
+ Contributed by Sayamindu Dasgupta <sayamindu@gmail.com> and
+ Pravin Satpute <psatpute@redhat.com>.
+
2009-06-16 Ulrich Drepper <drepper@redhat.com>
[BZ #10011]
diff --git a/localedata/SUPPORTED b/localedata/SUPPORTED
index ceb2415c19..2a8f61b806 100644
--- a/localedata/SUPPORTED
+++ b/localedata/SUPPORTED
@@ -322,6 +322,7 @@ pa_PK/UTF-8 \
pap_AN/UTF-8 \
pl_PL.UTF-8/UTF-8 \
pl_PL/ISO-8859-2 \
+ps_AF/UTF-8 \
pt_BR.UTF-8/UTF-8 \
pt_BR/ISO-8859-1 \
pt_PT.UTF-8/UTF-8 \
diff --git a/localedata/locales/POSIX b/localedata/locales/POSIX
index 00c5b4a0d6..457ce6ec64 100644
--- a/localedata/locales/POSIX
+++ b/localedata/locales/POSIX
@@ -328,4 +328,8 @@ LC_MESSAGES
yesexpr "<U005E><U005B><U0079><U0059><U005D>"
#
noexpr "<U005E><U005B><U006E><U004E><U005D>"
+#
+yesstr "<U0059><U0065><U0073>"
+#
+nostr "<U004E><U006F>"
END LC_MESSAGES
diff --git a/localedata/locales/ast_ES b/localedata/locales/ast_ES
index 249571cd3e..eb048d5bbb 100644
--- a/localedata/locales/ast_ES
+++ b/localedata/locales/ast_ES
@@ -109,6 +109,7 @@ t_fmt_ampm ""
date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
<U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
<U0025><U005A><U0020><U0025><U0059>"
+first_weekday 2
END LC_TIME
LC_PAPER
diff --git a/localedata/locales/crh_UA b/localedata/locales/crh_UA
index 5dfab24d90..a6fceeae0a 100644
--- a/localedata/locales/crh_UA
+++ b/localedata/locales/crh_UA
@@ -1,14 +1,14 @@
comment_char %
escape_char /
%
-% Crimean Tatar Language Locale for Ukraine (latin)
-% Source: Reshat Sabiq (Re<U015F>at)
-% Contact: Reshat Sabiq (Re<U015F>at)
-% Email: <tatar.iqtelif.i18n@gmail.com>
+% Crimean Tatar (Crimean Turkish) Language Locale for Ukraine (latin)
+% Source: Re<U015F>at SABIQ
+% Contact: Re<U015F>at SABIQ
+% Email: <tilde.birlik@gmail.com>
% Language: crh
% Territory: UA
-% Revision: 0.3
-% Date: 2006-10-09
+% Revision: 0.4
+% Date: 2009-08-16
% Application: general
% Users: general
% Charset: UTF-8
@@ -16,17 +16,17 @@ escape_char /
% for commercial purposes.
LC_IDENTIFICATION
-title "Crimean Tatar language locale for Ukraine"
+title "Crimean Tatar (Crimean Turkish) language locale for Ukraine"
source ""
address ""
-contact "Reshat Sabiq (Re<U015F>at)"
-email "tatar.iqtelif.i18n@gmail.com"
+contact "Re<U015F>at SABIQ"
+email "tilde.birlik@gmail.com"
tel ""
fax ""
language "Crimean Tatar"
territory "Ukraine"
-revision "0.3"
-date "2006-10-09"
+revision "0.4"
+date "2009-08-16"
category crh_UA:2000;LC_IDENTIFICATION
category crh_UA:2000;LC_CTYPE
@@ -124,11 +124,10 @@ copy "tr_TR"
END LC_CTYPE
LC_MESSAGES
-% TODO: No is "yoq"; is it OK that it corresponds with English "yes"?
yesstr "<U0065><U0062><U0065><U0074>"
-nostr "<U0079><U006F><U0071>"
-yesexpr "<U005E><U005B><U0045><U0065><U005D><U002E><U002A>"
-noexpr "<U005E><U005B><U0059><U0079><U004E><U006E><U005D><U002E><U002A>"
+nostr "<U0068><U0061><U0079><U0131><U0072>"
+yesexpr "<U005E><U005B><U0079><U0059><U0065><U0045><U005D>"
+noexpr "<U005E><U005B><U006E><U004E><U0068><U0048><U005D>"
END LC_MESSAGES
LC_MONETARY
@@ -157,9 +156,9 @@ END LC_NUMERIC
LC_TIME
day "<U0042><U0061><U007A><U0061><U0072>";/
- "<U0042><U0061><U007A><U0061><U0072><U0020><U0065><U0072><U0074><U0065><U0073><U0069>";/
+ "<U0042><U0061><U007A><U0061><U0072><U0065><U0072><U0074><U0065><U0073><U0069>";/
"<U0053><U0061><U006C><U0131>";/
- "<U00C7><U0061><U0072><U015F><U0065><U006E><U0062><U0065>";/
+ "<U00C7><U0061><U0072><U015F><U0065><U006D><U0062><U0065>";/
"<U0043><U0075><U006D><U0061><U0061><U0071><U015F><U0061><U006D><U0131>";/
"<U0043><U0075><U006D><U0061>";/
"<U0043><U0075><U006D><U0061><U0065><U0072><U0074><U0065><U0073><U0069>"
@@ -198,12 +197,14 @@ d_t_fmt "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062>/
<U0020><U0025><U0059><U0020><U0025><U0054>"
d_fmt "<U0025><U0064><U002E><U0025><U006D><U002E><U0025><U0059>"
t_fmt "<U0025><U0054>"
-am_pm "<U00D6><U0041>";"<U00D6><U0053>"
+am_pm "<U00DC><U0045>";"<U00DC><U0053>"
t_fmt_ampm "<U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053>/
<U0020><U0025><U0070>"
date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
<U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
<U0025><U005A><U0020><U0025><U0059>"
+first_weekday 2
+first_workday 2
END LC_TIME
LC_PAPER
diff --git a/localedata/locales/en_US b/localedata/locales/en_US
index 38425e815e..a41f5bc310 100644
--- a/localedata/locales/en_US
+++ b/localedata/locales/en_US
@@ -132,6 +132,8 @@ END LC_TIME
LC_MESSAGES
yesexpr "<U005E><U005B><U0079><U0059><U005D><U002E><U002A>"
noexpr "<U005E><U005B><U006E><U004E><U005D><U002E><U002A>"
+yesstr "<U0059><U0065><U0073>"
+nostr "<U004E><U006F>"
END LC_MESSAGES
LC_PAPER
diff --git a/localedata/locales/es_CO b/localedata/locales/es_CO
index bb983d7e7f..4c1de136be 100644
--- a/localedata/locales/es_CO
+++ b/localedata/locales/es_CO
@@ -117,11 +117,14 @@ mon "<U0065><U006E><U0065><U0072><U006F>";/
d_t_fmt "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
d_fmt "<U0025><U0064><U002F><U0025><U006D><U002F><U0025><U0079>"
t_fmt "<U0025><U0054>"
-am_pm "";""
-t_fmt_ampm ""
+am_pm "<U0041><U004D>";"<U0050><U004D>"
+t_fmt_ampm "<U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053>/
+<U0020><U0025><U0070>"
date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
<U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
<U0025><U005A><U0020><U0025><U0059>"
+% FIXME: found in CLDR
+first_weekday 2
END LC_TIME
LC_PAPER
diff --git a/localedata/locales/it_CH b/localedata/locales/it_CH
index 4fdc50a4b8..7ea13ad106 100644
--- a/localedata/locales/it_CH
+++ b/localedata/locales/it_CH
@@ -97,9 +97,9 @@ d_fmt "<U0025><U0064><U002E><U0020><U0025><U006D><U002E><U0020><U0025><U0079>"
t_fmt "<U0025><U0054>"
am_pm "";""
t_fmt_ampm ""
-date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
-<U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
-<U0025><U005A><U0020><U0025><U0059>"
+date_fmt "<U0025><U0061><U0020><U0025><U0065><U0020><U0025>\
+<U0062><U0020><U0025><U0059><U002C><U0020><U0025><U0048><U002E>\
+<U0025><U004D><U002E><U0025><U0053><U002C><U0020><U0025><U005A>"
END LC_TIME
LC_PAPER
diff --git a/localedata/locales/it_IT b/localedata/locales/it_IT
index 105f40c9f4..ec8151c68a 100644
--- a/localedata/locales/it_IT
+++ b/localedata/locales/it_IT
@@ -121,9 +121,9 @@ d_fmt "<U0025><U0064><U002F><U0025><U006D><U002F><U0025><U0059>"
t_fmt "<U0025><U0054>"
am_pm "";""
t_fmt_ampm ""
-date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
-<U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
-<U0025><U005A><U0020><U0025><U0059>"
+date_fmt "<U0025><U0061><U0020><U0025><U0065><U0020><U0025>\
+<U0062><U0020><U0025><U0059><U002C><U0020><U0025><U0048><U002E>\
+<U0025><U004D><U002E><U0025><U0053><U002C><U0020><U0025><U005A>"
END LC_TIME
LC_PAPER
diff --git a/localedata/locales/ps_AF b/localedata/locales/ps_AF
new file mode 100644
index 0000000000..7f686abbb5
--- /dev/null
+++ b/localedata/locales/ps_AF
@@ -0,0 +1,282 @@
+escape_char /
+comment_char %
+
+%%%%%%%%%%%%%%%%%%%%%%% locale definition file "ps_AF" %%%%%%%%%%%%%%%%%%%%%%
+
+% Pashto Locale for Afghanistan
+% Filename: ps_AF
+% Locale name: ps_AF.UTF-8
+% Language: Pashto
+% Territory: Afghanistan
+% Charset: UTF-8
+% Revision: 0.1
+% By: Nasir Gulzade<nasirgulzade@hotmail.com>
+% Creation Date: Thu, 15 Jan 2009 18:16:15 +0500 GMT
+% Last Modification Date: Fri, 16 Jan 2009 20:33:40 +0500 GMT
+%
+
+
+LC_IDENTIFICATION
+ title "Pashto locale for Afghanistan"
+ source "Nasir Gulzade"
+ address "see e-mail."
+ contact "Nasir Gulzade"
+ email "nasirgulzade@hotmail.com"
+ tel "+93 700530286"
+ fax ""
+ language "Pashto"
+ territory "Afghanistan"
+ revision "0.2"
+ date "2009-01-16"
+
+ category "ps_AF:2007";LC_IDENTIFICATION
+ category "ps_AF:2007";LC_CTYPE
+ category "ps_AF:2007";LC_COLLATE
+ category "ps_AF:2007";LC_TIME
+ category "ps_AF:2007";LC_NUMERIC
+ category "ps_AF:2007";LC_MONETARY
+ category "ps_AF:2007";LC_MESSAGES
+ category "ps_AF:2007";LC_MEASUREMENT
+ category "ps_AF:2007";LC_PAPER
+ category "ps_AF:2007";LC_NAME
+ category "ps_AF:2007";LC_ADDRESS
+ category "ps_AF:2007";LC_TELEPHONE
+END LC_IDENTIFICATION
+
+LC_CTYPE
+ copy "i18n"
+ outdigit <U0660>..<U0663>;<U06F4>;<U0665>..<U0669>
+ map to_outpunct; (<U002E>,<U066B>);(<U002C>,<U066C>)
+END LC_CTYPE
+
+LC_COLLATE
+% Collation rules updated as per requirement of glibc by Pravin Satpute <psatpute@redhat.com>
+% see rh bug 482881
+copy "iso14651_t1"
+
+collating-symbol <teh_with_ring>
+collating-symbol <hah_with_hamza_above>
+collating-symbol <hah_with_three_dots>
+collating-symbol <dal_with_ring>
+collating-symbol <reh_with_ring>
+collating-symbol <reh_with_dot_below_and_above>
+collating-symbol <seen_with_dot_below_and_above>
+collating-symbol <kaaf_with_ring>
+collating-symbol <noon_with_ring>
+collating-symbol <farsi_yeh>
+collating-symbol <arabic_letter_e>
+collating-symbol <yeh_with_tail>
+
+reorder-after <teh>
+<teh_with_ring>
+
+reorder-after <jeem>
+<hah_with_hamza_above>
+
+reorder-after <tcheh>
+<hah_with_three_dots>
+
+reorder-after <dal>
+<dal_with_ring>
+
+reorder-after <reh>
+<reh_with_ring>
+
+reorder-after <jeh>
+<reh_with_dot_below_and_above>
+
+reorder-after <sheen>
+<seen_with_dot_below_and_above>
+
+reorder-after <keheh>
+<kaaf_with_ring>
+
+reorder-after <noon>
+<noon_with_ring>
+
+reorder-after <heh>
+<farsi_yeh>
+
+reorder-after <alef_maksura>
+<arabic_letter_e>
+<yeh_with_tail>
+
+
+reorder-after <U062A>
+<U067C> <teh_with_ring>;<BAS>;<MIN>;IGNORE
+
+reorder-after <U062C>
+<U0681> <hah_with_hamza_above>;<BAS>;<MIN>;IGNORE
+
+reorder-after <U0686>
+<U0685> <hah_with_three_dots>;<BAS>;<MIN>;IGNORE
+
+reorder-after <U062F>
+<U0689> <dal_with_ring>;<BAS>;<MIN>;IGNORE
+
+reorder-after <U0631>
+<U0693> <reh_with_ring>;<BAS>;<MIN>;IGNORE
+
+reorder-after <U0698>
+<U0696> <reh_with_dot_below_and_above>;<BAS>;<MIN>;IGNORE
+
+reorder-after <U0634>
+<U069A> <seen_with_dot_below_and_above>;<BAS>;<MIN>;IGNORE
+
+reorder-after <U06A9>
+<U06AB> <kaaf_with_ring>;<BAS>;<MIN>;IGNORE
+
+reorder-after <U0646>
+<U06BC> <noon_with_ring>;<BAS>;<MIN>;IGNORE
+
+reorder-after <U0648>
+<U0647> <heh>;<BAS>;<MIN>;IGNORE
+<U06CC> <farsi_yeh>;<BAS>;<MIN>;IGNORE
+
+reorder-after <U064A>
+<U06D0> <arabic_letter_e>;<AYE>;<MIN>;IGNORE
+<U0626> "<alef_maksura><hamza>";"<BAS><BAS>";"<MIN><MIN>";IGNORE
+<U06CD> <yeh_with_tail>;<AYE>;<MIN>;IGNORE
+
+reorder-end
+
+END LC_COLLATE
+
+LC_TIME
+ abday "<U06CC><U002E>";/
+ "<U062F><U002E>";/
+ "<U0633><U002E>";/
+ "<U0686><U002E>";/
+ "<U067E><U002E>";/
+ "<U062C><U002E>";/
+ "<U0634><U002E>"
+ day "<U06CC><U06A9><U0634><U0646><U0628><U0647>";/
+ "<U062F><U0648><U0634><U0646><U0628><U0647>";/
+ "<U0633><U0647><U200C><U0634><U0646><U0628><U0647>";/
+ "<U0686><U0627><U0631><U0634><U0646><U0628><U0647>";/
+ "<U067E><U0646><U062C><U0634><U0646><U0628><U0647>";/
+ "<U062C><U0645><U0639><U0647>";/
+ "<U0634><U0646><U0628><U0647>"
+ abmon "<U062C><U0646><U0648>";/
+ "<U0641><U0628><U0631>";/
+ "<U0645><U0627><U0631>";/
+ "<U0627><U067E><U0631>";/
+ "<U0645><U0640><U06D0>";/
+ "<U062C><U0648><U0646>";/
+ "<U062C><U0648><U0644>";/
+ "<U0627><U06AB><U0633>";/
+ "<U0633><U067E><U062A>";/
+ "<U0627><U06A9><U062A>";/
+ "<U0646><U0648><U0645>";/
+ "<U062F><U0633><U0645>"
+ mon "<U062C><U0646><U0648><U0631><U064A>";/
+ "<U0641><U0628><U0631><U0648><U0631><U064A>";/
+ "<U0645><U0627><U0631><U0686>";/
+ "<U0627><U067E><U0631><U06CC><U0644>";/
+ "<U0645><U06D0>";/
+ "<U062C><U0648><U0646>";/
+ "<U062C><U0648><U0644><U0627><U064A>";/
+ "<U0627><U06AB><U0633><U062A>";/
+ "<U0633><U067E><U062A><U0645><U0628><U0631>";/
+ "<U0627><U06A9><U062A><U0648><U0628><U0631>";/
+ "<U0646><U0648><U0645><U0628><U0631>";/
+ "<U062F><U0633><U0645><U0628><U0631>"
+ d_t_fmt "<U0025><U0041><U0020><U062F><U0020><U0025><U0059>/
+<U0020><U062F><U0020><U0025><U0042><U0020><U0025><U0065><U060C>/
+<U0020><U0025><U005A><U0020><U0025><U0048><U003A><U0025><U004D>/
+<U003A><U0025><U0053>"
+ d_fmt "<U062F><U0020><U0025><U0059><U0020><U062F><U0020>/
+<U0025><U0042><U0020><U0025><U0065>"
+ t_fmt "<U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053>"
+ am_pm "<U063A><U002E><U0645><U002E>";/
+ "<U063A><U002E><U0648><U002E>"
+ t_fmt_ampm "<U202B><U0025><U0049><U003A><U0025><U004D><U003A>/
+<U0025><U0053><U0020><U0025><U0070><U202C>"
+ first_weekday 7
+ first_workday 7
+ cal_direction 3
+END LC_TIME
+
+LC_NUMERIC
+ decimal_point "<U066B>"
+ thousands_sep "<U066C>"
+ grouping 3
+END LC_NUMERIC
+
+LC_MONETARY
+ int_curr_symbol "<U0041><U0046><U004E><U0020>"
+ currency_symbol "<U0627><U0641><U063A><U0627><U0646><U06CD>"
+ mon_decimal_point "<U066B>"
+ mon_thousands_sep "<U066C>"
+ mon_grouping 3
+ positive_sign ""
+ negative_sign "<U002D>"
+ int_frac_digits 0
+ frac_digits 0
+ p_cs_precedes 0
+ p_sep_by_space 1
+ n_cs_precedes 0
+ n_sep_by_space 1
+ p_sign_posn 1
+ n_sign_posn 1
+END LC_MONETARY
+
+LC_MESSAGES
+ yesexpr "<U005E><U005B><U0079><U0059><U0628>/
+<U0066><U005D><U002E><U002A>"
+ noexpr "<U005E><U005B><U006E><U004E><U062E>/
+<U0646><U006F><U005D><U002E><U002A>"
+END LC_MESSAGES
+
+LC_MEASUREMENT
+ measurement 1
+END LC_MEASUREMENT
+
+LC_PAPER
+ height 297
+ width 210
+END LC_PAPER
+
+LC_NAME
+ name_fmt "<U0025><U0073><U0025><U0074><U0025><U0070><U0025>/
+<U0074><U0025><U0067><U0025><U0074><U0025><U006D><U0025><U0074><U0025><U0066>"
+ name_gen "" % No general salutation for all persons in Pashto.
+ name_mr "<U069A><U0627><U063A><U0644><U06D0>"
+ name_mrs "<U0628><U064A><U0020><U0628><U064A>"
+ name_miss "<U0628><U064A><U0020><U0628><U064A>"
+ name_ms "<U0628><U064A><U0020><U0628><U064A>"
+END LC_NAME
+
+LC_ADDRESS
+ postal_fmt "<U0025><U0061><U0025><U004E><U0025><U0066><U0025>/
+<U004E><U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025>/
+<U0073><U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072>/
+<U0025><U004E><U0025><U0043><U002D><U0025><U007A><U0020><U0025><U0054>/
+<U0025><U004E><U0025><U0063><U0025><U004E>"
+ country_name "<U0627><U0641><U063A><U0627><U0646>/
+<U0633><U062A><U0627><U0646>"
+ %country_post "<U0041><U0046><U0047>" % FIXME: Not confirmed.
+ country_ab2 "<U0041><U0046>"
+ country_ab3 "<U0041><U0046><U0047>"
+ country_num 004
+ country_car "<U0041><U0046><U0047>"
+
+ %country_isbn "" % Unfortunately not yet assigned :-(
+ % Since to date there is no ISBN agency working
+ % in Afghanistan.
+
+ lang_name "<U067E><U069A><U062A><U0648>"
+ lang_ab "<U0070><U0073>"
+ lang_term "<U0070><U0075><U0073>"
+ lang_lib "<U0070><U0075><U0073>"
+END LC_ADDRESS
+
+LC_TELEPHONE
+ tel_int_fmt "<U002B><U0025><U0063><U0020><U0025><U0061><U0020>/
+<U0025><U006C>"
+ tel_dom_fmt "<U0025><U0041><U2012><U0025><U006C>"
+ int_select "<U0030><U0030>"
+ int_prefix "<U0039><U0033>"
+END LC_TELEPHONE
+
+%%%%%%%%%%%%%%%%%%%% locale definition file "ps_AF" ends %%%%%%%%%%%%%%%%%%%%%
diff --git a/localedata/locales/shs_CA b/localedata/locales/shs_CA
index e6c52c7672..6c1b77f19d 100644
--- a/localedata/locales/shs_CA
+++ b/localedata/locales/shs_CA
@@ -55,10 +55,10 @@ reorder-after <RES-1>
% Present in iso14651_t1, but these definitions seem to have been
% removed from latest iso14651 tables.
reorder-after <U0041>
-<U00C6> "<a><e>";"<LIG><LIG>";"<CAP><CAP>";IGNORE
+<U00C6> "<U003C><U0061><U003E><U003C><U0065><U003E>";"<U003C><U004C><U0049><U0047><U003E><U003C><U004C><U0049><U0047><U003E>";"<U003C><U0043><U0041><U0050><U003E><U003C><U0043><U0041><U0050><U003E>";IGNORE
reorder-after <U0061>
-<U00E6> "<a><e>";"<LIG><LIG>";"<MIN><MIN>";IGNORE
+<U00E6> "<U003C><U0061><U003E><U003C><U0065><U003E>";"<U003C><U004C><U0049><U0047><U003E><U003C><U004C><U0049><U0047><U003E>";"<U003C><U004D><U0049><U004E><U003E><U003C><U004D><U0049><U004E><U003E>";IGNORE
reorder-end
@@ -80,41 +80,41 @@ LC_TIME
abday "<U0053><U0078><U0065>";/
"<U0053><U0070><U0065>";/
"<U0053><U0065><U006C>";/
- "<U004B><U0065><U006C>";/
- "<U004D><U0065><U0073>";/
- "<U0054><U0073><U0065>";/
- "<U0054><U0071><U006D>"
-day "<U0053><U0078><U0065><U0074><U0073><U0070><U0065><U0073><U0071><U0027><U0074>";/
- "<U0053><U0070><U0065><U0074><U006B><U0065><U0073><U0071><U0027><U0074>";/
- "<U0053><U0065><U006C><U0065><U0073><U0071><U0027><U0074>";/
- "<U0053><U006B><U0065><U006C><U006C><U0065><U0073><U0071><U0027><U0074>";/
- "<U0053><U006D><U0065><U0073><U0065><U0073><U0071><U0027><U0074>";/
- "<U0053><U0074><U0073><U0065><U006C><U006B><U0073><U0074><U0065><U0073><U0071><U0027><U0074>";/
- "<U0053><U0074><U0071><U006D><U0065><U006B><U0073><U0074><U0065><U0073><U0071><U0027><U0074>"
+ "<U0053><U006B><U0065>";/
+ "<U0053><U006D><U0065>";/
+ "<U0053><U0074><U0073>";/
+ "<U0053><U0074><U0071>"
+day "<U0053><U0078><U0065><U0074><U0073><U0070><U0065><U0073><U0071><U0313><U0074>";/
+ "<U0053><U0070><U0065><U0074><U006B><U0065><U0073><U0071><U0313><U0074>";/
+ "<U0053><U0065><U006C><U0065><U0073><U0071><U0313><U0074>";/
+ "<U0053><U006B><U0065><U006C><U006C><U0065><U0073><U0071><U0313><U0074>";/
+ "<U0053><U006D><U0065><U0073><U0065><U0073><U0071><U0313><U0074>";/
+ "<U0053><U0074><U0073><U0065><U006C><U006B><U0073><U0074><U0065><U0073><U0071><U0313><U0074>";/
+ "<U0053><U0074><U0071><U006D><U0065><U006B><U0073><U0074><U0065><U0073><U0071><U0313><U0074>"
abmon "<U004B><U0077><U0065>";/
"<U0054><U0073><U0069>";/
"<U0053><U0071><U0065>";/
- "<U0045><U0027><U0077>";/
+ "<U00C9><U0077><U0074>";/
"<U0045><U006C><U006C>";/
"<U0054><U0073><U0070>";/
"<U0054><U0071><U0077>";/
- "<U0043><U0074><U0027>";/
+ "<U0043><U0074><U0313><U00E9>";/
"<U0051><U0065><U006C>";/
- "<U0057><U0065><U006C>";/
+ "<U0057><U00E9><U006C>";/
"<U0055><U0037><U006C>";/
"<U0054><U0065><U0074>"
-mon "<U0050><U0065><U006C><U006C><U006B><U0077><U0065><U0074><U0027><U006D><U0069><U006E>";/
- "<U0050><U0065><U006C><U0063><U0074><U0073><U0069><U0070><U0077><U0065><U006E><U0027><U0074><U0065><U006E>";/
- "<U0050><U0065><U006C><U006C><U0073><U0071><U0065><U0027><U0070><U0074><U0073>";/
- "<U0050><U0065><U0073><U006C><U006C><U0065><U0027><U0077><U0074><U0065><U006E>";/
- "<U0050><U0065><U006C><U006C><U0037><U0065><U006C><U006C><U0037><U0065><U0027><U0037><U006C><U006C><U0071><U0074><U0065><U006E>";/
- "<U0050><U0065><U006C><U006C><U0074><U0073><U0070><U0065><U0027><U006E><U0074><U0073><U006B>";/
- "<U0050><U0065><U006C><U006C><U0074><U0071><U0077><U0065><U006C><U0071><U0027><U0077><U0065><U0027><U006C><U0027><U0074>";/
- "<U0050><U0065><U006C><U006C><U0063><U0074><U0027><U0065><U0027><U0078><U0065><U006C><U0027><U0063><U0074><U0065><U006E>";/
- "<U0050><U0065><U0073><U0071><U0065><U006C><U0071><U006C><U0065><U0027><U006C><U0074><U0065><U006E>";/
- "<U0050><U0065><U0073><U006C><U006C><U0077><U0065><U0027><U006C><U0073><U0074><U0065><U006E>";/
- "<U0050><U0065><U006C><U006C><U0063><U0037><U0065><U006C><U006C><U0037><U0075><U0027><U0037><U006C><U006C><U0063><U0077><U0074><U0065><U006E><U0027>";/
- "<U0050><U0065><U006C><U006C><U0074><U0065><U0074><U0065><U0027><U0074><U0071><U0027><U0065><U006D>"
+mon "<U0050><U0065><U006C><U006C><U006B><U0077><U0065><U0074><U0313><U006D><U0069><U006E>";/
+ "<U0050><U0065><U006C><U0063><U0074><U0073><U0069><U0070><U0077><U0065><U006E><U0313><U0074><U0065><U006E>";/
+ "<U0050><U0065><U006C><U006C><U0073><U0071><U00E9><U0070><U0074><U0073>";/
+ "<U0050><U0065><U0073><U006C><U006C><U00E9><U0077><U0074><U0065><U006E>";/
+ "<U0050><U0065><U006C><U006C><U0037><U0065><U006C><U006C><U0037><U00E9><U0037><U006C><U006C><U0071><U0074><U0065><U006E>";/
+ "<U0050><U0065><U006C><U006C><U0074><U0073><U0070><U00E9><U006E><U0074><U0073><U006B>";/
+ "<U0050><U0065><U006C><U006C><U0074><U0071><U0077><U0065><U006C><U0071><U0313><U0077><U00E9><U006C><U0313><U0074>";/
+ "<U0050><U0065><U006C><U006C><U0063><U0074><U0313><U00E9><U0078><U0065><U006C><U0313><U0063><U0074><U0065><U006E>";/
+ "<U0050><U0065><U0073><U0071><U0065><U006C><U0071><U006C><U00E9><U006C><U0074><U0065><U006E>";/
+ "<U0050><U0065><U0073><U006C><U006C><U0077><U00E9><U006C><U0073><U0074><U0065><U006E>";/
+ "<U0050><U0065><U006C><U006C><U0063><U0037><U0065><U006C><U006C><U0037><U00E9><U0037><U006C><U006C><U0063><U0077><U0074><U0065><U006E><U0313>";/
+ "<U0050><U0065><U006C><U006C><U0074><U0065><U0074><U00E9><U0074><U0071><U0313><U0065><U006D>"
d_t_fmt "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0072><U0020><U0025><U005A>"
d_fmt "<U0025><U0064><U002F><U0025><U006D><U002F><U0025><U0079>"
t_fmt "<U0025><U0072>"
diff --git a/login/utmp_file.c b/login/utmp_file.c
index f32144d1f7..d19a2c9c4d 100644
--- a/login/utmp_file.c
+++ b/login/utmp_file.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2004, 2007, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2004, 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>
and Paul Janzen <pcj@primenet.com>, 1996.
@@ -45,7 +45,7 @@ static struct utmp last_entry;
/* Locking timeout. */
#ifndef TIMEOUT
-# define TIMEOUT 1
+# define TIMEOUT 10
#endif
/* Do-nothing handler for locking timeout. */
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 79ba6b6f06..ea10d17f85 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -6474,8 +6474,8 @@ malloc_info (int options, FILE *fp)
fprintf (fp,
"<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
- "<system type=\"current\" size=\"%zu\n/>\n"
- "<system type=\"max\" size=\"%zu\n/>\n"
+ "<system type=\"current\" size=\"%zu\"/>\n"
+ "<system type=\"max\" size=\"%zu\"/>\n"
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n"
"</malloc>\n",
diff --git a/malloc/memusage.c b/malloc/memusage.c
index fcd58dc684..382261c1c4 100644
--- a/malloc/memusage.c
+++ b/malloc/memusage.c
@@ -163,15 +163,16 @@ update_data (struct header *result, size_t len, size_t old_len)
if (fd != -1)
{
uatomic32_t idx = catomic_exchange_and_add (&buffer_cnt, 1);
- if (idx >= 2 * buffer_size)
+ if (idx + 1 >= 2 * buffer_size)
{
/* We try to reset the counter to the correct range. If
this fails because of another thread increasing the
counter it does not matter since that thread will take
care of the correction. */
- uatomic32_t reset = idx % (2 * buffer_size);
- catomic_compare_and_exchange_val_acq (&buffer_cnt, reset, idx);
- idx = reset;
+ uatomic32_t reset = (idx + 1) % (2 * buffer_size);
+ catomic_compare_and_exchange_val_acq (&buffer_cnt, reset, idx + 1);
+ if (idx >= 2 * buffer_size)
+ idx = reset - 1;
}
assert (idx < 2 * DEFAULT_BUFFER_SIZE);
diff --git a/malloc/memusagestat.c b/malloc/memusagestat.c
index bf33175415..4d57f2cc23 100644
--- a/malloc/memusagestat.c
+++ b/malloc/memusagestat.c
@@ -191,13 +191,6 @@ main (int argc, char *argv[])
maxsize_heap = headent[1].heap;
maxsize_stack = headent[1].stack;
maxsize_total = headent[0].stack;
- if (also_total)
- {
- /* We use one scale and since we also draw the total amount of
- memory used we have to adapt the maximum. */
- maxsize_heap = maxsize_total;
- maxsize_stack = maxsize_total;
- }
if (maxsize_heap == 0 && maxsize_stack == 0)
{
@@ -210,18 +203,31 @@ main (int argc, char *argv[])
{
if (read (fd, &next, sizeof (next)) == 0)
break;
- if (next.heap > headent[1].heap)
- headent[1].heap = next.heap;
- if (next.stack > headent[1].stack)
- headent[1].stack = next.stack;
+ if (next.heap > maxsize_heap)
+ maxsize_heap = next.heap;
+ if (next.stack > maxsize_stack)
+ maxsize_stack = next.stack;
+ if (maxsize_heap + maxsize_stack > maxsize_total)
+ maxsize_total = maxsize_heap + maxsize_stack;
}
+ headent[0].stack = maxsize_total;
+ headent[1].heap = maxsize_heap;
+ headent[1].stack = maxsize_stack;
headent[1].time_low = next.time_low;
headent[1].time_high = next.time_high;
/* Write the computed values in the file. */
- lseek (fd, sizeof (struct entry), SEEK_SET);
- write (fd, &headent[1], sizeof (struct entry));
+ lseek (fd, 0, SEEK_SET);
+ write (fd, headent, 2 * sizeof (struct entry));
+ }
+
+ if (also_total)
+ {
+ /* We use one scale and since we also draw the total amount of
+ memory used we have to adapt the maximum. */
+ maxsize_heap = maxsize_total;
+ maxsize_stack = maxsize_total;
}
start_time = ((uint64_t) headent[0].time_high) << 32 | headent[0].time_low;
diff --git a/math/w_coshl.c b/math/w_coshl.c
index 5f4623a81a..52b8d93522 100644
--- a/math/w_coshl.c
+++ b/math/w_coshl.c
@@ -38,8 +38,8 @@ static char rcsid[] = "$NetBSD: $";
long double z;
z = __ieee754_coshl(x);
if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
- if(!__finite(z) && __finite(x)) {
- return __kernel_standard(x,x,205); /* cosh overflow */
+ if(!__finitel(z) && __finitel(x)) {
+ return __kernel_standard(x,x,205); /* cosh overflow */
} else
return z;
#endif
diff --git a/misc/Makefile b/misc/Makefile
index 13576347b9..ee6936180b 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -45,7 +45,7 @@ routines := brk sbrk sstk ioctl \
gethostid sethostid \
revoke vhangup \
swapon swapoff mktemp mkstemp mkstemp64 mkdtemp \
- mkostemp mkostemp64 \
+ mkostemp mkostemp64 mkstemps mkstemps64 mkostemps mkostemps64 \
ualarm usleep \
gtty stty \
ptrace \
diff --git a/misc/Versions b/misc/Versions
index c930eea944..3ffe3d138d 100644
--- a/misc/Versions
+++ b/misc/Versions
@@ -140,4 +140,7 @@ libc {
GLIBC_2.10 {
preadv; preadv64; pwritev; pwritev64;
}
+ GLIBC_2.11 {
+ mkstemps; mkstemps64; mkostemps; mkostemps64;
+ }
}
diff --git a/misc/mkdtemp.c b/misc/mkdtemp.c
index 7cd3a44f94..6200e9e4fb 100644
--- a/misc/mkdtemp.c
+++ b/misc/mkdtemp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 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
@@ -28,7 +28,7 @@ char *
mkdtemp (template)
char *template;
{
- if (__gen_tempname (template, 0, __GT_DIR))
+ if (__gen_tempname (template, 0, 0, __GT_DIR))
return NULL;
else
return template;
diff --git a/misc/mkostemp.c b/misc/mkostemp.c
index 372e4f3c0f..a2023ab470 100644
--- a/misc/mkostemp.c
+++ b/misc/mkostemp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2001, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2001, 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
@@ -32,5 +32,5 @@ mkostemp (template, flags)
char *template;
int flags;
{
- return __gen_tempname (template, flags, __GT_FILE);
+ return __gen_tempname (template, 0, flags, __GT_FILE);
}
diff --git a/misc/mkostemp64.c b/misc/mkostemp64.c
index 2ae730991e..18a506dd60 100644
--- a/misc/mkostemp64.c
+++ b/misc/mkostemp64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 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
@@ -29,5 +29,5 @@ mkostemp64 (template, flags)
char *template;
int flags;
{
- return __gen_tempname (template, flags | O_LARGEFILE, __GT_FILE);
+ return __gen_tempname (template, 0, flags | O_LARGEFILE, __GT_FILE);
}
diff --git a/misc/mkostemps.c b/misc/mkostemps.c
new file mode 100644
index 0000000000..030367296e
--- /dev/null
+++ b/misc/mkostemps.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 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 <stdio.h>
+#include <stdlib.h>
+
+#ifndef __GT_FILE
+# define __GT_FILE 0
+#endif
+
+/* Generate a unique temporary file name from TEMPLATE. The last six
+ characters before a suffix of length SUFFIXLEN of TEMPLATE must be
+ "XXXXXX"; they are replaced with a string that makes the filename
+ unique. Then open the file and return a fd. */
+int
+mkostemps (template, suffixlen, flags)
+ char *template;
+ int suffixlen;
+ int flags;
+{
+ if (suffixlen < 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return __gen_tempname (template, suffixlen, flags, __GT_FILE);
+}
diff --git a/misc/mkostemps64.c b/misc/mkostemps64.c
new file mode 100644
index 0000000000..0c6a2e7631
--- /dev/null
+++ b/misc/mkostemps64.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 2000, 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 <stdio.h>
+#include <stdlib.h>
+
+/* Generate a unique temporary file name from TEMPLATE. The last six
+ characters before a suffix of length SUFFIXLEN of TEMPLATE must be
+ "XXXXXX"; they are replaced with a string that makes the filename
+ unique. Then open the file and return a fd. */
+int
+mkostemps64 (template, suffixlen, flags)
+ char *template;
+ int suffixlen;
+ int flags;
+{
+ if (suffixlen < 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return __gen_tempname (template, suffixlen, flags | O_LARGEFILE, __GT_FILE);
+}
diff --git a/misc/mkstemp.c b/misc/mkstemp.c
index d3edca0791..bd3bbc88b2 100644
--- a/misc/mkstemp.c
+++ b/misc/mkstemp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2001, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2001, 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
@@ -31,5 +31,5 @@ int
mkstemp (template)
char *template;
{
- return __gen_tempname (template, 0, __GT_FILE);
+ return __gen_tempname (template, 0, 0, __GT_FILE);
}
diff --git a/misc/mkstemp64.c b/misc/mkstemp64.c
index 400bf47d06..c384bc71e6 100644
--- a/misc/mkstemp64.c
+++ b/misc/mkstemp64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 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
@@ -28,5 +28,5 @@ int
mkstemp64 (template)
char *template;
{
- return __gen_tempname (template, O_LARGEFILE, __GT_FILE);
+ return __gen_tempname (template, 0, O_LARGEFILE, __GT_FILE);
}
diff --git a/misc/mkstemps.c b/misc/mkstemps.c
new file mode 100644
index 0000000000..e5ff089443
--- /dev/null
+++ b/misc/mkstemps.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 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 <stdio.h>
+#include <stdlib.h>
+
+#ifndef __GT_FILE
+# define __GT_FILE 0
+#endif
+
+/* Generate a unique temporary file name from TEMPLATE. The last six
+ characters before a suffix of length SUFFIXLEN of TEMPLATE must be
+ "XXXXXX"; they are replaced with a string that makes the filename
+ unique. Then open the file and return a fd. */
+int
+mkstemps (template, suffixlen)
+ char *template;
+ int suffixlen;
+{
+ if (suffixlen < 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return __gen_tempname (template, suffixlen, 0, __GT_FILE);
+}
diff --git a/misc/mkstemps64.c b/misc/mkstemps64.c
new file mode 100644
index 0000000000..cf7562b48f
--- /dev/null
+++ b/misc/mkstemps64.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 2000, 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 <stdio.h>
+#include <stdlib.h>
+
+/* Generate a unique temporary file name from TEMPLATE. The last six
+ characters before a suffix of length SUFFIXLEN of TEMPLATE must be
+ "XXXXXX"; they are replaced with a string that makes the filename
+ unique. Then open the file and return a fd. */
+int
+mkstemps64 (template, suffixlen)
+ char *template;
+ int suffixlen;
+{
+ if (suffixlen < 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return __gen_tempname (template, suffixlen, O_LARGEFILE, __GT_FILE);
+}
diff --git a/misc/mktemp.c b/misc/mktemp.c
index f600d7ea7c..c42fd5ec44 100644
--- a/misc/mktemp.c
+++ b/misc/mktemp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000, 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
@@ -26,7 +26,7 @@ char *
mktemp (template)
char *template;
{
- if (__gen_tempname (template, 0, __GT_NOCREATE) < 0)
+ if (__gen_tempname (template, 0, 0, __GT_NOCREATE) < 0)
/* We return the null string if we can't find a unique file name. */
template[0] = '\0';
diff --git a/nis/nss_nis/nis-grp.c b/nis/nss_nis/nis-grp.c
index 6e36cf828f..6ad30eb1bb 100644
--- a/nis/nss_nis/nis-grp.c
+++ b/nis/nss_nis/nis-grp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1999, 2001-2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1999,2001-2004,2006,2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
@@ -55,7 +55,7 @@ internal_nis_endgrent (void)
oldkeylen = 0;
}
- struct response_t *curr = intern.next;
+ struct response_t *curr = intern.start;
while (curr != NULL)
{
@@ -203,16 +203,17 @@ internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen,
}
if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
- {
- free (result);
- *errnop = ERANGE;
- return NSS_STATUS_TRYAGAIN;
- }
+ {
+ if (!batch_read)
+ free (result);
+ *errnop = ERANGE;
+ return NSS_STATUS_TRYAGAIN;
+ }
char *p = strncpy (buffer, result, len);
buffer[len] = '\0';
while (isspace (*p))
- ++p;
+ ++p;
if (!batch_read)
free (result);
@@ -280,7 +281,7 @@ _nss_nis_getgrnam_r (const char *name, struct group *grp,
enum nss_status retval = yperr2nss (yperr);
if (retval == NSS_STATUS_TRYAGAIN)
- *errnop = errno;
+ *errnop = errno;
return retval;
}
@@ -329,7 +330,7 @@ _nss_nis_getgrgid_r (gid_t gid, struct group *grp,
enum nss_status retval = yperr2nss (yperr);
if (retval == NSS_STATUS_TRYAGAIN)
- *errnop = errno;
+ *errnop = errno;
return retval;
}
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index e9a278214a..4d0ca8035a 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,11 @@
+2009-10-30 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #3270]
+ * allocatestack.c (__nptl_setxid): Perform the operation in multiple
+ steps to avoid races with creation and terminations.
+ * nptl-init.c (sighandler_setxid): Adjust.
+ Patch by Daniel Jacobowitz.
+
2009-09-07 Andreas Schwab <schwab@redhat.com>
* sysdeps/pthread/bits/libc-lock.h (BP_SYM): Remove space before paren.
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index 67ea0c68f8..3c3585fe37 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -965,22 +965,53 @@ __find_thread_by_id (pid_t tid)
static void
internal_function
-setxid_signal_thread (struct xid_command *cmdp, struct pthread *t)
+setxid_mark_thread (struct xid_command *cmdp, struct pthread *t)
{
- if (! IS_DETACHED (t))
+ int ch;
+
+ /* Don't let the thread exit before the setxid handler runs. */
+ t->setxid_futex = 0;
+
+ do
{
- int ch;
- do
- {
- ch = t->cancelhandling;
+ ch = t->cancelhandling;
- /* If the thread is exiting right now, ignore it. */
- if ((ch & EXITING_BITMASK) != 0)
- return;
- }
- while (atomic_compare_and_exchange_bool_acq (&t->cancelhandling,
- ch | SETXID_BITMASK, ch));
+ /* If the thread is exiting right now, ignore it. */
+ if ((ch & EXITING_BITMASK) != 0)
+ return;
}
+ while (atomic_compare_and_exchange_bool_acq (&t->cancelhandling,
+ ch | SETXID_BITMASK, ch));
+}
+
+
+static void
+internal_function
+setxid_unmark_thread (struct xid_command *cmdp, struct pthread *t)
+{
+ int ch;
+
+ do
+ {
+ ch = t->cancelhandling;
+ if ((ch & SETXID_BITMASK) == 0)
+ return;
+ }
+ while (atomic_compare_and_exchange_bool_acq (&t->cancelhandling,
+ ch & ~SETXID_BITMASK, ch));
+
+ /* Release the futex just in case. */
+ t->setxid_futex = 1;
+ lll_futex_wake (&t->setxid_futex, 1, LLL_PRIVATE);
+}
+
+
+static int
+internal_function
+setxid_signal_thread (struct xid_command *cmdp, struct pthread *t)
+{
+ if ((t->cancelhandling & SETXID_BITMASK) == 0)
+ return 0;
int val;
INTERNAL_SYSCALL_DECL (err);
@@ -997,8 +1028,14 @@ setxid_signal_thread (struct xid_command *cmdp, struct pthread *t)
val = INTERNAL_SYSCALL (tkill, err, 2, t->tid, SIGSETXID);
#endif
+ /* If this failed, it must have had not started yet or else exited. */
if (!INTERNAL_SYSCALL_ERROR_P (val, err))
- atomic_increment (&cmdp->cntr);
+ {
+ atomic_increment (&cmdp->cntr);
+ return 1;
+ }
+ else
+ return 0;
}
@@ -1006,6 +1043,7 @@ int
attribute_hidden
__nptl_setxid (struct xid_command *cmdp)
{
+ int signalled;
int result;
lll_lock (stack_cache_lock, LLL_PRIVATE);
@@ -1022,7 +1060,7 @@ __nptl_setxid (struct xid_command *cmdp)
if (t == self)
continue;
- setxid_signal_thread (cmdp, t);
+ setxid_mark_thread (cmdp, t);
}
/* Now the list with threads using user-allocated stacks. */
@@ -1032,14 +1070,61 @@ __nptl_setxid (struct xid_command *cmdp)
if (t == self)
continue;
- setxid_signal_thread (cmdp, t);
+ setxid_mark_thread (cmdp, t);
}
- int cur = cmdp->cntr;
- while (cur != 0)
+ /* Iterate until we don't succeed in signalling anyone. That means
+ we have gotten all running threads, and their children will be
+ automatically correct once started. */
+ do
{
- lll_futex_wait (&cmdp->cntr, cur, LLL_PRIVATE);
- cur = cmdp->cntr;
+ signalled = 0;
+
+ list_for_each (runp, &stack_used)
+ {
+ struct pthread *t = list_entry (runp, struct pthread, list);
+ if (t == self)
+ continue;
+
+ signalled += setxid_signal_thread (cmdp, t);
+ }
+
+ list_for_each (runp, &__stack_user)
+ {
+ struct pthread *t = list_entry (runp, struct pthread, list);
+ if (t == self)
+ continue;
+
+ signalled += setxid_signal_thread (cmdp, t);
+ }
+
+ int cur = cmdp->cntr;
+ while (cur != 0)
+ {
+ lll_futex_wait (&cmdp->cntr, cur, LLL_PRIVATE);
+ cur = cmdp->cntr;
+ }
+ }
+ while (signalled != 0);
+
+ /* Clean up flags, so that no thread blocks during exit waiting
+ for a signal which will never come. */
+ list_for_each (runp, &stack_used)
+ {
+ struct pthread *t = list_entry (runp, struct pthread, list);
+ if (t == self)
+ continue;
+
+ setxid_unmark_thread (cmdp, t);
+ }
+
+ list_for_each (runp, &__stack_user)
+ {
+ struct pthread *t = list_entry (runp, struct pthread, list);
+ if (t == self)
+ continue;
+
+ setxid_unmark_thread (cmdp, t);
}
/* This must be last, otherwise the current thread might not have
diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index 5e9c250ff7..851bab2bf1 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -240,17 +240,23 @@ sighandler_setxid (int sig, siginfo_t *si, void *ctx)
INTERNAL_SYSCALL_NCS (__xidcmd->syscall_no, err, 3, __xidcmd->id[0],
__xidcmd->id[1], __xidcmd->id[2]);
- if (atomic_decrement_val (&__xidcmd->cntr) == 0)
- lll_futex_wake (&__xidcmd->cntr, 1, LLL_PRIVATE);
-
/* Reset the SETXID flag. */
struct pthread *self = THREAD_SELF;
- int flags = THREAD_GETMEM (self, cancelhandling);
- THREAD_SETMEM (self, cancelhandling, flags & ~SETXID_BITMASK);
+ int flags, newval;
+ do
+ {
+ flags = THREAD_GETMEM (self, cancelhandling);
+ newval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling,
+ flags & ~SETXID_BITMASK, flags);
+ }
+ while (flags != newval);
/* And release the futex. */
self->setxid_futex = 1;
lll_futex_wake (&self->setxid_futex, 1, LLL_PRIVATE);
+
+ if (atomic_decrement_val (&__xidcmd->cntr) == 0)
+ lll_futex_wake (&__xidcmd->cntr, 1, LLL_PRIVATE);
}
diff --git a/nscd/aicache.c b/nscd/aicache.c
index 524c0a63af..992357d2fe 100644
--- a/nscd/aicache.c
+++ b/nscd/aicache.c
@@ -453,13 +453,13 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
{
assert (db->wr_fd != -1);
assert ((char *) &dataset->resp > (char *) db->data);
- assert ((char *) &dataset->resp - (char *) db->head + total
+ assert ((char *) dataset - (char *) db->head + total
<= (sizeof (struct database_pers_head)
+ db->head->module * sizeof (ref_t)
+ db->head->data_size));
ssize_t written;
written = sendfileall (fd, db->wr_fd, (char *) &dataset->resp
- - (char *) db->head, total);
+ - (char *) db->head, dataset->head.recsize);
# ifndef __ASSUME_SENDFILE
if (written == -1 && errno == ENOSYS)
goto use_write;
@@ -470,7 +470,7 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
use_write:
# endif
#endif
- writeall (fd, &dataset->resp, total);
+ writeall (fd, &dataset->resp, dataset->head.recsize);
}
goto out;
diff --git a/nscd/dbg_log.c b/nscd/dbg_log.c
index 5e192c97dd..fa99dac88f 100644
--- a/nscd/dbg_log.c
+++ b/nscd/dbg_log.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1998, 2000, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (c) 1998, 2000, 2004, 2005, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1998.
@@ -53,14 +53,23 @@ void
dbg_log (const char *fmt,...)
{
va_list ap;
- char msg[512], msg2[512];
+ char msg2[512];
va_start (ap, fmt);
- vsnprintf (msg2, sizeof (msg), fmt, ap);
+ vsnprintf (msg2, sizeof (msg2), fmt, ap);
if (debug_level > 0)
{
- snprintf (msg, sizeof (msg), "%d: %s%s", getpid (), msg2,
+ time_t t = time (NULL);
+
+ struct tm now;
+ localtime_r (&t, &now);
+
+ char buf[256];
+ strftime (buf, sizeof (buf), "%c", &now);
+
+ char msg[512];
+ snprintf (msg, sizeof (msg), "%s - %d: %s%s", buf, getpid (), msg2,
msg2[strlen (msg2) - 1] == '\n' ? "" : "\n");
if (dbgout)
{
diff --git a/nscd/grpcache.c b/nscd/grpcache.c
index 184d53898c..bd101c675d 100644
--- a/nscd/grpcache.c
+++ b/nscd/grpcache.c
@@ -295,14 +295,14 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req,
{
assert (db->wr_fd != -1);
assert ((char *) &dataset->resp > (char *) db->data);
- assert ((char *) &dataset->resp - (char *) db->head
+ assert ((char *) dataset - (char *) db->head
+ total
<= (sizeof (struct database_pers_head)
+ db->head->module * sizeof (ref_t)
+ db->head->data_size));
written = sendfileall (fd, db->wr_fd,
(char *) &dataset->resp
- - (char *) db->head, total);
+ - (char *) db->head, dataset->head.recsize);
# ifndef __ASSUME_SENDFILE
if (written == -1 && errno == ENOSYS)
goto use_write;
@@ -313,7 +313,7 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req,
use_write:
# endif
#endif
- written = writeall (fd, &dataset->resp, total);
+ written = writeall (fd, &dataset->resp, dataset->head.recsize);
}
/* Add the record to the database. But only if it has not been
diff --git a/nscd/hstcache.c b/nscd/hstcache.c
index 51e2273960..228f6fd8ab 100644
--- a/nscd/hstcache.c
+++ b/nscd/hstcache.c
@@ -337,7 +337,7 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req,
{
assert (db->wr_fd != -1);
assert ((char *) &dataset->resp > (char *) db->data);
- assert ((char *) &dataset->resp - (char *) db->head
+ assert ((char *) dataset - (char *) db->head
+ total
<= (sizeof (struct database_pers_head)
+ db->head->module * sizeof (ref_t)
diff --git a/nscd/initgrcache.c b/nscd/initgrcache.c
index c33aaf315f..8195b6609e 100644
--- a/nscd/initgrcache.c
+++ b/nscd/initgrcache.c
@@ -350,14 +350,14 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
{
assert (db->wr_fd != -1);
assert ((char *) &dataset->resp > (char *) db->data);
- assert ((char *) &dataset->resp - (char *) db->head
+ assert ((char *) dataset - (char *) db->head
+ total
<= (sizeof (struct database_pers_head)
+ db->head->module * sizeof (ref_t)
+ db->head->data_size));
written = sendfileall (fd, db->wr_fd,
(char *) &dataset->resp
- - (char *) db->head, total);
+ - (char *) db->head, dataset->head.recsize);
# ifndef __ASSUME_SENDFILE
if (written == -1 && errno == ENOSYS)
goto use_write;
@@ -368,7 +368,7 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
use_write:
# endif
#endif
- written = writeall (fd, &dataset->resp, total);
+ written = writeall (fd, &dataset->resp, dataset->head.recsize);
}
diff --git a/nscd/pwdcache.c b/nscd/pwdcache.c
index 2338e7e1e0..75f2221e88 100644
--- a/nscd/pwdcache.c
+++ b/nscd/pwdcache.c
@@ -290,14 +290,14 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req,
{
assert (db->wr_fd != -1);
assert ((char *) &dataset->resp > (char *) db->data);
- assert ((char *) &dataset->resp - (char *) db->head
+ assert ((char *) dataset - (char *) db->head
+ total
<= (sizeof (struct database_pers_head)
+ db->head->module * sizeof (ref_t)
+ db->head->data_size));
written = sendfileall (fd, db->wr_fd,
(char *) &dataset->resp
- - (char *) db->head, total);
+ - (char *) db->head, dataset->head.recsize );
# ifndef __ASSUME_SENDFILE
if (written == -1 && errno == ENOSYS)
goto use_write;
@@ -308,7 +308,7 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req,
use_write:
# endif
#endif
- written = writeall (fd, &dataset->resp, total);
+ written = writeall (fd, &dataset->resp, dataset->head.recsize);
}
diff --git a/nss/nss_files/files-hosts.c b/nss/nss_files/files-hosts.c
index 7b69d47fcb..68fb969937 100644
--- a/nss/nss_files/files-hosts.c
+++ b/nss/nss_files/files-hosts.c
@@ -1,5 +1,5 @@
/* Hosts file parser in nss_files module.
- Copyright (C) 1996-2001, 2003-2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 1996-2001, 2003-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
@@ -423,6 +423,11 @@ _nss_files_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
if (! keep_stream)
internal_endent ();
}
+ else
+ {
+ *errnop = errno;
+ *herrnop = NO_DATA;
+ }
__libc_lock_unlock (lock);
diff --git a/resolv/res_send.c b/resolv/res_send.c
index 4c14db1bf5..e2bbfcc83f 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -219,33 +219,33 @@ res_ourserver_p(const res_state statp, const struct sockaddr_in6 *inp)
{
int ns;
- if (inp->sin6_family == AF_INET) {
- struct sockaddr_in *in4p = (struct sockaddr_in *) inp;
+ if (inp->sin6_family == AF_INET) {
+ struct sockaddr_in *in4p = (struct sockaddr_in *) inp;
in_port_t port = in4p->sin_port;
in_addr_t addr = in4p->sin_addr.s_addr;
- for (ns = 0; ns < MAXNS; ns++) {
- const struct sockaddr_in *srv =
+ for (ns = 0; ns < MAXNS; ns++) {
+ const struct sockaddr_in *srv =
(struct sockaddr_in *)EXT(statp).nsaddrs[ns];
- if ((srv != NULL) && (srv->sin_family == AF_INET) &&
- (srv->sin_port == port) &&
- (srv->sin_addr.s_addr == INADDR_ANY ||
- srv->sin_addr.s_addr == addr))
- return (1);
- }
- } else if (inp->sin6_family == AF_INET6) {
- for (ns = 0; ns < MAXNS; ns++) {
- const struct sockaddr_in6 *srv = EXT(statp).nsaddrs[ns];
- if ((srv != NULL) && (srv->sin6_family == AF_INET6) &&
- (srv->sin6_port == inp->sin6_port) &&
- !(memcmp(&srv->sin6_addr, &in6addr_any,
- sizeof (struct in6_addr)) &&
- memcmp(&srv->sin6_addr, &inp->sin6_addr,
- sizeof (struct in6_addr))))
- return (1);
- }
- }
+ if ((srv != NULL) && (srv->sin_family == AF_INET) &&
+ (srv->sin_port == port) &&
+ (srv->sin_addr.s_addr == INADDR_ANY ||
+ srv->sin_addr.s_addr == addr))
+ return (1);
+ }
+ } else if (inp->sin6_family == AF_INET6) {
+ for (ns = 0; ns < MAXNS; ns++) {
+ const struct sockaddr_in6 *srv = EXT(statp).nsaddrs[ns];
+ if ((srv != NULL) && (srv->sin6_family == AF_INET6) &&
+ (srv->sin6_port == inp->sin6_port) &&
+ !(memcmp(&srv->sin6_addr, &in6addr_any,
+ sizeof (struct in6_addr)) &&
+ memcmp(&srv->sin6_addr, &inp->sin6_addr,
+ sizeof (struct in6_addr))))
+ return (1);
+ }
+ }
return (0);
}
@@ -445,7 +445,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
malloc(sizeof (struct sockaddr_in6));
if (EXT(statp).nsaddrs[n] != NULL) {
memset (mempcpy(EXT(statp).nsaddrs[n],
- &statp->nsaddr_list[ns],
+ &statp->nsaddr_list[n],
sizeof (struct sockaddr_in)),
'\0',
sizeof (struct sockaddr_in6)
@@ -1003,9 +1003,10 @@ send_dg(res_state statp,
int orig_anssizp = *anssizp;
struct timespec now, timeout, finish;
struct pollfd pfd[1];
- int ptimeout;
+ int ptimeout;
struct sockaddr_in6 from;
- int resplen, n;
+ int resplen = 0;
+ int n;
/*
* Compute time for the total operation.
@@ -1050,7 +1051,7 @@ send_dg(res_state statp,
evSubTime(&timeout, &finish, &now);
need_recompute = 0;
}
- /* Convert struct timespec in milliseconds. */
+ /* Convert struct timespec in milliseconds. */
ptimeout = timeout.tv_sec * 1000 + timeout.tv_nsec / 1000000;
n = 0;
@@ -1244,7 +1245,7 @@ send_dg(res_state statp,
/* record the error */
statp->_flags |= RES_F_EDNS0ERR;
goto err_out;
- }
+ }
#endif
if (!(statp->options & RES_INSECURE2)
&& (recvresp1 || !res_queriesmatch(buf, buf + buflen,
diff --git a/stdio-common/tempnam.c b/stdio-common/tempnam.c
index 055604fb79..3604a2d267 100644
--- a/stdio-common/tempnam.c
+++ b/stdio-common/tempnam.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1993,1996-2000,2007 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1993,1996-2000,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,7 +34,7 @@ tempnam (const char *dir, const char *pfx)
if (__path_search (buf, FILENAME_MAX, dir, pfx, 1))
return NULL;
- if (__gen_tempname (buf, 0, __GT_NOCREATE))
+ if (__gen_tempname (buf, 0, 0, __GT_NOCREATE))
return NULL;
return __strdup (buf);
diff --git a/stdio-common/tempname.c b/stdio-common/tempname.c
index 2c7bcdee0f..02ee34fe8e 100644
--- a/stdio-common/tempname.c
+++ b/stdio-common/tempname.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 95-98, 99, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 95-99, 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
@@ -47,8 +47,9 @@ stub_warning (__path_search)
*/
int
-__gen_tempname (tmpl, flags, kind)
+__gen_tempname (tmpl, suffixlen, flags, kind)
char *tmpl;
+ int suffixlen;
int flags;
int kind;
{
diff --git a/stdio-common/tmpfile.c b/stdio-common/tmpfile.c
index b90051346b..69963fd4a9 100644
--- a/stdio-common/tmpfile.c
+++ b/stdio-common/tmpfile.c
@@ -1,5 +1,5 @@
/* Open a stdio stream on an anonymous temporary file. Generic/POSIX version.
- Copyright (C) 1991,1993,1996-2000,2002,2003,2007
+ Copyright (C) 1991,1993,1996-2000,2002,2003,2007,2009
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -48,7 +48,7 @@ tmpfile (void)
#ifdef FLAGS
flags = FLAGS;
#endif
- fd = __gen_tempname (buf, flags, __GT_FILE);
+ fd = __gen_tempname (buf, 0, flags, __GT_FILE);
if (fd < 0)
return NULL;
diff --git a/stdio-common/tmpnam.c b/stdio-common/tmpnam.c
index f1c16446d5..93d47a1212 100644
--- a/stdio-common/tmpnam.c
+++ b/stdio-common/tmpnam.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1993,1996-1999,2000,2007 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1993,1996-2000,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
@@ -39,7 +39,7 @@ tmpnam (char *s)
0))
return NULL;
- if (__builtin_expect (__gen_tempname (tmpbuf, 0, __GT_NOCREATE), 0))
+ if (__builtin_expect (__gen_tempname (tmpbuf, 0, 0, __GT_NOCREATE), 0))
return NULL;
if (s == NULL)
diff --git a/stdio-common/tmpnam_r.c b/stdio-common/tmpnam_r.c
index 60c42866a7..d252bafbb2 100644
--- a/stdio-common/tmpnam_r.c
+++ b/stdio-common/tmpnam_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1993,1996-1999,2000,2007 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1993,1996-2000,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
@@ -28,7 +28,7 @@ tmpnam_r (char *s)
if (__path_search (s, L_tmpnam, NULL, NULL, 0))
return NULL;
- if (__gen_tempname (s, 0, __GT_NOCREATE))
+ if (__gen_tempname (s, 0, 0, __GT_NOCREATE))
return NULL;
return s;
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index 1b88ce6a52..dc51d67170 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -50,7 +50,7 @@ __BEGIN_DECLS
# if defined __GNUC__ && !defined __cplusplus
# define __WAIT_INT(status) \
(__extension__ (((union { __typeof(status) __in; int __i; }) \
- { .__in = (status) }).__i))
+ { .__in = (status) }).__i))
# else
# define __WAIT_INT(status) (*(int *) &(status))
# endif
@@ -609,7 +609,7 @@ extern char *mktemp (char *__template) __THROW __nonnull ((1)) __wur;
Returns a file descriptor open on the file for reading and writing,
or -1 if it cannot create a uniquely-named file.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
# ifndef __USE_FILE_OFFSET64
extern int mkstemp (char *__template) __nonnull ((1)) __wur;
@@ -626,6 +626,29 @@ extern int mkstemp64 (char *__template) __nonnull ((1)) __wur;
# endif
#endif
+#ifdef __USE_MISC
+/* Similar to mkstemp, but the template can have a suffix after the
+ XXXXXX. The length of the suffix is specified in the second
+ parameter.
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+# ifndef __USE_FILE_OFFSET64
+extern int mkstemps (char *__template, int __suffixlen) __nonnull ((1)) __wur;
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (mkstemps, (char *__template, int __suffixlen),
+ mkstemps64) __nonnull ((1)) __wur;
+# else
+# define mkstemps mkstemps64
+# endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern int mkstemps64 (char *__template, int __suffixlen)
+ __nonnull ((1)) __wur;
+# endif
+#endif
+
#if defined __USE_BSD || defined __USE_XOPEN2K8
/* Create a unique temporary directory from TEMPLATE.
The last six characters of TEMPLATE must be "XXXXXX";
@@ -655,6 +678,29 @@ extern int __REDIRECT (mkostemp, (char *__template, int __flags), mkostemp64)
# ifdef __USE_LARGEFILE64
extern int mkostemp64 (char *__template, int __flags) __nonnull ((1)) __wur;
# endif
+
+/* Similar to mkostemp, but the template can have a suffix after the
+ XXXXXX. The length of the suffix is specified in the second
+ parameter.
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+# ifndef __USE_FILE_OFFSET64
+extern int mkostemps (char *__template, int __suffixlen, int __flags)
+ __nonnull ((1)) __wur;
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (mkostemps, (char *__template, int __suffixlen,
+ int __flags), mkostemps64)
+ __nonnull ((1)) __wur;
+# else
+# define mkostemps mkostemps64
+# endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern int mkostemps64 (char *__template, int __suffixlen, int __flags)
+ __nonnull ((1)) __wur;
+# endif
#endif
diff --git a/sysdeps/generic/elf/ifunc-sel.h b/sysdeps/generic/elf/ifunc-sel.h
new file mode 100644
index 0000000000..6a27b69c5b
--- /dev/null
+++ b/sysdeps/generic/elf/ifunc-sel.h
@@ -0,0 +1,26 @@
+/* Used by the elf ifunc tests. */
+#ifndef ELF_IFUNC_SEL_H
+#define ELF_IFUNC_SEL_H 1
+
+extern int global;
+
+static inline void *
+ifunc_sel (int (*f1) (void), int (*f2) (void), int (*f3) (void))
+{
+ switch (global)
+ {
+ case 1:
+ return f1;
+ case -1:
+ return f2;
+ default:
+ return f3;
+ }
+}
+
+static inline void *
+ifunc_one (int (*f1) (void))
+{
+ return f1;
+}
+#endif
diff --git a/sysdeps/generic/netinet/ip.h b/sysdeps/generic/netinet/ip.h
index fc91440527..38bd7556da 100644
--- a/sysdeps/generic/netinet/ip.h
+++ b/sysdeps/generic/netinet/ip.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,92,93,95,96,97,98,99,2000 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,95,96,97,98,99,2000,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
@@ -153,6 +154,41 @@ struct ip_timestamp
#define IP_MAXPACKET 65535 /* maximum packet size */
/*
+ * Definitions for Explicit Congestion Notification (ECN)
+ *
+ * Taken from RFC-3168, Section 5.
+ */
+
+#define IPTOS_ECN_MASK 0x03
+#define IPTOS_ECN(x) ((x) & IPTOS_ECN_MASK)
+#define IPTOS_ECN_NOT_ECT 0x00
+#define IPTOS_ECN_ECT1 0x01
+#define IPTOS_ECN_ECT0 0x02
+#define IPTOS_ECN_CE 0x03
+
+/*
+ * Definitions for IP differentiated services code points (DSCP)
+ *
+ * Taken from RFC-2597, Section 6 and RFC-2598, Section 2.3.
+ */
+
+#define IPTOS_DSCP_MASK 0xfc
+#define IPTOS_DSCP(x) ((x) & IPTOS_DSCP_MASK)
+#define IPTOS_DSCP_AF11 0x28
+#define IPTOS_DSCP_AF12 0x30
+#define IPTOS_DSCP_AF13 0x38
+#define IPTOS_DSCP_AF21 0x48
+#define IPTOS_DSCP_AF22 0x50
+#define IPTOS_DSCP_AF23 0x58
+#define IPTOS_DSCP_AF31 0x68
+#define IPTOS_DSCP_AF32 0x70
+#define IPTOS_DSCP_AF33 0x78
+#define IPTOS_DSCP_AF41 0x88
+#define IPTOS_DSCP_AF42 0x90
+#define IPTOS_DSCP_AF43 0x98
+#define IPTOS_DSCP_EF 0xb8
+
+/*
* Definitions for IP type of service (ip_tos)
*/
#define IPTOS_TOS_MASK 0x1E
diff --git a/sysdeps/gnu/getutmp.c b/sysdeps/gnu/getutmp.c
index 7b6d7713ea..9647c252e2 100644
--- a/sysdeps/gnu/getutmp.c
+++ b/sysdeps/gnu/getutmp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 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
@@ -19,10 +19,12 @@
#include <assert.h>
#include <string.h>
#include <utmp.h>
+#ifndef _UTMPX_H
/* This is an ugly hack but we must not see the getutmpx declaration. */
-#define getutmpx XXXgetutmpx
-#include <utmpx.h>
-#undef getutmpx
+# define getutmpx XXXgetutmpx
+# include <utmpx.h>
+# undef getutmpx
+#endif
void
getutmp (const struct utmpx *utmpx, struct utmp *utmp)
diff --git a/sysdeps/gnu/netinet/udp.h b/sysdeps/gnu/netinet/udp.h
index 45b69f7499..ae1beb9e1a 100644
--- a/sysdeps/gnu/netinet/udp.h
+++ b/sysdeps/gnu/netinet/udp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 95, 96, 97, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1993,1995-1997,2004,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
@@ -74,6 +74,16 @@ struct udphdr
};
#endif
+/* UDP socket options */
+#define UDP_CORK 1 /* Never send partially complete segments. */
+#define UDP_ENCAP 100 /* Set the socket to accept
+ encapsulated packets. */
+
+/* UDP encapsulation types */
+#define UDP_ENCAP_ESPINUDP_NON_IKE 1 /* draft-ietf-ipsec-nat-t-ike-00/01 */
+#define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */
+#define UDP_ENCAP_L2TPINUDP 3 /* rfc2661 */
+
#define SOL_UDP 17 /* sockopt level for UDP */
#endif /* netinet/udp.h */
diff --git a/sysdeps/i386/fpu/s_expm1.S b/sysdeps/i386/fpu/s_expm1.S
index e761183639..c690a458f8 100644
--- a/sysdeps/i386/fpu/s_expm1.S
+++ b/sysdeps/i386/fpu/s_expm1.S
@@ -22,6 +22,7 @@
/* Using: e^x - 1 = 2^(x * log2(e)) - 1 */
+#include <sysdep.h>
#include <machine/asm.h>
#ifdef __ELF__
@@ -48,6 +49,11 @@ l2e: .tfloat 1.442695040888963407359924681002
.text
ENTRY(__expm1)
+ movzwl 4+6(%esp), %eax
+ xorb $0x80, %ah // invert sign bit (now 1 is "positive")
+ cmpl $0xc086, %eax // is num >= 704?
+ jae HIDDEN_JUMPTARGET (__exp)
+
fldl 4(%esp) // x
fxam // Is NaN or +-Inf?
fstsw %ax
diff --git a/sysdeps/i386/fpu/s_expm1f.S b/sysdeps/i386/fpu/s_expm1f.S
index 88adb75b86..8645107274 100644
--- a/sysdeps/i386/fpu/s_expm1f.S
+++ b/sysdeps/i386/fpu/s_expm1f.S
@@ -22,6 +22,7 @@
/* Using: e^x - 1 = 2^(x * log2(e)) - 1 */
+#include <sysdep.h>
#include <machine/asm.h>
#ifdef __ELF__
@@ -48,6 +49,11 @@ l2e: .tfloat 1.442695040888963407359924681002
.text
ENTRY(__expm1f)
+ movzwl 4+2(%esp), %eax
+ xorb $0x80, %ah // invert sign bit (now 1 is "positive")
+ cmpl $0xc2b1, %eax // is num >= 88.5?
+ jae HIDDEN_JUMPTARGET (__expf)
+
flds 4(%esp) // x
fxam // Is NaN or +-Inf?
fstsw %ax
diff --git a/sysdeps/i386/fpu/s_expm1l.S b/sysdeps/i386/fpu/s_expm1l.S
index b69b22bc62..60b5b82e20 100644
--- a/sysdeps/i386/fpu/s_expm1l.S
+++ b/sysdeps/i386/fpu/s_expm1l.S
@@ -22,6 +22,7 @@
/* Using: e^x - 1 = 2^(x * log2(e)) - 1 */
+#include <sysdep.h>
#include <machine/asm.h>
#ifdef __ELF__
@@ -51,7 +52,7 @@ ENTRY(__expm1l)
movzwl 4+8(%esp), %eax // load sign bit and 15-bit exponent
xorb $0x80, %ah // invert sign bit (now 1 is "positive")
cmpl $0xc006, %eax // is num positive and exp >= 6 (number is >= 128.0)?
- jae __ieee754_expl // (if num is denormal, it is at least >= 64.0)
+ jae HIDDEN_JUMPTARGET (__expl) // (if num is denormal, it is at least >= 64.0)
fldt 4(%esp) // x
fxam // Is NaN or +-Inf?
diff --git a/sysdeps/ieee754/dbl-64/w_exp.c b/sysdeps/ieee754/dbl-64/w_exp.c
index 445c5788d2..1216492090 100644
--- a/sysdeps/ieee754/dbl-64/w_exp.c
+++ b/sysdeps/ieee754/dbl-64/w_exp.c
@@ -51,6 +51,7 @@ u_threshold= -7.45133219101941108420e+02; /* 0xc0874910, 0xD52D3051 */
return z;
#endif
}
+hidden_def (__exp)
weak_alias (__exp, exp)
#ifdef NO_LONG_DOUBLE
strong_alias (__exp, __expl)
diff --git a/sysdeps/ieee754/flt-32/w_expf.c b/sysdeps/ieee754/flt-32/w_expf.c
index 4ba21c7c42..83b268f570 100644
--- a/sysdeps/ieee754/flt-32/w_expf.c
+++ b/sysdeps/ieee754/flt-32/w_expf.c
@@ -56,4 +56,5 @@ u_threshold= -1.0397208405e+02; /* 0xc2cff1b5 */
return z;
#endif
}
+hidden_def (__expf)
weak_alias (__expf, expf)
diff --git a/sysdeps/ieee754/ldbl-128/w_expl.c b/sysdeps/ieee754/ldbl-128/w_expl.c
index 816ce3caa6..d6205d3ef8 100644
--- a/sysdeps/ieee754/ldbl-128/w_expl.c
+++ b/sysdeps/ieee754/ldbl-128/w_expl.c
@@ -55,4 +55,5 @@ u_threshold= -1.1433462743336297878837243843452621503410E4;
return z;
#endif
}
+hidden_def (__expl)
weak_alias (__expl, expl)
diff --git a/sysdeps/ieee754/ldbl-96/w_expl.c b/sysdeps/ieee754/ldbl-96/w_expl.c
index b8152cea65..53bb143734 100644
--- a/sysdeps/ieee754/ldbl-96/w_expl.c
+++ b/sysdeps/ieee754/ldbl-96/w_expl.c
@@ -57,4 +57,5 @@ u_threshold= -1.140019167866942050398521670162263001513e4;
return z;
#endif
}
+hidden_def (__expl)
weak_alias (__expl, expl)
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
index be979d8c8a..57ce5a942c 100644
--- a/sysdeps/posix/tempname.c
+++ b/sysdeps/posix/tempname.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2001, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2001, 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
@@ -210,9 +210,9 @@ static const char letters[] =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
/* Generate a temporary file name based on TMPL. TMPL must match the
- rules for mk[s]temp (i.e. end in "XXXXXX"). The name constructed
- does not exist at the time of the call to __gen_tempname. TMPL is
- overwritten with the result.
+ rules for mk[s]temp (i.e. end in "XXXXXX", possibly with a suffix).
+ The name constructed does not exist at the time of the call to
+ __gen_tempname. TMPL is overwritten with the result.
KIND may be one of:
__GT_NOCREATE: simply verify that the name does not exist
@@ -223,7 +223,7 @@ static const char letters[] =
We use a clever algorithm to get hard-to-predict names. */
int
-__gen_tempname (char *tmpl, int flags, int kind)
+__gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
{
int len;
char *XXXXXX;
@@ -251,14 +251,14 @@ __gen_tempname (char *tmpl, int flags, int kind)
#endif
len = strlen (tmpl);
- if (len < 6 || strcmp (&tmpl[len - 6], "XXXXXX"))
+ if (len < 6 + suffixlen || memcmp (&tmpl[len - 6 - suffixlen], "XXXXXX", 6))
{
__set_errno (EINVAL);
return -1;
}
/* This is where the Xs start. */
- XXXXXX = &tmpl[len - 6];
+ XXXXXX = &tmpl[len - 6 - suffixlen];
/* Get some more or less random data. */
#ifdef RANDOM_BITS
diff --git a/sysdeps/powerpc/elf/ifunc-sel.h b/sysdeps/powerpc/elf/ifunc-sel.h
new file mode 100644
index 0000000000..526d8ed88b
--- /dev/null
+++ b/sysdeps/powerpc/elf/ifunc-sel.h
@@ -0,0 +1,46 @@
+/* Used by the elf ifunc tests. */
+#ifndef ELF_IFUNC_SEL_H
+#define ELF_IFUNC_SEL_H 1
+
+extern int global;
+
+static inline void *
+ifunc_sel (int (*f1) (void), int (*f2) (void), int (*f3) (void))
+{
+ register void *ret __asm__ ("r3");
+ __asm__ ("mflr 12\n\t"
+ "bcl 20,31,1f\n"
+ "1:\tmflr 11\n\t"
+ "mtlr 12\n\t"
+ "addis 12,11,global-1b@ha\n\t"
+ "lwz 12,global-1b@l(12)\n\t"
+ "addis %0,11,%2-1b@ha\n\t"
+ "addi %0,%0,%2-1b@l\n\t"
+ "cmpwi 12,1\n\t"
+ "beqlr\n\t"
+ "addis %0,11,%3-1b@ha\n\t"
+ "addi %0,%0,%3-1b@l\n\t"
+ "cmpwi 12,-1\n\t"
+ "beqlr\n\t"
+ "addis %0,11,%4-1b@ha\n\t"
+ "addi %0,%0,%4-1b@l"
+ : "=r" (ret)
+ : "X" (&global), "X" (f1), "X" (f2), "X" (f3));
+ return ret;
+}
+
+static inline void *
+ifunc_one (int (*f1) (void))
+{
+ register void *ret __asm__ ("r3");
+ __asm__ ("mflr 12\n\t"
+ "bcl 20,31,1f\n"
+ "1:\tmflr %0\n\t"
+ "mtlr 12\n\t"
+ "addis %0,%0,%1-1b@ha\n\t"
+ "addi %0,%0,%1-1b@l"
+ : "=r" (ret)
+ : "X" (f1));
+ return ret;
+}
+#endif
diff --git a/sysdeps/powerpc/powerpc32/dl-irel.h b/sysdeps/powerpc/powerpc32/dl-irel.h
new file mode 100644
index 0000000000..3f204cd7ae
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/dl-irel.h
@@ -0,0 +1,45 @@
+/* Machine-dependent ELF indirect relocation inline functions.
+ PowerPC version.
+ Copyright (C) 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. */
+
+#ifndef _DL_IREL_H
+#define _DL_IREL_H
+
+#include <stdio.h>
+#include <unistd.h>
+
+#define ELF_MACHINE_IRELA 1
+
+static inline void
+__attribute ((always_inline))
+elf_irela (const Elf32_Rela *reloc)
+{
+ unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
+
+ if (__builtin_expect (r_type == R_PPC_IRELATIVE, 1))
+ {
+ Elf32_Addr *const reloc_addr = (void *) reloc->r_offset;
+ Elf32_Addr value = ((Elf32_Addr (*) (void)) reloc->r_addend) ();
+ *reloc_addr = value;
+ }
+ else
+ __libc_fatal ("unexpected reloc type in static binary");
+}
+
+#endif /* dl-irel.h */
diff --git a/sysdeps/powerpc/powerpc32/dl-machine.c b/sysdeps/powerpc/powerpc32/dl-machine.c
index 71540bd185..ee4c3e0c1c 100644
--- a/sysdeps/powerpc/powerpc32/dl-machine.c
+++ b/sysdeps/powerpc/powerpc32/dl-machine.c
@@ -337,7 +337,7 @@ __elf_machine_runtime_setup (struct link_map *map, int lazy, int profile)
}
Elf32_Addr
-__elf_machine_fixup_plt (struct link_map *map, const Elf32_Rela *reloc,
+__elf_machine_fixup_plt (struct link_map *map,
Elf32_Addr *reloc_addr, Elf32_Addr finaladdr)
{
Elf32_Sword delta = finaladdr - (Elf32_Word) reloc_addr;
@@ -430,6 +430,10 @@ __process_machine_rela (struct link_map *map,
*reloc_addr = finaladdr;
return;
+ case R_PPC_IRELATIVE:
+ *reloc_addr = ((Elf32_Addr (*) (void)) finaladdr) ();
+ return;
+
case R_PPC_UADDR32:
((char *) reloc_addr)[0] = finaladdr >> 24;
((char *) reloc_addr)[1] = finaladdr >> 16;
diff --git a/sysdeps/powerpc/powerpc32/dl-machine.h b/sysdeps/powerpc/powerpc32/dl-machine.h
index a50ffdd1c2..6f8d0f506e 100644
--- a/sysdeps/powerpc/powerpc32/dl-machine.h
+++ b/sysdeps/powerpc/powerpc32/dl-machine.h
@@ -226,7 +226,6 @@ elf_machine_runtime_setup (struct link_map *map,
/* Change the PLT entry whose reloc is 'reloc' to call the actual routine. */
extern Elf32_Addr __elf_machine_fixup_plt (struct link_map *map,
- const Elf32_Rela *reloc,
Elf32_Addr *reloc_addr,
Elf32_Addr finaladdr);
@@ -237,7 +236,7 @@ elf_machine_fixup_plt (struct link_map *map, lookup_t t,
{
if (map->l_info[DT_PPC(GOT)] == 0)
/* Handle old style PLT. */
- return __elf_machine_fixup_plt (map, reloc, reloc_addr, finaladdr);
+ return __elf_machine_fixup_plt (map, reloc_addr, finaladdr);
*reloc_addr = finaladdr;
return finaladdr;
@@ -317,6 +316,11 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
value = reloc->r_addend;
#endif
+ if (sym != NULL
+ && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0)
+ && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1))
+ value = ((Elf32_Addr (*) (void)) value) ();
+
/* A small amount of code is duplicated here for speed. In libc,
more than 90% of the relocs are R_PPC_RELATIVE; in the X11 shared
libraries, 60% are R_PPC_RELATIVE, 24% are R_PPC_GLOB_DAT or
diff --git a/sysdeps/powerpc/powerpc64/dl-irel.h b/sysdeps/powerpc/powerpc64/dl-irel.h
new file mode 100644
index 0000000000..6cded5091d
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/dl-irel.h
@@ -0,0 +1,58 @@
+/* Machine-dependent ELF indirect relocation inline functions.
+ PowerPC64 version.
+ Copyright (C) 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. */
+
+#ifndef _DL_IREL_H
+#define _DL_IREL_H
+
+#include <stdio.h>
+#include <unistd.h>
+
+#define ELF_MACHINE_IRELA 1
+
+typedef struct
+{
+ Elf64_Addr fd_func;
+ Elf64_Addr fd_toc;
+ Elf64_Addr fd_aux;
+} Elf64_FuncDesc;
+
+static inline void
+__attribute ((always_inline))
+elf_irela (const Elf64_Rela *reloc)
+{
+ unsigned int r_type = ELF64_R_TYPE (reloc->r_info);
+
+ if (__builtin_expect (r_type == R_PPC64_IRELATIVE, 1))
+ {
+ Elf64_Addr *const reloc_addr = (void *) reloc->r_offset;
+ Elf64_Addr value = ((Elf64_Addr (*) (void)) reloc->r_addend) ();
+ *reloc_addr = value;
+ }
+ else if (__builtin_expect (r_type == R_PPC64_JMP_IREL, 1))
+ {
+ Elf64_Addr *const reloc_addr = (void *) reloc->r_offset;
+ Elf64_Addr value = ((Elf64_Addr (*) (void)) reloc->r_addend) ();
+ *(Elf64_FuncDesc *) reloc_addr = *(Elf64_FuncDesc *) value;
+ }
+ else
+ __libc_fatal ("unexpected reloc type in static binary");
+}
+
+#endif /* dl-irel.h */
diff --git a/sysdeps/powerpc/powerpc64/dl-machine.h b/sysdeps/powerpc/powerpc64/dl-machine.h
index b674dbef43..8a720ae9c2 100644
--- a/sysdeps/powerpc/powerpc64/dl-machine.h
+++ b/sysdeps/powerpc/powerpc64/dl-machine.h
@@ -526,6 +526,29 @@ elf_machine_tprel (struct link_map *map,
}
#endif
+/* Call function at address VALUE (an OPD entry) to resolve ifunc relocs. */
+auto inline Elf64_Addr __attribute__ ((always_inline))
+resolve_ifunc (Elf64_Addr value,
+ const struct link_map *map, const struct link_map *sym_map)
+{
+ /* The function we are calling may not yet have its opd entry relocated. */
+ Elf64_FuncDesc opd;
+ if (map != sym_map
+#if !defined RTLD_BOOTSTRAP && defined SHARED
+ /* Bootstrap map doesn't have l_relocated set for it. */
+ && sym_map != &GL(dl_rtld_map)
+#endif
+ && !sym_map->l_relocated)
+ {
+ Elf64_FuncDesc *func = (Elf64_FuncDesc *) value;
+ opd.fd_func = func->fd_func + sym_map->l_addr;
+ opd.fd_toc = func->fd_toc + sym_map->l_addr;
+ opd.fd_aux = func->fd_aux;
+ value = (Elf64_Addr) &opd;
+ }
+ return ((Elf64_Addr (*) (void)) value) ();
+}
+
/* Perform the relocation specified by RELOC and SYM (which is fully
resolved). MAP is the object containing the reloc. */
auto inline void __attribute__ ((always_inline))
@@ -550,11 +573,17 @@ elf_machine_rela (struct link_map *map,
if (__builtin_expect (r_type == R_PPC64_NONE, 0))
return;
- /* We need SYM_MAP even in the absence of TLS, for elf_machine_fixup_plt. */
+ /* We need SYM_MAP even in the absence of TLS, for elf_machine_fixup_plt
+ and STT_GNU_IFUNC. */
struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
Elf64_Addr value = ((sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value)
+ reloc->r_addend);
+ if (sym != NULL
+ && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0)
+ && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1))
+ value = resolve_ifunc (value, map, sym_map);
+
/* For relocs that don't edit code, return.
For relocs that might edit instructions, break from the switch. */
switch (r_type)
@@ -564,6 +593,14 @@ elf_machine_rela (struct link_map *map,
*reloc_addr = value;
return;
+ case R_PPC64_IRELATIVE:
+ value = resolve_ifunc (value, map, sym_map);
+ *reloc_addr = value;
+ return;
+
+ case R_PPC64_JMP_IREL:
+ value = resolve_ifunc (value, map, sym_map);
+ /* Fall thru */
case R_PPC64_JMP_SLOT:
#ifdef RESOLVE_CONFLICT_FIND_MAP
elf_machine_plt_conflict (reloc_addr, value);
diff --git a/sysdeps/pthread/aio_misc.c b/sysdeps/pthread/aio_misc.c
index fd3fcbb755..c82acbbc2d 100644
--- a/sysdeps/pthread/aio_misc.c
+++ b/sysdeps/pthread/aio_misc.c
@@ -1,5 +1,5 @@
/* Handle general operations.
- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2006, 2007
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2006, 2007, 2009
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -372,9 +372,13 @@ __aio_enqueue_request (aiocb_union *aiocbp, int operation)
/* Simply enqueue it after the running one according to the
priority. */
+ last = NULL;
while (runp->next_prio != NULL
&& runp->next_prio->aiocbp->aiocb.__abs_prio >= prio)
- runp = runp->next_prio;
+ {
+ last = runp;
+ runp = runp->next_prio;
+ }
newp->next_prio = runp->next_prio;
runp->next_prio = newp;
@@ -403,6 +407,7 @@ __aio_enqueue_request (aiocb_union *aiocbp, int operation)
}
newp->next_prio = NULL;
+ last = NULL;
}
if (running == yes)
@@ -423,7 +428,8 @@ __aio_enqueue_request (aiocb_union *aiocbp, int operation)
running = newp->running = allocated;
/* Now try to start a thread. */
- if (aio_create_helper_thread (&thid, handle_fildes_io, newp) == 0)
+ result = aio_create_helper_thread (&thid, handle_fildes_io, newp);
+ if (result == 0)
/* We managed to enqueue the request. All errors which can
happen now can be recognized by calls to `aio_return' and
`aio_error'. */
@@ -434,10 +440,14 @@ __aio_enqueue_request (aiocb_union *aiocbp, int operation)
running = newp->running = yes;
if (nthreads == 0)
- /* We cannot create a thread in the moment and there is
- also no thread running. This is a problem. `errno' is
- set to EAGAIN if this is only a temporary problem. */
- result = -1;
+ {
+ /* We cannot create a thread in the moment and there is
+ also no thread running. This is a problem. `errno' is
+ set to EAGAIN if this is only a temporary problem. */
+ __aio_remove_request (last, newp, 0);
+ }
+ else
+ result = 0;
}
}
}
@@ -459,6 +469,8 @@ __aio_enqueue_request (aiocb_union *aiocbp, int operation)
{
/* Something went wrong. */
__aio_free_request (newp);
+ aiocbp->aiocb.__error_code = result;
+ __set_errno (result);
newp = NULL;
}
diff --git a/sysdeps/unix/sysv/linux/faccessat.c b/sysdeps/unix/sysv/linux/faccessat.c
index 10b903d076..c154deb40f 100644
--- a/sysdeps/unix/sysv/linux/faccessat.c
+++ b/sysdeps/unix/sysv/linux/faccessat.c
@@ -1,5 +1,5 @@
/* Test for access to file, relative to open directory. Linux version.
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 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
@@ -72,6 +72,12 @@ faccessat (fd, file, mode, flag)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
+ if (__builtin_expect (filelen == 0, 0))
+ {
+ __set_errno (ENOENT);
+ return -1;
+ }
+
static const char procfd[] = "/proc/self/fd/%d/%s";
/* Buffer for the path name we are going to use. It consists of
- the string /proc/self/fd/
diff --git a/sysdeps/unix/sysv/linux/fchmodat.c b/sysdeps/unix/sysv/linux/fchmodat.c
index 8b420153f1..051691230d 100644
--- a/sysdeps/unix/sysv/linux/fchmodat.c
+++ b/sysdeps/unix/sysv/linux/fchmodat.c
@@ -1,5 +1,5 @@
/* Change the protections of file relative to open directory. Linux version.
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 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
@@ -71,6 +71,12 @@ fchmodat (fd, file, mode, flag)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
+ if (__builtin_expect (filelen == 0, 0))
+ {
+ __set_errno (ENOENT);
+ return -1;
+ }
+
static const char procfd[] = "/proc/self/fd/%d/%s";
/* Buffer for the path name we are going to use. It consists of
- the string /proc/self/fd/
diff --git a/sysdeps/unix/sysv/linux/fchownat.c b/sysdeps/unix/sysv/linux/fchownat.c
index 0f731775b3..db43755694 100644
--- a/sysdeps/unix/sysv/linux/fchownat.c
+++ b/sysdeps/unix/sysv/linux/fchownat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -66,6 +66,12 @@ fchownat (fd, file, owner, group, flag)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
+ if (__builtin_expect (filelen == 0, 0))
+ {
+ __set_errno (ENOENT);
+ return -1;
+ }
+
static const char procfd[] = "/proc/self/fd/%d/%s";
/* Buffer for the path name we are going to use. It consists of
- the string /proc/self/fd/
diff --git a/sysdeps/unix/sysv/linux/fcntl.c b/sysdeps/unix/sysv/linux/fcntl.c
index 1f5aca14a4..b19654c625 100644
--- a/sysdeps/unix/sysv/linux/fcntl.c
+++ b/sysdeps/unix/sysv/linux/fcntl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2002, 2003, 2004, 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
@@ -23,6 +23,40 @@
#include <stdarg.h>
#include <sys/syscall.h>
+#include <kernel-features.h>
+
+
+#ifdef __ASSUME_F_GETOWN_EX
+# define miss_F_GETOWN_EX 0
+#else
+static int miss_F_GETOWN_EX;
+#endif
+
+
+static int
+do_fcntl (int fd, int cmd, void *arg)
+{
+ if (cmd != F_GETOWN || miss_F_GETOWN_EX)
+ return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg);
+
+ INTERNAL_SYSCALL_DECL (err);
+ struct f_owner_ex fex;
+ int res = INTERNAL_SYSCALL (fcntl, err, 3, fd, F_GETOWN_EX, &fex);
+ if (!INTERNAL_SYSCALL_ERROR_P (res, err))
+ return fex.type == F_OWNER_GID ? -fex.pid : fex.pid;
+
+#ifndef __ASSUME_F_GETOWN_EX
+ if (INTERNAL_SYSCALL_ERRNO (res, err) == EINVAL)
+ {
+ res = INLINE_SYSCALL (fcntl, 3, fd, F_GETOWN, arg);
+ miss_F_GETOWN_EX = 1;
+ return res;
+ }
+#endif
+
+ __set_errno (INTERNAL_SYSCALL_ERRNO (res, err));
+ return -1;
+}
#ifndef NO_CANCELLATION
@@ -36,7 +70,7 @@ __fcntl_nocancel (int fd, int cmd, ...)
arg = va_arg (ap, void *);
va_end (ap);
- return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg);
+ return do_fcntl (fd, cmd, arg);
}
#endif
@@ -52,11 +86,11 @@ __libc_fcntl (int fd, int cmd, ...)
va_end (ap);
if (SINGLE_THREAD_P || cmd != F_SETLKW)
- return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg);
+ return do_fcntl (fd, cmd, arg);
int oldtype = LIBC_CANCEL_ASYNC ();
- int result = INLINE_SYSCALL (fcntl, 3, fd, cmd, arg);
+ int result = do_fcntl (fd, cmd, arg);
LIBC_CANCEL_RESET (oldtype);
diff --git a/sysdeps/unix/sysv/linux/futimesat.c b/sysdeps/unix/sysv/linux/futimesat.c
index 5f3a3f52f3..8292533afb 100644
--- a/sysdeps/unix/sysv/linux/futimesat.c
+++ b/sysdeps/unix/sysv/linux/futimesat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -61,6 +61,12 @@ futimesat (fd, file, tvp)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
+ if (__builtin_expect (filelen == 0, 0))
+ {
+ __set_errno (ENOENT);
+ return -1;
+ }
+
static const char procfd[] = "/proc/self/fd/%d/%s";
/* Buffer for the path name we are going to use. It consists of
- the string /proc/self/fd/
diff --git a/sysdeps/unix/sysv/linux/fxstatat.c b/sysdeps/unix/sysv/linux/fxstatat.c
index 1b9add40d7..dd5c9bc684 100644
--- a/sysdeps/unix/sysv/linux/fxstatat.c
+++ b/sysdeps/unix/sysv/linux/fxstatat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 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
@@ -85,6 +85,12 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
+ if (__builtin_expect (filelen == 0, 0))
+ {
+ __set_errno (ENOENT);
+ return -1;
+ }
+
static const char procfd[] = "/proc/self/fd/%d/%s";
/* Buffer for the path name we are going to use. It consists of
- the string /proc/self/fd/
diff --git a/sysdeps/unix/sysv/linux/fxstatat64.c b/sysdeps/unix/sysv/linux/fxstatat64.c
index cb932b8e59..442e4ca989 100644
--- a/sysdeps/unix/sysv/linux/fxstatat64.c
+++ b/sysdeps/unix/sysv/linux/fxstatat64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005,2006 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -90,6 +90,12 @@ __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
+ if (__builtin_expect (filelen == 0, 0))
+ {
+ __set_errno (ENOENT);
+ return -1;
+ }
+
static const char procfd[] = "/proc/self/fd/%d/%s";
/* Buffer for the path name we are going to use. It consists of
- the string /proc/self/fd/
diff --git a/sysdeps/unix/sysv/linux/getpt.c b/sysdeps/unix/sysv/linux/getpt.c
index bb1ea47643..6b26fdfcdc 100644
--- a/sysdeps/unix/sysv/linux/getpt.c
+++ b/sysdeps/unix/sysv/linux/getpt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2001, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
@@ -64,9 +64,10 @@ __posix_openpt (oflag)
}
/* If /dev/pts is not mounted then the UNIX98 pseudo terminals
- are not usable. */
+ are not usable. */
__close (fd);
have_no_dev_ptmx = 1;
+ __set_errno (ENOENT);
}
else
{
@@ -76,6 +77,8 @@ __posix_openpt (oflag)
return -1;
}
}
+ else
+ __set_errno (ENOENT);
return -1;
}
diff --git a/sysdeps/unix/sysv/linux/i386/bits/fcntl.h b/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
index 35ef665998..d1718a17c9 100644
--- a/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004, 2006, 2007
+ Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004, 2006, 2007, 2009
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -166,6 +166,23 @@ struct flock64
};
#endif
+#ifdef __USE_GNU
+/* Owner types. */
+enum __pid_type
+ {
+ F_OWNER_TID = 0, /* Kernel thread. */
+ F_OWNER_PID, /* Process. */
+ F_OWNER_GID /* Process group. */
+ };
+
+/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */
+struct f_owner_ex
+ {
+ enum __pid_type type; /* Owner type of ID. */
+ __pid_t pid; /* ID of owner. */
+ };
+#endif
+
/* Define some more compatibility macros to be backward compatible with
BSD systems which did not managed to hide these kernel macros. */
#ifdef __USE_BSD
diff --git a/sysdeps/unix/sysv/linux/i386/fchownat.c b/sysdeps/unix/sysv/linux/i386/fchownat.c
index 34acf10c27..1b02fde459 100644
--- a/sysdeps/unix/sysv/linux/i386/fchownat.c
+++ b/sysdeps/unix/sysv/linux/i386/fchownat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -63,6 +63,12 @@ fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
+ if (__builtin_expect (filelen == 0, 0))
+ {
+ __set_errno (ENOENT);
+ return -1;
+ }
+
static const char procfd[] = "/proc/self/fd/%d/%s";
/* Buffer for the path name we are going to use. It consists of
- the string /proc/self/fd/
diff --git a/sysdeps/unix/sysv/linux/i386/fcntl.c b/sysdeps/unix/sysv/linux/i386/fcntl.c
index b27373d24b..5544d6e0d9 100644
--- a/sysdeps/unix/sysv/linux/i386/fcntl.c
+++ b/sysdeps/unix/sysv/linux/i386/fcntl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000,2002,2003,2004,2006 Free Software Foundation, Inc.
+/* Copyright (C) 2000,2002,2003,2004,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
@@ -30,6 +30,13 @@
int __have_no_fcntl64;
#endif
+#ifdef __ASSUME_F_GETOWN_EX
+# define miss_F_GETOWN_EX 0
+#else
+static int miss_F_GETOWN_EX;
+#endif
+
+
#if defined NO_CANCELLATION && __ASSUME_FCNTL64 == 0
# define __fcntl_nocancel __libc_fcntl
#endif
@@ -119,6 +126,26 @@ __fcntl_nocancel (int fd, int cmd, ...)
assert (F_SETLK - F_SETLKW == F_SETLK64 - F_SETLKW64);
return INLINE_SYSCALL (fcntl, 3, fd, cmd + F_SETLK - F_SETLK64, &fl);
}
+ case F_GETOWN:
+ if (! miss_F_GETOWN_EX)
+ {
+ INTERNAL_SYSCALL_DECL (err);
+ struct f_owner_ex fex;
+ int res = INTERNAL_SYSCALL (fcntl, err, 3, fd, F_GETOWN_EX, &fex);
+ if (!INTERNAL_SYSCALL_ERROR_P (res, err))
+ return fex.type == F_OWNER_GID ? -fex.pid : fex.pid;
+
+#ifndef __ASSUME_F_GETOWN_EX
+ if (INTERNAL_SYSCALL_ERRNO (res, err) == EINVAL)
+ miss_F_GETOWN_EX = 1;
+ else
+#endif
+ {
+ __set_errno (INTERNAL_SYSCALL_ERRNO (res, err));
+ return -1;
+ }
+ }
+ /* FALLTHROUGH */
default:
return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg);
}
diff --git a/sysdeps/unix/sysv/linux/i386/fxstatat.c b/sysdeps/unix/sysv/linux/i386/fxstatat.c
index 94f6e81186..37757937b3 100644
--- a/sysdeps/unix/sysv/linux/i386/fxstatat.c
+++ b/sysdeps/unix/sysv/linux/i386/fxstatat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -86,6 +86,12 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
+ if (__builtin_expect (filelen == 0, 0))
+ {
+ __set_errno (ENOENT);
+ return -1;
+ }
+
static const char procfd[] = "/proc/self/fd/%d/%s";
/* Buffer for the path name we are going to use. It consists of
- the string /proc/self/fd/
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h b/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
index 6abc5ced65..9e11f648f8 100644
--- a/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux/IA64.
- Copyright (C) 1999, 2000, 2004, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1999,2000,2004,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
@@ -159,6 +159,23 @@ struct flock64
};
#endif
+#ifdef __USE_GNU
+/* Owner types. */
+enum __pid_type
+ {
+ F_OWNER_TID = 0, /* Kernel thread. */
+ F_OWNER_PID, /* Process. */
+ F_OWNER_GID /* Process group. */
+ };
+
+/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */
+struct f_owner_ex
+ {
+ enum __pid_type type; /* Owner type of ID. */
+ __pid_t pid; /* ID of owner. */
+ };
+#endif
+
/* Define some more compatibility macros to be backward compatible with
BSD systems which did not managed to hide these kernel macros. */
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/siginfo.h b/sysdeps/unix/sysv/linux/ia64/bits/siginfo.h
index 66310c65b3..240ebbc9e1 100644
--- a/sysdeps/unix/sysv/linux/ia64/bits/siginfo.h
+++ b/sysdeps/unix/sysv/linux/ia64/bits/siginfo.h
@@ -1,5 +1,5 @@
/* siginfo_t, sigevent and constants. Linux/ia64 version.
- Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000-2004, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
@@ -310,6 +310,10 @@ typedef struct sigevent
{
int _pad[__SIGEV_PAD_SIZE];
+ /* When SIGEV_SIGNAL and SIGEV_THREAD_ID set, LWP ID of the
+ thread to receive the signal. */
+ __pid_t _tid;
+
struct
{
void (*_function) (sigval_t); /* Function to start. */
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index ff065effb5..f48e644e09 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -542,3 +542,8 @@
# define __ASSUME_PREADV 1
# define __ASSUME_PWRITEV 1
#endif
+
+/* Support for F_GETOWN_EX was introduced in 2.6.32. */
+#if __LINUX_KERNEL_VERSION >= 0x020620
+# define __ASSUME_F_GETOWN_EX 1
+#endif
diff --git a/sysdeps/unix/sysv/linux/linkat.c b/sysdeps/unix/sysv/linux/linkat.c
index cfd0e18223..b2b7b0386b 100644
--- a/sysdeps/unix/sysv/linux/linkat.c
+++ b/sysdeps/unix/sysv/linux/linkat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -66,6 +66,12 @@ linkat (fromfd, from, tofd, to, flags)
if (fromfd != AT_FDCWD && from[0] != '/')
{
size_t filelen = strlen (from);
+ if (__builtin_expect (filelen == 0, 0))
+ {
+ __set_errno (ENOENT);
+ return -1;
+ }
+
/* Buffer for the path name we are going to use. It consists of
- the string /proc/self/fd/
- the file descriptor number
diff --git a/sysdeps/unix/sysv/linux/mkdirat.c b/sysdeps/unix/sysv/linux/mkdirat.c
index 3c190085ce..aa89d08730 100644
--- a/sysdeps/unix/sysv/linux/mkdirat.c
+++ b/sysdeps/unix/sysv/linux/mkdirat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -57,6 +57,12 @@ mkdirat (fd, file, mode)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
+ if (__builtin_expect (filelen == 0, 0))
+ {
+ __set_errno (ENOENT);
+ return -1;
+ }
+
static const char procfd[] = "/proc/self/fd/%d/%s";
/* Buffer for the path name we are going to use. It consists of
- the string /proc/self/fd/
diff --git a/sysdeps/unix/sysv/linux/openat.c b/sysdeps/unix/sysv/linux/openat.c
index 45b566f2d0..7916c71105 100644
--- a/sysdeps/unix/sysv/linux/openat.c
+++ b/sysdeps/unix/sysv/linux/openat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 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
@@ -110,6 +110,12 @@ OPENAT_NOT_CANCEL (fd, file, oflag, mode)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
+ if (__builtin_expect (filelen == 0, 0))
+ {
+ __set_errno (ENOENT);
+ return -1;
+ }
+
static const char procfd[] = "/proc/self/fd/%d/%s";
/* Buffer for the path name we are going to use. It consists of
- the string /proc/self/fd/
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
index 90b669ab60..dc2e0e6201 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux/PowerPC.
- Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004, 2006, 2007
+ Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004, 2006, 2007, 2009
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -166,6 +166,23 @@ struct flock64
};
#endif
+#ifdef __USE_GNU
+/* Owner types. */
+enum __pid_type
+ {
+ F_OWNER_TID = 0, /* Kernel thread. */
+ F_OWNER_PID, /* Process. */
+ F_OWNER_GID /* Process group. */
+ };
+
+/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */
+struct f_owner_ex
+ {
+ enum __pid_type type; /* Owner type of ID. */
+ __pid_t pid; /* ID of owner. */
+ };
+#endif
+
/* Define some more compatibility macros to be backward compatible with
BSD systems which did not managed to hide these kernel macros. */
#ifdef __USE_BSD
diff --git a/sysdeps/unix/sysv/linux/powerpc/fchownat.c b/sysdeps/unix/sysv/linux/powerpc/fchownat.c
index 67c570648a..46f6d97c6b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/fchownat.c
+++ b/sysdeps/unix/sysv/linux/powerpc/fchownat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -66,6 +66,12 @@ fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
+ if (__builtin_expect (filelen == 0, 0))
+ {
+ __set_errno (ENOENT);
+ return -1;
+ }
+
static const char procfd[] = "/proc/self/fd/%d/%s";
/* Buffer for the path name we are going to use. It consists of
- the string /proc/self/fd/
diff --git a/sysdeps/unix/sysv/linux/readlinkat.c b/sysdeps/unix/sysv/linux/readlinkat.c
index 1361596503..55abff143d 100644
--- a/sysdeps/unix/sysv/linux/readlinkat.c
+++ b/sysdeps/unix/sysv/linux/readlinkat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -59,6 +59,12 @@ readlinkat (fd, path, buf, len)
if (fd != AT_FDCWD && path[0] != '/')
{
size_t pathlen = strlen (path);
+ if (__builtin_expect (pathlen == 0, 0))
+ {
+ __set_errno (ENOENT);
+ return -1;
+ }
+
static const char procfd[] = "/proc/self/fd/%d/%s";
/* Buffer for the path name we are going to use. It consists of
- the string /proc/self/fd/
diff --git a/sysdeps/unix/sysv/linux/renameat.c b/sysdeps/unix/sysv/linux/renameat.c
index 86bb75a7b0..160bdc4903 100644
--- a/sysdeps/unix/sysv/linux/renameat.c
+++ b/sysdeps/unix/sysv/linux/renameat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -135,6 +135,12 @@ renameat (oldfd, old, newfd, new)
if (oldfd != AT_FDCWD && old[0] != '/')
{
size_t filelen = strlen (old);
+ if (__builtin_expect (filelen == 0, 0))
+ {
+ __set_errno (ENOENT);
+ return -1;
+ }
+
/* Buffer for the path name we are going to use. It consists of
- the string /proc/self/fd/
- the file descriptor number
@@ -154,6 +160,12 @@ renameat (oldfd, old, newfd, new)
if (newfd != AT_FDCWD && new[0] != '/')
{
size_t filelen = strlen (new);
+ if (__builtin_expect (filelen == 0, 0))
+ {
+ __set_errno (ENOENT);
+ return -1;
+ }
+
/* Buffer for the path name we are going to use. It consists of
- the string /proc/self/fd/
- the file descriptor number
diff --git a/sysdeps/unix/sysv/linux/s390/bits/fcntl.h b/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
index ff5941df65..b50c00c882 100644
--- a/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 2000,2001,2002,2004,2006,2007 Free Software Foundation, Inc.
+ Copyright (C) 2000,2001,2002,2004,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
@@ -181,6 +181,23 @@ struct flock64
};
#endif
+#ifdef __USE_GNU
+/* Owner types. */
+enum __pid_type
+ {
+ F_OWNER_TID = 0, /* Kernel thread. */
+ F_OWNER_PID, /* Process. */
+ F_OWNER_GID /* Process group. */
+ };
+
+/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */
+struct f_owner_ex
+ {
+ enum __pid_type type; /* Owner type of ID. */
+ __pid_t pid; /* ID of owner. */
+ };
+#endif
+
/* Define some more compatibility macros to be backward compatible with
BSD systems which did not managed to hide these kernel macros. */
#ifdef __USE_BSD
diff --git a/sysdeps/unix/sysv/linux/s390/bits/siginfo.h b/sysdeps/unix/sysv/linux/s390/bits/siginfo.h
index 0b79853137..55b3f88c0a 100644
--- a/sysdeps/unix/sysv/linux/s390/bits/siginfo.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/siginfo.h
@@ -1,5 +1,5 @@
/* siginfo_t, sigevent and constants. S/390 version.
- Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 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
@@ -26,7 +26,7 @@
#if (!defined __have_sigval_t \
&& (defined _SIGNAL_H || defined __need_siginfo_t \
- || defined __need_sigevent_t))
+ || defined __need_sigevent_t))
# define __have_sigval_t 1
/* Type for data associated with a signal. */
@@ -96,7 +96,7 @@ typedef struct siginfo
struct
{
void *si_addr; /* Faulting insn/memory ref. */
- int si_trapno;
+ int si_trapno;
} _sigfault;
/* SIGPOLL. */
@@ -282,6 +282,10 @@ typedef struct sigevent
{
int _pad[__SIGEV_PAD_SIZE];
+ /* When SIGEV_SIGNAL and SIGEV_THREAD_ID set, LWP ID of the
+ thread to receive the signal. */
+ __pid_t _tid;
+
struct
{
void (*_function) (sigval_t); /* Function to start. */
diff --git a/sysdeps/unix/sysv/linux/sh/bits/fcntl.h b/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
index 35ef665998..d1718a17c9 100644
--- a/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004, 2006, 2007
+ Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004, 2006, 2007, 2009
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -166,6 +166,23 @@ struct flock64
};
#endif
+#ifdef __USE_GNU
+/* Owner types. */
+enum __pid_type
+ {
+ F_OWNER_TID = 0, /* Kernel thread. */
+ F_OWNER_PID, /* Process. */
+ F_OWNER_GID /* Process group. */
+ };
+
+/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */
+struct f_owner_ex
+ {
+ enum __pid_type type; /* Owner type of ID. */
+ __pid_t pid; /* ID of owner. */
+ };
+#endif
+
/* Define some more compatibility macros to be backward compatible with
BSD systems which did not managed to hide these kernel macros. */
#ifdef __USE_BSD
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
index d59744a55e..648bea8e58 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux/SPARC.
- Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004, 2006, 2007
+ Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004, 2006, 2007, 2009
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -185,6 +185,23 @@ struct flock64
};
#endif
+#ifdef __USE_GNU
+/* Owner types. */
+enum __pid_type
+ {
+ F_OWNER_TID = 0, /* Kernel thread. */
+ F_OWNER_PID, /* Process. */
+ F_OWNER_GID /* Process group. */
+ };
+
+/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */
+struct f_owner_ex
+ {
+ enum __pid_type type; /* Owner type of ID. */
+ __pid_t pid; /* ID of owner. */
+ };
+#endif
+
/* Define some more compatibility macros to be backward compatible with
BSD systems which did not managed to hide these kernel macros. */
#ifdef __USE_BSD
diff --git a/sysdeps/unix/sysv/linux/symlinkat.c b/sysdeps/unix/sysv/linux/symlinkat.c
index 4cfc924bfc..d2704777bd 100644
--- a/sysdeps/unix/sysv/linux/symlinkat.c
+++ b/sysdeps/unix/sysv/linux/symlinkat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -57,6 +57,12 @@ symlinkat (from, tofd, to)
if (tofd != AT_FDCWD && to[0] != '/')
{
size_t tolen = strlen (to);
+ if (__builtin_expect (tolen == 0, 0))
+ {
+ __set_errno (ENOENT);
+ return -1;
+ }
+
static const char procfd[] = "/proc/self/fd/%d/%s";
/* Buffer for the path name we are going to use. It consists of
- the string /proc/self/fd/
diff --git a/sysdeps/unix/sysv/linux/ttyname.c b/sysdeps/unix/sysv/linux/ttyname.c
index 1b79787515..69af6adc65 100644
--- a/sysdeps/unix/sysv/linux/ttyname.c
+++ b/sysdeps/unix/sysv/linux/ttyname.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,1996-2002,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,1996-2002,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
@@ -59,6 +59,11 @@ getttyname (const char *dev, dev_t mydev, ino64_t myino, int save, int *dostat)
return NULL;
}
+ /* Prepare for the loop. If we already have a buffer copy the directory
+ name we look at into it. */
+ if (devlen < namelen)
+ *((char *) __mempcpy (getttyname_name, dev, devlen - 1)) = '/';
+
while ((d = __readdir64 (dirstream)) != NULL)
if ((d->d_fileno == myino || *dostat)
&& strcmp (d->d_name, "stdin")
diff --git a/sysdeps/unix/sysv/linux/unlinkat.c b/sysdeps/unix/sysv/linux/unlinkat.c
index 0a07a8a875..bb5f89810b 100644
--- a/sysdeps/unix/sysv/linux/unlinkat.c
+++ b/sysdeps/unix/sysv/linux/unlinkat.c
@@ -1,5 +1,5 @@
/* unlinkat -- Remove a link by relative name.
- Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 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
@@ -64,6 +64,12 @@ unlinkat (fd, file, flag)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
+ if (__builtin_expect (filelen == 0, 0))
+ {
+ __set_errno (ENOENT);
+ return -1;
+ }
+
static const char procfd[] = "/proc/self/fd/%d/%s";
/* Buffer for the path name we are going to use. It consists of
- the string /proc/self/fd/
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c b/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c
index 8b1c932ba9..cc41fdedc0 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c
+++ b/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -72,6 +72,12 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
+ if (__builtin_expect (filelen == 0, 0))
+ {
+ __set_errno (ENOENT);
+ return -1;
+ }
+
static const char procfd[] = "/proc/self/fd/%d/%s";
/* Buffer for the path name we are going to use. It consists of
- the string /proc/self/fd/
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h b/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
index bc0f4d687b..e9806ee004 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux/x86-64.
- Copyright (C) 2001, 2002, 2004, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2001,2002,2004,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
@@ -180,6 +180,23 @@ struct flock64
};
#endif
+#ifdef __USE_GNU
+/* Owner types. */
+enum __pid_type
+ {
+ F_OWNER_TID = 0, /* Kernel thread. */
+ F_OWNER_PID, /* Process. */
+ F_OWNER_GID /* Process group. */
+ };
+
+/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */
+struct f_owner_ex
+ {
+ enum __pid_type type; /* Owner type of ID. */
+ __pid_t pid; /* ID of owner. */
+ };
+#endif
+
/* Define some more compatibility macros to be backward compatible with
BSD systems which did not managed to hide these kernel macros. */
#ifdef __USE_BSD
diff --git a/sysdeps/unix/sysv/linux/xmknodat.c b/sysdeps/unix/sysv/linux/xmknodat.c
index ef27b686cc..177b3db986 100644
--- a/sysdeps/unix/sysv/linux/xmknodat.c
+++ b/sysdeps/unix/sysv/linux/xmknodat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -72,6 +72,12 @@ __xmknodat (int vers, int fd, const char *file, mode_t mode, dev_t *dev)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
+ if (__builtin_expect (filelen == 0, 0))
+ {
+ __set_errno (ENOENT);
+ return -1;
+ }
+
static const char procfd[] = "/proc/self/fd/%d/%s";
/* Buffer for the path name we are going to use. It consists of
- the string /proc/self/fd/
diff --git a/sysdeps/x86_64/multiarch/Makefile b/sysdeps/x86_64/multiarch/Makefile
index 0ded3b3261..364e7bbbd2 100644
--- a/sysdeps/x86_64/multiarch/Makefile
+++ b/sysdeps/x86_64/multiarch/Makefile
@@ -4,7 +4,8 @@ gen-as-const-headers += ifunc-defines.sym
endif
ifeq ($(subdir),string)
-sysdep_routines += stpncpy-c strncpy-c strcmp-ssse3 strncmp-ssse3
+sysdep_routines += stpncpy-c strncpy-c strcmp-ssse3 strncmp-ssse3 \
+ strend-sse4
ifeq (yes,$(config-cflags-sse4))
sysdep_routines += strcspn-c strpbrk-c strspn-c strstr-c strcasestr-c
CFLAGS-strcspn-c.c += -msse4
diff --git a/sysdeps/x86_64/multiarch/strchr.S b/sysdeps/x86_64/multiarch/strchr.S
new file mode 100644
index 0000000000..b35566d1a5
--- /dev/null
+++ b/sysdeps/x86_64/multiarch/strchr.S
@@ -0,0 +1,177 @@
+/* strchr with SSE4.2
+ Copyright (C) 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 <sysdep.h>
+#include <ifunc-defines.h>
+
+
+/* Define multiple versions only for the definition in libc. */
+#ifndef NOT_IN_libc
+ .text
+ENTRY(strchr)
+ .type strchr, @gnu_indirect_function
+ cmpl $0, __cpu_features+KIND_OFFSET(%rip)
+ jne 1f
+ call __init_cpu_features
+1: leaq __strchr_sse2(%rip), %rax
+ testl $(1<<20), __cpu_features+CPUID_OFFSET+COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_ECX_OFFSET(%rip)
+ jz 2f
+ leaq __strchr_sse42(%rip), %rax
+2: ret
+END(strchr)
+
+
+/*
+ This implementation uses SSE4 instructions to compare up to 16 bytes
+ at a time looking for the first occurrence of the character c in the
+ string s:
+
+ char *strchr (const char *s, int c);
+
+ We use 0xa:
+ _SIDD_SBYTE_OPS
+ | _SIDD_CMP_EQUAL_EACH
+ | _SIDD_LEAST_SIGNIFICANT
+ on pcmpistri to compare xmm/mem128
+
+ 0 1 2 3 4 5 6 7 8 9 A B C D E F
+ X X X X X X X X X X X X X X X X
+
+ against xmm
+
+ 0 1 2 3 4 5 6 7 8 9 A B C D E F
+ C C C C C C C C C C C C C C C C
+
+ to find out if the first 16byte data element has a byte C and the
+ offset of the first byte. There are 3 cases:
+
+ 1. The first 16byte data element has the byte C at the offset X.
+ 2. The first 16byte data element has EOS and doesn't have the byte C.
+ 3. The first 16byte data element is valid and doesn't have the byte C.
+
+ Here is the table of ECX, CFlag, ZFlag and SFlag for 3 cases:
+
+ case ECX CFlag ZFlag SFlag
+ 1 X 1 0/1 0
+ 2 16 0 1 0
+ 3 16 0 0 0
+
+ We exit from the loop for cases 1 and 2 with jbe which branches
+ when either CFlag or ZFlag is 1. If CFlag == 1, ECX has the offset
+ X for case 1. */
+
+ .section .text.sse4.2,"ax",@progbits
+ .align 16
+ .type __strchr_sse42, @function
+__strchr_sse42:
+ cfi_startproc
+ CALL_MCOUNT
+ testb %sil, %sil
+ je __strend_sse4
+ pxor %xmm2, %xmm2
+ movd %esi, %xmm1
+ movl %edi, %ecx
+ andl $15, %ecx
+ movq %rdi, %r8
+ je L(aligned_start)
+
+/* Handle unaligned string. */
+ andq $-16, %r8
+ pshufb %xmm2, %xmm1
+ movdqa (%r8), %xmm0
+ pcmpeqb %xmm0, %xmm2
+ pcmpeqb %xmm1, %xmm0
+ /* Find where NULL is. */
+ pmovmskb %xmm2, %edx
+ /* Check if there is a match. */
+ pmovmskb %xmm0, %esi
+ /* Remove the leading bytes. */
+ sarl %cl, %edx
+ sarl %cl, %esi
+ testl %esi, %esi
+ je L(unaligned_no_match)
+ /* Check which byte is a match. */
+ bsfl %esi, %eax
+ /* Is there a NULL? */
+ testl %edx, %edx
+ je L(unaligned_match)
+ bsfl %edx, %esi
+ cmpl %esi, %eax
+ /* Return NULL if NULL comes first. */
+ ja L(return_null)
+L(unaligned_match):
+ addq %rdi, %rax
+ ret
+
+ .p2align 4
+L(unaligned_no_match):
+ testl %edx, %edx
+ jne L(return_null)
+
+/* Loop start on aligned string. */
+L(loop):
+ addq $16, %r8
+L(aligned_start):
+ pcmpistri $0x2, (%r8), %xmm1
+ jbe L(wrap)
+ addq $16, %r8
+ pcmpistri $0x2, (%r8), %xmm1
+ jbe L(wrap)
+ addq $16, %r8
+ pcmpistri $0x2, (%r8), %xmm1
+ jbe L(wrap)
+ addq $16, %r8
+ pcmpistri $0x2, (%r8), %xmm1
+ jbe L(wrap)
+ jmp L(loop)
+L(wrap):
+ jc L(loop_exit)
+
+/* Return NULL. */
+L(return_null):
+ xorl %eax, %eax
+ ret
+
+/* Loop exit. */
+ .p2align 4
+L(loop_exit):
+ leaq (%r8,%rcx), %rax
+ ret
+ cfi_endproc
+ .size __strchr_sse42, .-__strchr_sse42
+
+
+# undef ENTRY
+# define ENTRY(name) \
+ .type __strchr_sse2, @function; \
+ .align 16; \
+ __strchr_sse2: cfi_startproc; \
+ CALL_MCOUNT
+# undef END
+# define END(name) \
+ cfi_endproc; .size __strchr_sse2, .-__strchr_sse2
+# undef libc_hidden_builtin_def
+/* It doesn't make sense to send libc-internal strchr calls through a PLT.
+ The speedup we get from using SSE4.2 instruction is likely eaten away
+ by the indirect call in the PLT. */
+# define libc_hidden_builtin_def(name) \
+ .globl __GI_strchr; __GI_strchr = __strchr_sse2
+#endif
+
+#include "../strchr.S"
diff --git a/sysdeps/x86_64/multiarch/strend-sse4.S b/sysdeps/x86_64/multiarch/strend-sse4.S
new file mode 100644
index 0000000000..c3220b3386
--- /dev/null
+++ b/sysdeps/x86_64/multiarch/strend-sse4.S
@@ -0,0 +1,49 @@
+/* Return the pointer to the end of string, using SSE4.2
+ Copyright (C) 2009 Free Software Foundation, Inc.
+ Contributed by Intel Corporation.
+ 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 <sysdep.h>
+#include "asm-syntax.h"
+
+ .section .text.sse4.2,"ax",@progbits
+ENTRY (__strend_sse4)
+ pxor %xmm2, %xmm2
+ movq %rdi, %rcx
+ andq $~15, %rdi
+ movdqa %xmm2, %xmm1
+ pcmpeqb (%rdi), %xmm2
+ orl $0xffffffff, %esi
+ subq %rdi, %rcx
+ shll %cl, %esi
+ pmovmskb %xmm2, %edx
+ andl %esi, %edx
+ jnz 1f
+
+2: pcmpistri $0x08, 16(%rdi), %xmm1
+ leaq 16(%rdi), %rdi
+ jnz 2b
+
+ leaq (%rdi,%rcx), %rax
+ ret
+
+1: bsfl %edx, %eax
+ addq %rdi, %rax
+ ret
+
+END (__strend_sse4)
diff --git a/sysdeps/x86_64/multiarch/strrchr.S b/sysdeps/x86_64/multiarch/strrchr.S
new file mode 100644
index 0000000000..f6665f34b7
--- /dev/null
+++ b/sysdeps/x86_64/multiarch/strrchr.S
@@ -0,0 +1,278 @@
+/* strrchr with SSE4.2
+ Copyright (C) 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 <sysdep.h>
+#include <ifunc-defines.h>
+
+
+/* Define multiple versions only for the definition in libc and for
+ the DSO. In static binaries we need strrchr before the initialization
+ happened. */
+#if defined SHARED && !defined NOT_IN_libc
+ .text
+ENTRY(strrchr)
+ .type strrchr, @gnu_indirect_function
+ cmpl $0, __cpu_features+KIND_OFFSET(%rip)
+ jne 1f
+ call __init_cpu_features
+1: leaq __strrchr_sse2(%rip), %rax
+ testl $(1<<20), __cpu_features+CPUID_OFFSET+COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_ECX_OFFSET(%rip)
+ jz 2f
+ leaq __strrchr_sse42(%rip), %rax
+2: ret
+END(strrchr)
+
+/*
+ This implementation uses SSE4 instructions to compare up to 16 bytes
+ at a time looking for the last occurrence of the character c in the
+ string s:
+
+ char *strrchr (const char *s, int c);
+
+ We use 0x4a:
+ _SIDD_SBYTE_OPS
+ | _SIDD_CMP_EQUAL_EACH
+ | _SIDD_MOST_SIGNIFICANT
+ on pcmpistri to compare xmm/mem128
+
+ 0 1 2 3 4 5 6 7 8 9 A B C D E F
+ X X X X X X X X X X X X X X X X
+
+ against xmm
+
+ 0 1 2 3 4 5 6 7 8 9 A B C D E F
+ C C C C C C C C C C C C C C C C
+
+ to find out if the first 16byte data element has a byte C and the
+ last offset. There are 4 cases:
+
+ 1. The first 16byte data element has EOS and has the byte C at the
+ last offset X.
+ 2. The first 16byte data element is valid and has the byte C at the
+ last offset X.
+ 3. The first 16byte data element has EOS and doesn't have the byte C.
+ 4. The first 16byte data element is valid and doesn't have the byte C.
+
+ Here is the table of ECX, CFlag, ZFlag and SFlag for 3 cases:
+
+ case ECX CFlag ZFlag SFlag
+ 1 X 1 1 0
+ 2 X 1 0 0
+ 3 16 0 1 0
+ 4 16 0 0 0
+
+ We exit from the loop for cases 1 and 3 with jz which branches
+ when ZFlag is 1. If CFlag == 1, ECX has the offset X for case 1. */
+
+
+ .section .text.sse4.2,"ax",@progbits
+ .align 16
+ .type __strrchr_sse42, @function
+__strrchr_sse42:
+ cfi_startproc
+ CALL_MCOUNT
+ testb %sil, %sil
+ je __strend_sse4
+ xor %eax,%eax /* RAX has the last occurrence of s. */
+ movd %esi, %xmm1
+ punpcklbw %xmm1, %xmm1
+ movl %edi, %esi
+ punpcklbw %xmm1, %xmm1
+ andl $15, %esi
+ pshufd $0, %xmm1, %xmm1
+ movq %rdi, %r8
+ je L(loop)
+
+/* Handle unaligned string using psrldq. */
+ leaq L(psrldq_table)(%rip), %rdx
+ andq $-16, %r8
+ movslq (%rdx,%rsi,4),%r9
+ movdqa (%r8), %xmm0
+ addq %rdx, %r9
+ jmp *%r9
+
+/* Handle unaligned string with offset 1 using psrldq. */
+ .p2align 4
+L(psrldq_1):
+ psrldq $1, %xmm0
+
+ .p2align 4
+L(unaligned_pcmpistri):
+ pcmpistri $0x4a, %xmm1, %xmm0
+ jnc L(unaligned_no_byte)
+ leaq (%rdi,%rcx), %rax
+L(unaligned_no_byte):
+ /* Find the length of the unaligned string. */
+ pcmpistri $0x3a, %xmm0, %xmm0
+ movl $16, %edx
+ subl %esi, %edx
+ cmpl %ecx, %edx
+ /* Return RAX if the unaligned fragment to next 16B already
+ contain the NULL terminator. */
+ jg L(exit)
+ addq $16, %r8
+
+/* Loop start on aligned string. */
+ .p2align 4
+L(loop):
+ pcmpistri $0x4a, (%r8), %xmm1
+ jbe L(match_or_eos)
+ addq $16, %r8
+ jmp L(loop)
+ .p2align 4
+L(match_or_eos):
+ je L(had_eos)
+L(match_no_eos):
+ leaq (%r8,%rcx), %rax
+ addq $16, %r8
+ jmp L(loop)
+ .p2align 4
+L(had_eos):
+ jnc L(exit)
+ leaq (%r8,%rcx), %rax
+ .p2align 4
+L(exit):
+ ret
+
+/* Handle unaligned string with offset 15 using psrldq. */
+ .p2align 4
+L(psrldq_15):
+ psrldq $15, %xmm0
+ jmp L(unaligned_pcmpistri)
+
+/* Handle unaligned string with offset 14 using psrldq. */
+ .p2align 4
+L(psrldq_14):
+ psrldq $14, %xmm0
+ jmp L(unaligned_pcmpistri)
+
+/* Handle unaligned string with offset 13 using psrldq. */
+ .p2align 4
+L(psrldq_13):
+ psrldq $13, %xmm0
+ jmp L(unaligned_pcmpistri)
+
+/* Handle unaligned string with offset 12 using psrldq. */
+ .p2align 4
+L(psrldq_12):
+ psrldq $12, %xmm0
+ jmp L(unaligned_pcmpistri)
+
+/* Handle unaligned string with offset 11 using psrldq. */
+ .p2align 4
+L(psrldq_11):
+ psrldq $11, %xmm0
+ jmp L(unaligned_pcmpistri)
+
+/* Handle unaligned string with offset 10 using psrldq. */
+ .p2align 4
+L(psrldq_10):
+ psrldq $10, %xmm0
+ jmp L(unaligned_pcmpistri)
+
+/* Handle unaligned string with offset 9 using psrldq. */
+ .p2align 4
+L(psrldq_9):
+ psrldq $9, %xmm0
+ jmp L(unaligned_pcmpistri)
+
+/* Handle unaligned string with offset 8 using psrldq. */
+ .p2align 4
+L(psrldq_8):
+ psrldq $8, %xmm0
+ jmp L(unaligned_pcmpistri)
+
+/* Handle unaligned string with offset 7 using psrldq. */
+ .p2align 4
+L(psrldq_7):
+ psrldq $7, %xmm0
+ jmp L(unaligned_pcmpistri)
+
+/* Handle unaligned string with offset 6 using psrldq. */
+ .p2align 4
+L(psrldq_6):
+ psrldq $6, %xmm0
+ jmp L(unaligned_pcmpistri)
+
+/* Handle unaligned string with offset 5 using psrldq. */
+ .p2align 4
+L(psrldq_5):
+ psrldq $5, %xmm0
+ jmp L(unaligned_pcmpistri)
+
+/* Handle unaligned string with offset 4 using psrldq. */
+ .p2align 4
+L(psrldq_4):
+ psrldq $4, %xmm0
+ jmp L(unaligned_pcmpistri)
+
+/* Handle unaligned string with offset 3 using psrldq. */
+ .p2align 4
+L(psrldq_3):
+ psrldq $3, %xmm0
+ jmp L(unaligned_pcmpistri)
+
+/* Handle unaligned string with offset 2 using psrldq. */
+ .p2align 4
+L(psrldq_2):
+ psrldq $2, %xmm0
+ jmp L(unaligned_pcmpistri)
+
+ cfi_endproc
+ .size __strrchr_sse42, .-__strrchr_sse42
+
+ .section .rodata.sse4.2,"a",@progbits
+ .p2align 4
+L(psrldq_table):
+ .int L(loop) - L(psrldq_table)
+ .int L(psrldq_1) - L(psrldq_table)
+ .int L(psrldq_2) - L(psrldq_table)
+ .int L(psrldq_3) - L(psrldq_table)
+ .int L(psrldq_4) - L(psrldq_table)
+ .int L(psrldq_5) - L(psrldq_table)
+ .int L(psrldq_6) - L(psrldq_table)
+ .int L(psrldq_7) - L(psrldq_table)
+ .int L(psrldq_8) - L(psrldq_table)
+ .int L(psrldq_9) - L(psrldq_table)
+ .int L(psrldq_10) - L(psrldq_table)
+ .int L(psrldq_11) - L(psrldq_table)
+ .int L(psrldq_12) - L(psrldq_table)
+ .int L(psrldq_13) - L(psrldq_table)
+ .int L(psrldq_14) - L(psrldq_table)
+ .int L(psrldq_15) - L(psrldq_table)
+
+
+# undef ENTRY
+# define ENTRY(name) \
+ .type __strrchr_sse2, @function; \
+ .align 16; \
+ __strrchr_sse2: cfi_startproc; \
+ CALL_MCOUNT
+# undef END
+# define END(name) \
+ cfi_endproc; .size __strrchr_sse2, .-__strrchr_sse2
+# undef libc_hidden_builtin_def
+/* It doesn't make sense to send libc-internal strrchr calls through a PLT.
+ The speedup we get from using SSE4.2 instruction is likely eaten away
+ by the indirect call in the PLT. */
+# define libc_hidden_builtin_def(name) \
+ .globl __GI_strrchr; __GI_strrchr = __strrchr_sse2
+#endif
+
+#include "../strrchr.S"