summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2008-08-19 17:24:09 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2008-08-19 17:24:09 +0000
commit447fd9179ef3effda7c99168c310c5e0d0e8e770 (patch)
treef90fa016ce2e15d5b509f124107ea12273ee605e /libc
parent46a638ad529cc323bb7fbd02968b0770ab6626e8 (diff)
downloadeglibc2-447fd9179ef3effda7c99168c310c5e0d0e8e770.tar.gz
Merge changes between r6509 and r6780 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@6785 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc')
-rw-r--r--libc/ChangeLog529
-rw-r--r--libc/Makeconfig6
-rw-r--r--libc/Makefile4
-rw-r--r--libc/NEWS20
-rw-r--r--libc/Versions.def3
-rw-r--r--libc/config.make.in2
-rwxr-xr-xlibc/configure33
-rw-r--r--libc/configure.in17
-rw-r--r--libc/elf/Makefile8
-rw-r--r--libc/elf/dl-load.c11
-rw-r--r--libc/elf/dl-object.c10
-rw-r--r--libc/elf/dl-support.c2
-rw-r--r--libc/elf/dl-sysdep.c1
-rw-r--r--libc/elf/elf.h2
-rw-r--r--libc/hurd/fd-read.c7
-rw-r--r--libc/hurd/hurd/signal.h9
-rw-r--r--libc/include/arpa/nameser.h37
-rw-r--r--libc/include/resolv.h12
-rw-r--r--libc/include/rpc/clnt.h12
-rw-r--r--libc/include/sys/socket.h8
-rw-r--r--libc/include/unistd.h7
-rw-r--r--libc/io/Makefile4
-rw-r--r--libc/io/Versions3
-rw-r--r--libc/io/dup3.c48
-rw-r--r--libc/io/ftw.c4
-rw-r--r--libc/io/pipe2.c44
-rw-r--r--libc/libio/Makefile4
-rw-r--r--libc/libio/fileops.c4
-rw-r--r--libc/libio/fmemopen.c11
-rw-r--r--libc/libio/iopopen.c120
-rw-r--r--libc/libio/iosetvbuf.c2
-rw-r--r--libc/libio/tst-popen1.c49
-rw-r--r--libc/locale/setlocale.c43
-rw-r--r--libc/localedata/ChangeLog11
-rw-r--r--libc/localedata/charmaps/UTF-82
-rw-r--r--libc/localedata/locales/iso14651_t1_common270
-rw-r--r--libc/login/utmp_file.c34
-rw-r--r--libc/malloc/hooks.c4
-rw-r--r--libc/malloc/mtrace.c18
-rw-r--r--libc/manual/arith.texi6
-rw-r--r--libc/manual/creature.texi2
-rw-r--r--libc/manual/filesys.texi2
-rw-r--r--libc/manual/math.texi2
-rw-r--r--libc/manual/memory.texi2
-rw-r--r--libc/manual/resource.texi4
-rw-r--r--libc/manual/syslog.texi2
-rw-r--r--libc/manual/time.texi2
-rw-r--r--libc/misc/syslog.c31
-rw-r--r--libc/nis/ypclnt.c17
-rw-r--r--libc/nptl/ChangeLog32
-rw-r--r--libc/nptl/allocatestack.c22
-rw-r--r--libc/nptl/sysdeps/powerpc/tcb-offsets.sym2
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/mq_notify.c29
-rw-r--r--libc/nptl/sysdeps/x86_64/pthreaddef.h10
-rw-r--r--libc/nptl/tst-align2.c2
-rw-r--r--libc/nscd/Makefile2
-rw-r--r--libc/nscd/connections.c222
-rw-r--r--libc/nscd/nscd_helper.c31
-rw-r--r--libc/posix/unistd.h14
-rw-r--r--libc/posix/wordexp.c58
-rw-r--r--libc/resolv/Makefile5
-rw-r--r--libc/resolv/Versions13
-rw-r--r--libc/resolv/arpa/nameser.h397
-rw-r--r--libc/resolv/arpa/nameser_compat.h59
-rw-r--r--libc/resolv/gethnamaddr.c6
-rw-r--r--libc/resolv/ns_date.c121
-rw-r--r--libc/resolv/ns_name.c589
-rw-r--r--libc/resolv/ns_netint.c22
-rw-r--r--libc/resolv/ns_parse.c94
-rw-r--r--libc/resolv/ns_print.c203
-rw-r--r--libc/resolv/ns_samedomain.c65
-rw-r--r--libc/resolv/ns_ttl.c9
-rw-r--r--libc/resolv/nss_dns/dns-canon.c7
-rw-r--r--libc/resolv/nss_dns/dns-host.c81
-rw-r--r--libc/resolv/nss_dns/dns-network.c4
-rw-r--r--libc/resolv/res_debug.c2
-rw-r--r--libc/resolv/res_mkquery.c9
-rw-r--r--libc/resolv/res_query.c58
-rw-r--r--libc/resolv/res_send.c54
-rw-r--r--libc/scripts/gen-as-const.awk16
-rw-r--r--libc/socket/Makefile6
-rw-r--r--libc/socket/Versions3
-rw-r--r--libc/socket/have_sock_cloexec.c24
-rw-r--r--libc/socket/paccept.c43
-rw-r--r--libc/socket/sys/socket.h18
-rw-r--r--libc/stdio-common/Makefile9
-rw-r--r--libc/stdio-common/_i18n_number.h24
-rw-r--r--libc/stdio-common/printf_fp.c27
-rw-r--r--libc/stdio-common/tst-setvbuf1.c19
-rw-r--r--libc/stdio-common/tst-setvbuf1.expect2
-rw-r--r--libc/stdio-common/vfprintf.c15
-rw-r--r--libc/sunrpc/Versions3
-rw-r--r--libc/sunrpc/clnt_udp.c60
-rw-r--r--libc/sunrpc/key_call.c2
-rw-r--r--libc/sysdeps/generic/ldsodefs.h1
-rw-r--r--libc/sysdeps/i386/fpu/s_expm1l.S7
-rw-r--r--libc/sysdeps/i386/i686/memcmp.S5
-rw-r--r--libc/sysdeps/mach/hurd/bits/fcntl.h2
-rw-r--r--libc/sysdeps/mach/i386/machine-lock.h8
-rw-r--r--libc/sysdeps/posix/clock_getres.c4
-rw-r--r--libc/sysdeps/posix/getaddrinfo.c2
-rw-r--r--libc/sysdeps/powerpc/dl-procinfo.c10
-rw-r--r--libc/sysdeps/powerpc/dl-procinfo.h10
-rw-r--r--libc/sysdeps/powerpc/fpu/bits/mathinline.h10
-rw-r--r--libc/sysdeps/powerpc/powerpc32/dl-machine.c5
-rw-r--r--libc/sysdeps/powerpc/sysdep.h2
-rw-r--r--libc/sysdeps/sparc/Makefile2
-rw-r--r--libc/sysdeps/unix/syscalls.list1
-rw-r--r--libc/sysdeps/unix/sysv/linux/Versions3
-rw-r--r--libc/sysdeps/unix/sysv/linux/alpha/sys/epoll.h143
-rw-r--r--libc/sysdeps/unix/sysv/linux/alpha/sys/eventfd.h52
-rw-r--r--libc/sysdeps/unix/sysv/linux/alpha/sys/inotify.h105
-rw-r--r--libc/sysdeps/unix/sysv/linux/alpha/sys/signalfd.h66
-rw-r--r--libc/sysdeps/unix/sysv/linux/alpha/sys/timerfd.h60
-rw-r--r--libc/sysdeps/unix/sysv/linux/bits/in.h2
-rw-r--r--libc/sysdeps/unix/sysv/linux/bits/socket.h20
-rw-r--r--libc/sysdeps/unix/sysv/linux/clock_getres.c6
-rw-r--r--libc/sysdeps/unix/sysv/linux/dl-sysdep.h4
-rw-r--r--libc/sysdeps/unix/sysv/linux/eventfd.c12
-rw-r--r--libc/sysdeps/unix/sysv/linux/i386/bits/mman.h1
-rw-r--r--libc/sysdeps/unix/sysv/linux/i386/paccept.S135
-rw-r--r--libc/sysdeps/unix/sysv/linux/ifaddrs.c22
-rw-r--r--libc/sysdeps/unix/sysv/linux/kernel-features.h21
-rw-r--r--libc/sysdeps/unix/sysv/linux/opensock.c41
-rw-r--r--libc/sysdeps/unix/sysv/linux/paccept.c54
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/bits/mathinline.h132
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/bits/mman.h3
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/bits/utmp.h125
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/bits/utmpx.h104
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/Makefile5
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/Versions23
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/getutent.c29
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/getutent_r.c35
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/getutid.c29
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/getutid_r.c32
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/getutline.c29
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/getutline_r.c31
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/getutmp.c38
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/getutxent.c31
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/getutxid.c31
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/getutxline.c31
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/login.c36
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/login32.c37
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/pututxline.c31
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/updwtmp.c29
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/updwtmpx.c31
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/utmp-compat.h22
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/utmp-convert.h17
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.c185
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.h53
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/utmpx-convert.h86
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.c140
-rw-r--r--libc/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.h52
-rw-r--r--libc/sysdeps/unix/sysv/linux/signalfd.c12
-rw-r--r--libc/sysdeps/unix/sysv/linux/socketcall.h6
-rw-r--r--libc/sysdeps/unix/sysv/linux/sparc/bits/socket.h393
-rw-r--r--libc/sysdeps/unix/sysv/linux/sparc/sys/epoll.h143
-rw-r--r--libc/sysdeps/unix/sysv/linux/sparc/sys/eventfd.h52
-rw-r--r--libc/sysdeps/unix/sysv/linux/sparc/sys/inotify.h105
-rw-r--r--libc/sysdeps/unix/sysv/linux/sparc/sys/signalfd.h66
-rw-r--r--libc/sysdeps/unix/sysv/linux/sparc/sys/timerfd.h60
-rw-r--r--libc/sysdeps/unix/sysv/linux/sys/epoll.h22
-rw-r--r--libc/sysdeps/unix/sysv/linux/sys/eventfd.h11
-rw-r--r--libc/sysdeps/unix/sysv/linux/sys/inotify.h15
-rw-r--r--libc/sysdeps/unix/sysv/linux/sys/signalfd.h8
-rw-r--r--libc/sysdeps/unix/sysv/linux/sys/timerfd.h10
-rw-r--r--libc/sysdeps/unix/sysv/linux/syscalls.list3
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86_64/bits/mman.h1
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86_64/sys/epoll.h14
-rw-r--r--libc/sysdeps/x86_64/fpu/s_expm1l.S7
-rw-r--r--libc/sysdeps/x86_64/memset.S868
171 files changed, 6500 insertions, 1517 deletions
diff --git a/libc/ChangeLog b/libc/ChangeLog
index 0ea85f907..203349fde 100644
--- a/libc/ChangeLog
+++ b/libc/ChangeLog
@@ -1,3 +1,532 @@
+2008-07-18 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * Makefile (check-data): Check data directory in add-ons.
+ * elf/Makefile (check-data): Likewise.
+
+2008-08-18 Roland McGrath <roland@redhat.com>
+
+ * configure.in (--with-cpu): Check compiler support for -march/-mcpu.
+ * configure: Regenerated.
+ * config.make.in (cflags-cpu): New substituted variable.
+ (with-cpu): Variable removed.
+ * Makeconfig (+cflags): Use $(cflags-cpu), not $(with-cpu).
+
+2008-08-14 Ryan S. Arnold <rsa@us.ibm.com>
+
+ [BZ #6845]
+ * sysdeps/powerpc/fpu/bits/mathinline.h (__signbitl): Copy new
+ __signbitl definition and __LONG_DOUBLE_128__ guard from:
+ * sysdeps/unix/sysv/linux/powerpc/bits/mathinline.h: Remove as
+ redundant. Functions which call floating point assembler operations
+ should go into a sysdeps powerpc/fpu directory.
+
+2008-08-15 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/x86_64/bits/mman.h: Define MAP_STACK.
+ * sysdeps/unix/sysv/linux/i386/bits/mman.h: Likewise.
+
+2008-08-14 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/x86_64/memset.S: Reduce size of tables for PIC.
+
+ * sysdeps/unix/sysv/linux/dl-origin.c (_dl_get_origin): Undo all
+ change related to AT_EXECFN. We cannot use that string.
+ * sysdeps/generic/ldsodefs.h (struct rtld_global_ro): Remove
+ _dl_execfn member.
+ * elf/dl-support.c: Remove _dl_execfn variable.
+ (_dl_aux_init): Remove handling of AT_EXECFN.
+ * elf/dl-sysdep.c (_dl_sysdep_start): Remove handling of AT_EXECFN.
+ * elf/rtld.c (process_envvars): Remove use of __ASSUME_AT_EXECFN.
+
+2008-08-13 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #6544]
+ * libio/fmemopen.c: Implement binary mode. In this mode no NUL
+ byte gets added to writes and seeks from the end use the length of
+ the buffer and not the currently terminating NUL byte.
+
+ [BZ #6634]
+ * login/utmp_file.c (getutent_r_file): Take additional parameter.
+ Set to true if locking failed.
+ (getutid_r_file): Adjust caller.
+ (pututline_file): Likewise. Return NULL in this case.
+ Patch mostly by halesh.s@gmail.com.
+
+2008-08-12 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #6589]
+ * sysdeps/unix/sysv/linux/ifaddrs.c (struct sockaddr_ll_max):
+ Define.
+ (struct ifaddrs_storage): Use it instead of sockaddr_ll.
+
+2008-08-12 Ryan S. Arnold <rsa@us.ibm.com>
+
+ [BZ #6839]
+ * sysdeps/powerpc/powerpc32/dl-machine.c (CHECK_STATIC_TLS): Remove
+ macro since it is now available in elf/dynamic-link.h.
+
+2008-08-12 Roland McGrath <roland@frob.com>
+
+ * hurd/hurd/signal.h (HURD_MSGPORT_RPC): Avoid -Wparenthesis triggers,
+ in case used outside of libc.
+ Reported by Samuel Thibault <samuel.thibault@ens-lyon.org>
+
+2008-08-11 Ulrich Drepper <drepper@redhat.com>
+
+ * resolv/res_mkquery.c (res_nmkquery): Call ns_name_compress
+ directly instead of going through dn_comp.
+
+2008-08-11 Aurelien Jarno <aurel32@debian.org>
+
+ * sysdeps/mach/i386/machine-lock.h (__spin_unlock, __spin_try_lock):
+ Fix asm constraints.
+
+2008-08-07 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #6790]
+ * sysdeps/unix/sysv/linux/bits/in.h (IP_PMTUDISC_PROBE): Define.
+ (IPV6_PMTUDISC_PROBE): Likewise.
+
+2008-08-07 Pete Eberlein <eberlein@us.ibm.com>
+
+ [BZ #6791]
+ * sysdeps/unix/sysv/linux/powerpc/bits/mman.h (PROT_SAO): Define.
+
+2008-08-01 Steven Munroe <sjmunroe@us.ibm.com>
+ Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>
+
+ [BZ #6817]
+ * sysdeps/powerpc/dl-procinfo.c (_dl_powerpc_cap_flags):
+ Added the members 'vsx' and 'arch_2_06'.
+ (_dl_powerpc_platforms): Add the member 'power7'.
+ * sysdeps/powerpc/dl-procinfo.h: Modify _DL_HWCAP_FIRST
+ to reflect the changes required by VSX and ISA 2.06.
+ Modify _DL_PLATFORMS_COUNT to reflect the addition of
+ 'power7'.
+ Defined PPC_PLATFORM_POWER7.
+ (_dl_string_platform): Add support for POWER7.
+ * sysdeps/powerpc/sysdep.h: Define bit masks for VSX
+ capability and ISA 2.06.
+
+2008-08-07 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #6824]
+ * sysdeps/unix/sysv/linux/powerpc/bits/mathinline.h: Use correct
+ macro to detect use of 128 bit long double.
+ Patch by Ryan S. Arnold <rsa@us.ibm.com>.
+
+2008-08-05 Ulrich Drepper <drepper@redhat.com>
+
+ * scripts/gen-as-const.awk: Use 32-bit values on 32-bit platforms.
+
+ [BZ #5794]
+ * sysdeps/i386/fpu/s_expm1l.S: Simply use exp implementation for large
+ parameters.
+ * sysdeps/x86_64/fpu/s_expm1l.S: Likewise.
+ Patch by Denys Vlasenko <dvlasenk@redhat.com>.
+
+2008-08-03 Ulrich Drepper <drepper@redhat.com>
+
+ * nscd/connections.c (main_loop_poll): Pass a buffer which is
+ guaranteed to be large enough to read inotify event. Ignore
+ EAGAIN error. Better error message. Add branch predicition.
+ (main_loop_epoll): Likewise.
+
+2008-08-02 Roland McGrath <roland@frob.com>
+
+ * sysdeps/mach/i386/machine-lock.h (__spin_unlock, __spin_try_lock):
+ Add memory clobbers.
+
+2008-08-02 Ulrich Drepper <drepper@redhat.com>
+
+ * manual/arith.texi: Avoid @strong{Note:}.
+ * manual/creature.texi: Likewise.
+ * manual/filesys.texi: Likewise.
+ * manual/math.texi: Likewise.
+ * manual/memory.texi: Likewise.
+ * manual/resource.texi: Likewise.
+ * manual/syslog.texi: Likewise.
+ * manual/time.texi: Likewise.
+
+ * sysdeps/posix/clock_getres.c (hp_timing_getres): Remove inline
+ to prevent warning.
+
+2008-08-01 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/Versions: Fix changes due to old patch for
+ new epoll_create1 interface.
+ * sysdeps/unix/sysv/linux/syscalls.list: Likewise.
+ * sysdeps/unix/sysv/linux/sys/epoll.h: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/sys/epoll.h: Likewise.
+
+ * include/arpa/nameser.h (NS_GET16): Use const pointer.
+ (NS_GET32): Likewise.
+
+ * sysdeps/unix/sysv/linux/kernel-features.h: s390 has the new
+ syscalls, too.
+
+ * sysdeps/unix/sysv/linux/dl-origin.c (_dl_get_origin): We cannot
+ use the AT_EXECFN value if it is no absolute path.
+ * sysdeps/unix/sysv/linux/kernel-features.h: Never define
+ __ASSUME_AT_EXECFN.
+
+ * Versions.def: Add GLIBC_2.9 to libresolv.
+ * include/resolv.h: Remove hidden proto declarations for __ns_*
+ functions. Add them for __dn_count_labels and __p_secstodate.
+ * include/arpa/nameser.h: Add a number of hidden proto declarations.
+ Define ns_msg_getflags macro here.
+ * resolv/res_debug.c: Add hidden definition for __dn_count_labels
+ and __p_secstodate.
+ * resolv/Versions: Export functions from <arpa/nameser.h> from
+ libresolv in version GLIBC_2.9.
+ * resolv/ns_name.c: Integrate changes from bind 9.5.0. Add necessary
+ hidden definitions.
+ * resolv/ns_netint.c: Likewise.
+ * resolv/ns_parse.c: Likewise.
+ * resolv/ns_print.c: Likewise.
+ * resolv/ns_samedomain.c: Likewise.
+ * resolv/ns_ttl.c: Likewise.
+ * resolv/arpa/nameser_compat.h: Likewise.
+ * resolv/arpa/nameser.h: Likewise. Remove macros which redirect
+ function calls.
+ * resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Use __ns_get16
+ instead of ns_get16.
+ * resolv/nss_dns/dns-host.c (getanswer_r): Use __ns_get16 and
+ __ns_get32 instead of ns_get16 and ns_get32 respectively.
+ (gaih_getanswer_slice): Likewise.
+ * resolv/Makefile (libresolv-routines): Add ns_date.
+ * resolv/ns_date.c: New file.
+
+ * elf/Makefile (check-localplt.out): Also check libresolv and
+ libcrypt.
+
+2008-07-31 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/kernel-features.h: Define
+ __ASSUME_O_CLOEXEC.
+
+2008-07-30 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/posix/getaddrinfo.c (gaih_inet): Raise size of initial
+ buffer passed to NSS functions.
+
+ * nscd/connections.c (nscd_init): Typo in preprocessor directive.
+
+ * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_PACCEPT):
+ Define.
+
+ * misc/syslog.c (openlog_internal): Fix compile problem.
+
+2008-07-28 Roland McGrath <roland@redhat.com>
+
+ * elf/dl-sysdep.c (_dl_show_auxv): Add AT_EXECFN to the table.
+
+2008-07-28 Ulrich Drepper <drepper@redhat.com>
+
+ * io/ftw.c (add_object): Remove inline to avoid warning.
+
+ * sysdeps/unix/sysv/linux/paccept.c: Fix compile problem.
+
+ * resolv/res_send.c (__libc_res_nsend): Take additional parameter.
+ Use it instead of locally defined resplen2 variable.
+ (res_nsend): Adjust for __libc_res_nsend interface change.
+ (send_vc): Initialize *resplen2 if necessary. Read length of
+ package into an appropriately aligned variable. Store converted length
+ in new variable and use it appropriately.
+ Add branch prediction help.
+ * resolv/res_query.c (__libc_res_nquery): Take additional parameter
+ and pass it on to __libc_res_nsend. Adjust all callers.
+ (__libc_res_nsearch): Likewise.
+ (__libc_res_nqeurydomain): Likewise.
+ * resolv/nss_dns/dns-host.c: Adjust for __libc_res_nsearch interface
+ change.
+ (_nss_dns_gethostbyname4): Don't unconditionally allocate tmp array.
+ Define resplen2 variable and pass it to __libc_res_nsearch and then
+ to gaih_getanswer.
+ (getanswer_r): In case of incorrect DNS data don't overread buffer.
+ Add branch prediction.
+ (gaih_getanswer_slice): Likewise. Check for invalid data types.
+ (gaih_getanswer): Don't decode second slice if first one failed due
+ to a too small buffer. Don't let not found status of second
+ decoder shadow results of the first.
+ * resolv/gethnamaddr.c (gethostbyname2): Adjust for __libc_res_nsearch
+ and __libc_res_nquery interface changes
+ (gethostbyaddr): Adjust for __libc_res_nquery interface change.
+ * include/resolv.h: Adjust prototypes for __libc_res_nquery,
+ __libc_res_nsearch, and __libc_res_nsend.
+ * resolv/nss_dns/dns-canon.c: Adjust for __libc_res_nquery interface
+ change.
+ * resolv/nss_dns/dns-network.c: Adjust for __libc_res_nquery and
+ __libc_res_nsearch interface changes.
+
+2008-07-27 Ulrich Drepper <drepper@redhat.com>
+
+ * libio/iopopen.c (_IO_new_proc_open): Remove unnecessary volatile.
+
+ * posix/wordexp.c (exec_comm): Use pipe2 if possible to create
+ file descriptors with close-on-exec set.
+ (exec_comm_child): Fix the case where the write end of the pipe is
+ STDOUT_FILENO already. In case it is, clear close-on-exec.
+
+ * sysdeps/unix/sysv/linux/syscalls.list: Add __pipe2 alias.
+ * io/pipe2.c: Likewise.
+ * sysdeps/unix/sysv/linux/kernel-features.h: Define __ASSUME_PIPE2
+ instead of __ASSUME_PACCEPT.
+ * include/unistd.h: Declare __have_pipe2.
+ * libio/iopopen.c: Implement "e" flag.
+ * libio/Makefile (tests): Add tst-popen1.
+ * libio/tst-popen1.c: New file.
+
+ * sysdeps/unix/sysv/linux/bits/socket.h: Define PF_ISDN and AF_ISDN.
+ * sysdeps/unix/sysv/linux/sparc/bits/socket.h: Likewise.
+
+2008-07-26 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #6771]
+ * libio/fileops.c (_IO_new_file_attach): Preserve errno around
+ success call of _IO_SEEKOFF or calls which failed because the
+ descriptor is for a pipe.
+
+ * sunrpc/key_call.c (getkeyserv_handle): Use FD_CLOEXEC instead of
+ magic number.
+
+ * misc/syslog.c (openlog_internal): Use SOCK_CLOEXEC if possible.
+
+ * malloc/mtrace.c (mtrace): Use 'e' flag in fopen call. Drop
+ F_SETFD use if we know fopen set the flag.
+
+ * login/utmp_file.c (setutent_file): Minor optimization in case
+ O_CLOEXEC is available.
+
+2008-07-24 Tom "spot" Callaway <tcallawa@redhat.com>
+
+ * Makeconfig: Define pie-ccflag and PIE-ccflag variables.
+ * elf/Makefile: Use pie-ccflag variable.
+ * nscd/Makefile: Likewise.
+ * sysdeps/sparc/Makefile: Set $(pie-ccflag) to -fPIE.
+
+2008-07-21 Andreas Krebbel <krebbel1@de.ibm.com>
+
+ [BZ #6724]
+ * Versions.def: Add GLIBC_2.9 version tag for libutil.
+ * sysdeps/unix/sysv/linux/s390/bits/utmp.h: Copy of
+ gnu/bits/utmp.h. Check for __WORDSIZE_COMPAT32 removed.
+ * sysdeps/unix/sysv/linux/s390/bits/utmpx.h: Copy of
+ gnu/bits/utmpx.h. Check for __WORDSIZE_COMPAT32 removed.
+ * sysdeps/unix/sysv/linux/s390/s390-32/Makefile: Add new files
+ utmp32, utmpx32 and login32.
+ * sysdeps/unix/sysv/linux/s390/s390-32/Versions: Add 2.9
+ versions of struct utmp functions to libc and libutil.
+ * sysdeps/unix/sysv/linux/s390/s390-32/utmp-compat.h: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/getutent.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/getutent_r.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/getutid.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/getutid_r.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/getutline.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/getutline_r.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/getutmp.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/getutxent.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/getutxid.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/getutxline.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/login.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/login32.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/pututxline.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/updwtmp.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/updwtmpx.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/utmp-convert.h: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/utmp32.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/utmp32.h: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/utmpx-convert.h: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.h: New file.
+
+2008-07-26 Ulrich Drepper <drepper@redhat.com>
+
+ * scripts/gen-as-const.awk: Generate more widely usable code by
+ using 64-bit arithmetic.
+
+ * stdio-common/printf_fp.c (___printf_fp): Give wide outout code
+ the same treatment as narrow output code in last patch.
+
+ * sunrpc/clnt_udp.c (__libc_clntudp_bufcreate): Namespace cleanup.
+
+ [BZ #6763]
+ * elf/dl-load.c (local_strdup): Remove inline.
+ (_dl_map_object_from_fd): Don't allocate l_symbolic_searchlist.r_list.
+ * elf/dl-object.c (_dl_new_object): Allocate symbolic searchlist as
+ part of the object.
+
+ * sysdeps/unix/sysv/linux/dl-origin.c: Add const to avoid warning.
+
+2008-07-25 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/kernel-features.h: IA-64 and SPARC have
+ the new syscalls, too.
+
+ * sysdeps/i386/i686/memcmp.S: Fix unwind information.
+ Reported by Paul Pluzhnikov <ppluzhnikov@google.com>.
+
+ [BZ #6698]
+ * stdio-common/_i18n_number.h (_i18n_number_rewrite): Take additional
+ parameter for end of buffer. If temporary copy is too large use
+ malloc.
+ * stdio-common/vfprintf.c: Adjust for _i18n_number_rewrite
+ interface change.
+ * stdio-common/printf_fp.c (__printf_fp): Likewise.. Account for
+ string rewrite when allocating buffer.
+
+ * sysdeps/unix/sysv/linux/kernel-features.h: PPC has the new
+ syscalls, too.
+
+ * nscd/connections.c (nscd_init): Clean up fcntl call.
+
+ * nscd/nscd_helper.c (open_socket): Use SOCK_CLOEXEC and
+ SOCK_NONBLOCK if possible.
+
+ * sysdeps/unix/sysv/linux/opensock.c (__opensock): Use
+ SOCK_CLOEXEC if available.
+
+ * include/rpc/clnt.h: Declare __libc_clntudp_bufcreate and
+ __libc_clntudp_bufcreate_internal.
+ * include/sys/socket.h: Declare __have_sock_cloexec.
+ * socket/Makefile (aux): Add have_sock_cloexec.
+ * socket/have_sock_cloexec.c: New file.
+ * sunrpc/clnt_udp.h (clntudp_bufcreate): Now a wrapper around
+ __libc_clntudp_bufcreate.
+ (__libc_clntudp_bufcreate): Former implementation of clntudp_bufcreate
+ which takes an additional parameter. Create socket with non-blocking
+ mode and close-on-exec flag set, if wanted.
+ * sunrpc/Versions: Export __libc_clntudp_bufcreate@GLIBC_PRIVATE.
+ * nis/ypclnt.c (yp_bind_client_create): Use __libc_clntpudp_bufcreate
+ instead of clntudp_create. The socket has already the close-on-exec
+ flag set if SOCK_CLOEXEC is defined.
+
+2008-07-24 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/kernel-features.h: Define
+ __ASSUME_PACCEPT, __ASSUME_IN_NONBLOCK, and __ASSUME_PACCEPT if
+ appropriate.
+ * nscd/connections.c: Avoid fcntl calls to set close-on-exec flag and
+ non-blocking mode by using socket, paccept, and inotify_init1.
+
+ * Versions.def (glibc): Add GLIBC_2.9.
+ * io/Makefile (routines): Add dup3 and pipe2.
+ * io/Versions [glibc] (GLIBC_2.9): Add dup3 and pipe2.
+ * io/dup3.c: New file.
+ * io/pipe2.c: New file.
+ * posix/unistd.h: Declare dup3 and pipe2.
+ * socket/Makefile (routines): Add paccept.
+ * socket/Versions [glibc] (GLIBC_2.9): Add paccept.
+ * socket/paccept.c: New file.
+ * socket/sys/socket.h: Declare paccept.
+ * sysdeps/unix/syscalls.list: Add entry for dup3.
+ * sysdeps/unix/sysv/linux/Versions [glibc] (GLIBC_2.9): Add
+ epoll_create2 and inotify_init1.
+ * sysdeps/unix/sysv/linux/eventfd.c: Use eventfd1 syscall if possible.
+ * sysdeps/unix/sysv/linux/paccept.c: New file.
+ * sysdeps/unix/sysv/linux/signalfd.c: Use signalfd4 syscall if
+ possible.
+ * sysdeps/unix/sysv/linux/socketcall.h: Add SOCKOP_paccept.
+ * sysdeps/unix/sysv/linux/syscalls.list: Add epoll_create2,
+ inotify_init1, and pipe2 entries.
+ * sysdeps/unix/sysv/linux/alpha/sys/epoll.h: New file.
+ * sysdeps/unix/sysv/linux/alpha/sys/eventfd.h: New file.
+ * sysdeps/unix/sysv/linux/alpha/sys/inotify.h: New file.
+ * sysdeps/unix/sysv/linux/alpha/sys/signalfd.h: New file.
+ * sysdeps/unix/sysv/linux/alpha/sys/timerfd.h: New file.
+ * sysdeps/unix/sysv/linux/bits/socket.h: Define SOCK_CLOEXEC and
+ SOCK_NONBLOCK.
+ * sysdeps/unix/sysv/linux/i386/paccept.S: New file.
+ * sysdeps/unix/sysv/linux/sparc/sys/epoll.h: New file.
+ * sysdeps/unix/sysv/linux/sparc/sys/eventfd.h: New file.
+ * sysdeps/unix/sysv/linux/sparc/sys/inotify.h: New file.
+ * sysdeps/unix/sysv/linux/sparc/sys/signalfd.h: New file.
+ * sysdeps/unix/sysv/linux/sparc/sys/timerfd.h: New file.
+ * sysdeps/unix/sysv/linux/sparc/bits/socket.h: New file.
+ * sysdeps/unix/sysv/linux/sys/epoll.h: Define EPOLL_CLOEXEC and
+ EPOLL_NONBLOCK. Declare epoll_create2.
+ * sysdeps/unix/sysv/linux/sys/eventfd.h: Define EFD_CLOEXEC and
+ EFD_NONBLOCK.
+ * sysdeps/unix/sysv/linux/sys/inotify.h: Define IN_CLOEXEC and
+ IN_NONBLOCK. Declare inotify_init1.
+ * sysdeps/unix/sysv/linux/sys/signalfd.h: Define SFD_CLOEXEC and
+ SFD_NONBLOCK.
+ * sysdeps/unix/sysv/linux/sys/timerfd.h: Define TFD_CLOEXEC and
+ TFD_NONBLOCK.
+
+ * elf/elf.h: Define AT_EXECFN.
+ * elf/rtld.c [!__ASSUME_AT_EXECFN] (process_envvars): Don't handle
+ LD_ORIGIN_PATH.
+ * elf/dl-sysdep.c (_dl_sysdep_start): Handle AT_EXECFN.
+ * elf/dl-support.c: Define _dl_execfn. Don't define _dl_origin_path
+ if __ASSUME_AT_EXECFN is defined.
+ (_dl_aux_init): Handle AT_EXECFN.
+ * sysdeps/unix/sysv/linux/kernel-features.h: Define __ASSUME_AT_EXECFN
+ for 2.6.27 and up.
+ * sysdeps/generic/ldsodefs.h (rtld_global_ro): Add _dl_execfn.
+ Don't define _dl_origin_path if __ASSUME_AT_EXECFN is defined.
+ * sysdeps/unix/sysv/linux/dl-origin.c (_dl_get_origin): Use
+ _dl_execfn if available and avoid compatibility code if
+ __ASSUME_AT_EXECFN is defined.
+
+ * sysdeps/unix/sysv/linux/dl-sysdep.h: Don't declare
+ _dl_discover_osversion only for older kernels.
+
+2008-07-22 Roland McGrath <roland@frob.com>
+
+ * hurd/fd-read.c (_hurd_fd_read): Fix last change.
+
+2008-07-21 Roland McGrath <roland@frob.com>
+
+ * hurd/fd-read.c (_hurd_fd_read): Return EGRATUITOUS if the server
+ returned too much data out of line.
+
+2008-07-20 Ulrich Drepper <drepper@redhat.com>
+
+ * locale/setlocale.c (setname): Remove inline to avoid compiler
+ warning.
+
+ [BZ #6712]
+ * locale/setlocale.c (setlocale): Take the setlocale lock earlier.
+
+2008-07-15 Ulrich Drepper <drepper@redhat.com>
+
+ * stdio-common/vfprintf.c (_IO_helper_overflow): In case _IO_sputn
+ doesn't manage to write anything, fail.
+
+ * malloc/hooks.c (__malloc_check_init): Remove printf.
+
+2008-07-14 Samuel Thibault <samuel.thibault@ens-lyon.org>
+
+ * sysdeps/mach/hurd/bits/fcntl.h: Include <sys/types.h>.
+
+2008-07-12 Ulrich Drepper <drepper@redhat.com>
+
+ * nscd/connections.c (main_loop_poll): Fix handling of read errors
+ from inotify.
+ (main_loop_epoll): Likewise.
+
+2008-07-09 Ulrich Drepper <drepper@redhat.com>
+
+ * resolv/res_send.c: Remove unnecessary res_pquery prototype.
+
+ * resolv/res_query.c (__libc_res_nquery): Issue debug message only
+ if DEBUG is defined.
+
+ * resolv/res_query.c (__libc_res_nquery): Align buffer for T_AAAA
+ query. Adjust buffer size computation for padding.
+
+2008-07-08 Ulrich Drepper <drepper@redhat.com>
+
+ * stdio-common/Makefile: Add rules to build and run tst-setvbuf1.
+ * stdio-common/tst-setvbuf1.c: New file.
+ * stdio-common/tst-setvbuf1.expect: New file.
+
+ [BZ #6719]
+ * libio/iosetvbuf.c (_IO_setvbuf): Correctly clear buffering flags
+ when selecting fully-buffered stream.
+ Patch by Wang Xin <wxinee@gmail.com>.
+
2008-07-06 Samuel Thibault <samuel.thibault@ens-lyon.org>
* sysdeps/mach/hurd/open.c: Include <stdio.h>.
diff --git a/libc/Makeconfig b/libc/Makeconfig
index 913601f02..4dca7a0a4 100644
--- a/libc/Makeconfig
+++ b/libc/Makeconfig
@@ -651,7 +651,7 @@ ifeq "$(strip $(+cflags))" ""
+cflags := $(default_cflags)
endif # $(+cflags) == ""
-+cflags += $(addprefix -mcpu=,$(with-cpu)) $(+gccwarn) $(+merge-constants)
++cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants)
+gcc-nowarn := -w
# Don't duplicate options if we inherited variables from the parent.
@@ -720,6 +720,10 @@ pic-ccflag = -fPIC
# This one should always stay like this unless there is a very good reason.
PIC-ccflag = -fPIC
endif
+# This can be changed by a sysdep makefile
+pie-ccflag = -fpie
+# This one should always stay like this unless there is a very good reason.
+PIE-ccflag = -fPIE
ifeq (yes,$(build-profile))
# Under --enable-profile, we will build a static library of profiled objects.
# The profiled object files are named foo.op.
diff --git a/libc/Makefile b/libc/Makefile
index c2498a13b..b6c499d22 100644
--- a/libc/Makefile
+++ b/libc/Makefile
@@ -267,8 +267,8 @@ tests-clean:
tests: $(objpfx)c++-types-check.out $(objpfx)check-local-headers.out
ifneq ($(CXX),no)
check-data := $(firstword $(wildcard \
- $(foreach D,$(add-ons) scripts/data,\
- $(patsubst %,$D/c++-types-%.data,\
+ $(foreach D,$(add-ons) scripts,\
+ $(patsubst %,$D/data/c++-types-%.data,\
$(abi-name) \
$(addsuffix -$(config-os),\
$(config-machine) \
diff --git a/libc/NEWS b/libc/NEWS
index eebc6b834..c3ceaba42 100644
--- a/libc/NEWS
+++ b/libc/NEWS
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes. 2008-5-14
+GNU C Library NEWS -- history of user-visible changes. 2008-8-2
Copyright (C) 1992-2007, 2008 Free Software Foundation, Inc.
See the end for copying conditions.
@@ -22,10 +22,26 @@ Version 2.9
* New implementation of memmem, strstr, and strcasestr which is O(n).
Implemented by Eric Blake.
+
+* New Linux interfaces: inotify_init1, paccept, dup3, epoll_create1, pipe2
+
+* Implement "e" option for popen to open file descriptor with the
+ close-on-exec flag set. Implemented by Ulrich Drepper.
+
+* Implement "b" mode for fmemopen. In this mode writes writes don't
+ implicitly add a NUL byte and seeks from the end of the buffer really
+ use the buffer end, not the string length as the basis.
+ Implemented by Ulrich Drepper.
+
+* Many functions, exported and internal, now atomically set the close-on-exec
+ flag when run on a sufficiently new kernel. Implemented by Ulrich Drepper.
+
+* Sorting rules for some Indian languages (Kannada, Gurumukhi, Telugu)
+ Implemented by Pravin Satpute.
Version 2.8
-* New locales: bo_CN, bo_IN.
+* New locales: bo_CN, bo_IN, shs_CA.
* New encoding: HP-ROMAN9, HP-GREEK8, HP-THAI8, HP-TURKISH8.
diff --git a/libc/Versions.def b/libc/Versions.def
index 0de15f8f7..856d87806 100644
--- a/libc/Versions.def
+++ b/libc/Versions.def
@@ -25,6 +25,7 @@ libc {
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
+ GLIBC_2.9
%ifdef USE_IN_LIBIO
HURD_CTHREADS_0.3
%endif
@@ -92,6 +93,7 @@ libresolv {
GLIBC_2.0
GLIBC_2.2
GLIBC_2.3.2
+ GLIBC_2.9
GLIBC_PRIVATE
}
librt {
@@ -105,6 +107,7 @@ librt {
}
libutil {
GLIBC_2.0
+ GLIBC_2.9
}
ld {
GLIBC_2.0
diff --git a/libc/config.make.in b/libc/config.make.in
index 2d6c85b33..66e3ca329 100644
--- a/libc/config.make.in
+++ b/libc/config.make.in
@@ -31,7 +31,7 @@ base-machine = @base_machine@
config-vendor = @host_vendor@
config-os = @host_os@
config-sysdirs = @sysnames@
-with-cpu = @submachine@
+cflags-cpu = @libc_cv_cc_submachine@
defines = @DEFINES@
sysincludes = @SYSINCLUDES@
diff --git a/libc/configure b/libc/configure
index 0f08d121b..97f6e0159 100755
--- a/libc/configure
+++ b/libc/configure
@@ -313,7 +313,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons add_on_subdirs base_machine submachine sysnames sysdeps_add_ons INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR NM OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES CXX_SYSINCLUDES libc_cv_gcc_static_libgcc BASH_SHELL libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_cc_with_libunwind libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie libc_cv_hashstyle fno_unit_at_a_time libc_cv_ssp libc_cv_gnu89_inline libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_libcap have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons add_on_subdirs base_machine submachine sysnames sysdeps_add_ons INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR NM OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES CXX_SYSINCLUDES libc_cv_gcc_static_libgcc BASH_SHELL libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_cc_with_libunwind libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie libc_cv_hashstyle fno_unit_at_a_time libc_cv_ssp libc_cv_gnu89_inline libc_cv_have_initfini no_whole_archive exceptions libc_cv_cc_submachine LIBGD have_libaudit have_libcap have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -1821,7 +1821,6 @@ echo "$as_me: error: --with-cpu requires an argument" >&2;}
fi;
-
# An add-on can set this when it wants to disable the sanity check below.
libc_config_ok=no
@@ -6583,6 +6582,35 @@ _ACEOF
fi
fi
+if test -n "$submachine"; then
+ echo "$as_me:$LINENO: checking for compiler option for CPU variant" >&5
+echo $ECHO_N "checking for compiler option for CPU variant... $ECHO_C" >&6
+if test "${libc_cv_cc_submachine+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ libc_cv_cc_submachine=no
+ for opt in "-march=$submachine" "-mcpu=$submachine"; do
+ if { ac_try='${CC-cc} $opt -xc /dev/null -S -o /dev/null'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ libc_cv_cc_submachine="$opt"
+ break
+ fi
+ done
+fi
+echo "$as_me:$LINENO: result: $libc_cv_cc_submachine" >&5
+echo "${ECHO_T}$libc_cv_cc_submachine" >&6
+ if test "x$libc_cv_cc_submachine" = xno; then
+ { { echo "$as_me:$LINENO: error: ${CC-cc} does not support $submachine" >&5
+echo "$as_me: error: ${CC-cc} does not support $submachine" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+fi
+
+
echo "$as_me:$LINENO: checking for libgd" >&5
echo $ECHO_N "checking for libgd... $ECHO_C" >&6
if test "$with_gd" != "no"; then
@@ -8543,6 +8571,7 @@ s,@libc_cv_gnu89_inline@,$libc_cv_gnu89_inline,;t t
s,@libc_cv_have_initfini@,$libc_cv_have_initfini,;t t
s,@no_whole_archive@,$no_whole_archive,;t t
s,@exceptions@,$exceptions,;t t
+s,@libc_cv_cc_submachine@,$libc_cv_cc_submachine,;t t
s,@LIBGD@,$LIBGD,;t t
s,@have_libaudit@,$have_libaudit,;t t
s,@have_libcap@,$have_libcap,;t t
diff --git a/libc/configure.in b/libc/configure.in
index 4af921126..4225dcef0 100644
--- a/libc/configure.in
+++ b/libc/configure.in
@@ -326,7 +326,6 @@ AC_ARG_WITH([cpu],
esac
])
-
# An add-on can set this when it wants to disable the sanity check below.
libc_config_ok=no
@@ -1967,6 +1966,22 @@ EOF
fi
fi
+if test -n "$submachine"; then
+ AC_CACHE_CHECK([for compiler option for CPU variant],
+ libc_cv_cc_submachine, [dnl
+ libc_cv_cc_submachine=no
+ for opt in "-march=$submachine" "-mcpu=$submachine"; do
+ if AC_TRY_COMMAND([${CC-cc} $opt -xc /dev/null -S -o /dev/null]); then
+ libc_cv_cc_submachine="$opt"
+ break
+ fi
+ done])
+ if test "x$libc_cv_cc_submachine" = xno; then
+ AC_MSG_ERROR([${CC-cc} does not support $submachine])
+ fi
+fi
+AC_SUBST(libc_cv_cc_submachine)
+
dnl Check whether we have the gd library available.
AC_MSG_CHECKING(for libgd)
if test "$with_gd" != "no"; then
diff --git a/libc/elf/Makefile b/libc/elf/Makefile
index e4f693f0e..16c752f26 100644
--- a/libc/elf/Makefile
+++ b/libc/elf/Makefile
@@ -805,7 +805,7 @@ $(objpfx)tst-array5-static.out: $(objpfx)tst-array5-static
cmp $@ tst-array5-static.exp > /dev/null
ifeq (yesyes,$(have-fpie)$(build-shared))
-CFLAGS-tst-pie1.c += -fpie
+CFLAGS-tst-pie1.c += $(pie-ccflag)
$(objpfx)tst-pie1.out: $(objpfx)tst-pie1
$(cross-test-wrapper) \
@@ -847,8 +847,8 @@ $(objpfx)tst-dlmodcount: $(libdl)
$(objpfx)tst-dlmodcount.out: $(test-modules)
check-data := $(firstword $(wildcard \
- $(foreach D,$(add-ons) scripts/data,\
- $(patsubst %,$(..)$D/localplt-%.data,\
+ $(foreach D,$(add-ons) scripts,\
+ $(patsubst %,$(..)$D/data/localplt-%.data,\
$(abi-name) \
$(addsuffix -$(config-os),\
$(config-machine) \
@@ -866,6 +866,8 @@ $(objpfx)check-localplt.out: $(objpfx)check-localplt \
$(common-objpfx)math/libm.so $(thread-dso) \
$(common-objpfx)rt/librt.so \
$(common-objpfx)dlfcn/libdl.so \
+ $(common-objpfx)resolv/libresolv.so \
+ $(common-objpfx)crypt/libcrypt.so \
$(check-data)
$(dir $<)$(notdir $<) $(filter-out $< $(check-data),$^) | \
LC_ALL=C sort | \
diff --git a/libc/elf/dl-load.c b/libc/elf/dl-load.c
index 94531b271..8a8936f7b 100644
--- a/libc/elf/dl-load.c
+++ b/libc/elf/dl-load.c
@@ -163,7 +163,7 @@ static const size_t system_dirs_len[] =
/* Local version of `strdup' function. */
-static inline char *
+static char *
local_strdup (const char *s)
{
size_t len = strlen (s) + 1;
@@ -1470,15 +1470,6 @@ cannot enable executable stack as shared object requires");
{
/* Create an appropriate searchlist. It contains only this map.
This is the definition of DT_SYMBOLIC in SysVr4. */
- l->l_symbolic_searchlist.r_list =
- (struct link_map **) malloc (sizeof (struct link_map *));
-
- if (l->l_symbolic_searchlist.r_list == NULL)
- {
- errstring = N_("cannot create searchlist");
- goto call_lose_errno;
- }
-
l->l_symbolic_searchlist.r_list[0] = l;
l->l_symbolic_searchlist.r_nlist = 1;
diff --git a/libc/elf/dl-object.c b/libc/elf/dl-object.c
index 0e45aea39..be4ea38f9 100644
--- a/libc/elf/dl-object.c
+++ b/libc/elf/dl-object.c
@@ -1,5 +1,5 @@
/* Storage management for the chain of loaded shared objects.
- Copyright (C) 1995-2002, 2004, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1995-2002,2004,2006,2007,2008 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
@@ -50,13 +50,17 @@ _dl_new_object (char *realname, const char *libname, int type,
#endif
new = (struct link_map *) calloc (sizeof (*new) + audit_space
+ + sizeof (struct link_map *)
+ sizeof (*newname) + libname_len, 1);
if (new == NULL)
return NULL;
new->l_real = new;
- new->l_libname = newname = (struct libname_list *) ((char *) (new + 1)
- + audit_space);
+ new->l_symbolic_searchlist.r_list = (struct link_map **) ((char *) (new + 1)
+ + audit_space);
+
+ new->l_libname = newname
+ = (struct libname_list *) (new->l_symbolic_searchlist.r_list + 1);
newname->name = (char *) memcpy (newname + 1, libname, libname_len);
/* newname->next = NULL; We use calloc therefore not necessary. */
newname->dont_free = 1;
diff --git a/libc/elf/dl-support.c b/libc/elf/dl-support.c
index 2c11ac688..6bd573ec5 100644
--- a/libc/elf/dl-support.c
+++ b/libc/elf/dl-support.c
@@ -1,5 +1,5 @@
/* Support for dynamic linking code in static libc.
- Copyright (C) 1996-2005, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1996-2005, 2006, 2007, 2008 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
diff --git a/libc/elf/dl-sysdep.c b/libc/elf/dl-sysdep.c
index dd55905e1..e6f4272a6 100644
--- a/libc/elf/dl-sysdep.c
+++ b/libc/elf/dl-sysdep.c
@@ -270,6 +270,7 @@ _dl_show_auxv (void)
} auxvars[] =
{
[AT_EXECFD - 2] = { "AT_EXECFD: ", dec },
+ [AT_EXECFN - 2] = { "AT_EXECFN: ", str },
[AT_PHDR - 2] = { "AT_PHDR: 0x", hex },
[AT_PHENT - 2] = { "AT_PHENT: ", dec },
[AT_PHNUM - 2] = { "AT_PHNUM: ", dec },
diff --git a/libc/elf/elf.h b/libc/elf/elf.h
index 269de527e..a4134462a 100644
--- a/libc/elf/elf.h
+++ b/libc/elf/elf.h
@@ -970,6 +970,8 @@ typedef struct
#define AT_SECURE 23 /* Boolean, was exec setuid-like? */
+#define AT_EXECFN 31 /* Filename of executable. */
+
/* Pointer to the global system page used for system calls and other
nice things. */
#define AT_SYSINFO 32
diff --git a/libc/hurd/fd-read.c b/libc/hurd/fd-read.c
index 388a4dbaf..38706524f 100644
--- a/libc/hurd/fd-read.c
+++ b/libc/hurd/fd-read.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993,94,95,97,99,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1993,94,95,97,99,2002,2008 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
@@ -41,6 +41,11 @@ _hurd_fd_read (struct hurd_fd *fd, void *buf, size_t *nbytes, loff_t offset)
if (data != buf)
{
+ if (nread > *nbytes) /* Sanity check for bogus server. */
+ {
+ __vm_deallocate (__mach_task_self (), (vm_address_t) data, nread);
+ return EGRATUITOUS;
+ }
memcpy (buf, data, nread);
__vm_deallocate (__mach_task_self (), (vm_address_t) data, nread);
}
diff --git a/libc/hurd/hurd/signal.h b/libc/hurd/hurd/signal.h
index 39fa0f857..d4bcaf26a 100644
--- a/libc/hurd/hurd/signal.h
+++ b/libc/hurd/hurd/signal.h
@@ -1,5 +1,6 @@
/* Implementing POSIX.1 signals under the Hurd.
- Copyright (C) 1993,94,95,96,98,99,2002,2007 Free Software Foundation, Inc.
+ Copyright (C) 1993,94,95,96,98,99,2002,2007,2008
+ 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
@@ -342,10 +343,12 @@ extern mach_msg_timeout_t _hurd_interrupted_rpc_timeout;
do \
{ \
/* Get the message port. */ \
- if (__err = (fetch_msgport_expr)) \
+ __err = (fetch_msgport_expr); \
+ if (__err) \
break; \
/* Get the reference port. */ \
- if (__err = (fetch_refport_expr)) \
+ _err = (fetch_refport_expr); \
+ if (__err) \
{ \
/* Couldn't get it; deallocate MSGPORT and fail. */ \
__mach_port_deallocate (__mach_task_self (), msgport); \
diff --git a/libc/include/arpa/nameser.h b/libc/include/arpa/nameser.h
index efbe95660..57f745784 100644
--- a/libc/include/arpa/nameser.h
+++ b/libc/include/arpa/nameser.h
@@ -1,3 +1,5 @@
+#ifndef _ARPA_NAMESER_H_
+
#include <resolv/arpa/nameser.h>
/* If the machine allows unaligned access we can do better than using
@@ -7,14 +9,14 @@
#include <stdint.h>
#include <netinet/in.h>
-extern struct _ns_flagdata _ns_flagdata[] attribute_hidden;
+extern const struct _ns_flagdata _ns_flagdata[] attribute_hidden;
#if _STRING_ARCH_unaligned
# undef NS_GET16
# define NS_GET16(s, cp) \
do { \
- uint16_t *t_cp = (uint16_t *) (cp); \
+ const uint16_t *t_cp = (const uint16_t *) (cp); \
(s) = ntohs (*t_cp); \
(cp) += NS_INT16SZ; \
} while (0)
@@ -22,7 +24,7 @@ extern struct _ns_flagdata _ns_flagdata[] attribute_hidden;
# undef NS_GET32
# define NS_GET32(l, cp) \
do { \
- uint32_t *t_cp = (uint32_t *) (cp); \
+ const uint32_t *t_cp = (const uint32_t *) (cp); \
(l) = ntohl (*t_cp); \
(cp) += NS_INT32SZ; \
} while (0)
@@ -44,3 +46,32 @@ extern struct _ns_flagdata _ns_flagdata[] attribute_hidden;
} while (0)
#endif
+
+extern u_int __ns_get16 (const u_char *) __THROW;
+extern u_long __ns_get32 (const u_char *) __THROW;
+
+#define ns_msg_getflag(handle, flag) \
+ (((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift)
+
+libresolv_hidden_proto (ns_get16)
+libresolv_hidden_proto (ns_get32)
+libresolv_hidden_proto (ns_put16)
+libresolv_hidden_proto (ns_put32)
+libresolv_hidden_proto (ns_initparse)
+libresolv_hidden_proto (ns_skiprr)
+libresolv_hidden_proto (ns_parserr)
+libresolv_hidden_proto (ns_name_ntop)
+libresolv_hidden_proto (ns_name_pton)
+libresolv_hidden_proto (ns_name_pack)
+libresolv_hidden_proto (ns_name_skip)
+libresolv_hidden_proto (ns_name_unpack)
+libresolv_hidden_proto (ns_name_compress)
+libresolv_hidden_proto (ns_name_uncompress)
+libresolv_hidden_proto (ns_sprintrr)
+libresolv_hidden_proto (ns_sprintrrf)
+libresolv_hidden_proto (ns_samedomain)
+libresolv_hidden_proto (ns_samename)
+libresolv_hidden_proto (ns_makecanon)
+libresolv_hidden_proto (ns_format_ttl)
+
+#endif
diff --git a/libc/include/resolv.h b/libc/include/resolv.h
index 925746f68..7ab7f8779 100644
--- a/libc/include/resolv.h
+++ b/libc/include/resolv.h
@@ -58,11 +58,11 @@ libc_hidden_proto (__res_randomid)
libc_hidden_proto (__res_state)
int __libc_res_nquery (res_state, const char *, int, int, u_char *, int,
- u_char **, u_char **, int *);
+ u_char **, u_char **, int *, int *);
int __libc_res_nsearch (res_state, const char *, int, int, u_char *, int,
- u_char **, u_char **, int *);
+ u_char **, u_char **, int *, int *);
int __libc_res_nsend (res_state, const u_char *, int, const u_char *, int,
- u_char *, int, u_char **, u_char **, int *)
+ u_char *, int, u_char **, u_char **, int *, int *)
attribute_hidden;
libresolv_hidden_proto (_sethtent)
@@ -98,11 +98,9 @@ libresolv_hidden_proto (__res_nameinquery)
libresolv_hidden_proto (__res_queriesmatch)
libresolv_hidden_proto (__res_nsend)
libresolv_hidden_proto (__b64_ntop)
-libresolv_hidden_proto (__ns_name_ntop)
-libresolv_hidden_proto (__ns_name_unpack)
-libresolv_hidden_proto (__ns_get16)
-libresolv_hidden_proto (__ns_get32)
libresolv_hidden_proto (__res_nopt)
+libresolv_hidden_proto (__dn_count_labels)
+libresolv_hidden_proto (__p_secstodate)
extern const char *_res_opcodes[];
libresolv_hidden_proto (_res_opcodes)
diff --git a/libc/include/rpc/clnt.h b/libc/include/rpc/clnt.h
index 1e72e22bc..75d88a65c 100644
--- a/libc/include/rpc/clnt.h
+++ b/libc/include/rpc/clnt.h
@@ -21,6 +21,18 @@ extern CLIENT *clntudp_bufcreate_internal (struct sockaddr_in *__raddr,
struct timeval __wait_resend,
int *__sockp, u_int __sendsz,
u_int __recvsz) attribute_hidden;
+extern CLIENT *__libc_clntudp_bufcreate (struct sockaddr_in *__raddr,
+ u_long __program, u_long __version,
+ struct timeval __wait_resend,
+ int *__sockp, u_int __sendsz,
+ u_int __recvsz, int __flags);
+extern CLIENT *__libc_clntudp_bufcreate_internal (struct sockaddr_in *__raddr,
+ u_long __program,
+ u_long __version,
+ struct timeval __wait_resend,
+ int *__sockp, u_int __sendsz,
+ u_int __recvsz, int __flags)
+ attribute_hidden;
extern CLIENT *clntunix_create_internal (struct sockaddr_un *__raddr,
u_long __program, u_long __version,
int *__sockp, u_int __sendsz,
diff --git a/libc/include/sys/socket.h b/libc/include/sys/socket.h
index 0a226726a..df892783a 100644
--- a/libc/include/sys/socket.h
+++ b/libc/include/sys/socket.h
@@ -153,4 +153,12 @@ extern int __libc_sa_len_internal (sa_family_t __af) attribute_hidden;
# define __connect(fd, addr, len) INTUSE(__connect) (fd, addr, len)
#endif
+#ifdef SOCK_CLOEXEC
+extern int __have_sock_cloexec;
+/* At lot of other functionality became available at the same time as
+ SOCK_CLOEXEC. Avoid defining separate variables for all of them
+ unless it is really necessary. */
+# define __have_paccept __have_sock_cloexec
+#endif
+
#endif
diff --git a/libc/include/unistd.h b/libc/include/unistd.h
index f34d53f22..34d7477f9 100644
--- a/libc/include/unistd.h
+++ b/libc/include/unistd.h
@@ -48,6 +48,7 @@ extern ssize_t __libc_write (int __fd, __const void *__buf, size_t __n);
libc_hidden_proto (__libc_write)
extern int __pipe (int __pipedes[2]);
libc_hidden_proto (__pipe)
+extern int __pipe2 (int __pipedes[2], int __flags);
extern unsigned int __sleep (unsigned int __seconds);
extern int __chown (__const char *__file,
__uid_t __owner, __gid_t __group);
@@ -165,4 +166,10 @@ extern int __libc_pause (void);
/* Not cancelable variant. */
extern int __pause_nocancel (void) attribute_hidden;
+extern int __have_sock_cloexec;
+/* At lot of other functionality became available at the same time as
+ SOCK_CLOEXEC. Avoid defining separate variables for all of them
+ unless it is really necessary. */
+#define __have_pipe2 __have_sock_cloexec
+
#endif
diff --git a/libc/io/Makefile b/libc/io/Makefile
index e83952e06..8edfee01d 100644
--- a/libc/io/Makefile
+++ b/libc/io/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1992-2002,2003,2005,2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 1992-2003,2005,2006,2007,2008 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
@@ -42,7 +42,7 @@ routines := \
open open64 openat openat64 close \
read write lseek lseek64 access euidaccess faccessat \
fcntl flock lockf lockf64 \
- dup dup2 pipe \
+ dup dup2 dup3 pipe pipe2 \
creat creat64 \
chdir fchdir \
getcwd getwd getdirname \
diff --git a/libc/io/Versions b/libc/io/Versions
index d603668f4..6c0a23b46 100644
--- a/libc/io/Versions
+++ b/libc/io/Versions
@@ -119,4 +119,7 @@ libc {
GLIBC_2.7 {
__open_2; __open64_2; __openat_2; __openat64_2;
}
+ GLIBC_2.9 {
+ dup3; pipe2;
+ }
}
diff --git a/libc/io/dup3.c b/libc/io/dup3.c
new file mode 100644
index 000000000..162ab4e68
--- /dev/null
+++ b/libc/io/dup3.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2008 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 <unistd.h>
+
+
+/* Duplicate FD to FD2, closing the old FD2 and making FD2 be
+ open the same file as FD is which setting flags according to
+ FLAGS. Return FD2 or -1. */
+int
+dup3 (fd, fd2, flags)
+ int fd;
+ int fd2;
+ int flags;
+{
+ if (fd < 0 || fd2 < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+
+ if (fd == fd2)
+ /* No way to check that they are valid. */
+ return fd2;
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (dup3)
+
+#include <stub-tag.h>
diff --git a/libc/io/ftw.c b/libc/io/ftw.c
index 5495bc7ec..9cc09077e 100644
--- a/libc/io/ftw.c
+++ b/libc/io/ftw.c
@@ -1,5 +1,5 @@
/* File tree walker functions.
- Copyright (C) 1996-2003, 2004, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1996-2004, 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -243,7 +243,7 @@ object_compare (const void *p1, const void *p2)
}
-static inline int
+static int
add_object (struct ftw_data *data, struct STAT *st)
{
struct known_object *newp = malloc (sizeof (struct known_object));
diff --git a/libc/io/pipe2.c b/libc/io/pipe2.c
new file mode 100644
index 000000000..aa54d17ae
--- /dev/null
+++ b/libc/io/pipe2.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 1991, 1995, 1996, 2002, 2008 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 <unistd.h>
+#include <stddef.h>
+
+/* Create a one-way communication channel (__pipe). If successful,
+ two file descriptors are stored in PIPEDES; bytes written on
+ PIPEDES[1] can be read from PIPEDES[0]. Apply FLAGS to the new
+ file descriptors. Returns 0 if successful, -1 if not. */
+int
+__pipe2 (pipedes, flags)
+ int pipedes[2];
+ int flags;
+{
+ if (pipedes == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__pipe2, pipe2)
+stub_warning (pipe2)
+
+#include <stub-tag.h>
diff --git a/libc/libio/Makefile b/libc/libio/Makefile
index 260e82951..5a835a11d 100644
--- a/libc/libio/Makefile
+++ b/libc/libio/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1995-2002,2003,2004,2006,2007 Free Software Foundation, Inc.
+# Copyright (C) 1995-2004,2006,2007,2008 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
@@ -67,7 +67,7 @@ tests = test-fmemopen tst-ext tst-ext2 \
tst-mmap2-eofsync tst-mmap-offend bug-fopena+ \
bug-ungetc2 bug-ungetc3 bug-ungetc4 \
tst-memstream1 tst-memstream2 \
- bug-memstream1
+ bug-memstream1 tst-popen1
tests-$(OPTION_EGLIBC_LOCALE_CODE) \
+= tst-swscanf tst-fgetws tst-fopenloc tst-setvbuf1 \
tst-ungetwc1 tst-ungetwc2 bug-ftell bug-ungetwc2 \
diff --git a/libc/libio/fileops.c b/libc/libio/fileops.c
index 16fa2c297..2d86013c9 100644
--- a/libc/libio/fileops.c
+++ b/libc/libio/fileops.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995, 1997-2005, 2006, 2007
+/* Copyright (C) 1993, 1995, 1997-2005, 2006, 2007, 2008
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Per Bothner <bothner@cygnus.com>.
@@ -435,9 +435,11 @@ _IO_new_file_attach (fp, fd)
/* Get the current position of the file. */
/* We have to do that since that may be junk. */
fp->_offset = _IO_pos_BAD;
+ int save_errno = errno;
if (_IO_SEEKOFF (fp, (_IO_off64_t)0, _IO_seek_cur, _IOS_INPUT|_IOS_OUTPUT)
== _IO_pos_BAD && errno != ESPIPE)
return NULL;
+ __set_errno (save_errno);
return fp;
}
INTDEF2(_IO_new_file_attach, _IO_file_attach)
diff --git a/libc/libio/fmemopen.c b/libc/libio/fmemopen.c
index f3b280092..b618ce585 100644
--- a/libc/libio/fmemopen.c
+++ b/libc/libio/fmemopen.c
@@ -1,7 +1,7 @@
/* Fmemopen implementation.
- Copyright (C) 2000, 2002, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2002, 2005, 2006, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Hanno Mueller, kontakt@hanno.de, 2000.
+ Contributed by Hanno Mueller, kontakt@hanno.de, 2000.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -82,6 +82,7 @@ struct fmemopen_cookie_struct
{
char *buffer;
int mybuffer;
+ int binmode;
size_t size;
_IO_off64_t pos;
size_t maxpos;
@@ -120,7 +121,7 @@ fmemopen_write (void *cookie, const char *b, size_t s)
c = (fmemopen_cookie_t *) cookie;
- addnullc = s == 0 || b[s - 1] != '\0';
+ addnullc = c->binmode == 0 && (s == 0 || b[s - 1] != '\0');
if (c->pos + s + addnullc > c->size)
{
@@ -165,7 +166,7 @@ fmemopen_seek (void *cookie, _IO_off64_t *p, int w)
break;
case SEEK_END:
- np = c->maxpos - *p;
+ np = (c->binmode ? c->size : c->maxpos) - *p;
break;
default:
@@ -248,6 +249,8 @@ fmemopen (void *buf, size_t len, const char *mode)
else
c->pos = 0;
+ c->binmode = mode[0] != '\0' && mode[1] == 'b';
+
iof.read = fmemopen_read;
iof.write = fmemopen_write;
iof.seek = fmemopen_seek;
diff --git a/libc/libio/iopopen.c b/libc/libio/iopopen.c
index d5c6305b0..1a5cc0f59 100644
--- a/libc/libio/iopopen.c
+++ b/libc/libio/iopopen.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997-2002, 2003, 2004, 2007
+/* Copyright (C) 1993, 1997-2002, 2003, 2004, 2007, 2008
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Per Bothner <bothner@cygnus.com>.
@@ -44,6 +44,7 @@
#endif
#include <sys/types.h>
#include <sys/wait.h>
+#include <kernel-features.h>
#ifndef _IO_fork
#ifdef _LIBC
@@ -56,15 +57,6 @@ extern _IO_pid_t _IO_fork (void) __THROW;
#endif /* _IO_HAVE_SYS_WAIT */
-#ifndef _IO_pipe
-#ifdef _LIBC
-#define _IO_pipe __pipe
-#else
-#define _IO_pipe pipe
-#endif
-extern int _IO_pipe (int des[2]) __THROW;
-#endif
-
#ifndef _IO_dup2
#ifdef _LIBC
#define _IO_dup2 __dup2
@@ -127,45 +119,103 @@ _IO_new_proc_open (fp, command, mode)
const char *mode;
{
#if _IO_HAVE_SYS_WAIT
- volatile int read_or_write;
- volatile int parent_end, child_end;
+ int read_or_write;
+ int parent_end, child_end;
int pipe_fds[2];
_IO_pid_t child_pid;
+
+ int do_read = 0;
+ int do_write = 0;
+ int do_cloexec = 0;
+ while (*mode != '\0')
+ switch (*mode++)
+ {
+ case 'r':
+ do_read = 1;
+ break;
+ case 'w':
+ do_write = 1;
+ break;
+ case 'e':
+ do_cloexec = 1;
+ break;
+ default:
+ errout:
+ __set_errno (EINVAL);
+ return NULL;
+ }
+
+ if ((do_read ^ do_write) == 0)
+ goto errout;
+
if (_IO_file_is_open (fp))
return NULL;
- if (_IO_pipe (pipe_fds) < 0)
- return NULL;
- if (mode[0] == 'r' && mode[1] == '\0')
+
+#ifdef O_CLOEXEC
+# ifndef __ASSUME_PIPE2
+ if (__have_pipe2 >= 0)
+# endif
+ {
+ int r = __pipe2 (pipe_fds, O_CLOEXEC);
+# ifndef __ASSUME_PIPE2
+ if (__have_pipe2 == 0)
+ __have_pipe2 = r != -1 || errno != ENOSYS ? 1 : -1;
+
+ if (__have_pipe2 > 0)
+# endif
+ if (r < 0)
+ return NULL;
+ }
+#endif
+#ifndef __ASSUME_PIPE2
+# ifdef O_CLOEXEC
+ if (__have_pipe2 < 0)
+# endif
+ if (__pipe (pipe_fds) < 0)
+ return NULL;
+#endif
+
+ if (do_read)
{
parent_end = pipe_fds[0];
child_end = pipe_fds[1];
read_or_write = _IO_NO_WRITES;
}
- else if (mode[0] == 'w' && mode[1] == '\0')
+ else
{
parent_end = pipe_fds[1];
child_end = pipe_fds[0];
read_or_write = _IO_NO_READS;
}
- else
- {
- _IO_close (pipe_fds[0]);
- _IO_close (pipe_fds[1]);
- __set_errno (EINVAL);
- return NULL;
- }
+
((_IO_proc_file *) fp)->pid = child_pid = _IO_fork ();
if (child_pid == 0)
{
- int child_std_end = mode[0] == 'r' ? 1 : 0;
+ int child_std_end = do_read ? 1 : 0;
struct _IO_proc_file *p;
+#ifndef __ASSUME_PIPE2
+ /* If we have pipe2 the descriptor is marked for close-on-exec. */
_IO_close (parent_end);
+#endif
if (child_end != child_std_end)
{
_IO_dup2 (child_end, child_std_end);
+#ifndef __ASSUME_PIPE2
_IO_close (child_end);
+#endif
+ }
+#ifdef O_CLOEXEC
+ else
+ {
+ /* The descriptor is already the one we will use. But it must
+ not be marked close-on-exec. Undo the effects. */
+# ifndef __ASSUME_PIPE2
+ if (__have_pipe2 > 0)
+# endif
+ __fcntl (child_end, F_SETFD, 0);
}
+#endif
/* POSIX.2: "popen() shall ensure that any streams from previous
popen() calls that remain open in the parent process are closed
in the new child process." */
@@ -189,6 +239,28 @@ _IO_new_proc_open (fp, command, mode)
_IO_close (parent_end);
return NULL;
}
+
+ if (do_cloexec)
+ {
+#ifndef __ASSUME_PIPE2
+# ifdef O_CLOEXEC
+ if (__have_pipe2 < 0)
+# endif
+ __fcntl (parent_end, F_SETFD, FD_CLOEXEC);
+#endif
+ }
+ else
+ {
+#ifdef O_CLOEXEC
+ /* Undo the effects of the pipe2 call which set the
+ close-on-exec flag. */
+# ifndef __ASSUME_PIPE2
+ if (__have_pipe2 > 0)
+# endif
+ __fcntl (parent_end, F_SETFD, 0);
+#endif
+ }
+
_IO_fileno (fp) = parent_end;
/* Link into proc_file_chain. */
diff --git a/libc/libio/iosetvbuf.c b/libc/libio/iosetvbuf.c
index 7580230eb..a92eaebf8 100644
--- a/libc/libio/iosetvbuf.c
+++ b/libc/libio/iosetvbuf.c
@@ -45,7 +45,7 @@ _IO_setvbuf (fp, buf, mode, size)
switch (mode)
{
case _IOFBF:
- fp->_IO_file_flags &= ~_IO_LINE_BUF|_IO_UNBUFFERED;
+ fp->_IO_file_flags &= ~(_IO_LINE_BUF|_IO_UNBUFFERED);
if (buf == NULL)
{
if (fp->_IO_buf_base == NULL)
diff --git a/libc/libio/tst-popen1.c b/libc/libio/tst-popen1.c
new file mode 100644
index 000000000..bae6615b9
--- /dev/null
+++ b/libc/libio/tst-popen1.c
@@ -0,0 +1,49 @@
+#include <fcntl.h>
+#include <stdio.h>
+
+static int
+do_test (void)
+{
+ int res = 0;
+
+ FILE *fp = popen ("echo hello", "r");
+ if (fp == NULL)
+ {
+ puts ("first popen failed");
+ res = 1;
+ }
+ else
+ {
+ int fd = fileno (fp);
+ if (fcntl (fd, F_GETFD) == FD_CLOEXEC)
+ {
+ puts ("first popen(\"r\") set FD_CLOEXEC");
+ res = 1;
+ }
+
+ fclose (fp);
+ }
+
+ fp = popen ("echo hello", "re");
+ if (fp == NULL)
+ {
+ puts ("second popen failed");
+ res = 1;
+ }
+ else
+ {
+ int fd = fileno (fp);
+ if (fcntl (fd, F_GETFD) != FD_CLOEXEC)
+ {
+ puts ("second popen(\"r\") did not set FD_CLOEXEC");
+ res = 1;
+ }
+
+ fclose (fp);
+ }
+
+ return res;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/libc/locale/setlocale.c b/libc/locale/setlocale.c
index 0ff7167be..9593483d9 100644
--- a/libc/locale/setlocale.c
+++ b/libc/locale/setlocale.c
@@ -163,7 +163,7 @@ new_composite_name (int category, const char *newnames[__LC_LAST])
/* Put NAME in _nl_global_locale.__names. */
-static inline void
+static void
setname (int category, const char *name)
{
if (_nl_global_locale.__names[category] == name)
@@ -204,9 +204,16 @@ setlocale (int category, const char *locale)
if (locale == NULL)
return (char *) _nl_global_locale.__names[category];
+ /* Protect global data. */
+ __libc_rwlock_wrlock (__libc_setlocale_lock);
+
if (strcmp (locale, _nl_global_locale.__names[category]) == 0)
- /* Changing to the same thing. */
- return (char *) _nl_global_locale.__names[category];
+ {
+ /* Changing to the same thing. */
+ __libc_rwlock_unlock (__libc_setlocale_lock);
+
+ return (char *) _nl_global_locale.__names[category];
+ }
/* We perhaps really have to load some data. So we determine the
path in which to look for the data now. The environment variable
@@ -220,12 +227,13 @@ setlocale (int category, const char *locale)
if (locpath_var != NULL && locpath_var[0] != '\0')
{
if (__argz_create_sep (locpath_var, ':',
- &locale_path, &locale_path_len) != 0)
- return NULL;
-
- if (__argz_add_sep (&locale_path, &locale_path_len,
- _nl_default_locale_path, ':') != 0)
- return NULL;
+ &locale_path, &locale_path_len) != 0
+ || __argz_add_sep (&locale_path, &locale_path_len,
+ _nl_default_locale_path, ':') != 0)
+ {
+ __libc_rwlock_unlock (__libc_setlocale_lock);
+ return NULL;
+ }
}
if (category == LC_ALL)
@@ -260,8 +268,13 @@ setlocale (int category, const char *locale)
break;
if (cnt == __LC_LAST)
- /* Bogus category name. */
- ERROR_RETURN;
+ {
+ error_return:
+ __libc_rwlock_unlock (__libc_setlocale_lock);
+
+ /* Bogus category name. */
+ ERROR_RETURN;
+ }
/* Found the category this clause sets. */
newnames[cnt] = ++cp;
@@ -280,12 +293,9 @@ setlocale (int category, const char *locale)
for (cnt = 0; cnt < __LC_LAST; ++cnt)
if (cnt != LC_ALL && newnames[cnt] == locale)
/* The composite name did not specify all categories. */
- ERROR_RETURN;
+ goto error_return;
}
- /* Protect global data. */
- __libc_rwlock_wrlock (__libc_setlocale_lock);
-
/* Load the new data for each category. */
while (category-- > 0)
if (category != LC_ALL)
@@ -363,9 +373,6 @@ setlocale (int category, const char *locale)
struct locale_data *newdata = NULL;
const char *newname[1] = { locale };
- /* Protect global data. */
- __libc_rwlock_wrlock (__libc_setlocale_lock);
-
if (CATEGORY_USED (category))
{
/* Only actually load the data if anything will use it. */
diff --git a/libc/localedata/ChangeLog b/libc/localedata/ChangeLog
index 1d3e10fc3..2bc9e8997 100644
--- a/libc/localedata/ChangeLog
+++ b/libc/localedata/ChangeLog
@@ -1,3 +1,14 @@
+2008-07-11 Ulrich Drepper <drepper@redhat.com>
+
+ * locales/iso14651_t1_common: Add Kannada collation support.
+ Patch by Pravin Satpute <psatpute@redhat.com>.
+
+2008-07-08 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #6713]
+ * charmaps/UTF-8: Fix U1DBA entry representation.
+ Patch by Colin Watson.
+
2008-06-27 Ulrich Drepper <drepper@redhat.com>
* tst-strptime.c (do_test): Add test of %EY.
diff --git a/libc/localedata/charmaps/UTF-8 b/libc/localedata/charmaps/UTF-8
index d4375bbab..34b2f7ee8 100644
--- a/libc/localedata/charmaps/UTF-8
+++ b/libc/localedata/charmaps/UTF-8
@@ -5961,7 +5961,7 @@ CHARMAP
<U1DB7> /xe1/xb6/xb7 MODIFIER LETTER SMALL UPSILON
<U1DB8> /xe1/xb6/xb8 MODIFIER LETTER SMALL CAPITAL U
<U1DB9> /xe1/xb6/xb9 MODIFIER LETTER SMALL V WITH HOOK
-<U1DBA> /xe1/xb6/xbe MODIFIER LETTER SMALL TURNED V
+<U1DBA> /xe1/xb6/xba MODIFIER LETTER SMALL TURNED V
<U1DBB> /xe1/xb6/xbb MODIFIER LETTER SMALL Z
<U1DBC> /xe1/xb6/xbc MODIFIER LETTER SMALL Z WITH RETROFLEX HOOK
<U1DBD> /xe1/xb6/xbd MODIFIER LETTER SMALL Z WITH CURL
diff --git a/libc/localedata/locales/iso14651_t1_common b/libc/localedata/locales/iso14651_t1_common
index 35c0af0b2..cbca3eb86 100644
--- a/libc/localedata/locales/iso14651_t1_common
+++ b/libc/localedata/locales/iso14651_t1_common
@@ -64,6 +64,7 @@ script <DEVANAGARI>
script <GUJARATI>
script <TELUGU>
script <GURUMUKHI>
+script <KANNADA>
# Déclaration des symboles internes / Declaration of internal symbols
#
@@ -816,6 +817,99 @@ collating-symbol <tippi>
collating-symbol <adak>
collating-symbol <pa-halant>
+#<KANNADA>
+#
+# kvd- denotes vowel modifier
+# km- denotes matras
+# kvw- denotes vowels
+# <KNKT> denotes Nukta characters
+
+collating-element <kn-sign_ii> from "<U0CBF><U0CD5>"
+collating-element <kn-sign_e> from "<U0CC6><U0CD5>"
+collating-element <kn-sign_o> from "<U0CC6><U0CC2><U0CD5>"
+collating-element <kn-sign1_o> from "<U0CCA><U0CD5>"
+collating-element <kn-sign_shorto> from "<U0CC6><U0CC2>"
+collating-element <kn-sign_ai> from "<U0CC6><U0CD6>"
+
+# defning symbols
+
+collating-symbol <sign-jihvamuliya>
+collating-symbol <sign-upadhmaniya>
+collating-symbol <KNKT>
+collating-symbol <kvw-a>
+collating-symbol <kvw-aa>
+collating-symbol <kvw-i>
+collating-symbol <kvw-ii>
+collating-symbol <kvw-u>
+collating-symbol <kvw-uu>
+collating-symbol <kvw-vocalicr>
+collating-symbol <kvw-vocalicrr>
+collating-symbol <kvw-vocalicl>
+collating-symbol <kvw-vocalicll>
+collating-symbol <kvw-shorte>
+collating-symbol <kvw-e>
+collating-symbol <kvw-ai>
+collating-symbol <kvw-shorto>
+collating-symbol <kvw-o>
+collating-symbol <kvw-au>
+collating-symbol <k-ka>
+collating-symbol <k-kha>
+collating-symbol <k-ga>
+collating-symbol <k-gha>
+collating-symbol <k-nga>
+collating-symbol <k-ca>
+collating-symbol <k-cha>
+collating-symbol <k-ja>
+collating-symbol <k-jha>
+collating-symbol <k-nya>
+collating-symbol <k-tta>
+collating-symbol <k-ttha>
+collating-symbol <k-dda>
+collating-symbol <k-ddha>
+collating-symbol <k-nna>
+collating-symbol <k-ta>
+collating-symbol <k-tha>
+collating-symbol <k-da>
+collating-symbol <k-dha>
+collating-symbol <k-na>
+collating-symbol <k-pa>
+collating-symbol <k-pha>
+collating-symbol <k-ba>
+collating-symbol <k-bha>
+collating-symbol <k-ma>
+collating-symbol <k-ya>
+collating-symbol <k-ra>
+collating-symbol <k-rra>
+collating-symbol <k-la>
+collating-symbol <k-va>
+collating-symbol <k-sha>
+collating-symbol <k-ssa>
+collating-symbol <k-sa>
+collating-symbol <k-ha>
+collating-symbol <k-lla>
+collating-symbol <k-fa>
+collating-symbol <k-avagrah>
+collating-symbol <km-aa>
+collating-symbol <km-i>
+collating-symbol <km-ii>
+collating-symbol <km-u>
+collating-symbol <km-uu>
+collating-symbol <km-vocalicr>
+collating-symbol <km-vocalicrr>
+collating-symbol <km-vocalicl>
+collating-symbol <km-vocalicll>
+collating-symbol <km-shorte>
+collating-symbol <km-e>
+collating-symbol <km-ai>
+collating-symbol <km-shorto>
+collating-symbol <km-o>
+collating-symbol <km-au>
+collating-symbol <kvd-anuswara>
+collating-symbol <kvd-visarg>
+collating-symbol <k-halant>
+collating-symbol <k-lenght_mark>
+collating-symbol <k-ai_lenght_mark>
+
# Ordre des symboles internes / Order of internal symbols
#
# SYMB. N°
@@ -1557,6 +1651,88 @@ collating-symbol <pa-halant>
<tippi>
<pa-halant>
+#
+# <KANNADA>
+#
+# collation weights in order
+
+<KNKT>
+<sign-jihvamuliya>
+<sign-upadhmaniya>
+<kvw-a>
+<kvw-aa>
+<kvw-i>
+<kvw-ii>
+<kvw-u>
+<kvw-uu>
+<kvw-vocalicr>
+<kvw-vocalicrr>
+<kvw-vocalicl>
+<kvw-vocalicll>
+<kvw-shorte>
+<kvw-e>
+<kvw-ai>
+<kvw-shorto>
+<kvw-o>
+<kvw-au>
+<k-ka>
+<k-kha>
+<k-ga>
+<k-gha>
+<k-nga>
+<k-ca>
+<k-cha>
+<k-ja>
+<k-jha>
+<k-nya>
+<k-tta>
+<k-ttha>
+<k-dda>
+<k-ddha>
+<k-nna>
+<k-ta>
+<k-tha>
+<k-da>
+<k-dha>
+<k-na>
+<k-pa>
+<k-pha>
+<k-ba>
+<k-bha>
+<k-ma>
+<k-ya>
+<k-ra>
+<k-rra>
+<k-la>
+<k-va>
+<k-sha>
+<k-ssa>
+<k-sa>
+<k-ha>
+<k-lla>
+<k-fa>
+<k-avagrah>
+<km-aa>
+<km-i>
+<km-ii>
+<km-u>
+<km-uu>
+<km-vocalicr>
+<km-vocalicrr>
+<km-vocalicl>
+<km-vocalicll>
+<km-shorte>
+<km-e>
+<km-ai>
+<km-shorto>
+<km-o>
+<km-au>
+<kvd-anuswara>
+<kvd-visarg>
+<k-halant>
+<k-lenght_mark>
+<k-ai_lenght_mark>
+
order_start <SPECIAL>;forward;backward;forward;forward,position
#
# Tout caractère non précisément défini sera considéré comme caractère spécial
@@ -3698,6 +3874,100 @@ order_start <GURUMUKHI>;forward;forward;forward;forward,position
<U0A3C> IGNORE;<PNKT>;<MIN>;IGNORE
<U0A71> IGNORE;<adak>;<MIN>;IGNORE
+order_start <KANNADA>;forward;forward;forward;forward,position
+<U0CE6> <0>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
+<U0CE7> <1>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
+<U0CE8> <2>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
+<U0CE9> <3>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
+<U0CEA> <4>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
+<U0CEB> <5>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
+<U0CEC> <6>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
+<U0CED> <7>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
+<U0CEE> <8>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
+<U0CEF> <9>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
+<U0CF1> <sign-jihvamuliya>;<BAS>;<MIN>;IGNORE
+<U0CF2> <sign-upadhmaniya>;<BAS>;<MIN>;IGNORE
+<U0C85> <kvw-a>;<BAS>;<MIN>;IGNORE
+<U0C86> <kvw-aa>;<BAS>;<MIN>;IGNORE
+<U0C87> <kvw-i>;<BAS>;<MIN>;IGNORE
+<U0C88> <kvw-ii>;<BAS>;<MIN>;IGNORE
+<U0C89> <kvw-u>;<BAS>;<MIN>;IGNORE
+<U0C8A> <kvw-uu>;<BAS>;<MIN>;IGNORE
+<U0C8B> <kvw-vocalicr>;<BAS>;<MIN>;IGNORE
+<U0CE0> <kvw-vocalicrr>;<BAS>;<MIN>;IGNORE
+<U0C8C> <kvw-vocalicl>;<BAS>;<MIN>;IGNORE
+<U0CE1> <kvw-vocalicll>;<BAS>;<MIN>;IGNORE
+<U0C8E> <kvw-shorte>;<BAS>;<MIN>;IGNORE
+<U0C8F> <kvw-e>;<BAS>;<MIN>;IGNORE
+<U0C90> <kvw-ai>;<BAS>;<MIN>;IGNORE
+<U0C92> <kvw-shorto>;<BAS>;<MIN>;IGNORE
+<U0C93> <kvw-o>;<BAS>;<MIN>;IGNORE
+<U0C94> <kvw-au>;<BAS>;<MIN>;IGNORE
+<U0C95> <k-ka>;<BAS>;<MIN>;IGNORE
+<U0C96> <k-kha>;<BAS>;<MIN>;IGNORE
+<U0C97> <k-ga>;<BAS>;<MIN>;IGNORE
+<U0C98> <k-gha>;<BAS>;<MIN>;IGNORE
+<U0C99> <k-nga>;<BAS>;<MIN>;IGNORE
+<U0C9A> <k-ca>;<BAS>;<MIN>;IGNORE
+<U0C9B> <k-cha>;<BAS>;<MIN>;IGNORE
+<U0C9C> <k-ja>;<BAS>;<MIN>;IGNORE
+<U0C9D> <k-jha>;<BAS>;<MIN>;IGNORE
+<U0C9E> <k-nya>;<BAS>;<MIN>;IGNORE
+<U0C9F> <k-tta>;<BAS>;<MIN>;IGNORE
+<U0CA0> <k-ttha>;<BAS>;<MIN>;IGNORE
+<U0CA1> <k-dda>;<BAS>;<MIN>;IGNORE
+<U0CA2> <k-ddha>;<BAS>;<MIN>;IGNORE
+<U0CA3> <k-nna>;<BAS>;<MIN>;IGNORE
+<U0CA4> <k-ta>;<BAS>;<MIN>;IGNORE
+<U0CA5> <k-tha>;<BAS>;<MIN>;IGNORE
+<U0CA6> <k-da>;<BAS>;<MIN>;IGNORE
+<U0CA7> <k-dha>;<BAS>;<MIN>;IGNORE
+<U0CA8> <k-na>;<BAS>;<MIN>;IGNORE
+<U0CAA> <k-pa>;<BAS>;<MIN>;IGNORE
+<U0CAB> <k-pha>;<BAS>;<MIN>;IGNORE
+<U0CAC> <k-ba>;<BAS>;<MIN>;IGNORE
+<U0CAD> <k-bha>;<BAS>;<MIN>;IGNORE
+<U0CAE> <k-ma>;<BAS>;<MIN>;IGNORE
+<U0CAF> <k-ya>;<BAS>;<MIN>;IGNORE
+<U0CB0> <k-ra>;<BAS>;<MIN>;IGNORE
+<U0CB1> <k-rra>;<BAS>;<MIN>;IGNORE
+<U0CB2> <k-la>;<BAS>;<MIN>;IGNORE
+<U0CB5> <k-va>;<BAS>;<MIN>;IGNORE
+<U0CB6> <k-sha>;<BAS>;<MIN>;IGNORE
+<U0CB7> <k-ssa>;<BAS>;<MIN>;IGNORE
+<U0CB8> <k-sa>;<BAS>;<MIN>;IGNORE
+<U0CB9> <k-ha>;<BAS>;<MIN>;IGNORE
+<U0CB3> <k-lla>;<BAS>;<MIN>;IGNORE
+<U0CDE> <k-fa>;<BAS>;<MIN>;IGNORE
+<U0CBD> <k-avagrah>;<BAS>;<MIN>;IGNORE
+<U0CBE> <km-aa>;<BAS>;<MIN>;IGNORE
+<U0CBF> <km-i>;<BAS>;<MIN>;IGNORE
+<U0CC0> <km-ii>;<BAS>;<MIN>;IGNORE
+<kn-sign_ii> <km-ii>;<BAS>;<MIN>;IGNORE
+<U0CC1> <km-u>;<BAS>;<MIN>;IGNORE
+<U0CC2> <km-uu>;<BAS>;<MIN>;IGNORE
+<U0CC3> <km-vocalicr>;<BAS>;<MIN>;IGNORE
+<U0CC4> <km-vocalicrr>;<BAS>;<MIN>;IGNORE
+<U0CE2> <km-vocalicl>;<BAS>;<MIN>;IGNORE
+<U0CE3> <km-vocalicll>;<BAS>;<MIN>;IGNORE
+<U0CC6> <km-shorte>;<BAS>;<MIN>;IGNORE
+<U0CC7> <km-e>;<BAS>;<MIN>;IGNORE
+<kn-sign_e> <km-e>;<BAS>;<MIN>;IGNORE
+<U0CC8> <km-ai>;<BAS>;<MIN>;IGNORE
+<kn-sign_ai> <km-ai>;<BAS>;<MIN>;IGNORE
+<U0CCA> <km-shorto>;<BAS>;<MIN>;IGNORE
+<kn-sign_shorto> <km-shorto>;<BAS>;<MIN>;IGNORE
+<U0CCB> <km-o>;<BAS>;<MIN>;IGNORE
+<kn-sign_o> <km-o>;<BAS>;<MIN>;IGNORE
+<kn-sign1_o> <km-o>;<BAS>;<MIN>;IGNORE
+<U0CCC> <km-au>;<BAS>;<MIN>;IGNORE
+<U0C82> <kvd-anuswara>;<BAS>;<MIN>;IGNORE
+<U0C83> <kvd-visarg>;<BAS>;<MIN>;IGNORE
+<U0CCD> <k-halant>;<BAS>;<MIN>;IGNORE
+<U0CD5> <k-lenght_mark>;<BAS>;<MIN>;IGNORE
+<U0CD6> <k-ai_lenght_mark>;<BAS>;<MIN>;IGNORE
+<U0CBC> IGNORE;<KNKT>;<MIN>;IGNORE
+
order_end
END LC_COLLATE
diff --git a/libc/login/utmp_file.c b/libc/login/utmp_file.c
index a1c6a2571..9033f72a4 100644
--- a/libc/login/utmp_file.c
+++ b/libc/login/utmp_file.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2002, 2003, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2004, 2007, 2008 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.
@@ -22,6 +22,7 @@
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
+#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
@@ -167,10 +168,11 @@ setutent_file (void)
# ifdef O_CLOEXEC
if (__have_o_cloexec == 0)
__have_o_cloexec = (result & FD_CLOEXEC) ? 1 : -1;
-# endif
- result = fcntl_not_cancel (file_fd, F_SETFD,
- result | FD_CLOEXEC);
+ if (__have_o_cloexec < 0)
+# endif
+ result = fcntl_not_cancel (file_fd, F_SETFD,
+ result | FD_CLOEXEC);
}
if (result == -1)
@@ -243,12 +245,16 @@ getutent_r_file (struct utmp *buffer, struct utmp **result)
static int
-internal_getut_r (const struct utmp *id, struct utmp *buffer)
+internal_getut_r (const struct utmp *id, struct utmp *buffer,
+ bool *lock_failed)
{
int result = -1;
LOCK_FILE (file_fd, F_RDLCK)
- LOCKING_FAILED ();
+ {
+ *lock_failed = true;
+ LOCKING_FAILED ();
+ }
#if _HAVE_UT_TYPE - 0
if (id->ut_type == RUN_LVL || id->ut_type == BOOT_TIME
@@ -319,7 +325,10 @@ getutid_r_file (const struct utmp *id, struct utmp *buffer,
return -1;
}
- if (internal_getut_r (id, &last_entry) < 0)
+ /* We don't have to distinguish whether we can lock the file or
+ whether there is no entry. */
+ bool lock_failed = false;
+ if (internal_getut_r (id, &last_entry, &lock_failed) < 0)
{
*result = NULL;
return -1;
@@ -409,7 +418,16 @@ pututline_file (const struct utmp *data)
__utmp_equal (&last_entry, data)))
found = 1;
else
- found = internal_getut_r (data, &buffer);
+ {
+ bool lock_failed = false;
+ found = internal_getut_r (data, &buffer, &lock_failed);
+
+ if (__builtin_expect (lock_failed, false))
+ {
+ __set_errno (EAGAIN);
+ return NULL;
+ }
+ }
LOCK_FILE (file_fd, F_WRLCK)
{
diff --git a/libc/malloc/hooks.c b/libc/malloc/hooks.c
index 1e01b73af..c88937665 100644
--- a/libc/malloc/hooks.c
+++ b/libc/malloc/hooks.c
@@ -1,5 +1,5 @@
/* Malloc implementation for multiple threads without lock contention.
- Copyright (C) 2001-2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2001-2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Wolfram Gloger <wg@malloc.de>, 2001.
@@ -96,8 +96,6 @@ __malloc_check_init()
__free_hook = free_check;
__realloc_hook = realloc_check;
__memalign_hook = memalign_check;
- if(check_action & 1)
- malloc_printerr (5, "malloc: using debugging hooks", NULL);
}
/* A simple, standard set of debugging hooks. Overhead is `only' one
diff --git a/libc/malloc/mtrace.c b/libc/malloc/mtrace.c
index 1a9522b09..fafa52e91 100644
--- a/libc/malloc/mtrace.c
+++ b/libc/malloc/mtrace.c
@@ -1,5 +1,5 @@
/* More debugging hooks for `malloc'.
- Copyright (C) 1991-1994,1996-2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1991-1994,1996-2004, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written April 2, 1991 by John Gilmore of Cygnus Support.
Based on mcheck.c by Mike Haertel.
@@ -34,13 +34,13 @@
#include <stdio-common/_itoa.h>
-#ifdef _LIBC
-# include <libc-internal.h>
+#include <libc-internal.h>
-# include <libio/iolibio.h>
-# define setvbuf(s, b, f, l) INTUSE(_IO_setvbuf) (s, b, f, l)
-# define fwrite(buf, size, count, fp) _IO_fwrite (buf, size, count, fp)
-#endif
+#include <libio/iolibio.h>
+#define setvbuf(s, b, f, l) INTUSE(_IO_setvbuf) (s, b, f, l)
+#define fwrite(buf, size, count, fp) _IO_fwrite (buf, size, count, fp)
+
+#include <kernel-features.h>
#ifndef attribute_hidden
# define attribute_hidden
@@ -315,9 +315,10 @@ mtrace ()
if (mtb == NULL)
return;
- mallstream = fopen (mallfile != NULL ? mallfile : "/dev/null", "wc");
+ mallstream = fopen (mallfile != NULL ? mallfile : "/dev/null", "wce");
if (mallstream != NULL)
{
+#ifndef __ASSUME_O_CLOEXEC
/* Make sure we close the file descriptor on exec. */
int flags = __fcntl (fileno (mallstream), F_GETFD, 0);
if (flags >= 0)
@@ -325,6 +326,7 @@ mtrace ()
flags |= FD_CLOEXEC;
__fcntl (fileno (mallstream), F_SETFD, flags);
}
+#endif
/* Be sure it doesn't malloc its buffer! */
malloc_trace_buffer = mtb;
setvbuf (mallstream, malloc_trace_buffer, _IOFBF, TRACE_BUFFER_SIZE);
diff --git a/libc/manual/arith.texi b/libc/manual/arith.texi
index 078885e86..b1580a06f 100644
--- a/libc/manual/arith.texi
+++ b/libc/manual/arith.texi
@@ -418,7 +418,7 @@ This function returns @code{-1} if @var{x} represents negative infinity,
This function returns a nonzero value if @var{x} is a ``not a number''
value, and zero otherwise.
-@strong{Note:} The @code{isnan} macro defined by @w{ISO C99} overrides
+@strong{NB:} The @code{isnan} macro defined by @w{ISO C99} overrides
the BSD function. This is normally not a problem, because the two
routines behave identically. However, if you really need to get the BSD
function for some reason, you can write
@@ -968,7 +968,7 @@ decide whether traps will occur for each of the exceptions, by setting
bits in the @dfn{control word}. In C, traps result in the program
receiving the @code{SIGFPE} signal; see @ref{Signal Handling}.
-@strong{Note:} @w{IEEE 754} says that trap handlers are given details of
+@strong{NB:} @w{IEEE 754} says that trap handlers are given details of
the exceptional situation, and can set the result value. C signals do
not provide any mechanism to pass this information back and forth.
Trapping exceptions in C is therefore not very useful.
@@ -1721,7 +1721,7 @@ Not all machines provide hardware support for these operations. On
machines that don't, the macros can be very slow. Therefore, you should
not use these functions when NaN is not a concern.
-@strong{Note:} There are no macros @code{isequal} or @code{isunequal}.
+@strong{NB:} There are no macros @code{isequal} or @code{isunequal}.
They are unnecessary, because the @code{==} and @code{!=} operators do
@emph{not} throw an exception if one or both of the operands are NaN.
diff --git a/libc/manual/creature.texi b/libc/manual/creature.texi
index c825edd5a..96501568a 100644
--- a/libc/manual/creature.texi
+++ b/libc/manual/creature.texi
@@ -217,7 +217,7 @@ sequence of definitions:
Note that if you do this, you must link your program with the BSD
compatibility library by passing the @samp{-lbsd-compat} option to the
-compiler or linker. @strong{Note:} If you forget to do this, you may
+compiler or linker. @strong{NB:} If you forget to do this, you may
get very strange errors at run time.
@end defvr
diff --git a/libc/manual/filesys.texi b/libc/manual/filesys.texi
index 9719d4194..a486f7de3 100644
--- a/libc/manual/filesys.texi
+++ b/libc/manual/filesys.texi
@@ -3239,7 +3239,7 @@ are replaced with six characters which make the whole string a unique
file name. Usually the template string is something like
@samp{/tmp/@var{prefix}XXXXXX}, and each program uses a unique @var{prefix}.
-@strong{Note:} Because @code{mktemp} and @code{mkstemp} modify the
+@strong{NB:} Because @code{mktemp} and @code{mkstemp} modify the
template string, you @emph{must not} pass string constants to them.
String constants are normally in read-only storage, so your program
would crash when @code{mktemp} or @code{mkstemp} tried to modify the
diff --git a/libc/manual/math.texi b/libc/manual/math.texi
index 7ebcddee3..50e087c48 100644
--- a/libc/manual/math.texi
+++ b/libc/manual/math.texi
@@ -1366,7 +1366,7 @@ The prototypes for these functions are in @file{stdlib.h}.
This function returns the next pseudo-random number in the sequence.
The value returned ranges from @code{0} to @code{RAND_MAX}.
-@strong{Note:} Temporarily this function was defined to return a
+@strong{NB:} Temporarily this function was defined to return a
@code{int32_t} value to indicate that the return value always contains
32 bits even if @code{long int} is wider. The standard demands it
differently. Users must always be aware of the 32-bit limitation,
diff --git a/libc/manual/memory.texi b/libc/manual/memory.texi
index cbe147b71..43afc7bf9 100644
--- a/libc/manual/memory.texi
+++ b/libc/manual/memory.texi
@@ -2326,7 +2326,7 @@ additional block on each iteration. This is impossible with
variable-sized arrays.
@end itemize
-@strong{Note:} If you mix use of @code{alloca} and variable-sized arrays
+@strong{NB:} If you mix use of @code{alloca} and variable-sized arrays
within one function, exiting a scope in which a variable-sized array was
declared frees all blocks allocated with @code{alloca} during the
execution of that scope.
diff --git a/libc/manual/resource.texi b/libc/manual/resource.texi
index aabd28976..4a814c9e4 100644
--- a/libc/manual/resource.texi
+++ b/libc/manual/resource.texi
@@ -591,7 +591,7 @@ ready to execute instructions right now. When a process blocks to wait
for something like I/O, its absolute priority is irrelevant.
@cindex runnable process
-@strong{Note:} The term ``runnable'' is a synonym for ``ready to run.''
+@strong{NB:} The term ``runnable'' is a synonym for ``ready to run.''
When two processes are running or ready to run and both have the same
absolute priority, it's more interesting. In that case, who gets the
@@ -663,7 +663,7 @@ privileged process constantly monitors the process' CPU usage and raises
its absolute priority when the process isn't getting its entitled share
and lowers it when the process is exceeding it.
-@strong{Note:} The absolute priority is sometimes called the ``static
+@strong{NB:} The absolute priority is sometimes called the ``static
priority.'' We don't use that term in this manual because it misses the
most important feature of the absolute priority: its absoluteness.
diff --git a/libc/manual/syslog.texi b/libc/manual/syslog.texi
index 02c8e28a7..e16b5d247 100644
--- a/libc/manual/syslog.texi
+++ b/libc/manual/syslog.texi
@@ -337,7 +337,7 @@ Locally defined
Results are undefined if the facility code is anything else.
-@strong{note:} @code{syslog} recognizes one other facility code: that of
+@strong{NB:} @code{syslog} recognizes one other facility code: that of
the kernel. But you can't specify that facility code with these
functions. If you try, it looks the same to @code{syslog} as if you are
requesting the default facility. But you wouldn't want to anyway,
diff --git a/libc/manual/time.texi b/libc/manual/time.texi
index 64763a2d2..393bccd99 100644
--- a/libc/manual/time.texi
+++ b/libc/manual/time.texi
@@ -1652,7 +1652,7 @@ The seconds as a decimal number (range @code{0} through @code{60}).
Leading zeroes are permitted but not required.
-@strong{Note:} The Unix specification says the upper bound on this value
+@strong{NB:} The Unix specification says the upper bound on this value
is @code{61}, a result of a decision to allow double leap seconds. You
will not see the value @code{61} because no minute has more than one
leap second, but the myth persists.
diff --git a/libc/misc/syslog.c b/libc/misc/syslog.c
index 5781b4a96..8f84faf75 100644
--- a/libc/misc/syslog.c
+++ b/libc/misc/syslog.c
@@ -348,10 +348,35 @@ openlog_internal(const char *ident, int logstat, int logfac)
(void)strncpy(SyslogAddr.sun_path, _PATH_LOG,
sizeof(SyslogAddr.sun_path));
if (LogStat & LOG_NDELAY) {
- if ((LogFile = __socket(AF_UNIX, LogType, 0))
- == -1)
+#ifdef SOCK_CLOEXEC
+# ifndef __ASSUME_SOCK_CLOEXEC
+ if (__have_sock_cloexec >= 0) {
+# endif
+ LogFile = __socket(AF_UNIX,
+ LogType
+ | SOCK_CLOEXEC, 0);
+# ifndef __ASSUME_SOCK_CLOEXEC
+ if (__have_sock_cloexec == 0)
+ __have_sock_cloexec
+ = (LogFile != -1
+ || errno != EINVAL);
+ }
+#endif
+#endif
+#ifndef __ASSUME_SOCK_CLOEXEC
+# ifdef SOCK_CLOEXEC
+ if (__have_sock_cloexec < 0)
+# endif
+ LogFile = __socket(AF_UNIX, LogType, 0);
+#endif
+ if (LogFile == -1)
return;
- (void)__fcntl(LogFile, F_SETFD, 1);
+#ifndef __ASSUME_SOCK_CLOEXEC
+# ifdef SOCK_CLOEXEC
+ if (__have_sock_cloexec < 0)
+# endif
+ __fcntl(LogFile, F_SETFD, FD_CLOEXEC);
+#endif
}
}
if (LogFile != -1 && !connected)
diff --git a/libc/nis/ypclnt.c b/libc/nis/ypclnt.c
index 7d0091bd2..aaf4eb6e5 100644
--- a/libc/nis/ypclnt.c
+++ b/libc/nis/ypclnt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2001, 2002, 2003, 2004, 2005, 2006
+/* Copyright (C) 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
@@ -28,6 +28,7 @@
#include <rpcsvc/yp.h>
#include <rpcsvc/ypclnt.h>
#include <rpcsvc/ypupd.h>
+#include <sys/socket.h>
#include <sys/uio.h>
#include <bits/libc-lock.h>
@@ -69,14 +70,24 @@ yp_bind_client_create (const char *domain, dom_binding *ysd,
ysd->dom_domain[YPMAXDOMAIN] = '\0';
ysd->dom_socket = RPC_ANYSOCK;
- ysd->dom_client = clntudp_create (&ysd->dom_server_addr, YPPROG, YPVERS,
- UDPTIMEOUT, &ysd->dom_socket);
+#ifdef SOCK_CLOEXEC
+# define xflags SOCK_CLOEXEC
+#else
+# define xflags 0
+#endif
+ ysd->dom_client = __libc_clntudp_bufcreate (&ysd->dom_server_addr, YPPROG,
+ YPVERS, UDPTIMEOUT,
+ &ysd->dom_socket,
+ UDPMSGSIZE, UDPMSGSIZE,
+ xflags);
if (ysd->dom_client != NULL)
{
+#ifndef SOCK_CLOEXEC
/* If the program exits, close the socket */
if (fcntl (ysd->dom_socket, F_SETFD, FD_CLOEXEC) == -1)
perror ("fcntl: F_SETFD");
+#endif
}
}
diff --git a/libc/nptl/ChangeLog b/libc/nptl/ChangeLog
index 744f90d78..d638dde58 100644
--- a/libc/nptl/ChangeLog
+++ b/libc/nptl/ChangeLog
@@ -1,3 +1,33 @@
+2008-08-15 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/x86_64/pthreaddef.h: Remove ARCH_MAP_FLAGS and
+ ARCH_RETRY_MMAP definitions.
+ * allocatestack.c: Remove definition of ARCH_MAP_FLAGS.
+ Define MAP_STACK when not defined.
+ (allocate_stack): Use MAP_STACK instead of ARCH_MAP_FLAGS. Remove
+ handling of ARCH_RETRY_MMAP.
+
+2008-07-30 Ulrich Drepper <drepper@redhat.com>
+
+ * tst-align2.c (f): Print message that f is reached.
+
+2008-04-28 Hiroki Kaminaga <kaminaga@sm.sony.co.jp>
+
+ [BZ #6740]
+ * sysdeps/powerpc/tcb-offsets.sym (PRIVATE_FUTEX_OFFSET): Guard symbol
+ definition with #ifndef __ASSUME_PRIVATE_FUTEX.
+
+2008-07-25 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/mq_notify.c (init_mq_netlink): Use
+ SOCK_CLOEXEC if possible.
+
+2008-05-29 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile (tests): Add tst-rwlock2a.
+ * tst-rwlock2.c: Use TYPE macro to decide what rwlock type to use.
+ * tst-rwlock2a.c: New file.
+
2008-06-12 Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/pthread.h: Remove inadvertant checkin.
@@ -76,7 +106,7 @@
2008-03-27 Ulrich Drepper <drepper@redhat.com>
- * sysdeps/unix/sysv/linux/bits/local_lim.h: Undefined ARG_MAX if
+ * sysdeps/unix/sysv/linux/bits/local_lim.h: Undefine ARG_MAX if
<linux/limits.h> has defined it.
* sysdeps/unix/sysv/linux/alpha/bits/local_lim.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/bits/local_lim.h: Likewise.
diff --git a/libc/nptl/allocatestack.c b/libc/nptl/allocatestack.c
index b01f28d10..a8235e667 100644
--- a/libc/nptl/allocatestack.c
+++ b/libc/nptl/allocatestack.c
@@ -84,10 +84,10 @@
#endif
-/* Let the architecture add some flags to the mmap() call used to
- allocate stacks. */
-#ifndef ARCH_MAP_FLAGS
-# define ARCH_MAP_FLAGS 0
+/* Newer kernels have the MAP_STACK flag to indicate a mapping is used for
+ a stack. Use it when possible. */
+#ifndef MAP_STACK
+# define MAP_STACK 0
#endif
/* This yields the pointer that TLS support code calls the thread pointer. */
@@ -454,20 +454,14 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
#endif
mem = mmap (NULL, size, prot,
- MAP_PRIVATE | MAP_ANONYMOUS | ARCH_MAP_FLAGS, -1, 0);
+ MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0);
if (__builtin_expect (mem == MAP_FAILED, 0))
{
-#ifdef ARCH_RETRY_MMAP
- mem = ARCH_RETRY_MMAP (size, prot);
- if (__builtin_expect (mem == MAP_FAILED, 0))
-#endif
- {
- if (errno == ENOMEM)
- errno = EAGAIN;
+ if (errno == ENOMEM)
+ __set_errno (EAGAIN);
- return errno;
- }
+ return errno;
}
/* SIZE is guaranteed to be greater than zero.
diff --git a/libc/nptl/sysdeps/powerpc/tcb-offsets.sym b/libc/nptl/sysdeps/powerpc/tcb-offsets.sym
index eda43dce8..8ac133dfd 100644
--- a/libc/nptl/sysdeps/powerpc/tcb-offsets.sym
+++ b/libc/nptl/sysdeps/powerpc/tcb-offsets.sym
@@ -15,4 +15,6 @@ MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads)
PID thread_offsetof (pid)
TID thread_offsetof (tid)
POINTER_GUARD (offsetof (tcbhead_t, pointer_guard) - TLS_TCB_OFFSET - sizeof (tcbhead_t))
+#ifndef __ASSUME_PRIVATE_FUTEX
PRIVATE_FUTEX_OFFSET thread_offsetof (header.private_futex)
+#endif
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/mq_notify.c b/libc/nptl/sysdeps/unix/sysv/linux/mq_notify.c
index 2ec11bf68..49ddeae05 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/mq_notify.c
+++ b/libc/nptl/sysdeps/unix/sysv/linux/mq_notify.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contribute by Ulrich Drepper <drepper@redhat.com>, 2004.
@@ -29,6 +29,7 @@
#include <unistd.h>
#include <sys/socket.h>
#include <not-cancel.h>
+#include <kernel-features.h>
#ifdef __NR_mq_notify
@@ -152,18 +153,40 @@ reset_once (void)
static void
init_mq_netlink (void)
{
+#ifdef SOCK_CLOEXEC
+# ifndef __ASSUME_SOCK_CLOEXEC
+ static int have_sock_cloexec;
+# else
+# define have_sock_cloexec 1
+# endif
+#else
+# define have_sock_cloexec -1
+# define SOCK_CLOEXEC 0
+#endif
+
/* This code might be called a second time after fork(). The file
descriptor is inherited from the parent. */
if (netlink_socket == -1)
{
/* Just a normal netlink socket, not bound. */
- netlink_socket = socket (AF_NETLINK, SOCK_RAW, 0);
+ if (have_sock_cloexec >= 0)
+ {
+ netlink_socket = socket (AF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, 0);
+#if defined SOCK_CLOEXEC && !defined __ASSUME_SOCK_CLOEXEC
+ if (have_sock_cloexec == 0)
+ have_sock_cloexec = (netlink_socket != -1 || errno != EINVAL
+ ? 1 : -1);
+#endif
+ }
+ if (have_sock_cloexec < 0)
+ netlink_socket = socket (AF_NETLINK, SOCK_RAW, 0);
/* No need to do more if we have no socket. */
if (netlink_socket == -1)
return;
/* Make sure the descriptor is closed on exec. */
- if (fcntl (netlink_socket, F_SETFD, FD_CLOEXEC) != 0)
+ if (have_sock_cloexec < 0
+ && fcntl (netlink_socket, F_SETFD, FD_CLOEXEC) != 0)
goto errout;
}
diff --git a/libc/nptl/sysdeps/x86_64/pthreaddef.h b/libc/nptl/sysdeps/x86_64/pthreaddef.h
index 0195bc928..be63a8c74 100644
--- a/libc/nptl/sysdeps/x86_64/pthreaddef.h
+++ b/libc/nptl/sysdeps/x86_64/pthreaddef.h
@@ -36,16 +36,6 @@
({ char *frame; asm ("movq %%rsp, %0" : "=r" (frame)); frame; })
-/* We prefer to have the stack allocated in the low 4GB since this
- allows faster context switches. */
-#define ARCH_MAP_FLAGS MAP_32BIT
-
-/* If it is not possible to allocate memory there retry without that
- flag. */
-#define ARCH_RETRY_MMAP(size, prot) \
- mmap (NULL, size, prot, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)
-
-
/* XXX Until we have a better place keep the definitions here. */
/* While there is no such syscall. */
diff --git a/libc/nptl/tst-align2.c b/libc/nptl/tst-align2.c
index 9c300ecd1..9112bdc8f 100644
--- a/libc/nptl/tst-align2.c
+++ b/libc/nptl/tst-align2.c
@@ -31,6 +31,8 @@ f (void *arg)
{
bool ok = true;
+ puts ("in f");
+
if (TEST_STACK_ALIGN ())
ok = false;
diff --git a/libc/nscd/Makefile b/libc/nscd/Makefile
index a0d07d4f5..8d9d70686 100644
--- a/libc/nscd/Makefile
+++ b/libc/nscd/Makefile
@@ -98,7 +98,7 @@ CFLAGS-nscd_initgroups.c = -fexceptions
nscd-cflags = -DIS_IN_nscd=1 -D_FORTIFY_SOURCE=2
ifeq (yesyes,$(have-fpie)$(build-shared))
-nscd-cflags += -fpie
+nscd-cflags += $(pie-ccflag)
endif
ifeq (yes,$(have-ssp))
nscd-cflags += -fstack-protector
diff --git a/libc/nscd/connections.c b/libc/nscd/connections.c
index 0afc95a22..3395e54fa 100644
--- a/libc/nscd/connections.c
+++ b/libc/nscd/connections.c
@@ -234,6 +234,14 @@ static int inotify_fd = -1;
static int resolv_conf_descr = -1;
#endif
+#ifndef __ASSUME_SOCK_CLOEXEC
+/* Negative if SOCK_CLOEXEC is not supported, positive if it is, zero
+ before be know the result. */
+static int have_sock_cloexec;
+/* The paccept syscall was introduced at the same time as SOCK_CLOEXEC. */
+# define have_paccept have_sock_cloexec
+#endif
+
/* Number of times clients had to wait. */
unsigned long int client_queued;
@@ -517,9 +525,15 @@ nscd_init (void)
#ifdef HAVE_INOTIFY
/* Use inotify to recognize changed files. */
- inotify_fd = inotify_init ();
- if (inotify_fd != -1)
- fcntl (inotify_fd, F_SETFL, O_NONBLOCK);
+ inotify_fd = inotify_init1 (IN_NONBLOCK);
+# ifndef __ASSUME_IN_NONBLOCK
+ if (inotify_fd == -1 && errno == ENOSYS)
+ {
+ inotify_fd = inotify_init ();
+ if (inotify_fd != -1)
+ fcntl (inotify_fd, F_SETFL, O_RDONLY | O_NONBLOCK);
+ }
+# endif
#endif
for (size_t cnt = 0; cnt < lastdb; ++cnt)
@@ -860,7 +874,21 @@ cannot set socket to close on exec: %s; disabling paranoia mode"),
}
/* Create the socket. */
- sock = socket (AF_UNIX, SOCK_STREAM, 0);
+#ifndef __ASSUME_SOCK_CLOEXEC
+ sock = -1;
+ if (have_sock_cloexec >= 0)
+#endif
+ {
+ sock = socket (AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0);
+#ifndef __ASSUME_SOCK_CLOEXEC
+ if (have_sock_cloexec == 0)
+ have_sock_cloexec = sock != -1 || errno != EINVAL ? 1 : -1;
+#endif
+ }
+#ifndef __ASSUME_SOCK_CLOEXEC
+ if (have_sock_cloexec < 0)
+ sock = socket (AF_UNIX, SOCK_STREAM, 0);
+#endif
if (sock < 0)
{
dbg_log (_("cannot open socket: %s"), strerror (errno));
@@ -876,22 +904,27 @@ cannot set socket to close on exec: %s; disabling paranoia mode"),
exit (errno == EACCES ? 4 : 1);
}
- /* We don't want to get stuck on accept. */
- int fl = fcntl (sock, F_GETFL);
- if (fl == -1 || fcntl (sock, F_SETFL, fl | O_NONBLOCK) == -1)
+#ifndef __ASSUME_SOCK_CLOEXEC
+ if (have_sock_cloexec < 0)
{
- dbg_log (_("cannot change socket to nonblocking mode: %s"),
- strerror (errno));
- exit (1);
- }
+ /* We don't want to get stuck on accept. */
+ int fl = fcntl (sock, F_GETFL);
+ if (fl == -1 || fcntl (sock, F_SETFL, fl | O_NONBLOCK) == -1)
+ {
+ dbg_log (_("cannot change socket to nonblocking mode: %s"),
+ strerror (errno));
+ exit (1);
+ }
- /* The descriptor needs to be closed on exec. */
- if (paranoia && fcntl (sock, F_SETFD, FD_CLOEXEC) == -1)
- {
- dbg_log (_("cannot set socket to close on exec: %s"),
- strerror (errno));
- exit (1);
+ /* The descriptor needs to be closed on exec. */
+ if (paranoia && fcntl (sock, F_SETFD, FD_CLOEXEC) == -1)
+ {
+ dbg_log (_("cannot set socket to close on exec: %s"),
+ strerror (errno));
+ exit (1);
+ }
}
+#endif
/* Set permissions for the socket. */
chmod (_PATH_NSCDSOCKET, DEFFILEMODE);
@@ -1576,10 +1609,15 @@ nscd_run_worker (void *p)
/* We are done with the list. */
pthread_mutex_unlock (&readylist_lock);
- /* We do not want to block on a short read or so. */
- int fl = fcntl (fd, F_GETFL);
- if (fl == -1 || fcntl (fd, F_SETFL, fl | O_NONBLOCK) == -1)
- goto close_and_out;
+#ifndef __ASSUME_SOCK_CLOEXEC
+ if (have_sock_cloexec < 0)
+ {
+ /* We do not want to block on a short read or so. */
+ int fl = fcntl (fd, F_GETFL);
+ if (fl == -1 || fcntl (fd, F_SETFL, fl | O_NONBLOCK) == -1)
+ goto close_and_out;
+ }
+#endif
/* Now read the request. */
request_header req;
@@ -1779,7 +1817,24 @@ main_loop_poll (void)
if (conns[0].revents != 0)
{
/* We have a new incoming connection. Accept the connection. */
- int fd = TEMP_FAILURE_RETRY (accept (sock, NULL, NULL));
+ int fd;
+
+#ifndef __ASSUME_PACCEPT
+ fd = -1;
+ if (have_paccept >= 0)
+#endif
+ {
+ fd = TEMP_FAILURE_RETRY (paccept (sock, NULL, NULL, NULL,
+ SOCK_NONBLOCK));
+#ifndef __ASSUME_PACCEPT
+ if (have_paccept == 0)
+ have_paccept = fd != -1 || errno != ENOSYS ? 1 : -1;
+#endif
+ }
+#ifndef __ASSUME_PACCEPT
+ if (have_paccept < 0)
+ fd = TEMP_FAILURE_RETRY (accept (sock, NULL, NULL));
+#endif
/* Use the descriptor if we have not reached the limit. */
if (fd >= 0)
@@ -1806,42 +1861,70 @@ main_loop_poll (void)
size_t first = 1;
#ifdef HAVE_INOTIFY
- if (conns[1].fd == inotify_fd)
+ if (inotify_fd != -1 && conns[1].fd == inotify_fd)
{
if (conns[1].revents != 0)
{
- bool done[lastdb] = { false, };
+ bool to_clear[lastdb] = { false, };
union
{
+# ifndef PATH_MAX
+# define PATH_MAX 1024
+# endif
struct inotify_event i;
- char buf[100];
+ char buf[sizeof (struct inotify_event) + PATH_MAX];
} inev;
- while (TEMP_FAILURE_RETRY (read (inotify_fd, &inev,
- sizeof (inev)))
- >= (ssize_t) sizeof (struct inotify_event))
+ while (1)
{
+ ssize_t nb = TEMP_FAILURE_RETRY (read (inotify_fd, &inev,
+ sizeof (inev)));
+ if (nb < (ssize_t) sizeof (struct inotify_event))
+ {
+ if (__builtin_expect (nb == -1 && errno != EAGAIN,
+ 0))
+ {
+ /* Something went wrong when reading the inotify
+ data. Better disable inotify. */
+ dbg_log (_("\
+disabled inotify after read error %d"),
+ errno);
+ conns[1].fd = -1;
+ firstfree = 1;
+ if (nused == 2)
+ nused = 1;
+ close (inotify_fd);
+ inotify_fd = -1;
+ }
+ break;
+ }
+
/* Check which of the files changed. */
for (size_t dbcnt = 0; dbcnt < lastdb; ++dbcnt)
- if (!done[dbcnt]
- && (inev.i.wd == dbs[dbcnt].inotify_descr
- || (dbcnt == hstdb
- && inev.i.wd == resolv_conf_descr)))
+ if (inev.i.wd == dbs[dbcnt].inotify_descr)
{
- if (dbcnt == hstdb
- && inev.i.wd == resolv_conf_descr)
- res_init ();
-
- pthread_mutex_lock (&dbs[dbcnt].prune_lock);
- dbs[dbcnt].clear_cache = 1;
- pthread_mutex_unlock (&dbs[dbcnt].prune_lock);
- pthread_cond_signal (&dbs[dbcnt].prune_cond);
-
- done[dbcnt] = true;
- break;
+ to_clear[dbcnt] = true;
+ goto next;
}
+
+ if (inev.i.wd == resolv_conf_descr)
+ {
+ res_init ();
+ to_clear[hstdb] = true;
+ }
+ next:;
}
+ /* Actually perform the cache clearing. */
+ for (size_t dbcnt = 0; dbcnt < lastdb; ++dbcnt)
+ if (to_clear[dbcnt])
+ {
+ pthread_mutex_lock (&dbs[dbcnt].prune_lock);
+ dbs[dbcnt].clear_cache = 1;
+ pthread_mutex_unlock (&dbs[dbcnt].prune_lock);
+ pthread_cond_signal (&dbs[dbcnt].prune_cond);
+ }
+
--n;
}
@@ -1966,27 +2049,58 @@ main_loop_epoll (int efd)
#ifdef HAVE_INOTIFY
else if (revs[cnt].data.fd == inotify_fd)
{
+ bool to_clear[lastdb] = { false, };
union
{
struct inotify_event i;
- char buf[100];
+ char buf[sizeof (struct inotify_event) + PATH_MAX];
} inev;
- while (TEMP_FAILURE_RETRY (read (inotify_fd, &inev,
- sizeof (inev)))
- >= (ssize_t) sizeof (struct inotify_event))
+ while (1)
{
+ ssize_t nb = TEMP_FAILURE_RETRY (read (inotify_fd, &inev,
+ sizeof (inev)));
+ if (nb < (ssize_t) sizeof (struct inotify_event))
+ {
+ if (__builtin_expect (nb == -1 && errno != EAGAIN, 0))
+ {
+ /* Something went wrong when reading the inotify
+ data. Better disable inotify. */
+ dbg_log (_("disabled inotify after read error %d"),
+ errno);
+ (void) epoll_ctl (efd, EPOLL_CTL_DEL, inotify_fd,
+ NULL);
+ close (inotify_fd);
+ inotify_fd = -1;
+ }
+ break;
+ }
+
/* Check which of the files changed. */
for (size_t dbcnt = 0; dbcnt < lastdb; ++dbcnt)
if (inev.i.wd == dbs[dbcnt].inotify_descr)
{
- pthread_mutex_trylock (&dbs[dbcnt].prune_lock);
- dbs[dbcnt].clear_cache = 1;
- pthread_mutex_unlock (&dbs[dbcnt].prune_lock);
- pthread_cond_signal (&dbs[dbcnt].prune_cond);
- break;
+ to_clear[dbcnt] = true;
+ goto next;
}
+
+ if (inev.i.wd == resolv_conf_descr)
+ {
+ res_init ();
+ to_clear[hstdb] = true;
+ }
+ next:;
}
+
+ /* Actually perform the cache clearing. */
+ for (size_t dbcnt = 0; dbcnt < lastdb; ++dbcnt)
+ if (to_clear[dbcnt])
+ {
+ pthread_mutex_lock (&dbs[dbcnt].prune_lock);
+ dbs[dbcnt].clear_cache = 1;
+ pthread_mutex_unlock (&dbs[dbcnt].prune_lock);
+ pthread_cond_signal (&dbs[dbcnt].prune_cond);
+ }
}
#endif
else
@@ -2010,8 +2124,10 @@ main_loop_epoll (int efd)
/* Now look for descriptors for accepted connections which have
no reply in too long of a time. */
time_t laststart = now - ACCEPT_TIMEOUT;
+ assert (starttime[sock] == 0);
+ assert (inotify_fd == -1 || starttime[inotify_fd] == 0);
for (int cnt = highest; cnt > STDERR_FILENO; --cnt)
- if (cnt != sock && starttime[cnt] != 0 && starttime[cnt] < laststart)
+ if (starttime[cnt] != 0 && starttime[cnt] < laststart)
{
/* We are waiting for this one for too long. Close it. */
(void) epoll_ctl (efd, EPOLL_CTL_DEL, cnt, NULL);
diff --git a/libc/nscd/nscd_helper.c b/libc/nscd/nscd_helper.c
index 9828a46df..7db5d0984 100644
--- a/libc/nscd/nscd_helper.c
+++ b/libc/nscd/nscd_helper.c
@@ -33,6 +33,7 @@
#include <sys/un.h>
#include <not-cancel.h>
#include <nis/rpcsvc/nis.h>
+#include <kernel-features.h>
#include "nscd-client.h"
@@ -161,7 +162,26 @@ __readvall (int fd, const struct iovec *iov, int iovcnt)
static int
open_socket (request_type type, const char *key, size_t keylen)
{
- int sock = __socket (PF_UNIX, SOCK_STREAM, 0);
+ int sock;
+
+#ifdef SOCK_CLOEXEC
+# ifndef __ASSUME_SOCK_CLOEXEC
+ if (__have_sock_cloexec >= 0)
+# endif
+ {
+ sock = __socket (PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0);
+# ifndef __ASSUME_SOCK_CLOEXEC
+ if (__have_sock_cloexec == 0)
+ __have_sock_cloexec = sock != -1 || errno != EINVAL ? 1 : -1;
+# endif
+ }
+#endif
+#ifndef __ASSUME_SOCK_CLOEXEC
+# ifdef SOCK_CLOEXEC
+ if (__have_sock_cloexec < 0)
+# endif
+ sock = __socket (PF_UNIX, SOCK_STREAM, 0);
+#endif
if (sock < 0)
return -1;
@@ -172,8 +192,13 @@ open_socket (request_type type, const char *key, size_t keylen)
} reqdata;
size_t real_sizeof_reqdata = sizeof (request_header) + keylen;
- /* Make socket non-blocking. */
- __fcntl (sock, F_SETFL, O_RDWR | O_NONBLOCK);
+#ifndef __ASSUME_SOCK_CLOEXEC
+# ifdef SOCK_NONBLOCK
+ if (__have_sock_cloexec < 0)
+# endif
+ /* Make socket non-blocking. */
+ __fcntl (sock, F_SETFL, O_RDWR | O_NONBLOCK);
+#endif
struct sockaddr_un sun;
sun.sun_family = AF_UNIX;
diff --git a/libc/posix/unistd.h b/libc/posix/unistd.h
index 01ac3f8b4..96bb02dff 100644
--- a/libc/posix/unistd.h
+++ b/libc/posix/unistd.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2006, 2007, 2008 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
@@ -383,6 +383,12 @@ extern ssize_t pwrite64 (int __fd, __const void *__buf, size_t __n,
Returns 0 if successful, -1 if not. */
extern int pipe (int __pipedes[2]) __THROW __wur;
+#ifdef __USE_GNU
+/* Same as pipe but apply flags passed in FLAGS to the new file
+ descriptors. */
+extern int pipe2 (int __pipedes[2], int __flags) __THROW __wur;
+#endif
+
/* Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM.
If SECONDS is zero, any currently scheduled alarm will be cancelled.
The function returns the number of seconds remaining until the last
@@ -492,6 +498,12 @@ extern int dup (int __fd) __THROW __wur;
/* Duplicate FD to FD2, closing FD2 and making it open on the same file. */
extern int dup2 (int __fd, int __fd2) __THROW;
+#ifdef __USE_GNU
+/* Duplicate FD to FD2, closing FD2 and making it open on the same
+ file while setting flags according to FLAGS. */
+extern int dup3 (int __fd, int __fd2, int __flags) __THROW;
+#endif
+
/* NULL-terminated array of "NAME=VALUE" environment variables. */
extern char **__environ;
#ifdef __USE_GNU
diff --git a/libc/posix/wordexp.c b/libc/posix/wordexp.c
index 765d14d81..058a7cfbe 100644
--- a/libc/posix/wordexp.c
+++ b/libc/posix/wordexp.c
@@ -1,5 +1,5 @@
/* POSIX.2 wordexp implementation.
- Copyright (C) 1997-2002, 2003, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1997-2003, 2005, 2006, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Tim Waugh <tim@cyberelk.demon.co.uk>.
@@ -42,6 +42,7 @@
# include <wchar.h>
#endif
#include <wordexp.h>
+#include <kernel-features.h>
#include <bits/libc-lock.h>
#include <stdio-common/_itoa.h>
@@ -824,17 +825,30 @@ exec_comm_child (char *comm, int *fildes, int showerr, int noexec)
args[1] = "-nc";
/* Redirect output. */
- __dup2 (fildes[1], STDOUT_FILENO);
- __close (fildes[1]);
+ if (__builtin_expect (fildes[1] != STDOUT_FILENO, 1))
+ {
+ __dup2 (fildes[1], STDOUT_FILENO);
+ __close (fildes[1]);
+ }
+ else
+ {
+#ifdef O_CLOEXEC
+ /* Reset the close-on-exec flag (if necessary). */
+# ifndef __ASSUME_PIPE2
+ if (__have_pipe2 > 0)
+# endif
+ __fcntl (fildes[1], F_SETFD, 0);
+#endif
+ }
/* Redirect stderr to /dev/null if we have to. */
if (showerr == 0)
{
struct stat64 st;
int fd;
- __close (2);
+ __close (STDERR_FILENO);
fd = __open (_PATH_DEVNULL, O_WRONLY);
- if (fd >= 0 && fd != 2)
+ if (fd >= 0 && fd != STDERR_FILENO)
{
__dup2 (fd, STDERR_FILENO);
__close (fd);
@@ -885,18 +899,38 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
if (!comm || !*comm)
return 0;
- if (__pipe (fildes))
- /* Bad */
- return WRDE_NOSPACE;
+#ifdef O_CLOEXEC
+# ifndef __ASSUME_PIPE2
+ if (__have_pipe2 >= 0)
+# endif
+ {
+ int r = __pipe2 (fildes, O_CLOEXEC);
+# ifndef __ASSUME_PIPE2
+ if (__have_pipe2 == 0)
+ __have_pipe2 = r != -1 || errno != ENOSYS ? 1 : -1;
+
+ if (__have_pipe2 > 0)
+# endif
+ if (r < 0)
+ /* Bad */
+ return WRDE_NOSPACE;
+ }
+#endif
+#ifndef __ASSUME_PIPE2
+# ifdef O_CLOEXEC
+ if (__have_pipe2 < 0)
+# endif
+ if (__pipe (fildes) < 0)
+ /* Bad */
+ return WRDE_NOSPACE;
+#endif
again:
if ((pid = __fork ()) < 0)
{
/* Bad */
- if (fildes[0] != -1)
- __close (fildes[0]);
- if (fildes[1] != -1)
- __close (fildes[1]);
+ __close (fildes[0]);
+ __close (fildes[1]);
return WRDE_NOSPACE;
}
diff --git a/libc/resolv/Makefile b/libc/resolv/Makefile
index 3575e0e28..cc2739eae 100644
--- a/libc/resolv/Makefile
+++ b/libc/resolv/Makefile
@@ -1,5 +1,4 @@
-# Copyright (C) 1994,1995,1996,1997,1998,1999,2000,2001,2003,2004,2007
-# Free Software Foundation, Inc.
+# Copyright (C) 1994-2001,2003,2004,2007,2008 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
@@ -52,7 +51,7 @@ libresolv-routines := gethnamaddr res_comp res_debug \
res_data res_mkquery res_query res_send \
inet_net_ntop inet_net_pton inet_neta base64 \
ns_parse ns_name ns_netint ns_ttl ns_print \
- ns_samedomain
+ ns_samedomain ns_date
libanl-routines := gai_cancel gai_error gai_misc gai_notify gai_suspend \
getaddrinfo_a
diff --git a/libc/resolv/Versions b/libc/resolv/Versions
index 355d95d60..4b2e5e9db 100644
--- a/libc/resolv/Versions
+++ b/libc/resolv/Versions
@@ -74,6 +74,19 @@ libresolv {
GLIBC_2.3.2 {
__p_rcode;
}
+ GLIBC_2.9 {
+ ns_msg_getflag;
+ ns_get16; ns_get32; ns_put16; ns_put32;
+ ns_initparse; ns_skiprr; ns_parserr;
+ ns_sprintrr; ns_sprintrrf;
+ ns_format_ttl; ns_parse_ttl;
+ ns_datetosecs;
+ ns_name_ntol; ns_name_ntop; ns_name_pton;
+ ns_name_unpack; ns_name_pack;
+ ns_name_uncompress; ns_name_compress;
+ ns_name_skip; ns_name_rollback;
+ ns_samedomain; ns_subdomain; ns_makecanon; ns_samename;
+ }
GLIBC_PRIVATE {
# Needed in libnss_dns.
__ns_name_unpack; __ns_name_ntop;
diff --git a/libc/resolv/arpa/nameser.h b/libc/resolv/arpa/nameser.h
index a164221df..7979b3d4d 100644
--- a/libc/resolv/arpa/nameser.h
+++ b/libc/resolv/arpa/nameser.h
@@ -28,6 +28,7 @@
*/
/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
@@ -51,6 +52,8 @@
#ifndef _ARPA_NAMESER_H_
#define _ARPA_NAMESER_H_
+/*! \file */
+
#define BIND_4_COMPAT
#include <sys/param.h>
@@ -61,7 +64,7 @@
#endif
#include <sys/cdefs.h>
-/*
+/*%
* Revision information. This is the release date in YYYYMMDD format.
* It can change every day so the right thing to do with it is use it
* in preprocessor commands such as "#if (__NAMESER > 19931104)". Do not
@@ -69,42 +72,41 @@
* contains a new enough lib/nameser/ to support the feature you need.
*/
-#define __NAMESER 19991006 /* New interface version stamp. */
-
+#define __NAMESER 19991006 /*%< New interface version stamp. */
/*
* Define constants based on RFC 883, RFC 1034, RFC 1035
*/
-#define NS_PACKETSZ 512 /* maximum packet size */
-#define NS_MAXDNAME 1025 /* maximum domain name */
-#define NS_MAXCDNAME 255 /* maximum compressed domain name */
-#define NS_MAXLABEL 63 /* maximum length of domain label */
-#define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */
-#define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */
-#define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */
-#define NS_INT32SZ 4 /* #/bytes of data in a u_int32_t */
-#define NS_INT16SZ 2 /* #/bytes of data in a u_int16_t */
-#define NS_INT8SZ 1 /* #/bytes of data in a u_int8_t */
-#define NS_INADDRSZ 4 /* IPv4 T_A */
-#define NS_IN6ADDRSZ 16 /* IPv6 T_AAAA */
-#define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */
-#define NS_DEFAULTPORT 53 /* For both TCP and UDP. */
-
+#define NS_PACKETSZ 512 /*%< default UDP packet size */
+#define NS_MAXDNAME 1025 /*%< maximum domain name */
+#define NS_MAXMSG 65535 /*%< maximum message size */
+#define NS_MAXCDNAME 255 /*%< maximum compressed domain name */
+#define NS_MAXLABEL 63 /*%< maximum length of domain label */
+#define NS_HFIXEDSZ 12 /*%< #/bytes of fixed data in header */
+#define NS_QFIXEDSZ 4 /*%< #/bytes of fixed data in query */
+#define NS_RRFIXEDSZ 10 /*%< #/bytes of fixed data in r record */
+#define NS_INT32SZ 4 /*%< #/bytes of data in a u_int32_t */
+#define NS_INT16SZ 2 /*%< #/bytes of data in a u_int16_t */
+#define NS_INT8SZ 1 /*%< #/bytes of data in a u_int8_t */
+#define NS_INADDRSZ 4 /*%< IPv4 T_A */
+#define NS_IN6ADDRSZ 16 /*%< IPv6 T_AAAA */
+#define NS_CMPRSFLGS 0xc0 /*%< Flag bits indicating name compression. */
+#define NS_DEFAULTPORT 53 /*%< For both TCP and UDP. */
/*
* These can be expanded with synonyms, just keep ns_parse.c:ns_parserecord()
* in synch with it.
*/
typedef enum __ns_sect {
- ns_s_qd = 0, /* Query: Question. */
- ns_s_zn = 0, /* Update: Zone. */
- ns_s_an = 1, /* Query: Answer. */
- ns_s_pr = 1, /* Update: Prerequisites. */
- ns_s_ns = 2, /* Query: Name servers. */
- ns_s_ud = 2, /* Update: Update. */
- ns_s_ar = 3, /* Query|Update: Additional records. */
+ ns_s_qd = 0, /*%< Query: Question. */
+ ns_s_zn = 0, /*%< Update: Zone. */
+ ns_s_an = 1, /*%< Query: Answer. */
+ ns_s_pr = 1, /*%< Update: Prerequisites. */
+ ns_s_ns = 2, /*%< Query: Name servers. */
+ ns_s_ud = 2, /*%< Update: Update. */
+ ns_s_ar = 3, /*%< Query|Update: Additional records. */
ns_s_max = 4
} ns_sect;
-/*
+/*%
* This is a message handle. It is caller allocated and has no dynamic data.
* This structure is intended to be opaque to all but ns_parse.c, thus the
* leading _'s on the member names. Use the accessor functions, not the _'s.
@@ -115,25 +117,22 @@ typedef struct __ns_msg {
const u_char *_sections[ns_s_max];
ns_sect _sect;
int _rrnum;
- const u_char *_ptr;
+ const u_char *_msg_ptr;
} ns_msg;
/* Private data structure - do not use from outside library. */
struct _ns_flagdata { int mask, shift; };
-extern struct _ns_flagdata _ns_flagdata[];
+extern const struct _ns_flagdata _ns_flagdata[];
/* Accessor macros - this is part of the public interface. */
-#define ns_msg_getflag(handle, flag) ( \
- ((handle)._flags & _ns_flagdata[flag].mask) \
- >> _ns_flagdata[flag].shift \
- )
+
#define ns_msg_id(handle) ((handle)._id + 0)
#define ns_msg_base(handle) ((handle)._msg + 0)
#define ns_msg_end(handle) ((handle)._eom + 0)
#define ns_msg_size(handle) ((handle)._eom - (handle)._msg)
#define ns_msg_count(handle, section) ((handle)._counts[section] + 0)
-/*
+/*%
* This is a parsed record. It is caller allocated and has no dynamic data.
*/
typedef struct __ns_rr {
@@ -153,56 +152,58 @@ typedef struct __ns_rr {
#define ns_rr_rdlen(rr) ((rr).rdlength + 0)
#define ns_rr_rdata(rr) ((rr).rdata + 0)
-/*
+/*%
* These don't have to be in the same order as in the packet flags word,
* and they can even overlap in some cases, but they will need to be kept
* in synch with ns_parse.c:ns_flagdata[].
*/
typedef enum __ns_flag {
- ns_f_qr, /* Question/Response. */
- ns_f_opcode, /* Operation code. */
- ns_f_aa, /* Authoritative Answer. */
- ns_f_tc, /* Truncation occurred. */
- ns_f_rd, /* Recursion Desired. */
- ns_f_ra, /* Recursion Available. */
- ns_f_z, /* MBZ. */
- ns_f_ad, /* Authentic Data (DNSSEC). */
- ns_f_cd, /* Checking Disabled (DNSSEC). */
- ns_f_rcode, /* Response code. */
+ ns_f_qr, /*%< Question/Response. */
+ ns_f_opcode, /*%< Operation code. */
+ ns_f_aa, /*%< Authoritative Answer. */
+ ns_f_tc, /*%< Truncation occurred. */
+ ns_f_rd, /*%< Recursion Desired. */
+ ns_f_ra, /*%< Recursion Available. */
+ ns_f_z, /*%< MBZ. */
+ ns_f_ad, /*%< Authentic Data (DNSSEC). */
+ ns_f_cd, /*%< Checking Disabled (DNSSEC). */
+ ns_f_rcode, /*%< Response code. */
ns_f_max
} ns_flag;
-/*
+/*%
* Currently defined opcodes.
*/
typedef enum __ns_opcode {
- ns_o_query = 0, /* Standard query. */
- ns_o_iquery = 1, /* Inverse query (deprecated/unsupported). */
- ns_o_status = 2, /* Name server status query (unsupported). */
+ ns_o_query = 0, /*%< Standard query. */
+ ns_o_iquery = 1, /*%< Inverse query (deprecated/unsupported). */
+ ns_o_status = 2, /*%< Name server status query (unsupported). */
/* Opcode 3 is undefined/reserved. */
- ns_o_notify = 4, /* Zone change notification. */
- ns_o_update = 5, /* Zone update message. */
+ ns_o_notify = 4, /*%< Zone change notification. */
+ ns_o_update = 5, /*%< Zone update message. */
ns_o_max = 6
} ns_opcode;
-/*
+/*%
* Currently defined response codes.
*/
typedef enum __ns_rcode {
- ns_r_noerror = 0, /* No error occurred. */
- ns_r_formerr = 1, /* Format error. */
- ns_r_servfail = 2, /* Server failure. */
- ns_r_nxdomain = 3, /* Name error. */
- ns_r_notimpl = 4, /* Unimplemented. */
- ns_r_refused = 5, /* Operation refused. */
+ ns_r_noerror = 0, /*%< No error occurred. */
+ ns_r_formerr = 1, /*%< Format error. */
+ ns_r_servfail = 2, /*%< Server failure. */
+ ns_r_nxdomain = 3, /*%< Name error. */
+ ns_r_notimpl = 4, /*%< Unimplemented. */
+ ns_r_refused = 5, /*%< Operation refused. */
/* these are for BIND_UPDATE */
- ns_r_yxdomain = 6, /* Name exists */
- ns_r_yxrrset = 7, /* RRset exists */
- ns_r_nxrrset = 8, /* RRset does not exist */
- ns_r_notauth = 9, /* Not authoritative for zone */
- ns_r_notzone = 10, /* Zone of record different from zone section */
+ ns_r_yxdomain = 6, /*%< Name exists */
+ ns_r_yxrrset = 7, /*%< RRset exists */
+ ns_r_nxrrset = 8, /*%< RRset does not exist */
+ ns_r_notauth = 9, /*%< Not authoritative for zone */
+ ns_r_notzone = 10, /*%< Zone of record different from zone section */
ns_r_max = 11,
- /* The following are TSIG extended errors */
+ /* The following are EDNS extended rcodes */
+ ns_r_badvers = 16,
+ /* The following are TSIG errors */
ns_r_badsig = 16,
ns_r_badkey = 17,
ns_r_badtime = 18
@@ -215,7 +216,7 @@ typedef enum __ns_update_operation {
ns_uop_max = 2
} ns_update_operation;
-/*
+/*%
* This structure is used for TSIG authenticated messages
*/
struct ns_tsig_key {
@@ -225,7 +226,7 @@ struct ns_tsig_key {
};
typedef struct ns_tsig_key ns_tsig_key;
-/*
+/*%
* This structure is used for TSIG authenticated TCP messages
*/
struct ns_tcp_tsig_state {
@@ -245,59 +246,61 @@ typedef struct ns_tcp_tsig_state ns_tcp_tsig_state;
#define NS_TSIG_ERROR_NO_SPACE -11
#define NS_TSIG_ERROR_FORMERR -12
-/*
+/*%
* Currently defined type values for resources and queries.
*/
typedef enum __ns_type {
- ns_t_invalid = 0, /* Cookie. */
- ns_t_a = 1, /* Host address. */
- ns_t_ns = 2, /* Authoritative server. */
- ns_t_md = 3, /* Mail destination. */
- ns_t_mf = 4, /* Mail forwarder. */
- ns_t_cname = 5, /* Canonical name. */
- ns_t_soa = 6, /* Start of authority zone. */
- ns_t_mb = 7, /* Mailbox domain name. */
- ns_t_mg = 8, /* Mail group member. */
- ns_t_mr = 9, /* Mail rename name. */
- ns_t_null = 10, /* Null resource record. */
- ns_t_wks = 11, /* Well known service. */
- ns_t_ptr = 12, /* Domain name pointer. */
- ns_t_hinfo = 13, /* Host information. */
- ns_t_minfo = 14, /* Mailbox information. */
- ns_t_mx = 15, /* Mail routing information. */
- ns_t_txt = 16, /* Text strings. */
- ns_t_rp = 17, /* Responsible person. */
- ns_t_afsdb = 18, /* AFS cell database. */
- ns_t_x25 = 19, /* X_25 calling address. */
- ns_t_isdn = 20, /* ISDN calling address. */
- ns_t_rt = 21, /* Router. */
- ns_t_nsap = 22, /* NSAP address. */
- ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */
- ns_t_sig = 24, /* Security signature. */
- ns_t_key = 25, /* Security key. */
- ns_t_px = 26, /* X.400 mail mapping. */
- ns_t_gpos = 27, /* Geographical position (withdrawn). */
- ns_t_aaaa = 28, /* Ip6 Address. */
- ns_t_loc = 29, /* Location Information. */
- ns_t_nxt = 30, /* Next domain (security). */
- ns_t_eid = 31, /* Endpoint identifier. */
- ns_t_nimloc = 32, /* Nimrod Locator. */
- ns_t_srv = 33, /* Server Selection. */
- ns_t_atma = 34, /* ATM Address */
- ns_t_naptr = 35, /* Naming Authority PoinTeR */
- ns_t_kx = 36, /* Key Exchange */
- ns_t_cert = 37, /* Certification record */
- ns_t_a6 = 38, /* IPv6 address (deprecated, use ns_t_aaaa) */
- ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */
- ns_t_sink = 40, /* Kitchen sink (experimentatl) */
- ns_t_opt = 41, /* EDNS0 option (meta-RR) */
- ns_t_tsig = 250, /* Transaction signature. */
- ns_t_ixfr = 251, /* Incremental zone transfer. */
- ns_t_axfr = 252, /* Transfer zone of authority. */
- ns_t_mailb = 253, /* Transfer mailbox records. */
- ns_t_maila = 254, /* Transfer mail agent records. */
- ns_t_any = 255, /* Wildcard match. */
- ns_t_zxfr = 256, /* BIND-specific, nonstandard. */
+ ns_t_invalid = 0, /*%< Cookie. */
+ ns_t_a = 1, /*%< Host address. */
+ ns_t_ns = 2, /*%< Authoritative server. */
+ ns_t_md = 3, /*%< Mail destination. */
+ ns_t_mf = 4, /*%< Mail forwarder. */
+ ns_t_cname = 5, /*%< Canonical name. */
+ ns_t_soa = 6, /*%< Start of authority zone. */
+ ns_t_mb = 7, /*%< Mailbox domain name. */
+ ns_t_mg = 8, /*%< Mail group member. */
+ ns_t_mr = 9, /*%< Mail rename name. */
+ ns_t_null = 10, /*%< Null resource record. */
+ ns_t_wks = 11, /*%< Well known service. */
+ ns_t_ptr = 12, /*%< Domain name pointer. */
+ ns_t_hinfo = 13, /*%< Host information. */
+ ns_t_minfo = 14, /*%< Mailbox information. */
+ ns_t_mx = 15, /*%< Mail routing information. */
+ ns_t_txt = 16, /*%< Text strings. */
+ ns_t_rp = 17, /*%< Responsible person. */
+ ns_t_afsdb = 18, /*%< AFS cell database. */
+ ns_t_x25 = 19, /*%< X_25 calling address. */
+ ns_t_isdn = 20, /*%< ISDN calling address. */
+ ns_t_rt = 21, /*%< Router. */
+ ns_t_nsap = 22, /*%< NSAP address. */
+ ns_t_nsap_ptr = 23, /*%< Reverse NSAP lookup (deprecated). */
+ ns_t_sig = 24, /*%< Security signature. */
+ ns_t_key = 25, /*%< Security key. */
+ ns_t_px = 26, /*%< X.400 mail mapping. */
+ ns_t_gpos = 27, /*%< Geographical position (withdrawn). */
+ ns_t_aaaa = 28, /*%< Ip6 Address. */
+ ns_t_loc = 29, /*%< Location Information. */
+ ns_t_nxt = 30, /*%< Next domain (security). */
+ ns_t_eid = 31, /*%< Endpoint identifier. */
+ ns_t_nimloc = 32, /*%< Nimrod Locator. */
+ ns_t_srv = 33, /*%< Server Selection. */
+ ns_t_atma = 34, /*%< ATM Address */
+ ns_t_naptr = 35, /*%< Naming Authority PoinTeR */
+ ns_t_kx = 36, /*%< Key Exchange */
+ ns_t_cert = 37, /*%< Certification record */
+ ns_t_a6 = 38, /*%< IPv6 address (deprecated, use ns_t_aaaa) */
+ ns_t_dname = 39, /*%< Non-terminal DNAME (for IPv6) */
+ ns_t_sink = 40, /*%< Kitchen sink (experimentatl) */
+ ns_t_opt = 41, /*%< EDNS0 option (meta-RR) */
+ ns_t_apl = 42, /*%< Address prefix list (RFC3123) */
+ ns_t_tkey = 249, /*%< Transaction key */
+ ns_t_tsig = 250, /*%< Transaction signature. */
+ ns_t_ixfr = 251, /*%< Incremental zone transfer. */
+ ns_t_axfr = 252, /*%< Transfer zone of authority. */
+ ns_t_mailb = 253, /*%< Transfer mailbox records. */
+ ns_t_maila = 254, /*%< Transfer mail agent records. */
+ ns_t_any = 255, /*%< Wildcard match. */
+ ns_t_zxfr = 256, /*%< BIND-specific, nonstandard. */
ns_t_max = 65536
} ns_type;
@@ -312,61 +315,61 @@ typedef enum __ns_type {
#define ns_t_xfr_p(t) ((t) == ns_t_axfr || (t) == ns_t_ixfr || \
(t) == ns_t_zxfr)
-/*
+/*%
* Values for class field
*/
typedef enum __ns_class {
- ns_c_invalid = 0, /* Cookie. */
- ns_c_in = 1, /* Internet. */
- ns_c_2 = 2, /* unallocated/unsupported. */
- ns_c_chaos = 3, /* MIT Chaos-net. */
- ns_c_hs = 4, /* MIT Hesiod. */
+ ns_c_invalid = 0, /*%< Cookie. */
+ ns_c_in = 1, /*%< Internet. */
+ ns_c_2 = 2, /*%< unallocated/unsupported. */
+ ns_c_chaos = 3, /*%< MIT Chaos-net. */
+ ns_c_hs = 4, /*%< MIT Hesiod. */
/* Query class values which do not appear in resource records */
- ns_c_none = 254, /* for prereq. sections in update requests */
- ns_c_any = 255, /* Wildcard match. */
+ ns_c_none = 254, /*%< for prereq. sections in update requests */
+ ns_c_any = 255, /*%< Wildcard match. */
ns_c_max = 65536
} ns_class;
/* DNSSEC constants. */
typedef enum __ns_key_types {
- ns_kt_rsa = 1, /* key type RSA/MD5 */
- ns_kt_dh = 2, /* Diffie Hellman */
- ns_kt_dsa = 3, /* Digital Signature Standard (MANDATORY) */
- ns_kt_private = 254 /* Private key type starts with OID */
+ ns_kt_rsa = 1, /*%< key type RSA/MD5 */
+ ns_kt_dh = 2, /*%< Diffie Hellman */
+ ns_kt_dsa = 3, /*%< Digital Signature Standard (MANDATORY) */
+ ns_kt_private = 254 /*%< Private key type starts with OID */
} ns_key_types;
typedef enum __ns_cert_types {
- cert_t_pkix = 1, /* PKIX (X.509v3) */
- cert_t_spki = 2, /* SPKI */
- cert_t_pgp = 3, /* PGP */
- cert_t_url = 253, /* URL private type */
- cert_t_oid = 254 /* OID private type */
+ cert_t_pkix = 1, /*%< PKIX (X.509v3) */
+ cert_t_spki = 2, /*%< SPKI */
+ cert_t_pgp = 3, /*%< PGP */
+ cert_t_url = 253, /*%< URL private type */
+ cert_t_oid = 254 /*%< OID private type */
} ns_cert_types;
/* Flags field of the KEY RR rdata. */
-#define NS_KEY_TYPEMASK 0xC000 /* Mask for "type" bits */
-#define NS_KEY_TYPE_AUTH_CONF 0x0000 /* Key usable for both */
-#define NS_KEY_TYPE_CONF_ONLY 0x8000 /* Key usable for confidentiality */
-#define NS_KEY_TYPE_AUTH_ONLY 0x4000 /* Key usable for authentication */
-#define NS_KEY_TYPE_NO_KEY 0xC000 /* No key usable for either; no key */
+#define NS_KEY_TYPEMASK 0xC000 /*%< Mask for "type" bits */
+#define NS_KEY_TYPE_AUTH_CONF 0x0000 /*%< Key usable for both */
+#define NS_KEY_TYPE_CONF_ONLY 0x8000 /*%< Key usable for confidentiality */
+#define NS_KEY_TYPE_AUTH_ONLY 0x4000 /*%< Key usable for authentication */
+#define NS_KEY_TYPE_NO_KEY 0xC000 /*%< No key usable for either; no key */
/* The type bits can also be interpreted independently, as single bits: */
-#define NS_KEY_NO_AUTH 0x8000 /* Key unusable for authentication */
-#define NS_KEY_NO_CONF 0x4000 /* Key unusable for confidentiality */
+#define NS_KEY_NO_AUTH 0x8000 /*%< Key unusable for authentication */
+#define NS_KEY_NO_CONF 0x4000 /*%< Key unusable for confidentiality */
#define NS_KEY_RESERVED2 0x2000 /* Security is *mandatory* if bit=0 */
-#define NS_KEY_EXTENDED_FLAGS 0x1000 /* reserved - must be zero */
-#define NS_KEY_RESERVED4 0x0800 /* reserved - must be zero */
-#define NS_KEY_RESERVED5 0x0400 /* reserved - must be zero */
-#define NS_KEY_NAME_TYPE 0x0300 /* these bits determine the type */
-#define NS_KEY_NAME_USER 0x0000 /* key is assoc. with user */
-#define NS_KEY_NAME_ENTITY 0x0200 /* key is assoc. with entity eg host */
-#define NS_KEY_NAME_ZONE 0x0100 /* key is zone key */
-#define NS_KEY_NAME_RESERVED 0x0300 /* reserved meaning */
-#define NS_KEY_RESERVED8 0x0080 /* reserved - must be zero */
-#define NS_KEY_RESERVED9 0x0040 /* reserved - must be zero */
-#define NS_KEY_RESERVED10 0x0020 /* reserved - must be zero */
-#define NS_KEY_RESERVED11 0x0010 /* reserved - must be zero */
-#define NS_KEY_SIGNATORYMASK 0x000F /* key can sign RR's of same name */
+#define NS_KEY_EXTENDED_FLAGS 0x1000 /*%< reserved - must be zero */
+#define NS_KEY_RESERVED4 0x0800 /*%< reserved - must be zero */
+#define NS_KEY_RESERVED5 0x0400 /*%< reserved - must be zero */
+#define NS_KEY_NAME_TYPE 0x0300 /*%< these bits determine the type */
+#define NS_KEY_NAME_USER 0x0000 /*%< key is assoc. with user */
+#define NS_KEY_NAME_ENTITY 0x0200 /*%< key is assoc. with entity eg host */
+#define NS_KEY_NAME_ZONE 0x0100 /*%< key is zone key */
+#define NS_KEY_NAME_RESERVED 0x0300 /*%< reserved meaning */
+#define NS_KEY_RESERVED8 0x0080 /*%< reserved - must be zero */
+#define NS_KEY_RESERVED9 0x0040 /*%< reserved - must be zero */
+#define NS_KEY_RESERVED10 0x0020 /*%< reserved - must be zero */
+#define NS_KEY_RESERVED11 0x0010 /*%< reserved - must be zero */
+#define NS_KEY_SIGNATORYMASK 0x000F /*%< key can sign RR's of same name */
#define NS_KEY_RESERVED_BITMASK ( NS_KEY_RESERVED2 | \
NS_KEY_RESERVED4 | \
NS_KEY_RESERVED5 | \
@@ -374,16 +377,14 @@ typedef enum __ns_cert_types {
NS_KEY_RESERVED9 | \
NS_KEY_RESERVED10 | \
NS_KEY_RESERVED11 )
-#define NS_KEY_RESERVED_BITMASK2 0xFFFF /* no bits defined here */
-
+#define NS_KEY_RESERVED_BITMASK2 0xFFFF /*%< no bits defined here */
/* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */
-#define NS_ALG_MD5RSA 1 /* MD5 with RSA */
-#define NS_ALG_DH 2 /* Diffie Hellman KEY */
-#define NS_ALG_DSA 3 /* DSA KEY */
+#define NS_ALG_MD5RSA 1 /*%< MD5 with RSA */
+#define NS_ALG_DH 2 /*%< Diffie Hellman KEY */
+#define NS_ALG_DSA 3 /*%< DSA KEY */
#define NS_ALG_DSS NS_ALG_DSA
-#define NS_ALG_EXPIRE_ONLY 253 /* No alg, no security */
-#define NS_ALG_PRIVATE_OID 254 /* Key begins with OID giving alg */
-
+#define NS_ALG_EXPIRE_ONLY 253 /*%< No alg, no security */
+#define NS_ALG_PRIVATE_OID 254 /*%< Key begins with OID giving alg */
/* Protocol values */
/* value 0 is reserved */
#define NS_KEY_PROT_TLS 1
@@ -393,8 +394,8 @@ typedef enum __ns_cert_types {
#define NS_KEY_PROT_ANY 255
/* Signatures */
-#define NS_MD5RSA_MIN_BITS 512 /* Size of a mod or exp in bits */
-#define NS_MD5RSA_MAX_BITS 2552
+#define NS_MD5RSA_MIN_BITS 512 /*%< Size of a mod or exp in bits */
+#define NS_MD5RSA_MAX_BITS 4096
/* Total of binary mod and exp */
#define NS_MD5RSA_MAX_BYTES ((NS_MD5RSA_MAX_BITS+7/8)*2+3)
/* Max length of text sig block */
@@ -407,15 +408,14 @@ typedef enum __ns_cert_types {
#define NS_DSA_MAX_BYTES 405
/* Offsets into SIG record rdata to find various values */
-#define NS_SIG_TYPE 0 /* Type flags */
-#define NS_SIG_ALG 2 /* Algorithm */
-#define NS_SIG_LABELS 3 /* How many labels in name */
-#define NS_SIG_OTTL 4 /* Original TTL */
-#define NS_SIG_EXPIR 8 /* Expiration time */
-#define NS_SIG_SIGNED 12 /* Signature time */
-#define NS_SIG_FOOT 16 /* Key footprint */
-#define NS_SIG_SIGNER 18 /* Domain name of who signed it */
-
+#define NS_SIG_TYPE 0 /*%< Type flags */
+#define NS_SIG_ALG 2 /*%< Algorithm */
+#define NS_SIG_LABELS 3 /*%< How many labels in name */
+#define NS_SIG_OTTL 4 /*%< Original TTL */
+#define NS_SIG_EXPIR 8 /*%< Expiration time */
+#define NS_SIG_SIGNED 12 /*%< Signature time */
+#define NS_SIG_FOOT 16 /*%< Key footprint */
+#define NS_SIG_SIGNER 18 /*%< Domain name of who signed it */
/* How RR types are represented as bit-flags in NXT records */
#define NS_NXT_BITS 8
#define NS_NXT_BIT_SET( n,p) (p[(n)/NS_NXT_BITS] |= (0x80>>((n)%NS_NXT_BITS)))
@@ -423,16 +423,17 @@ typedef enum __ns_cert_types {
#define NS_NXT_BIT_ISSET(n,p) (p[(n)/NS_NXT_BITS] & (0x80>>((n)%NS_NXT_BITS)))
#define NS_NXT_MAX 127
-/*
- * EDNS0 extended flags, host order.
+/*%
+ * EDNS0 extended flags and option codes, host order.
*/
#define NS_OPT_DNSSEC_OK 0x8000U
+#define NS_OPT_NSID 3
-/*
+/*%
* Inline versions of get/put short/long. Pointer is advanced.
*/
#define NS_GET16(s, cp) do { \
- register u_char *t_cp = (u_char *)(cp); \
+ register const u_char *t_cp = (const u_char *)(cp); \
(s) = ((u_int16_t)t_cp[0] << 8) \
| ((u_int16_t)t_cp[1]) \
; \
@@ -440,7 +441,7 @@ typedef enum __ns_cert_types {
} while (0)
#define NS_GET32(l, cp) do { \
- register u_char *t_cp = (u_char *)(cp); \
+ register const u_char *t_cp = (const u_char *)(cp); \
(l) = ((u_int32_t)t_cp[0] << 24) \
| ((u_int32_t)t_cp[1] << 16) \
| ((u_int32_t)t_cp[2] << 8) \
@@ -467,43 +468,8 @@ typedef enum __ns_cert_types {
(cp) += NS_INT32SZ; \
} while (0)
-/*
- * ANSI C identifier hiding for bind's lib/nameser.
- */
-#define ns_get16 __ns_get16
-#define ns_get32 __ns_get32
-#define ns_put16 __ns_put16
-#define ns_put32 __ns_put32
-#define ns_initparse __ns_initparse
-#define ns_skiprr __ns_skiprr
-#define ns_parserr __ns_parserr
-#define ns_sprintrr __ns_sprintrr
-#define ns_sprintrrf __ns_sprintrrf
-#define ns_format_ttl __ns_format_ttl
-#define ns_parse_ttl __ns_parse_ttl
-#define ns_datetosecs __ns_datetosecs
-#define ns_name_ntol __ns_name_ntol
-#define ns_name_ntop __ns_name_ntop
-#define ns_name_pton __ns_name_pton
-#define ns_name_unpack __ns_name_unpack
-#define ns_name_pack __ns_name_pack
-#define ns_name_compress __ns_name_compress
-#define ns_name_uncompress __ns_name_uncompress
-#define ns_name_skip __ns_name_skip
-#define ns_name_rollback __ns_name_rollback
-#define ns_sign __ns_sign
-#define ns_sign_tcp __ns_sign_tcp
-#define ns_sign_tcp_init __ns_sign_tcp_init
-#define ns_find_tsig __ns_find_tsig
-#define ns_verify __ns_verify
-#define ns_verify_tcp __ns_verify_tcp
-#define ns_verify_tcp_init __ns_verify_tcp_init
-#define ns_samedomain __ns_samedomain
-#define ns_subdomain __ns_subdomain
-#define ns_makecanon __ns_makecanon
-#define ns_samename __ns_samename
-
__BEGIN_DECLS
+int ns_msg_getflag (ns_msg, int) __THROW;
u_int ns_get16 (const u_char *) __THROW;
u_long ns_get32 (const u_char *) __THROW;
void ns_put16 (u_int, u_char *) __THROW;
@@ -538,8 +504,14 @@ void ns_name_rollback (const u_char *, const u_char **,
const u_char **) __THROW;
int ns_sign (u_char *, int *, int, int, void *,
const u_char *, int, u_char *, int *, time_t) __THROW;
+int ns_sign2 (u_char *, int *, int, int, void *,
+ const u_char *, int, u_char *, int *, time_t,
+ u_char **, u_char **) __THROW;
int ns_sign_tcp (u_char *, int *, int, int,
ns_tcp_tsig_state *, int) __THROW;
+int ns_sign_tcp2 (u_char *, int *, int, int,
+ ns_tcp_tsig_state *, int,
+ u_char **, u_char **) __THROW;
int ns_sign_tcp_init (void *, const u_char *, int,
ns_tcp_tsig_state *) __THROW;
u_char *ns_find_tsig (u_char *, u_char *) __THROW;
@@ -560,3 +532,4 @@ __END_DECLS
#endif
#endif /* !_ARPA_NAMESER_H_ */
+/*! \file */
diff --git a/libc/resolv/arpa/nameser_compat.h b/libc/resolv/arpa/nameser_compat.h
index 8bc6e913d..d59c9e41b 100644
--- a/libc/resolv/arpa/nameser_compat.h
+++ b/libc/resolv/arpa/nameser_compat.h
@@ -26,7 +26,7 @@
* SUCH DAMAGE.
*/
-/*
+/*%
* from nameser.h 8.1 (Berkeley) 6/2/93
* $BINDId: nameser_compat.h,v 8.11 1999/01/02 08:00:58 vixie Exp $
*/
@@ -34,11 +34,11 @@
#ifndef _ARPA_NAMESER_COMPAT_
#define _ARPA_NAMESER_COMPAT_
-#define __BIND 19950621 /* (DEAD) interface version stamp. */
+#define __BIND 19950621 /*%< (DEAD) interface version stamp. */
#include <endian.h>
-/*
+/*%
* Structure for query header. The order of the fields is machine- and
* compiler-dependent, depending on the byte/bit order and the layout
* of bit fields. We use bit fields only in int variables, as this
@@ -46,40 +46,40 @@
*/
typedef struct {
- unsigned id :16; /* query identification number */
+ unsigned id :16; /*%< query identification number */
#if BYTE_ORDER == BIG_ENDIAN
/* fields in third byte */
- unsigned qr: 1; /* response flag */
- unsigned opcode: 4; /* purpose of message */
- unsigned aa: 1; /* authoritive answer */
- unsigned tc: 1; /* truncated message */
- unsigned rd: 1; /* recursion desired */
+ unsigned qr: 1; /*%< response flag */
+ unsigned opcode: 4; /*%< purpose of message */
+ unsigned aa: 1; /*%< authoritive answer */
+ unsigned tc: 1; /*%< truncated message */
+ unsigned rd: 1; /*%< recursion desired */
/* fields in fourth byte */
- unsigned ra: 1; /* recursion available */
- unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
- unsigned ad: 1; /* authentic data from named */
- unsigned cd: 1; /* checking disabled by resolver */
- unsigned rcode :4; /* response code */
+ unsigned ra: 1; /*%< recursion available */
+ unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */
+ unsigned ad: 1; /*%< authentic data from named */
+ unsigned cd: 1; /*%< checking disabled by resolver */
+ unsigned rcode :4; /*%< response code */
#endif
#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
/* fields in third byte */
- unsigned rd :1; /* recursion desired */
- unsigned tc :1; /* truncated message */
- unsigned aa :1; /* authoritive answer */
- unsigned opcode :4; /* purpose of message */
- unsigned qr :1; /* response flag */
+ unsigned rd :1; /*%< recursion desired */
+ unsigned tc :1; /*%< truncated message */
+ unsigned aa :1; /*%< authoritive answer */
+ unsigned opcode :4; /*%< purpose of message */
+ unsigned qr :1; /*%< response flag */
/* fields in fourth byte */
- unsigned rcode :4; /* response code */
- unsigned cd: 1; /* checking disabled by resolver */
- unsigned ad: 1; /* authentic data from named */
- unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
- unsigned ra :1; /* recursion available */
+ unsigned rcode :4; /*%< response code */
+ unsigned cd: 1; /*%< checking disabled by resolver */
+ unsigned ad: 1; /*%< authentic data from named */
+ unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */
+ unsigned ra :1; /*%< recursion available */
#endif
/* remaining bytes */
- unsigned qdcount :16; /* number of question entries */
- unsigned ancount :16; /* number of answer entries */
- unsigned nscount :16; /* number of authority entries */
- unsigned arcount :16; /* number of resource entries */
+ unsigned qdcount :16; /*%< number of question entries */
+ unsigned ancount :16; /*%< number of answer entries */
+ unsigned nscount :16; /*%< number of authority entries */
+ unsigned arcount :16; /*%< number of resource entries */
} HEADER;
#define PACKETSZ NS_PACKETSZ
@@ -91,6 +91,7 @@ typedef struct {
#define RRFIXEDSZ NS_RRFIXEDSZ
#define INT32SZ NS_INT32SZ
#define INT16SZ NS_INT16SZ
+#define INT8SZ NS_INT8SZ
#define INADDRSZ NS_INADDRSZ
#define IN6ADDRSZ NS_IN6ADDRSZ
#define INDIR_MASK NS_CMPRSFLGS
@@ -161,6 +162,7 @@ typedef struct {
#define T_SRV ns_t_srv
#define T_ATMA ns_t_atma
#define T_NAPTR ns_t_naptr
+#define T_A6 ns_t_a6
#define T_DNAME ns_t_dname
#define T_TSIG ns_t_tsig
#define T_IXFR ns_t_ixfr
@@ -182,3 +184,4 @@ typedef struct {
#define PUTLONG NS_PUT32
#endif /* _ARPA_NAMESER_COMPAT_ */
+/*! \file */
diff --git a/libc/resolv/gethnamaddr.c b/libc/resolv/gethnamaddr.c
index 2a9bd0b3c..5cf660a8d 100644
--- a/libc/resolv/gethnamaddr.c
+++ b/libc/resolv/gethnamaddr.c
@@ -621,7 +621,7 @@ gethostbyname2(name, af)
buf.buf = origbuf = (querybuf *) alloca (1024);
if ((n = __libc_res_nsearch(&_res, name, C_IN, type, buf.buf->buf, 1024,
- &buf.ptr, NULL, NULL)) < 0) {
+ &buf.ptr, NULL, NULL, NULL)) < 0) {
if (buf.buf != origbuf)
free (buf.buf);
Dprintf("res_nsearch failed (%d)\n", n);
@@ -716,12 +716,12 @@ gethostbyaddr(addr, len, af)
buf.buf = orig_buf = (querybuf *) alloca (1024);
n = __libc_res_nquery(&_res, qbuf, C_IN, T_PTR, buf.buf->buf, 1024,
- &buf.ptr, NULL, NULL);
+ &buf.ptr, NULL, NULL, NULL);
if (n < 0 && af == AF_INET6 && (_res.options & RES_NOIP6DOTINT) == 0) {
strcpy(qp, "ip6.int");
n = __libc_res_nquery(&_res, qbuf, C_IN, T_PTR, buf.buf->buf,
buf.buf != orig_buf ? MAXPACKET : 1024,
- &buf.ptr, NULL, NULL);
+ &buf.ptr, NULL, NULL, NULL);
}
if (n < 0) {
if (buf.buf != orig_buf)
diff --git a/libc/resolv/ns_date.c b/libc/resolv/ns_date.c
new file mode 100644
index 000000000..3fee9b7b5
--- /dev/null
+++ b/libc/resolv/ns_date.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if !defined(_LIBC) && !defined(lint)
+static const char rcsid[] = "$Id: ns_date.c,v 1.1 2008/08/01 17:15:09 drepper Exp $";
+#endif
+
+/* Import. */
+
+#include <arpa/nameser.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+
+#define SPRINTF(x) ((size_t)sprintf x)
+
+/* Forward. */
+
+static int datepart(const char *, int, int, int, int *);
+
+/* Public. */
+
+/*%
+ * Convert a date in ASCII into the number of seconds since
+ * 1 January 1970 (GMT assumed). Format is yyyymmddhhmmss, all
+ * digits required, no spaces allowed.
+ */
+
+u_int32_t
+ns_datetosecs(const char *cp, int *errp) {
+ struct tm time;
+ u_int32_t result;
+ int mdays, i;
+ static const int days_per_month[12] =
+ {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+
+ if (strlen(cp) != 14U) {
+ *errp = 1;
+ return (0);
+ }
+ *errp = 0;
+
+ memset(&time, 0, sizeof time);
+ time.tm_year = datepart(cp + 0, 4, 1990, 9999, errp) - 1900;
+ time.tm_mon = datepart(cp + 4, 2, 01, 12, errp) - 1;
+ time.tm_mday = datepart(cp + 6, 2, 01, 31, errp);
+ time.tm_hour = datepart(cp + 8, 2, 00, 23, errp);
+ time.tm_min = datepart(cp + 10, 2, 00, 59, errp);
+ time.tm_sec = datepart(cp + 12, 2, 00, 59, errp);
+ if (*errp) /*%< Any parse errors? */
+ return (0);
+
+ /*
+ * OK, now because timegm() is not available in all environments,
+ * we will do it by hand. Roll up sleeves, curse the gods, begin!
+ */
+
+#define SECS_PER_DAY ((u_int32_t)24*60*60)
+#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
+
+ result = time.tm_sec; /*%< Seconds */
+ result += time.tm_min * 60; /*%< Minutes */
+ result += time.tm_hour * (60*60); /*%< Hours */
+ result += (time.tm_mday - 1) * SECS_PER_DAY; /*%< Days */
+ /* Months are trickier. Look without leaping, then leap */
+ mdays = 0;
+ for (i = 0; i < time.tm_mon; i++)
+ mdays += days_per_month[i];
+ result += mdays * SECS_PER_DAY; /*%< Months */
+ if (time.tm_mon > 1 && isleap(1900+time.tm_year))
+ result += SECS_PER_DAY; /*%< Add leapday for this year */
+ /* First figure years without leapdays, then add them in. */
+ /* The loop is slow, FIXME, but simple and accurate. */
+ result += (time.tm_year - 70) * (SECS_PER_DAY*365); /*%< Years */
+ for (i = 70; i < time.tm_year; i++)
+ if (isleap(1900+i))
+ result += SECS_PER_DAY; /*%< Add leapday for prev year */
+ return (result);
+}
+
+/* Private. */
+
+/*%
+ * Parse part of a date. Set error flag if any error.
+ * Don't reset the flag if there is no error.
+ */
+static int
+datepart(const char *buf, int size, int min, int max, int *errp) {
+ int result = 0;
+ int i;
+
+ for (i = 0; i < size; i++) {
+ if (!isdigit((unsigned char)(buf[i])))
+ *errp = 1;
+ result = (result * 10) + buf[i] - '0';
+ }
+ if (result < min)
+ *errp = 1;
+ if (result > max)
+ *errp = 1;
+ return (result);
+}
+
+/*! \file */
diff --git a/libc/resolv/ns_name.c b/libc/resolv/ns_name.c
index ed361915d..adf64bbd9 100644
--- a/libc/resolv/ns_name.c
+++ b/libc/resolv/ns_name.c
@@ -1,18 +1,18 @@
/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996,1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#if !defined(_LIBC) && !defined(lint)
@@ -24,16 +24,41 @@ static const char rcsid[] = "$BINDId: ns_name.c,v 8.15 2000/03/30 22:53:46 vixie
#include <netinet/in.h>
#include <arpa/nameser.h>
-#include <ctype.h>
#include <errno.h>
#include <resolv.h>
#include <string.h>
#include <ctype.h>
+#include <stdlib.h>
+#include <limits.h>
+
+# define SPRINTF(x) ((size_t)sprintf x)
+
+#define NS_TYPE_ELT 0x40 /*%< EDNS0 extended label type */
+#define DNS_LABELTYPE_BITSTRING 0x41
/* Data. */
static const char digits[] = "0123456789";
+static const char digitvalue[256] = {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /*16*/
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /*32*/
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /*48*/
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, /*64*/
+ -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, /*80*/
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /*96*/
+ -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, /*112*/
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /*128*/
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /*256*/
+};
+
/* Forward. */
static int special(int);
@@ -41,31 +66,40 @@ static int printable(int);
static int dn_find(const u_char *, const u_char *,
const u_char * const *,
const u_char * const *);
+static int encode_bitstring(const char **, const char *,
+ unsigned char **, unsigned char **,
+ unsigned const char *);
+static int labellen(const u_char *);
+static int decode_bitstring(const unsigned char **,
+ char *, const char *);
/* Public. */
-/*
- * ns_name_ntop(src, dst, dstsiz)
+/*%
* Convert an encoded domain name to printable ascii as per RFC1035.
+
* return:
- * Number of bytes written to buffer, or -1 (with errno set)
+ *\li Number of bytes written to buffer, or -1 (with errno set)
+ *
* notes:
- * The root is returned as "."
- * All other domains are returned in non absolute form
+ *\li The root is returned as "."
+ *\li All other domains are returned in non absolute form
*/
int
-ns_name_ntop(const u_char *src, char *dst, size_t dstsiz) {
+ns_name_ntop(const u_char *src, char *dst, size_t dstsiz)
+{
const u_char *cp;
char *dn, *eom;
u_char c;
u_int n;
+ int l;
cp = src;
dn = dst;
eom = dst + dstsiz;
while ((n = *cp++) != 0) {
- if ((n & NS_CMPRSFLGS) != 0 && n != 0x41) {
+ if ((n & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
/* Some kind of compression pointer. */
__set_errno (EMSGSIZE);
return (-1);
@@ -77,34 +111,31 @@ ns_name_ntop(const u_char *src, char *dst, size_t dstsiz) {
}
*dn++ = '.';
}
+ if ((l = labellen(cp - 1)) < 0) {
+ __set_errno (EMSGSIZE);
+ return(-1);
+ }
+ if (dn + l >= eom) {
+ __set_errno (EMSGSIZE);
+ return (-1);
+ }
+ if ((n & NS_CMPRSFLGS) == NS_TYPE_ELT) {
+ int m;
- if (n == 0x41) {
- n = *cp++ / 8;
- if (dn + n * 2 + 4 >= eom) {
- __set_errno (EMSGSIZE);
- return (-1);
+ if (n != DNS_LABELTYPE_BITSTRING) {
+ /* XXX: labellen should reject this case */
+ __set_errno (EINVAL);
+ return(-1);
}
- *dn++ = '\\';
- *dn++ = '[';
- *dn++ = 'x';
-
- while (n-- > 0) {
- c = *cp++;
- unsigned u = c >> 4;
- *dn++ = u > 9 ? 'a' + u - 10 : '0' + u;
- u = c & 0xf;
- *dn++ = u > 9 ? 'a' + u - 10 : '0' + u;
+ if ((m = decode_bitstring(&cp, dn, eom)) < 0)
+ {
+ __set_errno (EMSGSIZE);
+ return(-1);
}
-
- *dn++ = ']';
+ dn += m;
continue;
}
-
- if (dn + n >= eom) {
- __set_errno (EMSGSIZE);
- return (-1);
- }
- for ((void)NULL; n > 0; n--) {
+ for ((void)NULL; l > 0; l--) {
c = *cp++;
if (special(c)) {
if (dn + 1 >= eom) {
@@ -146,22 +177,26 @@ ns_name_ntop(const u_char *src, char *dst, size_t dstsiz) {
return (dn - dst);
}
libresolv_hidden_def (ns_name_ntop)
+strong_alias (ns_name_ntop, __ns_name_ntop)
-/*
- * ns_name_pton(src, dst, dstsiz)
+/*%
* Convert a ascii string into an encoded domain name as per RFC1035.
+ *
* return:
- * -1 if it fails
- * 1 if string was fully qualified
- * 0 is string was not fully qualified
+ *
+ *\li -1 if it fails
+ *\li 1 if string was fully qualified
+ *\li 0 is string was not fully qualified
+ *
* notes:
- * Enforces label and domain length limits.
+ *\li Enforces label and domain length limits.
*/
int
-ns_name_pton(const char *src, u_char *dst, size_t dstsiz) {
+ns_name_pton(const char *src, u_char *dst, size_t dstsiz)
+{
u_char *label, *bp, *eom;
- int c, n, escaped;
+ int c, n, escaped, e = 0;
char *cp;
escaped = 0;
@@ -171,7 +206,28 @@ ns_name_pton(const char *src, u_char *dst, size_t dstsiz) {
while ((c = *src++) != 0) {
if (escaped) {
- if ((cp = strchr(digits, c)) != NULL) {
+ if (c == '[') { /*%< start a bit string label */
+ if ((cp = strchr(src, ']')) == NULL) {
+ __set_errno (EINVAL);
+ return(-1);
+ }
+ if ((e = encode_bitstring(&src, cp + 2,
+ &label, &bp, eom))
+ != 0) {
+ __set_errno (e);
+ return(-1);
+ }
+ escaped = 0;
+ label = bp++;
+ if ((c = *src++) == 0)
+ goto done;
+ else if (c != '.') {
+ __set_errno (EINVAL);
+ return(-1);
+ }
+ continue;
+ }
+ else if ((cp = strchr(digits, c)) != NULL) {
n = (cp - digits) * 100;
if ((c = *src++) == 0 ||
(cp = strchr(digits, c)) == NULL) {
@@ -190,41 +246,6 @@ ns_name_pton(const char *src, u_char *dst, size_t dstsiz) {
return (-1);
}
c = n;
- } else if (c == '[' && label == bp - 1 && *src == 'x') {
- /* Theoretically we would have to handle \[o
- as well but we do not since we do not need
- it internally. */
- *label = 0x41;
- label = bp++;
- ++src;
- while (isxdigit (*src)) {
- n = *src > '9' ? *src - 'a' + 10 : *src - '0';
- ++src;
- if (! isxdigit(*src)) {
- __set_errno (EMSGSIZE);
- return (-1);
- }
- n <<= 4;
- n += *src > '9' ? *src - 'a' + 10 : *src - '0';
- if (bp + 1 >= eom) {
- __set_errno (EMSGSIZE);
- return (-1);
- }
- *bp++ = n;
- ++src;
- }
- *label = (bp - label - 1) * 8;
- if (*src++ != ']' || *src++ != '.') {
- __set_errno (EMSGSIZE);
- return (-1);
- }
- escaped = 0;
- label = bp++;
- if (bp >= eom) {
- __set_errno (EMSGSIZE);
- return (-1);
- }
- continue;
}
escaped = 0;
} else if (c == '\\') {
@@ -232,7 +253,7 @@ ns_name_pton(const char *src, u_char *dst, size_t dstsiz) {
continue;
} else if (c == '.') {
c = (bp - label - 1);
- if ((c & NS_CMPRSFLGS) != 0) { /* Label too big. */
+ if ((c & NS_CMPRSFLGS) != 0) { /*%< Label too big. */
__set_errno (EMSGSIZE);
return (-1);
}
@@ -270,10 +291,11 @@ ns_name_pton(const char *src, u_char *dst, size_t dstsiz) {
*bp++ = (u_char)c;
}
c = (bp - label - 1);
- if ((c & NS_CMPRSFLGS) != 0) { /* Label too big. */
+ if ((c & NS_CMPRSFLGS) != 0) { /*%< Label too big. */
__set_errno (EMSGSIZE);
return (-1);
}
+ done:
if (label >= eom) {
__set_errno (EMSGSIZE);
return (-1);
@@ -286,45 +308,57 @@ ns_name_pton(const char *src, u_char *dst, size_t dstsiz) {
}
*bp++ = 0;
}
- if ((bp - dst) > MAXCDNAME) { /* src too big */
+ if ((bp - dst) > MAXCDNAME) { /*%< src too big */
__set_errno (EMSGSIZE);
return (-1);
}
return (0);
}
+libresolv_hidden_def (ns_name_pton)
-/*
- * ns_name_ntol(src, dst, dstsiz)
+/*%
* Convert a network strings labels into all lowercase.
+ *
* return:
- * Number of bytes written to buffer, or -1 (with errno set)
+ *\li Number of bytes written to buffer, or -1 (with errno set)
+ *
* notes:
- * Enforces label and domain length limits.
+ *\li Enforces label and domain length limits.
*/
int
-ns_name_ntol(const u_char *src, u_char *dst, size_t dstsiz) {
+ns_name_ntol(const u_char *src, u_char *dst, size_t dstsiz)
+{
const u_char *cp;
u_char *dn, *eom;
u_char c;
u_int n;
+ int l;
cp = src;
dn = dst;
eom = dst + dstsiz;
+ if (dn >= eom) {
+ __set_errno (EMSGSIZE);
+ return (-1);
+ }
while ((n = *cp++) != 0) {
- if ((n & NS_CMPRSFLGS) != 0) {
+ if ((n & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
/* Some kind of compression pointer. */
__set_errno (EMSGSIZE);
return (-1);
}
*dn++ = n;
- if (dn + n >= eom) {
+ if ((l = labellen(cp - 1)) < 0) {
__set_errno (EMSGSIZE);
return (-1);
}
- for ((void)NULL; n > 0; n--) {
+ if (dn + l >= eom) {
+ __set_errno (EMSGSIZE);
+ return (-1);
+ }
+ for ((void)NULL; l > 0; l--) {
c = *cp++;
if (isupper(c))
*dn++ = tolower(c);
@@ -336,11 +370,11 @@ ns_name_ntol(const u_char *src, u_char *dst, size_t dstsiz) {
return (dn - dst);
}
-/*
- * ns_name_unpack(msg, eom, src, dst, dstsiz)
+/*%
* Unpack a domain name from a message, source may be compressed.
+ *
* return:
- * -1 if it fails, or consumed octets if it succeeds.
+ *\li -1 if it fails, or consumed octets if it succeeds.
*/
int
ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src,
@@ -348,7 +382,7 @@ ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src,
{
const u_char *srcp, *dstlim;
u_char *dstp;
- int n, len, checked;
+ int n, len, checked, l;
len = -1;
checked = 0;
@@ -363,29 +397,22 @@ ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src,
while ((n = *srcp++) != 0) {
/* Check for indirection. */
switch (n & NS_CMPRSFLGS) {
- case 0x40:
- if (n == 0x41) {
- if (dstp + 1 >= dstlim) {
- __set_errno (EMSGSIZE);
- return (-1);
- }
- *dstp++ = 0x41;
- n = *srcp++ / 8;
- ++checked;
- } else {
- __set_errno (EMSGSIZE);
- return (-1); /* flag error */
- }
- /* FALLTHROUGH */
case 0:
+ case NS_TYPE_ELT:
/* Limit checks. */
- if (dstp + n + 1 >= dstlim || srcp + n >= eom) {
+ if ((l = labellen(srcp - 1)) < 0) {
+ __set_errno (EMSGSIZE);
+ return(-1);
+ }
+ if (dstp + l + 1 >= dstlim || srcp + l >= eom) {
__set_errno (EMSGSIZE);
return (-1);
}
- checked += n + 1;
- dstp = mempcpy(dstp, srcp - 1, n + 1);
- srcp += n;
+ checked += l + 1;
+ *dstp++ = n;
+ memcpy(dstp, srcp, l);
+ dstp += l;
+ srcp += l;
break;
case NS_CMPRSFLGS:
@@ -396,7 +423,7 @@ ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src,
if (len < 0)
len = srcp - src + 1;
srcp = msg + (((n & 0x3f) << 8) | (*srcp & 0xff));
- if (srcp < msg || srcp >= eom) { /* Out of range. */
+ if (srcp < msg || srcp >= eom) { /*%< Out of range. */
__set_errno (EMSGSIZE);
return (-1);
}
@@ -414,7 +441,7 @@ ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src,
default:
__set_errno (EMSGSIZE);
- return (-1); /* flag error */
+ return (-1); /*%< flag error */
}
}
*dstp = '\0';
@@ -423,20 +450,23 @@ ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src,
return (len);
}
libresolv_hidden_def (ns_name_unpack)
+strong_alias (ns_name_unpack, __ns_name_unpack)
-/*
- * ns_name_pack(src, dst, dstsiz, dnptrs, lastdnptr)
+/*%
* Pack domain name 'domain' into 'comp_dn'.
+ *
* return:
- * Size of the compressed name, or -1.
+ *\li Size of the compressed name, or -1.
+ *
* notes:
- * 'dnptrs' is an array of pointers to previous compressed names.
- * dnptrs[0] is a pointer to the beginning of the message. The array
+ *\li 'dnptrs' is an array of pointers to previous compressed names.
+ *\li dnptrs[0] is a pointer to the beginning of the message. The array
* ends with NULL.
- * 'lastdnptr' is a pointer to the end of the array pointed to
+ *\li 'lastdnptr' is a pointer to the end of the array pointed to
* by 'dnptrs'.
+ *
* Side effects:
- * The list of pointers in dnptrs is updated for labels inserted into
+ *\li The list of pointers in dnptrs is updated for labels inserted into
* the message as we compress the name. If 'dnptr' is NULL, we don't
* try to compress names. If 'lastdnptr' is NULL, we don't update the
* list.
@@ -458,7 +488,7 @@ ns_name_pack(const u_char *src, u_char *dst, int dstsiz,
if ((msg = *dnptrs++) != NULL) {
for (cpp = dnptrs; *cpp != NULL; cpp++)
(void)NULL;
- lpp = cpp; /* end of list to search */
+ lpp = cpp; /*%< end of list to search */
}
} else
msg = NULL;
@@ -466,19 +496,23 @@ ns_name_pack(const u_char *src, u_char *dst, int dstsiz,
/* make sure the domain we are about to add is legal */
l = 0;
do {
+ int l0;
+
n = *srcp;
- if ((n & NS_CMPRSFLGS) != 0 && n != 0x41) {
+ if ((n & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
__set_errno (EMSGSIZE);
return (-1);
}
- if (n == 0x41)
- n = *++srcp / 8;
- l += n + 1;
+ if ((l0 = labellen(srcp)) < 0) {
+ __set_errno (EINVAL);
+ return(-1);
+ }
+ l += l0 + 1;
if (l > MAXCDNAME) {
__set_errno (EMSGSIZE);
return (-1);
}
- srcp += n + 1;
+ srcp += l0 + 1;
} while (n != 0);
/* from here on we need to reset compression pointer array on error */
@@ -486,7 +520,7 @@ ns_name_pack(const u_char *src, u_char *dst, int dstsiz,
do {
/* Look to see if we can use pointers. */
n = *srcp;
- if (n != 0 && n != 0x41 && msg != NULL) {
+ if (n != 0 && msg != NULL) {
l = dn_find(srcp, msg, (const u_char * const *)dnptrs,
(const u_char * const *)lpp);
if (l >= 0) {
@@ -506,15 +540,11 @@ ns_name_pack(const u_char *src, u_char *dst, int dstsiz,
}
}
/* copy label to buffer */
- if ((n & NS_CMPRSFLGS) != 0 && n != 0x41) { /* Should not happen. */
+ if ((n & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
+ /* Should not happen. */
goto cleanup;
}
- if (n == 0x41) {
- n = *++srcp / 8;
- if (dstp + 1 >= eob)
- goto cleanup;
- *dstp++ = 0x41;
- }
+ n = labellen(srcp);
if (dstp + 1 + n >= eob) {
goto cleanup;
}
@@ -532,14 +562,16 @@ cleanup:
}
return (dstp - dst);
}
+libresolv_hidden_def (ns_name_pack)
-/*
- * ns_name_uncompress(msg, eom, src, dst, dstsiz)
+/*%
* Expand compressed domain name to presentation format.
+ *
* return:
- * Number of bytes read out of `src', or -1 (with errno set).
+ *\li Number of bytes read out of `src', or -1 (with errno set).
+ *
* note:
- * Root domain returns as "." not "".
+ *\li Root domain returns as "." not "".
*/
int
ns_name_uncompress(const u_char *msg, const u_char *eom, const u_char *src,
@@ -554,19 +586,21 @@ ns_name_uncompress(const u_char *msg, const u_char *eom, const u_char *src,
return (-1);
return (n);
}
+libresolv_hidden_def (ns_name_uncompress)
-/*
- * ns_name_compress(src, dst, dstsiz, dnptrs, lastdnptr)
+/*%
* Compress a domain name into wire format, using compression pointers.
+ *
* return:
- * Number of bytes consumed in `dst' or -1 (with errno set).
+ *\li Number of bytes consumed in `dst' or -1 (with errno set).
+ *
* notes:
- * 'dnptrs' is an array of pointers to previous compressed names.
- * dnptrs[0] is a pointer to the beginning of the message.
- * The list ends with NULL. 'lastdnptr' is a pointer to the end of the
+ *\li 'dnptrs' is an array of pointers to previous compressed names.
+ *\li dnptrs[0] is a pointer to the beginning of the message.
+ *\li The list ends with NULL. 'lastdnptr' is a pointer to the end of the
* array pointed to by 'dnptrs'. Side effect is to update the list of
* pointers for labels inserted into the message as we compress the name.
- * If 'dnptr' is NULL, we don't try to compress names. If 'lastdnptr'
+ *\li If 'dnptr' is NULL, we don't try to compress names. If 'lastdnptr'
* is NULL, we don't update the list.
*/
int
@@ -579,8 +613,9 @@ ns_name_compress(const char *src, u_char *dst, size_t dstsiz,
return (-1);
return (ns_name_pack(tmp, dst, dstsiz, dnptrs, lastdnptr));
}
+libresolv_hidden_def (ns_name_compress)
-/*
+/*%
* Reset dnptrs so that there are no active references to pointers at or
* after src.
*/
@@ -597,28 +632,37 @@ ns_name_rollback(const u_char *src, const u_char **dnptrs,
}
}
-/*
- * ns_name_skip(ptrptr, eom)
+/*%
* Advance *ptrptr to skip over the compressed name it points at.
+ *
* return:
- * 0 on success, -1 (with errno set) on failure.
+ *\li 0 on success, -1 (with errno set) on failure.
*/
int
-ns_name_skip(const u_char **ptrptr, const u_char *eom) {
+ns_name_skip(const u_char **ptrptr, const u_char *eom)
+{
const u_char *cp;
u_int n;
+ int l;
cp = *ptrptr;
while (cp < eom && (n = *cp++) != 0) {
/* Check for indirection. */
switch (n & NS_CMPRSFLGS) {
- case 0: /* normal case, n == len */
+ case 0: /*%< normal case, n == len */
cp += n;
continue;
- case NS_CMPRSFLGS: /* indirection */
+ case NS_TYPE_ELT: /*%< EDNS0 extended label */
+ if ((l = labellen(cp - 1)) < 0) {
+ __set_errno (EMSGSIZE);
+ return(-1);
+ }
+ cp += l;
+ continue;
+ case NS_CMPRSFLGS: /*%< indirection */
cp++;
break;
- default: /* illegal type */
+ default: /*%< illegal type */
__set_errno (EMSGSIZE);
return (-1);
}
@@ -631,45 +675,48 @@ ns_name_skip(const u_char **ptrptr, const u_char *eom) {
*ptrptr = cp;
return (0);
}
+libresolv_hidden_def (ns_name_skip)
/* Private. */
-/*
- * special(ch)
+/*%
* Thinking in noninternationalized USASCII (per the DNS spec),
* is this characted special ("in need of quoting") ?
+ *
* return:
- * boolean.
+ *\li boolean.
*/
static int
special(int ch) {
switch (ch) {
- case 0x22: /* '"' */
- case 0x2E: /* '.' */
- case 0x3B: /* ';' */
- case 0x5C: /* '\\' */
+ case 0x22: /*%< '"' */
+ case 0x2E: /*%< '.' */
+ case 0x3B: /*%< ';' */
+ case 0x5C: /*%< '\\' */
+ case 0x28: /*%< '(' */
+ case 0x29: /*%< ')' */
/* Special modifiers in zone files. */
- case 0x40: /* '@' */
- case 0x24: /* '$' */
+ case 0x40: /*%< '@' */
+ case 0x24: /*%< '$' */
return (1);
default:
return (0);
}
}
-/*
- * printable(ch)
+/*%
* Thinking in noninternationalized USASCII (per the DNS spec),
* is this character visible and not a space when printed ?
+ *
* return:
- * boolean.
+ *\li boolean.
*/
static int
printable(int ch) {
return (ch > 0x20 && ch < 0x7f);
}
-/*
+/*%
* Thinking in noninternationalized USASCII (per the DNS spec),
* convert this character to lower case if it's upper case.
*/
@@ -680,14 +727,15 @@ mklower(int ch) {
return (ch);
}
-/*
- * dn_find(domain, msg, dnptrs, lastdnptr)
+/*%
* Search for the counted-label name in an array of compressed names.
+ *
* return:
- * offset from msg if found, or -1.
+ *\li offset from msg if found, or -1.
+ *
* notes:
- * dnptrs is the pointer to the first name on the list,
- * not the pointer to the start of the message.
+ *\li dnptrs is the pointer to the first name on the list,
+ *\li not the pointer to the start of the message.
*/
static int
dn_find(const u_char *domain, const u_char *msg,
@@ -715,9 +763,11 @@ dn_find(const u_char *domain, const u_char *msg,
* check for indirection
*/
switch (n & NS_CMPRSFLGS) {
- case 0: /* normal case, n == len */
+ case 0: /*%< normal case, n == len */
+ n = labellen(cp - 1); /*%< XXX */
if (n != *dn++)
goto next;
+
for ((void)NULL; n > 0; n--)
if (mklower(*dn++) !=
mklower(*cp++))
@@ -728,20 +778,197 @@ dn_find(const u_char *domain, const u_char *msg,
if (*dn)
continue;
goto next;
-
- case NS_CMPRSFLGS: /* indirection */
+ case NS_CMPRSFLGS: /*%< indirection */
cp = msg + (((n & 0x3f) << 8) | *cp);
break;
- default: /* illegal type */
+ default: /*%< illegal type */
__set_errno (EMSGSIZE);
return (-1);
}
}
- next:
+ next: ;
sp += *sp + 1;
}
}
__set_errno (ENOENT);
return (-1);
}
+
+static int
+decode_bitstring(const unsigned char **cpp, char *dn, const char *eom)
+{
+ const unsigned char *cp = *cpp;
+ char *beg = dn, tc;
+ int b, blen, plen, i;
+
+ if ((blen = (*cp & 0xff)) == 0)
+ blen = 256;
+ plen = (blen + 3) / 4;
+ plen += sizeof("\\[x/]") + (blen > 99 ? 3 : (blen > 9) ? 2 : 1);
+ if (dn + plen >= eom)
+ return(-1);
+
+ cp++;
+ i = SPRINTF((dn, "\\[x"));
+ if (i < 0)
+ return (-1);
+ dn += i;
+ for (b = blen; b > 7; b -= 8, cp++) {
+ i = SPRINTF((dn, "%02x", *cp & 0xff));
+ if (i < 0)
+ return (-1);
+ dn += i;
+ }
+ if (b > 4) {
+ tc = *cp++;
+ i = SPRINTF((dn, "%02x", tc & (0xff << (8 - b))));
+ if (i < 0)
+ return (-1);
+ dn += i;
+ } else if (b > 0) {
+ tc = *cp++;
+ i = SPRINTF((dn, "%1x",
+ ((tc >> 4) & 0x0f) & (0x0f << (4 - b))));
+ if (i < 0)
+ return (-1);
+ dn += i;
+ }
+ i = SPRINTF((dn, "/%d]", blen));
+ if (i < 0)
+ return (-1);
+ dn += i;
+
+ *cpp = cp;
+ return(dn - beg);
+}
+
+static int
+encode_bitstring(const char **bp, const char *end, unsigned char **labelp,
+ unsigned char ** dst, unsigned const char *eom)
+{
+ int afterslash = 0;
+ const char *cp = *bp;
+ unsigned char *tp;
+ char c;
+ const char *beg_blen;
+ char *end_blen = NULL;
+ int value = 0, count = 0, tbcount = 0, blen = 0;
+
+ beg_blen = end_blen = NULL;
+
+ /* a bitstring must contain at least 2 characters */
+ if (end - cp < 2)
+ return(EINVAL);
+
+ /* XXX: currently, only hex strings are supported */
+ if (*cp++ != 'x')
+ return(EINVAL);
+ if (!isxdigit((*cp) & 0xff)) /*%< reject '\[x/BLEN]' */
+ return(EINVAL);
+
+ for (tp = *dst + 1; cp < end && tp < eom; cp++) {
+ switch((c = *cp)) {
+ case ']': /*%< end of the bitstring */
+ if (afterslash) {
+ if (beg_blen == NULL)
+ return(EINVAL);
+ blen = (int)strtol(beg_blen, &end_blen, 10);
+ if (*end_blen != ']')
+ return(EINVAL);
+ }
+ if (count)
+ *tp++ = ((value << 4) & 0xff);
+ cp++; /*%< skip ']' */
+ goto done;
+ case '/':
+ afterslash = 1;
+ break;
+ default:
+ if (afterslash) {
+ if (!isdigit(c&0xff))
+ return(EINVAL);
+ if (beg_blen == NULL) {
+
+ if (c == '0') {
+ /* blen never begings with 0 */
+ return(EINVAL);
+ }
+ beg_blen = cp;
+ }
+ } else {
+ if (!isxdigit(c&0xff))
+ return(EINVAL);
+ value <<= 4;
+ value += digitvalue[(int)c];
+ count += 4;
+ tbcount += 4;
+ if (tbcount > 256)
+ return(EINVAL);
+ if (count == 8) {
+ *tp++ = value;
+ count = 0;
+ }
+ }
+ break;
+ }
+ }
+ done:
+ if (cp >= end || tp >= eom)
+ return(EMSGSIZE);
+
+ /*
+ * bit length validation:
+ * If a <length> is present, the number of digits in the <bit-data>
+ * MUST be just sufficient to contain the number of bits specified
+ * by the <length>. If there are insignificant bits in a final
+ * hexadecimal or octal digit, they MUST be zero.
+ * RFC2673, Section 3.2.
+ */
+ if (blen > 0) {
+ int traillen;
+
+ if (((blen + 3) & ~3) != tbcount)
+ return(EINVAL);
+ traillen = tbcount - blen; /*%< between 0 and 3 */
+ if (((value << (8 - traillen)) & 0xff) != 0)
+ return(EINVAL);
+ }
+ else
+ blen = tbcount;
+ if (blen == 256)
+ blen = 0;
+
+ /* encode the type and the significant bit fields */
+ **labelp = DNS_LABELTYPE_BITSTRING;
+ **dst = blen;
+
+ *bp = cp;
+ *dst = tp;
+
+ return(0);
+}
+
+static int
+labellen(const u_char *lp)
+{
+ int bitlen;
+ u_char l = *lp;
+
+ if ((l & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
+ /* should be avoided by the caller */
+ return(-1);
+ }
+
+ if ((l & NS_CMPRSFLGS) == NS_TYPE_ELT) {
+ if (l == DNS_LABELTYPE_BITSTRING) {
+ if ((bitlen = *(lp + 1)) == 0)
+ bitlen = 256;
+ return((bitlen + 7 ) / 8 + 1);
+ }
+ return(-1); /*%< unknwon ELT */
+ }
+ return(l);
+}
+
+/*! \file */
diff --git a/libc/resolv/ns_netint.c b/libc/resolv/ns_netint.c
index 20ecf626d..4318f1887 100644
--- a/libc/resolv/ns_netint.c
+++ b/libc/resolv/ns_netint.c
@@ -1,18 +1,18 @@
/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996,1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#if !defined(_LIBC) && !defined(lint)
@@ -34,6 +34,7 @@ ns_get16(const u_char *src) {
return (dst);
}
libresolv_hidden_def (ns_get16)
+strong_alias (ns_get16, __ns_get16)
u_long
ns_get32(const u_char *src) {
@@ -43,13 +44,18 @@ ns_get32(const u_char *src) {
return (dst);
}
libresolv_hidden_def (ns_get32)
+strong_alias (ns_get32, __ns_get32)
void
ns_put16(u_int src, u_char *dst) {
NS_PUT16(src, dst);
}
+libresolv_hidden_def (ns_put16)
void
ns_put32(u_long src, u_char *dst) {
NS_PUT32(src, dst);
}
+libresolv_hidden_def (ns_put32)
+
+/*! \file */
diff --git a/libc/resolv/ns_parse.c b/libc/resolv/ns_parse.c
index d305eae53..712469be1 100644
--- a/libc/resolv/ns_parse.c
+++ b/libc/resolv/ns_parse.c
@@ -1,18 +1,18 @@
/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996,1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#if !defined(_LIBC) && !defined(lint)
@@ -41,25 +41,30 @@ static void setsection(ns_msg *msg, ns_sect sect);
/* Public. */
/* These need to be in the same order as the nres.h:ns_flag enum. */
-struct _ns_flagdata _ns_flagdata[16] = {
- { 0x8000, 15 }, /* qr. */
- { 0x7800, 11 }, /* opcode. */
- { 0x0400, 10 }, /* aa. */
- { 0x0200, 9 }, /* tc. */
- { 0x0100, 8 }, /* rd. */
- { 0x0080, 7 }, /* ra. */
- { 0x0040, 6 }, /* z. */
- { 0x0020, 5 }, /* ad. */
- { 0x0010, 4 }, /* cd. */
- { 0x000f, 0 }, /* rcode. */
- { 0x0000, 0 }, /* expansion (1/6). */
- { 0x0000, 0 }, /* expansion (2/6). */
- { 0x0000, 0 }, /* expansion (3/6). */
- { 0x0000, 0 }, /* expansion (4/6). */
- { 0x0000, 0 }, /* expansion (5/6). */
- { 0x0000, 0 }, /* expansion (6/6). */
+const struct _ns_flagdata _ns_flagdata[16] = {
+ { 0x8000, 15 }, /*%< qr. */
+ { 0x7800, 11 }, /*%< opcode. */
+ { 0x0400, 10 }, /*%< aa. */
+ { 0x0200, 9 }, /*%< tc. */
+ { 0x0100, 8 }, /*%< rd. */
+ { 0x0080, 7 }, /*%< ra. */
+ { 0x0040, 6 }, /*%< z. */
+ { 0x0020, 5 }, /*%< ad. */
+ { 0x0010, 4 }, /*%< cd. */
+ { 0x000f, 0 }, /*%< rcode. */
+ { 0x0000, 0 }, /*%< expansion (1/6). */
+ { 0x0000, 0 }, /*%< expansion (2/6). */
+ { 0x0000, 0 }, /*%< expansion (3/6). */
+ { 0x0000, 0 }, /*%< expansion (4/6). */
+ { 0x0000, 0 }, /*%< expansion (5/6). */
+ { 0x0000, 0 }, /*%< expansion (6/6). */
};
+#undef ns_msg_getflag
+int ns_msg_getflag(ns_msg handle, int flag) {
+ return(((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift);
+}
+
int
ns_skiprr(const u_char *ptr, const u_char *eom, ns_sect section, int count) {
const u_char *optr = ptr;
@@ -83,6 +88,7 @@ ns_skiprr(const u_char *ptr, const u_char *eom, ns_sect section, int count) {
RETERR(EMSGSIZE);
return (ptr - optr);
}
+libresolv_hidden_def (ns_skiprr)
int
ns_initparse(const u_char *msg, int msglen, ns_msg *handle) {
@@ -120,13 +126,16 @@ ns_initparse(const u_char *msg, int msglen, ns_msg *handle) {
setsection(handle, ns_s_max);
return (0);
}
+libresolv_hidden_def (ns_initparse)
int
ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) {
int b;
+ int tmp;
/* Make section right. */
- if (section < 0 || section >= ns_s_max)
+ tmp = section;
+ if (tmp < 0 || section >= ns_s_max)
RETERR(ENODEV);
if (section != handle->_sect)
setsection(handle, section);
@@ -139,38 +148,38 @@ ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) {
if (rrnum < handle->_rrnum)
setsection(handle, section);
if (rrnum > handle->_rrnum) {
- b = ns_skiprr(handle->_ptr, handle->_eom, section,
+ b = ns_skiprr(handle->_msg_ptr, handle->_eom, section,
rrnum - handle->_rrnum);
if (b < 0)
return (-1);
- handle->_ptr += b;
+ handle->_msg_ptr += b;
handle->_rrnum = rrnum;
}
/* Do the parse. */
b = dn_expand(handle->_msg, handle->_eom,
- handle->_ptr, rr->name, NS_MAXDNAME);
+ handle->_msg_ptr, rr->name, NS_MAXDNAME);
if (b < 0)
return (-1);
- handle->_ptr += b;
- if (handle->_ptr + NS_INT16SZ + NS_INT16SZ > handle->_eom)
+ handle->_msg_ptr += b;
+ if (handle->_msg_ptr + NS_INT16SZ + NS_INT16SZ > handle->_eom)
RETERR(EMSGSIZE);
- NS_GET16(rr->type, handle->_ptr);
- NS_GET16(rr->rr_class, handle->_ptr);
+ NS_GET16(rr->type, handle->_msg_ptr);
+ NS_GET16(rr->rr_class, handle->_msg_ptr);
if (section == ns_s_qd) {
rr->ttl = 0;
rr->rdlength = 0;
rr->rdata = NULL;
} else {
- if (handle->_ptr + NS_INT32SZ + NS_INT16SZ > handle->_eom)
+ if (handle->_msg_ptr + NS_INT32SZ + NS_INT16SZ > handle->_eom)
RETERR(EMSGSIZE);
- NS_GET32(rr->ttl, handle->_ptr);
- NS_GET16(rr->rdlength, handle->_ptr);
- if (handle->_ptr + rr->rdlength > handle->_eom)
+ NS_GET32(rr->ttl, handle->_msg_ptr);
+ NS_GET16(rr->rdlength, handle->_msg_ptr);
+ if (handle->_msg_ptr + rr->rdlength > handle->_eom)
RETERR(EMSGSIZE);
- rr->rdata = handle->_ptr;
- handle->_ptr += rr->rdlength;
+ rr->rdata = handle->_msg_ptr;
+ handle->_msg_ptr += rr->rdlength;
}
if (++handle->_rrnum > handle->_counts[(int)section])
setsection(handle, (ns_sect)((int)section + 1));
@@ -178,6 +187,7 @@ ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) {
/* All done. */
return (0);
}
+libresolv_hidden_def (ns_parserr)
/* Private. */
@@ -186,9 +196,11 @@ setsection(ns_msg *msg, ns_sect sect) {
msg->_sect = sect;
if (sect == ns_s_max) {
msg->_rrnum = -1;
- msg->_ptr = NULL;
+ msg->_msg_ptr = NULL;
} else {
msg->_rrnum = 0;
- msg->_ptr = msg->_sections[(int)sect];
+ msg->_msg_ptr = msg->_sections[(int)sect];
}
}
+
+/*! \file */
diff --git a/libc/resolv/ns_print.c b/libc/resolv/ns_print.c
index b0b7a1046..36d39784a 100644
--- a/libc/resolv/ns_print.c
+++ b/libc/resolv/ns_print.c
@@ -1,4 +1,5 @@
/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
@@ -34,11 +35,7 @@ static const char rcsid[] = "$BINDId: ns_print.c,v 8.18 2000/02/29 05:48:12 vixi
#include <string.h>
#include <ctype.h>
-#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
-#else
-# define SPRINTF(x) ((size_t)sprintf x)
-#endif
+#define SPRINTF(x) ((size_t)sprintf x)
/* Forward. */
@@ -54,11 +51,7 @@ static int addstr(const char *src, size_t len,
static int addtab(size_t len, size_t target, int spaced,
char **buf, size_t *buflen);
-/* Proto. */
-
-#ifndef _LIBC
-u_int16_t dst_s_dns_key_id(const u_char *, const int);
-#endif
+static u_int16_t dst_s_dns_key_id(const u_char *, const int);
/* Macros. */
@@ -70,12 +63,11 @@ u_int16_t dst_s_dns_key_id(const u_char *, const int);
/* Public. */
-/*
- * int
- * ns_sprintrr(handle, rr, name_ctx, origin, buf, buflen)
+/*%
* Convert an RR to presentation format.
+ *
* return:
- * Number of characters written to buf, or -1 (check errno).
+ *\li Number of characters written to buf, or -1 (check errno).
*/
int
ns_sprintrr(const ns_msg *handle, const ns_rr *rr,
@@ -90,14 +82,13 @@ ns_sprintrr(const ns_msg *handle, const ns_rr *rr,
name_ctx, origin, buf, buflen);
return (n);
}
+libresolv_hidden_def (ns_sprintrr)
-/*
- * int
- * ns_sprintrrf(msg, msglen, name, class, type, ttl, rdata, rdlen,
- * name_ctx, origin, buf, buflen)
+/*%
* Convert the fields of an RR into presentation format.
+ *
* return:
- * Number of characters written to buf, or -1 (check errno).
+ *\li Number of characters written to buf, or -1 (check errno).
*/
int
ns_sprintrrf(const u_char *msg, size_t msglen,
@@ -122,14 +113,17 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
T(addstr("\t\t\t", 3, &buf, &buflen));
} else {
len = prune_origin(name, origin);
- if (len == 0) {
+ if (*name == '\0') {
+ goto root;
+ } else if (len == 0) {
T(addstr("@\t\t\t", 4, &buf, &buflen));
} else {
T(addstr(name, len, &buf, &buflen));
/* Origin not used or not root, and no trailing dot? */
if (((origin == NULL || origin[0] == '\0') ||
- (origin[0] != '.' && origin[1] != '\0' &&
- name[len] == '\0')) && name[len - 1] != '.') {
+ (origin[0] != '.' && origin[1] != '\0' &&
+ name[len] == '\0')) && name[len - 1] != '.') {
+ root:
T(addstr(".", 1, &buf, &buflen));
len++;
}
@@ -151,7 +145,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
*/
switch (type) {
case ns_t_a:
- if (rdlen != NS_INADDRSZ)
+ if (rdlen != (size_t)NS_INADDRSZ)
goto formerr;
(void) inet_ntop(AF_INET, rdata, buf, buflen);
addlen(strlen(buf), &buf, &buflen);
@@ -163,6 +157,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
case ns_t_mr:
case ns_t_ns:
case ns_t_ptr:
+ case ns_t_dname:
T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
break;
@@ -254,7 +249,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
case ns_t_rt: {
u_int t;
- if (rdlen < NS_INT16SZ)
+ if (rdlen < (size_t)NS_INT16SZ)
goto formerr;
/* Priority. */
@@ -272,7 +267,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
case ns_t_px: {
u_int t;
- if (rdlen < NS_INT16SZ)
+ if (rdlen < (size_t)NS_INT16SZ)
goto formerr;
/* Priority. */
@@ -310,9 +305,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
break;
case ns_t_nsap: {
- /* 2*255 for hex digits, 128 for '.' and '\0', 2 for
- 0x if inet_nsap_ntoa starts using it. */
- char t[255*2 + 128 + 2];
+ char t[2+255*3];
(void) inet_nsap_ntoa(rdlen, rdata, t);
T(addstr(t, strlen(t), &buf, &buflen));
@@ -320,7 +313,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
}
case ns_t_aaaa:
- if (rdlen != NS_IN6ADDRSZ)
+ if (rdlen != (size_t)NS_IN6ADDRSZ)
goto formerr;
(void) inet_ntop(AF_INET6, rdata, buf, buflen);
addlen(strlen(buf), &buf, &buflen);
@@ -339,7 +332,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
u_int order, preference;
char t[50];
- if (rdlen < 2*NS_INT16SZ)
+ if (rdlen < 2U*NS_INT16SZ)
goto formerr;
/* Order, Precedence. */
@@ -380,7 +373,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
u_int priority, weight, port;
char t[50];
- if (rdlen < NS_INT16SZ*3)
+ if (rdlen < 3U*NS_INT16SZ)
goto formerr;
/* Priority, Weight, Port. */
@@ -409,7 +402,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
case ns_t_wks: {
int n, lcnt;
- if (rdlen < NS_INT32SZ + 1)
+ if (rdlen < 1U + NS_INT32SZ)
goto formerr;
/* Address. */
@@ -448,13 +441,12 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
}
case ns_t_key: {
-#ifndef _LIBC
char base64_key[NS_MD5RSA_MAX_BASE64];
u_int keyflags, protocol, algorithm, key_id;
const char *leader;
int n;
- if (rdlen < NS_INT16SZ + NS_INT8SZ + NS_INT8SZ)
+ if (rdlen < 0U + NS_INT16SZ + NS_INT8SZ + NS_INT8SZ)
goto formerr;
/* Key flags, Protocol, Algorithm. */
@@ -486,20 +478,18 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
T(addstr(" )", 2, &buf, &buflen));
n = SPRINTF((tmp, " ; key_tag= %u", key_id));
T(addstr(tmp, n, &buf, &buflen));
-#endif /* !_LIBC */
break;
}
case ns_t_sig: {
-#ifndef _LIBC
char base64_key[NS_MD5RSA_MAX_BASE64];
u_int type, algorithm, labels, footprint;
const char *leader;
u_long t;
int n;
- if (rdlen < 22)
+ if (rdlen < 22U)
goto formerr;
/* Type covered, Algorithm, Label count, Original TTL. */
@@ -549,7 +539,6 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
}
if (len > 15)
T(addstr(" )", 2, &buf, &buflen));
-#endif /* !_LIBC */
break;
}
@@ -571,8 +560,10 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
case ns_t_cert: {
u_int c_type, key_tag, alg;
- int n, siz;
- char base64_cert[8192], *leader, tmp[40];
+ int n;
+ unsigned int siz;
+ char base64_cert[8192], tmp[40];
+ const char *leader;
c_type = ns_get16(rdata); rdata += NS_INT16SZ;
key_tag = ns_get16(rdata); rdata += NS_INT16SZ;
@@ -582,7 +573,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
T(addstr(tmp, len, &buf, &buflen));
siz = (edata-rdata)*4/3 + 4; /* "+4" accounts for trailing \0 */
if (siz > sizeof(base64_cert) * 3/4) {
- char *str = "record too long to print";
+ const char *str = "record too long to print";
T(addstr(str, strlen(str), &buf, &buflen));
}
else {
@@ -610,16 +601,47 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
break;
}
+ case ns_t_tkey: {
+ /* KJD - need to complete this */
+ u_long t;
+ int mode, err, keysize;
+
+ /* Algorithm name. */
+ T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
+ T(addstr(" ", 1, &buf, &buflen));
+
+ /* Inception. */
+ t = ns_get32(rdata); rdata += NS_INT32SZ;
+ len = SPRINTF((tmp, "%s ", p_secstodate(t)));
+ T(addstr(tmp, len, &buf, &buflen));
+
+ /* Experation. */
+ t = ns_get32(rdata); rdata += NS_INT32SZ;
+ len = SPRINTF((tmp, "%s ", p_secstodate(t)));
+ T(addstr(tmp, len, &buf, &buflen));
+
+ /* Mode , Error, Key Size. */
+ /* Priority, Weight, Port. */
+ mode = ns_get16(rdata); rdata += NS_INT16SZ;
+ err = ns_get16(rdata); rdata += NS_INT16SZ;
+ keysize = ns_get16(rdata); rdata += NS_INT16SZ;
+ len = SPRINTF((tmp, "%u %u %u ", mode, err, keysize));
+ T(addstr(tmp, len, &buf, &buflen));
+
+ /* XXX need to dump key, print otherdata length & other data */
+ break;
+ }
+
case ns_t_tsig: {
/* BEW - need to complete this */
int n;
T(len = addname(msg, msglen, &rdata, origin, &buf, &buflen));
T(addstr(" ", 1, &buf, &buflen));
- rdata += 8; /* time */
+ rdata += 8; /*%< time */
n = ns_get16(rdata); rdata += INT16SZ;
- rdata += n; /* sig */
- n = ns_get16(rdata); rdata += INT16SZ; /* original id */
+ rdata += n; /*%< sig */
+ n = ns_get16(rdata); rdata += INT16SZ; /*%< original id */
sprintf(buf, "%d", ns_get16(rdata));
rdata += INT16SZ;
addlen(strlen(buf), &buf, &buflen);
@@ -677,7 +699,8 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
int n, m;
char *p;
- len = SPRINTF((tmp, "\\#(\t\t; %s", comment));
+ len = SPRINTF((tmp, "\\# %u%s\t; %s", (unsigned)(edata - rdata),
+ rdlen != 0U ? " (" : "", comment));
T(addstr(tmp, len, &buf, &buflen));
while (rdata < edata) {
p = tmp;
@@ -703,10 +726,11 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
return (buf - obuf);
}
}
+libresolv_hidden_def (ns_sprintrrf)
/* Private. */
-/*
+/*%
* size_t
* prune_origin(name, origin)
* Find out if the name is at or under the current origin.
@@ -739,7 +763,7 @@ prune_origin(const char *name, const char *origin) {
return (name - oname);
}
-/*
+/*%
* int
* charstr(rdata, edata, buf, buflen)
* Format a <character-string> into the presentation buffer.
@@ -795,9 +819,11 @@ addname(const u_char *msg, size_t msglen,
n = dn_expand(msg, msg + msglen, *pp, *buf, *buflen);
if (n < 0)
- goto enospc; /* Guess. */
+ goto enospc; /*%< Guess. */
newlen = prune_origin(*buf, origin);
- if (newlen == 0) {
+ if (**buf == '\0') {
+ goto root;
+ } else if (newlen == 0U) {
/* Use "@" instead of name. */
if (newlen + 2 > *buflen)
goto enospc; /* No room for "@\0". */
@@ -808,6 +834,7 @@ addname(const u_char *msg, size_t msglen,
(origin[0] != '.' && origin[1] != '\0' &&
(*buf)[newlen] == '\0')) && (*buf)[newlen - 1] != '.') {
/* No trailing dot. */
+ root:
if (newlen + 2 > *buflen)
goto enospc; /* No room for ".\0". */
(*buf)[newlen++] = '.';
@@ -864,3 +891,81 @@ addtab(size_t len, size_t target, int spaced, char **buf, size_t *buflen) {
}
return (spaced);
}
+
+/* DST algorithm codes */
+#define KEY_RSA 1
+#define KEY_HMAC_MD5 157
+
+/*%
+ * calculates a checksum used in dst for an id.
+ * takes an array of bytes and a length.
+ * returns a 16 bit checksum.
+ */
+static u_int16_t
+dst_s_id_calc(const u_char *key, const int keysize)
+{
+ u_int32_t ac;
+ const u_char *kp = key;
+ int size = keysize;
+
+ if (!key || (keysize <= 0))
+ return (0xffffU);
+
+ for (ac = 0; size > 1; size -= 2, kp += 2)
+ ac += ((*kp) << 8) + *(kp + 1);
+
+ if (size > 0)
+ ac += ((*kp) << 8);
+ ac += (ac >> 16) & 0xffff;
+
+ return (ac & 0xffff);
+}
+
+/*%
+ * dst_s_get_int16
+ * This routine extracts a 16 bit integer from a two byte character
+ * string. The character string is assumed to be in network byte
+ * order and may be unaligned. The number returned is in host order.
+ * Parameter
+ * buf A two byte character string.
+ * Return
+ * The converted integer value.
+ */
+
+static u_int16_t
+dst_s_get_int16(const u_char *buf)
+{
+ register u_int16_t a = 0;
+ a = ((u_int16_t)(buf[0] << 8)) | ((u_int16_t)(buf[1]));
+ return (a);
+}
+
+/*%
+ * dst_s_dns_key_id() Function to calculate DNSSEC footprint from KEY record
+ * rdata
+ * Input:
+ * dns_key_rdata: the raw data in wire format
+ * rdata_len: the size of the input data
+ * Output:
+ * the key footprint/id calculated from the key data
+ */
+static u_int16_t
+dst_s_dns_key_id(const u_char *dns_key_rdata, const int rdata_len)
+{
+ if (!dns_key_rdata)
+ return 0;
+
+ /* compute id */
+ if (dns_key_rdata[3] == KEY_RSA) /*%< Algorithm RSA */
+ return dst_s_get_int16((const u_char *)
+ &dns_key_rdata[rdata_len - 3]);
+ else if (dns_key_rdata[3] == KEY_HMAC_MD5)
+ /* compatibility */
+ return 0;
+ else
+ /* compute a checksum on the key part of the key rr */
+ return dst_s_id_calc(dns_key_rdata, rdata_len);
+}
+
+
+/*! \file */
diff --git a/libc/resolv/ns_samedomain.c b/libc/resolv/ns_samedomain.c
index 1fb1c552d..44b843a74 100644
--- a/libc/resolv/ns_samedomain.c
+++ b/libc/resolv/ns_samedomain.c
@@ -1,4 +1,5 @@
/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995,1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
@@ -24,21 +25,22 @@ static const char rcsid[] = "$BINDId: ns_samedomain.c,v 8.9 1999/10/15 21:06:51
#include <errno.h>
#include <string.h>
-/*
- * int
- * ns_samedomain(a, b)
+/*%
* Check whether a name belongs to a domain.
+ *
* Inputs:
- * a - the domain whose ancestory is being verified
- * b - the potential ancestor we're checking against
+ *\li a - the domain whose ancestory is being verified
+ *\li b - the potential ancestor we're checking against
+ *
* Return:
- * boolean - is a at or below b?
+ *\li boolean - is a at or below b?
+ *
* Notes:
- * Trailing dots are first removed from name and domain.
+ *\li Trailing dots are first removed from name and domain.
* Always compare complete subdomains, not only whether the
* domain name is the trailing string of the given name.
*
- * "host.foobar.top" lies in "foobar.top" and in "top" and in ""
+ *\li "host.foobar.top" lies in "foobar.top" and in "top" and in ""
* but NOT in "bar.top"
*/
@@ -52,7 +54,7 @@ ns_samedomain(const char *a, const char *b) {
lb = strlen(b);
/* Ignore a trailing label separator (i.e. an unescaped dot) in 'a'. */
- if (la != 0 && a[la - 1] == '.') {
+ if (la != 0U && a[la - 1] == '.') {
escaped = 0;
/* Note this loop doesn't get executed if la==1. */
for (i = la - 2; i >= 0; i--)
@@ -68,7 +70,7 @@ ns_samedomain(const char *a, const char *b) {
}
/* Ignore a trailing label separator (i.e. an unescaped dot) in 'b'. */
- if (lb != 0 && b[lb - 1] == '.') {
+ if (lb != 0U && b[lb - 1] == '.') {
escaped = 0;
/* note this loop doesn't get executed if lb==1 */
for (i = lb - 2; i >= 0; i--)
@@ -84,7 +86,7 @@ ns_samedomain(const char *a, const char *b) {
}
/* lb == 0 means 'b' is the root domain, so 'a' must be in 'b'. */
- if (lb == 0)
+ if (lb == 0U)
return (1);
/* 'b' longer than 'a' means 'a' can't be in 'b'. */
@@ -121,24 +123,23 @@ ns_samedomain(const char *a, const char *b) {
*/
escaped = 0;
for (i = diff - 2; i >= 0; i--)
- if (a[i] == '\\')
+ if (a[i] == '\\') {
if (escaped)
escaped = 0;
else
escaped = 1;
- else
+ } else
break;
if (escaped)
return (0);
-
+
/* Now compare aligned trailing substring. */
cp = a + diff;
return (strncasecmp(cp, b, lb) == 0);
}
+libresolv_hidden_def (ns_samedomain)
-/*
- * int
- * ns_subdomain(a, b)
+/*%
* is "a" a subdomain of "b"?
*/
int
@@ -146,30 +147,31 @@ ns_subdomain(const char *a, const char *b) {
return (ns_samename(a, b) != 1 && ns_samedomain(a, b));
}
-/*
- * int
- * ns_makecanon(src, dst, dstsize)
+/*%
* make a canonical copy of domain name "src"
+ *
* notes:
+ * \code
* foo -> foo.
* foo. -> foo.
* foo.. -> foo.
* foo\. -> foo\..
* foo\\. -> foo\\.
+ * \endcode
*/
int
ns_makecanon(const char *src, char *dst, size_t dstsize) {
size_t n = strlen(src);
- if (n + sizeof "." > dstsize) {
+ if (n + sizeof "." > dstsize) { /*%< Note: sizeof == 2 */
__set_errno (EMSGSIZE);
return (-1);
}
strcpy(dst, src);
- while (n > 0 && dst[n - 1] == '.') /* Ends in "." */
- if (n > 1 && dst[n - 2] == '\\' && /* Ends in "\." */
- (n < 2 || dst[n - 3] != '\\')) /* But not "\\." */
+ while (n >= 1U && dst[n - 1] == '.') /*%< Ends in "." */
+ if (n >= 2U && dst[n - 2] == '\\' && /*%< Ends in "\." */
+ (n < 3U || dst[n - 3] != '\\')) /*%< But not "\\." */
break;
else
dst[--n] = '\0';
@@ -177,15 +179,15 @@ ns_makecanon(const char *src, char *dst, size_t dstsize) {
dst[n] = '\0';
return (0);
}
+libresolv_hidden_def (ns_makecanon)
-/*
- * int
- * ns_samename(a, b)
+/*%
* determine whether domain name "a" is the same as domain name "b"
+ *
* return:
- * -1 on error
- * 0 if names differ
- * 1 if names are the same
+ *\li -1 on error
+ *\li 0 if names differ
+ *\li 1 if names are the same
*/
int
@@ -200,3 +202,6 @@ ns_samename(const char *a, const char *b) {
else
return (0);
}
+libresolv_hidden_def (ns_samename)
+
+/*! \file */
diff --git a/libc/resolv/ns_ttl.c b/libc/resolv/ns_ttl.c
index 0f74178bb..d4c98bcf3 100644
--- a/libc/resolv/ns_ttl.c
+++ b/libc/resolv/ns_ttl.c
@@ -1,4 +1,5 @@
/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996,1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
@@ -88,8 +89,8 @@ ns_format_ttl(u_long src, char *dst, size_t dstlen) {
return (dst - odst);
}
+libresolv_hidden_def (ns_format_ttl)
-#ifndef SHARED
// Seems not to be needed. It's not exported from the DSO. Some libresolv.a
// might depend on it so we let it in.
int
@@ -132,7 +133,8 @@ ns_parse_ttl(const char *src, u_long *dst) {
goto einval;
else
ttl += tmp;
- }
+ } else if (!dirty)
+ goto einval;
*dst = ttl;
return (0);
@@ -140,7 +142,6 @@ ns_parse_ttl(const char *src, u_long *dst) {
__set_errno (EINVAL);
return (-1);
}
-#endif
/* Private. */
@@ -157,3 +158,5 @@ fmt1(int t, char s, char **buf, size_t *buflen) {
*buflen -= len;
return (0);
}
+
+/*! \file */
diff --git a/libc/resolv/nss_dns/dns-canon.c b/libc/resolv/nss_dns/dns-canon.c
index 47949b862..50a0fc026 100644
--- a/libc/resolv/nss_dns/dns-canon.c
+++ b/libc/resolv/nss_dns/dns-canon.c
@@ -61,7 +61,8 @@ _nss_dns_getcanonname_r (const char *name, char *buffer, size_t buflen,
for (int i = 0; i < nqtypes; ++i)
{
int r = __libc_res_nquery (&_res, name, ns_c_in, qtypes[i],
- buf, sizeof (buf), &ansp.ptr, NULL, NULL);
+ buf, sizeof (buf), &ansp.ptr, NULL, NULL,
+ NULL);
if (r > 0)
{
/* We need to decode the response. Just one question record.
@@ -133,14 +134,14 @@ _nss_dns_getcanonname_r (const char *name, char *buffer, size_t buflen,
if (type != ns_t_cname)
goto unavail;
- if (ns_get16 (ptr) != ns_c_in)
+ if (__ns_get16 (ptr) != ns_c_in)
goto unavail;
/* Also skip over the TTL. */
ptr += sizeof (uint16_t) + sizeof (uint32_t);
/* Skip over the data length and data. */
- ptr += sizeof (uint16_t) + ns_get16 (ptr);
+ ptr += sizeof (uint16_t) + __ns_get16 (ptr);
}
}
}
diff --git a/libc/resolv/nss_dns/dns-host.c b/libc/resolv/nss_dns/dns-host.c
index cae077445..4d43dec94 100644
--- a/libc/resolv/nss_dns/dns-host.c
+++ b/libc/resolv/nss_dns/dns-host.c
@@ -195,7 +195,7 @@ _nss_dns_gethostbyname3_r (const char *name, int af, struct hostent *result,
host_buffer.buf = orig_host_buffer = (querybuf *) alloca (1024);
n = __libc_res_nsearch (&_res, name, C_IN, type, host_buffer.buf->buf,
- 1024, &host_buffer.ptr, NULL, NULL);
+ 1024, &host_buffer.ptr, NULL, NULL, NULL);
if (n < 0)
{
status = (errno == ECONNREFUSED
@@ -213,7 +213,7 @@ _nss_dns_gethostbyname3_r (const char *name, int af, struct hostent *result,
n = __libc_res_nsearch (&_res, name, C_IN, T_A, host_buffer.buf->buf,
host_buffer.buf != orig_host_buffer
? MAXPACKET : 1024, &host_buffer.ptr,
- NULL, NULL);
+ NULL, NULL, NULL);
if (n < 0)
{
@@ -273,8 +273,6 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
if (__res_maybe_init (&_res, 0) == -1)
return NSS_STATUS_UNAVAIL;
- char tmp[NS_MAXDNAME];
-
/*
* if there aren't any dots, it could be a user-level alias.
* this is also done in res_query() since we are not the only
@@ -282,7 +280,8 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
*/
if (strchr (name, '.') == NULL)
{
- const char *cp = res_hostalias (&_res, name, tmp, sizeof (tmp));
+ char *tmp = alloca (NS_MAXDNAME);
+ const char *cp = res_hostalias (&_res, name, tmp, NS_MAXDNAME);
if (cp != NULL)
name = cp;
}
@@ -296,12 +295,13 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
host_buffer.buf = orig_host_buffer = (querybuf *) alloca (2048);
u_char *ans2p = NULL;
int nans2p = 0;
+ int resplen2 = 0;
int olderr = errno;
enum nss_status status;
int n = __libc_res_nsearch (&_res, name, C_IN, T_UNSPEC,
host_buffer.buf->buf, 2048, &host_buffer.ptr,
- &ans2p, &nans2p);
+ &ans2p, &nans2p, &resplen2);
if (n < 0)
{
status = (errno == ECONNREFUSED
@@ -319,7 +319,7 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
}
status = gaih_getanswer(host_buffer.buf, n, (const querybuf *) ans2p,
- nans2p, name, pat, buffer, buflen,
+ resplen2, name, pat, buffer, buflen,
errnop, herrnop, ttlp);
if (host_buffer.buf != orig_host_buffer)
@@ -417,7 +417,7 @@ _nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af,
strcpy (qp, "].ip6.arpa");
n = __libc_res_nquery (&_res, qbuf, C_IN, T_PTR,
host_buffer.buf->buf, 1024, &host_buffer.ptr,
- NULL, NULL);
+ NULL, NULL, NULL);
if (n >= 0)
goto got_it_already;
}
@@ -438,14 +438,14 @@ _nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af,
}
n = __libc_res_nquery (&_res, qbuf, C_IN, T_PTR, host_buffer.buf->buf,
- 1024, &host_buffer.ptr, NULL, NULL);
+ 1024, &host_buffer.ptr, NULL, NULL, NULL);
if (n < 0 && af == AF_INET6 && (_res.options & RES_NOIP6DOTINT) == 0)
{
strcpy (qp, "ip6.int");
n = __libc_res_nquery (&_res, qbuf, C_IN, T_PTR, host_buffer.buf->buf,
host_buffer.buf != orig_host_buffer
? MAXPACKET : 1024, &host_buffer.ptr,
- NULL, NULL);
+ NULL, NULL, NULL);
}
if (n < 0)
{
@@ -685,21 +685,28 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
n = -1;
}
- if (n < 0 || (*name_ok) (bp) == 0)
+ if (__builtin_expect (n < 0 || (*name_ok) (bp) == 0, 0))
{
++had_error;
continue;
}
cp += n; /* name */
- type = ns_get16 (cp);
+
+ if (__builtin_expect (cp + 10 > end_of_message, 0))
+ {
+ ++had_error;
+ continue;
+ }
+
+ type = __ns_get16 (cp);
cp += INT16SZ; /* type */
- class = ns_get16 (cp);
+ class = __ns_get16 (cp);
cp += INT16SZ; /* class */
- ttl = ns_get32 (cp);
+ ttl = __ns_get32 (cp);
cp += INT32SZ; /* TTL */
- n = ns_get16 (cp);
+ n = __ns_get16 (cp);
cp += INT16SZ; /* len */
- if (class != C_IN)
+ if (__builtin_expect (class != C_IN, 0))
{
/* XXX - debug? syslog? */
cp += n;
@@ -711,7 +718,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
if (ap >= &host_data->aliases[MAX_NR_ALIASES - 1])
continue;
n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf);
- if (n < 0 || (*name_ok) (tbuf) == 0)
+ if (__builtin_expect (n < 0 || (*name_ok) (tbuf) == 0, 0))
{
++had_error;
continue;
@@ -745,7 +752,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
if (qtype == T_PTR && type == T_CNAME)
{
n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf);
- if (n < 0 || res_dnok (tbuf) == 0)
+ if (__builtin_expect (n < 0 || res_dnok (tbuf) == 0, 0))
{
++had_error;
continue;
@@ -792,7 +799,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
switch (type)
{
case T_PTR:
- if (__strcasecmp (tname, bp) != 0)
+ if (__builtin_expect (__strcasecmp (tname, bp) != 0, 0))
{
syslog (LOG_NOTICE | LOG_AUTH, AskedForGot, qname, bp);
cp += n;
@@ -809,7 +816,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
n = -1;
}
- if (n < 0 || res_hnok (bp) == 0)
+ if (__builtin_expect (n < 0 || res_hnok (bp) == 0, 0))
{
++had_error;
break;
@@ -839,7 +846,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
if (have_to_map)
{
n = strlen (bp) + 1; /* for the \0 */
- if (n >= MAXHOSTNAMELEN)
+ if (__builtin_expect (n >= MAXHOSTNAMELEN, 0))
{
++had_error;
break;
@@ -957,7 +964,7 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
return NSS_STATUS_UNAVAIL;
}
- u_char packtmp[NS_MAXCDNAME];
+ u_char packtmp[NS_MAXCDNAME];
int n = __ns_name_unpack (answer->buf, end_of_message, cp,
packtmp, sizeof packtmp);
/* We unpack the name to check it for validity. But we do not need
@@ -1005,7 +1012,7 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
n = -1;
}
- if (n < 0 || res_hnok (buffer) == 0)
+ if (__builtin_expect (n < 0 || res_hnok (buffer) == 0, 0))
{
++had_error;
continue;
@@ -1018,13 +1025,20 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
}
cp += n; /* name */
- int type = ns_get16 (cp);
+
+ if (__builtin_expect (cp + 10 > end_of_message, 0))
+ {
+ ++had_error;
+ continue;
+ }
+
+ int type = __ns_get16 (cp);
cp += INT16SZ; /* type */
- int class = ns_get16 (cp);
+ int class = __ns_get16 (cp);
cp += INT16SZ; /* class */
- int32_t ttl = ns_get32 (cp);
+ int32_t ttl = __ns_get32 (cp);
cp += INT32SZ; /* TTL */
- n = ns_get16 (cp);
+ n = __ns_get16 (cp);
cp += INT16SZ; /* len */
if (class != C_IN)
@@ -1037,7 +1051,7 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
{
char tbuf[MAXDNAME];
n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf);
- if (n < 0 || res_hnok (tbuf) == 0)
+ if (__builtin_expect (n < 0 || res_hnok (tbuf) == 0, 0))
{
++had_error;
continue;
@@ -1130,6 +1144,12 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
}
(*pat)->family = type == T_A ? AF_INET : AF_INET6;
+ if (__builtin_expect ((type == T_A && n != INADDRSZ)
+ || (type == T_AAAA && n != IN6ADDRSZ), 0))
+ {
+ ++had_error;
+ continue;
+ }
memcpy ((*pat)->addr, cp, n);
cp += n;
(*pat)->scopeid = 0;
@@ -1172,14 +1192,15 @@ gaih_getanswer (const querybuf *answer1, int anslen1, const querybuf *answer2,
errnop, h_errnop, ttlp,
&first);
if ((status == NSS_STATUS_SUCCESS || status == NSS_STATUS_NOTFOUND
- || status == NSS_STATUS_TRYAGAIN)
+ || (status == NSS_STATUS_TRYAGAIN
+ && (errno != ERANGE || *h_errnop != NO_RECOVERY)))
&& answer2 != NULL && anslen2 > 0)
{
enum nss_status status2 = gaih_getanswer_slice(answer2, anslen2, qname,
&pat, &buffer, &buflen,
errnop, h_errnop, ttlp,
&first);
- if (status != NSS_STATUS_SUCCESS)
+ if (status != NSS_STATUS_SUCCESS && status2 != NSS_STATUS_NOTFOUND)
status = status2;
}
diff --git a/libc/resolv/nss_dns/dns-network.c b/libc/resolv/nss_dns/dns-network.c
index 40736fbe9..c9969e08d 100644
--- a/libc/resolv/nss_dns/dns-network.c
+++ b/libc/resolv/nss_dns/dns-network.c
@@ -130,7 +130,7 @@ _nss_dns_getnetbyname_r (const char *name, struct netent *result,
net_buffer.buf = orig_net_buffer = (querybuf *) alloca (1024);
anslen = __libc_res_nsearch (&_res, qbuf, C_IN, T_PTR, net_buffer.buf->buf,
- 1024, &net_buffer.ptr, NULL, NULL);
+ 1024, &net_buffer.ptr, NULL, NULL, NULL);
if (anslen < 0)
{
/* Nothing found. */
@@ -206,7 +206,7 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result,
net_buffer.buf = orig_net_buffer = (querybuf *) alloca (1024);
anslen = __libc_res_nquery (&_res, qbuf, C_IN, T_PTR, net_buffer.buf->buf,
- 1024, &net_buffer.ptr, NULL, NULL);
+ 1024, &net_buffer.ptr, NULL, NULL, NULL);
if (anslen < 0)
{
/* Nothing found. */
diff --git a/libc/resolv/res_debug.c b/libc/resolv/res_debug.c
index 76fd34bf3..c38de640a 100644
--- a/libc/resolv/res_debug.c
+++ b/libc/resolv/res_debug.c
@@ -1024,6 +1024,7 @@ dn_count_labels(const char *name) {
count++;
return (count);
}
+libresolv_hidden_def (__dn_count_labels)
/*
@@ -1051,3 +1052,4 @@ p_secstodate (u_long secs) {
time->tm_hour, time->tm_min, time->tm_sec);
return (output);
}
+libresolv_hidden_def (__p_secstodate)
diff --git a/libc/resolv/res_mkquery.c b/libc/resolv/res_mkquery.c
index 416bf1c32..ae0cdb417 100644
--- a/libc/resolv/res_mkquery.c
+++ b/libc/resolv/res_mkquery.c
@@ -160,7 +160,10 @@ res_nmkquery(res_state statp,
if ((buflen -= QFIXEDSZ) < 0)
return (-1);
compose:
- if ((n = dn_comp(dname, cp, buflen, dnptrs, lastdnptr)) < 0)
+ n = ns_name_compress(dname, cp, buflen,
+ (const u_char **) dnptrs,
+ (const u_char **) lastdnptr);
+ if (n < 0)
return (-1);
cp += n;
buflen -= n;
@@ -172,7 +175,9 @@ res_nmkquery(res_state statp,
/*
* Make an additional record for completion domain.
*/
- n = dn_comp((char *)data, cp, buflen, dnptrs, lastdnptr);
+ n = ns_name_compress((char *)data, cp, buflen,
+ (const u_char **) dnptrs,
+ (const u_char **) lastdnptr);
if (__builtin_expect (n < 0, 0))
return (-1);
cp += n;
diff --git a/libc/resolv/res_query.c b/libc/resolv/res_query.c
index 3d2f2fe3a..7102ba948 100644
--- a/libc/resolv/res_query.c
+++ b/libc/resolv/res_query.c
@@ -97,7 +97,8 @@ static const char rcsid[] = "$BINDId: res_query.c,v 8.20 2000/02/29 05:39:12 vix
static int
__libc_res_nquerydomain(res_state statp, const char *name, const char *domain,
int class, int type, u_char *answer, int anslen,
- u_char **answerp, u_char **answerp2, int *nanswerp2);
+ u_char **answerp, u_char **answerp2, int *nanswerp2,
+ int *resplen2);
/*
* Formulate a normal query, send, and await answer.
@@ -117,7 +118,8 @@ __libc_res_nquery(res_state statp,
int anslen, /* size of answer buffer */
u_char **answerp, /* if buffer needs to be enlarged */
u_char **answerp2,
- int *nanswerp2)
+ int *nanswerp2,
+ int *resplen2)
{
HEADER *hp = (HEADER *) answer;
int n, use_malloc = 0;
@@ -146,18 +148,34 @@ __libc_res_nquery(res_state statp,
{
if ((oflags & RES_F_EDNS0ERR) == 0
&& (statp->options & RES_USE_EDNS0) != 0)
- n = __res_nopt(statp, n, query1, bufsize, anslen / 2);
+ {
+ n = __res_nopt(statp, n, query1, bufsize, anslen / 2);
+ if (n < 0)
+ goto unspec_nomem;
+ }
nquery1 = n;
- query2 = buf + nquery1;
+ /* Align the buffer. */
+ int npad = ((nquery1 + __alignof__ (HEADER) - 1)
+ & ~(__alignof__ (HEADER) - 1)) - nquery1;
+ if (n > bufsize - npad)
+ {
+ n = -1;
+ goto unspec_nomem;
+ }
+ int nused = n + npad;
+ query2 = buf + nused;
n = res_nmkquery(statp, QUERY, name, class, T_AAAA, NULL, 0,
- NULL, query2, bufsize - n);
+ NULL, query2, bufsize - nused);
if (n > 0
&& (oflags & RES_F_EDNS0ERR) == 0
&& (statp->options & RES_USE_EDNS0) != 0)
- n = __res_nopt(statp, n, query2, bufsize - n, anslen / 2);
+ n = __res_nopt(statp, n, query2, bufsize - nused - n,
+ anslen / 2);
nquery2 = n;
}
+
+ unspec_nomem:;
}
else
{
@@ -188,8 +206,10 @@ __libc_res_nquery(res_state statp,
if ((statp->options & RES_USE_EDNS0) != 0
&& ((oflags ^ statp->_flags) & RES_F_EDNS0ERR) != 0) {
statp->_flags |= RES_F_EDNS0ERR;
+#ifdef DEBUG
if (statp->options & RES_DEBUG)
printf(";; res_nquery: retry without EDNS0\n");
+#endif
goto again;
}
#ifdef DEBUG
@@ -203,7 +223,7 @@ __libc_res_nquery(res_state statp,
}
assert (answerp == NULL || (void *) *answerp == (void *) answer);
n = __libc_res_nsend(statp, query1, nquery1, query2, nquery2, answer,
- anslen, answerp, answerp2, nanswerp2);
+ anslen, answerp, answerp2, nanswerp2, resplen2);
if (use_malloc)
free (buf);
if (n < 0) {
@@ -289,7 +309,7 @@ res_nquery(res_state statp,
int anslen) /* size of answer buffer */
{
return __libc_res_nquery(statp, name, class, type, answer, anslen,
- NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL);
}
libresolv_hidden_def (res_nquery)
@@ -307,7 +327,8 @@ __libc_res_nsearch(res_state statp,
int anslen, /* size of answer */
u_char **answerp,
u_char **answerp2,
- int *nanswerp2)
+ int *nanswerp2,
+ int *resplen2)
{
const char *cp, * const *domain;
HEADER *hp = (HEADER *) answer;
@@ -331,7 +352,7 @@ __libc_res_nsearch(res_state statp,
if (!dots && (cp = res_hostalias(statp, name, tmp, sizeof tmp))!= NULL)
return (__libc_res_nquery(statp, cp, class, type, answer,
anslen, answerp, answerp2,
- nanswerp2));
+ nanswerp2, resplen2));
#ifdef DEBUG
if (statp->options & RES_DEBUG)
@@ -348,7 +369,7 @@ __libc_res_nsearch(res_state statp,
if (dots >= statp->ndots || trailing_dot) {
ret = __libc_res_nquerydomain(statp, name, NULL, class, type,
answer, anslen, answerp,
- answerp2, nanswerp2);
+ answerp2, nanswerp2, resplen2);
if (ret > 0 || trailing_dot)
return (ret);
saved_herrno = h_errno;
@@ -386,7 +407,8 @@ __libc_res_nsearch(res_state statp,
ret = __libc_res_nquerydomain(statp, name, *domain,
class, type,
answer, anslen, answerp,
- answerp2, nanswerp2);
+ answerp2, nanswerp2,
+ resplen2);
if (ret > 0)
return (ret);
@@ -455,7 +477,7 @@ __libc_res_nsearch(res_state statp,
if (dots && !(tried_as_is || root_on_list)) {
ret = __libc_res_nquerydomain(statp, name, NULL, class, type,
answer, anslen, answerp,
- answerp2, nanswerp2);
+ answerp2, nanswerp2, resplen2);
if (ret > 0)
return (ret);
}
@@ -490,7 +512,7 @@ res_nsearch(res_state statp,
int anslen) /* size of answer */
{
return __libc_res_nsearch(statp, name, class, type, answer,
- anslen, NULL, NULL, NULL);
+ anslen, NULL, NULL, NULL, NULL);
}
libresolv_hidden_def (res_nsearch)
@@ -507,7 +529,8 @@ __libc_res_nquerydomain(res_state statp,
int anslen, /* size of answer */
u_char **answerp,
u_char **answerp2,
- int *nanswerp2)
+ int *nanswerp2,
+ int *resplen2)
{
char nbuf[MAXDNAME];
const char *longname = nbuf;
@@ -544,7 +567,8 @@ __libc_res_nquerydomain(res_state statp,
sprintf(nbuf, "%s.%s", name, domain);
}
return (__libc_res_nquery(statp, longname, class, type, answer,
- anslen, answerp, answerp2, nanswerp2));
+ anslen, answerp, answerp2, nanswerp2,
+ resplen2));
}
int
@@ -556,7 +580,7 @@ res_nquerydomain(res_state statp,
int anslen) /* size of answer */
{
return __libc_res_nquerydomain(statp, name, domain, class, type,
- answer, anslen, NULL, NULL, NULL);
+ answer, anslen, NULL, NULL, NULL, NULL);
}
libresolv_hidden_def (res_nquerydomain)
diff --git a/libc/resolv/res_send.c b/libc/resolv/res_send.c
index e78ff967a..3130f6428 100644
--- a/libc/resolv/res_send.c
+++ b/libc/resolv/res_send.c
@@ -194,7 +194,6 @@ static int sock_eq(struct sockaddr_in6 *, struct sockaddr_in6 *);
/* Reachover. */
static void convaddr4to6(struct sockaddr_in6 *sa);
-void res_pquery(const res_state, const u_char *, int, FILE *);
/* Public. */
@@ -340,9 +339,9 @@ int
__libc_res_nsend(res_state statp, const u_char *buf, int buflen,
const u_char *buf2, int buflen2,
u_char *ans, int anssiz, u_char **ansp, u_char **ansp2,
- int *nansp2)
+ int *nansp2, int *resplen2)
{
- int gotsomewhere, terrno, try, v_circuit, resplen, resplen2, ns, n;
+ int gotsomewhere, terrno, try, v_circuit, resplen, ns, n;
if (statp->nscount == 0) {
__set_errno (ESRCH);
@@ -540,7 +539,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
try = statp->retry;
n = send_vc(statp, buf, buflen, buf2, buflen2,
&ans, &anssiz, &terrno,
- ns, ansp, ansp2, nansp2, &resplen2);
+ ns, ansp, ansp2, nansp2, resplen2);
if (n < 0)
return (-1);
if (n == 0)
@@ -550,14 +549,14 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
n = send_dg(statp, buf, buflen, buf2, buflen2,
&ans, &anssiz, &terrno,
ns, &v_circuit, &gotsomewhere, ansp,
- ansp2, nansp2, &resplen2);
+ ansp2, nansp2, resplen2);
if (n < 0)
return (-1);
if (n == 0)
goto next_ns;
if (v_circuit)
// XXX Check whether both requests failed or
- // XXX whether one have been answered successfully
+ // XXX whether one has been answered successfully
goto same_ns;
}
@@ -576,7 +575,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
DprintQ((statp->options & RES_DEBUG) ||
(statp->pfcode & RES_PRF_REPLY),
(stdout, "%s", ""),
- *ansp2, (resplen2 > *nansp2) ? *nansp2 : resplen2);
+ *ansp2, (*resplen2 > *nansp2) ? *nansp2 : *resplen2);
/*
* If we have temporarily opened a virtual circuit,
@@ -639,7 +638,7 @@ res_nsend(res_state statp,
const u_char *buf, int buflen, u_char *ans, int anssiz)
{
return __libc_res_nsend(statp, buf, buflen, NULL, 0, ans, anssiz,
- NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL);
}
libresolv_hidden_def (res_nsend)
@@ -666,6 +665,8 @@ send_vc(res_state statp,
u_short len2;
u_char *cp;
+ if (resplen2 != NULL)
+ *resplen2 = 0;
connreset = 0;
same_ns:
truncating = 0;
@@ -735,8 +736,9 @@ send_vc(res_state statp,
int recvresp2 = buf2 == NULL;
read_len:
cp = ans;
- len = INT16SZ;
- while ((n = TEMP_FAILURE_RETRY (read(statp->_vcsock, (char *)cp,
+ uint16_t rlen16;
+ len = sizeof(rlen16);
+ while ((n = TEMP_FAILURE_RETRY (read(statp->_vcsock, &rlen16,
(int)len))) > 0) {
cp += n;
if ((len -= n) <= 0)
@@ -761,11 +763,7 @@ send_vc(res_state statp,
}
return (0);
}
-#ifdef _STRING_ARCH_unaligned
- resplen = ntohs (*(uint16_t *) ans);
-#else
- resplen = ns_get16(ans);
-#endif
+ int rlen = ntohs (rlen16);
int *thisanssizp;
u_char **thisansp;
@@ -796,11 +794,11 @@ send_vc(res_state statp,
}
anhp = (HEADER *) *thisansp;
- *thisresplenp = resplen;
- if (resplen > *thisanssizp) {
+ *thisresplenp = rlen;
+ if (rlen > *thisanssizp) {
/* Yes, we test ANSCP here. If we have two buffers
both will be allocatable. */
- if (anscp) {
+ if (__builtin_expect (anscp != NULL, 1)) {
u_char *newp = malloc (MAXPACKET);
if (newp == NULL) {
*terrno = ENOMEM;
@@ -810,7 +808,7 @@ send_vc(res_state statp,
*thisanssizp = MAXPACKET;
*thisansp = newp;
anhp = (HEADER *) newp;
- len = resplen;
+ len = rlen;
} else {
Dprint(statp->options & RES_DEBUG,
(stdout, ";; response truncated\n")
@@ -819,9 +817,9 @@ send_vc(res_state statp,
len = *thisanssizp;
}
} else
- len = resplen;
+ len = rlen;
- if (len < HFIXEDSZ) {
+ if (__builtin_expect (len < HFIXEDSZ, 0)) {
/*
* Undersized message.
*/
@@ -837,18 +835,18 @@ send_vc(res_state statp,
cp += n;
len -= n;
}
- if (n <= 0) {
+ if (__builtin_expect (n <= 0, 0)) {
*terrno = errno;
Perror(statp, stderr, "read(vc)", errno);
__res_iclose(statp, false);
return (0);
}
- if (truncating) {
+ if (__builtin_expect (truncating, 0)) {
/*
* Flush rest of answer so connection stays in synch.
*/
anhp->tc = 1;
- len = resplen - *thisanssizp;
+ len = rlen - *thisanssizp;
while (len != 0) {
char junk[PACKETSZ];
@@ -873,7 +871,7 @@ send_vc(res_state statp,
(statp->pfcode & RES_PRF_REPLY),
(stdout, ";; old answer (unexpected):\n"),
*thisansp,
- (resplen > *thisanssiz) ? *thisanssiz: resplen);
+ (rlen > *thisanssiz) ? *thisanssiz: rlen);
goto read_len;
}
@@ -890,7 +888,7 @@ send_vc(res_state statp,
* All is well, or the error is fatal. Signal that the
* next nameserver ought not be tried.
*/
- return (resplen);
+ return resplen;
}
static int
@@ -1085,7 +1083,7 @@ send_dg(res_state statp,
*thisresplenp = recvfrom(pfd[0].fd, (char*)*thisansp,
*thisanssizp, 0,
(struct sockaddr *)&from, &fromlen);
- if (*thisresplenp <= 0) {
+ if (__builtin_expect (*thisresplenp <= 0, 0)) {
if (errno == EINTR || errno == EAGAIN) {
need_recompute = 1;
goto wait;
@@ -1094,7 +1092,7 @@ send_dg(res_state statp,
goto err_out;
}
*gotsomewhere = 1;
- if (*thisresplenp < HFIXEDSZ) {
+ if (__builtin_expect (*thisresplenp < HFIXEDSZ, 0)) {
/*
* Undersized message.
*/
diff --git a/libc/scripts/gen-as-const.awk b/libc/scripts/gen-as-const.awk
index bc3c47fb7..20d18c12a 100644
--- a/libc/scripts/gen-as-const.awk
+++ b/libc/scripts/gen-as-const.awk
@@ -14,12 +14,22 @@ BEGIN { started = 0 }
NF >= 1 && !started {
if (test) {
+ print "\n#include <inttypes.h>";
print "\n#include <stdio.h>";
+ print "\n#if __WORDSIZE__ == 64";
+ print "\ntypedef uint64_t c_t;";
+ print "\n#define U(n) UINT64_C (n)";
+ print "\n#define PRI PRId64";
+ print "\n#else";
+ print "\ntypedef uint32_t c_t;";
+ print "\n#define U(n) UINT32_C (n)";
+ print "\n#define PRI PRId32";
+ print "\n#endif";
print "\nstatic int do_test (void)\n{\n int bad = 0, good = 0;\n";
print "#define TEST(name, source, expr) \\\n" \
- " if (asconst_##name != (expr)) { ++bad;" \
- " fprintf (stderr, \"%s: %s is %ld but %s is %ld\\n\"," \
- " source, #name, (long int) asconst_##name, #expr, (long int) (expr));" \
+ " if (U (asconst_##name) != (c_t) (expr)) { ++bad;" \
+ " fprintf (stderr, \"%s: %s is %\" PRI \" but %s is %\"PRI \"\\n\"," \
+ " source, #name, U (asconst_##name), #expr, (c_t) (expr));" \
" } else ++good;\n";
}
else
diff --git a/libc/socket/Makefile b/libc/socket/Makefile
index aa0776e5b..e7fa589e6 100644
--- a/libc/socket/Makefile
+++ b/libc/socket/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991,1995-2001,2005 Free Software Foundation, Inc.
+# Copyright (C) 1991,1995-2001,2005,2008 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,7 +27,9 @@ headers := sys/socket.h sys/un.h bits/sockaddr.h bits/socket.h \
routines := accept bind connect getpeername getsockname getsockopt \
listen recv recvfrom recvmsg send sendmsg sendto \
setsockopt shutdown socket socketpair isfdtype opensock \
- sockatmark
+ sockatmark paccept
+
+aux := have_sock_cloexec
distribute := ifreq.h
diff --git a/libc/socket/Versions b/libc/socket/Versions
index d282eff79..9764227c3 100644
--- a/libc/socket/Versions
+++ b/libc/socket/Versions
@@ -31,4 +31,7 @@ libc {
# Addition from P1003.1-200x
sockatmark;
}
+ GLIBC_2.9 {
+ paccept;
+ }
}
diff --git a/libc/socket/have_sock_cloexec.c b/libc/socket/have_sock_cloexec.c
new file mode 100644
index 000000000..22dccdf72
--- /dev/null
+++ b/libc/socket/have_sock_cloexec.c
@@ -0,0 +1,24 @@
+/* Copyright (C) 2008 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 <sys/socket.h>
+#include <kernel-features.h>
+
+#if defined SOCK_CLOEXEC && !defined __ASSUME_SOCK_CLOEXEC
+int __have_sock_cloexec;
+#endif
diff --git a/libc/socket/paccept.c b/libc/socket/paccept.c
new file mode 100644
index 000000000..777dd8c30
--- /dev/null
+++ b/libc/socket/paccept.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 2008 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 <sys/socket.h>
+
+/* Await a connection on socket FD.
+ When a connection arrives, open a new socket to communicate with it,
+ set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting
+ peer and *ADDR_LEN to the address's actual length, and return the
+ new socket's descriptor, or -1 for errors. SS is installed as
+ the thread's signal mask and FLAGS are additional flags. */
+int
+paccept (fd, addr, addr_len, ss, flags)
+ int fd;
+ __SOCKADDR_ARG addr;
+ socklen_t *addr_len;
+ const __sigset_t *ss;
+ int flags;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (paccept)
+
+
+stub_warning (paccept)
+#include <stub-tag.h>
diff --git a/libc/socket/sys/socket.h b/libc/socket/sys/socket.h
index 6d9eab7f9..ea4123d28 100644
--- a/libc/socket/sys/socket.h
+++ b/libc/socket/sys/socket.h
@@ -1,5 +1,5 @@
/* Declarations of socket constants, types, and functions.
- Copyright (C) 1991,92,1994-2001,2003,2005,2007
+ Copyright (C) 1991,92,1994-2001,2003,2005,2007,2008
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -28,6 +28,10 @@ __BEGIN_DECLS
#include <sys/uio.h>
#define __need_size_t
#include <stddef.h>
+#ifdef __USE_GNU
+/* Get the __sigset_t definition. */
+# include <bits/sigset.h>
+#endif
/* This operating system-specific header file defines the SOCK_*, PF_*,
@@ -210,6 +214,18 @@ extern int listen (int __fd, int __n) __THROW;
extern int accept (int __fd, __SOCKADDR_ARG __addr,
socklen_t *__restrict __addr_len);
+#ifdef __USE_GNU
+/* Variant of the accept function which takes additional parameters. The
+ MASK parameter allows to change the thread signal mask for the duration
+ of the call. The FLAGS parameter allows to pass additional flags.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int paccept (int __fd, __SOCKADDR_ARG __addr,
+ socklen_t *__restrict __addr_len,
+ __const __sigset_t *__restrict __ss, int __flags);
+#endif
+
/* Shut down all or part of the connection open on socket FD.
HOW determines what to shut down:
SHUT_RD = No more receptions;
diff --git a/libc/stdio-common/Makefile b/libc/stdio-common/Makefile
index 252ca1d34..deeac91ce 100644
--- a/libc/stdio-common/Makefile
+++ b/libc/stdio-common/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 1991-2006, 2007, 2008 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
@@ -65,7 +65,8 @@ tests := tstscanf test_rdwr test-popen tstgetln test-fseek \
tst-sprintf tst-rndseek tst-fdopen tst-fphex \
tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
tst-fwrite bug16 bug17 tst-sprintf2 bug18 \
- bug19 tst-popen2 scanf14 scanf15 bug21 bug22 scanf16 scanf17
+ bug19 tst-popen2 scanf14 scanf15 bug21 bug22 scanf16 scanf17 \
+ tst-setvbuf1
tests-$(OPTION_EGLIBC_LOCALE_CODE) \
+= tst-sscanf tst-swprintf bug15 test-vfprintf bug14 scanf13
tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
@@ -143,3 +144,7 @@ bug15-ENV = LOCPATH=$(common-objpfx)localedata
ifneq (,$(filter %REENTRANT, $(defines)))
CPPFLAGS += -D_IO_MTSAFE_IO
endif
+
+$(objpfx)tst-setvbuf1.out: tst-setvbuf1.expect $(objpfx)tst-setvbuf1
+ $(built-program-cmd) > $@ 2>&1
+ cmp tst-setvbuf1.expect $@
diff --git a/libc/stdio-common/_i18n_number.h b/libc/stdio-common/_i18n_number.h
index bd6adf80d..7fb29ae68 100644
--- a/libc/stdio-common/_i18n_number.h
+++ b/libc/stdio-common/_i18n_number.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2004, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 2000.
@@ -27,7 +27,7 @@
#if __OPTION_EGLIBC_LOCALE_CODE
static CHAR_T *
-_i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr)
+_i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr, CHAR_T *end)
{
#ifdef COMPILE_WPRINTF
# define decimal NULL
@@ -61,10 +61,23 @@ _i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr)
#endif
/* Copy existing string so that nothing gets overwritten. */
- CHAR_T *src = (CHAR_T *) alloca ((rear_ptr - w) * sizeof (CHAR_T));
+ CHAR_T *src;
+ bool use_alloca = __libc_use_alloca ((rear_ptr - w) * sizeof (CHAR_T));
+ if (__builtin_expect (use_alloca, true))
+ src = (CHAR_T *) alloca ((rear_ptr - w) * sizeof (CHAR_T));
+ else
+ {
+ src = (CHAR_T *) malloc ((rear_ptr - w) * sizeof (CHAR_T));
+ if (src == NULL)
+ /* If we cannot allocate the memory don't rewrite the string.
+ It is better than nothing. */
+ return w;
+ }
+
CHAR_T *s = (CHAR_T *) __mempcpy (src, w,
(rear_ptr - w) * sizeof (CHAR_T));
- w = rear_ptr;
+
+ w = end;
/* Process all characters in the string. */
while (--s >= src)
@@ -94,6 +107,9 @@ _i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr)
}
}
+ if (! use_alloca)
+ free (src);
+
return w;
}
diff --git a/libc/stdio-common/printf_fp.c b/libc/stdio-common/printf_fp.c
index f5a423b0b..e48590c54 100644
--- a/libc/stdio-common/printf_fp.c
+++ b/libc/stdio-common/printf_fp.c
@@ -1,5 +1,5 @@
/* Floating point output for `printf'.
- Copyright (C) 1995-2003, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1995-2003, 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@@ -1170,6 +1170,7 @@ ___printf_fp (FILE *fp,
{
char *buffer = NULL;
+ char *buffer_end = NULL;
char *cp = NULL;
char *tmpptr;
@@ -1179,6 +1180,9 @@ ___printf_fp (FILE *fp,
size_t decimal_len;
size_t thousands_sep_len;
wchar_t *copywc;
+ size_t factor = (info->i18n
+ ? _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MB_CUR_MAX)
+ : 1);
decimal_len = strlen (decimal);
@@ -1187,10 +1191,11 @@ ___printf_fp (FILE *fp,
else
thousands_sep_len = strlen (thousands_sep);
+ size_t nbuffer = (2 + chars_needed * factor + decimal_len
+ + ngroups * thousands_sep_len);
if (__builtin_expect (buffer_malloced, 0))
{
- buffer = (char *) malloc (2 + chars_needed + decimal_len
- + ngroups * thousands_sep_len);
+ buffer = (char *) malloc (nbuffer);
if (buffer == NULL)
{
/* Signal an error to the caller. */
@@ -1199,8 +1204,8 @@ ___printf_fp (FILE *fp,
}
}
else
- buffer = (char *) alloca (2 + chars_needed + decimal_len
- + ngroups * thousands_sep_len);
+ buffer = (char *) alloca (nbuffer);
+ buffer_end = buffer + nbuffer;
/* Now copy the wide character string. Since the character
(except for the decimal point and thousands separator) must
@@ -1219,9 +1224,17 @@ ___printf_fp (FILE *fp,
if (__builtin_expect (info->i18n, 0))
{
#ifdef COMPILE_WPRINTF
- wstartp = _i18n_number_rewrite (wstartp, wcp);
+ wstartp = _i18n_number_rewrite (wstartp, wcp,
+ wbuffer + wbuffer_to_alloc);
+ wcp = wbuffer + wbuffer_to_alloc;
+ assert ((uintptr_t) wbuffer <= (uintptr_t) wstartp);
+ assert ((uintptr_t) wstartp
+ < (uintptr_t) wbuffer + wbuffer_to_alloc);
#else
- tmpptr = _i18n_number_rewrite (tmpptr, cp);
+ tmpptr = _i18n_number_rewrite (tmpptr, cp, buffer_end);
+ cp = buffer_end;
+ assert ((uintptr_t) buffer <= (uintptr_t) tmpptr);
+ assert ((uintptr_t) tmpptr < (uintptr_t) buffer_end);
#endif
}
diff --git a/libc/stdio-common/tst-setvbuf1.c b/libc/stdio-common/tst-setvbuf1.c
new file mode 100644
index 000000000..22410939c
--- /dev/null
+++ b/libc/stdio-common/tst-setvbuf1.c
@@ -0,0 +1,19 @@
+#include <stdio.h>
+
+static int
+do_test (void)
+{
+ if (setvbuf (stderr, NULL, _IOFBF, BUFSIZ) != 0)
+ {
+ puts ("Set full buffer error.");
+ return 1;
+ }
+
+ fprintf (stderr, "Output #1 <stderr>.\n");
+ printf ("Output #2 <stdout>.\n");
+
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/libc/stdio-common/tst-setvbuf1.expect b/libc/stdio-common/tst-setvbuf1.expect
new file mode 100644
index 000000000..281c18ca1
--- /dev/null
+++ b/libc/stdio-common/tst-setvbuf1.expect
@@ -0,0 +1,2 @@
+Output #2 <stdout>.
+Output #1 <stderr>.
diff --git a/libc/stdio-common/vfprintf.c b/libc/stdio-common/vfprintf.c
index b265ff226..6eedcc54a 100644
--- a/libc/stdio-common/vfprintf.c
+++ b/libc/stdio-common/vfprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006, 2007
+/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -638,7 +638,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
thousands_sep); \
\
if (use_outdigits && base == 10) \
- string = _i18n_number_rewrite (string, workend); \
+ string = _i18n_number_rewrite (string, workend, workend); \
} \
/* Simplify further test for num != 0. */ \
number.word = number.longlong != 0; \
@@ -696,7 +696,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
thousands_sep); \
\
if (use_outdigits && base == 10) \
- string = _i18n_number_rewrite (string, workend); \
+ string = _i18n_number_rewrite (string, workend, workend); \
} \
} \
\
@@ -2103,6 +2103,11 @@ _IO_helper_overflow (_IO_FILE *s, int c)
{
_IO_size_t written = _IO_sputn (target, s->_wide_data->_IO_write_base,
used);
+ if (written == 0 || written == WEOF)
+ return WEOF;
+ __wmemmove (s->_wide_data->_IO_write_base,
+ s->_wide_data->_IO_write_base + written,
+ used - written);
s->_wide_data->_IO_write_ptr -= written;
}
#else
@@ -2110,6 +2115,10 @@ _IO_helper_overflow (_IO_FILE *s, int c)
if (used)
{
_IO_size_t written = _IO_sputn (target, s->_IO_write_base, used);
+ if (written == 0 || written == EOF)
+ return EOF;
+ memmove (s->_IO_write_base, s->_IO_write_base + written,
+ used - written);
s->_IO_write_ptr -= written;
}
#endif
diff --git a/libc/sunrpc/Versions b/libc/sunrpc/Versions
index cddf18876..d2d8e81ac 100644
--- a/libc/sunrpc/Versions
+++ b/libc/sunrpc/Versions
@@ -116,4 +116,7 @@ libc {
GLIBC_2.3.4 {
xdr_quad_t; xdr_u_quad_t;
}
+ GLIBC_PRIVATE {
+ __libc_clntudp_bufcreate;
+ }
}
diff --git a/libc/sunrpc/clnt_udp.c b/libc/sunrpc/clnt_udp.c
index 634313211..548c987e6 100644
--- a/libc/sunrpc/clnt_udp.c
+++ b/libc/sunrpc/clnt_udp.c
@@ -54,12 +54,15 @@ static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro";
#ifdef USE_IN_LIBIO
# include <wchar.h>
#endif
+#include <fcntl.h>
#ifdef IP_RECVERR
#include <errqueue.h>
#include <sys/uio.h>
#endif
+#include <kernel-features.h>
+
extern bool_t xdr_opaque_auth (XDR *, struct opaque_auth *);
extern u_long _create_xid (void);
@@ -121,9 +124,9 @@ struct cu_data
* sent and received.
*/
CLIENT *
-clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, u_long version,
- struct timeval wait, int *sockp, u_int sendsz,
- u_int recvsz)
+__libc_clntudp_bufcreate (struct sockaddr_in *raddr, u_long program,
+ u_long version, struct timeval wait, int *sockp,
+ u_int sendsz, u_int recvsz, int flags)
{
CLIENT *cl;
struct cu_data *cu = NULL;
@@ -178,8 +181,32 @@ clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, u_long version,
{
int dontblock = 1;
- *sockp = __socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
- if (*sockp < 0)
+#ifdef SOCK_NONBLOCK
+# ifndef __ASSUME_SOCK_CLOEXEC
+ if (__have_sock_cloexec >= 0)
+# endif
+ {
+ *sockp = __socket (AF_INET, SOCK_DGRAM|SOCK_NONBLOCK|flags,
+ IPPROTO_UDP);
+# ifndef __ASSUME_SOCK_CLOEXEC
+ if (__have_sock_cloexec == 0)
+ __have_sock_cloexec = *sockp >= 0 || errno != EINVAL ? 1 : -1;
+# endif
+ }
+#endif
+#ifndef __ASSUME_SOCK_CLOEXEC
+# ifdef SOCK_CLOEXEC
+ if (__have_sock_cloexec < 0)
+# endif
+ {
+ *sockp = __socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+# ifdef SOCK_CLOEXEC
+ if (flags & SOCK_CLOEXEC)
+ __fcntl (*sockp, F_SETFD, FD_CLOEXEC);
+# endif
+ }
+#endif
+ if (__builtin_expect (*sockp < 0, 0))
{
struct rpc_createerr *ce = &get_rpc_createerr ();
ce->cf_stat = RPC_SYSTEMERROR;
@@ -188,8 +215,13 @@ clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, u_long version,
}
/* attempt to bind to prov port */
(void) bindresvport (*sockp, (struct sockaddr_in *) 0);
- /* the sockets rpc controls are non-blocking */
- (void) __ioctl (*sockp, FIONBIO, (char *) &dontblock);
+#ifndef __ASSUME_SOCK_CLOEXEC
+# ifdef SOCK_CLOEXEC
+ if (__have_sock_cloexec < 0)
+# endif
+ /* the sockets rpc controls are non-blocking */
+ (void) __ioctl (*sockp, FIONBIO, (char *) &dontblock);
+#endif
#ifdef IP_RECVERR
{
int on = 1;
@@ -212,6 +244,16 @@ fooy:
mem_free ((caddr_t) cl, sizeof (CLIENT));
return (CLIENT *) NULL;
}
+INTDEF (__libc_clntudp_bufcreate)
+
+CLIENT *
+clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, u_long version,
+ struct timeval wait, int *sockp, u_int sendsz,
+ u_int recvsz)
+{
+ return INTUSE(__libc_clntudp_bufcreate) (raddr, program, version, wait,
+ sockp, sendsz, recvsz, 0);
+}
INTDEF (clntudp_bufcreate)
CLIENT *
@@ -222,8 +264,8 @@ clntudp_create (raddr, program, version, wait, sockp)
struct timeval wait;
int *sockp;
{
- return INTUSE(clntudp_bufcreate) (raddr, program, version, wait, sockp,
- UDPMSGSIZE, UDPMSGSIZE);
+ return INTUSE(__libc_clntudp_bufcreate) (raddr, program, version, wait,
+ sockp, UDPMSGSIZE, UDPMSGSIZE, 0);
}
INTDEF (clntudp_create)
diff --git a/libc/sunrpc/key_call.c b/libc/sunrpc/key_call.c
index 611c37256..319d8017e 100644
--- a/libc/sunrpc/key_call.c
+++ b/libc/sunrpc/key_call.c
@@ -462,7 +462,7 @@ getkeyserv_handle (int vers)
clnt_control (kcp->client, CLSET_RETRY_TIMEOUT,
(char *)&wait_time);
if (clnt_control (kcp->client, CLGET_FD, (char *)&fd))
- __fcntl (fd, F_SETFD, 1); /* make it "close on exec" */
+ __fcntl (fd, F_SETFD, FD_CLOEXEC); /* make it "close on exec" */
return kcp->client;
}
diff --git a/libc/sysdeps/generic/ldsodefs.h b/libc/sysdeps/generic/ldsodefs.h
index 9d1ebdf61..4d857404a 100644
--- a/libc/sysdeps/generic/ldsodefs.h
+++ b/libc/sysdeps/generic/ldsodefs.h
@@ -38,6 +38,7 @@
#include <bits/libc-lock.h>
#include <hp-timing.h>
#include <tls.h>
+#include <kernel-features.h>
__BEGIN_DECLS
diff --git a/libc/sysdeps/i386/fpu/s_expm1l.S b/libc/sysdeps/i386/fpu/s_expm1l.S
index 2dc379b79..b69b22bc6 100644
--- a/libc/sysdeps/i386/fpu/s_expm1l.S
+++ b/libc/sysdeps/i386/fpu/s_expm1l.S
@@ -1,5 +1,5 @@
/* ix87 specific implementation of exp(x)-1.
- Copyright (C) 1996, 1997, 2002, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 2002, 2005, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
Based on code by John C. Bowman <bowman@ipp-garching.mpg.de>.
@@ -48,6 +48,11 @@ l2e: .tfloat 1.442695040888963407359924681002
.text
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)
+
fldt 4(%esp) // x
fxam // Is NaN or +-Inf?
fstsw %ax
diff --git a/libc/sysdeps/i386/i686/memcmp.S b/libc/sysdeps/i386/i686/memcmp.S
index 4fa6adea9..24f6804b0 100644
--- a/libc/sysdeps/i386/i686/memcmp.S
+++ b/libc/sysdeps/i386/i686/memcmp.S
@@ -29,8 +29,7 @@
#define ENTRANCE pushl %ebx; cfi_adjust_cfa_offset (4); \
cfi_rel_offset (ebx, 0); ENTER
#define RETURN popl %ebx; cfi_adjust_cfa_offset (-4); \
- cfi_restore (ebx); LEAVE; ret; \
- cfi_adjust_cfa_offset (4); cfi_rel_offset (ebx, 0);
+ cfi_restore (ebx); LEAVE; ret
/* Load an entry in a jump table into EBX. TABLE is a jump table
with relative offsets. INDEX is a register contains the index
@@ -71,6 +70,8 @@ L(bye):
xorl %eax, %eax
RETURN
+ cfi_adjust_cfa_offset (4)
+ cfi_rel_offset (ebx, 0)
L(neq):
sbbl %eax, %eax
sbbl $-1, %eax
diff --git a/libc/sysdeps/mach/hurd/bits/fcntl.h b/libc/sysdeps/mach/hurd/bits/fcntl.h
index 2f890c1b6..b4147cee5 100644
--- a/libc/sysdeps/mach/hurd/bits/fcntl.h
+++ b/libc/sysdeps/mach/hurd/bits/fcntl.h
@@ -22,6 +22,8 @@
# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
#endif
+#include <sys/types.h>
+
/* File access modes. These are understood by io servers; they can be
passed in `dir_lookup', and are returned by `io_get_openmodes'.
Consequently they can be passed to `open', `hurd_file_name_lookup', and
diff --git a/libc/sysdeps/mach/i386/machine-lock.h b/libc/sysdeps/mach/i386/machine-lock.h
index d78662817..33602f43a 100644
--- a/libc/sysdeps/mach/i386/machine-lock.h
+++ b/libc/sysdeps/mach/i386/machine-lock.h
@@ -1,5 +1,5 @@
/* Machine-specific definition for spin locks. i386 version.
- Copyright (C) 1994, 1997, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1994,1997,2007,2008 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
@@ -40,7 +40,8 @@ __spin_unlock (__spin_lock_t *__lock)
{
register int __unlocked;
__asm__ __volatile ("xchgl %0, %1"
- : "=&r" (__unlocked), "=m" (*__lock) : "0" (0));
+ : "=&r" (__unlocked), "=m" (*__lock) : "0" (0)
+ : "memory");
}
/* Try to lock LOCK; return nonzero if we locked it, zero if another has. */
@@ -50,7 +51,8 @@ __spin_try_lock (__spin_lock_t *__lock)
{
register int __locked;
__asm__ __volatile ("xchgl %0, %1"
- : "=&r" (__locked), "=m" (*__lock) : "0" (1));
+ : "=&r" (__locked), "=m" (*__lock) : "0" (1)
+ : "memory");
return !__locked;
}
diff --git a/libc/sysdeps/posix/clock_getres.c b/libc/sysdeps/posix/clock_getres.c
index f4dc21f8a..7d7cd05ff 100644
--- a/libc/sysdeps/posix/clock_getres.c
+++ b/libc/sysdeps/posix/clock_getres.c
@@ -1,5 +1,5 @@
/* clock_getres -- Get the resolution of a POSIX clockid_t.
- Copyright (C) 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999,2000,2001,2003,2004,2008 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 @@
#if HP_TIMING_AVAIL
static long int nsec; /* Clock frequency of the processor. */
-static inline int
+static int
hp_timing_getres (struct timespec *res)
{
if (__builtin_expect (nsec == 0, 0))
diff --git a/libc/sysdeps/posix/getaddrinfo.c b/libc/sysdeps/posix/getaddrinfo.c
index 4987505c5..97f3af993 100644
--- a/libc/sysdeps/posix/getaddrinfo.c
+++ b/libc/sysdeps/posix/getaddrinfo.c
@@ -697,7 +697,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
old_res_options = _res.options;
_res.options &= ~RES_USE_INET6;
- size_t tmpbuflen = 512;
+ size_t tmpbuflen = 1024;
char *tmpbuf = alloca (tmpbuflen);
while (!no_more)
diff --git a/libc/sysdeps/powerpc/dl-procinfo.c b/libc/sysdeps/powerpc/dl-procinfo.c
index a732e94fa..1c74c2a90 100644
--- a/libc/sysdeps/powerpc/dl-procinfo.c
+++ b/libc/sysdeps/powerpc/dl-procinfo.c
@@ -46,11 +46,12 @@
#if !defined PROCINFO_DECL && defined SHARED
._dl_powerpc_cap_flags
#else
-PROCINFO_CLASS const char _dl_powerpc_cap_flags[23][10]
+PROCINFO_CLASS const char _dl_powerpc_cap_flags[25][10]
#endif
#ifndef PROCINFO_DECL
= {
- "power6x", "dfp", "pa6t",
+ "vsx",
+ "arch_2_06", "power6x", "dfp", "pa6t",
"arch_2_05", "ic_snoop", "smt", "booke",
"cellbe", "power5+", "power5", "power4",
"notb", "efpdouble", "efpsingle", "spe",
@@ -67,7 +68,7 @@ PROCINFO_CLASS const char _dl_powerpc_cap_flags[23][10]
#if !defined PROCINFO_DECL && defined SHARED
._dl_powerpc_platforms
#else
-PROCINFO_CLASS const char _dl_powerpc_platforms[7][12]
+PROCINFO_CLASS const char _dl_powerpc_platforms[8][12]
#endif
#ifndef PROCINFO_DECL
= {
@@ -77,7 +78,8 @@ PROCINFO_CLASS const char _dl_powerpc_platforms[7][12]
[PPC_PLATFORM_POWER5_PLUS] = "power5+",
[PPC_PLATFORM_POWER6] = "power6",
[PPC_PLATFORM_CELL_BE] = "ppc-cell-be",
- [PPC_PLATFORM_POWER6X] = "power6x"
+ [PPC_PLATFORM_POWER6X] = "power6x",
+ [PPC_PLATFORM_POWER7] = "power7"
}
#endif
#if !defined SHARED || defined PROCINFO_DECL
diff --git a/libc/sysdeps/powerpc/dl-procinfo.h b/libc/sysdeps/powerpc/dl-procinfo.h
index 0bf935385..254195a94 100644
--- a/libc/sysdeps/powerpc/dl-procinfo.h
+++ b/libc/sysdeps/powerpc/dl-procinfo.h
@@ -23,15 +23,15 @@
#include <ldsodefs.h>
#include <sysdep.h> /* This defines the PPC_FEATURE_* macros. */
-/* There are 20 bits used, but they are bits 12..31. */
-#define _DL_HWCAP_FIRST 9
+/* There are 25 bits used, but they are bits 7..31. */
+#define _DL_HWCAP_FIRST 7
#define _DL_HWCAP_COUNT 32
/* These bits influence library search. */
#define HWCAP_IMPORTANT (PPC_FEATURE_HAS_ALTIVEC \
+ PPC_FEATURE_HAS_DFP)
-#define _DL_PLATFORMS_COUNT 7
+#define _DL_PLATFORMS_COUNT 8
#define _DL_FIRST_PLATFORM 32
/* Mask to filter out platforms. */
@@ -46,6 +46,7 @@
#define PPC_PLATFORM_POWER6 4
#define PPC_PLATFORM_CELL_BE 5
#define PPC_PLATFORM_POWER6X 6
+#define PPC_PLATFORM_POWER7 7
static inline const char *
__attribute__ ((unused))
@@ -103,6 +104,9 @@ _dl_string_platform (const char *str)
++str;
}
break;
+ case '7':
+ ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER7;
+ break;
default:
return -1;
}
diff --git a/libc/sysdeps/powerpc/fpu/bits/mathinline.h b/libc/sysdeps/powerpc/fpu/bits/mathinline.h
index c5d458582..0f3c4a025 100644
--- a/libc/sysdeps/powerpc/fpu/bits/mathinline.h
+++ b/libc/sysdeps/powerpc/fpu/bits/mathinline.h
@@ -1,5 +1,5 @@
/* Inline math functions for powerpc.
- Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2004, 2006, 2007
+ Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2004, 2006, 2007, 2008
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -72,6 +72,14 @@ __NTH (__signbit (double __x))
__extension__ union { double __d; int __i[2]; } __u = { __d: __x };
return __u.__i[0] < 0;
}
+# ifdef __LONG_DOUBLE_128__
+__MATH_INLINE int
+__NTH (__signbitl (long double __x))
+{
+ __extension__ union { long double __d; int __i[4]; } __u = { __d: __x };
+ return __u.__i[0] < 0;
+}
+# endif
# endif
#endif /* __USE_ISOC99 */
diff --git a/libc/sysdeps/powerpc/powerpc32/dl-machine.c b/libc/sysdeps/powerpc/powerpc32/dl-machine.c
index fc2ce7c1d..731d23956 100644
--- a/libc/sysdeps/powerpc/powerpc32/dl-machine.c
+++ b/libc/sysdeps/powerpc/powerpc32/dl-machine.c
@@ -557,11 +557,6 @@ __process_machine_rela (struct link_map *map,
}
break;
-#define CHECK_STATIC_TLS(map, sym_map) \
- do { \
- if (__builtin_expect ((sym_map)->l_tls_offset == NO_TLS_OFFSET, 0)) \
- _dl_allocate_static_tls (sym_map); \
- } while (0)
#define DO_TLS_RELOC(suffix) \
case R_PPC_DTPREL##suffix: \
/* During relocation all TLS symbols are defined and used. \
diff --git a/libc/sysdeps/powerpc/sysdep.h b/libc/sysdeps/powerpc/sysdep.h
index 2ae52b78c..43edeb71e 100644
--- a/libc/sysdeps/powerpc/sysdep.h
+++ b/libc/sysdeps/powerpc/sysdep.h
@@ -44,6 +44,8 @@
#define PPC_FEATURE_PA6T 0x00000800 /* PA Semi 6T Core */
#define PPC_FEATURE_HAS_DFP 0x00000400 /* Decimal FP Unit */
#define PPC_FEATURE_POWER6_EXT 0x00000200 /* P6 + mffgpr/mftgpr */
+#define PPC_FEATURE_HAS_VSX 0x00000100 /* P7 Vector Extension. */
+#define PPC_FEATURE_ARCH_2_06 0x00000080 /* ISA 2.06 */
#define PPC_FEATURE_970 (PPC_FEATURE_POWER4 + PPC_FEATURE_HAS_ALTIVEC)
#ifdef __ASSEMBLER__
diff --git a/libc/sysdeps/sparc/Makefile b/libc/sysdeps/sparc/Makefile
index 9fa5324b4..73b926554 100644
--- a/libc/sysdeps/sparc/Makefile
+++ b/libc/sysdeps/sparc/Makefile
@@ -1,6 +1,8 @@
# The Sparc `long double' is a distinct type we support.
long-double-fcts = yes
+pie-ccflag = -fPIE
+
ifeq ($(subdir),gmon)
sysdep_routines += sparc-mcount
endif
diff --git a/libc/sysdeps/unix/syscalls.list b/libc/sysdeps/unix/syscalls.list
index 4c963abe5..04ed63c4d 100644
--- a/libc/sysdeps/unix/syscalls.list
+++ b/libc/sysdeps/unix/syscalls.list
@@ -9,6 +9,7 @@ chroot - chroot i:s chroot
close - close Ci:i __libc_close __close close
dup - dup i:i __dup dup
dup2 - dup2 i:ii __dup2 dup2
+dup3 - dup3 i:iii dup3
fchdir - fchdir i:i __fchdir fchdir
fcntl - fcntl Ci:iiF __libc_fcntl __fcntl __fcntl_internal fcntl
fstatfs - fstatfs i:ip __fstatfs fstatfs
diff --git a/libc/sysdeps/unix/sysv/linux/Versions b/libc/sysdeps/unix/sysv/linux/Versions
index af4c293c2..76ecae001 100644
--- a/libc/sysdeps/unix/sysv/linux/Versions
+++ b/libc/sysdeps/unix/sysv/linux/Versions
@@ -135,6 +135,9 @@ libc {
GLIBC_2.8 {
timerfd_create; timerfd_settime; timerfd_gettime;
}
+ GLIBC_2.9 {
+ epoll_create1; inotify_init1;
+ }
GLIBC_PRIVATE {
# functions used in other libraries
__syscall_rt_sigqueueinfo;
diff --git a/libc/sysdeps/unix/sysv/linux/alpha/sys/epoll.h b/libc/sysdeps/unix/sysv/linux/alpha/sys/epoll.h
new file mode 100644
index 000000000..9f983a515
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/alpha/sys/epoll.h
@@ -0,0 +1,143 @@
+/* Copyright (C) 2002-2006, 2007, 2008 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 _SYS_EPOLL_H
+#define _SYS_EPOLL_H 1
+
+#include <stdint.h>
+#include <sys/types.h>
+
+/* Get __sigset_t. */
+#include <bits/sigset.h>
+
+#ifndef __sigset_t_defined
+# define __sigset_t_defined
+typedef __sigset_t sigset_t;
+#endif
+
+
+/* Flags to be passed to epoll_create2. */
+enum
+ {
+ EPOLL_CLOEXEC = 010000000,
+#define EPOLL_CLOEXEC EPOLL_CLOEXEC
+ EPOLL_NONBLOCK = 04
+#define EPOLL_NONBLOCK EPOLL_NONBLOCK
+ };
+
+
+enum EPOLL_EVENTS
+ {
+ EPOLLIN = 0x001,
+#define EPOLLIN EPOLLIN
+ EPOLLPRI = 0x002,
+#define EPOLLPRI EPOLLPRI
+ EPOLLOUT = 0x004,
+#define EPOLLOUT EPOLLOUT
+ EPOLLRDNORM = 0x040,
+#define EPOLLRDNORM EPOLLRDNORM
+ EPOLLRDBAND = 0x080,
+#define EPOLLRDBAND EPOLLRDBAND
+ EPOLLWRNORM = 0x100,
+#define EPOLLWRNORM EPOLLWRNORM
+ EPOLLWRBAND = 0x200,
+#define EPOLLWRBAND EPOLLWRBAND
+ EPOLLMSG = 0x400,
+#define EPOLLMSG EPOLLMSG
+ EPOLLERR = 0x008,
+#define EPOLLERR EPOLLERR
+ EPOLLHUP = 0x010,
+#define EPOLLHUP EPOLLHUP
+ EPOLLRDHUP = 0x2000,
+#define EPOLLRDHUP EPOLLRDHUP
+ EPOLLONESHOT = (1 << 30),
+#define EPOLLONESHOT EPOLLONESHOT
+ EPOLLET = (1 << 31)
+#define EPOLLET EPOLLET
+ };
+
+
+/* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */
+#define EPOLL_CTL_ADD 1 /* Add a file descriptor to the interface. */
+#define EPOLL_CTL_DEL 2 /* Remove a file descriptor from the interface. */
+#define EPOLL_CTL_MOD 3 /* Change file descriptor epoll_event structure. */
+
+
+typedef union epoll_data
+{
+ void *ptr;
+ int fd;
+ uint32_t u32;
+ uint64_t u64;
+} epoll_data_t;
+
+struct epoll_event
+{
+ uint32_t events; /* Epoll events */
+ epoll_data_t data; /* User data variable */
+};
+
+
+__BEGIN_DECLS
+
+/* Creates an epoll instance. Returns an fd for the new instance.
+ The "size" parameter is a hint specifying the number of file
+ descriptors to be associated with the new instance. The fd
+ returned by epoll_create() should be closed with close(). */
+extern int epoll_create (int __size) __THROW;
+
+/* Same as epoll_create but with an additional FLAGS parameter. */
+extern int epoll_create2 (int __size, int __flags) __THROW;
+
+
+/* Manipulate an epoll instance "epfd". Returns 0 in case of success,
+ -1 in case of error ( the "errno" variable will contain the
+ specific error code ) The "op" parameter is one of the EPOLL_CTL_*
+ constants defined above. The "fd" parameter is the target of the
+ operation. The "event" parameter describes which events the caller
+ is interested in and any associated user data. */
+extern int epoll_ctl (int __epfd, int __op, int __fd,
+ struct epoll_event *__event) __THROW;
+
+
+/* Wait for events on an epoll instance "epfd". Returns the number of
+ triggered events returned in "events" buffer. Or -1 in case of
+ error with the "errno" variable set to the specific error code. The
+ "events" parameter is a buffer that will contain triggered
+ events. The "maxevents" is the maximum number of events to be
+ returned ( usually size of "events" ). The "timeout" parameter
+ specifies the maximum wait time in milliseconds (-1 == infinite).
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int epoll_wait (int __epfd, struct epoll_event *__events,
+ int __maxevents, int __timeout);
+
+
+/* Same as epoll_wait, but the thread's signal mask is temporarily
+ and atomically replaced with the one provided as parameter.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int epoll_pwait (int __epfd, struct epoll_event *__events,
+ int __maxevents, int __timeout,
+ __const __sigset_t *__ss);
+
+__END_DECLS
+
+#endif /* sys/epoll.h */
diff --git a/libc/sysdeps/unix/sysv/linux/alpha/sys/eventfd.h b/libc/sysdeps/unix/sysv/linux/alpha/sys/eventfd.h
new file mode 100644
index 000000000..c8ce55462
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/alpha/sys/eventfd.h
@@ -0,0 +1,52 @@
+/* Copyright (C) 2007, 2008 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 _SYS_EVENTFD_H
+#define _SYS_EVENTFD_H 1
+
+#include <stdint.h>
+
+
+/* Type for event counter. */
+typedef uint64_t eventfd_t;
+
+/* Flags for signalfd. */
+enum
+ {
+ EFD_CLOEXEC = 010000000,
+#define EFD_CLOEXEC EFD_CLOEXEC
+ EFD_NONBLOCK = 04
+#define EFD_NONBLOCK EFD_NONBLOCK
+ };
+
+
+__BEGIN_DECLS
+
+/* Return file descriptor for generic event channel. Set initial
+ value to COUNT. */
+extern int eventfd (int __count, int __flags) __THROW;
+
+/* Read event counter and possibly wait for events. */
+extern int eventfd_read (int __fd, eventfd_t *__value);
+
+/* Increment event counter. */
+extern int eventfd_write (int __fd, eventfd_t value);
+
+__END_DECLS
+
+#endif /* sys/eventfd.h */
diff --git a/libc/sysdeps/unix/sysv/linux/alpha/sys/inotify.h b/libc/sysdeps/unix/sysv/linux/alpha/sys/inotify.h
new file mode 100644
index 000000000..d61c700d5
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/alpha/sys/inotify.h
@@ -0,0 +1,105 @@
+/* Copyright (C) 2005, 2006, 2008 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 _SYS_INOTIFY_H
+#define _SYS_INOTIFY_H 1
+
+#include <stdint.h>
+
+
+/* Flags for the parameter of inotify_init1. */
+enum
+ {
+ IN_CLOEXEC = 010000000,
+#define IN_CLOEXEC IN_CLOEXEC
+ IN_NONBLOCK = 04
+#define IN_NONBLOCK IN_NONBLOCK
+ };
+
+
+/* Structure describing an inotify event. */
+struct inotify_event
+{
+ int wd; /* Watch descriptor. */
+ uint32_t mask; /* Watch mask. */
+ uint32_t cookie; /* Cookie to synchronize two events. */
+ uint32_t len; /* Length (including NULs) of name. */
+ char name __flexarr; /* Name. */
+};
+
+
+/* Supported events suitable for MASK parameter of INOTIFY_ADD_WATCH. */
+#define IN_ACCESS 0x00000001 /* File was accessed. */
+#define IN_MODIFY 0x00000002 /* File was modified. */
+#define IN_ATTRIB 0x00000004 /* Metadata changed. */
+#define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed. */
+#define IN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed. */
+#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* Close. */
+#define IN_OPEN 0x00000020 /* File was opened. */
+#define IN_MOVED_FROM 0x00000040 /* File was moved from X. */
+#define IN_MOVED_TO 0x00000080 /* File was moved to Y. */
+#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* Moves. */
+#define IN_CREATE 0x00000100 /* Subfile was created. */
+#define IN_DELETE 0x00000200 /* Subfile was deleted. */
+#define IN_DELETE_SELF 0x00000400 /* Self was deleted. */
+#define IN_MOVE_SELF 0x00000800 /* Self was moved. */
+
+/* Events sent by the kernel. */
+#define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted. */
+#define IN_Q_OVERFLOW 0x00004000 /* Event queued overflowed. */
+#define IN_IGNORED 0x00008000 /* File was ignored. */
+
+/* Helper events. */
+#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* Close. */
+#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* Moves. */
+
+/* Special flags. */
+#define IN_ONLYDIR 0x01000000 /* Only watch the path if it is a
+ directory. */
+#define IN_DONT_FOLLOW 0x02000000 /* Do not follow a sym link. */
+#define IN_MASK_ADD 0x20000000 /* Add to the mask of an already
+ existing watch. */
+#define IN_ISDIR 0x40000000 /* Event occurred against dir. */
+#define IN_ONESHOT 0x80000000 /* Only send event once. */
+
+/* All events which a program can wait on. */
+#define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE \
+ | IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM \
+ | IN_MOVED_TO | IN_CREATE | IN_DELETE \
+ | IN_DELETE_SELF | IN_MOVE_SELF)
+
+
+__BEGIN_DECLS
+
+/* Create and initialize inotify instance. */
+extern int inotify_init (void) __THROW;
+
+/* Create and initialize inotify instance. */
+extern int inotify_init1 (int __flags) __THROW;
+
+/* Add watch of object NAME to inotify instance FD. Notify about
+ events specified by MASK. */
+extern int inotify_add_watch (int __fd, const char *__name, uint32_t __mask)
+ __THROW;
+
+/* Remove the watch specified by WD from the inotify instance FD. */
+extern int inotify_rm_watch (int __fd, uint32_t __wd) __THROW;
+
+__END_DECLS
+
+#endif /* sys/inotify.h */
diff --git a/libc/sysdeps/unix/sysv/linux/alpha/sys/signalfd.h b/libc/sysdeps/unix/sysv/linux/alpha/sys/signalfd.h
new file mode 100644
index 000000000..a820eafe7
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/alpha/sys/signalfd.h
@@ -0,0 +1,66 @@
+/* Copyright (C) 2007, 2008 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 _SYS_SIGNALFD_H
+#define _SYS_SIGNALFD_H 1
+
+#define __need_sigset_t
+#include <signal.h>
+#include <stdint.h>
+
+
+struct signalfd_siginfo
+{
+ uint32_t ssi_signo;
+ int32_t ssi_errno;
+ int32_t ssi_code;
+ uint32_t ssi_pid;
+ uint32_t ssi_uid;
+ int32_t ssi_fd;
+ uint32_t ssi_tid;
+ uint32_t ssi_band;
+ uint32_t ssi_overrun;
+ uint32_t ssi_trapno;
+ int32_t ssi_status;
+ int32_t ssi_int;
+ uint64_t ssi_ptr;
+ uint64_t ssi_utime;
+ uint64_t ssi_stime;
+ uint64_t ssi_addr;
+ uint8_t __pad[48];
+};
+
+/* Flags for signalfd. */
+enum
+ {
+ SFD_CLOEXEC = 010000000,
+#define SFD_CLOEXEC SFD_CLOEXEC
+ SFD_NONBLOCK = 04
+#define SFD_NONBLOCK SFD_NONBLOCK
+ };
+
+__BEGIN_DECLS
+
+/* Request notification for delivery of signals in MASK to be
+ performed using descriptor FD.*/
+extern int signalfd (int __fd, const sigset_t *__mask, int __flags)
+ __nonnull ((2)) __THROW;
+
+__END_DECLS
+
+#endif /* sys/signalfd.h */
diff --git a/libc/sysdeps/unix/sysv/linux/alpha/sys/timerfd.h b/libc/sysdeps/unix/sysv/linux/alpha/sys/timerfd.h
new file mode 100644
index 000000000..09d6ccf6c
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/alpha/sys/timerfd.h
@@ -0,0 +1,60 @@
+/* Copyright (C) 2008 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 _SYS_TIMERFD_H
+#define _SYS_TIMERFD_H 1
+
+#include <time.h>
+
+
+/* Bits to be set in the FLAGS parameter of `timerfd_create'. */
+enum
+ {
+ TFD_CLOEXEC = 010000000,
+#define TFD_CLOEXEC TFD_CLOEXEC
+ TFD_NONBLOCK = 04
+#define TFD_NONBLOCK TFD_NONBLOCK
+ };
+
+
+/* Bits to be set in the FLAGS parameter of `timerfd_settime'. */
+enum
+ {
+ TFD_TIMER_ABSTIME = 1 << 0
+#define TFD_TIMER_ABSTIME TFD_TIMER_ABSTIME
+ };
+
+
+__BEGIN_DECLS
+
+/* Return file descriptor for new interval timer source. */
+extern int timerfd_create (clockid_t __clock_id, int __flags) __THROW;
+
+/* Set next expiration time of interval timer source UFD to UTMR. If
+ FLAGS has the TFD_TIMER_ABSTIME flag set the timeout value is
+ absolute. Optionally return the old expiration time in OTMR. */
+extern int timerfd_settime (int __ufd, int __flags,
+ __const struct itimerspec *__utmr,
+ struct itimerspec *__otmr) __THROW;
+
+/* Return the next expiration time of UFD. */
+extern int timerfd_gettime (int __ufd, struct itimerspec *__otmr) __THROW;
+
+__END_DECLS
+
+#endif /* sys/timerfd.h */
diff --git a/libc/sysdeps/unix/sysv/linux/bits/in.h b/libc/sysdeps/unix/sysv/linux/bits/in.h
index 433c033c7..b457a1790 100644
--- a/libc/sysdeps/unix/sysv/linux/bits/in.h
+++ b/libc/sysdeps/unix/sysv/linux/bits/in.h
@@ -70,6 +70,7 @@
#define IP_PMTUDISC_DONT 0 /* Never send DF frames. */
#define IP_PMTUDISC_WANT 1 /* Use per route hints. */
#define IP_PMTUDISC_DO 2 /* Always DF. */
+#define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu. */
/* To select the IP level. */
#define SOL_IP 0
@@ -162,6 +163,7 @@ struct in_pktinfo
#define IPV6_PMTUDISC_DONT 0 /* Never send DF frames. */
#define IPV6_PMTUDISC_WANT 1 /* Use per route hints. */
#define IPV6_PMTUDISC_DO 2 /* Always DF. */
+#define IPV6_PMTUDISC_PROBE 3 /* Ignore dst pmtu. */
/* Socket level values for IPv6. */
#define SOL_IPV6 41
diff --git a/libc/sysdeps/unix/sysv/linux/bits/socket.h b/libc/sysdeps/unix/sysv/linux/bits/socket.h
index 3dda3d1c2..87c3b9180 100644
--- a/libc/sysdeps/unix/sysv/linux/bits/socket.h
+++ b/libc/sysdeps/unix/sysv/linux/bits/socket.h
@@ -52,12 +52,22 @@ enum __socket_type
SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based,
datagrams of fixed maximum length. */
#define SOCK_SEQPACKET SOCK_SEQPACKET
- SOCK_DCCP = 6,
-#define SOCK_DCCP SOCK_DCCP /* Datagram Congestion Control Protocol. */
- SOCK_PACKET = 10 /* Linux specific way of getting packets
+ SOCK_DCCP = 6, /* Datagram Congestion Control Protocol. */
+#define SOCK_DCCP SOCK_DCCP
+ SOCK_PACKET = 10, /* Linux specific way of getting packets
at the dev level. For writing rarp and
other similar things on the user level. */
#define SOCK_PACKET SOCK_PACKET
+
+ /* Flags to be ORed into the type parameter of socket and socketpair and
+ used for the flags parameter of paccept. */
+
+ SOCK_CLOEXEC = 02000000, /* Atomically set close-on-exec flag for the
+ new descriptor(s). */
+#define SOCK_CLOEXEC SOCK_CLOEXEC
+ SOCK_NONBLOCK = 04000 /* Atomically mark descriptor(s) as
+ non-blocking. */
+#define SOCK_NONBLOCK SOCK_NONBLOCK
};
/* Protocol families. */
@@ -92,7 +102,8 @@ enum __socket_type
#define PF_BLUETOOTH 31 /* Bluetooth sockets. */
#define PF_IUCV 32 /* IUCV sockets. */
#define PF_RXRPC 33 /* RxRPC sockets. */
-#define PF_MAX 34 /* For now.. */
+#define PF_ISDN 34 /* mISDN sockets. */
+#define PF_MAX 35 /* For now.. */
/* Address families. */
#define AF_UNSPEC PF_UNSPEC
@@ -126,6 +137,7 @@ enum __socket_type
#define AF_BLUETOOTH PF_BLUETOOTH
#define AF_IUCV PF_IUCV
#define AF_RXRPC PF_RXRPC
+#define AF_ISDN PF_ISDN
#define AF_MAX PF_MAX
/* Socket level values. Others are defined in the appropriate headers.
diff --git a/libc/sysdeps/unix/sysv/linux/clock_getres.c b/libc/sysdeps/unix/sysv/linux/clock_getres.c
index 813d3ebbf..581ff22c7 100644
--- a/libc/sysdeps/unix/sysv/linux/clock_getres.c
+++ b/libc/sysdeps/unix/sysv/linux/clock_getres.c
@@ -1,5 +1,5 @@
/* clock_getres -- Get the resolution of a POSIX clockid_t. Linux version.
- Copyright (C) 2003,2004,2005,2006 Free Software Foundation, Inc.
+ Copyright (C) 2003,2004,2005,2006, 2008 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
@@ -121,7 +121,7 @@ maybe_syscall_getres_cpu (clockid_t clock_id, struct timespec *res)
return 0;
e = INTERNAL_SYSCALL_ERRNO (r, err);
-# ifndef __ASSUME_POSIX_TIMERS
+# ifndef __ASSUME_POSIX_TIMERS
if (e == ENOSYS)
{
__libc_missing_posix_timers = 1;
@@ -129,7 +129,7 @@ maybe_syscall_getres_cpu (clockid_t clock_id, struct timespec *res)
e = EINVAL;
}
else
-# endif
+# endif
{
if (e == EINVAL)
{
diff --git a/libc/sysdeps/unix/sysv/linux/dl-sysdep.h b/libc/sysdeps/unix/sysv/linux/dl-sysdep.h
index f44fa9814..a3c2cb8e7 100644
--- a/libc/sysdeps/unix/sysv/linux/dl-sysdep.h
+++ b/libc/sysdeps/unix/sysv/linux/dl-sysdep.h
@@ -27,9 +27,7 @@
#define NEED_DL_SYSINFO_DSO 1
-/* The _dl_discover_osversion function is so far only needed in sysconf
- to check for kernels later than 2.6.23. */
-#if !defined __ASSEMBLER__ && __LINUX_KERNEL_VERSION < 0x020617
+#ifndef __ASSEMBLER__
/* Get version of the OS. */
extern int _dl_discover_osversion (void) attribute_hidden;
# define HAVE_DL_DISCOVER_OSVERSION 1
diff --git a/libc/sysdeps/unix/sysv/linux/eventfd.c b/libc/sysdeps/unix/sysv/linux/eventfd.c
index 180861aad..6ebfed86f 100644
--- a/libc/sysdeps/unix/sysv/linux/eventfd.c
+++ b/libc/sysdeps/unix/sysv/linux/eventfd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2007, 2008 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
@@ -24,7 +24,10 @@
int
eventfd (int count, int flags)
{
- /* The system call has no flag parameter which is bad. So we have
+#ifdef __NR_eventfd1
+ return INLINE_SYSCALL (eventfd1, 1, flags);
+#else
+ /* The old system call has no flag parameter which is bad. So we have
to wait until we have to support to pass additional values to the
kernel (sys_indirect) before implementing setting flags like
O_NONBLOCK etc. */
@@ -34,10 +37,11 @@ eventfd (int count, int flags)
return -1;
}
-#ifdef __NR_eventfd
+# ifdef __NR_eventfd
return INLINE_SYSCALL (eventfd, 1, count);
-#else
+# else
__set_errno (ENOSYS);
return -1;
+# endif
#endif
}
diff --git a/libc/sysdeps/unix/sysv/linux/i386/bits/mman.h b/libc/sysdeps/unix/sysv/linux/i386/bits/mman.h
index 00cb98239..2b90c8d7d 100644
--- a/libc/sysdeps/unix/sysv/linux/i386/bits/mman.h
+++ b/libc/sysdeps/unix/sysv/linux/i386/bits/mman.h
@@ -63,6 +63,7 @@
# define MAP_NORESERVE 0x04000 /* Don't check for reservations. */
# define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */
# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */
+# define MAP_STACK 0x20000 /* Allocation is for a stack. */
#endif
/* Flags to `msync'. */
diff --git a/libc/sysdeps/unix/sysv/linux/i386/paccept.S b/libc/sysdeps/unix/sysv/linux/i386/paccept.S
new file mode 100644
index 000000000..02ad78dd4
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/i386/paccept.S
@@ -0,0 +1,135 @@
+/* Copyright (C) 1995-1998,2002,2003,2005,2008 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-cancel.h>
+#include <socketcall.h>
+#include <tls.h>
+
+#define _NSIG 64
+
+#define P(a, b) P2(a, b)
+#define P2(a, b) a##b
+
+ .text
+/* The socket-oriented system calls are handled unusally in Linux.
+ They are all gated through the single `socketcall' system call number.
+ `socketcall' takes two arguments: the first is the subcode, specifying
+ which socket function is being called; and the second is a pointer to
+ the arguments to the specific function. */
+
+ENTRY(do_paccept)
+#ifdef SOCKOP_paccept
+ subl $6*4, %esp
+ cfi_adjust_cfa_offset(6*4)
+
+ movl (%eax), %ecx
+ movl %ecx, (%esp)
+ movl 4(%eax), %ecx
+ movl %ecx, 4(%esp)
+ movl 8(%eax), %ecx
+ movl %ecx, 8(%esp)
+ movl 12(%eax), %ecx
+ movl %ecx, 12(%esp)
+ movl $(_NSIG / 8), 16(%esp)
+ movl 16(%eax), %ecx
+ movl %ecx, 20(%esp)
+
+ movl $SYS_ify(socketcall), %eax /* System call number in %eax. */
+
+ movl $SOCKOP_paccept, %ebx /* Subcode is first arg to syscall. */
+ movl %esp, %ecx /* Address of args is 2nd arg. */
+
+ /* Do the system call trap. */
+ ENTER_KERNEL
+
+ addl $6*4, %esp
+ cfi_adjust_cfa_offset(-6*4)
+
+ /* %eax is < 0 if there was an error. */
+ cmpl $-125, %eax
+ jae SYSCALL_ERROR_LABEL
+#else
+ movl $-ENOSYS, %eax
+ jmp SYSCALL_ERROR_LABEL
+
+ .section .gnu.glibc-stub.paccept
+ .previous
+ .section .gnu.warning.paccept
+ .string "warning: paccept is not implemented and will always fail"
+ .previous
+#endif
+L(pseudo_end):
+ ret
+PSEUDO_END(do_paccept)
+
+
+ .globl paccept
+ENTRY (paccept)
+#ifdef CENABLE
+ SINGLE_THREAD_P
+ jne 1f
+#endif
+
+ /* Save registers. */
+ movl %ebx, %edx
+ cfi_register (3, 2)
+
+ lea 4(%esp), %eax
+ call do_paccept
+
+ /* Restore registers. */
+ movl %edx, %ebx
+ cfi_restore (3)
+
+ ret
+
+#ifdef CENABLE
+ /* We need one more register. */
+1: pushl %esi
+ cfi_adjust_cfa_offset(4)
+
+ /* Enable asynchronous cancellation. */
+ CENABLE
+ movl %eax, %esi
+ cfi_offset(6, -8) /* %esi */
+
+ /* Save registers. */
+ movl %ebx, %edx
+ cfi_register (3, 2)
+
+ lea 8(%esp), %eax
+ call do_paccept
+
+ /* Restore registers. */
+ movl %edx, %ebx
+ cfi_restore (3)
+
+ /* Restore the cancellation. */
+ xchgl %esi, %eax
+ CDISABLE
+
+ /* Restore registers. */
+ movl %esi, %eax
+ popl %esi
+ cfi_restore (6)
+ cfi_adjust_cfa_offset(-4)
+
+ /* Successful; return the syscall's value. */
+ ret
+#endif
+PSEUDO_END (paccept)
diff --git a/libc/sysdeps/unix/sysv/linux/ifaddrs.c b/libc/sysdeps/unix/sysv/linux/ifaddrs.c
index 9aa9abac3..150ec8a9b 100644
--- a/libc/sysdeps/unix/sysv/linux/ifaddrs.c
+++ b/libc/sysdeps/unix/sysv/linux/ifaddrs.c
@@ -1,5 +1,5 @@
/* getifaddrs -- get names and addresses of all network interfaces
- Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2003-2007, 2008 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
@@ -49,6 +49,22 @@ int __no_netlink_support attribute_hidden;
#endif
+/* There is a problem with this type. The address length for
+ Infiniband sockets is much longer than the 8 bytes allocated in the
+ sockaddr_ll definition. Hence we use here a special
+ definition. */
+struct sockaddr_ll_max
+ {
+ unsigned short int sll_family;
+ unsigned short int sll_protocol;
+ int sll_ifindex;
+ unsigned short int sll_hatype;
+ unsigned char sll_pkttype;
+ unsigned char sll_halen;
+ unsigned char sll_addr[24];
+ };
+
+
/* struct to hold the data for one ifaddrs entry, so we can allocate
everything at once. */
struct ifaddrs_storage
@@ -59,7 +75,7 @@ struct ifaddrs_storage
/* Save space for the biggest of the four used sockaddr types and
avoid a lot of casts. */
struct sockaddr sa;
- struct sockaddr_ll sl;
+ struct sockaddr_ll_max sl;
struct sockaddr_in s4;
struct sockaddr_in6 s6;
} addr, netmask, broadaddr;
@@ -307,7 +323,7 @@ map_newlink (int index, struct ifaddrs_storage *ifas, int *map, int max)
/* Create a linked list of `struct ifaddrs' structures, one for each
network interface on the host machine. If successful, store the
- list in *IFAP and return 0. On errors, return -1 and set `errno'. */
+ list in *IFAP and 2004, 2005, 2006, return 0. On errors, return -1 and set `errno'. */
int
getifaddrs (struct ifaddrs **ifap)
{
diff --git a/libc/sysdeps/unix/sysv/linux/kernel-features.h b/libc/sysdeps/unix/sysv/linux/kernel-features.h
index 01baab090..6031eae2d 100644
--- a/libc/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/libc/sysdeps/unix/sysv/linux/kernel-features.h
@@ -1,6 +1,6 @@
/* Set flags signalling availability of kernel features based on given
kernel version number.
- Copyright (C) 1999-2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1999-2006, 2007, 2008 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
@@ -488,7 +488,26 @@
# define __ASSUME_FALLOCATE 1
#endif
+/* Support for various CLOEXEC and NONBLOCK flags was added for x86,
+ x86-64, PPC, IA-64, SPARC< and S390 in 2.6.23. */
+#if __LINUX_KERNEL_VERSION >= 0x020617 \
+ && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
+ || defined __ia64__ || defined __sparc__ || defined __s390__)
+# define __ASSUME_O_CLOEXEC 1
+#endif
+
/* Support for ADJ_OFFSET_SS_READ was added in 2.6.24. */
#if __LINUX_KERNEL_VERSION >= 0x020618
# define __ASSUME_ADJ_OFFSET_SS_READ 1
#endif
+
+/* Support for various CLOEXEC and NONBLOCK flags was added for x86,
+ x86-64, PPC, IA-64, and SPARC in 2.6.27. */
+#if __LINUX_KERNEL_VERSION >= 0x02061b \
+ && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
+ || defined __ia64__ || defined __sparc__ || __s390__)
+# define __ASSUME_SOCK_CLOEXEC 1
+# define __ASSUME_IN_NONBLOCK 1
+# define __ASSUME_PIPE2 1
+# define __ASSUME_PACCEPT 1
+#endif
diff --git a/libc/sysdeps/unix/sysv/linux/opensock.c b/libc/sysdeps/unix/sysv/linux/opensock.c
index 95559eb79..191d72011 100644
--- a/libc/sysdeps/unix/sysv/linux/opensock.c
+++ b/libc/sysdeps/unix/sysv/linux/opensock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2001, 2002, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2001, 2002, 2007, 2008 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
@@ -22,6 +22,7 @@
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
+#include <kernel-features.h>
/* Return a socket of any type. The socket can be used in subsequent
ioctl calls to talk to the kernel. */
@@ -70,7 +71,24 @@ __opensock (void)
{
assert (last_type != 0);
- result = __socket (last_family, last_type, 0);
+#ifdef SOCK_CLOEXEC
+# ifndef __ASSUME_SOCK_CLOEXEC
+ if (__have_sock_cloexec >= 0)
+# endif
+ {
+ result = __socket (last_family, last_type | SOCK_CLOEXEC, 0);
+# ifndef __ASSUME_SOCK_CLOEXEC
+ if (__have_sock_cloexec == 0)
+ __have_sock_cloexec = result != -1 || errno != EINVAL ? 1 : -1;
+# endif
+ }
+#endif
+#ifndef __ASSUME_SOCK_CLOEXEC
+# ifdef SOCK_CLOEXEC
+ if (__have_sock_cloexec < 0)
+# endif
+ result = __socket (last_family, last_type, 0);
+#endif
if (result != -1 || errno != EAFNOSUPPORT)
/* Maybe the socket type isn't supported anymore (module is
unloaded). In this case again try to find the type. */
@@ -105,7 +123,24 @@ __opensock (void)
if (afs[cnt].family == AF_NETROM || afs[cnt].family == AF_X25)
type = SOCK_SEQPACKET;
- result = __socket (afs[cnt].family, type, 0);
+#ifdef SOCK_CLOEXEC
+# ifndef __ASSUME_SOCK_CLOEXEC
+ if (__have_sock_cloexec >= 0)
+# endif
+ {
+ result = __socket (afs[cnt].family, type | SOCK_CLOEXEC, 0);
+# ifndef __ASSUME_SOCK_CLOEXEC
+ if (__have_sock_cloexec == 0)
+ __have_sock_cloexec = result != -1 || errno != EINVAL ? 1 : -1;
+# endif
+ }
+#endif
+#ifndef __ASSUME_SOCK_CLOEXEC
+# ifdef SOCK_CLOEXEC
+ if (__have_sock_cloexec < 0)
+# endif
+ result = __socket (afs[cnt].family, type, 0);
+#endif
if (result != -1)
{
/* Found an available family. */
diff --git a/libc/sysdeps/unix/sysv/linux/paccept.c b/libc/sysdeps/unix/sysv/linux/paccept.c
new file mode 100644
index 000000000..cc2979c0e
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/paccept.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2008.
+
+ 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 <signal.h>
+#include <sys/socket.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+
+#ifdef __NR_paccept
+int
+paccept (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len,
+ const __sigset_t *ss, int flags)
+{
+ if (SINGLE_THREAD_P)
+ return INLINE_SYSCALL (paccept, 6, fd, addr.__sockaddr__, addr_len, ss,
+ _NSIG / 8, flags);
+
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ int result = INLINE_SYSCALL (paccept, 6, fd, addr.__sockaddr__, addr_len, ss,
+ _NSIG / 8, flags);
+
+ LIBC_CANCEL_RESET (oldtype);
+
+ return result;
+}
+#else
+int
+paccept (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len,
+ const __sigset_t *ss, int flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+stub_warning (epoll_pwait)
+}
+#endif
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/bits/mathinline.h b/libc/sysdeps/unix/sysv/linux/powerpc/bits/mathinline.h
deleted file mode 100644
index f8e6bb51d..000000000
--- a/libc/sysdeps/unix/sysv/linux/powerpc/bits/mathinline.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/* Inline math functions for powerpc.
- Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2004, 2006, 2007, 2008
- 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 _MATH_H
-# error "Never use <bits/mathinline.h> directly; include <math.h> instead."
-#endif
-
-#ifndef __extern_inline
-# define __MATH_INLINE __inline
-#else
-# define __MATH_INLINE __extern_inline
-#endif /* __cplusplus */
-
-#if defined __GNUC__ && !defined _SOFT_FLOAT && !defined __NO_FPRS__
-
-#ifdef __USE_ISOC99
-# if !__GNUC_PREREQ (2,97)
-# define __unordered_cmp(x, y) \
- (__extension__ \
- ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
- unsigned __r; \
- __asm__("fcmpu 7,%1,%2 ; mfcr %0" : "=r" (__r) : "f" (__x), "f"(__y) \
- : "cr7"); \
- __r; }))
-
-# undef isgreater
-# undef isgreaterequal
-# undef isless
-# undef islessequal
-# undef islessgreater
-# undef isunordered
-
-# define isgreater(x, y) (__unordered_cmp (x, y) >> 2 & 1)
-# define isgreaterequal(x, y) ((__unordered_cmp (x, y) & 6) != 0)
-# define isless(x, y) (__unordered_cmp (x, y) >> 3 & 1)
-# define islessequal(x, y) ((__unordered_cmp (x, y) & 0xA) != 0)
-# define islessgreater(x, y) ((__unordered_cmp (x, y) & 0xC) != 0)
-# define isunordered(x, y) (__unordered_cmp (x, y) & 1)
-
-# endif /* __GNUC_PREREQ (2,97) */
-
-/* The gcc, version 2.7 or below, has problems with all this inlining
- code. So disable it for this version of the compiler. */
-# if __GNUC_PREREQ (2, 8)
-/* Test for negative number. Used in the signbit() macro. */
-__MATH_INLINE int
-__NTH (__signbitf (float __x))
-{
- __extension__ union { float __f; int __i; } __u = { __f: __x };
- return __u.__i < 0;
-}
-__MATH_INLINE int
-__NTH (__signbit (double __x))
-{
- __extension__ union { double __d; int __i[2]; } __u = { __d: __x };
- return __u.__i[0] < 0;
-}
-# ifdef __LONGDOUBLE128
-__MATH_INLINE int
-__NTH (__signbitl (long double __x))
-{
- __extension__ union { long double __d; int __i[4]; } __u = { __d: __x };
- return __u.__i[0] < 0;
-}
-# endif
-# endif
-#endif /* __USE_ISOC99 */
-
-#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
-
-#ifdef __USE_ISOC99
-
-# ifndef __powerpc64__
-__MATH_INLINE long int lrint (double __x) __THROW;
-__MATH_INLINE long int
-__NTH (lrint (double __x))
-{
- union {
- double __d;
- int __ll[2];
- } __u;
- __asm__ ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x));
- return __u.__ll[1];
-}
-
-__MATH_INLINE long int lrintf (float __x) __THROW;
-__MATH_INLINE long int
-__NTH (lrintf (float __x))
-{
- union {
- double __d;
- int __ll[2];
- } __u;
- __asm__ ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x));
- return __u.__ll[1];
-}
-# endif
-
-__MATH_INLINE double fdim (double __x, double __y) __THROW;
-__MATH_INLINE double
-__NTH (fdim (double __x, double __y))
-{
- return __x <= __y ? 0 : __x - __y;
-}
-
-__MATH_INLINE float fdimf (float __x, float __y) __THROW;
-__MATH_INLINE float
-__NTH (fdimf (float __x, float __y))
-{
- return __x <= __y ? 0 : __x - __y;
-}
-
-#endif /* __USE_ISOC99 */
-#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */
-#endif /* __GNUC__ && !_SOFT_FLOAT */
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/bits/mman.h b/libc/sysdeps/unix/sysv/linux/powerpc/bits/mman.h
index e03ab7ff8..d5729a1f1 100644
--- a/libc/sysdeps/unix/sysv/linux/powerpc/bits/mman.h
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/bits/mman.h
@@ -1,5 +1,5 @@
/* Definitions for POSIX memory map interface. Linux/PowerPC version.
- Copyright (C) 1997, 2000, 2003, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1997,2000,2003,2005,2006,2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -34,6 +34,7 @@
#define PROT_WRITE 0x2 /* Page can be written. */
#define PROT_EXEC 0x4 /* Page can be executed. */
#define PROT_NONE 0x0 /* Page can not be accessed. */
+#define PROT_SAO 0x10 /* Strong Access Ordering. */
#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of
growsdown vma (mprotect only). */
#define PROT_GROWSUP 0x02000000 /* Extend change to start of
diff --git a/libc/sysdeps/unix/sysv/linux/s390/bits/utmp.h b/libc/sysdeps/unix/sysv/linux/s390/bits/utmp.h
new file mode 100644
index 000000000..acb82b0ac
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/s390/bits/utmp.h
@@ -0,0 +1,125 @@
+/* The `struct utmp' type, describing entries in the utmp file. GNU version.
+ Copyright (C) 1993, 1996, 1997, 1998, 1999, 2002, 2008
+ 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 _UTMP_H
+# error "Never include <bits/utmp.h> directly; use <utmp.h> instead."
+#endif
+
+#include <paths.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <bits/wordsize.h>
+
+
+#define UT_LINESIZE 32
+#define UT_NAMESIZE 32
+#define UT_HOSTSIZE 256
+
+
+/* The structure describing an entry in the database of
+ previous logins. */
+struct lastlog
+ {
+#if __WORDSIZE == 32
+ int64_t ll_time;
+#else
+ __time_t ll_time;
+#endif
+ char ll_line[UT_LINESIZE];
+ char ll_host[UT_HOSTSIZE];
+ };
+
+
+/* The structure describing the status of a terminated process. This
+ type is used in `struct utmp' below. */
+struct exit_status
+ {
+ short int e_termination; /* Process termination status. */
+ short int e_exit; /* Process exit status. */
+ };
+
+
+/* The structure describing an entry in the user accounting database. */
+struct utmp
+{
+ short int ut_type; /* Type of login. */
+ pid_t ut_pid; /* Process ID of login process. */
+ char ut_line[UT_LINESIZE]; /* Devicename. */
+ char ut_id[4]; /* Inittab ID. */
+ char ut_user[UT_NAMESIZE]; /* Username. */
+ char ut_host[UT_HOSTSIZE]; /* Hostname for remote login. */
+ struct exit_status ut_exit; /* Exit status of a process marked
+ as DEAD_PROCESS. */
+/* The ut_session and ut_tv fields must be the same size when compiled
+ 32- and 64-bit. This allows data files and shared memory to be
+ shared between 32- and 64-bit applications. */
+#if __WORDSIZE == 32
+ int64_t ut_session; /* Session ID, used for windowing. */
+ struct
+ {
+ int64_t tv_sec; /* Seconds. */
+ int64_t tv_usec; /* Microseconds. */
+ } ut_tv; /* Time entry was made. */
+#else
+ long int ut_session; /* Session ID, used for windowing. */
+ struct timeval ut_tv; /* Time entry was made. */
+#endif
+
+ int32_t ut_addr_v6[4]; /* Internet address of remote host. */
+ char __unused[20]; /* Reserved for future use. */
+};
+
+/* Backwards compatibility hacks. */
+#define ut_name ut_user
+#ifndef _NO_UT_TIME
+/* We have a problem here: `ut_time' is also used otherwise. Define
+ _NO_UT_TIME if the compiler complains. */
+# define ut_time ut_tv.tv_sec
+#endif
+#define ut_xtime ut_tv.tv_sec
+#define ut_addr ut_addr_v6[0]
+
+
+/* Values for the `ut_type' field of a `struct utmp'. */
+#define EMPTY 0 /* No valid user accounting information. */
+
+#define RUN_LVL 1 /* The system's runlevel. */
+#define BOOT_TIME 2 /* Time of system boot. */
+#define NEW_TIME 3 /* Time after system clock changed. */
+#define OLD_TIME 4 /* Time when system clock changed. */
+
+#define INIT_PROCESS 5 /* Process spawned by the init process. */
+#define LOGIN_PROCESS 6 /* Session leader of a logged in user. */
+#define USER_PROCESS 7 /* Normal process. */
+#define DEAD_PROCESS 8 /* Terminated process. */
+
+#define ACCOUNTING 9
+
+/* Old Linux name for the EMPTY type. */
+#define UT_UNKNOWN EMPTY
+
+
+/* Tell the user that we have a modern system with UT_HOST, UT_PID,
+ UT_TYPE, UT_ID and UT_TV fields. */
+#define _HAVE_UT_TYPE 1
+#define _HAVE_UT_PID 1
+#define _HAVE_UT_ID 1
+#define _HAVE_UT_TV 1
+#define _HAVE_UT_HOST 1
diff --git a/libc/sysdeps/unix/sysv/linux/s390/bits/utmpx.h b/libc/sysdeps/unix/sysv/linux/s390/bits/utmpx.h
new file mode 100644
index 000000000..718e29039
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/s390/bits/utmpx.h
@@ -0,0 +1,104 @@
+/* Structures and definitions for the user accounting database. GNU version.
+ Copyright (C) 1997, 1998, 2000, 2001, 2002, 2008
+ 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 _UTMPX_H
+# error "Never include <bits/utmpx.h> directly; use <utmpx.h> instead."
+#endif
+
+#include <bits/types.h>
+#include <sys/time.h>
+#include <bits/wordsize.h>
+
+
+#ifdef __USE_GNU
+# include <paths.h>
+# define _PATH_UTMPX _PATH_UTMP
+# define _PATH_WTMPX _PATH_WTMP
+#endif
+
+
+#define __UT_LINESIZE 32
+#define __UT_NAMESIZE 32
+#define __UT_HOSTSIZE 256
+
+
+/* The structure describing the status of a terminated process. This
+ type is used in `struct utmpx' below. */
+struct __exit_status
+ {
+#ifdef __USE_GNU
+ short int e_termination; /* Process termination status. */
+ short int e_exit; /* Process exit status. */
+#else
+ short int __e_termination; /* Process termination status. */
+ short int __e_exit; /* Process exit status. */
+#endif
+ };
+
+
+/* The structure describing an entry in the user accounting database. */
+struct utmpx
+{
+ short int ut_type; /* Type of login. */
+ __pid_t ut_pid; /* Process ID of login process. */
+ char ut_line[__UT_LINESIZE]; /* Devicename. */
+ char ut_id[4]; /* Inittab ID. */
+ char ut_user[__UT_NAMESIZE]; /* Username. */
+ char ut_host[__UT_HOSTSIZE]; /* Hostname for remote login. */
+ struct __exit_status ut_exit; /* Exit status of a process marked
+ as DEAD_PROCESS. */
+
+/* The fields ut_session and ut_tv must be the same size when compiled
+ 32- and 64-bit. This allows files and shared memory to be shared
+ between 32- and 64-bit applications. */
+#if __WORDSIZE == 32
+ __int64_t ut_session; /* Session ID, used for windowing. */
+ struct
+ {
+ __int64_t tv_sec; /* Seconds. */
+ __int64_t tv_usec; /* Microseconds. */
+ } ut_tv; /* Time entry was made. */
+#else
+ long int ut_session; /* Session ID, used for windowing. */
+ struct timeval ut_tv; /* Time entry was made. */
+#endif
+ __int32_t ut_addr_v6[4]; /* Internet address of remote host. */
+ char __unused[20]; /* Reserved for future use. */
+};
+
+
+/* Values for the `ut_type' field of a `struct utmpx'. */
+#define EMPTY 0 /* No valid user accounting information. */
+
+#ifdef __USE_GNU
+# define RUN_LVL 1 /* The system's runlevel. */
+#endif
+#define BOOT_TIME 2 /* Time of system boot. */
+#define NEW_TIME 3 /* Time after system clock changed. */
+#define OLD_TIME 4 /* Time when system clock changed. */
+
+#define INIT_PROCESS 5 /* Process spawned by the init process. */
+#define LOGIN_PROCESS 6 /* Session leader of a logged in user. */
+#define USER_PROCESS 7 /* Normal process. */
+#define DEAD_PROCESS 8 /* Terminated process. */
+
+#ifdef __USE_GNU
+# define ACCOUNTING 9 /* System accounting. */
+#endif
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/Makefile b/libc/sysdeps/unix/sysv/linux/s390/s390-32/Makefile
index 359c863c0..a509c9312 100644
--- a/libc/sysdeps/unix/sysv/linux/s390/s390-32/Makefile
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/Makefile
@@ -1,3 +1,8 @@
+ifeq ($(subdir),login)
+sysdep_routines += utmp32 utmpx32
+libutil-routines += login32
+endif
+
ifeq ($(subdir),misc)
sysdep_headers += sys/elf.h
endif
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/Versions b/libc/sysdeps/unix/sysv/linux/s390/s390-32/Versions
index 8d6a660cb..b6d608d0a 100644
--- a/libc/sysdeps/unix/sysv/linux/s390/s390-32/Versions
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/Versions
@@ -26,4 +26,27 @@ libc {
GLIBC_2.3.3 {
posix_fadvise64; posix_fallocate64;
}
+ GLIBC_2.9 {
+ getutent;
+ getutid;
+ getutline;
+ pututline;
+ updwtmp;
+ getutent_r;
+ getutid_r;
+ getutline_r;
+ getutxent;
+ getutxid;
+ getutxline;
+ pututxline;
+ updwtmpx;
+ getutmp;
+ getutmpx;
+ }
+}
+
+libutil {
+ GLIBC_2.9 {
+ login;
+ }
}
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutent.c b/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutent.c
new file mode 100644
index 000000000..de3aa3f5b
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutent.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <stdlib.h>
+#include <utmp.h>
+
+#include "utmp-compat.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#include "login/getutent.c"
+
+default_symbol_version (__getutent, getutent, UTMP_COMPAT_BASE);
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutent_r.c b/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutent_r.c
new file mode 100644
index 000000000..8c4be200c
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutent_r.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <bits/libc-lock.h>
+#include <stdlib.h>
+#include <utmp.h>
+
+#include "utmp-compat.h"
+#include "utmp-private.h"
+
+weak_alias (__setutent, setutent)
+weak_alias (__endutent, endutent)
+
+#undef weak_alias
+#define weak_alias(n,a)
+#include "login/getutent_r.c"
+
+default_symbol_version (__getutent_r, getutent_r, UTMP_COMPAT_BASE);
+default_symbol_version (__pututline, pututline, UTMP_COMPAT_BASE);
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutid.c b/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutid.c
new file mode 100644
index 000000000..5285481bb
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutid.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <stdlib.h>
+#include <utmp.h>
+
+#include "utmp-compat.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#include "login/getutid.c"
+
+default_symbol_version (__getutid, getutid, UTMP_COMPAT_BASE);
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutid_r.c b/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutid_r.c
new file mode 100644
index 000000000..5989726db
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutid_r.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <bits/libc-lock.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <utmp.h>
+
+#include "utmp-compat.h"
+#include "utmp-private.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#include "login/getutid_r.c"
+
+default_symbol_version (__getutid_r, getutid_r, UTMP_COMPAT_BASE);
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutline.c b/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutline.c
new file mode 100644
index 000000000..86b1add58
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutline.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <stdlib.h>
+#include <utmp.h>
+
+#include "utmp-compat.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#include "login/getutline.c"
+
+default_symbol_version (__getutline, getutline, UTMP_COMPAT_BASE);
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutline_r.c b/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutline_r.c
new file mode 100644
index 000000000..6d40adbb9
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutline_r.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <bits/libc-lock.h>
+#include <utmp.h>
+
+#include "utmp-compat.h"
+#include "utmp-private.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#include "login/getutline_r.c"
+
+default_symbol_version (__getutline_r, getutline_r, UTMP_COMPAT_BASE);;
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutmp.c b/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutmp.c
new file mode 100644
index 000000000..2a14e1238
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutmp.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <string.h>
+#include <utmp.h>
+/* This is an ugly hack but we must not see the getutmpx declaration. */
+#define getutmpx XXXgetutmpx
+#include <utmpx.h>
+#undef getutmpx
+
+#include "utmp-compat.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#define getutmp __getutmp
+#define getutmpx __getutmpx
+#include "sysdeps/gnu/getutmp.c"
+#undef getutmp
+#undef getutmpx
+
+default_symbol_version (__getutmp, getutmp, UTMP_COMPAT_BASE);
+default_symbol_version (__getutmpx, getutmpx, UTMP_COMPAT_BASE);
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutxent.c b/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutxent.c
new file mode 100644
index 000000000..38179a216
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutxent.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <utmp.h>
+#include <utmpx.h>
+
+#include "utmp-compat.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#define getutxent __getutxent
+#include "login/getutxent.c"
+#undef getutxent
+
+default_symbol_version (__getutxent, getutxent, UTMP_COMPAT_BASE);
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutxid.c b/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutxid.c
new file mode 100644
index 000000000..da1950185
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutxid.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <utmp.h>
+#include <utmpx.h>
+
+#include "utmp-compat.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#define getutxid __getutxid
+#include "login/getutxid.c"
+#undef getutxid
+
+default_symbol_version (__getutxid, getutxid, UTMP_COMPAT_BASE);
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutxline.c b/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutxline.c
new file mode 100644
index 000000000..9336150cf
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/getutxline.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <utmp.h>
+#include <utmpx.h>
+
+#include "utmp-compat.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#define getutxline __getutxline
+#include "login/getutxline.c"
+#undef getutxline
+
+default_symbol_version (__getutxline, getutxline, UTMP_COMPAT_BASE);
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/login.c b/libc/sysdeps/unix/sysv/linux/s390/s390-32/login.c
new file mode 100644
index 000000000..17a21c8d8
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/login.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <assert.h>
+#include <errno.h>
+#include <limits.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <utmp.h>
+
+#include "utmp-compat.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#define login __login
+#include "login/login.c"
+#undef login
+
+default_symbol_version (__login, login, UTMP_COMPAT_BASE);
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/login32.c b/libc/sysdeps/unix/sysv/linux/s390/s390-32/login32.c
new file mode 100644
index 000000000..c9af995f1
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/login32.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <sys/types.h>
+#include <utmp.h>
+#include <libc-symbols.h>
+
+#include "utmp32.h"
+#include "utmp-convert.h"
+
+/* Write the given entry into utmp and wtmp. */
+void
+login32 (const struct utmp32 *entry)
+{
+ struct utmp in64;
+
+ utmp_convert32to64 (entry, &in64);
+ login (&in64);
+}
+
+symbol_version (login32, login, GLIBC_2.0);
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/pututxline.c b/libc/sysdeps/unix/sysv/linux/s390/s390-32/pututxline.c
new file mode 100644
index 000000000..41f93d332
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/pututxline.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <utmp.h>
+#include <utmpx.h>
+
+#include "utmp-compat.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#define pututxline __pututxline
+#include "login/pututxline.c"
+#undef pututxline
+
+default_symbol_version (__pututxline, pututxline, UTMP_COMPAT_BASE);
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/updwtmp.c b/libc/sysdeps/unix/sysv/linux/s390/s390-32/updwtmp.c
new file mode 100644
index 000000000..72e06576a
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/updwtmp.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <utmp.h>
+
+#include "utmp-compat.h"
+#include "utmp-private.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#include "sysdeps/gnu/updwtmp.c"
+
+default_symbol_version (__updwtmp, updwtmp, UTMP_COMPAT_BASE);
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/updwtmpx.c b/libc/sysdeps/unix/sysv/linux/s390/s390-32/updwtmpx.c
new file mode 100644
index 000000000..0f0b87d8a
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/updwtmpx.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <utmp.h>
+#include <utmpx.h>
+
+#include "utmp-compat.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#define updwtmpx __updwtmpx
+#include "login/updwtmpx.c"
+#undef updwtmpx
+
+default_symbol_version (__updwtmpx, updwtmpx, UTMP_COMPAT_BASE);
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/utmp-compat.h b/libc/sysdeps/unix/sysv/linux/s390/s390-32/utmp-compat.h
new file mode 100644
index 000000000..064da5423
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/utmp-compat.h
@@ -0,0 +1,22 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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. */
+
+/* This macro defines the glibc version tag at which the 64 bit struct
+ utmp functions have been added to the 32 bit glibc. */
+#define UTMP_COMPAT_BASE GLIBC_2.9
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/utmp-convert.h b/libc/sysdeps/unix/sysv/linux/s390/s390-32/utmp-convert.h
new file mode 100644
index 000000000..177da80f0
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/utmp-convert.h
@@ -0,0 +1,17 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.c b/libc/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.c
new file mode 100644
index 000000000..32a5d7137
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.c
@@ -0,0 +1,185 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <sys/types.h>
+#include <utmp.h>
+#include <errno.h>
+#include <libc-symbols.h>
+
+#include "utmp32.h"
+#include "utmp-convert.h"
+
+/* Allocate a static buffer to be returned to the caller. As well as
+ with the existing version of these functions the caller has to be
+ aware that the contents of this buffer will change with subsequent
+ calls. */
+#define ALLOCATE_UTMP32_OUT(OUT) \
+ static struct utmp32 *OUT = NULL; \
+ \
+ if (OUT == NULL) \
+ { \
+ OUT = malloc (sizeof (struct utmp32)); \
+ if (OUT == NULL) \
+ return NULL; \
+ }
+
+/* Perform a lookup for a utmp entry matching FIELD using function
+ FUNC. FIELD is converted to a 64 bit utmp and the result is
+ converted back to 32 bit utmp. */
+#define ACCESS_UTMP_ENTRY(FUNC, FIELD) \
+ struct utmp in64; \
+ struct utmp *out64; \
+ ALLOCATE_UTMP32_OUT (out32); \
+ \
+ utmp_convert32to64 (FIELD, &in64); \
+ out64 = FUNC (&in64); \
+ \
+ if (out64 == NULL) \
+ return NULL; \
+ \
+ utmp_convert64to32 (out64, out32); \
+ \
+ return out32;
+
+/* Search forward from the current point in the utmp file until the
+ next entry with a ut_type matching ID->ut_type. */
+struct utmp32 *
+getutid32 (const struct utmp32 *id)
+{
+ ACCESS_UTMP_ENTRY (getutid, id)
+}
+symbol_version (getutid32, getutid, GLIBC_2.0);
+
+/* Search forward from the current point in the utmp file until the
+ next entry with a ut_line matching LINE->ut_line. */
+struct utmp32 *
+getutline32 (const struct utmp32 *line)
+{
+ ACCESS_UTMP_ENTRY (getutline, line)
+}
+symbol_version (getutline32, getutline, GLIBC_2.0);
+
+/* Write out entry pointed to by UTMP_PTR into the utmp file. */
+struct utmp32 *
+pututline32 (const struct utmp32 *utmp_ptr)
+{
+ ACCESS_UTMP_ENTRY (pututline, utmp_ptr)
+}
+symbol_version (pututline32, pututline, GLIBC_2.0);
+
+/* Read next entry from a utmp-like file. */
+struct utmp32 *
+getutent32 (void)
+{
+ struct utmp *out64;
+ ALLOCATE_UTMP32_OUT (out32);
+
+ out64 = getutent ();
+ if (!out64)
+ return NULL;
+
+ utmp_convert64to32 (out64, out32);
+ return out32;
+}
+symbol_version (getutent32, getutent, GLIBC_2.0);
+
+/* Reentrant versions of the file for handling utmp files. */
+
+int
+getutent32_r (struct utmp32 *buffer, struct utmp32 **result)
+{
+ struct utmp out64;
+ struct utmp *out64p;
+ int ret;
+
+ ret = getutent_r (&out64, &out64p);
+ if (ret == -1)
+ {
+ *result = NULL;
+ return -1;
+ }
+
+ utmp_convert64to32 (out64p, buffer);
+ *result = buffer;
+
+ return 0;
+}
+symbol_version (getutent32_r, getutent_r, GLIBC_2.0);
+
+int
+getutid32_r (const struct utmp32 *id, struct utmp32 *buffer,
+ struct utmp32 **result)
+{
+ struct utmp in64;
+ struct utmp out64;
+ struct utmp *out64p;
+ int ret;
+
+ utmp_convert32to64 (id, &in64);
+
+ ret = getutid_r (&in64, &out64, &out64p);
+ if (ret == -1)
+ {
+ *result = NULL;
+ return -1;
+ }
+
+ utmp_convert64to32 (out64p, buffer);
+ *result = buffer;
+
+ return 0;
+}
+symbol_version (getutid32_r, getutid_r, GLIBC_2.0);
+
+int
+getutline32_r (const struct utmp32 *line,
+ struct utmp32 *buffer, struct utmp32 **result)
+{
+ struct utmp in64;
+ struct utmp out64;
+ struct utmp *out64p;
+ int ret;
+
+ utmp_convert32to64 (line, &in64);
+
+ ret = getutline_r (&in64, &out64, &out64p);
+ if (ret == -1)
+ {
+ *result = NULL;
+ return -1;
+ }
+
+ utmp_convert64to32 (out64p, buffer);
+ *result = buffer;
+
+ return 0;
+
+}
+symbol_version (getutline32_r, getutline_r, GLIBC_2.0);
+
+/* Append entry UTMP to the wtmp-like file WTMP_FILE. */
+void
+updwtmp32 (const char *wtmp_file, const struct utmp32 *utmp)
+{
+ struct utmp in32;
+
+ utmp_convert32to64 (utmp, &in32);
+ updwtmp (wtmp_file, &in32);
+}
+symbol_version (updwtmp32, updwtmp, GLIBC_2.0);
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.h b/libc/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.h
new file mode 100644
index 000000000..335bc7fbd
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.h
@@ -0,0 +1,53 @@
+/* The `struct utmp' type, describing entries in the utmp file. GNU version.
+ Copyright (C) 1993, 1996, 1997, 1998, 1999, 2002, 2008
+ 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 _UTMP32_H
+#define _UTMP32_H 1
+
+#include <paths.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <bits/wordsize.h>
+#include <utmp.h>
+
+/* The structure describing an entry in the user accounting database. */
+struct utmp32
+{
+ short int ut_type; /* Type of login. */
+ pid_t ut_pid; /* Process ID of login process. */
+ char ut_line[UT_LINESIZE]; /* Devicename. */
+ char ut_id[4]; /* Inittab ID. */
+ char ut_user[UT_NAMESIZE]; /* Username. */
+ char ut_host[UT_HOSTSIZE]; /* Hostname for remote login. */
+ struct exit_status ut_exit; /* Exit status of a process marked
+ as DEAD_PROCESS. */
+ int32_t ut_session; /* Session ID, used for windowing. */
+ struct
+ {
+ int32_t tv_sec; /* Seconds. */
+ int32_t tv_usec; /* Microseconds. */
+ } ut_tv; /* Time entry was made. */
+
+ int32_t ut_addr_v6[4]; /* Internet address of remote host. */
+ char __unused[20]; /* Reserved for future use. */
+};
+
+
+#endif /* utmp32.h */
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/utmpx-convert.h b/libc/sysdeps/unix/sysv/linux/s390/s390-32/utmpx-convert.h
new file mode 100644
index 000000000..a59989c27
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/utmpx-convert.h
@@ -0,0 +1,86 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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. */
+
+
+/* This file provides functions converting between the 32 and 64 bit
+ struct utmp variants. */
+
+#ifndef _UTMPX_CONVERT_H
+#define _UTMPX_CONVERT_H 1
+
+#include <string.h>
+#include "utmpx32.h"
+
+/* Convert the 64 bit struct utmpx value in FROM to the 32 bit version
+ returned in TO. */
+static inline void
+utmpx_convert64to32 (const struct utmpx *from, struct utmpx32 *to)
+{
+#if _HAVE_UT_TYPE - 0
+ to->ut_type = from->ut_type;
+#endif
+#if _HAVE_UT_PID - 0
+ to->ut_pid = from->ut_pid;
+#endif
+ memcpy (to->ut_line, from->ut_line, __UT_LINESIZE);
+ memcpy (to->ut_user, from->ut_user, __UT_NAMESIZE);
+#if _HAVE_UT_ID - 0
+ memcpy (to->ut_id, from->ut_id, 4);
+#endif
+#if _HAVE_UT_HOST - 0
+ memcpy (to->ut_host, from->ut_host, __UT_HOSTSIZE);
+#endif
+ to->ut_exit = from->ut_exit;
+ to->ut_session = (int32_t) from->ut_session;
+#if _HAVE_UT_TV - 0
+ to->ut_tv.tv_sec = (int32_t) from->ut_tv.tv_sec;
+ to->ut_tv.tv_usec = (int32_t) from->ut_tv.tv_usec;
+#endif
+ memcpy (to->ut_addr_v6, from->ut_addr_v6, 4 * 4);
+}
+
+/* Convert the 32 bit struct utmpx value in FROM to the 64 bit version
+ returned in TO. */
+static inline void
+utmpx_convert32to64 (const struct utmpx32 *from, struct utmpx *to)
+{
+#if _HAVE_UT_TYPE - 0
+ to->ut_type = from->ut_type;
+#endif
+#if _HAVE_UT_PID - 0
+ to->ut_pid = from->ut_pid;
+#endif
+ memcpy (to->ut_line, from->ut_line, __UT_LINESIZE);
+ memcpy (to->ut_user, from->ut_user, __UT_NAMESIZE);
+#if _HAVE_UT_ID - 0
+ memcpy (to->ut_id, from->ut_id, 4);
+#endif
+#if _HAVE_UT_HOST - 0
+ memcpy (to->ut_host, from->ut_host, __UT_HOSTSIZE);
+#endif
+ to->ut_exit = from->ut_exit;
+ to->ut_session = (int64_t) from->ut_session;
+#if _HAVE_UT_TV - 0
+ to->ut_tv.tv_sec = (int64_t) from->ut_tv.tv_sec;
+ to->ut_tv.tv_usec = (int64_t) from->ut_tv.tv_usec;
+#endif
+ memcpy (to->ut_addr_v6, from->ut_addr_v6, 4 * 4);
+}
+
+#endif /* utmpx-convert.h */
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.c b/libc/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.c
new file mode 100644
index 000000000..69a1384db
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.c
@@ -0,0 +1,140 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <sys/types.h>
+#include <utmp.h>
+#include <errno.h>
+#include <libc-symbols.h>
+
+#include "utmp32.h"
+#include "utmp-convert.h"
+
+#include "utmpx32.h"
+#include "utmpx-convert.h"
+
+/* Allocate a static buffer to be returned to the caller. As well as
+ with the existing version of these functions the caller has to be
+ aware that the contents of this buffer will change with subsequent
+ calls. */
+#define ALLOCATE_UTMPX32_OUT(OUT) \
+ static struct utmpx32 *OUT = NULL; \
+ \
+ if (OUT == NULL) \
+ { \
+ OUT = malloc (sizeof (struct utmpx32)); \
+ if (OUT == NULL) \
+ return NULL; \
+ }
+
+/* Perform a lookup for a utmpx entry matching FIELD using function
+ FUNC. FIELD is converted to a 64 bit utmpx and the result is
+ converted back to 32 bit utmpx. */
+#define ACCESS_UTMPX_ENTRY(FUNC, FIELD) \
+ struct utmpx in64; \
+ struct utmpx *out64; \
+ ALLOCATE_UTMPX32_OUT (out32); \
+ \
+ utmpx_convert32to64 (FIELD, &in64); \
+ out64 = FUNC (&in64); \
+ \
+ if (out64 == NULL) \
+ return NULL; \
+ \
+ utmpx_convert64to32 (out64, out32); \
+ \
+ return out32;
+
+
+/* Get the next entry from the user accounting database. */
+struct utmpx32 *
+getutxent32 (void)
+{
+ struct utmpx *out64;
+ ALLOCATE_UTMPX32_OUT (out32);
+
+ out64 = getutxent ();
+ if (!out64)
+ return NULL;
+
+ utmpx_convert64to32 (out64, out32);
+ return out32;
+
+}
+symbol_version (getutxent32, getutxent, GLIBC_2.1);
+
+/* Get the user accounting database entry corresponding to ID. */
+struct utmpx32 *
+getutxid32 (const struct utmpx32 *id)
+{
+ ACCESS_UTMPX_ENTRY (getutxid, id);
+}
+symbol_version (getutxid32, getutxid, GLIBC_2.1);
+
+/* Get the user accounting database entry corresponding to LINE. */
+struct utmpx32 *
+getutxline32 (const struct utmpx32 *line)
+{
+ ACCESS_UTMPX_ENTRY (getutxline, line);
+}
+symbol_version (getutxline32, getutxline, GLIBC_2.1);
+
+/* Write the entry UTMPX into the user accounting database. */
+struct utmpx32 *
+pututxline32 (const struct utmpx32 *utmpx)
+{
+ ACCESS_UTMPX_ENTRY (pututxline, utmpx);
+}
+symbol_version (pututxline32, pututxline, GLIBC_2.1);
+
+/* Append entry UTMP to the wtmpx-like file WTMPX_FILE. */
+void
+updwtmpx32 (const char *wtmpx_file, const struct utmpx32 *utmpx)
+{
+ struct utmpx in64;
+
+ utmpx_convert32to64 (utmpx, &in64);
+ updwtmpx (wtmpx_file, &in64);
+}
+symbol_version (updwtmpx32, updwtmpx, GLIBC_2.1);
+
+/* Copy the information in UTMPX to UTMP. */
+void
+getutmp32 (const struct utmpx32 *utmpx, struct utmp32 *utmp)
+{
+ struct utmpx in64;
+ struct utmp out64;
+
+ utmpx_convert32to64 (utmpx, &in64);
+ getutmp (&in64, &out64);
+ utmp_convert64to32 (&out64, utmp);
+}
+symbol_version (getutmp32, getutmp, GLIBC_2.1.1);
+
+/* Copy the information in UTMP to UTMPX. */
+void
+getutmpx32 (const struct utmp32 *utmp, struct utmpx32 *utmpx)
+{
+ struct utmp in64;
+ struct utmpx out64;
+
+ utmp_convert32to64 (utmp, &in64);
+ getutmpx (&in64, &out64);
+ utmpx_convert64to32 (&out64, utmpx);
+}
+symbol_version (getutmpx32, getutmpx, GLIBC_2.1.1);
diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.h b/libc/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.h
new file mode 100644
index 000000000..5f468ed68
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.h
@@ -0,0 +1,52 @@
+/* The `struct utmp' type, describing entries in the utmp file. GNU version.
+ Copyright (C) 1993, 1996, 1997, 1998, 1999, 2002, 2008
+ 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 _UTMPX32_H
+#define _UTMPX32_H 1
+
+#include <paths.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <bits/wordsize.h>
+#include <utmpx.h>
+
+/* The structure describing an entry in the user accounting database. */
+struct utmpx32
+{
+ short int ut_type; /* Type of login. */
+ __pid_t ut_pid; /* Process ID of login process. */
+ char ut_line[__UT_LINESIZE]; /* Devicename. */
+ char ut_id[4]; /* Inittab ID. */
+ char ut_user[__UT_NAMESIZE]; /* Username. */
+ char ut_host[__UT_HOSTSIZE]; /* Hostname for remote login. */
+ struct __exit_status ut_exit; /* Exit status of a process marked
+ as DEAD_PROCESS. */
+ __int64_t ut_session; /* Session ID, used for windowing. */
+ struct
+ {
+ __int64_t tv_sec; /* Seconds. */
+ __int64_t tv_usec; /* Microseconds. */
+ } ut_tv; /* Time entry was made. */
+
+ __int32_t ut_addr_v6[4]; /* Internet address of remote host. */
+ char __unused[20]; /* Reserved for future use. */
+};
+
+#endif /* utmpx32.h */
diff --git a/libc/sysdeps/unix/sysv/linux/signalfd.c b/libc/sysdeps/unix/sysv/linux/signalfd.c
index 09355ecd1..9898f2923 100644
--- a/libc/sysdeps/unix/sysv/linux/signalfd.c
+++ b/libc/sysdeps/unix/sysv/linux/signalfd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2007, 2008 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
@@ -25,7 +25,10 @@
int
signalfd (int fd, const sigset_t *mask, int flags)
{
- /* The system call has no flag parameter which is bad. So we have
+#ifdef __NR_signalfd4
+ return INLINE_SYSCALL (signalfd4, 4, fd, mask, _NSIG / 8, flags);
+#else
+ /* The old system call has no flag parameter which is bad. So we have
to wait until we have to support to pass additional values to the
kernel (sys_indirect) before implementing setting flags like
O_NONBLOCK etc. */
@@ -35,10 +38,11 @@ signalfd (int fd, const sigset_t *mask, int flags)
return -1;
}
-#ifdef __NR_signalfd
+# ifdef __NR_signalfd
return INLINE_SYSCALL (signalfd, 3, fd, mask, _NSIG / 8);
-#else
+# else
__set_errno (ENOSYS);
return -1;
+# endif
#endif
}
diff --git a/libc/sysdeps/unix/sysv/linux/socketcall.h b/libc/sysdeps/unix/sysv/linux/socketcall.h
index d836534f3..24ec9ee2a 100644
--- a/libc/sysdeps/unix/sysv/linux/socketcall.h
+++ b/libc/sysdeps/unix/sysv/linux/socketcall.h
@@ -1,5 +1,5 @@
/* ID for functions called via socketcall system call.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 2008 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
@@ -18,7 +18,6 @@
02111-1307 USA. */
#ifndef _SYS_SOCKETCALL_H
-
#define _SYS_SOCKETCALL_H 1
/* Define unique numbers for the operations permitted on socket. Linux
@@ -44,5 +43,6 @@
#define SOCKOP_getsockopt 15
#define SOCKOP_sendmsg 16
#define SOCKOP_recvmsg 17
+#define SOCKOP_paccept 18
-#endif /* _SYS_SOCKETCALL_H */
+#endif /* sys/socketcall.h */
diff --git a/libc/sysdeps/unix/sysv/linux/sparc/bits/socket.h b/libc/sysdeps/unix/sysv/linux/sparc/bits/socket.h
new file mode 100644
index 000000000..d43a3cdf7
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/sparc/bits/socket.h
@@ -0,0 +1,393 @@
+/* System-specific socket constants and types. Linux/SPARC version.
+ Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007, 2008
+ 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 __BITS_SOCKET_H
+#define __BITS_SOCKET_H
+
+#ifndef _SYS_SOCKET_H
+# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
+#endif
+
+#define __need_size_t
+#include <stddef.h>
+
+#include <sys/types.h>
+
+/* Type for length arguments in socket calls. */
+#ifndef __socklen_t_defined
+typedef __socklen_t socklen_t;
+# define __socklen_t_defined
+#endif
+
+/* Types of sockets. */
+enum __socket_type
+{
+ SOCK_STREAM = 1, /* Sequenced, reliable, connection-based
+ byte streams. */
+#define SOCK_STREAM SOCK_STREAM
+ SOCK_DGRAM = 2, /* Connectionless, unreliable datagrams
+ of fixed maximum length. */
+#define SOCK_DGRAM SOCK_DGRAM
+ SOCK_RAW = 3, /* Raw protocol interface. */
+#define SOCK_RAW SOCK_RAW
+ SOCK_RDM = 4, /* Reliably-delivered messages. */
+#define SOCK_RDM SOCK_RDM
+ SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based,
+ datagrams of fixed maximum length. */
+#define SOCK_SEQPACKET SOCK_SEQPACKET
+ SOCK_DCCP = 6, /* Datagram Congestion Control Protocol. */
+#define SOCK_DCCP SOCK_DCCP
+ SOCK_PACKET = 10, /* Linux specific way of getting packets
+ at the dev level. For writing rarp and
+ other similar things on the user level. */
+#define SOCK_PACKET SOCK_PACKET
+
+ /* Flags to be ORed into the type parameter of socket and socketpair. */
+
+ SOCK_CLOEXEC = 0x400000, /* Atomically set close-on-exec flag for the
+ new descriptor(s). */
+#define SOCK_CLOEXEC SOCK_CLOEXEC
+ SOCK_NONBLOCK = 0x4000 /* Atomically mark descriptor(s) as
+ non-blocking. */
+#define SOCK_NONBLOCK SOCK_NONBLOCK
+};
+
+/* Protocol families. */
+#define PF_UNSPEC 0 /* Unspecified. */
+#define PF_LOCAL 1 /* Local to host (pipes and file-domain). */
+#define PF_UNIX PF_LOCAL /* POSIX name for PF_LOCAL. */
+#define PF_FILE PF_LOCAL /* Another non-standard name for PF_LOCAL. */
+#define PF_INET 2 /* IP protocol family. */
+#define PF_AX25 3 /* Amateur Radio AX.25. */
+#define PF_IPX 4 /* Novell Internet Protocol. */
+#define PF_APPLETALK 5 /* Appletalk DDP. */
+#define PF_NETROM 6 /* Amateur radio NetROM. */
+#define PF_BRIDGE 7 /* Multiprotocol bridge. */
+#define PF_ATMPVC 8 /* ATM PVCs. */
+#define PF_X25 9 /* Reserved for X.25 project. */
+#define PF_INET6 10 /* IP version 6. */
+#define PF_ROSE 11 /* Amateur Radio X.25 PLP. */
+#define PF_DECnet 12 /* Reserved for DECnet project. */
+#define PF_NETBEUI 13 /* Reserved for 802.2LLC project. */
+#define PF_SECURITY 14 /* Security callback pseudo AF. */
+#define PF_KEY 15 /* PF_KEY key management API. */
+#define PF_NETLINK 16
+#define PF_ROUTE PF_NETLINK /* Alias to emulate 4.4BSD. */
+#define PF_PACKET 17 /* Packet family. */
+#define PF_ASH 18 /* Ash. */
+#define PF_ECONET 19 /* Acorn Econet. */
+#define PF_ATMSVC 20 /* ATM SVCs. */
+#define PF_SNA 22 /* Linux SNA Project */
+#define PF_IRDA 23 /* IRDA sockets. */
+#define PF_PPPOX 24 /* PPPoX sockets. */
+#define PF_WANPIPE 25 /* Wanpipe API sockets. */
+#define PF_BLUETOOTH 31 /* Bluetooth sockets. */
+#define PF_IUCV 32 /* IUCV sockets. */
+#define PF_RXRPC 33 /* RxRPC sockets. */
+#define PF_ISDN 34 /* mISDN sockets. */
+#define PF_MAX 35 /* For now.. */
+
+/* Address families. */
+#define AF_UNSPEC PF_UNSPEC
+#define AF_LOCAL PF_LOCAL
+#define AF_UNIX PF_UNIX
+#define AF_FILE PF_FILE
+#define AF_INET PF_INET
+#define AF_AX25 PF_AX25
+#define AF_IPX PF_IPX
+#define AF_APPLETALK PF_APPLETALK
+#define AF_NETROM PF_NETROM
+#define AF_BRIDGE PF_BRIDGE
+#define AF_ATMPVC PF_ATMPVC
+#define AF_X25 PF_X25
+#define AF_INET6 PF_INET6
+#define AF_ROSE PF_ROSE
+#define AF_DECnet PF_DECnet
+#define AF_NETBEUI PF_NETBEUI
+#define AF_SECURITY PF_SECURITY
+#define AF_KEY PF_KEY
+#define AF_NETLINK PF_NETLINK
+#define AF_ROUTE PF_ROUTE
+#define AF_PACKET PF_PACKET
+#define AF_ASH PF_ASH
+#define AF_ECONET PF_ECONET
+#define AF_ATMSVC PF_ATMSVC
+#define AF_SNA PF_SNA
+#define AF_IRDA PF_IRDA
+#define AF_PPPOX PF_PPPOX
+#define AF_WANPIPE PF_WANPIPE
+#define AF_BLUETOOTH PF_BLUETOOTH
+#define AF_IUCV PF_IUCV
+#define AF_RXRPC PF_RXRPC
+#define AF_ISDN PF_ISDN
+#define AF_MAX PF_MAX
+
+/* Socket level values. Others are defined in the appropriate headers.
+
+ XXX These definitions also should go into the appropriate headers as
+ far as they are available. */
+#define SOL_RAW 255
+#define SOL_DECNET 261
+#define SOL_X25 262
+#define SOL_PACKET 263
+#define SOL_ATM 264 /* ATM layer (cell level). */
+#define SOL_AAL 265 /* ATM Adaption Layer (packet level). */
+#define SOL_IRDA 266
+
+/* Maximum queue length specifiable by listen. */
+#define SOMAXCONN 128
+
+/* Get the definition of the macro to define the common sockaddr members. */
+#include <bits/sockaddr.h>
+
+/* Structure describing a generic socket address. */
+struct sockaddr
+ {
+ __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */
+ char sa_data[14]; /* Address data. */
+ };
+
+
+/* Structure large enough to hold any socket address (with the historical
+ exception of AF_UNIX). We reserve 128 bytes. */
+#define __ss_aligntype unsigned long int
+#define _SS_SIZE 128
+#define _SS_PADSIZE (_SS_SIZE - (2 * sizeof (__ss_aligntype)))
+
+struct sockaddr_storage
+ {
+ __SOCKADDR_COMMON (ss_); /* Address family, etc. */
+ __ss_aligntype __ss_align; /* Force desired alignment. */
+ char __ss_padding[_SS_PADSIZE];
+ };
+
+
+/* Bits in the FLAGS argument to `send', `recv', et al. */
+enum
+ {
+ MSG_OOB = 0x01, /* Process out-of-band data. */
+#define MSG_OOB MSG_OOB
+ MSG_PEEK = 0x02, /* Peek at incoming messages. */
+#define MSG_PEEK MSG_PEEK
+ MSG_DONTROUTE = 0x04, /* Don't use local routing. */
+#define MSG_DONTROUTE MSG_DONTROUTE
+#ifdef __USE_GNU
+ /* DECnet uses a different name. */
+ MSG_TRYHARD = MSG_DONTROUTE,
+# define MSG_TRYHARD MSG_DONTROUTE
+#endif
+ MSG_CTRUNC = 0x08, /* Control data lost before delivery. */
+#define MSG_CTRUNC MSG_CTRUNC
+ MSG_PROXY = 0x10, /* Supply or ask second address. */
+#define MSG_PROXY MSG_PROXY
+ MSG_TRUNC = 0x20,
+#define MSG_TRUNC MSG_TRUNC
+ MSG_DONTWAIT = 0x40, /* Nonblocking IO. */
+#define MSG_DONTWAIT MSG_DONTWAIT
+ MSG_EOR = 0x80, /* End of record. */
+#define MSG_EOR MSG_EOR
+ MSG_WAITALL = 0x100, /* Wait for a full request. */
+#define MSG_WAITALL MSG_WAITALL
+ MSG_FIN = 0x200,
+#define MSG_FIN MSG_FIN
+ MSG_SYN = 0x400,
+#define MSG_SYN MSG_SYN
+ MSG_CONFIRM = 0x800, /* Confirm path validity. */
+#define MSG_CONFIRM MSG_CONFIRM
+ MSG_RST = 0x1000,
+#define MSG_RST MSG_RST
+ MSG_ERRQUEUE = 0x2000, /* Fetch message from error queue. */
+#define MSG_ERRQUEUE MSG_ERRQUEUE
+ MSG_NOSIGNAL = 0x4000, /* Do not generate SIGPIPE. */
+#define MSG_NOSIGNAL MSG_NOSIGNAL
+ MSG_MORE = 0x8000, /* Sender will send more. */
+#define MSG_MORE MSG_MORE
+
+ MSG_CMSG_CLOEXEC = 0x40000000 /* Set close_on_exit for file
+ descriptor received through
+ SCM_RIGHTS. */
+#define MSG_CMSG_CLOEXEC MSG_CMSG_CLOEXEC
+ };
+
+
+/* Structure describing messages sent by
+ `sendmsg' and received by `recvmsg'. */
+struct msghdr
+ {
+ void *msg_name; /* Address to send to/receive from. */
+ socklen_t msg_namelen; /* Length of address data. */
+
+ struct iovec *msg_iov; /* Vector of data to send/receive into. */
+ size_t msg_iovlen; /* Number of elements in the vector. */
+
+ void *msg_control; /* Ancillary data (eg BSD filedesc passing). */
+ size_t msg_controllen; /* Ancillary data buffer length.
+ !! The type should be socklen_t but the
+ definition of the kernel is incompatible
+ with this. */
+
+ int msg_flags; /* Flags on received message. */
+ };
+
+/* Structure used for storage of ancillary data object information. */
+struct cmsghdr
+ {
+ size_t cmsg_len; /* Length of data in cmsg_data plus length
+ of cmsghdr structure.
+ !! The type should be socklen_t but the
+ definition of the kernel is incompatible
+ with this. */
+ int cmsg_level; /* Originating protocol. */
+ int cmsg_type; /* Protocol specific type. */
+#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
+ __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data. */
+#endif
+ };
+
+/* Ancillary data object manipulation macros. */
+#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
+# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
+#else
+# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
+#endif
+#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
+#define CMSG_FIRSTHDR(mhdr) \
+ ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) \
+ ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0)
+#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \
+ & (size_t) ~(sizeof (size_t) - 1))
+#define CMSG_SPACE(len) (CMSG_ALIGN (len) \
+ + CMSG_ALIGN (sizeof (struct cmsghdr)))
+#define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
+
+extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr,
+ struct cmsghdr *__cmsg) __THROW;
+#ifdef __USE_EXTERN_INLINES
+# ifndef _EXTERN_INLINE
+# define _EXTERN_INLINE __extern_inline
+# endif
+_EXTERN_INLINE struct cmsghdr *
+__NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg))
+{
+ if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
+ /* The kernel header does this so there may be a reason. */
+ return 0;
+
+ __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
+ + CMSG_ALIGN (__cmsg->cmsg_len));
+ if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) __mhdr->msg_control
+ + __mhdr->msg_controllen)
+ || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)
+ > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
+ /* No more entries. */
+ return 0;
+ return __cmsg;
+}
+#endif /* Use `extern inline'. */
+
+/* Socket level message types. This must match the definitions in
+ <linux/socket.h>. */
+enum
+ {
+ SCM_RIGHTS = 0x01 /* Transfer file descriptors. */
+#define SCM_RIGHTS SCM_RIGHTS
+#ifdef __USE_BSD
+ , SCM_CREDENTIALS = 0x02 /* Credentials passing. */
+# define SCM_CREDENTIALS SCM_CREDENTIALS
+#endif
+ };
+
+#ifdef __USE_GNU
+/* User visible structure for SCM_CREDENTIALS message */
+struct ucred
+{
+ pid_t pid; /* PID of sending process. */
+ uid_t uid; /* UID of sending process. */
+ gid_t gid; /* GID of sending process. */
+};
+#endif
+
+/* Ugly workaround for unclean kernel headers. */
+#if !defined __USE_MISC && !defined __USE_GNU
+# ifndef FIOGETOWN
+# define __SYS_SOCKET_H_undef_FIOGETOWN
+# endif
+# ifndef FIOSETOWN
+# define __SYS_SOCKET_H_undef_FIOSETOWN
+# endif
+# ifndef SIOCATMARK
+# define __SYS_SOCKET_H_undef_SIOCATMARK
+# endif
+# ifndef SIOCGPGRP
+# define __SYS_SOCKET_H_undef_SIOCGPGRP
+# endif
+# ifndef SIOCGSTAMP
+# define __SYS_SOCKET_H_undef_SIOCGSTAMP
+# endif
+# ifndef SIOCGSTAMPNS
+# define __SYS_SOCKET_H_undef_SIOCGSTAMPNS
+# endif
+# ifndef SIOCSPGRP
+# define __SYS_SOCKET_H_undef_SIOCSPGRP
+# endif
+#endif
+
+/* Get socket manipulation related informations from kernel headers. */
+#include <asm/socket.h>
+
+#if !defined __USE_MISC && !defined __USE_GNU
+# ifdef __SYS_SOCKET_H_undef_FIOGETOWN
+# undef __SYS_SOCKET_H_undef_FIOGETOWN
+# undef FIOGETOWN
+# endif
+# ifdef __SYS_SOCKET_H_undef_FIOSETOWN
+# undef __SYS_SOCKET_H_undef_FIOSETOWN
+# undef FIOSETOWN
+# endif
+# ifdef __SYS_SOCKET_H_undef_SIOCATMARK
+# undef __SYS_SOCKET_H_undef_SIOCATMARK
+# undef SIOCATMARK
+# endif
+# ifdef __SYS_SOCKET_H_undef_SIOCGPGRP
+# undef __SYS_SOCKET_H_undef_SIOCGPGRP
+# undef SIOCGPGRP
+# endif
+# ifdef __SYS_SOCKET_H_undef_SIOCGSTAMP
+# undef __SYS_SOCKET_H_undef_SIOCGSTAMP
+# undef SIOCGSTAMP
+# endif
+# ifdef __SYS_SOCKET_H_undef_SIOCGSTAMPNS
+# undef __SYS_SOCKET_H_undef_SIOCGSTAMPNS
+# undef SIOCGSTAMPNS
+# endif
+# ifdef __SYS_SOCKET_H_undef_SIOCSPGRP
+# undef __SYS_SOCKET_H_undef_SIOCSPGRP
+# undef SIOCSPGRP
+# endif
+#endif
+
+/* Structure used to manipulate the SO_LINGER option. */
+struct linger
+ {
+ int l_onoff; /* Nonzero to linger on close. */
+ int l_linger; /* Time to linger. */
+ };
+
+#endif /* bits/socket.h */
diff --git a/libc/sysdeps/unix/sysv/linux/sparc/sys/epoll.h b/libc/sysdeps/unix/sysv/linux/sparc/sys/epoll.h
new file mode 100644
index 000000000..cc0ddef69
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/sparc/sys/epoll.h
@@ -0,0 +1,143 @@
+/* Copyright (C) 2002-2006, 2007, 2008 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 _SYS_EPOLL_H
+#define _SYS_EPOLL_H 1
+
+#include <stdint.h>
+#include <sys/types.h>
+
+/* Get __sigset_t. */
+#include <bits/sigset.h>
+
+#ifndef __sigset_t_defined
+# define __sigset_t_defined
+typedef __sigset_t sigset_t;
+#endif
+
+
+/* Flags to be passed to epoll_create2. */
+enum
+ {
+ EPOLL_CLOEXEC = 0x400000,
+#define EPOLL_CLOEXEC EPOLL_CLOEXEC
+ EPOLL_NONBLOCK = 0x4000
+#define EPOLL_NONBLOCK EPOLL_NONBLOCK
+ };
+
+
+enum EPOLL_EVENTS
+ {
+ EPOLLIN = 0x001,
+#define EPOLLIN EPOLLIN
+ EPOLLPRI = 0x002,
+#define EPOLLPRI EPOLLPRI
+ EPOLLOUT = 0x004,
+#define EPOLLOUT EPOLLOUT
+ EPOLLRDNORM = 0x040,
+#define EPOLLRDNORM EPOLLRDNORM
+ EPOLLRDBAND = 0x080,
+#define EPOLLRDBAND EPOLLRDBAND
+ EPOLLWRNORM = 0x100,
+#define EPOLLWRNORM EPOLLWRNORM
+ EPOLLWRBAND = 0x200,
+#define EPOLLWRBAND EPOLLWRBAND
+ EPOLLMSG = 0x400,
+#define EPOLLMSG EPOLLMSG
+ EPOLLERR = 0x008,
+#define EPOLLERR EPOLLERR
+ EPOLLHUP = 0x010,
+#define EPOLLHUP EPOLLHUP
+ EPOLLRDHUP = 0x2000,
+#define EPOLLRDHUP EPOLLRDHUP
+ EPOLLONESHOT = (1 << 30),
+#define EPOLLONESHOT EPOLLONESHOT
+ EPOLLET = (1 << 31)
+#define EPOLLET EPOLLET
+ };
+
+
+/* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */
+#define EPOLL_CTL_ADD 1 /* Add a file descriptor to the interface. */
+#define EPOLL_CTL_DEL 2 /* Remove a file descriptor from the interface. */
+#define EPOLL_CTL_MOD 3 /* Change file descriptor epoll_event structure. */
+
+
+typedef union epoll_data
+{
+ void *ptr;
+ int fd;
+ uint32_t u32;
+ uint64_t u64;
+} epoll_data_t;
+
+struct epoll_event
+{
+ uint32_t events; /* Epoll events */
+ epoll_data_t data; /* User data variable */
+};
+
+
+__BEGIN_DECLS
+
+/* Creates an epoll instance. Returns an fd for the new instance.
+ The "size" parameter is a hint specifying the number of file
+ descriptors to be associated with the new instance. The fd
+ returned by epoll_create() should be closed with close(). */
+extern int epoll_create (int __size) __THROW;
+
+/* Same as epoll_create but with an additional FLAGS parameter. */
+extern int epoll_create2 (int __size, int __flags) __THROW;
+
+
+/* Manipulate an epoll instance "epfd". Returns 0 in case of success,
+ -1 in case of error ( the "errno" variable will contain the
+ specific error code ) The "op" parameter is one of the EPOLL_CTL_*
+ constants defined above. The "fd" parameter is the target of the
+ operation. The "event" parameter describes which events the caller
+ is interested in and any associated user data. */
+extern int epoll_ctl (int __epfd, int __op, int __fd,
+ struct epoll_event *__event) __THROW;
+
+
+/* Wait for events on an epoll instance "epfd". Returns the number of
+ triggered events returned in "events" buffer. Or -1 in case of
+ error with the "errno" variable set to the specific error code. The
+ "events" parameter is a buffer that will contain triggered
+ events. The "maxevents" is the maximum number of events to be
+ returned ( usually size of "events" ). The "timeout" parameter
+ specifies the maximum wait time in milliseconds (-1 == infinite).
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int epoll_wait (int __epfd, struct epoll_event *__events,
+ int __maxevents, int __timeout);
+
+
+/* Same as epoll_wait, but the thread's signal mask is temporarily
+ and atomically replaced with the one provided as parameter.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int epoll_pwait (int __epfd, struct epoll_event *__events,
+ int __maxevents, int __timeout,
+ __const __sigset_t *__ss);
+
+__END_DECLS
+
+#endif /* sys/epoll.h */
diff --git a/libc/sysdeps/unix/sysv/linux/sparc/sys/eventfd.h b/libc/sysdeps/unix/sysv/linux/sparc/sys/eventfd.h
new file mode 100644
index 000000000..aff4f3592
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/sparc/sys/eventfd.h
@@ -0,0 +1,52 @@
+/* Copyright (C) 2007, 2008 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 _SYS_EVENTFD_H
+#define _SYS_EVENTFD_H 1
+
+#include <stdint.h>
+
+
+/* Type for event counter. */
+typedef uint64_t eventfd_t;
+
+/* Flags for signalfd. */
+enum
+ {
+ EFD_CLOEXEC = 0x400000,
+#define EFD_CLOEXEC EFD_CLOEXEC
+ EFD_NONBLOCK = 0x4000
+#define EFD_NONBLOCK EFD_NONBLOCK
+ };
+
+
+__BEGIN_DECLS
+
+/* Return file descriptor for generic event channel. Set initial
+ value to COUNT. */
+extern int eventfd (int __count, int __flags) __THROW;
+
+/* Read event counter and possibly wait for events. */
+extern int eventfd_read (int __fd, eventfd_t *__value);
+
+/* Increment event counter. */
+extern int eventfd_write (int __fd, eventfd_t value);
+
+__END_DECLS
+
+#endif /* sys/eventfd.h */
diff --git a/libc/sysdeps/unix/sysv/linux/sparc/sys/inotify.h b/libc/sysdeps/unix/sysv/linux/sparc/sys/inotify.h
new file mode 100644
index 000000000..b1fccc42c
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/sparc/sys/inotify.h
@@ -0,0 +1,105 @@
+/* Copyright (C) 2005, 2006, 2008 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 _SYS_INOTIFY_H
+#define _SYS_INOTIFY_H 1
+
+#include <stdint.h>
+
+
+/* Flags for the parameter of inotify_init1. */
+enum
+ {
+ IN_CLOEXEC = 0x400000,
+#define IN_CLOEXEC IN_CLOEXEC
+ IN_NONBLOCK = 0x4000
+#define IN_NONBLOCK IN_NONBLOCK
+ };
+
+
+/* Structure describing an inotify event. */
+struct inotify_event
+{
+ int wd; /* Watch descriptor. */
+ uint32_t mask; /* Watch mask. */
+ uint32_t cookie; /* Cookie to synchronize two events. */
+ uint32_t len; /* Length (including NULs) of name. */
+ char name __flexarr; /* Name. */
+};
+
+
+/* Supported events suitable for MASK parameter of INOTIFY_ADD_WATCH. */
+#define IN_ACCESS 0x00000001 /* File was accessed. */
+#define IN_MODIFY 0x00000002 /* File was modified. */
+#define IN_ATTRIB 0x00000004 /* Metadata changed. */
+#define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed. */
+#define IN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed. */
+#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* Close. */
+#define IN_OPEN 0x00000020 /* File was opened. */
+#define IN_MOVED_FROM 0x00000040 /* File was moved from X. */
+#define IN_MOVED_TO 0x00000080 /* File was moved to Y. */
+#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* Moves. */
+#define IN_CREATE 0x00000100 /* Subfile was created. */
+#define IN_DELETE 0x00000200 /* Subfile was deleted. */
+#define IN_DELETE_SELF 0x00000400 /* Self was deleted. */
+#define IN_MOVE_SELF 0x00000800 /* Self was moved. */
+
+/* Events sent by the kernel. */
+#define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted. */
+#define IN_Q_OVERFLOW 0x00004000 /* Event queued overflowed. */
+#define IN_IGNORED 0x00008000 /* File was ignored. */
+
+/* Helper events. */
+#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* Close. */
+#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* Moves. */
+
+/* Special flags. */
+#define IN_ONLYDIR 0x01000000 /* Only watch the path if it is a
+ directory. */
+#define IN_DONT_FOLLOW 0x02000000 /* Do not follow a sym link. */
+#define IN_MASK_ADD 0x20000000 /* Add to the mask of an already
+ existing watch. */
+#define IN_ISDIR 0x40000000 /* Event occurred against dir. */
+#define IN_ONESHOT 0x80000000 /* Only send event once. */
+
+/* All events which a program can wait on. */
+#define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE \
+ | IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM \
+ | IN_MOVED_TO | IN_CREATE | IN_DELETE \
+ | IN_DELETE_SELF | IN_MOVE_SELF)
+
+
+__BEGIN_DECLS
+
+/* Create and initialize inotify instance. */
+extern int inotify_init (void) __THROW;
+
+/* Create and initialize inotify instance. */
+extern int inotify_init1 (int __flags) __THROW;
+
+/* Add watch of object NAME to inotify instance FD. Notify about
+ events specified by MASK. */
+extern int inotify_add_watch (int __fd, const char *__name, uint32_t __mask)
+ __THROW;
+
+/* Remove the watch specified by WD from the inotify instance FD. */
+extern int inotify_rm_watch (int __fd, uint32_t __wd) __THROW;
+
+__END_DECLS
+
+#endif /* sys/inotify.h */
diff --git a/libc/sysdeps/unix/sysv/linux/sparc/sys/signalfd.h b/libc/sysdeps/unix/sysv/linux/sparc/sys/signalfd.h
new file mode 100644
index 000000000..a134cc7ba
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/sparc/sys/signalfd.h
@@ -0,0 +1,66 @@
+/* Copyright (C) 2007, 2008 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 _SYS_SIGNALFD_H
+#define _SYS_SIGNALFD_H 1
+
+#define __need_sigset_t
+#include <signal.h>
+#include <stdint.h>
+
+
+struct signalfd_siginfo
+{
+ uint32_t ssi_signo;
+ int32_t ssi_errno;
+ int32_t ssi_code;
+ uint32_t ssi_pid;
+ uint32_t ssi_uid;
+ int32_t ssi_fd;
+ uint32_t ssi_tid;
+ uint32_t ssi_band;
+ uint32_t ssi_overrun;
+ uint32_t ssi_trapno;
+ int32_t ssi_status;
+ int32_t ssi_int;
+ uint64_t ssi_ptr;
+ uint64_t ssi_utime;
+ uint64_t ssi_stime;
+ uint64_t ssi_addr;
+ uint8_t __pad[48];
+};
+
+/* Flags for signalfd. */
+enum
+ {
+ SFD_CLOEXEC = 0x400000,
+#define SFD_CLOEXEC SFD_CLOEXEC
+ SFD_NONBLOCK = 0x4000
+#define SFD_NONBLOCK SFD_NONBLOCK
+ };
+
+__BEGIN_DECLS
+
+/* Request notification for delivery of signals in MASK to be
+ performed using descriptor FD.*/
+extern int signalfd (int __fd, const sigset_t *__mask, int __flags)
+ __nonnull ((2)) __THROW;
+
+__END_DECLS
+
+#endif /* sys/signalfd.h */
diff --git a/libc/sysdeps/unix/sysv/linux/sparc/sys/timerfd.h b/libc/sysdeps/unix/sysv/linux/sparc/sys/timerfd.h
new file mode 100644
index 000000000..833d050fb
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/sparc/sys/timerfd.h
@@ -0,0 +1,60 @@
+/* Copyright (C) 2008 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 _SYS_TIMERFD_H
+#define _SYS_TIMERFD_H 1
+
+#include <time.h>
+
+
+/* Bits to be set in the FLAGS parameter of `timerfd_create'. */
+enum
+ {
+ TFD_CLOEXEC = 0x400000,
+#define TFD_CLOEXEC TFD_CLOEXEC
+ TFD_NONBLOCK = 0x4000
+#define TFD_NONBLOCK TFD_NONBLOCK
+ };
+
+
+/* Bits to be set in the FLAGS parameter of `timerfd_settime'. */
+enum
+ {
+ TFD_TIMER_ABSTIME = 1 << 0
+#define TFD_TIMER_ABSTIME TFD_TIMER_ABSTIME
+ };
+
+
+__BEGIN_DECLS
+
+/* Return file descriptor for new interval timer source. */
+extern int timerfd_create (clockid_t __clock_id, int __flags) __THROW;
+
+/* Set next expiration time of interval timer source UFD to UTMR. If
+ FLAGS has the TFD_TIMER_ABSTIME flag set the timeout value is
+ absolute. Optionally return the old expiration time in OTMR. */
+extern int timerfd_settime (int __ufd, int __flags,
+ __const struct itimerspec *__utmr,
+ struct itimerspec *__otmr) __THROW;
+
+/* Return the next expiration time of UFD. */
+extern int timerfd_gettime (int __ufd, struct itimerspec *__otmr) __THROW;
+
+__END_DECLS
+
+#endif /* sys/timerfd.h */
diff --git a/libc/sysdeps/unix/sysv/linux/sys/epoll.h b/libc/sysdeps/unix/sysv/linux/sys/epoll.h
index f4e8bda99..12de0bcfe 100644
--- a/libc/sysdeps/unix/sysv/linux/sys/epoll.h
+++ b/libc/sysdeps/unix/sysv/linux/sys/epoll.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2006, 2007, 2008 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,6 +31,16 @@ typedef __sigset_t sigset_t;
#endif
+/* Flags to be passed to epoll_create2. */
+enum
+ {
+ EPOLL_CLOEXEC = 02000000,
+#define EPOLL_CLOEXEC EPOLL_CLOEXEC
+ EPOLL_NONBLOCK = 04000
+#define EPOLL_NONBLOCK EPOLL_NONBLOCK
+ };
+
+
enum EPOLL_EVENTS
{
EPOLLIN = 0x001,
@@ -63,9 +73,9 @@ enum EPOLL_EVENTS
/* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */
-#define EPOLL_CTL_ADD 1 /* Add a file decriptor to the interface. */
-#define EPOLL_CTL_DEL 2 /* Remove a file decriptor from the interface. */
-#define EPOLL_CTL_MOD 3 /* Change file decriptor epoll_event structure. */
+#define EPOLL_CTL_ADD 1 /* Add a file descriptor to the interface. */
+#define EPOLL_CTL_DEL 2 /* Remove a file descriptor from the interface. */
+#define EPOLL_CTL_MOD 3 /* Change file descriptor epoll_event structure. */
typedef union epoll_data
@@ -91,6 +101,10 @@ __BEGIN_DECLS
returned by epoll_create() should be closed with close(). */
extern int epoll_create (int __size) __THROW;
+/* Same as epoll_create but with an FLAGS parameter. The unused SIZE
+ parameter has been dropped. */
+extern int epoll_create1 (int __flags) __THROW;
+
/* Manipulate an epoll instance "epfd". Returns 0 in case of success,
-1 in case of error ( the "errno" variable will contain the
diff --git a/libc/sysdeps/unix/sysv/linux/sys/eventfd.h b/libc/sysdeps/unix/sysv/linux/sys/eventfd.h
index 1ebaea7b3..205824b66 100644
--- a/libc/sysdeps/unix/sysv/linux/sys/eventfd.h
+++ b/libc/sysdeps/unix/sysv/linux/sys/eventfd.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2007, 2008 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
@@ -25,6 +25,15 @@
/* Type for event counter. */
typedef uint64_t eventfd_t;
+/* Flags for signalfd. */
+enum
+ {
+ EFD_CLOEXEC = 02000000,
+#define EFD_CLOEXEC EFD_CLOEXEC
+ EFD_NONBLOCK = 04000
+#define EFD_NONBLOCK EFD_NONBLOCK
+ };
+
__BEGIN_DECLS
diff --git a/libc/sysdeps/unix/sysv/linux/sys/inotify.h b/libc/sysdeps/unix/sysv/linux/sys/inotify.h
index 0131db9d3..81e31fb64 100644
--- a/libc/sysdeps/unix/sysv/linux/sys/inotify.h
+++ b/libc/sysdeps/unix/sysv/linux/sys/inotify.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006, 2008 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
@@ -22,6 +22,16 @@
#include <stdint.h>
+/* Flags for the parameter of inotify_init1. */
+enum
+ {
+ IN_CLOEXEC = 02000000,
+#define IN_CLOEXEC IN_CLOEXEC
+ IN_NONBLOCK = 04000
+#define IN_NONBLOCK IN_NONBLOCK
+ };
+
+
/* Structure describing an inotify event. */
struct inotify_event
{
@@ -79,6 +89,9 @@ __BEGIN_DECLS
/* Create and initialize inotify instance. */
extern int inotify_init (void) __THROW;
+/* Create and initialize inotify instance. */
+extern int inotify_init1 (int __flags) __THROW;
+
/* Add watch of object NAME to inotify instance FD. Notify about
events specified by MASK. */
extern int inotify_add_watch (int __fd, const char *__name, uint32_t __mask)
diff --git a/libc/sysdeps/unix/sysv/linux/sys/signalfd.h b/libc/sysdeps/unix/sysv/linux/sys/signalfd.h
index 7a7f53ba3..dae71a400 100644
--- a/libc/sysdeps/unix/sysv/linux/sys/signalfd.h
+++ b/libc/sysdeps/unix/sysv/linux/sys/signalfd.h
@@ -45,6 +45,14 @@ struct signalfd_siginfo
uint8_t __pad[48];
};
+/* Flags for signalfd. */
+enum
+ {
+ SFD_CLOEXEC = 02000000,
+#define SFD_CLOEXEC SFD_CLOEXEC
+ SFD_NONBLOCK = 04000
+#define SFD_NONBLOCK SFD_NONBLOCK
+ };
__BEGIN_DECLS
diff --git a/libc/sysdeps/unix/sysv/linux/sys/timerfd.h b/libc/sysdeps/unix/sysv/linux/sys/timerfd.h
index 0a4b81c9b..c1bb06f5f 100644
--- a/libc/sysdeps/unix/sysv/linux/sys/timerfd.h
+++ b/libc/sysdeps/unix/sysv/linux/sys/timerfd.h
@@ -22,6 +22,16 @@
#include <time.h>
+/* Bits to be set in the FLAGS parameter of `timerfd_create'. */
+enum
+ {
+ TFD_CLOEXEC = 02000000,
+#define TFD_CLOEXEC TFD_CLOEXEC
+ TFD_NONBLOCK = 04000
+#define TFD_NONBLOCK TFD_NONBLOCK
+ };
+
+
/* Bits to be set in the FLAGS parameter of `timerfd_settime'. */
enum
{
diff --git a/libc/sysdeps/unix/sysv/linux/syscalls.list b/libc/sysdeps/unix/sysv/linux/syscalls.list
index b3ecf9f47..a87906a4e 100644
--- a/libc/sysdeps/unix/sysv/linux/syscalls.list
+++ b/libc/sysdeps/unix/sysv/linux/syscalls.list
@@ -8,6 +8,7 @@ creat - creat Ci:si __libc_creat creat
create_module EXTRA create_module 3 create_module
delete_module EXTRA delete_module 3 delete_module
epoll_create EXTRA epoll_create i:i epoll_create
+epoll_create1 EXTRA epoll_create1 i:i epoll_create1
epoll_ctl EXTRA epoll_ctl i:iiip epoll_ctl
epoll_wait EXTRA epoll_wait Ci:ipii epoll_wait
fdatasync - fdatasync Ci:i fdatasync
@@ -26,6 +27,7 @@ getsid - getsid i:i getsid
init_module EXTRA init_module 5 init_module
inotify_add_watch EXTRA inotify_add_watch i:isi inotify_add_watch
inotify_init EXTRA inotify_init i: inotify_init
+inotify_init1 EXTRA inotify_init1 i:I inotify_init1
inotify_rm_watch EXTRA inotify_rm_watch i:ii inotify_rm_watch
ioperm - ioperm i:iii ioperm
iopl - iopl i:i iopl
@@ -45,6 +47,7 @@ nfsservctl EXTRA nfsservctl i:ipp nfsservctl
pause - pause Ci: __libc_pause pause
personality EXTRA personality i:i __personality personality
pipe - pipe i:f __pipe pipe
+pipe2 - pipe2 i:fi __pipe2 pipe2
pivot_root EXTRA pivot_root i:ss pivot_root
prctl EXTRA prctl i:iiiii __prctl prctl
putpmsg - putpmsg i:ippii putpmsg
diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/bits/mman.h b/libc/sysdeps/unix/sysv/linux/x86_64/bits/mman.h
index 535c9edcf..781068253 100644
--- a/libc/sysdeps/unix/sysv/linux/x86_64/bits/mman.h
+++ b/libc/sysdeps/unix/sysv/linux/x86_64/bits/mman.h
@@ -64,6 +64,7 @@
# define MAP_NORESERVE 0x04000 /* Don't check for reservations. */
# define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */
# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */
+# define MAP_STACK 0x20000 /* Allocation is for a stack. */
#endif
/* Flags to `msync'. */
diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/sys/epoll.h b/libc/sysdeps/unix/sysv/linux/x86_64/sys/epoll.h
index dfb65fe5f..234798e4b 100644
--- a/libc/sysdeps/unix/sysv/linux/x86_64/sys/epoll.h
+++ b/libc/sysdeps/unix/sysv/linux/x86_64/sys/epoll.h
@@ -31,6 +31,16 @@ typedef __sigset_t sigset_t;
#endif
+/* Flags to be passed to epoll_create2. */
+enum
+ {
+ EPOLL_CLOEXEC = 02000000,
+#define EPOLL_CLOEXEC EPOLL_CLOEXEC
+ EPOLL_NONBLOCK = 04000
+#define EPOLL_NONBLOCK EPOLL_NONBLOCK
+ };
+
+
enum EPOLL_EVENTS
{
EPOLLIN = 0x001,
@@ -91,6 +101,10 @@ __BEGIN_DECLS
returned by epoll_create() should be closed with close(). */
extern int epoll_create (int __size) __THROW;
+/* Same as epoll_create but with an FLAGS parameter. The unused SIZE
+ parameter has been dropped. */
+extern int epoll_create1 (int __flags) __THROW;
+
/* Manipulate an epoll instance "epfd". Returns 0 in case of success,
-1 in case of error ( the "errno" variable will contain the
diff --git a/libc/sysdeps/x86_64/fpu/s_expm1l.S b/libc/sysdeps/x86_64/fpu/s_expm1l.S
index b4f5a3efd..05a1bfcce 100644
--- a/libc/sysdeps/x86_64/fpu/s_expm1l.S
+++ b/libc/sysdeps/x86_64/fpu/s_expm1l.S
@@ -1,5 +1,5 @@
/* ix87 specific implementation of exp(x)-1.
- Copyright (C) 1996, 1997, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 2001, 2002, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
Based on code by John C. Bowman <bowman@ipp-garching.mpg.de>.
@@ -48,6 +48,11 @@ l2e: .tfloat 1.442695040888963407359924681002
.text
ENTRY(__expm1l)
+ movzwl 8+8(%rsp), %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)
+
fldt 8(%rsp) // x
fxam // Is NaN or +-Inf?
fstsw %ax
diff --git a/libc/sysdeps/x86_64/memset.S b/libc/sysdeps/x86_64/memset.S
index c7bf2318d..681ab870e 100644
--- a/libc/sysdeps/x86_64/memset.S
+++ b/libc/sysdeps/x86_64/memset.S
@@ -55,12 +55,14 @@ L(now_dw_aligned):
cmp $0x90,%r8
jg L(ck_mem_ops_method)
L(now_dw_aligned_small):
- lea L(setPxQx)(%rip),%r11
add %r8,%rdi
#ifndef PIC
+ lea L(setPxQx)(%rip),%r11
jmpq *(%r11,%r8,8)
#else
- movslq (%r11,%r8,4),%rcx
+ lea L(Got0)(%rip),%r11
+ lea L(setPxQx)(%rip),%rcx
+ movswq (%rcx,%r8,2),%rcx
lea (%rcx,%r11,1),%r11
jmpq *%r11
#endif
@@ -115,177 +117,177 @@ L(setPxQx):
# endif
#else
L(setPxQx):
- .int L(Got0)-L(setPxQx)
- .int L(P1Q0)-L(setPxQx)
- .int L(P2Q0)-L(setPxQx)
- .int L(P3Q0)-L(setPxQx)
- .int L(P4Q0)-L(setPxQx)
- .int L(P5Q0)-L(setPxQx)
- .int L(P6Q0)-L(setPxQx)
- .int L(P7Q0)-L(setPxQx)
-
- .int L(P0Q1)-L(setPxQx)
- .int L(P1Q1)-L(setPxQx)
- .int L(P2Q1)-L(setPxQx)
- .int L(P3Q1)-L(setPxQx)
- .int L(P4Q1)-L(setPxQx)
- .int L(P5Q1)-L(setPxQx)
- .int L(P6Q1)-L(setPxQx)
- .int L(P7Q1)-L(setPxQx)
-
- .int L(P0Q2)-L(setPxQx)
- .int L(P1Q2)-L(setPxQx)
- .int L(P2Q2)-L(setPxQx)
- .int L(P3Q2)-L(setPxQx)
- .int L(P4Q2)-L(setPxQx)
- .int L(P5Q2)-L(setPxQx)
- .int L(P6Q2)-L(setPxQx)
- .int L(P7Q2)-L(setPxQx)
-
- .int L(P0Q3)-L(setPxQx)
- .int L(P1Q3)-L(setPxQx)
- .int L(P2Q3)-L(setPxQx)
- .int L(P3Q3)-L(setPxQx)
- .int L(P4Q3)-L(setPxQx)
- .int L(P5Q3)-L(setPxQx)
- .int L(P6Q3)-L(setPxQx)
- .int L(P7Q3)-L(setPxQx)
-
- .int L(P0Q4)-L(setPxQx)
- .int L(P1Q4)-L(setPxQx)
- .int L(P2Q4)-L(setPxQx)
- .int L(P3Q4)-L(setPxQx)
- .int L(P4Q4)-L(setPxQx)
- .int L(P5Q4)-L(setPxQx)
- .int L(P6Q4)-L(setPxQx)
- .int L(P7Q4)-L(setPxQx)
-
- .int L(P0Q5)-L(setPxQx)
- .int L(P1Q5)-L(setPxQx)
- .int L(P2Q5)-L(setPxQx)
- .int L(P3Q5)-L(setPxQx)
- .int L(P4Q5)-L(setPxQx)
- .int L(P5Q5)-L(setPxQx)
- .int L(P6Q5)-L(setPxQx)
- .int L(P7Q5)-L(setPxQx)
-
- .int L(P0Q6)-L(setPxQx)
- .int L(P1Q6)-L(setPxQx)
- .int L(P2Q6)-L(setPxQx)
- .int L(P3Q6)-L(setPxQx)
- .int L(P4Q6)-L(setPxQx)
- .int L(P5Q6)-L(setPxQx)
- .int L(P6Q6)-L(setPxQx)
- .int L(P7Q6)-L(setPxQx)
-
- .int L(P0Q7)-L(setPxQx)
- .int L(P1Q7)-L(setPxQx)
- .int L(P2Q7)-L(setPxQx)
- .int L(P3Q7)-L(setPxQx)
- .int L(P4Q7)-L(setPxQx)
- .int L(P5Q7)-L(setPxQx)
- .int L(P6Q7)-L(setPxQx)
- .int L(P7Q7)-L(setPxQx)
-
- .int L(P0Q8)-L(setPxQx)
- .int L(P1Q8)-L(setPxQx)
- .int L(P2Q8)-L(setPxQx)
- .int L(P3Q8)-L(setPxQx)
- .int L(P4Q8)-L(setPxQx)
- .int L(P5Q8)-L(setPxQx)
- .int L(P6Q8)-L(setPxQx)
- .int L(P7Q8)-L(setPxQx)
-
- .int L(P0Q9)-L(setPxQx)
- .int L(P1Q9)-L(setPxQx)
- .int L(P2Q9)-L(setPxQx)
- .int L(P3Q9)-L(setPxQx)
- .int L(P4Q9)-L(setPxQx)
- .int L(P5Q9)-L(setPxQx)
- .int L(P6Q9)-L(setPxQx)
- .int L(P7Q9)-L(setPxQx)
-
- .int L(P0QA)-L(setPxQx)
- .int L(P1QA)-L(setPxQx)
- .int L(P2QA)-L(setPxQx)
- .int L(P3QA)-L(setPxQx)
- .int L(P4QA)-L(setPxQx)
- .int L(P5QA)-L(setPxQx)
- .int L(P6QA)-L(setPxQx)
- .int L(P7QA)-L(setPxQx)
-
- .int L(P0QB)-L(setPxQx)
- .int L(P1QB)-L(setPxQx)
- .int L(P2QB)-L(setPxQx)
- .int L(P3QB)-L(setPxQx)
- .int L(P4QB)-L(setPxQx)
- .int L(P5QB)-L(setPxQx)
- .int L(P6QB)-L(setPxQx)
- .int L(P7QB)-L(setPxQx)
-
- .int L(P0QC)-L(setPxQx)
- .int L(P1QC)-L(setPxQx)
- .int L(P2QC)-L(setPxQx)
- .int L(P3QC)-L(setPxQx)
- .int L(P4QC)-L(setPxQx)
- .int L(P5QC)-L(setPxQx)
- .int L(P6QC)-L(setPxQx)
- .int L(P7QC)-L(setPxQx)
-
- .int L(P0QD)-L(setPxQx)
- .int L(P1QD)-L(setPxQx)
- .int L(P2QD)-L(setPxQx)
- .int L(P3QD)-L(setPxQx)
- .int L(P4QD)-L(setPxQx)
- .int L(P5QD)-L(setPxQx)
- .int L(P6QD)-L(setPxQx)
- .int L(P7QD)-L(setPxQx)
-
- .int L(P0QE)-L(setPxQx)
- .int L(P1QE)-L(setPxQx)
- .int L(P2QE)-L(setPxQx)
- .int L(P3QE)-L(setPxQx)
- .int L(P4QE)-L(setPxQx)
- .int L(P5QE)-L(setPxQx)
- .int L(P6QE)-L(setPxQx)
- .int L(P7QE)-L(setPxQx)
-
- .int L(P0QF)-L(setPxQx)
- .int L(P1QF)-L(setPxQx)
- .int L(P2QF)-L(setPxQx)
- .int L(P3QF)-L(setPxQx)
- .int L(P4QF)-L(setPxQx)
- .int L(P5QF)-L(setPxQx)
- .int L(P6QF)-L(setPxQx)
- .int L(P7QF)-L(setPxQx)
-
- .int L(P0QG)-L(setPxQx)
- .int L(P1QG)-L(setPxQx)
- .int L(P2QG)-L(setPxQx)
- .int L(P3QG)-L(setPxQx)
- .int L(P4QG)-L(setPxQx)
- .int L(P5QG)-L(setPxQx)
- .int L(P6QG)-L(setPxQx)
- .int L(P7QG)-L(setPxQx)
-
- .int L(P0QH)-L(setPxQx)
- .int L(P1QH)-L(setPxQx)
- .int L(P2QH)-L(setPxQx)
- .int L(P3QH)-L(setPxQx)
- .int L(P4QH)-L(setPxQx)
- .int L(P5QH)-L(setPxQx)
- .int L(P6QH)-L(setPxQx)
- .int L(P7QH)-L(setPxQx)
-
- .int L(P0QI)-L(setPxQx)
+ .short L(Got0)-L(Got0)
+ .short L(P1Q0)-L(Got0)
+ .short L(P2Q0)-L(Got0)
+ .short L(P3Q0)-L(Got0)
+ .short L(P4Q0)-L(Got0)
+ .short L(P5Q0)-L(Got0)
+ .short L(P6Q0)-L(Got0)
+ .short L(P7Q0)-L(Got0)
+
+ .short L(P0Q1)-L(Got0)
+ .short L(P1Q1)-L(Got0)
+ .short L(P2Q1)-L(Got0)
+ .short L(P3Q1)-L(Got0)
+ .short L(P4Q1)-L(Got0)
+ .short L(P5Q1)-L(Got0)
+ .short L(P6Q1)-L(Got0)
+ .short L(P7Q1)-L(Got0)
+
+ .short L(P0Q2)-L(Got0)
+ .short L(P1Q2)-L(Got0)
+ .short L(P2Q2)-L(Got0)
+ .short L(P3Q2)-L(Got0)
+ .short L(P4Q2)-L(Got0)
+ .short L(P5Q2)-L(Got0)
+ .short L(P6Q2)-L(Got0)
+ .short L(P7Q2)-L(Got0)
+
+ .short L(P0Q3)-L(Got0)
+ .short L(P1Q3)-L(Got0)
+ .short L(P2Q3)-L(Got0)
+ .short L(P3Q3)-L(Got0)
+ .short L(P4Q3)-L(Got0)
+ .short L(P5Q3)-L(Got0)
+ .short L(P6Q3)-L(Got0)
+ .short L(P7Q3)-L(Got0)
+
+ .short L(P0Q4)-L(Got0)
+ .short L(P1Q4)-L(Got0)
+ .short L(P2Q4)-L(Got0)
+ .short L(P3Q4)-L(Got0)
+ .short L(P4Q4)-L(Got0)
+ .short L(P5Q4)-L(Got0)
+ .short L(P6Q4)-L(Got0)
+ .short L(P7Q4)-L(Got0)
+
+ .short L(P0Q5)-L(Got0)
+ .short L(P1Q5)-L(Got0)
+ .short L(P2Q5)-L(Got0)
+ .short L(P3Q5)-L(Got0)
+ .short L(P4Q5)-L(Got0)
+ .short L(P5Q5)-L(Got0)
+ .short L(P6Q5)-L(Got0)
+ .short L(P7Q5)-L(Got0)
+
+ .short L(P0Q6)-L(Got0)
+ .short L(P1Q6)-L(Got0)
+ .short L(P2Q6)-L(Got0)
+ .short L(P3Q6)-L(Got0)
+ .short L(P4Q6)-L(Got0)
+ .short L(P5Q6)-L(Got0)
+ .short L(P6Q6)-L(Got0)
+ .short L(P7Q6)-L(Got0)
+
+ .short L(P0Q7)-L(Got0)
+ .short L(P1Q7)-L(Got0)
+ .short L(P2Q7)-L(Got0)
+ .short L(P3Q7)-L(Got0)
+ .short L(P4Q7)-L(Got0)
+ .short L(P5Q7)-L(Got0)
+ .short L(P6Q7)-L(Got0)
+ .short L(P7Q7)-L(Got0)
+
+ .short L(P0Q8)-L(Got0)
+ .short L(P1Q8)-L(Got0)
+ .short L(P2Q8)-L(Got0)
+ .short L(P3Q8)-L(Got0)
+ .short L(P4Q8)-L(Got0)
+ .short L(P5Q8)-L(Got0)
+ .short L(P6Q8)-L(Got0)
+ .short L(P7Q8)-L(Got0)
+
+ .short L(P0Q9)-L(Got0)
+ .short L(P1Q9)-L(Got0)
+ .short L(P2Q9)-L(Got0)
+ .short L(P3Q9)-L(Got0)
+ .short L(P4Q9)-L(Got0)
+ .short L(P5Q9)-L(Got0)
+ .short L(P6Q9)-L(Got0)
+ .short L(P7Q9)-L(Got0)
+
+ .short L(P0QA)-L(Got0)
+ .short L(P1QA)-L(Got0)
+ .short L(P2QA)-L(Got0)
+ .short L(P3QA)-L(Got0)
+ .short L(P4QA)-L(Got0)
+ .short L(P5QA)-L(Got0)
+ .short L(P6QA)-L(Got0)
+ .short L(P7QA)-L(Got0)
+
+ .short L(P0QB)-L(Got0)
+ .short L(P1QB)-L(Got0)
+ .short L(P2QB)-L(Got0)
+ .short L(P3QB)-L(Got0)
+ .short L(P4QB)-L(Got0)
+ .short L(P5QB)-L(Got0)
+ .short L(P6QB)-L(Got0)
+ .short L(P7QB)-L(Got0)
+
+ .short L(P0QC)-L(Got0)
+ .short L(P1QC)-L(Got0)
+ .short L(P2QC)-L(Got0)
+ .short L(P3QC)-L(Got0)
+ .short L(P4QC)-L(Got0)
+ .short L(P5QC)-L(Got0)
+ .short L(P6QC)-L(Got0)
+ .short L(P7QC)-L(Got0)
+
+ .short L(P0QD)-L(Got0)
+ .short L(P1QD)-L(Got0)
+ .short L(P2QD)-L(Got0)
+ .short L(P3QD)-L(Got0)
+ .short L(P4QD)-L(Got0)
+ .short L(P5QD)-L(Got0)
+ .short L(P6QD)-L(Got0)
+ .short L(P7QD)-L(Got0)
+
+ .short L(P0QE)-L(Got0)
+ .short L(P1QE)-L(Got0)
+ .short L(P2QE)-L(Got0)
+ .short L(P3QE)-L(Got0)
+ .short L(P4QE)-L(Got0)
+ .short L(P5QE)-L(Got0)
+ .short L(P6QE)-L(Got0)
+ .short L(P7QE)-L(Got0)
+
+ .short L(P0QF)-L(Got0)
+ .short L(P1QF)-L(Got0)
+ .short L(P2QF)-L(Got0)
+ .short L(P3QF)-L(Got0)
+ .short L(P4QF)-L(Got0)
+ .short L(P5QF)-L(Got0)
+ .short L(P6QF)-L(Got0)
+ .short L(P7QF)-L(Got0)
+
+ .short L(P0QG)-L(Got0)
+ .short L(P1QG)-L(Got0)
+ .short L(P2QG)-L(Got0)
+ .short L(P3QG)-L(Got0)
+ .short L(P4QG)-L(Got0)
+ .short L(P5QG)-L(Got0)
+ .short L(P6QG)-L(Got0)
+ .short L(P7QG)-L(Got0)
+
+ .short L(P0QH)-L(Got0)
+ .short L(P1QH)-L(Got0)
+ .short L(P2QH)-L(Got0)
+ .short L(P3QH)-L(Got0)
+ .short L(P4QH)-L(Got0)
+ .short L(P5QH)-L(Got0)
+ .short L(P6QH)-L(Got0)
+ .short L(P7QH)-L(Got0)
+
+ .short L(P0QI)-L(Got0)
# ifdef USE_EXTRA_TABLE
- .int L(P1QI)-L(setPxQx)
- .int L(P2QI)-L(setPxQx)
- .int L(P3QI)-L(setPxQx)
- .int L(P4QI)-L(setPxQx)
- .int L(P5QI)-L(setPxQx)
- .int L(P6QI)-L(setPxQx)
- .int L(P7QI)-L(setPxQx)
+ .short L(P1QI)-L(Got0)
+ .short L(P2QI)-L(Got0)
+ .short L(P3QI)-L(Got0)
+ .short L(P4QI)-L(Got0)
+ .short L(P5QI)-L(Got0)
+ .short L(P6QI)-L(Got0)
+ .short L(P7QI)-L(Got0)
# endif
#endif
.popsection
@@ -499,18 +501,20 @@ L(ck_mem_ops_method):
# align to 16 byte boundary first
#test $0xf,%rdi
#jz L(aligned_now)
- lea L(AliPxQx)(%rip),%r11
- mov $0x10,%r10
- mov %rdi,%r9
- and $0xf,%r9
- sub %r9,%r10
- and $0xf,%r10
- add %r10,%rdi
- sub %r10,%r8
+ mov $0x10,%r10
+ mov %rdi,%r9
+ and $0xf,%r9
+ sub %r9,%r10
+ and $0xf,%r10
+ add %r10,%rdi
+ sub %r10,%r8
#ifndef PIC
+ lea L(AliPxQx)(%rip),%r11
jmpq *(%r11,%r10,8)
#else
- movslq (%r11,%r10,4),%rcx
+ lea L(aligned_now)(%rip), %r11
+ lea L(AliPxQx)(%rip),%rcx
+ movswq (%rcx,%r10,2),%rcx
lea (%rcx,%r11,1),%r11
jmpq *%r11
#endif
@@ -525,23 +529,23 @@ L(AliPxQx):
.quad L(A4Q1), L(A5Q1), L(A6Q1), L(A7Q1)
#else
L(AliPxQx):
- .int L(aligned_now)-L(AliPxQx)
- .int L(A1Q0)-L(AliPxQx)
- .int L(A2Q0)-L(AliPxQx)
- .int L(A3Q0)-L(AliPxQx)
- .int L(A4Q0)-L(AliPxQx)
- .int L(A5Q0)-L(AliPxQx)
- .int L(A6Q0)-L(AliPxQx)
- .int L(A7Q0)-L(AliPxQx)
-
- .int L(A0Q1)-L(AliPxQx)
- .int L(A1Q1)-L(AliPxQx)
- .int L(A2Q1)-L(AliPxQx)
- .int L(A3Q1)-L(AliPxQx)
- .int L(A4Q1)-L(AliPxQx)
- .int L(A5Q1)-L(AliPxQx)
- .int L(A6Q1)-L(AliPxQx)
- .int L(A7Q1)-L(AliPxQx)
+ .short L(aligned_now)-L(aligned_now)
+ .short L(A1Q0)-L(aligned_now)
+ .short L(A2Q0)-L(aligned_now)
+ .short L(A3Q0)-L(aligned_now)
+ .short L(A4Q0)-L(aligned_now)
+ .short L(A5Q0)-L(aligned_now)
+ .short L(A6Q0)-L(aligned_now)
+ .short L(A7Q0)-L(aligned_now)
+
+ .short L(A0Q1)-L(aligned_now)
+ .short L(A1Q1)-L(aligned_now)
+ .short L(A2Q1)-L(aligned_now)
+ .short L(A3Q1)-L(aligned_now)
+ .short L(A4Q1)-L(aligned_now)
+ .short L(A5Q1)-L(aligned_now)
+ .short L(A6Q1)-L(aligned_now)
+ .short L(A7Q1)-L(aligned_now)
#endif
.popsection
@@ -634,12 +638,14 @@ L(8byte_move_loop):
L(8byte_move_skip):
andl $127,%r8d
lea (%rdi,%r8,1),%rdi
- lea L(setPxQx)(%rip),%r11
#ifndef PIC
+ lea L(setPxQx)(%rip),%r11
jmpq *(%r11,%r8,8) # old scheme remained for nonPIC
#else
- movslq (%r11,%r8,4),%rcx
+ lea L(Got0)(%rip),%r11
+ lea L(setPxQx)(%rip),%rcx
+ movswq (%rcx,%r8,2),%rcx
lea (%rcx,%r11,1),%r11
jmpq *%r11
#endif
@@ -676,11 +682,13 @@ L(8byte_stos_skip):
andl $7,%r8d
lea (%rdi,%r8,1),%rdi
- lea L(setPxQx)(%rip),%r11
#ifndef PIC
+ lea L(setPxQx)(%rip),%r11
jmpq *(%r11,%r8,8) # old scheme remained for nonPIC
#else
- movslq (%r11,%r8,4),%rcx
+ lea L(Got0)(%rip),%r11
+ lea L(setPxQx)(%rip),%rcx
+ movswq (%rcx,%r8,2),%rcx
lea (%rcx,%r11,1),%r11
jmpq *%r11
#endif
@@ -722,11 +730,13 @@ L(8byte_nt_move_skip):
andl $127,%r8d
lea (%rdi,%r8,1),%rdi
- lea L(setPxQx)(%rip),%r11
#ifndef PIC
+ lea L(setPxQx)(%rip),%r11
jmpq *(%r11,%r8,8) # old scheme remained for nonPIC
#else
- movslq (%r11,%r8,4),%rcx
+ lea L(Got0)(%rip),%r11
+ lea L(setPxQx)(%rip),%rcx
+ movswq (%rcx,%r8,2),%rcx
lea (%rcx,%r11,1),%r11
jmpq *%r11
#endif
@@ -736,15 +746,17 @@ L(SSE_pre):
movd %rdx,%xmm0
punpcklqdq %xmm0,%xmm0
- lea L(SSExDx)(%rip),%r9 # for later after the alignment
cmp $0xb0,%r8 # 176
jge L(byte32sse2_pre)
add %r8,%rdi
#ifndef PIC
+ lea L(SSExDx)(%rip),%r9
jmpq *(%r9,%r8,8)
#else
- movslq (%r9,%r8,4),%rcx
+ lea L(SSE0Q0)(%rip),%r9
+ lea L(SSExDx)(%rip),%rcx
+ movswq (%rcx,%r8,2),%rcx
lea (%rcx,%r9,1),%r9
jmpq *%r9
#endif
@@ -1012,13 +1024,15 @@ L(byte32sse2):
lea 0x80(%rdi),%rdi
jge L(byte32sse2)
- lea L(SSExDx)(%rip),%r11
add %r8,%rdi
#ifndef PIC
+ lea L(SSExDx)(%rip),%r11
jmpq *(%r11,%r8,8)
#else
- movslq (%r11,%r8,4),%rcx
- lea (%rcx,%r11,1),%r11
+ lea L(SSE0Q0)(%rip),%r11
+ lea L(SSExDx)(%rip),%rcx
+ movswq (%rcx,%r8,2),%rcx
+ lea (%rcx,%r11,1),%r11
jmpq *%r11
#endif
@@ -1044,13 +1058,15 @@ L(sse2_nt_move):
lea 0x80(%rdi),%rdi
jge L(sse2_nt_move)
- lea L(SSExDx)(%rip),%r11
sfence
add %r8,%rdi
#ifndef PIC
+ lea L(SSExDx)(%rip),%r11
jmpq *(%r11,%r8,8)
#else
- movslq (%r11,%r8,4),%rcx
+ lea L(SSE0Q0)(%rip),%r11
+ lea L(SSExDx)(%rip),%rcx
+ movswq (%rcx,%r8,2),%rcx
lea (%rcx,%r11,1),%r11
jmpq *%r11
#endif
@@ -1109,221 +1125,221 @@ L(SSExDx):
.quad L(SSE12QB), L(SSE13QB), L(SSE14QB), L(SSE15QB)
#else
L(SSExDx):
- .int L(SSE0Q0) -L(SSExDx)
- .int L(SSE1Q0) -L(SSExDx)
- .int L(SSE2Q0) -L(SSExDx)
- .int L(SSE3Q0) -L(SSExDx)
- .int L(SSE4Q0) -L(SSExDx)
- .int L(SSE5Q0) -L(SSExDx)
- .int L(SSE6Q0) -L(SSExDx)
- .int L(SSE7Q0) -L(SSExDx)
-
- .int L(SSE8Q0) -L(SSExDx)
- .int L(SSE9Q0) -L(SSExDx)
- .int L(SSE10Q0)-L(SSExDx)
- .int L(SSE11Q0)-L(SSExDx)
- .int L(SSE12Q0)-L(SSExDx)
- .int L(SSE13Q0)-L(SSExDx)
- .int L(SSE14Q0)-L(SSExDx)
- .int L(SSE15Q0)-L(SSExDx)
-
- .int L(SSE0Q1) -L(SSExDx)
- .int L(SSE1Q1) -L(SSExDx)
- .int L(SSE2Q1) -L(SSExDx)
- .int L(SSE3Q1) -L(SSExDx)
- .int L(SSE4Q1) -L(SSExDx)
- .int L(SSE5Q1) -L(SSExDx)
- .int L(SSE6Q1) -L(SSExDx)
- .int L(SSE7Q1) -L(SSExDx)
-
- .int L(SSE8Q1) -L(SSExDx)
- .int L(SSE9Q1) -L(SSExDx)
- .int L(SSE10Q1)-L(SSExDx)
- .int L(SSE11Q1)-L(SSExDx)
- .int L(SSE12Q1)-L(SSExDx)
- .int L(SSE13Q1)-L(SSExDx)
- .int L(SSE14Q1)-L(SSExDx)
- .int L(SSE15Q1)-L(SSExDx)
-
- .int L(SSE0Q2) -L(SSExDx)
- .int L(SSE1Q2) -L(SSExDx)
- .int L(SSE2Q2) -L(SSExDx)
- .int L(SSE3Q2) -L(SSExDx)
- .int L(SSE4Q2) -L(SSExDx)
- .int L(SSE5Q2) -L(SSExDx)
- .int L(SSE6Q2) -L(SSExDx)
- .int L(SSE7Q2) -L(SSExDx)
-
- .int L(SSE8Q2) -L(SSExDx)
- .int L(SSE9Q2) -L(SSExDx)
- .int L(SSE10Q2)-L(SSExDx)
- .int L(SSE11Q2)-L(SSExDx)
- .int L(SSE12Q2)-L(SSExDx)
- .int L(SSE13Q2)-L(SSExDx)
- .int L(SSE14Q2)-L(SSExDx)
- .int L(SSE15Q2)-L(SSExDx)
-
- .int L(SSE0Q3) -L(SSExDx)
- .int L(SSE1Q3) -L(SSExDx)
- .int L(SSE2Q3) -L(SSExDx)
- .int L(SSE3Q3) -L(SSExDx)
- .int L(SSE4Q3) -L(SSExDx)
- .int L(SSE5Q3) -L(SSExDx)
- .int L(SSE6Q3) -L(SSExDx)
- .int L(SSE7Q3) -L(SSExDx)
-
- .int L(SSE8Q3) -L(SSExDx)
- .int L(SSE9Q3) -L(SSExDx)
- .int L(SSE10Q3)-L(SSExDx)
- .int L(SSE11Q3)-L(SSExDx)
- .int L(SSE12Q3)-L(SSExDx)
- .int L(SSE13Q3)-L(SSExDx)
- .int L(SSE14Q3)-L(SSExDx)
- .int L(SSE15Q3)-L(SSExDx)
-
- .int L(SSE0Q4) -L(SSExDx)
- .int L(SSE1Q4) -L(SSExDx)
- .int L(SSE2Q4) -L(SSExDx)
- .int L(SSE3Q4) -L(SSExDx)
- .int L(SSE4Q4) -L(SSExDx)
- .int L(SSE5Q4) -L(SSExDx)
- .int L(SSE6Q4) -L(SSExDx)
- .int L(SSE7Q4) -L(SSExDx)
-
- .int L(SSE8Q4) -L(SSExDx)
- .int L(SSE9Q4) -L(SSExDx)
- .int L(SSE10Q4)-L(SSExDx)
- .int L(SSE11Q4)-L(SSExDx)
- .int L(SSE12Q4)-L(SSExDx)
- .int L(SSE13Q4)-L(SSExDx)
- .int L(SSE14Q4)-L(SSExDx)
- .int L(SSE15Q4)-L(SSExDx)
-
- .int L(SSE0Q5) -L(SSExDx)
- .int L(SSE1Q5) -L(SSExDx)
- .int L(SSE2Q5) -L(SSExDx)
- .int L(SSE3Q5) -L(SSExDx)
- .int L(SSE4Q5) -L(SSExDx)
- .int L(SSE5Q5) -L(SSExDx)
- .int L(SSE6Q5) -L(SSExDx)
- .int L(SSE7Q5) -L(SSExDx)
-
- .int L(SSE8Q5) -L(SSExDx)
- .int L(SSE9Q5) -L(SSExDx)
- .int L(SSE10Q5)-L(SSExDx)
- .int L(SSE11Q5)-L(SSExDx)
- .int L(SSE12Q5)-L(SSExDx)
- .int L(SSE13Q5)-L(SSExDx)
- .int L(SSE14Q5)-L(SSExDx)
- .int L(SSE15Q5)-L(SSExDx)
-
- .int L(SSE0Q6) -L(SSExDx)
- .int L(SSE1Q6) -L(SSExDx)
- .int L(SSE2Q6) -L(SSExDx)
- .int L(SSE3Q6) -L(SSExDx)
- .int L(SSE4Q6) -L(SSExDx)
- .int L(SSE5Q6) -L(SSExDx)
- .int L(SSE6Q6) -L(SSExDx)
- .int L(SSE7Q6) -L(SSExDx)
-
- .int L(SSE8Q6) -L(SSExDx)
- .int L(SSE9Q6) -L(SSExDx)
- .int L(SSE10Q6)-L(SSExDx)
- .int L(SSE11Q6)-L(SSExDx)
- .int L(SSE12Q6)-L(SSExDx)
- .int L(SSE13Q6)-L(SSExDx)
- .int L(SSE14Q6)-L(SSExDx)
- .int L(SSE15Q6)-L(SSExDx)
-
- .int L(SSE0Q7) -L(SSExDx)
- .int L(SSE1Q7) -L(SSExDx)
- .int L(SSE2Q7) -L(SSExDx)
- .int L(SSE3Q7) -L(SSExDx)
- .int L(SSE4Q7) -L(SSExDx)
- .int L(SSE5Q7) -L(SSExDx)
- .int L(SSE6Q7) -L(SSExDx)
- .int L(SSE7Q7) -L(SSExDx)
-
- .int L(SSE8Q7) -L(SSExDx)
- .int L(SSE9Q7) -L(SSExDx)
- .int L(SSE10Q7)-L(SSExDx)
- .int L(SSE11Q7)-L(SSExDx)
- .int L(SSE12Q7)-L(SSExDx)
- .int L(SSE13Q7)-L(SSExDx)
- .int L(SSE14Q7)-L(SSExDx)
- .int L(SSE15Q7)-L(SSExDx)
-
- .int L(SSE0Q8) -L(SSExDx)
- .int L(SSE1Q8) -L(SSExDx)
- .int L(SSE2Q8) -L(SSExDx)
- .int L(SSE3Q8) -L(SSExDx)
- .int L(SSE4Q8) -L(SSExDx)
- .int L(SSE5Q8) -L(SSExDx)
- .int L(SSE6Q8) -L(SSExDx)
- .int L(SSE7Q8) -L(SSExDx)
-
- .int L(SSE8Q8) -L(SSExDx)
- .int L(SSE9Q8) -L(SSExDx)
- .int L(SSE10Q8)-L(SSExDx)
- .int L(SSE11Q8)-L(SSExDx)
- .int L(SSE12Q8)-L(SSExDx)
- .int L(SSE13Q8)-L(SSExDx)
- .int L(SSE14Q8)-L(SSExDx)
- .int L(SSE15Q8)-L(SSExDx)
-
- .int L(SSE0Q9) -L(SSExDx)
- .int L(SSE1Q9) -L(SSExDx)
- .int L(SSE2Q9) -L(SSExDx)
- .int L(SSE3Q9) -L(SSExDx)
- .int L(SSE4Q9) -L(SSExDx)
- .int L(SSE5Q9) -L(SSExDx)
- .int L(SSE6Q9) -L(SSExDx)
- .int L(SSE7Q9) -L(SSExDx)
-
- .int L(SSE8Q9) -L(SSExDx)
- .int L(SSE9Q9) -L(SSExDx)
- .int L(SSE10Q9)-L(SSExDx)
- .int L(SSE11Q9)-L(SSExDx)
- .int L(SSE12Q9)-L(SSExDx)
- .int L(SSE13Q9)-L(SSExDx)
- .int L(SSE14Q9)-L(SSExDx)
- .int L(SSE15Q9)-L(SSExDx)
-
- .int L(SSE0QA) -L(SSExDx)
- .int L(SSE1QA) -L(SSExDx)
- .int L(SSE2QA) -L(SSExDx)
- .int L(SSE3QA) -L(SSExDx)
- .int L(SSE4QA) -L(SSExDx)
- .int L(SSE5QA) -L(SSExDx)
- .int L(SSE6QA) -L(SSExDx)
- .int L(SSE7QA) -L(SSExDx)
-
- .int L(SSE8QA) -L(SSExDx)
- .int L(SSE9QA) -L(SSExDx)
- .int L(SSE10QA)-L(SSExDx)
- .int L(SSE11QA)-L(SSExDx)
- .int L(SSE12QA)-L(SSExDx)
- .int L(SSE13QA)-L(SSExDx)
- .int L(SSE14QA)-L(SSExDx)
- .int L(SSE15QA)-L(SSExDx)
-
- .int L(SSE0QB) -L(SSExDx)
- .int L(SSE1QB) -L(SSExDx)
- .int L(SSE2QB) -L(SSExDx)
- .int L(SSE3QB) -L(SSExDx)
- .int L(SSE4QB) -L(SSExDx)
- .int L(SSE5QB) -L(SSExDx)
- .int L(SSE6QB) -L(SSExDx)
- .int L(SSE7QB) -L(SSExDx)
-
- .int L(SSE8QB) -L(SSExDx)
- .int L(SSE9QB) -L(SSExDx)
- .int L(SSE10QB)-L(SSExDx)
- .int L(SSE11QB)-L(SSExDx)
- .int L(SSE12QB)-L(SSExDx)
- .int L(SSE13QB)-L(SSExDx)
- .int L(SSE14QB)-L(SSExDx)
- .int L(SSE15QB)-L(SSExDx)
+ .short L(SSE0Q0) -L(SSE0Q0)
+ .short L(SSE1Q0) -L(SSE0Q0)
+ .short L(SSE2Q0) -L(SSE0Q0)
+ .short L(SSE3Q0) -L(SSE0Q0)
+ .short L(SSE4Q0) -L(SSE0Q0)
+ .short L(SSE5Q0) -L(SSE0Q0)
+ .short L(SSE6Q0) -L(SSE0Q0)
+ .short L(SSE7Q0) -L(SSE0Q0)
+
+ .short L(SSE8Q0) -L(SSE0Q0)
+ .short L(SSE9Q0) -L(SSE0Q0)
+ .short L(SSE10Q0)-L(SSE0Q0)
+ .short L(SSE11Q0)-L(SSE0Q0)
+ .short L(SSE12Q0)-L(SSE0Q0)
+ .short L(SSE13Q0)-L(SSE0Q0)
+ .short L(SSE14Q0)-L(SSE0Q0)
+ .short L(SSE15Q0)-L(SSE0Q0)
+
+ .short L(SSE0Q1) -L(SSE0Q0)
+ .short L(SSE1Q1) -L(SSE0Q0)
+ .short L(SSE2Q1) -L(SSE0Q0)
+ .short L(SSE3Q1) -L(SSE0Q0)
+ .short L(SSE4Q1) -L(SSE0Q0)
+ .short L(SSE5Q1) -L(SSE0Q0)
+ .short L(SSE6Q1) -L(SSE0Q0)
+ .short L(SSE7Q1) -L(SSE0Q0)
+
+ .short L(SSE8Q1) -L(SSE0Q0)
+ .short L(SSE9Q1) -L(SSE0Q0)
+ .short L(SSE10Q1)-L(SSE0Q0)
+ .short L(SSE11Q1)-L(SSE0Q0)
+ .short L(SSE12Q1)-L(SSE0Q0)
+ .short L(SSE13Q1)-L(SSE0Q0)
+ .short L(SSE14Q1)-L(SSE0Q0)
+ .short L(SSE15Q1)-L(SSE0Q0)
+
+ .short L(SSE0Q2) -L(SSE0Q0)
+ .short L(SSE1Q2) -L(SSE0Q0)
+ .short L(SSE2Q2) -L(SSE0Q0)
+ .short L(SSE3Q2) -L(SSE0Q0)
+ .short L(SSE4Q2) -L(SSE0Q0)
+ .short L(SSE5Q2) -L(SSE0Q0)
+ .short L(SSE6Q2) -L(SSE0Q0)
+ .short L(SSE7Q2) -L(SSE0Q0)
+
+ .short L(SSE8Q2) -L(SSE0Q0)
+ .short L(SSE9Q2) -L(SSE0Q0)
+ .short L(SSE10Q2)-L(SSE0Q0)
+ .short L(SSE11Q2)-L(SSE0Q0)
+ .short L(SSE12Q2)-L(SSE0Q0)
+ .short L(SSE13Q2)-L(SSE0Q0)
+ .short L(SSE14Q2)-L(SSE0Q0)
+ .short L(SSE15Q2)-L(SSE0Q0)
+
+ .short L(SSE0Q3) -L(SSE0Q0)
+ .short L(SSE1Q3) -L(SSE0Q0)
+ .short L(SSE2Q3) -L(SSE0Q0)
+ .short L(SSE3Q3) -L(SSE0Q0)
+ .short L(SSE4Q3) -L(SSE0Q0)
+ .short L(SSE5Q3) -L(SSE0Q0)
+ .short L(SSE6Q3) -L(SSE0Q0)
+ .short L(SSE7Q3) -L(SSE0Q0)
+
+ .short L(SSE8Q3) -L(SSE0Q0)
+ .short L(SSE9Q3) -L(SSE0Q0)
+ .short L(SSE10Q3)-L(SSE0Q0)
+ .short L(SSE11Q3)-L(SSE0Q0)
+ .short L(SSE12Q3)-L(SSE0Q0)
+ .short L(SSE13Q3)-L(SSE0Q0)
+ .short L(SSE14Q3)-L(SSE0Q0)
+ .short L(SSE15Q3)-L(SSE0Q0)
+
+ .short L(SSE0Q4) -L(SSE0Q0)
+ .short L(SSE1Q4) -L(SSE0Q0)
+ .short L(SSE2Q4) -L(SSE0Q0)
+ .short L(SSE3Q4) -L(SSE0Q0)
+ .short L(SSE4Q4) -L(SSE0Q0)
+ .short L(SSE5Q4) -L(SSE0Q0)
+ .short L(SSE6Q4) -L(SSE0Q0)
+ .short L(SSE7Q4) -L(SSE0Q0)
+
+ .short L(SSE8Q4) -L(SSE0Q0)
+ .short L(SSE9Q4) -L(SSE0Q0)
+ .short L(SSE10Q4)-L(SSE0Q0)
+ .short L(SSE11Q4)-L(SSE0Q0)
+ .short L(SSE12Q4)-L(SSE0Q0)
+ .short L(SSE13Q4)-L(SSE0Q0)
+ .short L(SSE14Q4)-L(SSE0Q0)
+ .short L(SSE15Q4)-L(SSE0Q0)
+
+ .short L(SSE0Q5) -L(SSE0Q0)
+ .short L(SSE1Q5) -L(SSE0Q0)
+ .short L(SSE2Q5) -L(SSE0Q0)
+ .short L(SSE3Q5) -L(SSE0Q0)
+ .short L(SSE4Q5) -L(SSE0Q0)
+ .short L(SSE5Q5) -L(SSE0Q0)
+ .short L(SSE6Q5) -L(SSE0Q0)
+ .short L(SSE7Q5) -L(SSE0Q0)
+
+ .short L(SSE8Q5) -L(SSE0Q0)
+ .short L(SSE9Q5) -L(SSE0Q0)
+ .short L(SSE10Q5)-L(SSE0Q0)
+ .short L(SSE11Q5)-L(SSE0Q0)
+ .short L(SSE12Q5)-L(SSE0Q0)
+ .short L(SSE13Q5)-L(SSE0Q0)
+ .short L(SSE14Q5)-L(SSE0Q0)
+ .short L(SSE15Q5)-L(SSE0Q0)
+
+ .short L(SSE0Q6) -L(SSE0Q0)
+ .short L(SSE1Q6) -L(SSE0Q0)
+ .short L(SSE2Q6) -L(SSE0Q0)
+ .short L(SSE3Q6) -L(SSE0Q0)
+ .short L(SSE4Q6) -L(SSE0Q0)
+ .short L(SSE5Q6) -L(SSE0Q0)
+ .short L(SSE6Q6) -L(SSE0Q0)
+ .short L(SSE7Q6) -L(SSE0Q0)
+
+ .short L(SSE8Q6) -L(SSE0Q0)
+ .short L(SSE9Q6) -L(SSE0Q0)
+ .short L(SSE10Q6)-L(SSE0Q0)
+ .short L(SSE11Q6)-L(SSE0Q0)
+ .short L(SSE12Q6)-L(SSE0Q0)
+ .short L(SSE13Q6)-L(SSE0Q0)
+ .short L(SSE14Q6)-L(SSE0Q0)
+ .short L(SSE15Q6)-L(SSE0Q0)
+
+ .short L(SSE0Q7) -L(SSE0Q0)
+ .short L(SSE1Q7) -L(SSE0Q0)
+ .short L(SSE2Q7) -L(SSE0Q0)
+ .short L(SSE3Q7) -L(SSE0Q0)
+ .short L(SSE4Q7) -L(SSE0Q0)
+ .short L(SSE5Q7) -L(SSE0Q0)
+ .short L(SSE6Q7) -L(SSE0Q0)
+ .short L(SSE7Q7) -L(SSE0Q0)
+
+ .short L(SSE8Q7) -L(SSE0Q0)
+ .short L(SSE9Q7) -L(SSE0Q0)
+ .short L(SSE10Q7)-L(SSE0Q0)
+ .short L(SSE11Q7)-L(SSE0Q0)
+ .short L(SSE12Q7)-L(SSE0Q0)
+ .short L(SSE13Q7)-L(SSE0Q0)
+ .short L(SSE14Q7)-L(SSE0Q0)
+ .short L(SSE15Q7)-L(SSE0Q0)
+
+ .short L(SSE0Q8) -L(SSE0Q0)
+ .short L(SSE1Q8) -L(SSE0Q0)
+ .short L(SSE2Q8) -L(SSE0Q0)
+ .short L(SSE3Q8) -L(SSE0Q0)
+ .short L(SSE4Q8) -L(SSE0Q0)
+ .short L(SSE5Q8) -L(SSE0Q0)
+ .short L(SSE6Q8) -L(SSE0Q0)
+ .short L(SSE7Q8) -L(SSE0Q0)
+
+ .short L(SSE8Q8) -L(SSE0Q0)
+ .short L(SSE9Q8) -L(SSE0Q0)
+ .short L(SSE10Q8)-L(SSE0Q0)
+ .short L(SSE11Q8)-L(SSE0Q0)
+ .short L(SSE12Q8)-L(SSE0Q0)
+ .short L(SSE13Q8)-L(SSE0Q0)
+ .short L(SSE14Q8)-L(SSE0Q0)
+ .short L(SSE15Q8)-L(SSE0Q0)
+
+ .short L(SSE0Q9) -L(SSE0Q0)
+ .short L(SSE1Q9) -L(SSE0Q0)
+ .short L(SSE2Q9) -L(SSE0Q0)
+ .short L(SSE3Q9) -L(SSE0Q0)
+ .short L(SSE4Q9) -L(SSE0Q0)
+ .short L(SSE5Q9) -L(SSE0Q0)
+ .short L(SSE6Q9) -L(SSE0Q0)
+ .short L(SSE7Q9) -L(SSE0Q0)
+
+ .short L(SSE8Q9) -L(SSE0Q0)
+ .short L(SSE9Q9) -L(SSE0Q0)
+ .short L(SSE10Q9)-L(SSE0Q0)
+ .short L(SSE11Q9)-L(SSE0Q0)
+ .short L(SSE12Q9)-L(SSE0Q0)
+ .short L(SSE13Q9)-L(SSE0Q0)
+ .short L(SSE14Q9)-L(SSE0Q0)
+ .short L(SSE15Q9)-L(SSE0Q0)
+
+ .short L(SSE0QA) -L(SSE0Q0)
+ .short L(SSE1QA) -L(SSE0Q0)
+ .short L(SSE2QA) -L(SSE0Q0)
+ .short L(SSE3QA) -L(SSE0Q0)
+ .short L(SSE4QA) -L(SSE0Q0)
+ .short L(SSE5QA) -L(SSE0Q0)
+ .short L(SSE6QA) -L(SSE0Q0)
+ .short L(SSE7QA) -L(SSE0Q0)
+
+ .short L(SSE8QA) -L(SSE0Q0)
+ .short L(SSE9QA) -L(SSE0Q0)
+ .short L(SSE10QA)-L(SSE0Q0)
+ .short L(SSE11QA)-L(SSE0Q0)
+ .short L(SSE12QA)-L(SSE0Q0)
+ .short L(SSE13QA)-L(SSE0Q0)
+ .short L(SSE14QA)-L(SSE0Q0)
+ .short L(SSE15QA)-L(SSE0Q0)
+
+ .short L(SSE0QB) -L(SSE0Q0)
+ .short L(SSE1QB) -L(SSE0Q0)
+ .short L(SSE2QB) -L(SSE0Q0)
+ .short L(SSE3QB) -L(SSE0Q0)
+ .short L(SSE4QB) -L(SSE0Q0)
+ .short L(SSE5QB) -L(SSE0Q0)
+ .short L(SSE6QB) -L(SSE0Q0)
+ .short L(SSE7QB) -L(SSE0Q0)
+
+ .short L(SSE8QB) -L(SSE0Q0)
+ .short L(SSE9QB) -L(SSE0Q0)
+ .short L(SSE10QB)-L(SSE0Q0)
+ .short L(SSE11QB)-L(SSE0Q0)
+ .short L(SSE12QB)-L(SSE0Q0)
+ .short L(SSE13QB)-L(SSE0Q0)
+ .short L(SSE14QB)-L(SSE0Q0)
+ .short L(SSE15QB)-L(SSE0Q0)
#endif
.popsection