diff options
161 files changed, 5099 insertions, 1196 deletions
diff --git a/libc/ChangeLog b/libc/ChangeLog index 1fa12aaf8..e3842807d 100644 --- a/libc/ChangeLog +++ b/libc/ChangeLog @@ -1,6 +1,243 @@ +2012-03-07 Joseph Myers <joseph@codesourcery.com> + + [BZ #10716] + * math/s_cacosh.c (__cacosh): Convert negative log results to 0. + * math/s_cacoshf.c (__cacoshf): Likewise. + * math/s_cacoshl.c (__cacoshl): Likewise. + * math/s_casinh.c (__casinh): Set signs of result from argument. + * math/s_casinhf.c (__casinhf): Likewise. + * math/s_casinhl.c (__casinhl): Likewise. + * math/libm-test.inc (cacos_test, cacosh_test, casin_test) + (casinh_test): Add more tests. + * sysdeps/i386/fpu/libm-test-ulps: Update. + * sysdeps/x86_64/fpu/libm-test-ulps: Likewise. + +2012-03-07 Ulrich Drepper <drepper@gmail.com> + + * login/Makefile (distribute): Remove variable. + * catgets/Makefile: Likewise. + * mach/Makefile: Likewise. + * malloc/Makefile: Likewise. + * misc/Makefile: Likewise. + * iconv/Makefile: Likewise. + * nscd/Makefile: Likewise. + * hurd/Makefile: Likewise. + * manual/Makefile: Likewise. + * locale/Makefile: Likewise. + * intl/Makefile: Likewise. + * conform/Makefile: Likewise. + * nss/Makefile: Likewise. + * time/Makefile: Likewise. + * soft-fp/Makefile: Likewise. + * dirent/Makefile: Likewise. + * gmon/Makefile: Likewise. + * po/Makefile: Likewise. + * rt/Makefile: Likewise. + * socket/Makefile: Likewise. + * math/Makefile: Likewise. + * signal/Makefile: Likewise. + * debug/Makefile: Likewise. + * elf/Makefile: Likewise. + * timezone/Makefile: Likewise. + * stdlib/Makefile: Likewise. + * iconvdata/Makefile: Likewise. + * sunrpc/Makefile: Likewise. + * io/Makefile: Likewise. + * argp/Makefile: Likewise. + * inet/Makefile: Likewise. + * hesiod/Makefile: Likewise. + * grp/Makefile: Likewise. + * csu/Makefile: Likewise. + * wctype/Makefile: Likewise. + * crypt/Makefile: Likewise. + * libio/Makefile: Likewise. + * string/Makefile: Likewise. + * nis/Makefile: Likewise. + * resolv/Makefile: Likewise. + * stdio-common/Makefile: Likewise. + * wcsmbs/Makefile: Likewise. + * dlfcn/Makefile: Likewise. + * posix/Makefile: Likewise. + + * timezone/Makefile: Don't install timezone files, just the programs + and scripts. + +2012-03-06 Ulrich Drepper <drepper@gmail.com> + + * nss/databases.def: Add missing gshadow entry. + + * stdio-common/vfprintf.c: Fix formatting. Missing copyright update. + +2012-03-06 Marek Polacek <polacek@redhat.com> + + [BZ #13726] + * sysdeps/ieee754/ldbl-96/printf_fphex.c: Adjust position of wnumstr. + * sysdeps/x86_64/fpu/printf_fphex.c: Likewise. + * stdio-common/Makefile (tests): Add tst-long-dbl-fphex. + * stdio-common/tst-long-dbl-fphex.c: New file. + +2012-03-06 David S. Miller <davem@davemloft.net> + + * sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c + (set_obp_int): New function. + (get_obp_int): New function. + (__get_clockfreq_via_dev_openprom): Likewise. + * sysdeps/unix/sysv/linux/sparc/sysdep.h (INTERNAL_SYSCALL_ERROR_P): + Avoid unused variable warnings on 'val' and use builtin_expect. + (INLINE_SYSCALL): Don't wrap INTERNAL_SYSCALL_ERROR_P with + __builtin_expect. + (INLINE_CLONE_SYSCALL): Likewise. + +2012-03-05 David S. Miller <davem@davemloft.net> + + * sysdeps/sparc/fpu/libm-test-ulps: Update. + +2012-03-05 Andreas Schwab <schwab@linux-m68k.org> + + * sysdeps/powerpc/fpu/libm-test-ulps: Update. + + * sysdeps/ieee754/ldbl-128ibm/e_coshl.c: Drop exp(-x) term + only for |x| >= 40. + * sysdeps/ieee754/ldbl-128ibm/e_sinhl.c: Likewise. + +2012-03-05 H.J. Lu <hongjiu.lu@intel.com> + + * sysdeps/unix/sysv/linux/x86_64/gettimeofday.c (gettimeofday_ifunc): + Replace gettimeofday with __vdso_gettimeofday. + + * sysdeps/unix/sysv/linux/x86_64/init-first.c + (_libc_vdso_platform_setup): Replace clock_gettime and getcpu with + __vdso_clock_gettime and __vdso_getcpu. + + * sysdeps/unix/sysv/linux/x86_64/time.c (time_ifunc): Replace + time with __vdso_time. + +2012-03-05 Joseph Myers <joseph@codesourcery.com> + + * manual/lang.texi (size_t): Note types to which size_t may be + equivalent with the GNU C Library, but do not describe when + differences between them are significant. + +2012-03-05 Andreas Jaeger <aj@suse.de> + + * sysdeps/i386/fpu/libm-test-ulps: Update. + +2012-03-05 Joseph Myers <joseph@codesourcery.com> + + [BZ #3976] + * sysdeps/ieee754/dbl-64/e_pow.c: Include <fenv.h>. + (__ieee754_pow): Save and restore rounding mode and use + round-to-nearest for main computations. + * math/libm-test.inc (pow_test_tonearest): New function. + (pow_test_towardzero): Likewise. + (pow_test_downward): Likewise. + (pow_test_upward): Likewise. + (main): Call the new functions. + * sysdeps/i386/fpu/libm-test-ulps: Update. + * sysdeps/x86_64/fpu/libm-test-ulps: Likewise. + + [BZ #3976] + * math/libm-test.inc (cosh_test_tonearest): New function. + (cosh_test_towardzero): Likewise. + (cosh_test_downward): Likewise. + (cosh_test_upward): Likewise. + (sinh_test_tonearest): Likewise. + (sinh_test_towardzero): Likewise. + (sinh_test_downward): Likewise. + (sinh_test_upward): Likewise. + (main): Call the new functions. + * sysdeps/i386/fpu/libm-test-ulps: Update. + * sysdeps/x86_64/fpu/libm-test-ulps: Likewise. + +2012-03-05 Tom de Vries <tom@codesourcery.com> + + * sysdeps/generic/dl-osinfo.h (_dl_setup_stack_chk_guard): Ensure + default stack guard is set in last bytes. + * sysdeps/unix/sysv/linux/dl-osinfo.h (_dl_setup_stack_chk_guard): Same. + +2012-03-05 Kees Cook <keescook@chromium.org> + + * stdio-common/vfprintf.c (vfprintf): add missing errno settings. + + [BZ #13656] + * stdio-common/vfprintf.c (vfprintf): Check for nargs overflow and + possibly allocate from heap instead of stack. + * stdio-common/bug-vfprintf-nargs.c: New file. + * stdio-common/Makefile (tests): Add nargs overflow test. + +2012-03-03 Andreas Schwab <schwab@linux-m68k.org> + + * sysdeps/powerpc/fpu/libm-test-ulps: Update. + +2012-03-03 Marek Polacek <polacek@redhat.com> + + * include/sys/cdefs.h: Remove __GNUC_PREREQ macro. + * math/math_private.h: Likewise. + * stdlib/tst-strtod.c: Likewise. + * sysdeps/i386/i486/bits/atomic.h: Likewise. + * sysdeps/x86_64/bits/atomic.h: Likewise. + +2012-03-02 David S. Miller <davem@davemloft.net> + + * sysdeps/sparc/sparc32/sparcv9/fpu/s_llrint.S: New file. + * sysdeps/sparc/sparc32/sparcv9/fpu/s_llrintf.S: New file. + * sysdeps/sparc/sparc32/sparcv9/fpu/s_lrint.S: New file. + * sysdeps/sparc/sparc32/sparcv9/fpu/s_lrintf.S: New file. + * sysdeps/sparc/sparc64/fpu/s_llrint.S: New file. + * sysdeps/sparc/sparc64/fpu/s_llrintf.S: New file. + * sysdeps/sparc/sparc64/fpu/s_lrint.S: New file. + * sysdeps/sparc/sparc64/fpu/s_lrintf.S: New file. + 2012-03-02 Roland McGrath <roland@hack.frob.com> [BZ #13792] + * manual/examples/README: New file, says the example source files + can be used under GPL>=2. + * manual/Makefile (%.c.texi): Eat the leading part of the file until a + line containing just "*/". + * manual/examples/add.c: Add copyright header (GPL>=2). + * manual/examples/argp-ex1.c: Likewise. + * manual/examples/argp-ex2.c: Likewise. + * manual/examples/argp-ex3.c: Likewise. + * manual/examples/argp-ex4.c: Likewise. + * manual/examples/atexit.c: Likewise. + * manual/examples/db.c: Likewise. + * manual/examples/dir.c: Likewise. + * manual/examples/dir2.c: Likewise. + * manual/examples/execinfo.c: Likewise. + * manual/examples/filecli.c: Likewise. + * manual/examples/filesrv.c: Likewise. + * manual/examples/fmtmsgexpl.c: Likewise. + * manual/examples/genpass.c: Likewise. + * manual/examples/inetcli.c: Likewise. + * manual/examples/inetsrv.c: Likewise. + * manual/examples/isockad.c: Likewise. + * manual/examples/longopt.c: Likewise. + * manual/examples/memopen.c: Likewise. + * manual/examples/memstrm.c: Likewise. + * manual/examples/mkfsock.c: Likewise. + * manual/examples/mkisock.c: Likewise. + * manual/examples/mygetpass.c: Likewise. + * manual/examples/pipe.c: Likewise. + * manual/examples/popen.c: Likewise. + * manual/examples/rprintf.c: Likewise. + * manual/examples/search.c: Likewise. + * manual/examples/select.c: Likewise. + * manual/examples/setjmp.c: Likewise. + * manual/examples/sigh1.c: Likewise. + * manual/examples/sigusr.c: Likewise. + * manual/examples/stpcpy.c: Likewise. + * manual/examples/strdupa.c: Likewise. + * manual/examples/strftim.c: Likewise. + * manual/examples/strncat.c: Likewise. + * manual/examples/subopt.c: Likewise. + * manual/examples/swapcontext.c: Likewise. + * manual/examples/termios.c: Likewise. + * manual/examples/testopt.c: Likewise. + * manual/examples/testpass.c: Likewise. + * manual/examples/timeval_subtract.c: Likewise. + + [BZ #13792] * manual/time.texi (Elapsed Time): Move timeval_subtract example function to ... * manual/timeval_subtract.c.texi: ... here, new file. @@ -9,11 +9,12 @@ Version 2.16 * The following bugs are resolved with this release: - 174, 350, 411, 2541, 2547, 2548, 3335, 3992, 4026, 4108, 4596, 4822, 5077, - 5461, 5805, 5993, 6884, 6907, 9739, 9902, 10110, 10135, 10140, 10210, - 11174, 11322, 11365, 11494, 12047, 13058, 13525, 13526, 13527, 13528, - 13529, 13530, 13531, 13532, 13533, 13547, 13551, 13552, 13553, 13555, - 13559, 13583, 13618, 13637, 13695, 13704, 13706, 13738, 13786 + 174, 350, 411, 2541, 2547, 2548, 3335, 3976, 3992, 4026, 4108, 4596, 4822, + 5077, 5461, 5805, 5993, 6884, 6907, 9739, 9902, 10110, 10135, 10140, + 10210, 10716, 11174, 11322, 11365, 11494, 12047, 13058, 13525, 13526, + 13527, 13528, 13529, 13530, 13531, 13532, 13533, 13547, 13551, 13552, + 13553, 13555, 13559, 13583, 13618, 13637, 13656, 13695, 13704, 13706, + 13726, 13738, 13786, 13792 * ISO C11 support: diff --git a/libc/argp/Makefile b/libc/argp/Makefile index 329f95168..ca33622ff 100644 --- a/libc/argp/Makefile +++ b/libc/argp/Makefile @@ -1,4 +1,5 @@ -# Copyright (C) 1997,2002,2003,2006,2007,2010 Free Software Foundation, Inc. +# Copyright (C) 1997,2002,2003,2006,2007,2010,2012 +# Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -23,7 +24,6 @@ include ../option-groups.mak subdir := argp headers = argp.h -distribute = argp-fmtstream.h argp-namefrob.h routines = $(addprefix argp-, ba fmtstream fs-xinl help parse pv \ pvh xinl eexst) diff --git a/libc/catgets/Makefile b/libc/catgets/Makefile index f0ebd6102..3c5ad7a15 100644 --- a/libc/catgets/Makefile +++ b/libc/catgets/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1996-2000, 2002, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 1996-2000, 2002-2004, 2012 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -23,8 +23,6 @@ subdir := catgets include ../option-groups.mak headers = nl_types.h -distribute = catgetsinfo.h config.h xopen-msg.sed test1.msg test2.msg \ - test-gencat.sh sample.SJIS routines-$(OPTION_EGLIBC_CATGETS) := catgets open_catalog others-$(OPTION_EGLIBC_CATGETS) := gencat install-bin-$(OPTION_EGLIBC_CATGETS) := gencat diff --git a/libc/conform/Makefile b/libc/conform/Makefile index f1f45ee20..4915a67b1 100644 --- a/libc/conform/Makefile +++ b/libc/conform/Makefile @@ -20,9 +20,6 @@ # subdir := conform -distribute = conformtest.pl $(wildcard data/*.h-data) \ - $(wildcard data/*/*.h-data) - include ../Rules ifneq (yes,$(fast-check)) diff --git a/libc/crypt/Makefile b/libc/crypt/Makefile index 51dcb3822..1184810b6 100644 --- a/libc/crypt/Makefile +++ b/libc/crypt/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1996, 2000, 2001, 2007, 2009 Free Software Foundation, Inc. +# Copyright (C) 1996,2000,2001,2007,2009,2012 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -34,9 +34,6 @@ libcrypt-routines += $(libcrypt-routines-y) tests-$(OPTION_EGLIBC_CRYPT) := md5c-test sha256c-test sha512c-test tests-$(OPTION_EGLIBC_CRYPT_UFC) += cert -distribute := ufc-crypt.h crypt-private.h ufc.c speeds.c README.ufc-crypt \ - Banner md5.h sha256.h sha512.h - include ../Makeconfig ifeq ($(crypt-in-libc)$(OPTION_EGLIBC_CRYPT),yesy) diff --git a/libc/csu/Makefile b/libc/csu/Makefile index cf73425ee..8d47cbc78 100644 --- a/libc/csu/Makefile +++ b/libc/csu/Makefile @@ -39,8 +39,6 @@ omit-deps = $(patsubst %.o,%,$(start-installed-name) g$(start-installed-name) \ b$(start-installed-name) $(csu-dummies) \ S$(start-installed-name)) install-lib = $(start-installed-name) g$(start-installed-name) $(csu-dummies) -distribute = gmon-start.c start.c \ - abi-note.S init.c c not-cancel.h generated = version-info.h before-compile = $(objpfx)version-info.h diff --git a/libc/debug/Makefile b/libc/debug/Makefile index 60aa76fca..943630882 100644 --- a/libc/debug/Makefile +++ b/libc/debug/Makefile @@ -23,7 +23,6 @@ include ../option-groups.mak subdir := debug headers := execinfo.h -distribute = sigcontextinfo.h register-dump.h frame.h routines = noophooks \ memcpy_chk memmove_chk mempcpy_chk memset_chk stpcpy_chk \ @@ -160,7 +159,6 @@ install-bin-script = xtrace include ../Makeconfig -distribute += catchsegv.sh xtrace.sh ifeq ($(build-shared),yes) install-bin-script += catchsegv endif diff --git a/libc/dirent/Makefile b/libc/dirent/Makefile index 8b504fdf0..0cdab68ab 100644 --- a/libc/dirent/Makefile +++ b/libc/dirent/Makefile @@ -1,4 +1,5 @@ -# Copyright (C) 1991-2000,2002,2003,2005,2006,2011 Free Software Foundation, Inc. +# Copyright (C) 1991-2000,2002,2003,2005,2006,2011,2012 +# Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -26,7 +27,6 @@ routines := opendir closedir readdir readdir_r rewinddir \ getdents getdents64 dirfd readdir64 readdir64_r scandir64 \ alphasort64 versionsort64 fdopendir \ scandirat scandirat64 -distribute := dirstream.h tests := list tst-seekdir opendir-tst1 bug-readdir1 tst-fdopendir \ tst-fdopendir2 diff --git a/libc/dlfcn/Makefile b/libc/dlfcn/Makefile index ea6f26509..0da477065 100644 --- a/libc/dlfcn/Makefile +++ b/libc/dlfcn/Makefile @@ -24,12 +24,6 @@ libdl-routines := dlopen dlclose dlsym dlvsym dlerror dladdr dladdr1 dlinfo \ dlmopen dlfcn routines := $(patsubst %,s%,$(filter-out dlfcn,$(libdl-routines))) elide-routines.os := $(routines) -distribute := dlopenold.c glreflib1.c glreflib2.c glreflib3.c \ - failtestmod.c \ - defaultmod1.c defaultmod2.c errmsg1mod.c modatexit.c \ - modcxaatexit.c modstatic.c modstatic2.c \ - bug-dlsym1-lib1.c bug-dlsym1-lib2.c bug-atexit1-lib.c \ - bug-atexit2-lib.c extra-libs-others := libdl diff --git a/libc/elf/Makefile b/libc/elf/Makefile index 5e2666908..76ea4c8c0 100644 --- a/libc/elf/Makefile +++ b/libc/elf/Makefile @@ -41,91 +41,6 @@ shared-only-routines += dl-caller rtld-routines := rtld $(dl-routines) dl-sysdep dl-environ dl-minimal all-rtld-routines = $(rtld-routines) $(sysdep-rtld-routines) -distribute := rtld-Rules \ - $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \ - dl-cache.h dl-hash.h soinit.c sofini.c ldd.bash.in \ - genrtldtbl.awk atomicity.h dl-procinfo.h ldsodefs.h \ - dl-librecon.h interp.c sln.c dl-dst.h hp-timing.h \ - dl-lookupcfg.h sprof.c gen-trusted-dirs.awk \ - testobj1.c testobj2.c testobj3.c testobj4.c testobj5.c \ - testobj6.c testobj1_1.c failobj.c unloadmod.c \ - ldconfig.h ldconfig.c cache.c readlib.c readelflib.c \ - chroot_canon.c gccframe.h \ - dep1.c dep2.c dep3.c dep4.c dl-dtprocnum.h unsecvars.h \ - vismain.c vismod1.c vismod2.c vismod3.c \ - constload2.c constload3.c filtmod1.c filtmod2.c \ - nodlopenmod.c nodelete.c nodelmod1.c nodelmod2.c \ - nodelmod3.c nodelmod4.c nodlopen.c dl-osinfo.h \ - reldepmod1.c reldepmod2.c reldepmod3.c reldepmod4.c \ - reldepmod5.c reldepmod6.c \ - reldep4mod1.c reldep4mod2.c reldep4mod3.c reldep4mod4.c \ - nextmod1.c nextmod2.c pathoptobj.c tst-pathopt.sh \ - neededobj1.c neededobj2.c neededobj3.c neededobj4.c \ - neededobj5.c neededobj6.c firstobj.c \ - unload2mod.c unload2dep.c ltglobmod1.c ltglobmod2.c \ - testobj.h vismod.h globalmod1.c \ - dblloadmod1.c dblloadmod2.c dblloadmod3.c \ - reldep6mod4.c reldep6mod3.c reldep6mod2.c reldep6mod1.c \ - reldep6mod0.c reldep7mod1.c reldep7mod2.c \ - unwind-dw2.c unwind-dw2-fde.c unwind.h unwind-pe.h \ - unwind-dw2-fde.h dwarf2.h dl-procinfo.c tls.h dl-tls.h \ - tst-tlsmod1.c tst-tlsmod2.c tst-tlsmod3.c tst-tlsmod4.c \ - tst-tlsmod5.c tst-tlsmod6.c tst-tlsmod7.c tst-tlsmod8.c \ - tst-tlsmod9.c tst-tlsmod10.c tst-tlsmod11.c \ - tst-tlsmod12.c tst-tls10.h tst-alignmod.c tst-alignmod2.c \ - circlemod1.c circlemod1a.c circlemod2.c circlemod2a.c \ - circlemod3.c circlemod3a.c nodlopenmod2.c \ - tst-tls19mod1.c tst-tls19mod2.c tst-tls19mod3.c \ - tls-macros.h \ - reldep8mod1.c reldep8mod2.c reldep8mod3.c \ - nodel2mod1.c nodel2mod2.c nodel2mod3.c \ - reldep9.c reldep9mod1.c reldep9mod2.c reldep9mod3.c \ - tst-array1.exp tst-array2.exp tst-array4.exp \ - tst-array2dep.c tst-piemod1.c \ - tst-execstack-mod.c tst-dlmodcount.c \ - check-textrel.c dl-sysdep.h test-dlopenrpathmod.c \ - tst-deep1mod1.c tst-deep1mod2.c tst-deep1mod3.c \ - unload3mod1.c unload3mod2.c unload3mod3.c unload3mod4.c \ - unload4mod1.c unload4mod2.c unload4mod3.c unload4mod4.c \ - unload6mod1.c unload6mod2.c unload6mod3.c \ - unload7mod1.c unload7mod2.c \ - unload8mod1.c unload8mod1x.c unload8mod2.c unload8mod3.c \ - tst-audit1.c tst-audit2.c tst-audit3.c tst-audit4.c \ - tst-auditmod1.c tst-auditmod3a.c tst-auditmod3b.c \ - tst-auditmod4a.c tst-auditmod4b.c \ - tst-audit5.c tst-auditmod5a.c tst-auditmod5b.c \ - tst-audit6.c tst-auditmod6a.c tst-auditmod6b.c \ - tst-auditmod6c.c \ - tst-audit7.c tst-auditmod7a.c tst-auditmod7b.c \ - order2mod1.c order2mod2.c order2mod3.c order2mod4.c \ - tst-stackguard1.c tst-stackguard1-static.c \ - tst-array5.c tst-array5-static.c tst-array5dep.c \ - tst-array5.exp tst-leaks1.c check-execstack.c \ - ifuncmain1.c ifuncmain1pic.c ifuncmain1vis.c \ - ifuncmain1vispic.c ifuncmain1static.c \ - ifuncmain1staticpic.c ifuncmain1picstatic.c \ - ifuncdep1.c ifuncdep1pic.c ifuncmod1.c \ - ifuncmain1pie.c ifuncmain1vispie.c \ - ifuncmain1staticpie.c \ - ifuncmain2.c ifuncmain2static.c ifuncdep2.c \ - ifuncmain2pic.c ifuncmain2picstatic.c ifuncdep2pic.c \ - ifuncmain3.c ifuncmod3.c \ - ifuncmain4.c ifuncmain4static.c ifuncmain4picstatic.c \ - ifuncmain5.c ifuncmain5pic.c ifuncmain5picstatic.c \ - ifuncmain5pie.c ifuncmain5static.c \ - ifuncmain5staticpic.c \ - ifuncdep5.c ifuncdep5pic.c ifuncmod5.c \ - ifuncmain6pie.c ifuncmod6.c \ - ifuncmain7.c ifuncmain7pic.c ifuncmain7picstatic.c \ - ifuncmain7pie.c ifuncmain7static.c \ - tst-unique1.c tst-unique1mod1.c tst-unique1mod2.c \ - tst-unique2.c tst-unique2mod1.c tst-unique2mod2.c \ - tst-initordera1.c tst-initordera2.c tst-initorderb1.c \ - tst-initorderb2.c tst-initordera3.c tst-initordera4.c \ - tst-initorder.c \ - tst-initorder2.c \ - tst-relsort1.c tst-relsort1mod1.c tst-relsort1mod2.c - CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-dl-iterate-phdr.c = $(uses-callbacks) diff --git a/libc/gmon/Makefile b/libc/gmon/Makefile index 2f15d8ca3..66c7916e1 100644 --- a/libc/gmon/Makefile +++ b/libc/gmon/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1995,1996,1997,2001,2002,2005 Free Software Foundation, Inc. +# Copyright (C) 1995-1997,2001,2002,2005,2012 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -21,7 +21,6 @@ subdir := gmon headers := sys/gmon.h sys/gmon_out.h sys/profil.h -distribute := machine-gmon.h profil-counter.h routines := gmon mcount profil sprofil bb_init_func bb_exit_func prof-freq elide-routines.os = bb_init_func bb_exit_func diff --git a/libc/grp/Makefile b/libc/grp/Makefile index a634bb107..b2b75e8d7 100644 --- a/libc/grp/Makefile +++ b/libc/grp/Makefile @@ -1,4 +1,5 @@ -# Copyright (C) 1991,1992,1996-2000,2003,2004 Free Software Foundation, Inc. +# Copyright (C) 1991,1992,1996-2000,2003,2004,2012 +# Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -23,8 +24,6 @@ include ../option-groups.mak subdir := grp headers := grp.h -distribute := tst_fgetgrent.c tst_fgetgrent.sh compat-initgroups.c - routines := fgetgrent initgroups setgroups \ getgrent getgrgid getgrnam putgrent \ getgrent_r getgrgid_r getgrnam_r fgetgrent_r diff --git a/libc/hesiod/Makefile b/libc/hesiod/Makefile index dbac6363f..22abe114f 100644 --- a/libc/hesiod/Makefile +++ b/libc/hesiod/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc. +# Copyright (C) 1997, 1998, 2000, 2001, 2012 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -22,8 +22,6 @@ include ../option-groups.mak subdir := hesiod -distribute := hesiod.h hesiod_p.h README.hesiod nss_hesiod/nss_hesiod.h - extra-libs-$(OPTION_EGLIBC_INET) += libnss_hesiod extra-libs-others-y += $(extra-libs-y) @@ -31,7 +29,7 @@ subdir-dirs = nss_hesiod vpath %.c nss_hesiod libnss_hesiod-routines := hesiod hesiod-grp hesiod-init hesiod-proto \ - hesiod-pwd hesiod-service + hesiod-pwd hesiod-service # Build only shared library libnss_hesiod-inhibit-o = $(filter-out .os,$(object-suffixes)) @@ -43,6 +41,6 @@ include ../Rules # The Hesiod NSS modules also needs the resolver and some help from # the file service. $(objpfx)libnss_hesiod.so: $(common-objpfx)resolv/libresolv.so \ - $(common-objpfx)nss/libnss_files.so \ - $(common-objpfx)libc.so \ + $(common-objpfx)nss/libnss_files.so \ + $(common-objpfx)libc.so \ $(common-objpfx)libc_nonshared.a diff --git a/libc/hurd/Makefile b/libc/hurd/Makefile index bdad4ff90..321e04ef1 100644 --- a/libc/hurd/Makefile +++ b/libc/hurd/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991,92,93,94,95,96,97,98,99,2001,2002,2004,2006 +# Copyright (C) 1991,92,93,94,95,96,97,98,99,2001,2002,2004,2006,2012 # Free Software Foundation, Inc. # This file is part of the GNU C Library. @@ -29,7 +29,7 @@ headers = hurd.h $(interface-headers) \ userlink.h resource.h threadvar.h lookup.h) inline-headers = hurd.h $(addprefix hurd/,fd.h signal.h \ - userlink.h threadvar.h port.h) + userlink.h threadvar.h port.h) # The RPC interfaces go in a separate library. interface-library := libhurduser @@ -67,12 +67,9 @@ dtable = dtable port2fd new-fd alloc-fd intern-fd \ getdport openport \ fd-close fd-read fd-write hurdioctl ctty-input ctty-output inlines = $(inline-headers:%.h=%-inlines) -distribute = hurdstartup.h hurdfault.h hurdhost.h \ - faultexc.defs intr-rpc.defs intr-rpc.h intr-msg.h Notes # XXX this is a temporary hack; see hurdmalloc.h routines += hurdmalloc -distribute += hurdmalloc.h # Binary compatibility for libc.so.0.2[GLIBC_2.0]. ifeq ($(versioning),yes) diff --git a/libc/iconv/Makefile b/libc/iconv/Makefile index 3a424a580..3451ba3f2 100644 --- a/libc/iconv/Makefile +++ b/libc/iconv/Makefile @@ -47,10 +47,6 @@ CFLAGS-simple-hash.c = -I../locale tests = tst-iconv1 tst-iconv2 tst-iconv3 tst-iconv4 tst-iconv5 -distribute = gconv_builtin.h gconv_int.h loop.c skeleton.c iconv_prog.h \ - iconv_charmap.c dummy-repertoire.c gconv_charset.h strtab.c \ - iconvconfig.h - others = iconv_prog iconvconfig install-others-programs = $(inst_bindir)/iconv install-sbin = iconvconfig diff --git a/libc/iconvdata/Makefile b/libc/iconvdata/Makefile index f55fc3909..edb868967 100644 --- a/libc/iconvdata/Makefile +++ b/libc/iconvdata/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1997-2008, 2011 Free Software Foundation, Inc. +# Copyright (C) 1997-2008, 2011, 2012 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -131,83 +131,6 @@ LDFLAGS-libCNS.so = $(LDFLAGS-soname-fname) LDFLAGS-libISOIR165.so = $(LDFLAGS-soname-fname) LDFLAGS-libJISX0213.so = $(LDFLAGS-soname-fname) -distribute := gconv-modules extra-module.mk gap.awk gaptab.awk gconv.map \ - gen-8bit.sh gen-8bit-gap.sh gen-8bit-gap-1.sh \ - TESTS $(wildcard testdata/*) \ - TESTS2 run-iconv-test.sh tst-tables.sh tst-table.sh \ - tst-table-charmap.sh tst-table-from.c tst-table-to.c \ - EUC-JP.irreversible ISIRI-3342.irreversible SJIS.irreversible \ - EUC-KR.irreversible BIG5HKSCS.irreversible BIG5.irreversible \ - CP1255.irreversible CP1258.irreversible EUC-TW.irreversible \ - IBM856.irreversible IBM922.irreversible IBM1132.irreversible \ - IBM1133.irreversible IBM1160.irreversible IBM1161.irreversible\ - IBM1163.irreversible IBM1164.irreversible \ - ARMSCII-8.irreversible TCVN5712-1.precomposed \ - JISX0213.TXT EUC-JISX0213.precomposed \ - SHIFT_JISX0213.precomposed SHIFT_JISX0213.irreversible \ - TSCII.irreversible TSCII.precomposed \ - 8bit-generic.c 8bit-gap.c \ - ansi_x3.110.c asmo_449.c big5.c cp737.c cp737.h \ - cp775.c cp775.h ibm874.c cns11643.c cns11643.h \ - cns11643l1.c cns11643l1.h cp1125.c cp1250.c cp1251.c cp1252.c \ - cp1253.c cp1254.c cp1255.c cp1256.c cp1257.c cp1258.c \ - csn_369103.c cwi.c dec-mcs.c ebcdic-at-de.c ebcdic-at-de-a.c \ - ebcdic-ca-fr.c ebcdic-dk-no.c ebcdic-dk-no-a.c ebcdic-es.c \ - ebcdic-es-a.c ebcdic-es-s.c ebcdic-fr.c ebcdic-fi-se.c \ - ebcdic-fi-se-a.c ebcdic-is-friss.c ebcdic-it.c ebcdic-pt.c \ - ebcdic-uk.c ebcdic-us.c ecma-cyrillic.c euc-cn.c euc-jp.c \ - euc-kr.c euc-tw.c gb2312.c gb2312.h gbk.c gost_19768-74.c \ - greek-ccitt.c greek7.c greek7-old.c hp-roman8.c ibm037.c \ - ibm038.c ibm256.c ibm273.c ibm274.c ibm275.c ibm277.c \ - ibm278.c ibm280.c ibm281.c ibm284.c ibm285.c ibm290.c \ - ibm297.c ibm420.c ibm423.c ibm424.c ibm437.c ibm500.c \ - ibm850.c ibm851.c ibm852.c ibm855.c ibm857.c ibm860.c \ - ibm861.c ibm862.c ibm863.c ibm864.c ibm865.c ibm866.c \ - ibm868.c ibm869.c ibm870.c ibm871.c ibm875.c ibm880.c \ - ibm891.c ibm903.c ibm904.c ibm905.c ibm918.c ibm1004.c \ - ibm856.c ibm930.c ibm933.c ibm935.c ibm937.c ibm939.c ibm1046.c \ - ibm856.h ibm930.h ibm933.h ibm935.h ibm937.h ibm939.h ibm1046.h \ - ibm922.c ibm922.h ibm1124.c ibm1124.h ibm1129.c ibm1129.h \ - ibm1132.c ibm1132.h ibm1133.c ibm1133.h ibm1162.c ibm1162.h \ - ibm1026.c ibm1047.c iec_p27-1.c inis.c inis-8.c viscii.c \ - inis-cyrillic.c iso-2022-jp.c iso-2022-kr.c iso646.c \ - iso8859-1.c iso8859-2.c iso8859-3.c iso8859-4.c iso8859-5.c \ - iso8859-6.c iso8859-7.c iso8859-8.c iso8859-9.c iso8859-10.c \ - iso8859-11.c iso8859-13.c iso8859-14.c iso8859-9e.c \ - iso8859-15.c iso_2033.c iso_5427-ext.c iso_5427.c iso_5428.c \ - iso_6937.c iso_6937-2.c iso_10367-box.c jis0201.c jis0201.h \ - jis0208.c jis0208.h jis0212.c jis0212.h johab.c koi-8.c \ - koi8-r.c ksc5601.c ksc5601.h latin-greek.c latin-greek-1.c \ - macintosh.c mac-is.c mac-uk.c nats-dano.c nats-sefi.c sjis.c \ - t.61.c uhc.c sami-ws2.c iso-ir-197.c tis-620.c koi8-u.c \ - isiri-3342.c isiri-3342.h gbgbk.c iso-2022-cn.c cns11643l2.h \ - iso8859-16.c utf-16.c unicode.c utf-32.c utf-7.c big5hkscs.c \ - iso-ir-165.c iso-ir-165.h gb18030.c iso-2022-cn-ext.c \ - ibm932.c ibm932.h ibm943.c ibm943.h gbbig5.c cp10007.c \ - koi8-t.c georgian-ps.c georgian-academy.c iso-ir-209.c \ - mac-sami.c ibm1160.c ibm1160.h ibm1161.c ibm1161.h \ - ibm1163.c ibm1163.h ibm1164.c ibm1164.h jisx0213.c jisx0213.h \ - euc-jisx0213.c shift_jisx0213.c iso-2022-jp-3.c \ - tcvn5712-1.c armscii-8.c tscii.c ibm866nav.c pt154.c rk1048.c \ - ibm1025.c ibm1025.h ibm1122.c ibm1122.h ibm1137.c ibm1137.h \ - ibm1153.c ibm1153.h ibm1154.c ibm1154.h ibm1155.c ibm1155.h \ - ibm1156.c ibm1156.h ibm1157.c ibm1157.h ibm1158.c ibm1158.h \ - ibm803.c ibm803.h ibm901.c ibm901.h ibm902.c ibm902.h \ - ibm921.c ibm921.h ibm1008.c ibm1008.h ibm1008_420.c \ - ibm1097.c ibm1097.h ibm1112.c ibm1112.h ibm1123.c ibm1123.h \ - ibm1130.c ibm1130.h ibm1140.c ibm1140.h ibm1141.c ibm1141.h \ - ibm1142.c ibm1142.h ibm1143.c ibm1143.h ibm1144.c ibm1144.h \ - ibm1145.c ibm1145.h ibm1146.c ibm1146.h ibm1147.c ibm1147.h \ - ibm1148.c ibm1148.h ibm1149.c ibm1149.h ibm1166.c ibm1166.h \ - ibm1167.c ibm1167.h ibm4517.c ibm4517.h ibm4899.c ibm4899.h \ - ibm4909.c ibm4909.h ibm4971.c ibm4971.h ibm5347.c ibm5347.h \ - ibm9030.c ibm9030.h ibm9066.c ibm9066.h ibm9448.c ibm9448.h \ - ibm12712.c ibm12712.h ibm16804.c ibm16804.h \ - ibm1364.c ibm1364.h ibm1371.c ibm1371.h ibm1388.c ibm1388.h \ - ibm1390.c ibm1390.h ibm1399.c ibm1399.h iso_11548-1.c mik.c \ - brf.c mac-centraleurope.c hp-roman9.c hp-turkish8.c \ - hp-thai8.c hp-greek8.c cp770.c cp771.c cp772.c cp773.c cp774.c - # We build the transformation modules only when we build shared libs. ifeq (yes,$(build-shared)) diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h index fa93982af..71baa1a2d 100644 --- a/libc/include/sys/cdefs.h +++ b/libc/include/sys/cdefs.h @@ -14,11 +14,7 @@ libc_hidden_proto (__chk_fail) rtld_hidden_proto (__chk_fail) -# if __GNUC_PREREQ (4,3) -# define __attribute_alloc_size(...) __attribute__ ((alloc_size (__VA_ARGS__))) -# else -# define __attribute_alloc_size(...) -# endif +# define __attribute_alloc_size(...) __attribute__ ((alloc_size (__VA_ARGS__))) #endif #endif diff --git a/libc/inet/Makefile b/libc/inet/Makefile index bf2f6edb1..c04700582 100644 --- a/libc/inet/Makefile +++ b/libc/inet/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991-2006, 2007, 2009, 2011 Free Software Foundation, Inc. +# Copyright (C) 1991-2007, 2009, 2011, 2012 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -27,8 +27,6 @@ headers := netinet/ether.h netinet/in.h netinet/in_systm.h \ netinet/tcp.h netinet/ip.h $(wildcard arpa/*.h protocols/*.h) \ aliases.h ifaddrs.h netinet/ip6.h netinet/icmp6.h bits/in.h -distribute := netgroup.h - routines-$(OPTION_EGLIBC_INET) \ += htonl htons \ inet_lnaof inet_mkadr \ diff --git a/libc/intl/Makefile b/libc/intl/Makefile index d91eabbbb..afc01f046 100644 --- a/libc/intl/Makefile +++ b/libc/intl/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1995-2003, 2005, 2008, 2011 Free Software Foundation, Inc. +# Copyright (C) 1995-2003,2005,2008,2011,2012 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -24,15 +24,6 @@ routines = bindtextdom dcgettext dgettext gettext \ dcigettext dcngettext dngettext ngettext \ finddomain loadmsgcat localealias textdomain aux = l10nflist explodename plural plural-exp hash-string -distribute = gmo.h gettextP.h hash-string.h loadinfo.h locale.alias \ - plural.y plural-exp.h plural-eval.c po2test.sed \ - tst-gettext.sh \ - tst-translit.sh translit.po \ - tst-gettext2.sh tstlang1.po tstlang2.po \ - tst-codeset.sh tstcodeset.po \ - tst-gettext3.sh \ - tst-gettext4.sh tst-gettext4-de.po tst-gettext4-fr.po \ - tst-gettext5.sh tst-gettext6.sh include ../Makeconfig diff --git a/libc/io/Makefile b/libc/io/Makefile index 9d5bc183c..7162b7867 100644 --- a/libc/io/Makefile +++ b/libc/io/Makefile @@ -77,8 +77,6 @@ tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \ tests-$(OPTION_EGLIBC_FTRAVERSE) += bug-ftw1 bug-ftw2 bug-ftw3 bug-ftw4 \ bug-ftw5 -distribute := ftwtest-sh - include ../Rules CFLAGS-fcntl.c = -fexceptions -fasynchronous-unwind-tables diff --git a/libc/libidn/ChangeLog b/libc/libidn/ChangeLog index a718a9f2a..58a95b1b9 100644 --- a/libc/libidn/ChangeLog +++ b/libc/libidn/ChangeLog @@ -1,3 +1,7 @@ +2012-03-07 Ulrich Drepper <drepper@gmail.com> + + * Makefile (distribute): Remove variable. + 2011-12-03 Ulrich Drepper <drepper@gmail.com> * idna.c (idna_to_unicode_4z4z): Remove variable rc. diff --git a/libc/libidn/Makefile b/libc/libidn/Makefile index dd81025b8..85fa6ab79 100644 --- a/libc/libidn/Makefile +++ b/libc/libidn/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2003, 2004, 2005, 2006, 2012 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -20,8 +20,6 @@ include ../option-groups.mak subdir := libidn -distribute := punycode.h stringprep.h idna.h iconvme.h - routines = idn-stub extra-libs-$(OPTION_EGLIBC_IDN) = libcidn diff --git a/libc/libio/Makefile b/libc/libio/Makefile index 4e0e885ef..67f30aea0 100644 --- a/libc/libio/Makefile +++ b/libc/libio/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1995-2004,2006-2009,2011 Free Software Foundation, Inc. +# Copyright (C) 1995-2004,2006-2009,2011,2012 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -189,9 +189,6 @@ shared-only-routines = oldiofopen oldiofdopen oldiofclose oldfileops \ oldiofgetpos oldiofgetpos64 oldiofsetpos \ oldiofsetpos64 -distribute := iolibio.h libioP.h strfile.h Banner test-freopen.sh \ - fd_to_filename.h - include ../Rules ifeq (y,$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO)) diff --git a/libc/locale/Makefile b/libc/locale/Makefile index 2bc54a6f0..31cf1beb9 100644 --- a/libc/locale/Makefile +++ b/libc/locale/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991,1992,1995-2003,2005,2009,2011 +# Copyright (C) 1991,1992,1995-2003,2005,2009,2011,2012 # Free Software Foundation, Inc. # This file is part of the GNU C Library. @@ -24,19 +24,6 @@ include ../option-groups.mak subdir := locale headers = locale.h bits/locale.h langinfo.h xlocale.h -distribute = localeinfo.h categories.def iso-639.def iso-3166.def \ - iso-4217.def weight.h weightwc.h strlen-hash.h elem-hash.h \ - indigits.h indigitswc.h outdigits.h outdigitswc.h \ - coll-lookup.h C-translit.h.in C-translit.h gen-translit.pl \ - locarchive.h hashval.h dummy-setlocale.c \ - $(addprefix programs/, \ - locale.c localedef.c \ - $(localedef-modules:=.c) $(locale-modules:=.c) \ - $(lib-modules:=.c) config.h simple-hash.h \ - charmap-kw.gperf charmap-kw.h locfile-token.h \ - locfile-kw.gperf locfile-kw.h linereader.h \ - locfile.h charmap.h repertoire.h localedef.h \ - 3level.h charmap-dir.h locarchive.c) # catnames is needed by OPTION_EGLIBC_LOCALE_CODE and by the 'intl' code. # If we put the latter in an option group, too, we can omit catnames # when both option groups are disabled. libstdc++-v3 needs mb_cur_max. diff --git a/libc/localedata/ChangeLog b/libc/localedata/ChangeLog index ff5851fcd..c5afba1b0 100644 --- a/libc/localedata/ChangeLog +++ b/libc/localedata/ChangeLog @@ -1,3 +1,7 @@ +2012-03-07 Ulrich Drepper <drepper@gmail.com> + + * Makefile (distribute): Remove variable. + 2012-02-10 Joseph Myers <joseph@codesourcery.com> Revert changes to locales from previous commit. diff --git a/libc/localedata/Makefile b/libc/localedata/Makefile index 09d314207..e18a3fa8c 100644 --- a/libc/localedata/Makefile +++ b/libc/localedata/Makefile @@ -1,4 +1,5 @@ -# Copyright (C) 1996-2003,2005,2007,2008,2009,2011 Free Software Foundation, Inc. +# Copyright (C) 1996-2003,2005,2007-2009,2011,2012 +# Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -66,19 +67,6 @@ generated := $(test-input) $(test-output) sort-test.out tst-locale.out \ generated-dirs := $(ld-test-names) tt_TT de_DE.437 \ $(addprefix tstfmon_,$(fmon-tests)) \ -distribute := CHECKSUMS README SUPPORTED ChangeLog \ - $(all-charmaps) $(all-locales) \ - tst-rpmatch.sh tst-locale.sh tst-fmon.sh sort-test.sh \ - tst-fmon.data $(test-input-data) $(ld-test-srcs) \ - th_TH.in cs_CZ.in tst-mbswcs.sh tst-trans.sh tst-ctype.sh \ - tst-ctype-de_DE.ISO-8859-1.in \ - tst-numeric.sh tst-numeric.data \ - $(wildcard tests-mbwc/*.[ch]) \ - $(addprefix tst-fmon-locales/tstfmon_,$(fmon-tests)) \ - gen-locale.sh show-ucs-data.c tst-langinfo.sh \ - tst-wctype.sh tst-wctype.input gen-unicode-ctype.c \ - dump-ctype.c - # Get $(inst_i18ndir) defined. include ../Makeconfig diff --git a/libc/login/Makefile b/libc/login/Makefile index df3d69cde..f0af07d39 100644 --- a/libc/login/Makefile +++ b/libc/login/Makefile @@ -1,4 +1,5 @@ -# Copyright (C) 1996-1998,2000-2003,2007, 2009 Free Software Foundation, Inc. +# Copyright (C) 1996-1998,2000-2003,2007,2009,2012 +# Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -36,8 +37,6 @@ others-$(OPTION_EGLIBC_UTMP) += utmpdump others-pie = pt_chown install-others-programs = $(inst_libexecdir)/pt_chown -distribute := utmp-private.h utmp-equal.h pty-private.h - subdir-dirs = programs vpath %.c programs diff --git a/libc/mach/Makefile b/libc/mach/Makefile index ec33fa72d..00de7a505 100644 --- a/libc/mach/Makefile +++ b/libc/mach/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991,92,93,94,95,96,97,98,2001,02 +# Copyright (C) 1991,92,93,94,95,96,97,98,2001,02,12 # Free Software Foundation, Inc. # This file is part of the GNU C Library. @@ -27,7 +27,6 @@ include ../Makeconfig headers = mach_init.h mach.h mach_error.h mach-shortcuts.h mach/mach_traps.h \ $(interface-headers) mach/mach.h mach/mig_support.h mach/error.h \ $(lock-headers) machine-sp.h -distribute = thread_state.h lock = spin-solid spin-lock mutex-init mutex-solid lock-headers = lock-intern.h machine-lock.h spin-lock.h routines = $(mach-syscalls) $(mach-shortcuts) \ @@ -52,17 +51,11 @@ mach/memory_object_user.defs = mach/memory_object.defs user-interfaces := $(addprefix mach/,$(mach-interface-list) \ mach_port mach_host exc \ - )\ + )\ $(addprefix device/,device device_request) server-interfaces := mach/exc -# It is important that we do not use the wildcard function to expand -# `err_*.sub'. Leaving the wildcard allows Make-dist to find all matching -# files in all sysdep directories. -distribute += Machrules syscalls.awk shortcut.awk \ - errorlib.h err_*.sub errsystems.awk - # Clear any environment value. generated = diff --git a/libc/malloc/Makefile b/libc/malloc/Makefile index 3ffaba745..e3be2544e 100644 --- a/libc/malloc/Makefile +++ b/libc/malloc/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991-1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2009, 2011 +# Copyright (C) 1991-2003, 2005, 2006, 2007, 2009, 2011, 2012 # Free Software Foundation, Inc. # This file is part of the GNU C Library. @@ -31,14 +31,7 @@ tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \ tst-mallocstate tst-mcheck tst-mallocfork tst-trim1 test-srcs = tst-mtrace -distribute = thread-m.h mtrace.pl mcheck-init.c stackinfo.h memusage.h \ - memusage.sh memusagestat.c tst-mtrace.sh arena.c hooks.c - -# Things which get pasted together into gmalloc.c. -gmalloc-routines := malloc morecore -# Things to include in the standalone distribution. -dist-routines = $(gmalloc-routines) mcheck mtrace -routines = $(dist-routines) obstack +routines = malloc morecore mcheck mtrace obstack install-lib := libmcheck.a non-lib.a := libmcheck.a diff --git a/libc/manual/Makefile b/libc/manual/Makefile index eed65f4a6..85ffec2b7 100644 --- a/libc/manual/Makefile +++ b/libc/manual/Makefile @@ -131,7 +131,8 @@ stamp-version: $(common-objpfx)config.make # Generate Texinfo files from the C source for the example programs. %.c.texi: examples/%.c - sed -e 's,[{}],@&,g' \ + sed -e '1,/^\*\/$$/d' \ + -e 's,[{}],@&,g' \ -e 's,/\*\(@.*\)\*/,\1,g' \ -e 's,/\* *,/* @r{,g' -e 's, *\*/,} */,' \ -e 's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/g'\ @@ -153,17 +154,8 @@ minimal-dist = summary.awk texis.awk tsort.awk libc-texinfo.sh libc.texinfo \ $(filter-out summary.texi, $(nonexamples)) \ $(patsubst %.c.texi,examples/%.c, $(examples)) -doc-only-dist = Makefile COPYING.LIB -distribute = $(minimal-dist) $(examples) stdio-fp.c \ - libc.info* libc.?? libc.??s texinfo.tex \ - xtract-typefun.awk dir-add.texi dir libm-err-tab.pl -export distribute := $(distribute) - tar-it = tar chovf $@ $^ -manual.tar: $(doc-only-dist) $(minimal-dist) ; $(tar-it) -mandist.tar: $(doc-only-dist) $(distribute) ; $(tar-it) - edition := $(shell sed -n 's/^@set EDITION \([0-9][0-9.]*\)[^0-9.]*.*$$/\1/p' \ libc.texinfo) diff --git a/libc/manual/examples/README b/libc/manual/examples/README new file mode 100644 index 000000000..7d0070fdd --- /dev/null +++ b/libc/manual/examples/README @@ -0,0 +1,8 @@ +These are source files for example code that appears in The GNU C +Library Reference Manual. + +While the manual itself is licensed under the terms of the GNU Free +Documentation License, you can use these source files on their own +under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License, or (at your +option) any later version. diff --git a/libc/manual/examples/add.c b/libc/manual/examples/add.c index e4b1bba36..d4b9af9c9 100644 --- a/libc/manual/examples/add.c +++ b/libc/manual/examples/add.c @@ -1,3 +1,20 @@ +/* Example of a Variadic Function + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdarg.h> #include <stdio.h> diff --git a/libc/manual/examples/argp-ex1.c b/libc/manual/examples/argp-ex1.c index 931a8264a..01c363921 100644 --- a/libc/manual/examples/argp-ex1.c +++ b/libc/manual/examples/argp-ex1.c @@ -1,4 +1,19 @@ -/* Argp example #1 -- a minimal program using argp */ +/* Argp example #1 -- a minimal program using argp + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ /* This is (probably) the smallest possible program that uses argp. It won't do much except give an error diff --git a/libc/manual/examples/argp-ex2.c b/libc/manual/examples/argp-ex2.c index 097ce7622..0e038bbc9 100644 --- a/libc/manual/examples/argp-ex2.c +++ b/libc/manual/examples/argp-ex2.c @@ -1,4 +1,19 @@ -/* Argp example #2 -- a pretty minimal program using argp */ +/* Argp example #2 -- a pretty minimal program using argp + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ /* This program doesn't use any options or arguments, but uses argp to be compliant with the GNU standard command line diff --git a/libc/manual/examples/argp-ex3.c b/libc/manual/examples/argp-ex3.c index d5896ee13..689d7cfda 100644 --- a/libc/manual/examples/argp-ex3.c +++ b/libc/manual/examples/argp-ex3.c @@ -1,4 +1,19 @@ -/* Argp example #3 -- a program with options and arguments using argp */ +/* Argp example #3 -- a program with options and arguments using argp + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ /* This program uses the same features as example 2, and uses options and arguments. diff --git a/libc/manual/examples/argp-ex4.c b/libc/manual/examples/argp-ex4.c index 2b61358c7..b946dd106 100644 --- a/libc/manual/examples/argp-ex4.c +++ b/libc/manual/examples/argp-ex4.c @@ -1,4 +1,19 @@ -/* Argp example #4 -- a program with somewhat more complicated options */ +/* Argp example #4 -- a program with somewhat more complicated options + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ /* This program uses the same features as example 3, but has more options, and somewhat more structure in the -help output. It diff --git a/libc/manual/examples/atexit.c b/libc/manual/examples/atexit.c index 42bba7112..5f07c8751 100644 --- a/libc/manual/examples/atexit.c +++ b/libc/manual/examples/atexit.c @@ -1,7 +1,24 @@ +/* Cleanups on Exit + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <stdlib.h> -void +void bye (void) { puts ("Goodbye, cruel world...."); diff --git a/libc/manual/examples/db.c b/libc/manual/examples/db.c index 1a1cb0c0d..d6405e50d 100644 --- a/libc/manual/examples/db.c +++ b/libc/manual/examples/db.c @@ -1,3 +1,20 @@ +/* User and Group Database Example + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <grp.h> #include <pwd.h> #include <sys/types.h> diff --git a/libc/manual/examples/dir.c b/libc/manual/examples/dir.c index 8ab77dc34..9ca63fec0 100644 --- a/libc/manual/examples/dir.c +++ b/libc/manual/examples/dir.c @@ -1,3 +1,20 @@ +/* Simple Program to List a Directory + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + /*@group*/ #include <stdio.h> #include <sys/types.h> diff --git a/libc/manual/examples/dir2.c b/libc/manual/examples/dir2.c index a75c88574..7f095c84d 100644 --- a/libc/manual/examples/dir2.c +++ b/libc/manual/examples/dir2.c @@ -1,3 +1,20 @@ +/* Simple Program to List a Directory, Mark II + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + /*@group*/ #include <stdio.h> #include <dirent.h> diff --git a/libc/manual/examples/execinfo.c b/libc/manual/examples/execinfo.c index 5a0490195..18a3a2973 100644 --- a/libc/manual/examples/execinfo.c +++ b/libc/manual/examples/execinfo.c @@ -1,3 +1,20 @@ +/* Obtain a backtrace and print it. + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <execinfo.h> #include <stdio.h> #include <stdlib.h> diff --git a/libc/manual/examples/filecli.c b/libc/manual/examples/filecli.c index 9f64445fa..71dc46180 100644 --- a/libc/manual/examples/filecli.c +++ b/libc/manual/examples/filecli.c @@ -1,3 +1,20 @@ +/* Example of Reading Datagrams + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <errno.h> #include <unistd.h> diff --git a/libc/manual/examples/filesrv.c b/libc/manual/examples/filesrv.c index 32507c655..e1f80aa7b 100644 --- a/libc/manual/examples/filesrv.c +++ b/libc/manual/examples/filesrv.c @@ -1,3 +1,20 @@ +/* Datagram Socket Example + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <errno.h> #include <stdlib.h> diff --git a/libc/manual/examples/fmtmsgexpl.c b/libc/manual/examples/fmtmsgexpl.c index 42b8bb517..fd7b16bb2 100644 --- a/libc/manual/examples/fmtmsgexpl.c +++ b/libc/manual/examples/fmtmsgexpl.c @@ -1,3 +1,20 @@ +/* How to use fmtmsg and addseverity. + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <fmtmsg.h> int diff --git a/libc/manual/examples/genpass.c b/libc/manual/examples/genpass.c index a7626dbed..cb4d99f06 100644 --- a/libc/manual/examples/genpass.c +++ b/libc/manual/examples/genpass.c @@ -1,31 +1,48 @@ +/* Encrypting Passwords + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <time.h> #include <unistd.h> #include <crypt.h> -int +int main(void) { unsigned long seed[2]; char salt[] = "$1$........"; - const char *const seedchars = + const char *const seedchars = "./0123456789ABCDEFGHIJKLMNOPQRST" "UVWXYZabcdefghijklmnopqrstuvwxyz"; char *password; int i; - - /* Generate a (not very) random seed. + + /* Generate a (not very) random seed. You should do it better than this... */ seed[0] = time(NULL); seed[1] = getpid() ^ (seed[0] >> 14 & 0x30000); - + /* Turn it into printable characters from `seedchars'. */ for (i = 0; i < 8; i++) salt[3+i] = seedchars[(seed[i/5] >> (i%5)*6) & 0x3f]; - + /* Read in the user's password and encrypt it. */ password = crypt(getpass("Password:"), salt); - + /* Print the results. */ puts(password); return 0; diff --git a/libc/manual/examples/inetcli.c b/libc/manual/examples/inetcli.c index 35dfb379e..afd4a91a6 100644 --- a/libc/manual/examples/inetcli.c +++ b/libc/manual/examples/inetcli.c @@ -1,3 +1,20 @@ +/* Byte Stream Socket Example + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <errno.h> #include <stdlib.h> @@ -11,7 +28,7 @@ #define MESSAGE "Yow!!! Are we having fun yet?!?" #define SERVERHOST "mescaline.gnu.org" -void +void write_to_server (int filedes) { int nbytes; diff --git a/libc/manual/examples/inetsrv.c b/libc/manual/examples/inetsrv.c index 3d544c005..d245f0d11 100644 --- a/libc/manual/examples/inetsrv.c +++ b/libc/manual/examples/inetsrv.c @@ -1,3 +1,20 @@ +/* Byte Stream Connection Server Example + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <errno.h> #include <stdlib.h> diff --git a/libc/manual/examples/isockad.c b/libc/manual/examples/isockad.c index 9c21149a8..b7c73a7f4 100644 --- a/libc/manual/examples/isockad.c +++ b/libc/manual/examples/isockad.c @@ -1,10 +1,27 @@ +/* Internet Socket Example using sockaddr_in. + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> -void +void init_sockaddr (struct sockaddr_in *name, const char *hostname, uint16_t port) @@ -14,7 +31,7 @@ init_sockaddr (struct sockaddr_in *name, name->sin_family = AF_INET; name->sin_port = htons (port); hostinfo = gethostbyname (hostname); - if (hostinfo == NULL) + if (hostinfo == NULL) { fprintf (stderr, "Unknown host %s.\n", hostname); exit (EXIT_FAILURE); diff --git a/libc/manual/examples/longopt.c b/libc/manual/examples/longopt.c index 989e88713..6e7d4d939 100644 --- a/libc/manual/examples/longopt.c +++ b/libc/manual/examples/longopt.c @@ -1,3 +1,20 @@ +/* Example of Parsing Long Options with getopt_long. + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <stdlib.h> #include <getopt.h> diff --git a/libc/manual/examples/memopen.c b/libc/manual/examples/memopen.c index 682830fe5..3fa29d521 100644 --- a/libc/manual/examples/memopen.c +++ b/libc/manual/examples/memopen.c @@ -1,3 +1,20 @@ +/* String Streams + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> static char buffer[] = "foobar"; diff --git a/libc/manual/examples/memstrm.c b/libc/manual/examples/memstrm.c index 1674c36e0..be8366064 100644 --- a/libc/manual/examples/memstrm.c +++ b/libc/manual/examples/memstrm.c @@ -1,3 +1,20 @@ +/* open_memstream example. + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> int diff --git a/libc/manual/examples/mkfsock.c b/libc/manual/examples/mkfsock.c index 615ecd868..e5c3b2847 100644 --- a/libc/manual/examples/mkfsock.c +++ b/libc/manual/examples/mkfsock.c @@ -1,3 +1,20 @@ +/* Example of Local-Namespace Sockets + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stddef.h> #include <stdio.h> #include <errno.h> diff --git a/libc/manual/examples/mkisock.c b/libc/manual/examples/mkisock.c index 2fd8b3d2f..68cf348f1 100644 --- a/libc/manual/examples/mkisock.c +++ b/libc/manual/examples/mkisock.c @@ -1,9 +1,26 @@ +/* Internet Socket Example + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> -int +int make_socket (uint16_t port) { int sock; diff --git a/libc/manual/examples/mygetpass.c b/libc/manual/examples/mygetpass.c index 6fe06f463..a927a13ac 100644 --- a/libc/manual/examples/mygetpass.c +++ b/libc/manual/examples/mygetpass.c @@ -1,3 +1,20 @@ +/* Reading Passwords + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <termios.h> #include <stdio.h> @@ -14,12 +31,12 @@ my_getpass (char **lineptr, size_t *n, FILE *stream) new.c_lflag &= ~ECHO; if (tcsetattr (fileno (stream), TCSAFLUSH, &new) != 0) return -1; - + /* Read the password. */ nread = getline (lineptr, n, stream); /* Restore terminal. */ (void) tcsetattr (fileno (stream), TCSAFLUSH, &old); - + return nread; } diff --git a/libc/manual/examples/pipe.c b/libc/manual/examples/pipe.c index 92d339a7b..b03c90f8f 100644 --- a/libc/manual/examples/pipe.c +++ b/libc/manual/examples/pipe.c @@ -1,3 +1,20 @@ +/* Creating a Pipe + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <sys/types.h> #include <unistd.h> #include <stdio.h> diff --git a/libc/manual/examples/popen.c b/libc/manual/examples/popen.c index 1b9ee826b..6716dc246 100644 --- a/libc/manual/examples/popen.c +++ b/libc/manual/examples/popen.c @@ -1,3 +1,20 @@ +/* Pipe to a Subprocess + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <stdlib.h> diff --git a/libc/manual/examples/rprintf.c b/libc/manual/examples/rprintf.c index 2b8f6bfe7..14de9d243 100644 --- a/libc/manual/examples/rprintf.c +++ b/libc/manual/examples/rprintf.c @@ -1,3 +1,20 @@ +/* Printf Extension Example + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <stdlib.h> #include <printf.h> diff --git a/libc/manual/examples/search.c b/libc/manual/examples/search.c index 182e6e4a3..e37656721 100644 --- a/libc/manual/examples/search.c +++ b/libc/manual/examples/search.c @@ -1,3 +1,20 @@ +/* Searching and Sorting Example + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdlib.h> #include <stdio.h> #include <string.h> @@ -35,7 +52,7 @@ int count = sizeof (muppets) / sizeof (struct critter); /* This is the comparison function used for sorting and searching. */ -int +int critter_cmp (const struct critter *c1, const struct critter *c2) { return strcmp (c1->name, c2->name); @@ -44,7 +61,7 @@ critter_cmp (const struct critter *c1, const struct critter *c2) /* Print information about a critter. */ -void +void print_critter (const struct critter *c) { printf ("%s, the %s\n", c->name, c->species); @@ -54,7 +71,7 @@ print_critter (const struct critter *c) /*@group*/ /* Do the lookup into the sorted array. */ -void +void find_critter (const char *name) { struct critter target, *result; diff --git a/libc/manual/examples/select.c b/libc/manual/examples/select.c index a65ed7750..635163026 100644 --- a/libc/manual/examples/select.c +++ b/libc/manual/examples/select.c @@ -1,3 +1,20 @@ +/* Waiting for Input or Output + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + /*@group*/ #include <errno.h> #include <stdio.h> diff --git a/libc/manual/examples/setjmp.c b/libc/manual/examples/setjmp.c index 023339c60..ffd7744c1 100644 --- a/libc/manual/examples/setjmp.c +++ b/libc/manual/examples/setjmp.c @@ -1,10 +1,27 @@ +/* Introduction to Non-Local Exits + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <setjmp.h> #include <stdlib.h> #include <stdio.h> jmp_buf main_loop; -void +void abort_to_main_loop (int status) { longjmp (main_loop, status); @@ -21,7 +38,7 @@ main (void) } -void +void do_command (void) { char buffer[128]; diff --git a/libc/manual/examples/sigh1.c b/libc/manual/examples/sigh1.c index 2c6e95b9c..d05afd9af 100644 --- a/libc/manual/examples/sigh1.c +++ b/libc/manual/examples/sigh1.c @@ -1,3 +1,20 @@ +/* Signal Handlers that Return + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <signal.h> #include <stdio.h> #include <stdlib.h> @@ -6,14 +23,14 @@ volatile sig_atomic_t keep_going = 1; /* The signal handler just clears the flag and re-enables itself. */ -void +void catch_alarm (int sig) { keep_going = 0; signal (sig, catch_alarm); } -void +void do_stuff (void) { puts ("Doing stuff while waiting for alarm...."); diff --git a/libc/manual/examples/sigusr.c b/libc/manual/examples/sigusr.c index 11e3ceee8..5bfbc8071 100644 --- a/libc/manual/examples/sigusr.c +++ b/libc/manual/examples/sigusr.c @@ -1,3 +1,20 @@ +/* Using kill for Communication + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + /*@group*/ #include <signal.h> #include <stdio.h> @@ -8,14 +25,14 @@ /* When a @code{SIGUSR1} signal arrives, set this variable. */ volatile sig_atomic_t usr_interrupt = 0; -void +void synch_signal (int sig) { usr_interrupt = 1; } /* The child process executes this function. */ -void +void child_function (void) { /* Perform initialization. */ diff --git a/libc/manual/examples/stpcpy.c b/libc/manual/examples/stpcpy.c index b83226354..f94cb636b 100644 --- a/libc/manual/examples/stpcpy.c +++ b/libc/manual/examples/stpcpy.c @@ -1,3 +1,20 @@ +/* stpcpy example. + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <string.h> #include <stdio.h> diff --git a/libc/manual/examples/strdupa.c b/libc/manual/examples/strdupa.c index 7d6ef3994..f01e11524 100644 --- a/libc/manual/examples/strdupa.c +++ b/libc/manual/examples/strdupa.c @@ -1,3 +1,20 @@ +/* strdupa example. + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <paths.h> #include <string.h> #include <stdio.h> diff --git a/libc/manual/examples/strftim.c b/libc/manual/examples/strftim.c index 7f95ef02a..93428177e 100644 --- a/libc/manual/examples/strftim.c +++ b/libc/manual/examples/strftim.c @@ -1,3 +1,20 @@ +/* Time Functions Example + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <time.h> #include <stdio.h> diff --git a/libc/manual/examples/strncat.c b/libc/manual/examples/strncat.c index 948d662a4..fb7b7078a 100644 --- a/libc/manual/examples/strncat.c +++ b/libc/manual/examples/strncat.c @@ -1,3 +1,20 @@ +/* strncat example. + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <string.h> #include <stdio.h> diff --git a/libc/manual/examples/subopt.c b/libc/manual/examples/subopt.c index a87bee166..ecf75f9a9 100644 --- a/libc/manual/examples/subopt.c +++ b/libc/manual/examples/subopt.c @@ -1,3 +1,20 @@ +/* Parsing of Suboptions Example + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <stdlib.h> #include <unistd.h> diff --git a/libc/manual/examples/swapcontext.c b/libc/manual/examples/swapcontext.c index f733510f8..c993d1450 100644 --- a/libc/manual/examples/swapcontext.c +++ b/libc/manual/examples/swapcontext.c @@ -1,3 +1,20 @@ +/* Complete Context Control + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <signal.h> #include <stdio.h> #include <stdlib.h> diff --git a/libc/manual/examples/termios.c b/libc/manual/examples/termios.c index 6db5990a0..40d4325b5 100644 --- a/libc/manual/examples/termios.c +++ b/libc/manual/examples/termios.c @@ -1,3 +1,20 @@ +/* Noncanonical Mode Example + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <unistd.h> #include <stdio.h> #include <stdlib.h> @@ -7,13 +24,13 @@ struct termios saved_attributes; -void +void reset_input_mode (void) { tcsetattr (STDIN_FILENO, TCSANOW, &saved_attributes); } -void +void set_input_mode (void) { struct termios tattr; diff --git a/libc/manual/examples/testopt.c b/libc/manual/examples/testopt.c index 44ca8e4ad..081742d85 100644 --- a/libc/manual/examples/testopt.c +++ b/libc/manual/examples/testopt.c @@ -1,3 +1,20 @@ +/* Example of Parsing Arguments with getopt. + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + /*@group*/ #include <ctype.h> #include <stdio.h> diff --git a/libc/manual/examples/testpass.c b/libc/manual/examples/testpass.c index 5bd616d2a..4e05a9059 100644 --- a/libc/manual/examples/testpass.c +++ b/libc/manual/examples/testpass.c @@ -1,9 +1,26 @@ +/* Verify a password. + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <string.h> #include <unistd.h> #include <crypt.h> -int +int main(void) { /* Hashed form of "GNU libc manual". */ @@ -11,7 +28,7 @@ main(void) char *result; int ok; - + /*@group*/ /* Read in the user's password and encrypt it, passing the expected password in as the salt. */ diff --git a/libc/manual/examples/timeval_subtract.c b/libc/manual/examples/timeval_subtract.c index 683322ffe..f0f237568 100644 --- a/libc/manual/examples/timeval_subtract.c +++ b/libc/manual/examples/timeval_subtract.c @@ -1,3 +1,20 @@ +/* struct timeval subtraction. + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + /* Subtract the `struct timeval' values X and Y, storing the result in RESULT. Return 1 if the difference is negative, otherwise 0. */ diff --git a/libc/manual/lang.texi b/libc/manual/lang.texi index 2a73c723b..6cb7371aa 100644 --- a/libc/manual/lang.texi +++ b/libc/manual/lang.texi @@ -629,27 +629,13 @@ This is an unsigned integer type used to represent the sizes of objects. The result of the @code{sizeof} operator is of this type, and functions such as @code{malloc} (@pxref{Unconstrained Allocation}) and @code{memcpy} (@pxref{Copying and Concatenation}) accept arguments of -this type to specify object sizes. +this type to specify object sizes. On systems using @theglibc{}, this +will be @w{@code{unsigned int}} or @w{@code{unsigned long int}}. @strong{Usage Note:} @code{size_t} is the preferred way to declare any arguments or variables that hold the size of an object. @end deftp -In the GNU system @code{size_t} is equivalent to either -@w{@code{unsigned int}} or @w{@code{unsigned long int}}. These types -have identical properties on the GNU system and, for most purposes, you -can use them interchangeably. However, they are distinct as data types, -which makes a difference in certain contexts. - -For example, when you specify the type of a function argument in a -function prototype, it makes a difference which one you use. If the -system header files declare @code{malloc} with an argument of type -@code{size_t} and you declare @code{malloc} with an argument of type -@code{unsigned int}, you will get a compilation error if @code{size_t} -happens to be @code{unsigned long int} on your system. To avoid any -possibility of error, when a function argument or value is supposed to -have type @code{size_t}, never declare its type in any other way. - @strong{Compatibility Note:} Implementations of C before the advent of @w{ISO C} generally used @code{unsigned int} for representing object sizes and @code{int} for pointer subtraction results. They did not diff --git a/libc/math/Makefile b/libc/math/Makefile index 2c3263756..826acb7a3 100644 --- a/libc/math/Makefile +++ b/libc/math/Makefile @@ -28,9 +28,6 @@ headers := math.h bits/mathcalls.h bits/mathinline.h bits/huge_val.h \ bits/fenv.h bits/fenvinline.h bits/mathdef.h tgmath.h \ bits/math-finite.h -# Internal header files. -distribute := math_ldbl.h math_private.h machine/asm.h - # FPU support code. aux := setfpucw fpu_control @@ -86,7 +83,6 @@ calls = s_isinf s_isnan s_finite s_copysign s_modf s_scalbn s_frexp s_ldexp \ generated += $(foreach s,.c .S l.c l.S f.c f.S,$(calls:s_%=m_%$s)) routines = $(calls) $(calls:=f) $(long-c-$(long-double-fcts)) long-c-yes = $(calls:=l) -distribute += $(filter-out $(generated),$(long-m-yes:=.c) $(long-c-yes:=.c)) # Rules for the test suite. tests = test-matherr test-fenv basic-test \ @@ -97,7 +93,6 @@ tests-$(OPTION_EGLIBC_LIBM_BIG) += atest-exp atest-sincos atest-exp2 # We do the `long double' tests only if this data type is available and # distinct from `double'. test-longdouble-yes = test-ldouble test-ildoubl -distribute += $(test-longdouble-yes:=.c) ifneq (no,$(PERL)) libm-tests = test-float test-double $(test-longdouble-$(long-double-fcts)) \ @@ -145,15 +140,12 @@ CPPFLAGS-test-idouble.c = -U__LIBC_INTERNAL_MATH_INLINES -D__FAST_MATH__ \ CPPFLAGS-test-ildoubl.c = -U__LIBC_INTERNAL_MATH_INLINES -D__FAST_MATH__ \ -DTEST_FAST_MATH -fno-builtin -distribute += libm-test.inc gen-libm-test.pl README.libm-test - # The -lieee module sets the _LIB_VERSION_ switch to IEEE mode # for error handling in the -lm functions. install-lib += libieee.a non-lib.a += libieee.a extra-objs += libieee.a ieee-math.o -distribute += ieee-math.c include ../Rules diff --git a/libc/math/libm-test.inc b/libc/math/libm-test.inc index 5309a24a9..56928978e 100644 --- a/libc/math/libm-test.inc +++ b/libc/math/libm-test.inc @@ -1073,6 +1073,32 @@ cacos_test (void) TEST_c_c (cacos, nan_value, nan_value, nan_value, nan_value); + TEST_c_c (cacos, plus_zero, -1.5L, M_PI_2l, 1.194763217287109304111930828519090523536L); + TEST_c_c (cacos, minus_zero, -1.5L, M_PI_2l, 1.194763217287109304111930828519090523536L); + TEST_c_c (cacos, plus_zero, -1.0L, M_PI_2l, 0.8813735870195430252326093249797923090282L); + TEST_c_c (cacos, minus_zero, -1.0L, M_PI_2l, 0.8813735870195430252326093249797923090282L); + TEST_c_c (cacos, plus_zero, -0.5L, M_PI_2l, 0.4812118250596034474977589134243684231352L); + TEST_c_c (cacos, minus_zero, -0.5L, M_PI_2l, 0.4812118250596034474977589134243684231352L); + TEST_c_c (cacos, plus_zero, 0.5L, M_PI_2l, -0.4812118250596034474977589134243684231352L); + TEST_c_c (cacos, minus_zero, 0.5L, M_PI_2l, -0.4812118250596034474977589134243684231352L); + TEST_c_c (cacos, plus_zero, 1.0L, M_PI_2l, -0.8813735870195430252326093249797923090282L); + TEST_c_c (cacos, minus_zero, 1.0L, M_PI_2l, -0.8813735870195430252326093249797923090282L); + TEST_c_c (cacos, plus_zero, 1.5L, M_PI_2l, -1.194763217287109304111930828519090523536L); + TEST_c_c (cacos, minus_zero, 1.5L, M_PI_2l, -1.194763217287109304111930828519090523536L); + + TEST_c_c (cacos, -1.5L, plus_zero, M_PIl, -0.9624236501192068949955178268487368462704L); + TEST_c_c (cacos, -1.5L, minus_zero, M_PIl, 0.9624236501192068949955178268487368462704L); + TEST_c_c (cacos, -1.0L, plus_zero, M_PIl, minus_zero); + TEST_c_c (cacos, -1.0L, minus_zero, M_PIl, plus_zero); + TEST_c_c (cacos, -0.5L, plus_zero, 2.094395102393195492308428922186335256131L, minus_zero); + TEST_c_c (cacos, -0.5L, minus_zero, 2.094395102393195492308428922186335256131L, plus_zero); + TEST_c_c (cacos, 0.5L, plus_zero, 1.047197551196597746154214461093167628066L, minus_zero); + TEST_c_c (cacos, 0.5L, minus_zero, 1.047197551196597746154214461093167628066L, plus_zero); + TEST_c_c (cacos, 1.0L, plus_zero, plus_zero, minus_zero); + TEST_c_c (cacos, 1.0L, minus_zero, plus_zero, plus_zero); + TEST_c_c (cacos, 1.5L, plus_zero, plus_zero, -0.9624236501192068949955178268487368462704L); + TEST_c_c (cacos, 1.5L, minus_zero, plus_zero, 0.9624236501192068949955178268487368462704L); + TEST_c_c (cacos, 0.75L, 1.25L, 1.11752014915610270578240049553777969L, -1.13239363160530819522266333696834467L); TEST_c_c (cacos, -2, -3, 2.1414491111159960199416055713254211L, 1.9833870299165354323470769028940395L); @@ -1135,6 +1161,32 @@ cacosh_test (void) TEST_c_c (cacosh, nan_value, nan_value, nan_value, nan_value); + TEST_c_c (cacosh, plus_zero, -1.5L, 1.194763217287109304111930828519090523536L, -M_PI_2l); + TEST_c_c (cacosh, minus_zero, -1.5L, 1.194763217287109304111930828519090523536L, -M_PI_2l); + TEST_c_c (cacosh, plus_zero, -1.0L, 0.8813735870195430252326093249797923090282L, -M_PI_2l); + TEST_c_c (cacosh, minus_zero, -1.0L, 0.8813735870195430252326093249797923090282L, -M_PI_2l); + TEST_c_c (cacosh, plus_zero, -0.5L, 0.4812118250596034474977589134243684231352L, -M_PI_2l); + TEST_c_c (cacosh, minus_zero, -0.5L, 0.4812118250596034474977589134243684231352L, -M_PI_2l); + TEST_c_c (cacosh, plus_zero, 0.5L, 0.4812118250596034474977589134243684231352L, M_PI_2l); + TEST_c_c (cacosh, minus_zero, 0.5L, 0.4812118250596034474977589134243684231352L, M_PI_2l); + TEST_c_c (cacosh, plus_zero, 1.0L, 0.8813735870195430252326093249797923090282L, M_PI_2l); + TEST_c_c (cacosh, minus_zero, 1.0L, 0.8813735870195430252326093249797923090282L, M_PI_2l); + TEST_c_c (cacosh, plus_zero, 1.5L, 1.194763217287109304111930828519090523536L, M_PI_2l); + TEST_c_c (cacosh, minus_zero, 1.5L, 1.194763217287109304111930828519090523536L, M_PI_2l); + + TEST_c_c (cacosh, -1.5L, plus_zero, 0.9624236501192068949955178268487368462704L, M_PIl); + TEST_c_c (cacosh, -1.5L, minus_zero, 0.9624236501192068949955178268487368462704L, -M_PIl); + TEST_c_c (cacosh, -1.0L, plus_zero, plus_zero, M_PIl); + TEST_c_c (cacosh, -1.0L, minus_zero, plus_zero, -M_PIl); + TEST_c_c (cacosh, -0.5L, plus_zero, plus_zero, 2.094395102393195492308428922186335256131L); + TEST_c_c (cacosh, -0.5L, minus_zero, plus_zero, -2.094395102393195492308428922186335256131L); + TEST_c_c (cacosh, 0.5L, plus_zero, plus_zero, 1.047197551196597746154214461093167628066L); + TEST_c_c (cacosh, 0.5L, minus_zero, plus_zero, -1.047197551196597746154214461093167628066L); + TEST_c_c (cacosh, 1.0L, plus_zero, plus_zero, plus_zero); + TEST_c_c (cacosh, 1.0L, minus_zero, plus_zero, minus_zero); + TEST_c_c (cacosh, 1.5L, plus_zero, 0.9624236501192068949955178268487368462704L, plus_zero); + TEST_c_c (cacosh, 1.5L, minus_zero, 0.9624236501192068949955178268487368462704L, minus_zero); + TEST_c_c (cacosh, 0.75L, 1.25L, 1.13239363160530819522266333696834467L, 1.11752014915610270578240049553777969L); TEST_c_c (cacosh, -2, -3, 1.9833870299165354323470769028940395L, -2.1414491111159960199416055713254211L); @@ -1266,6 +1318,32 @@ casin_test (void) TEST_c_c (casin, nan_value, nan_value, nan_value, nan_value); + TEST_c_c (casin, plus_zero, -1.5L, plus_zero, -1.194763217287109304111930828519090523536L); + TEST_c_c (casin, minus_zero, -1.5L, minus_zero, -1.194763217287109304111930828519090523536L); + TEST_c_c (casin, plus_zero, -1.0L, plus_zero, -0.8813735870195430252326093249797923090282L); + TEST_c_c (casin, minus_zero, -1.0L, minus_zero, -0.8813735870195430252326093249797923090282L); + TEST_c_c (casin, plus_zero, -0.5L, plus_zero, -0.4812118250596034474977589134243684231352L); + TEST_c_c (casin, minus_zero, -0.5L, minus_zero, -0.4812118250596034474977589134243684231352L); + TEST_c_c (casin, plus_zero, 0.5L, plus_zero, 0.4812118250596034474977589134243684231352L); + TEST_c_c (casin, minus_zero, 0.5L, minus_zero, 0.4812118250596034474977589134243684231352L); + TEST_c_c (casin, plus_zero, 1.0L, plus_zero, 0.8813735870195430252326093249797923090282L); + TEST_c_c (casin, minus_zero, 1.0L, minus_zero, 0.8813735870195430252326093249797923090282L); + TEST_c_c (casin, plus_zero, 1.5L, plus_zero, 1.194763217287109304111930828519090523536L); + TEST_c_c (casin, minus_zero, 1.5L, minus_zero, 1.194763217287109304111930828519090523536L); + + TEST_c_c (casin, -1.5L, plus_zero, -M_PI_2l, 0.9624236501192068949955178268487368462704L); + TEST_c_c (casin, -1.5L, minus_zero, -M_PI_2l, -0.9624236501192068949955178268487368462704L); + TEST_c_c (casin, -1.0L, plus_zero, -M_PI_2l, plus_zero); + TEST_c_c (casin, -1.0L, minus_zero, -M_PI_2l, minus_zero); + TEST_c_c (casin, -0.5L, plus_zero, -0.5235987755982988730771072305465838140329L, plus_zero); + TEST_c_c (casin, -0.5L, minus_zero, -0.5235987755982988730771072305465838140329L, minus_zero); + TEST_c_c (casin, 0.5L, plus_zero, 0.5235987755982988730771072305465838140329L, plus_zero); + TEST_c_c (casin, 0.5L, minus_zero, 0.5235987755982988730771072305465838140329L, minus_zero); + TEST_c_c (casin, 1.0L, plus_zero, M_PI_2l, plus_zero); + TEST_c_c (casin, 1.0L, minus_zero, M_PI_2l, minus_zero); + TEST_c_c (casin, 1.5L, plus_zero, M_PI_2l, 0.9624236501192068949955178268487368462704L); + TEST_c_c (casin, 1.5L, minus_zero, M_PI_2l, -0.9624236501192068949955178268487368462704L); + TEST_c_c (casin, 0.75L, 1.25L, 0.453276177638793913448921196101971749L, 1.13239363160530819522266333696834467L); TEST_c_c (casin, -2, -3, -0.57065278432109940071028387968566963L, -1.9833870299165354323470769028940395L); @@ -1330,6 +1408,32 @@ casinh_test (void) TEST_c_c (casinh, nan_value, nan_value, nan_value, nan_value); + TEST_c_c (casinh, plus_zero, -1.5L, 0.9624236501192068949955178268487368462704L, -M_PI_2l); + TEST_c_c (casinh, minus_zero, -1.5L, -0.9624236501192068949955178268487368462704L, -M_PI_2l); + TEST_c_c (casinh, plus_zero, -1.0L, plus_zero, -M_PI_2l); + TEST_c_c (casinh, minus_zero, -1.0L, minus_zero, -M_PI_2l); + TEST_c_c (casinh, plus_zero, -0.5L, plus_zero, -0.5235987755982988730771072305465838140329L); + TEST_c_c (casinh, minus_zero, -0.5L, minus_zero, -0.5235987755982988730771072305465838140329L); + TEST_c_c (casinh, plus_zero, 0.5L, plus_zero, 0.5235987755982988730771072305465838140329L); + TEST_c_c (casinh, minus_zero, 0.5L, minus_zero, 0.5235987755982988730771072305465838140329L); + TEST_c_c (casinh, plus_zero, 1.0L, plus_zero, M_PI_2l); + TEST_c_c (casinh, minus_zero, 1.0L, minus_zero, M_PI_2l); + TEST_c_c (casinh, plus_zero, 1.5L, 0.9624236501192068949955178268487368462704L, M_PI_2l); + TEST_c_c (casinh, minus_zero, 1.5L, -0.9624236501192068949955178268487368462704L, M_PI_2l); + + TEST_c_c (casinh, -1.5L, plus_zero, -1.194763217287109304111930828519090523536L, plus_zero); + TEST_c_c (casinh, -1.5L, minus_zero, -1.194763217287109304111930828519090523536L, minus_zero); + TEST_c_c (casinh, -1.0L, plus_zero, -0.8813735870195430252326093249797923090282L, plus_zero); + TEST_c_c (casinh, -1.0L, minus_zero, -0.8813735870195430252326093249797923090282L, minus_zero); + TEST_c_c (casinh, -0.5L, plus_zero, -0.4812118250596034474977589134243684231352L, plus_zero); + TEST_c_c (casinh, -0.5L, minus_zero, -0.4812118250596034474977589134243684231352L, minus_zero); + TEST_c_c (casinh, 0.5L, plus_zero, 0.4812118250596034474977589134243684231352L, plus_zero); + TEST_c_c (casinh, 0.5L, minus_zero, 0.4812118250596034474977589134243684231352L, minus_zero); + TEST_c_c (casinh, 1.0L, plus_zero, 0.8813735870195430252326093249797923090282L, plus_zero); + TEST_c_c (casinh, 1.0L, minus_zero, 0.8813735870195430252326093249797923090282L, minus_zero); + TEST_c_c (casinh, 1.5L, plus_zero, 1.194763217287109304111930828519090523536L, plus_zero); + TEST_c_c (casinh, 1.5L, minus_zero, 1.194763217287109304111930828519090523536L, minus_zero); + TEST_c_c (casinh, 0.75L, 1.25L, 1.03171853444778027336364058631006594L, 0.911738290968487636358489564316731207L); TEST_c_c (casinh, -2, -3, -1.9686379257930962917886650952454982L, -0.96465850440760279204541105949953237L); @@ -2186,6 +2290,114 @@ cosh_test (void) static void +cosh_test_tonearest (void) +{ + int save_round_mode; + errno = 0; + FUNC(cosh) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (cosh_tonearest); + + save_round_mode = fegetround (); + + if (!fesetround (FE_TONEAREST)) + { + TEST_f_f (cosh, 22, 1792456423.065795780980053377632656584997L); + TEST_f_f (cosh, 23, 4872401723.124451300068625740569997090344L); + TEST_f_f (cosh, 24, 13244561064.92173614708845674912733665919L); + } + + fesetround (save_round_mode); + + END (cosh_tonearest); +} + + +static void +cosh_test_towardzero (void) +{ + int save_round_mode; + errno = 0; + FUNC(cosh) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (cosh_towardzero); + + save_round_mode = fegetround (); + + if (!fesetround (FE_TOWARDZERO)) + { + TEST_f_f (cosh, 22, 1792456423.065795780980053377632656584997L); + TEST_f_f (cosh, 23, 4872401723.124451300068625740569997090344L); + TEST_f_f (cosh, 24, 13244561064.92173614708845674912733665919L); + } + + fesetround (save_round_mode); + + END (cosh_towardzero); +} + + +static void +cosh_test_downward (void) +{ + int save_round_mode; + errno = 0; + FUNC(cosh) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (cosh_downward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_DOWNWARD)) + { + TEST_f_f (cosh, 22, 1792456423.065795780980053377632656584997L); + TEST_f_f (cosh, 23, 4872401723.124451300068625740569997090344L); + TEST_f_f (cosh, 24, 13244561064.92173614708845674912733665919L); + } + + fesetround (save_round_mode); + + END (cosh_downward); +} + + +static void +cosh_test_upward (void) +{ + int save_round_mode; + errno = 0; + FUNC(cosh) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (cosh_upward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_UPWARD)) + { + TEST_f_f (cosh, 22, 1792456423.065795780980053377632656584997L); + TEST_f_f (cosh, 23, 4872401723.124451300068625740569997090344L); + TEST_f_f (cosh, 24, 13244561064.92173614708845674912733665919L); + } + + fesetround (save_round_mode); + + END (cosh_upward); +} + + +static void cpow_test (void) { errno = 0; @@ -5223,6 +5435,111 @@ pow_test (void) END (pow); } + +static void +pow_test_tonearest (void) +{ + int save_round_mode; + errno = 0; + FUNC(pow) (0, 0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (pow_tonearest); + + save_round_mode = fegetround (); + + if (!fesetround (FE_TONEAREST)) + { + TEST_ff_f (pow, 1.0625L, 1.125L, 1.070582293028761362162622578677070098674L); + TEST_ff_f (pow, 1.5L, 1.03125L, 1.519127098714743184071644334163037684948L); + } + + fesetround (save_round_mode); + + END (pow_tonearest); +} + + +static void +pow_test_towardzero (void) +{ + int save_round_mode; + errno = 0; + FUNC(pow) (0, 0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (pow_towardzero); + + save_round_mode = fegetround (); + + if (!fesetround (FE_TOWARDZERO)) + { + TEST_ff_f (pow, 1.0625L, 1.125L, 1.070582293028761362162622578677070098674L); + TEST_ff_f (pow, 1.5L, 1.03125L, 1.519127098714743184071644334163037684948L); + } + + fesetround (save_round_mode); + + END (pow_towardzero); +} + + +static void +pow_test_downward (void) +{ + int save_round_mode; + errno = 0; + FUNC(pow) (0, 0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (pow_downward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_DOWNWARD)) + { + TEST_ff_f (pow, 1.0625L, 1.125L, 1.070582293028761362162622578677070098674L); + TEST_ff_f (pow, 1.5L, 1.03125L, 1.519127098714743184071644334163037684948L); + } + + fesetround (save_round_mode); + + END (pow_downward); +} + + +static void +pow_test_upward (void) +{ + int save_round_mode; + errno = 0; + FUNC(pow) (0, 0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (pow_upward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_UPWARD)) + { + TEST_ff_f (pow, 1.0625L, 1.125L, 1.070582293028761362162622578677070098674L); + TEST_ff_f (pow, 1.5L, 1.03125L, 1.519127098714743184071644334163037684948L); + } + + fesetround (save_round_mode); + + END (pow_upward); +} + + static void remainder_test (void) { @@ -6256,6 +6573,115 @@ sinh_test (void) END (sinh); } + +static void +sinh_test_tonearest (void) +{ + int save_round_mode; + errno = 0; + FUNC(sinh) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (sinh_tonearest); + + save_round_mode = fegetround (); + + if (!fesetround (FE_TONEAREST)) + { + TEST_f_f (sinh, 22, 1792456423.065795780701106568345764104225L); + TEST_f_f (sinh, 23, 4872401723.124451299966006944252978187305L); + TEST_f_f (sinh, 24, 13244561064.92173614705070540368454568168L); + } + + fesetround (save_round_mode); + + END (sinh_tonearest); +} + + +static void +sinh_test_towardzero (void) +{ + int save_round_mode; + errno = 0; + FUNC(sinh) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (sinh_towardzero); + + save_round_mode = fegetround (); + + if (!fesetround (FE_TOWARDZERO)) + { + TEST_f_f (sinh, 22, 1792456423.065795780701106568345764104225L); + TEST_f_f (sinh, 23, 4872401723.124451299966006944252978187305L); + TEST_f_f (sinh, 24, 13244561064.92173614705070540368454568168L); + } + + fesetround (save_round_mode); + + END (sinh_towardzero); +} + + +static void +sinh_test_downward (void) +{ + int save_round_mode; + errno = 0; + FUNC(sinh) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (sinh_downward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_DOWNWARD)) + { + TEST_f_f (sinh, 22, 1792456423.065795780701106568345764104225L); + TEST_f_f (sinh, 23, 4872401723.124451299966006944252978187305L); + TEST_f_f (sinh, 24, 13244561064.92173614705070540368454568168L); + } + + fesetround (save_round_mode); + + END (sinh_downward); +} + + +static void +sinh_test_upward (void) +{ + int save_round_mode; + errno = 0; + FUNC(sinh) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (sinh_upward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_UPWARD)) + { + TEST_f_f (sinh, 22, 1792456423.065795780701106568345764104225L); + TEST_f_f (sinh, 23, 4872401723.124451299966006944252978187305L); + TEST_f_f (sinh, 24, 13244561064.92173614705070540368454568168L); + } + + fesetround (save_round_mode); + + END (sinh_upward); +} + + static void sqrt_test (void) { @@ -6975,7 +7401,15 @@ main (int argc, char **argv) asinh_test (); atanh_test (); cosh_test (); + cosh_test_tonearest (); + cosh_test_towardzero (); + cosh_test_downward (); + cosh_test_upward (); sinh_test (); + sinh_test_tonearest (); + sinh_test_towardzero (); + sinh_test_downward (); + sinh_test_upward (); tanh_test (); /* Exponential and logarithmic functions: */ @@ -7006,6 +7440,10 @@ main (int argc, char **argv) fabs_test (); hypot_test (); pow_test (); + pow_test_tonearest (); + pow_test_towardzero (); + pow_test_downward (); + pow_test_upward (); sqrt_test (); /* Error and gamma functions: */ diff --git a/libc/math/math_private.h b/libc/math/math_private.h index e4108d8f2..777762dd3 100644 --- a/libc/math/math_private.h +++ b/libc/math/math_private.h @@ -211,10 +211,8 @@ extern int __kernel_rem_pio2 (double*,double*,int,int,int, const int32_t*); /* internal functions. */ extern double __copysign (double x, double __y); -#if __GNUC_PREREQ (4, 0) extern inline double __copysign (double x, double y) { return __builtin_copysign (x, y); } -#endif /* ieee style elementary float functions */ extern float __ieee754_sqrtf (float); @@ -258,10 +256,8 @@ extern int __kernel_rem_pio2f (float*,float*,int,int,int, const int32_t*); /* internal functions. */ extern float __copysignf (float x, float __y); -#if __GNUC_PREREQ (4, 0) extern inline float __copysignf (float x, float y) { return __builtin_copysignf (x, y); } -#endif /* ieee style elementary long double functions */ extern long double __ieee754_sqrtl (long double); @@ -326,10 +322,8 @@ extern void __sincosl (long double, long double *, long double *); extern long double __logbl (long double x); extern long double __significandl (long double x); -#if __GNUC_PREREQ (4, 0) extern inline long double __copysignl (long double x, long double y) { return __builtin_copysignl (x, y); } -#endif #endif diff --git a/libc/math/s_cacosh.c b/libc/math/s_cacosh.c index 95bf005cd..ef49088c3 100644 --- a/libc/math/s_cacosh.c +++ b/libc/math/s_cacosh.c @@ -1,5 +1,5 @@ /* Return arc hyperbole cosine for double value. - Copyright (C) 1997, 2006, 2011 Free Software Foundation, Inc. + Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -66,9 +66,13 @@ __cacosh (__complex__ double x) } /* The factor 16 is just a guess. */ else if (16.0 * fabs (__imag__ x) < fabs (__real__ x)) - /* Kahan's formula which avoid cancellation through subtraction in - some cases. */ - res = 2.0 * __clog (__csqrt ((x + 1.0) / 2.0) + __csqrt ((x - 1.0) / 2.0)); + { + /* Kahan's formula which avoid cancellation through subtraction in + some cases. */ + res = 2.0 * __clog (__csqrt ((x + 1.0) / 2.0) + __csqrt ((x - 1.0) / 2.0)); + if (signbit (__real__ res)) + __real__ res = 0.0; + } else { __complex__ double y; diff --git a/libc/math/s_cacoshf.c b/libc/math/s_cacoshf.c index d634a1b75..fc716ac51 100644 --- a/libc/math/s_cacoshf.c +++ b/libc/math/s_cacoshf.c @@ -1,5 +1,5 @@ /* Return arc hyperbole cosine for float value. - Copyright (C) 1997, 2006, 2011 Free Software Foundation, Inc. + Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -66,10 +66,14 @@ __cacoshf (__complex__ float x) } /* The factor 16 is just a guess. */ else if (16.0 * fabsf (__imag__ x) < fabsf (__real__ x)) - /* Kahan's formula which avoid cancellation through subtraction in - some cases. */ - res = 2.0 * __clogf (__csqrtf ((x + 1.0) / 2.0) - + __csqrtf ((x - 1.0) / 2.0)); + { + /* Kahan's formula which avoid cancellation through subtraction in + some cases. */ + res = 2.0 * __clogf (__csqrtf ((x + 1.0) / 2.0) + + __csqrtf ((x - 1.0) / 2.0)); + if (signbit (__real__ res)) + __real__ res = 0.0f; + } else { __complex__ float y; diff --git a/libc/math/s_cacoshl.c b/libc/math/s_cacoshl.c index dcdb1d5a6..3bcab1d27 100644 --- a/libc/math/s_cacoshl.c +++ b/libc/math/s_cacoshl.c @@ -1,5 +1,5 @@ /* Return arc hyperbole cosine for long double value. - Copyright (C) 1997, 1998, 2006, 2011 Free Software Foundation, Inc. + Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -66,10 +66,14 @@ __cacoshl (__complex__ long double x) } /* The factor 16 is just a guess. */ else if (16.0L * fabsl (__imag__ x) < fabsl (__real__ x)) - /* Kahan's formula which avoid cancellation through subtraction in - some cases. */ - res = 2.0L * __clogl (__csqrtl ((x + 1.0L) / 2.0L) - + __csqrtl ((x - 1.0L) / 2.0L)); + { + /* Kahan's formula which avoid cancellation through subtraction in + some cases. */ + res = 2.0L * __clogl (__csqrtl ((x + 1.0L) / 2.0L) + + __csqrtl ((x - 1.0L) / 2.0L)); + if (signbit (__real__ res)) + __real__ res = 0.0L; + } else { __complex__ long double y; diff --git a/libc/math/s_casinh.c b/libc/math/s_casinh.c index e06be1cdc..24ae676a8 100644 --- a/libc/math/s_casinh.c +++ b/libc/math/s_casinh.c @@ -1,5 +1,5 @@ /* Return arc hyperbole sine for double value. - Copyright (C) 1997, 2011 Free Software Foundation, Inc. + Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -73,6 +73,11 @@ __casinh (__complex__ double x) __imag__ y += __imag__ x; res = __clog (y); + + /* Ensure zeros have correct sign and results are correct if + very close to branch cuts. */ + __real__ res = __copysign (__real__ res, __real__ x); + __imag__ res = __copysign (__imag__ res, __imag__ x); } return res; diff --git a/libc/math/s_casinhf.c b/libc/math/s_casinhf.c index 37c67401a..c7098ef30 100644 --- a/libc/math/s_casinhf.c +++ b/libc/math/s_casinhf.c @@ -1,5 +1,5 @@ /* Return arc hyperbole sine for float value. - Copyright (C) 1997, 2011 Free Software Foundation, Inc. + Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -73,6 +73,11 @@ __casinhf (__complex__ float x) __imag__ y += __imag__ x; res = __clogf (y); + + /* Ensure zeros have correct sign and results are correct if + very close to branch cuts. */ + __real__ res = __copysignf (__real__ res, __real__ x); + __imag__ res = __copysignf (__imag__ res, __imag__ x); } return res; diff --git a/libc/math/s_casinhl.c b/libc/math/s_casinhl.c index de41cb899..80d7bf500 100644 --- a/libc/math/s_casinhl.c +++ b/libc/math/s_casinhl.c @@ -1,5 +1,5 @@ /* Return arc hyperbole sine for long double value. - Copyright (C) 1997, 1998, 2011 Free Software Foundation, Inc. + Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -73,6 +73,11 @@ __casinhl (__complex__ long double x) __imag__ y += __imag__ x; res = __clogl (y); + + /* Ensure zeros have correct sign and results are correct if + very close to branch cuts. */ + __real__ res = __copysignl (__real__ res, __real__ x); + __imag__ res = __copysignl (__imag__ res, __imag__ x); } return res; diff --git a/libc/misc/Makefile b/libc/misc/Makefile index 9536f02f2..67247bfca 100644 --- a/libc/misc/Makefile +++ b/libc/misc/Makefile @@ -73,8 +73,6 @@ routines-$(OPTION_EGLIBC_FSTAB) += fstab routines-$(OPTION_EGLIBC_BSD) += chflags fchflags revoke routines-$(OPTION_EGLIBC_FCVT) += efgcvt efgcvt_r qefgcvt qefgcvt_r -distribute := device-nrs.h - generated := tst-error1.mtrace tst-error1-mem include ../Makeconfig diff --git a/libc/nis/Makefile b/libc/nis/Makefile index 97376d042..a9ab55014 100644 --- a/libc/nis/Makefile +++ b/libc/nis/Makefile @@ -1,4 +1,5 @@ -# Copyright (C) 1996-1998,2001,2004,2006,2011 Free Software Foundation, Inc. +# Copyright (C) 1996-1998,2001,2004,2006,2011,2012 +# Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -24,10 +25,6 @@ subdir := nis aux := nis_hash -distribute := nss-nis.h nss-nisplus.h nis_intern.h Banner \ - nisplus-parser.h nis_xdr.h nss \ - $(wildcard rpcsvc/*.[hx]) - # These are the databases available for the nis (and perhaps later nisplus) # service. This must be a superset of the services in nss. databases-y := proto service hosts network grp pwd rpc ethers \ diff --git a/libc/nptl/ChangeLog b/libc/nptl/ChangeLog index 23040e463..eb2e38daf 100644 --- a/libc/nptl/ChangeLog +++ b/libc/nptl/ChangeLog @@ -1,7 +1,32 @@ +2012-03-07 Ulrich Drepper <drepper@gmail.com> + + * Makefile (distribute): Remove variable. + +2012-01-23 Thomas Schwinge <thomas@codesourcery.com> + + * sysdeps/unix/sysv/linux/sem_timedwait.c (sem_timedwait): Get rid of + superfluous assignment. + * sysdeps/unix/sysv/linux/sparc/sem_timedwait.c (sem_timedwait): + Likewise. + * sysdeps/unix/sysv/linux/sparc/sparc32/sem_timedwait.c + (sem_timedwait): Likewise. + +2012-03-06 Ulrich Drepper <drepper@gmail.com> + + * sysdeps/pthread/bits/libc-lock.h: Move information not needed in + installed headers to... + * sysdeps/pthread/bits/libc-lockP.h: ...here. New file. + +2012-03-06 David S. Miller <davem@davemloft.net> + + * sysdeps/unix/sysv/linux/sparc/sem_post.c (__new_sem_post): Use + atomic_increment and remove unused local variable. + (__old_sem_post): Likewise. + 2012-02-27 David S. Miller <davem@davemloft.net> - * sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h: Don't refer to non-existing - __pthread_attr. + * sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h: Don't refer to + non-existing __pthread_attr. * sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h: Likewise. * sysdeps/unix/sysv/linux/s390/bits/pthreadtypes.h: Likewise. * sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h: Likewise. @@ -42,8 +67,8 @@ 2012-02-16 Richard Henderson <rth@twiddle.net> - * nptl/sysdeps/unix/sysv/linux/s390/s390-32/pt-initfini.c: Remove file. - * nptl/sysdeps/unix/sysv/linux/s390/s390-64/pt-initfini.c: Remove file. + * sysdeps/unix/sysv/linux/s390/s390-32/pt-initfini.c: Remove file. + * sysdeps/unix/sysv/linux/s390/s390-64/pt-initfini.c: Remove file. 2012-02-15 Kaz Kojima <kkojima@rr.iij4u.or.jp> diff --git a/libc/nptl/Makefile b/libc/nptl/Makefile index 238920a36..10144d2a8 100644 --- a/libc/nptl/Makefile +++ b/libc/nptl/Makefile @@ -282,8 +282,6 @@ tests-nolibpthread = tst-unload # of the page size since every architecture's page size is > 1k. tst-oddstacklimit-ENV = ; ulimit -s 1023; -distribute = eintr.c tst-cleanup4aux.c - gen-as-const-headers = pthread-errnos.sym LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst diff --git a/libc/nptl/sysdeps/pthread/bits/libc-lock.h b/libc/nptl/sysdeps/pthread/bits/libc-lock.h index 9faa5281a..297cf207e 100644 --- a/libc/nptl/sysdeps/pthread/bits/libc-lock.h +++ b/libc/nptl/sysdeps/pthread/bits/libc-lock.h @@ -24,12 +24,6 @@ #include <stddef.h> -/* Fortunately Linux now has a mean to do locking which is realtime - safe without the aid of the thread library. We also need no fancy - options like error checking mutexes etc. We only need simple - locks, maybe recursive. This can be easily and cheaply implemented - using futexes. We will use them everywhere except in ld.so since - ld.so might be used on old kernels with a different libc.so. */ #ifdef _LIBC # include <lowlevellock.h> # include <tls.h> @@ -41,27 +35,14 @@ /* Mutex type. */ #if defined _LIBC || defined _IO_MTSAFE_IO # if (defined NOT_IN_libc && !defined IS_IN_libpthread) || !defined _LIBC -typedef pthread_mutex_t __libc_lock_t; typedef struct { pthread_mutex_t mutex; } __libc_lock_recursive_t; # else -typedef int __libc_lock_t; typedef struct { int lock; int cnt; void *owner; } __libc_lock_recursive_t; # endif -typedef struct { pthread_mutex_t mutex; } __rtld_lock_recursive_t; -# ifdef __USE_UNIX98 -typedef pthread_rwlock_t __libc_rwlock_t; -# else -typedef struct __libc_rwlock_opaque__ __libc_rwlock_t; -# endif #else -typedef struct __libc_lock_opaque__ __libc_lock_t; typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t; -typedef struct __libc_rwlock_opaque__ __libc_rwlock_t; #endif -/* Type for key to thread-specific data. */ -typedef pthread_key_t __libc_key_t; - /* Define a lock variable NAME with storage class CLASS. The lock must be initialized with __libc_lock_init before it can be used (or define it with __libc_lock_define_initialized, below). Use `extern' for CLASS to @@ -69,44 +50,8 @@ typedef pthread_key_t __libc_key_t; definitions you must use a pointer to the lock structure (i.e., NAME begins with a `*'), because its storage size will not be known outside of libc. */ -#define __libc_lock_define(CLASS,NAME) \ - CLASS __libc_lock_t NAME; -#define __libc_rwlock_define(CLASS,NAME) \ - CLASS __libc_rwlock_t NAME; #define __libc_lock_define_recursive(CLASS,NAME) \ CLASS __libc_lock_recursive_t NAME; -#define __rtld_lock_define_recursive(CLASS,NAME) \ - CLASS __rtld_lock_recursive_t NAME; - -/* Define an initialized lock variable NAME with storage class CLASS. - - For the C library we take a deeper look at the initializer. For - this implementation all fields are initialized to zero. Therefore - we don't initialize the variable which allows putting it into the - BSS section. (Except on PA-RISC and other odd architectures, where - initialized locks must be set to one due to the lack of normal - atomic operations.) */ - -#if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread) -# if LLL_LOCK_INITIALIZER == 0 -# define __libc_lock_define_initialized(CLASS,NAME) \ - CLASS __libc_lock_t NAME; -# else -# define __libc_lock_define_initialized(CLASS,NAME) \ - CLASS __libc_lock_t NAME = LLL_LOCK_INITIALIZER; -# endif -#else -# if __LT_SPINLOCK_INIT == 0 -# define __libc_lock_define_initialized(CLASS,NAME) \ - CLASS __libc_lock_t NAME; -# else -# define __libc_lock_define_initialized(CLASS,NAME) \ - CLASS __libc_lock_t NAME = PTHREAD_MUTEX_INITIALIZER; -# endif -#endif - -#define __libc_rwlock_define_initialized(CLASS,NAME) \ - CLASS __libc_rwlock_t NAME = PTHREAD_RWLOCK_INITIALIZER; /* Define an initialized recursive lock variable NAME with storage class CLASS. */ @@ -127,63 +72,7 @@ typedef pthread_key_t __libc_key_t; {PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP} #endif -#define __rtld_lock_define_initialized_recursive(CLASS,NAME) \ - CLASS __rtld_lock_recursive_t NAME = _RTLD_LOCK_RECURSIVE_INITIALIZER; -#define _RTLD_LOCK_RECURSIVE_INITIALIZER \ - {PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP} - -#define __rtld_lock_initialize(NAME) \ - (void) ((NAME) = (__rtld_lock_recursive_t) _RTLD_LOCK_RECURSIVE_INITIALIZER) - -/* If we check for a weakly referenced symbol and then perform a - normal jump to it te code generated for some platforms in case of - PIC is unnecessarily slow. What would happen is that the function - is first referenced as data and then it is called indirectly - through the PLT. We can make this a direct jump. */ -#ifdef __PIC__ -# define __libc_maybe_call(FUNC, ARGS, ELSE) \ - (__extension__ ({ __typeof (FUNC) *_fn = (FUNC); \ - _fn != NULL ? (*_fn) ARGS : ELSE; })) -#else -# define __libc_maybe_call(FUNC, ARGS, ELSE) \ - (FUNC != NULL ? FUNC ARGS : ELSE) -#endif - -/* Call thread functions through the function pointer table. */ -#if defined SHARED && !defined NOT_IN_libc -# define PTFAVAIL(NAME) __libc_pthread_functions_init -# define __libc_ptf_call(FUNC, ARGS, ELSE) \ - (__libc_pthread_functions_init ? PTHFCT_CALL (ptr_##FUNC, ARGS) : ELSE) -# define __libc_ptf_call_always(FUNC, ARGS) \ - PTHFCT_CALL (ptr_##FUNC, ARGS) -#else -# define PTFAVAIL(NAME) (NAME != NULL) -# define __libc_ptf_call(FUNC, ARGS, ELSE) \ - __libc_maybe_call (FUNC, ARGS, ELSE) -# define __libc_ptf_call_always(FUNC, ARGS) \ - FUNC ARGS -#endif - - -/* Initialize the named lock variable, leaving it in a consistent, unlocked - state. */ -#if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread) -# define __libc_lock_init(NAME) ((NAME) = LLL_LOCK_INITIALIZER, 0) -#else -# define __libc_lock_init(NAME) \ - __libc_maybe_call (__pthread_mutex_init, (&(NAME), NULL), 0) -#endif -#if defined SHARED && !defined NOT_IN_libc -/* ((NAME) = (__libc_rwlock_t) PTHREAD_RWLOCK_INITIALIZER, 0) is - inefficient. */ -# define __libc_rwlock_init(NAME) \ - (__builtin_memset (&(NAME), '\0', sizeof (NAME)), 0) -#else -# define __libc_rwlock_init(NAME) \ - __libc_maybe_call (__pthread_rwlock_init, (&(NAME), NULL), 0) -#endif - -/* Same as last but this time we initialize a recursive mutex. */ +/* Initialize a recursive mutex. */ #if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread) # define __libc_lock_init_recursive(NAME) \ ((NAME) = (__libc_lock_recursive_t) _LIBC_LOCK_RECURSIVE_INITIALIZER, 0) @@ -201,34 +90,6 @@ typedef pthread_key_t __libc_key_t; } while (0) #endif -#define __rtld_lock_init_recursive(NAME) \ - do { \ - if (__pthread_mutex_init != NULL) \ - { \ - pthread_mutexattr_t __attr; \ - __pthread_mutexattr_init (&__attr); \ - __pthread_mutexattr_settype (&__attr, PTHREAD_MUTEX_RECURSIVE_NP); \ - __pthread_mutex_init (&(NAME).mutex, &__attr); \ - __pthread_mutexattr_destroy (&__attr); \ - } \ - } while (0) - -/* Finalize the named lock variable, which must be locked. It cannot be - used again until __libc_lock_init is called again on it. This must be - called on a lock variable before the containing storage is reused. */ -#if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread) -# define __libc_lock_fini(NAME) ((void) 0) -#else -# define __libc_lock_fini(NAME) \ - __libc_maybe_call (__pthread_mutex_destroy, (&(NAME)), 0) -#endif -#if defined SHARED && !defined NOT_IN_libc -# define __libc_rwlock_fini(NAME) ((void) 0) -#else -# define __libc_rwlock_fini(NAME) \ - __libc_maybe_call (__pthread_rwlock_destroy, (&(NAME)), 0) -#endif - /* Finalize recursive named lock. */ #if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread) # define __libc_lock_fini_recursive(NAME) ((void) 0) @@ -237,31 +98,6 @@ typedef pthread_key_t __libc_key_t; __libc_maybe_call (__pthread_mutex_destroy, (&(NAME)), 0) #endif -/* Lock the named lock variable. */ -#if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread) -# if __OPTION_EGLIBC_BIG_MACROS != 1 -/* EGLIBC: Declare wrapper function for a big macro if either - !__OPTION_EGLIBC_BIG_MACROS or we are using a back door from - small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */ -extern void __libc_lock_lock_fn (__libc_lock_t *); -libc_hidden_proto (__libc_lock_lock_fn); -# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */ -# if __OPTION_EGLIBC_BIG_MACROS -# define __libc_lock_lock(NAME) \ - ({ lll_lock (NAME, LLL_PRIVATE); 0; }) -# else -# define __libc_lock_lock(NAME) \ - __libc_lock_lock_fn (&(NAME)) -# endif /* __OPTION_EGLIBC_BIG_MACROS */ -#else -# define __libc_lock_lock(NAME) \ - __libc_maybe_call (__pthread_mutex_lock, (&(NAME)), 0) -#endif -#define __libc_rwlock_rdlock(NAME) \ - __libc_ptf_call (__pthread_rwlock_rdlock, (&(NAME)), 0) -#define __libc_rwlock_wrlock(NAME) \ - __libc_ptf_call (__pthread_rwlock_wrlock, (&(NAME)), 0) - /* Lock the recursive named lock variable. */ #if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread) # if __OPTION_EGLIBC_BIG_MACROS != 1 @@ -291,31 +127,6 @@ libc_hidden_proto (__libc_lock_lock_recursive_fn); __libc_maybe_call (__pthread_mutex_lock, (&(NAME).mutex), 0) #endif -/* Try to lock the named lock variable. */ -#if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread) -# if __OPTION_EGLIBC_BIG_MACROS != 1 -/* EGLIBC: Declare wrapper function for a big macro if either - !__OPTION_EGLIBC_BIG_MACROS or we are using a back door from - small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */ -extern int __libc_lock_trylock_fn (__libc_lock_t *); -libc_hidden_proto (__libc_lock_trylock_fn); -# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */ -# if __OPTION_EGLIBC_BIG_MACROS -# define __libc_lock_trylock(NAME) \ - lll_trylock (NAME) -# else -# define __libc_lock_trylock(NAME) \ - __libc_lock_trylock_fn (&(NAME)) -# endif /* __OPTION_EGLIBC_BIG_MACROS */ -#else -# define __libc_lock_trylock(NAME) \ - __libc_maybe_call (__pthread_mutex_trylock, (&(NAME)), 0) -#endif -#define __libc_rwlock_tryrdlock(NAME) \ - __libc_maybe_call (__pthread_rwlock_tryrdlock, (&(NAME)), 0) -#define __libc_rwlock_trywrlock(NAME) \ - __libc_maybe_call (__pthread_rwlock_trywrlock, (&(NAME)), 0) - /* Try to lock the recursive named lock variable. */ #if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread) # if __OPTION_EGLIBC_BIG_MACROS != 1 @@ -353,32 +164,6 @@ libc_hidden_proto (__libc_lock_trylock_recursive_fn); __libc_maybe_call (__pthread_mutex_trylock, (&(NAME)), 0) #endif -#define __rtld_lock_trylock_recursive(NAME) \ - __libc_maybe_call (__pthread_mutex_trylock, (&(NAME).mutex), 0) - -/* Unlock the named lock variable. */ -#if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread) -# if __OPTION_EGLIBC_BIG_MACROS != 1 -/* EGLIBC: Declare wrapper function for a big macro if either - !__OPTION_EGLIBC_BIG_MACROS, or we are using a back door from - small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */ -extern void __libc_lock_unlock_fn (__libc_lock_t *); -libc_hidden_proto (__libc_lock_unlock_fn); -# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */ -# if __OPTION_EGLIBC_BIG_MACROS -# define __libc_lock_unlock(NAME) \ - lll_unlock (NAME, LLL_PRIVATE) -# else -# define __libc_lock_unlock(NAME) \ - __libc_lock_unlock_fn (&(NAME)) -# endif /* __OPTION_EGLIBC_BIG_MACROS */ -#else -# define __libc_lock_unlock(NAME) \ - __libc_maybe_call (__pthread_mutex_unlock, (&(NAME)), 0) -#endif -#define __libc_rwlock_unlock(NAME) \ - __libc_ptf_call (__pthread_rwlock_unlock, (&(NAME)), 0) - /* Unlock the recursive named lock variable. */ #if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread) # if __OPTION_EGLIBC_BIG_MACROS != 1 @@ -407,58 +192,10 @@ libc_hidden_proto (__libc_lock_unlock_recursive_fn); __libc_maybe_call (__pthread_mutex_unlock, (&(NAME)), 0) #endif -#if defined _LIBC && defined SHARED -# define __rtld_lock_default_lock_recursive(lock) \ - ++((pthread_mutex_t *)(lock))->__data.__count; - -# define __rtld_lock_default_unlock_recursive(lock) \ - --((pthread_mutex_t *)(lock))->__data.__count; - -# define __rtld_lock_lock_recursive(NAME) \ - GL(dl_rtld_lock_recursive) (&(NAME).mutex) - -# define __rtld_lock_unlock_recursive(NAME) \ - GL(dl_rtld_unlock_recursive) (&(NAME).mutex) -#else -# define __rtld_lock_lock_recursive(NAME) \ - __libc_maybe_call (__pthread_mutex_lock, (&(NAME).mutex), 0) - -# define __rtld_lock_unlock_recursive(NAME) \ - __libc_maybe_call (__pthread_mutex_unlock, (&(NAME).mutex), 0) -#endif - -/* Define once control variable. */ -#if PTHREAD_ONCE_INIT == 0 -/* Special case for static variables where we can avoid the initialization - if it is zero. */ -# define __libc_once_define(CLASS, NAME) \ - CLASS pthread_once_t NAME -#else -# define __libc_once_define(CLASS, NAME) \ - CLASS pthread_once_t NAME = PTHREAD_ONCE_INIT -#endif - -/* Call handler iff the first call. */ -#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \ - do { \ - if (PTFAVAIL (__pthread_once)) \ - __libc_ptf_call_always (__pthread_once, (&(ONCE_CONTROL), \ - INIT_FUNCTION)); \ - else if ((ONCE_CONTROL) == PTHREAD_ONCE_INIT) { \ - INIT_FUNCTION (); \ - (ONCE_CONTROL) |= 2; \ - } \ - } while (0) - - /* Note that for I/O cleanup handling we are using the old-style - cancel handling. It does not have to be integrated with C++ snce + cancel handling. It does not have to be integrated with C++ since no C++ code is called in the middle. The old-style handling is faster and the support is not going away. */ -extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *buffer, - void (*routine) (void *), void *arg); -extern void _pthread_cleanup_pop (struct _pthread_cleanup_buffer *buffer, - int execute); extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer, void (*routine) (void *), void *arg); extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer, @@ -489,170 +226,11 @@ extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer _buffer.__routine (_buffer.__arg); \ } -/* Sometimes we have to exit the block in the middle. */ -#define __libc_cleanup_end(DOIT) \ - if (_avail) { \ - __libc_ptf_call_always (_pthread_cleanup_pop_restore, (&_buffer, DOIT));\ - } else if (DOIT) \ - _buffer.__routine (_buffer.__arg) - - -/* Normal cleanup handling, based on C cleanup attribute. */ -__extern_inline void -__libc_cleanup_routine (struct __pthread_cleanup_frame *f) -{ - if (f->__do_it) - f->__cancel_routine (f->__cancel_arg); -} - -#define __libc_cleanup_push(fct, arg) \ - do { \ - struct __pthread_cleanup_frame __clframe \ - __attribute__ ((__cleanup__ (__libc_cleanup_routine))) \ - = { .__cancel_routine = (fct), .__cancel_arg = (arg), \ - .__do_it = 1 }; - -#define __libc_cleanup_pop(execute) \ - __clframe.__do_it = (execute); \ - } while (0) - - -/* Create thread-specific key. */ -#define __libc_key_create(KEY, DESTRUCTOR) \ - __libc_ptf_call (__pthread_key_create, (KEY, DESTRUCTOR), 1) - -/* Get thread-specific data. */ -#define __libc_getspecific(KEY) \ - __libc_ptf_call (__pthread_getspecific, (KEY), NULL) - -/* Set thread-specific data. */ -#define __libc_setspecific(KEY, VALUE) \ - __libc_ptf_call (__pthread_setspecific, (KEY, VALUE), 0) - - -/* Register handlers to execute before and after `fork'. Note that the - last parameter is NULL. The handlers registered by the libc are - never removed so this is OK. */ -#define __libc_atfork(PREPARE, PARENT, CHILD) \ - __register_atfork (PREPARE, PARENT, CHILD, NULL) -extern int __register_atfork (void (*__prepare) (void), - void (*__parent) (void), - void (*__child) (void), - void *__dso_handle); - -/* Functions that are used by this file and are internal to the GNU C - library. */ - -extern int __pthread_mutex_init (pthread_mutex_t *__mutex, - const pthread_mutexattr_t *__mutex_attr); - -extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex); - -extern int __pthread_mutex_trylock (pthread_mutex_t *__mutex); - -extern int __pthread_mutex_lock (pthread_mutex_t *__mutex); - -extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex); - -extern int __pthread_mutexattr_init (pthread_mutexattr_t *__attr); - -extern int __pthread_mutexattr_destroy (pthread_mutexattr_t *__attr); - -extern int __pthread_mutexattr_settype (pthread_mutexattr_t *__attr, - int __kind); -#ifdef __USE_UNIX98 -extern int __pthread_rwlock_init (pthread_rwlock_t *__rwlock, - const pthread_rwlockattr_t *__attr); - -extern int __pthread_rwlock_destroy (pthread_rwlock_t *__rwlock); - -extern int __pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock); - -extern int __pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock); - -extern int __pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock); - -extern int __pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock); - -extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock); -#endif - -extern int __pthread_key_create (pthread_key_t *__key, - void (*__destr_function) (void *)); - -extern int __pthread_setspecific (pthread_key_t __key, - const void *__pointer); - -extern void *__pthread_getspecific (pthread_key_t __key); - -extern int __pthread_once (pthread_once_t *__once_control, - void (*__init_routine) (void)); - -extern int __pthread_atfork (void (*__prepare) (void), - void (*__parent) (void), - void (*__child) (void)); - - - -/* Make the pthread functions weak so that we can elide them from - single-threaded processes. */ -#ifndef __NO_WEAK_PTHREAD_ALIASES -# ifdef weak_extern -# if _LIBC -# include <bp-sym.h> -# else -# define BP_SYM(sym) sym -# endif -weak_extern (BP_SYM (__pthread_mutex_init)) -weak_extern (BP_SYM (__pthread_mutex_destroy)) -weak_extern (BP_SYM (__pthread_mutex_lock)) -weak_extern (BP_SYM (__pthread_mutex_trylock)) -weak_extern (BP_SYM (__pthread_mutex_unlock)) -weak_extern (BP_SYM (__pthread_mutexattr_init)) -weak_extern (BP_SYM (__pthread_mutexattr_destroy)) -weak_extern (BP_SYM (__pthread_mutexattr_settype)) -weak_extern (BP_SYM (__pthread_rwlock_init)) -weak_extern (BP_SYM (__pthread_rwlock_destroy)) -weak_extern (BP_SYM (__pthread_rwlock_rdlock)) -weak_extern (BP_SYM (__pthread_rwlock_tryrdlock)) -weak_extern (BP_SYM (__pthread_rwlock_wrlock)) -weak_extern (BP_SYM (__pthread_rwlock_trywrlock)) -weak_extern (BP_SYM (__pthread_rwlock_unlock)) -weak_extern (BP_SYM (__pthread_key_create)) -weak_extern (BP_SYM (__pthread_setspecific)) -weak_extern (BP_SYM (__pthread_getspecific)) -weak_extern (BP_SYM (__pthread_once)) -weak_extern (__pthread_initialize) -weak_extern (__pthread_atfork) -weak_extern (BP_SYM (_pthread_cleanup_push_defer)) -weak_extern (BP_SYM (_pthread_cleanup_pop_restore)) -weak_extern (BP_SYM (pthread_setcancelstate)) -# else -# pragma weak __pthread_mutex_init -# pragma weak __pthread_mutex_destroy -# pragma weak __pthread_mutex_lock -# pragma weak __pthread_mutex_trylock -# pragma weak __pthread_mutex_unlock -# pragma weak __pthread_mutexattr_init -# pragma weak __pthread_mutexattr_destroy -# pragma weak __pthread_mutexattr_settype -# pragma weak __pthread_rwlock_destroy -# pragma weak __pthread_rwlock_rdlock -# pragma weak __pthread_rwlock_tryrdlock -# pragma weak __pthread_rwlock_wrlock -# pragma weak __pthread_rwlock_trywrlock -# pragma weak __pthread_rwlock_unlock -# pragma weak __pthread_key_create -# pragma weak __pthread_setspecific -# pragma weak __pthread_getspecific -# pragma weak __pthread_once -# pragma weak __pthread_initialize -# pragma weak __pthread_atfork -# pragma weak _pthread_cleanup_push_defer -# pragma weak _pthread_cleanup_pop_restore -# pragma weak pthread_setcancelstate -# endif +/* Hide the definitions which are only supposed to be used inside libc in + a separate file. This file is not present in the installation! */ +#ifdef _LIBC +# include "libc-lockP.h" #endif #endif /* bits/libc-lock.h */ diff --git a/libc/nptl/sysdeps/pthread/bits/libc-lockP.h b/libc/nptl/sysdeps/pthread/bits/libc-lockP.h new file mode 100644 index 000000000..55c95af2c --- /dev/null +++ b/libc/nptl/sysdeps/pthread/bits/libc-lockP.h @@ -0,0 +1,472 @@ +/* Private libc-internal interface for mutex locks. NPTL version. + Copyright (C) 1996-2003, 2005, 2007, 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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; see the file COPYING.LIB. If + not, see <http://www.gnu.org/licenses/>. */ + +#ifndef _BITS_LIBC_LOCKP_H +#define _BITS_LIBC_LOCKP_H 1 + +#include <pthread.h> +#define __need_NULL +#include <stddef.h> + + +/* Fortunately Linux now has a mean to do locking which is realtime + safe without the aid of the thread library. We also need no fancy + options like error checking mutexes etc. We only need simple + locks, maybe recursive. This can be easily and cheaply implemented + using futexes. We will use them everywhere except in ld.so since + ld.so might be used on old kernels with a different libc.so. */ +#include <lowlevellock.h> +#include <tls.h> +#include <pthread-functions.h> +#include <errno.h> /* For EBUSY. */ +#include <gnu/option-groups.h> /* For __OPTION_EGLIBC_BIG_MACROS. */ + +/* Mutex type. */ +#if defined NOT_IN_libc && !defined IS_IN_libpthread +typedef pthread_mutex_t __libc_lock_t; +#else +typedef int __libc_lock_t; +#endif +typedef struct { pthread_mutex_t mutex; } __rtld_lock_recursive_t; +typedef pthread_rwlock_t __libc_rwlock_t; + +/* Type for key to thread-specific data. */ +typedef pthread_key_t __libc_key_t; + +/* Define a lock variable NAME with storage class CLASS. The lock must be + initialized with __libc_lock_init before it can be used (or define it + with __libc_lock_define_initialized, below). Use `extern' for CLASS to + declare a lock defined in another module. In public structure + definitions you must use a pointer to the lock structure (i.e., NAME + begins with a `*'), because its storage size will not be known outside + of libc. */ +#define __libc_lock_define(CLASS,NAME) \ + CLASS __libc_lock_t NAME; +#define __libc_rwlock_define(CLASS,NAME) \ + CLASS __libc_rwlock_t NAME; +#define __rtld_lock_define_recursive(CLASS,NAME) \ + CLASS __rtld_lock_recursive_t NAME; + +/* Define an initialized lock variable NAME with storage class CLASS. + + For the C library we take a deeper look at the initializer. For + this implementation all fields are initialized to zero. Therefore + we don't initialize the variable which allows putting it into the + BSS section. (Except on PA-RISC and other odd architectures, where + initialized locks must be set to one due to the lack of normal + atomic operations.) */ + +#if !defined NOT_IN_libc || defined IS_IN_libpthread +# if LLL_LOCK_INITIALIZER == 0 +# define __libc_lock_define_initialized(CLASS,NAME) \ + CLASS __libc_lock_t NAME; +# else +# define __libc_lock_define_initialized(CLASS,NAME) \ + CLASS __libc_lock_t NAME = LLL_LOCK_INITIALIZER; +# endif +#else +# if __LT_SPINLOCK_INIT == 0 +# define __libc_lock_define_initialized(CLASS,NAME) \ + CLASS __libc_lock_t NAME; +# else +# define __libc_lock_define_initialized(CLASS,NAME) \ + CLASS __libc_lock_t NAME = PTHREAD_MUTEX_INITIALIZER; +# endif +#endif + +#define __libc_rwlock_define_initialized(CLASS,NAME) \ + CLASS __libc_rwlock_t NAME = PTHREAD_RWLOCK_INITIALIZER; + +#define __rtld_lock_define_initialized_recursive(CLASS,NAME) \ + CLASS __rtld_lock_recursive_t NAME = _RTLD_LOCK_RECURSIVE_INITIALIZER; +#define _RTLD_LOCK_RECURSIVE_INITIALIZER \ + {PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP} + +#define __rtld_lock_initialize(NAME) \ + (void) ((NAME) = (__rtld_lock_recursive_t) _RTLD_LOCK_RECURSIVE_INITIALIZER) + +/* If we check for a weakly referenced symbol and then perform a + normal jump to it te code generated for some platforms in case of + PIC is unnecessarily slow. What would happen is that the function + is first referenced as data and then it is called indirectly + through the PLT. We can make this a direct jump. */ +#ifdef __PIC__ +# define __libc_maybe_call(FUNC, ARGS, ELSE) \ + (__extension__ ({ __typeof (FUNC) *_fn = (FUNC); \ + _fn != NULL ? (*_fn) ARGS : ELSE; })) +#else +# define __libc_maybe_call(FUNC, ARGS, ELSE) \ + (FUNC != NULL ? FUNC ARGS : ELSE) +#endif + +/* Call thread functions through the function pointer table. */ +#if defined SHARED && !defined NOT_IN_libc +# define PTFAVAIL(NAME) __libc_pthread_functions_init +# define __libc_ptf_call(FUNC, ARGS, ELSE) \ + (__libc_pthread_functions_init ? PTHFCT_CALL (ptr_##FUNC, ARGS) : ELSE) +# define __libc_ptf_call_always(FUNC, ARGS) \ + PTHFCT_CALL (ptr_##FUNC, ARGS) +#else +# define PTFAVAIL(NAME) (NAME != NULL) +# define __libc_ptf_call(FUNC, ARGS, ELSE) \ + __libc_maybe_call (FUNC, ARGS, ELSE) +# define __libc_ptf_call_always(FUNC, ARGS) \ + FUNC ARGS +#endif + + +/* Initialize the named lock variable, leaving it in a consistent, unlocked + state. */ +#if !defined NOT_IN_libc || defined IS_IN_libpthread +# define __libc_lock_init(NAME) ((NAME) = LLL_LOCK_INITIALIZER, 0) +#else +# define __libc_lock_init(NAME) \ + __libc_maybe_call (__pthread_mutex_init, (&(NAME), NULL), 0) +#endif +#if defined SHARED && !defined NOT_IN_libc +/* ((NAME) = (__libc_rwlock_t) PTHREAD_RWLOCK_INITIALIZER, 0) is + inefficient. */ +# define __libc_rwlock_init(NAME) \ + (__builtin_memset (&(NAME), '\0', sizeof (NAME)), 0) +#else +# define __libc_rwlock_init(NAME) \ + __libc_maybe_call (__pthread_rwlock_init, (&(NAME), NULL), 0) +#endif + +#define __rtld_lock_init_recursive(NAME) \ + do { \ + if (__pthread_mutex_init != NULL) \ + { \ + pthread_mutexattr_t __attr; \ + __pthread_mutexattr_init (&__attr); \ + __pthread_mutexattr_settype (&__attr, PTHREAD_MUTEX_RECURSIVE_NP); \ + __pthread_mutex_init (&(NAME).mutex, &__attr); \ + __pthread_mutexattr_destroy (&__attr); \ + } \ + } while (0) + +/* Finalize the named lock variable, which must be locked. It cannot be + used again until __libc_lock_init is called again on it. This must be + called on a lock variable before the containing storage is reused. */ +#if !defined NOT_IN_libc || defined IS_IN_libpthread +# define __libc_lock_fini(NAME) ((void) 0) +#else +# define __libc_lock_fini(NAME) \ + __libc_maybe_call (__pthread_mutex_destroy, (&(NAME)), 0) +#endif +#if defined SHARED && !defined NOT_IN_libc +# define __libc_rwlock_fini(NAME) ((void) 0) +#else +# define __libc_rwlock_fini(NAME) \ + __libc_maybe_call (__pthread_rwlock_destroy, (&(NAME)), 0) +#endif + +/* Lock the named lock variable. */ +#if !defined NOT_IN_libc || defined IS_IN_libpthread +# if __OPTION_EGLIBC_BIG_MACROS != 1 +/* EGLIBC: Declare wrapper function for a big macro if either + !__OPTION_EGLIBC_BIG_MACROS or we are using a back door from + small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */ +extern void __libc_lock_lock_fn (__libc_lock_t *); +libc_hidden_proto (__libc_lock_lock_fn); +# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */ +# if __OPTION_EGLIBC_BIG_MACROS +# define __libc_lock_lock(NAME) \ + ({ lll_lock (NAME, LLL_PRIVATE); 0; }) +# else +# define __libc_lock_lock(NAME) \ + __libc_lock_lock_fn (&(NAME)) +# endif /* __OPTION_EGLIBC_BIG_MACROS */ +#else +# define __libc_lock_lock(NAME) \ + __libc_maybe_call (__pthread_mutex_lock, (&(NAME)), 0) +#endif +#define __libc_rwlock_rdlock(NAME) \ + __libc_ptf_call (__pthread_rwlock_rdlock, (&(NAME)), 0) +#define __libc_rwlock_wrlock(NAME) \ + __libc_ptf_call (__pthread_rwlock_wrlock, (&(NAME)), 0) + +/* Try to lock the named lock variable. */ +#if !defined NOT_IN_libc || defined IS_IN_libpthread +# if __OPTION_EGLIBC_BIG_MACROS != 1 +/* EGLIBC: Declare wrapper function for a big macro if either + !__OPTION_EGLIBC_BIG_MACROS or we are using a back door from + small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */ +extern int __libc_lock_trylock_fn (__libc_lock_t *); +libc_hidden_proto (__libc_lock_trylock_fn); +# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */ +# if __OPTION_EGLIBC_BIG_MACROS +# define __libc_lock_trylock(NAME) \ + lll_trylock (NAME) +# else +# define __libc_lock_trylock(NAME) \ + __libc_lock_trylock_fn (&(NAME)) +# endif /* __OPTION_EGLIBC_BIG_MACROS */ +#else +# define __libc_lock_trylock(NAME) \ + __libc_maybe_call (__pthread_mutex_trylock, (&(NAME)), 0) +#endif +#define __libc_rwlock_tryrdlock(NAME) \ + __libc_maybe_call (__pthread_rwlock_tryrdlock, (&(NAME)), 0) +#define __libc_rwlock_trywrlock(NAME) \ + __libc_maybe_call (__pthread_rwlock_trywrlock, (&(NAME)), 0) + +#define __rtld_lock_trylock_recursive(NAME) \ + __libc_maybe_call (__pthread_mutex_trylock, (&(NAME).mutex), 0) + +/* Unlock the named lock variable. */ +#if !defined NOT_IN_libc || defined IS_IN_libpthread +# if __OPTION_EGLIBC_BIG_MACROS != 1 +/* EGLIBC: Declare wrapper function for a big macro if either + !__OPTION_EGLIBC_BIG_MACROS, or we are using a back door from + small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */ +extern void __libc_lock_unlock_fn (__libc_lock_t *); +libc_hidden_proto (__libc_lock_unlock_fn); +# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */ +# if __OPTION_EGLIBC_BIG_MACROS +# define __libc_lock_unlock(NAME) \ + lll_unlock (NAME, LLL_PRIVATE) +# else +# define __libc_lock_unlock(NAME) \ + __libc_lock_unlock_fn (&(NAME)) +# endif /* __OPTION_EGLIBC_BIG_MACROS */ +#else +# define __libc_lock_unlock(NAME) \ + __libc_maybe_call (__pthread_mutex_unlock, (&(NAME)), 0) +#endif +#define __libc_rwlock_unlock(NAME) \ + __libc_ptf_call (__pthread_rwlock_unlock, (&(NAME)), 0) + +#ifdef SHARED +# define __rtld_lock_default_lock_recursive(lock) \ + ++((pthread_mutex_t *)(lock))->__data.__count; + +# define __rtld_lock_default_unlock_recursive(lock) \ + --((pthread_mutex_t *)(lock))->__data.__count; + +# define __rtld_lock_lock_recursive(NAME) \ + GL(dl_rtld_lock_recursive) (&(NAME).mutex) + +# define __rtld_lock_unlock_recursive(NAME) \ + GL(dl_rtld_unlock_recursive) (&(NAME).mutex) +#else +# define __rtld_lock_lock_recursive(NAME) \ + __libc_maybe_call (__pthread_mutex_lock, (&(NAME).mutex), 0) + +# define __rtld_lock_unlock_recursive(NAME) \ + __libc_maybe_call (__pthread_mutex_unlock, (&(NAME).mutex), 0) +#endif + +/* Define once control variable. */ +#if PTHREAD_ONCE_INIT == 0 +/* Special case for static variables where we can avoid the initialization + if it is zero. */ +# define __libc_once_define(CLASS, NAME) \ + CLASS pthread_once_t NAME +#else +# define __libc_once_define(CLASS, NAME) \ + CLASS pthread_once_t NAME = PTHREAD_ONCE_INIT +#endif + +/* Call handler iff the first call. */ +#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \ + do { \ + if (PTFAVAIL (__pthread_once)) \ + __libc_ptf_call_always (__pthread_once, (&(ONCE_CONTROL), \ + INIT_FUNCTION)); \ + else if ((ONCE_CONTROL) == PTHREAD_ONCE_INIT) { \ + INIT_FUNCTION (); \ + (ONCE_CONTROL) |= 2; \ + } \ + } while (0) + + +/* Note that for I/O cleanup handling we are using the old-style + cancel handling. It does not have to be integrated with C++ snce + no C++ code is called in the middle. The old-style handling is + faster and the support is not going away. */ +extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *buffer, + void (*routine) (void *), void *arg); +extern void _pthread_cleanup_pop (struct _pthread_cleanup_buffer *buffer, + int execute); +extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer, + void (*routine) (void *), void *arg); +extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer, + int execute); + +/* Sometimes we have to exit the block in the middle. */ +#define __libc_cleanup_end(DOIT) \ + if (_avail) { \ + __libc_ptf_call_always (_pthread_cleanup_pop_restore, (&_buffer, DOIT));\ + } else if (DOIT) \ + _buffer.__routine (_buffer.__arg) + + +/* Normal cleanup handling, based on C cleanup attribute. */ +__extern_inline void +__libc_cleanup_routine (struct __pthread_cleanup_frame *f) +{ + if (f->__do_it) + f->__cancel_routine (f->__cancel_arg); +} + +#define __libc_cleanup_push(fct, arg) \ + do { \ + struct __pthread_cleanup_frame __clframe \ + __attribute__ ((__cleanup__ (__libc_cleanup_routine))) \ + = { .__cancel_routine = (fct), .__cancel_arg = (arg), \ + .__do_it = 1 }; + +#define __libc_cleanup_pop(execute) \ + __clframe.__do_it = (execute); \ + } while (0) + + +/* Create thread-specific key. */ +#define __libc_key_create(KEY, DESTRUCTOR) \ + __libc_ptf_call (__pthread_key_create, (KEY, DESTRUCTOR), 1) + +/* Get thread-specific data. */ +#define __libc_getspecific(KEY) \ + __libc_ptf_call (__pthread_getspecific, (KEY), NULL) + +/* Set thread-specific data. */ +#define __libc_setspecific(KEY, VALUE) \ + __libc_ptf_call (__pthread_setspecific, (KEY, VALUE), 0) + + +/* Register handlers to execute before and after `fork'. Note that the + last parameter is NULL. The handlers registered by the libc are + never removed so this is OK. */ +#define __libc_atfork(PREPARE, PARENT, CHILD) \ + __register_atfork (PREPARE, PARENT, CHILD, NULL) +extern int __register_atfork (void (*__prepare) (void), + void (*__parent) (void), + void (*__child) (void), + void *__dso_handle); + +/* Functions that are used by this file and are internal to the GNU C + library. */ + +extern int __pthread_mutex_init (pthread_mutex_t *__mutex, + const pthread_mutexattr_t *__mutex_attr); + +extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex); + +extern int __pthread_mutex_trylock (pthread_mutex_t *__mutex); + +extern int __pthread_mutex_lock (pthread_mutex_t *__mutex); + +extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex); + +extern int __pthread_mutexattr_init (pthread_mutexattr_t *__attr); + +extern int __pthread_mutexattr_destroy (pthread_mutexattr_t *__attr); + +extern int __pthread_mutexattr_settype (pthread_mutexattr_t *__attr, + int __kind); + +extern int __pthread_rwlock_init (pthread_rwlock_t *__rwlock, + const pthread_rwlockattr_t *__attr); + +extern int __pthread_rwlock_destroy (pthread_rwlock_t *__rwlock); + +extern int __pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock); + +extern int __pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock); + +extern int __pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock); + +extern int __pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock); + +extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock); + +extern int __pthread_key_create (pthread_key_t *__key, + void (*__destr_function) (void *)); + +extern int __pthread_setspecific (pthread_key_t __key, + const void *__pointer); + +extern void *__pthread_getspecific (pthread_key_t __key); + +extern int __pthread_once (pthread_once_t *__once_control, + void (*__init_routine) (void)); + +extern int __pthread_atfork (void (*__prepare) (void), + void (*__parent) (void), + void (*__child) (void)); + + + +/* Make the pthread functions weak so that we can elide them from + single-threaded processes. */ +#ifndef __NO_WEAK_PTHREAD_ALIASES +# ifdef weak_extern +# include <bp-sym.h> +weak_extern (BP_SYM (__pthread_mutex_init)) +weak_extern (BP_SYM (__pthread_mutex_destroy)) +weak_extern (BP_SYM (__pthread_mutex_lock)) +weak_extern (BP_SYM (__pthread_mutex_trylock)) +weak_extern (BP_SYM (__pthread_mutex_unlock)) +weak_extern (BP_SYM (__pthread_mutexattr_init)) +weak_extern (BP_SYM (__pthread_mutexattr_destroy)) +weak_extern (BP_SYM (__pthread_mutexattr_settype)) +weak_extern (BP_SYM (__pthread_rwlock_init)) +weak_extern (BP_SYM (__pthread_rwlock_destroy)) +weak_extern (BP_SYM (__pthread_rwlock_rdlock)) +weak_extern (BP_SYM (__pthread_rwlock_tryrdlock)) +weak_extern (BP_SYM (__pthread_rwlock_wrlock)) +weak_extern (BP_SYM (__pthread_rwlock_trywrlock)) +weak_extern (BP_SYM (__pthread_rwlock_unlock)) +weak_extern (BP_SYM (__pthread_key_create)) +weak_extern (BP_SYM (__pthread_setspecific)) +weak_extern (BP_SYM (__pthread_getspecific)) +weak_extern (BP_SYM (__pthread_once)) +weak_extern (__pthread_initialize) +weak_extern (__pthread_atfork) +weak_extern (BP_SYM (_pthread_cleanup_push_defer)) +weak_extern (BP_SYM (_pthread_cleanup_pop_restore)) +weak_extern (BP_SYM (pthread_setcancelstate)) +# else +# pragma weak __pthread_mutex_init +# pragma weak __pthread_mutex_destroy +# pragma weak __pthread_mutex_lock +# pragma weak __pthread_mutex_trylock +# pragma weak __pthread_mutex_unlock +# pragma weak __pthread_mutexattr_init +# pragma weak __pthread_mutexattr_destroy +# pragma weak __pthread_mutexattr_settype +# pragma weak __pthread_rwlock_destroy +# pragma weak __pthread_rwlock_rdlock +# pragma weak __pthread_rwlock_tryrdlock +# pragma weak __pthread_rwlock_wrlock +# pragma weak __pthread_rwlock_trywrlock +# pragma weak __pthread_rwlock_unlock +# pragma weak __pthread_key_create +# pragma weak __pthread_setspecific +# pragma weak __pthread_getspecific +# pragma weak __pthread_once +# pragma weak __pthread_initialize +# pragma weak __pthread_atfork +# pragma weak _pthread_cleanup_push_defer +# pragma weak _pthread_cleanup_pop_restore +# pragma weak pthread_setcancelstate +# endif +#endif + +#endif /* bits/libc-lockP.h */ diff --git a/libc/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c b/libc/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c index 903830ea7..36e00426d 100644 --- a/libc/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c +++ b/libc/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c @@ -1,5 +1,5 @@ /* sem_timedwait -- wait on a semaphore. Generic futex-using version. - Copyright (C) 2003, 2007 Free Software Foundation, Inc. + Copyright (C) 2003, 2007, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Paul Mackerras <paulus@au.ibm.com>, 2003. @@ -83,7 +83,6 @@ sem_timedwait (sem_t *sem, const struct timespec *abstime) } /* Already timed out? */ - err = -ETIMEDOUT; if (sec < 0) { __set_errno (ETIMEDOUT); diff --git a/libc/nptl/sysdeps/unix/sysv/linux/sparc/sem_post.c b/libc/nptl/sysdeps/unix/sysv/linux/sparc/sem_post.c index 0b829927d..28e06f632 100644 --- a/libc/nptl/sysdeps/unix/sysv/linux/sparc/sem_post.c +++ b/libc/nptl/sysdeps/unix/sysv/linux/sparc/sem_post.c @@ -30,7 +30,7 @@ __new_sem_post (sem_t *sem) { struct sparc_new_sem *isem = (struct sparc_new_sem *) sem; - int nr = atomic_increment_val (&isem->value); + atomic_increment (&isem->value); atomic_full_barrier (); if (isem->nwaiters > 0) { @@ -53,10 +53,11 @@ attribute_compat_text_section __old_sem_post (sem_t *sem) { struct sparc_old_sem *isem = (struct sparc_old_sem *) sem; + int err; - int nr = atomic_increment_val (&isem->value); - int err = lll_futex_wake (&isem->value, 1, - isem->private ^ FUTEX_PRIVATE_FLAG); + atomic_increment (&isem->value); + err = lll_futex_wake (&isem->value, 1, + isem->private ^ FUTEX_PRIVATE_FLAG); if (__builtin_expect (err, 0) < 0) { __set_errno (-err); diff --git a/libc/nptl/sysdeps/unix/sysv/linux/sparc/sem_timedwait.c b/libc/nptl/sysdeps/unix/sysv/linux/sparc/sem_timedwait.c index 7b4e8241a..8e56bc9c1 100644 --- a/libc/nptl/sysdeps/unix/sysv/linux/sparc/sem_timedwait.c +++ b/libc/nptl/sysdeps/unix/sysv/linux/sparc/sem_timedwait.c @@ -1,5 +1,5 @@ /* sem_timedwait -- wait on a semaphore. Generic futex-using version. - Copyright (C) 2003, 2007 Free Software Foundation, Inc. + Copyright (C) 2003, 2007, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Paul Mackerras <paulus@au.ibm.com>, 2003. @@ -83,7 +83,6 @@ sem_timedwait (sem_t *sem, const struct timespec *abstime) } /* Already timed out? */ - err = -ETIMEDOUT; if (sec < 0) { __set_errno (ETIMEDOUT); diff --git a/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_timedwait.c b/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_timedwait.c index 5da15742c..c9fcd595f 100644 --- a/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_timedwait.c +++ b/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_timedwait.c @@ -1,5 +1,5 @@ /* sem_timedwait -- wait on a semaphore. SPARC version. - Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 2003, 2006, 2007, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Paul Mackerras <paulus@au.ibm.com>, 2003. @@ -102,7 +102,6 @@ sem_timedwait (sem_t *sem, const struct timespec *abstime) } /* Already timed out? */ - err = -ETIMEDOUT; if (sec < 0) { __set_errno (ETIMEDOUT); diff --git a/libc/nptl_db/ChangeLog b/libc/nptl_db/ChangeLog index 81ebfcdfc..fe1778ee9 100644 --- a/libc/nptl_db/ChangeLog +++ b/libc/nptl_db/ChangeLog @@ -1,3 +1,7 @@ +2012-03-07 Ulrich Drepper <drepper@gmail.com> + + * Makefile (distribute): Remove variable. + 2011-09-15 Andreas Schwab <schwab@redhat.com> * thread_dbP.h: Include <list.h> diff --git a/libc/nptl_db/Makefile b/libc/nptl_db/Makefile index eb3c7e89f..d15fb9e81 100644 --- a/libc/nptl_db/Makefile +++ b/libc/nptl_db/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 2002,2003,2009 Free Software Foundation, Inc. +# Copyright (C) 2002,2003,2009,2012 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -49,8 +49,6 @@ libthread_db-inhibit-o = $(filter-out .os,$(object-suffixes)) # The ps_* callback functions are not defined. libthread_db.so-no-z-defs = yes -distribute = thread_dbP.h shlib-versions proc_service.h \ - db_info.c structs.def db-symbols.h db-symbols.awk include ../Rules # Depend on libc.so so a DT_NEEDED is generated in the shared objects. diff --git a/libc/nscd/Makefile b/libc/nscd/Makefile index aa2cef1f5..0780e112c 100644 --- a/libc/nscd/Makefile +++ b/libc/nscd/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1998,2000,2002-2009,2011 Free Software Foundation, Inc. +# Copyright (C) 1998,2000,2002-2009,2011,2012 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -81,11 +81,6 @@ endif LDLIBS-nscd = $(selinux-LIBS) -distribute := nscd.h nscd-client.h dbg_log.h \ - $(addsuffix .c, $(filter-out xmalloc,$(all-nscd-modules))) \ - nscd.conf nscd.init nscd_proto.h nscd-types.h \ - nis_hash.c - include ../Rules CFLAGS-nscd_getpw_r.c = -fexceptions diff --git a/libc/nss/Makefile b/libc/nss/Makefile index 572fec425..62355ebab 100644 --- a/libc/nss/Makefile +++ b/libc/nss/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1996-1998,2000-2002,2007,2009,2010,2011 +# Copyright (C) 1996-1998,2000-2002,2007,2009,2010,2011,2012 # Free Software Foundation, Inc. # This file is part of the GNU C Library. @@ -24,10 +24,6 @@ include ../option-groups.mak subdir := nss headers := nss.h -distribute := nsswitch.h XXX-lookup.c getXXbyYY.c getXXbyYY_r.c \ - getXXent.c getXXent_r.c databases.def \ - nsswitch.conf digits_dots.c function.def \ - gen-fixed-nsswitch.c # These are the databases that go through nss dispatch. # Caution: if you add a database here, you must add its real name @@ -74,7 +70,6 @@ vpath %.c $(subdir-dirs) ../locale/programs ../intl libnss_files-routines := $(addprefix files-,$(databases-y)) \ files-initgroups files-have_o_cloexec files-init -distribute += files-XXX.c files-parse.c libnss_db-dbs := $(addprefix db-,\ $(filter-out hosts network key alias,\ @@ -83,7 +78,6 @@ libnss_db-dbs := $(addprefix db-,\ libnss_db-routines := $(libnss_db-dbs) db-open db-init hash-string generated += $(filter-out db-alias.c db-netgrp.c, \ $(addsuffix .c,$(libnss_db-dbs))) -distribute += $(addprefix nss_db/, db-XXX.c nss_db.h) install-others += $(inst_vardbdir)/Makefile @@ -165,8 +159,6 @@ $(objpfx)makedb: $(makedb-modules:%=$(objpfx)%.o) $(inst_vardbdir)/Makefile: db-Makefile $(+force) $(do-install) -distribute += nss_test1.c - CFLAGS-nss_test1.c = -DNOT_IN_libc=1 $(objpfx)/libnss_test1.so: $(objpfx)nss_test1.os $(common-objpfx)libc.so \ $(common-objpfx)libc_nonshared.a diff --git a/libc/nss/databases.def b/libc/nss/databases.def index 755fbe201..0247aa963 100644 --- a/libc/nss/databases.def +++ b/libc/nss/databases.def @@ -1,5 +1,5 @@ /* List of all databases defined for the NSS in GNU C Library. - Copyright (C) 1996, 1997, 2005, 2011 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 2005, 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -23,6 +23,7 @@ DEFINE_DATABASE (aliases) DEFINE_DATABASE (ethers) DEFINE_DATABASE (group) +DEFINE_DATABASE (gshadow) DEFINE_DATABASE (hosts) DEFINE_DATABASE (initgroups) DEFINE_DATABASE (netgroup) diff --git a/libc/po/Makefile b/libc/po/Makefile index 7f523eeb3..4ca0d1c4d 100644 --- a/libc/po/Makefile +++ b/libc/po/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1996-1999,2001,2002,2006,2007,2009,2011 +# Copyright (C) 1996-1999,2001,2002,2006,2007,2009,2011,2012 # Free Software Foundation, Inc. # This file is part of the GNU C Library. @@ -47,10 +47,6 @@ mo-installed = $(inst_msgcatdir)/%/LC_MESSAGES/$(domainname).mo # Files to install: a $(domainname).mo file for each language. install-others = $(LINGUAS:%=$(mo-installed)) -# Files to distribute: all the source and compiled binary translation files. -distribute = $(ALL_LINGUAS:=.po) $(BROKEN_LINGUAS:=.po) $(ALL_LINGUAS:=.mo) \ - libc.pot header.pot - include ../Rules diff --git a/libc/posix/Makefile b/libc/posix/Makefile index 98f816b26..ee2f0e4c4 100644 --- a/libc/posix/Makefile +++ b/libc/posix/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991-2007, 2009, 2010, 2011 Free Software Foundation, Inc. +# Copyright (C) 1991-2007,2009,2010,2011,2012 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -31,13 +31,6 @@ headers := sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h \ bits/sched.h re_comp.h wait.h bits/environments.h cpio.h \ sys/sysmacros.h spawn.h bits/unistd.h -distribute := confstr.h TESTS TESTS2C.sed testcases.h \ - PTESTS PTESTS2C.sed ptestcases.h \ - globtest.c globtest.sh wordexp-tst.sh annexc.c fnmatch_loop.c \ - spawn_int.h tst-getconf.sh regcomp.c regexec.c regex_internal.c \ - regex_internal.h fork.h rxspencer/tests rxspencer/COPYRIGHT \ - PCRE.tests BOOST.tests - routines := \ uname \ times \ diff --git a/libc/resolv/Makefile b/libc/resolv/Makefile index 67eeeb383..288f679f5 100644 --- a/libc/resolv/Makefile +++ b/libc/resolv/Makefile @@ -27,8 +27,6 @@ headers := resolv.h \ netdb.h bits/netdb.h \ arpa/nameser.h arpa/nameser_compat.h \ sys/bitypes.h -distribute := ../conf/portability.h mapv4v6addr.h mapv4v6hostent.h \ - Banner res_hconf.h res_debug.h README gai_misc.h ga_test.c routines-$(OPTION_EGLIBC_INET) \ += herror inet_addr inet_ntop inet_pton nsap_addr res_init \ diff --git a/libc/rt/Makefile b/libc/rt/Makefile index a355f71a2..1ad2015dd 100644 --- a/libc/rt/Makefile +++ b/libc/rt/Makefile @@ -53,8 +53,6 @@ tests := tst-shm tst-clock tst-clock_nanosleep tst-timer tst-timer2 \ extra-libs := librt extra-libs-others := $(extra-libs) -distribute := aio_misc.h - include ../Rules CFLAGS-aio_suspend.c = -fexceptions diff --git a/libc/signal/Makefile b/libc/signal/Makefile index 4cf886cd7..9da859984 100644 --- a/libc/signal/Makefile +++ b/libc/signal/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991-1998,2003,2006 Free Software Foundation, Inc. +# Copyright (C) 1991-1998,2003,2006,2012 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -38,8 +38,6 @@ routines := signal raise killpg \ tests := tst-signal tst-sigset tst-sigsimple tst-raise tst-sigset2 -distribute := sigsetops.h testrtsig.h sigset-cvt-mask.h - include ../Rules diff --git a/libc/socket/Makefile b/libc/socket/Makefile index b5be39a67..e3a90b8a3 100644 --- a/libc/socket/Makefile +++ b/libc/socket/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991,1995-2001,2005,2008 Free Software Foundation, Inc. +# Copyright (C) 1991,1995-2001,2005,2008,2012 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -30,6 +30,4 @@ routines := accept bind connect getpeername getsockname getsockopt \ aux := have_sock_cloexec -distribute := ifreq.h - include ../Rules diff --git a/libc/soft-fp/Makefile b/libc/soft-fp/Makefile index 11464dfac..88ee6c5cb 100644 --- a/libc/soft-fp/Makefile +++ b/libc/soft-fp/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc. +# Copyright (C) 1997, 1999, 2000, 2012 Free Software Foundation, Inc. # This file is part of the GNU C Library. # @@ -35,10 +35,4 @@ gcc-quad-routines := negtf2 addtf3 subtf3 multf3 divtf3 eqtf2 \ fixunstfdi floatditf extendsftf2 trunctfsf2 extenddftf2 \ trunctfdf2 sqrttf2 floatunsitf floatunditf -distribute := double.h op-1.h op-2.h op-4.h op-common.h quad.h \ - single.h soft-fp.h extended.h Banner op-8.h testit.c \ - $(addsuffix .c,$(gcc-single-routines)) \ - $(addsuffix .c,$(gcc-double-routines)) \ - $(addsuffix .c,$(gcc-quad-routines)) - include ../Rules diff --git a/libc/stdio-common/Makefile b/libc/stdio-common/Makefile index efe19feab..a5884a7b3 100644 --- a/libc/stdio-common/Makefile +++ b/libc/stdio-common/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991-2009, 2011 Free Software Foundation, Inc. +# Copyright (C) 1991-2009, 2011, 2012 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -52,8 +52,6 @@ install-headers-nosubdir: $(inst_includedir)/bits/stdio_lim.h aux := errlist siglist printf-parsemb fxprintf aux-$(OPTION_POSIX_C_LANG_WIDE_CHAR) += printf-parsewc -distribute := _itoa.h _itowa.h _i18n_number.h \ - printf-parse.h stdio_lim.h.in tst-unbputc.sh tst-printf.sh tests := tstscanf test_rdwr test-popen tstgetln test-fseek \ temptest tst-fileno test-fwrite tst-ungetc tst-ferror \ @@ -67,11 +65,11 @@ tests := tstscanf test_rdwr test-popen tstgetln test-fseek \ 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 \ - tst-setvbuf1 bug23 bug24 + tst-setvbuf1 bug23 bug24 bug-vfprintf-nargs tests-$(OPTION_EGLIBC_LOCALE_CODE) \ += tst-sscanf tst-swprintf bug15 test-vfprintf bug14 scanf13 tst-grouping tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \ - += tst-perror bug19a bug20 + += tst-perror bug19a bug20 tst-long-dbl-fphex tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \ += bug18a tst-swscanf tst-wc-printf diff --git a/libc/stdio-common/bug-vfprintf-nargs.c b/libc/stdio-common/bug-vfprintf-nargs.c new file mode 100644 index 000000000..13c66c048 --- /dev/null +++ b/libc/stdio-common/bug-vfprintf-nargs.c @@ -0,0 +1,78 @@ +/* Test for vfprintf nargs allocation overflow (BZ #13656). + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Kees Cook <keescook@chromium.org>, 2012. + + 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 <stdio.h> +#include <stdlib.h> +#include <stdint.h> +#include <unistd.h> +#include <inttypes.h> +#include <string.h> +#include <signal.h> + +static int +format_failed (const char *fmt, const char *expected) +{ + char output[80]; + + printf ("%s : ", fmt); + + memset (output, 0, sizeof output); + /* Having sprintf itself detect a failure is good. */ + if (sprintf (output, fmt, 1, 2, 3, "test") > 0 + && strcmp (output, expected) != 0) + { + printf ("FAIL (output '%s' != expected '%s')\n", output, expected); + return 1; + } + puts ("ok"); + return 0; +} + +static int +do_test (void) +{ + int rc = 0; + char buf[64]; + + /* Regular positionals work. */ + if (format_failed ("%1$d", "1") != 0) + rc = 1; + + /* Regular width positionals work. */ + if (format_failed ("%1$*2$d", " 1") != 0) + rc = 1; + + /* Positional arguments are constructed via read_int, so nargs can only + overflow on 32-bit systems. On 64-bit systems, it will attempt to + allocate a giant amount of memory and possibly crash, which is the + expected situation. Since the 64-bit behavior is arch-specific, only + test this on 32-bit systems. */ + if (sizeof (long int) == 4) + { + sprintf (buf, "%%1$d %%%" PRIdPTR "$d", UINT32_MAX / sizeof (int)); + if (format_failed (buf, "1 %$d") != 0) + rc = 1; + } + + return rc; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/libc/stdio-common/tst-long-dbl-fphex.c b/libc/stdio-common/tst-long-dbl-fphex.c new file mode 100644 index 000000000..b57fb85ad --- /dev/null +++ b/libc/stdio-common/tst-long-dbl-fphex.c @@ -0,0 +1,38 @@ +/* This file is part of the GNU C Library. + Copyright (C) 2012 Free Software Foundation, Inc. + Contributed by Marek Polacek <polacek@redhat.com>, 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <wchar.h> + +/* Prototype for our test function. */ +static int do_test (void); + +static int +do_test (void) +{ + const long double x = 24.5; + wchar_t a[16 * sizeof (wchar_t)]; + swprintf (a, 16 * sizeof (wchar_t), L"%La\n", x); + wchar_t A[16 * sizeof (wchar_t)]; + swprintf (A, 16 * sizeof (wchar_t), L"%LA\n", x); + + return (wmemcmp (a, L"0xc.4p+1", 8) != 0 + || wmemcmp (A, L"0XC.4P+1", 8) != 0); +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/libc/stdio-common/vfprintf.c b/libc/stdio-common/vfprintf.c index 1bd49a942..b04e95dc9 100644 --- a/libc/stdio-common/vfprintf.c +++ b/libc/stdio-common/vfprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2008, 2009, 2010, 2011 Free Software Foundation, Inc. +/* Copyright (C) 1991-2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -248,6 +248,9 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) 0 if unknown. */ int readonly_format = 0; + /* For the argument descriptions, which may be allocated on the heap. */ + void *args_malloced = NULL; + /* This table maps a character into a number representing a class. In each step there is a destination label for each class. */ @@ -832,7 +835,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) \ if (function_done < 0) \ { \ - /* Error in print handler. */ \ + /* Error in print handler; up to handler to set errno. */ \ done = -1; \ goto all_done; \ } \ @@ -886,7 +889,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) \ if (function_done < 0) \ { \ - /* Error in print handler. */ \ + /* Error in print handler; up to handler to set errno. */ \ done = -1; \ goto all_done; \ } \ @@ -1131,7 +1134,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) &mbstate); \ if (len == (size_t) -1) \ { \ - /* Something went wron gduring the conversion. Bail out. */ \ + /* Something went wrong during the conversion. Bail out. */ \ done = -1; \ goto all_done; \ } \ @@ -1203,6 +1206,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) if (__mbsnrtowcs (ignore, &str2, strend - str2, \ ignore_size, &ps) == (size_t) -1) \ { \ + /* Conversion function has set errno. */ \ done = -1; \ goto all_done; \ } \ @@ -1623,6 +1627,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) if (spec == L_('\0')) { /* The format string ended before the specifier is complete. */ + __set_errno (EINVAL); done = -1; goto all_done; } @@ -1668,9 +1673,10 @@ do_positional: determine the size of the array needed to store the argument attributes. */ size_t nargs = 0; - int *args_type; - union printf_arg *args_value = NULL; + size_t bytes_per_arg; + union printf_arg *args_value; int *args_size; + int *args_type; /* Positional parameters refer to arguments directly. This could also determine the maximum number of arguments. Track the @@ -1721,13 +1727,38 @@ do_positional: /* Determine the number of arguments the format string consumes. */ nargs = MAX (nargs, max_ref_arg); + /* Calculate total size needed to represent a single argument across + all three argument-related arrays. */ + bytes_per_arg = (sizeof (*args_value) + sizeof (*args_size) + + sizeof (*args_type)); + + /* Check for potential integer overflow. */ + if (__builtin_expect (nargs > SIZE_MAX / bytes_per_arg, 0)) + { + __set_errno (ERANGE); + done = -1; + goto all_done; + } + + /* Allocate memory for all three argument arrays. */ + if (__libc_use_alloca (nargs * bytes_per_arg)) + args_value = alloca (nargs * bytes_per_arg); + else + { + args_value = args_malloced = malloc (nargs * bytes_per_arg); + if (args_value == NULL) + { + done = -1; + goto all_done; + } + } - /* Allocate memory for the argument descriptions. */ - args_type = alloca (nargs * sizeof (int)); + /* Set up the remaining two arrays to each point past the end of the + prior array, since space for all three has been allocated now. */ + args_size = &args_value[nargs].pa_int; + args_type = &args_size[nargs]; memset (args_type, s->_flags2 & _IO_FLAGS2_FORTIFY ? '\xff' : '\0', - nargs * sizeof (int)); - args_value = alloca (nargs * sizeof (union printf_arg)); - args_size = alloca (nargs * sizeof (int)); + nargs * sizeof (*args_type)); /* XXX Could do sanity check here: If any element in ARGS_TYPE is still zero after this loop, format is invalid. For now we @@ -1942,6 +1973,7 @@ do_positional: about # of chars. */ if (function_done < 0) { + /* Function has set errno. */ done = -1; goto all_done; } @@ -1976,6 +2008,7 @@ do_positional: of chars. */ if (function_done < 0) { + /* Function has set errno. */ done = -1; goto all_done; } @@ -1996,8 +2029,8 @@ do_positional: } all_done: - if (__builtin_expect (workstart != NULL, 0)) - free (workstart); + free (args_malloced); + free (workstart); /* Unlock the stream. */ _IO_funlockfile (s); _IO_cleanup_region_end (0); diff --git a/libc/stdlib/Makefile b/libc/stdlib/Makefile index b6c97aeb2..2200dd07d 100644 --- a/libc/stdlib/Makefile +++ b/libc/stdlib/Makefile @@ -69,8 +69,6 @@ aux = grouping groupingwc tens_in_limb # linked against when the shared library will be used. static-only-routines = atexit at_quick_exit -distribute := exit.h grouping.h abort-instr.h isomac.c tst-fmtmsg.sh \ - allocalim.h test-srcs-$(OPTION_EGLIBC_FMTMSG) := tst-fmtmsg tests := tst-strtol tst-strtod testrand testsort testdiv \ test-canon test-canon2 tst-strtoll tst-environ \ @@ -99,7 +97,6 @@ routines := $(strip $(routines) $(mpn-routines)) \ dbl2mpn ldbl2mpn \ mpn2flt mpn2dbl mpn2ldbl aux += fpioconst mp_clz_tab -distribute := $(distribute) $(mpn-headers) fpioconst.h tst-putenvmod.c tests-extras += tst-putenvmod extra-test-objs += tst-putenvmod.os diff --git a/libc/stdlib/tst-strtod.c b/libc/stdlib/tst-strtod.c index b4cf347e4..5b3cd0cdf 100644 --- a/libc/stdlib/tst-strtod.c +++ b/libc/stdlib/tst-strtod.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,1996-2001,2003,2009,2011 Free Software Foundation, Inc. +/* Copyright (C) 1991-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -65,12 +65,9 @@ static const struct ltest tests[] = { "0x0.8p-1022", 1.11253692925360069154511635866620203210960799023116591527666e-308, '\0', ERANGE }, -#if __GNUC_PREREQ(2,96) - /* For older GCC release HUGE_VAL is not a constant. */ { "Inf", HUGE_VAL, '\0', 0 }, { "-Inf", -HUGE_VAL, '\0', 0 }, { "+InFiNiTy", HUGE_VAL, '\0', 0 }, -#endif { "0x80000Ap-23", 0x80000Ap-23, '\0', 0 }, { "1e-324", 0, '\0', ERANGE }, { NULL, 0, '\0', 0 } diff --git a/libc/string/Makefile b/libc/string/Makefile index 0676e85be..9825a1b58 100644 --- a/libc/string/Makefile +++ b/libc/string/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991-2002, 2005-2010, 2011 Free Software Foundation, Inc. +# Copyright (C) 1991-2002, 2005-2011, 2012 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -63,8 +63,6 @@ tests := tester inl-tester noinl-tester testcopy test-ffs \ tests-$(OPTION_EGLIBC_ENVZ) += bug-envz1 tests-$(OPTION_EGLIBC_LOCALE_CODE) \ += tst-strxfrm bug-strcoll1 -distribute := memcopy.h pagecopy.h tst-svc.expect test-string.h \ - str-two-way.h include ../Rules diff --git a/libc/sunrpc/Makefile b/libc/sunrpc/Makefile index 44f204226..ff57aede4 100644 --- a/libc/sunrpc/Makefile +++ b/libc/sunrpc/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1994-2004, 2005, 2006, 2011 Free Software Foundation, Inc. +# Copyright (C) 1994-2006, 2011, 2012 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -96,11 +96,6 @@ install-bin-$(OPTION_EGLIBC_SUNRPC) += rpcgen rpcgen-objs = rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o \ rpc_scan.o rpc_util.o rpc_svcout.o rpc_clntout.o \ rpc_tblout.o rpc_sample.o -# These headers are part of rpcgen. -distribute := proto.h rpc_util.h rpc_parse.h rpc_scan.h \ - $(headers-in-tirpc) $(headers-not-in-tirpc) \ - $(rpcgen-objs:.o=.c) etc.rpc \ - errqueue.h extra-objs-$(OPTION_EGLIBC_SUNRPC) += $(rpcgen-objs) all: # Make this the default target; it will be defined in Rules. @@ -113,7 +108,6 @@ xtests-$(OPTION_EGLIBC_SUNRPC) := tst-getmyaddr ifeq ($(have-thread-library),yes) xtests-$(OPTION_EGLIBC_SUNRPC) += thrsvc endif -distribute += thrsvc.c ifeq (yes,$(build-static-nss)) otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ diff --git a/libc/sysdeps/generic/dl-osinfo.h b/libc/sysdeps/generic/dl-osinfo.h index 2eaab3b76..548fc4666 100644 --- a/libc/sysdeps/generic/dl-osinfo.h +++ b/libc/sysdeps/generic/dl-osinfo.h @@ -30,8 +30,8 @@ _dl_setup_stack_chk_guard (void *dl_random) if (dl_random == NULL) { - ret.bytes[sizeof (ret) - 2] = 255; - ret.bytes[sizeof (ret) - 3] = '\n'; + ret.bytes[sizeof (ret) - 1] = 255; + ret.bytes[sizeof (ret) - 2] = '\n'; } else { diff --git a/libc/sysdeps/i386/fpu/libm-test-ulps b/libc/sysdeps/i386/fpu/libm-test-ulps index cb22d4565..977a3abd1 100644 --- a/libc/sysdeps/i386/fpu/libm-test-ulps +++ b/libc/sysdeps/i386/fpu/libm-test-ulps @@ -28,13 +28,147 @@ ildouble: 2 ldouble: 1 # cacos +Test "Imaginary part of: cacos (+0 + 0.5 i) == pi/2 - 0.4812118250596034474977589134243684231352 i": +double: 2 +idouble: 2 +Test "Imaginary part of: cacos (+0 + 1.0 i) == pi/2 - 0.8813735870195430252326093249797923090282 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: cacos (+0 + 1.5 i) == pi/2 - 1.194763217287109304111930828519090523536 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Imaginary part of: cacos (+0 - 0.5 i) == pi/2 + 0.4812118250596034474977589134243684231352 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (+0 - 1.0 i) == pi/2 + 0.8813735870195430252326093249797923090282 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (+0 - 1.5 i) == pi/2 + 1.194763217287109304111930828519090523536 i": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0 + 0.5 i) == pi/2 - 0.4812118250596034474977589134243684231352 i": +double: 2 +idouble: 2 +Test "Imaginary part of: cacos (-0 + 1.0 i) == pi/2 - 0.8813735870195430252326093249797923090282 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: cacos (-0 + 1.5 i) == pi/2 - 1.194763217287109304111930828519090523536 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Imaginary part of: cacos (-0 - 0.5 i) == pi/2 + 0.4812118250596034474977589134243684231352 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0 - 1.0 i) == pi/2 + 0.8813735870195430252326093249797923090282 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0 - 1.5 i) == pi/2 + 1.194763217287109304111930828519090523536 i": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-1.5 + +0 i) == pi - 0.9624236501192068949955178268487368462704 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-1.5 - 0 i) == pi + 0.9624236501192068949955178268487368462704 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0.5 + +0 i) == 1.047197551196597746154214461093167628066 - 0 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0.5 - 0 i) == 1.047197551196597746154214461093167628066 + +0 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 Test "Imaginary part of: cacos (0.75 + 1.25 i) == 1.11752014915610270578240049553777969 - 1.13239363160530819522266333696834467 i": float: 1 ifloat: 1 ildouble: 2 ldouble: 2 +Test "Imaginary part of: cacos (1.5 + +0 i) == +0 - 0.9624236501192068949955178268487368462704 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (1.5 - 0 i) == +0 + 0.9624236501192068949955178268487368462704 i": +ildouble: 1 +ldouble: 1 # cacosh +Test "Real part of: cacosh (+0 + 0.5 i) == 0.4812118250596034474977589134243684231352 + pi/2 i": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (+0 + 1.0 i) == 0.8813735870195430252326093249797923090282 + pi/2 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (+0 + 1.5 i) == 1.194763217287109304111930828519090523536 + pi/2 i": +double: 1 +idouble: 1 +Test "Real part of: cacosh (+0 - 0.5 i) == 0.4812118250596034474977589134243684231352 - pi/2 i": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (+0 - 1.0 i) == 0.8813735870195430252326093249797923090282 - pi/2 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (+0 - 1.5 i) == 1.194763217287109304111930828519090523536 - pi/2 i": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0 + 0.5 i) == 0.4812118250596034474977589134243684231352 + pi/2 i": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0 + 1.0 i) == 0.8813735870195430252326093249797923090282 + pi/2 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (-0 + 1.5 i) == 1.194763217287109304111930828519090523536 + pi/2 i": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0 - 0.5 i) == 0.4812118250596034474977589134243684231352 - pi/2 i": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0 - 1.0 i) == 0.8813735870195430252326093249797923090282 - pi/2 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (-0 - 1.5 i) == 1.194763217287109304111930828519090523536 - pi/2 i": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (-0.5 + +0 i) == +0 + 2.094395102393195492308428922186335256131 i": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (-0.5 - 0 i) == +0 - 2.094395102393195492308428922186335256131 i": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-1.5 + +0 i) == 0.9624236501192068949955178268487368462704 + pi i": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-1.5 - 0 i) == 0.9624236501192068949955178268487368462704 - pi i": +float: 1 +ifloat: 1 Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": double: 1 float: 9 @@ -52,8 +186,74 @@ ldouble: 1 Test "Real part of: cacosh (0.75 + 1.25 i) == 1.13239363160530819522266333696834467 + 1.11752014915610270578240049553777969 i": ildouble: 1 ldouble: 1 +Test "Real part of: cacosh (1.5 + +0 i) == 0.9624236501192068949955178268487368462704 + +0 i": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (1.5 - 0 i) == 0.9624236501192068949955178268487368462704 - 0 i": +float: 1 +ifloat: 1 # casin +Test "Imaginary part of: casin (+0 + 0.5 i) == +0 + 0.4812118250596034474977589134243684231352 i": +double: 2 +idouble: 2 +Test "Imaginary part of: casin (+0 + 1.0 i) == +0 + 0.8813735870195430252326093249797923090282 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: casin (+0 + 1.5 i) == +0 + 1.194763217287109304111930828519090523536 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Imaginary part of: casin (+0 - 0.5 i) == +0 - 0.4812118250596034474977589134243684231352 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (+0 - 1.0 i) == +0 - 0.8813735870195430252326093249797923090282 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (+0 - 1.5 i) == +0 - 1.194763217287109304111930828519090523536 i": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0 + 0.5 i) == -0 + 0.4812118250596034474977589134243684231352 i": +double: 2 +idouble: 2 +Test "Imaginary part of: casin (-0 + 1.0 i) == -0 + 0.8813735870195430252326093249797923090282 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: casin (-0 + 1.5 i) == -0 + 1.194763217287109304111930828519090523536 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Imaginary part of: casin (-0 - 0.5 i) == -0 - 0.4812118250596034474977589134243684231352 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0 - 1.0 i) == -0 - 0.8813735870195430252326093249797923090282 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0 - 1.5 i) == -0 - 1.194763217287109304111930828519090523536 i": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-1.5 + +0 i) == -pi/2 + 0.9624236501192068949955178268487368462704 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-1.5 - 0 i) == -pi/2 - 0.9624236501192068949955178268487368462704 i": +ildouble: 1 +ldouble: 1 Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i": double: 1 float: 1 @@ -66,8 +266,62 @@ float: 1 ifloat: 1 ildouble: 2 ldouble: 2 +Test "Imaginary part of: casin (1.5 + +0 i) == pi/2 + 0.9624236501192068949955178268487368462704 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (1.5 - 0 i) == pi/2 - 0.9624236501192068949955178268487368462704 i": +ildouble: 1 +ldouble: 1 # casinh +Test "Real part of: casinh (+0 + 1.5 i) == 0.9624236501192068949955178268487368462704 + pi/2 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (+0 - 1.5 i) == 0.9624236501192068949955178268487368462704 - pi/2 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0 + 1.5 i) == -0.9624236501192068949955178268487368462704 + pi/2 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-0 - 1.5 i) == -0.9624236501192068949955178268487368462704 - pi/2 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 + +0 i) == -0.4812118250596034474977589134243684231352 + +0 i": +double: 2 +idouble: 2 +Test "Real part of: casinh (-0.5 - 0 i) == -0.4812118250596034474977589134243684231352 - 0 i": +double: 2 +idouble: 2 +Test "Real part of: casinh (-1.0 + +0 i) == -0.8813735870195430252326093249797923090282 + +0 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Real part of: casinh (-1.0 - 0 i) == -0.8813735870195430252326093249797923090282 - 0 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Real part of: casinh (-1.5 + +0 i) == -1.194763217287109304111930828519090523536 + +0 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Real part of: casinh (-1.5 - 0 i) == -1.194763217287109304111930828519090523536 - 0 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i": double: 5 float: 1 @@ -82,6 +336,12 @@ idouble: 3 ifloat: 6 ildouble: 5 ldouble: 5 +Test "Real part of: casinh (0.5 + +0 i) == 0.4812118250596034474977589134243684231352 + +0 i": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 - 0 i) == 0.4812118250596034474977589134243684231352 - 0 i": +float: 1 +ifloat: 1 Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i": float: 1 ifloat: 1 @@ -92,6 +352,22 @@ idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 +Test "Real part of: casinh (1.0 + +0 i) == 0.8813735870195430252326093249797923090282 + +0 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (1.0 - 0 i) == 0.8813735870195430252326093249797923090282 - 0 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (1.5 + +0 i) == 1.194763217287109304111930828519090523536 + +0 i": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.5 - 0 i) == 1.194763217287109304111930828519090523536 - 0 i": +double: 1 +idouble: 1 # catan Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i": @@ -322,6 +598,9 @@ ldouble: 1 Test "cos_tonearest (8) == -0.1455000338086135258688413818311946826093": ildouble: 1 ldouble: 1 +Test "cos_tonearest (9) == -0.9111302618846769883682947111811653112463": +ildouble: 1 +ldouble: 1 # cos_towardzero Test "cos_towardzero (1) == 0.5403023058681397174009366074429766037323": @@ -408,6 +687,42 @@ ifloat: 1 Test "cosh (0.75) == 1.29468328467684468784170818539018176": ildouble: 1 +# cosh_downward +Test "cosh_downward (22) == 1792456423.065795780980053377632656584997": +double: 1 +float: 1 +ldouble: 2 +Test "cosh_downward (23) == 4872401723.124451300068625740569997090344": +double: 1 +float: 1 +ldouble: 1 +Test "cosh_downward (24) == 13244561064.92173614708845674912733665919": +float: 1 +ldouble: 1 + +# cosh_tonearest +Test "cosh_tonearest (22) == 1792456423.065795780980053377632656584997": +ldouble: 1 + +# cosh_towardzero +Test "cosh_towardzero (22) == 1792456423.065795780980053377632656584997": +double: 1 +float: 1 +ldouble: 2 +Test "cosh_towardzero (23) == 4872401723.124451300068625740569997090344": +double: 1 +float: 1 +ldouble: 1 +Test "cosh_towardzero (24) == 13244561064.92173614708845674912733665919": +float: 1 +ldouble: 1 + +# cosh_upward +Test "cosh_upward (23) == 4872401723.124451300068625740569997090344": +ldouble: 1 +Test "cosh_upward (24) == 13244561064.92173614708845674912733665919": +double: 1 + # cpow Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i": float: 1 @@ -897,6 +1212,42 @@ ifloat: 1 ildouble: 1 ldouble: 1 +# pow_downward +Test "pow_downward (1.0625, 1.125) == 1.070582293028761362162622578677070098674": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "pow_downward (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# pow_towardzero +Test "pow_towardzero (1.0625, 1.125) == 1.070582293028761362162622578677070098674": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "pow_towardzero (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# pow_upward +Test "pow_upward (1.0625, 1.125) == 1.070582293028761362162622578677070098674": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "pow_upward (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + # sin_downward Test "sin_downward (1) == 0.8414709848078965066525023216302989996226": ildouble: 1 @@ -950,6 +1301,9 @@ ldouble: 1 Test "sin_tonearest (4) == -0.7568024953079282513726390945118290941359": ildouble: 1 ldouble: 1 +Test "sin_tonearest (9) == 0.4121184852417565697562725663524351793439": +ildouble: 1 +ldouble: 1 # sin_towardzero Test "sin_towardzero (1) == 0.8414709848078965066525023216302989996226": @@ -1052,6 +1406,58 @@ Test "sinh (0.75) == 0.822316731935829980703661634446913849": double: 1 ildouble: 1 +# sinh_downward +Test "sinh_downward (22) == 1792456423.065795780701106568345764104225": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ldouble: 4 +Test "sinh_downward (23) == 4872401723.124451299966006944252978187305": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "sinh_downward (24) == 13244561064.92173614705070540368454568168": +float: 1 +ifloat: 1 +ldouble: 5 + +# sinh_tonearest +Test "sinh_tonearest (22) == 1792456423.065795780701106568345764104225": +ldouble: 3 +Test "sinh_tonearest (23) == 4872401723.124451299966006944252978187305": +ldouble: 1 +Test "sinh_tonearest (24) == 13244561064.92173614705070540368454568168": +ldouble: 6 + +# sinh_towardzero +Test "sinh_towardzero (22) == 1792456423.065795780701106568345764104225": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ldouble: 4 +Test "sinh_towardzero (23) == 4872401723.124451299966006944252978187305": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "sinh_towardzero (24) == 13244561064.92173614705070540368454568168": +float: 1 +ifloat: 1 +ldouble: 5 + +# sinh_upward +Test "sinh_upward (22) == 1792456423.065795780701106568345764104225": +ldouble: 16 +Test "sinh_upward (23) == 4872401723.124451299966006944252978187305": +ldouble: 27 +Test "sinh_upward (24) == 13244561064.92173614705070540368454568168": +double: 1 +idouble: 1 +ldouble: 7 + # tan Test "tan (pi/4) == 1": double: 1 @@ -1081,6 +1487,9 @@ float: 1 ifloat: 1 ildouble: 1 ldouble: 1 +Test "tan_downward (5) == -3.3805150062465856369827058794473439087096": +ildouble: 1 +ldouble: 1 Test "tan_downward (6) == -0.2910061913847491570536995888681755428312": double: 1 float: 1 @@ -1130,6 +1539,8 @@ ldouble: 1 Test "tan_towardzero (3) == -0.1425465430742778052956354105339134932261": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Test "tan_towardzero (4) == 1.1578212823495775831373424182673239231198": float: 1 ifloat: 1 @@ -1174,6 +1585,8 @@ ldouble: 1 Test "tan_upward (3) == -0.1425465430742778052956354105339134932261": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Test "tan_upward (4) == 1.1578212823495775831373424182673239231198": double: 1 idouble: 1 @@ -1395,6 +1808,10 @@ idouble: 1 ifloat: 1 # Maximal error of functions: +Function: "acos": +ildouble: 1 +ldouble: 1 + Function: "asin": ildouble: 1 ldouble: 1 @@ -1403,8 +1820,16 @@ Function: "atanh": ildouble: 2 ldouble: 1 +Function: Real part of "cacos": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + Function: Imaginary part of "cacos": +double: 2 float: 1 +idouble: 2 ifloat: 1 ildouble: 2 ldouble: 2 @@ -1434,7 +1859,9 @@ ildouble: 2 ldouble: 2 Function: Imaginary part of "casin": +double: 2 float: 1 +idouble: 2 ifloat: 1 ildouble: 2 ldouble: 2 @@ -1568,6 +1995,23 @@ ldouble: 1 Function: "cosh": ildouble: 1 +Function: "cosh_downward": +double: 1 +float: 1 +ldouble: 2 + +Function: "cosh_tonearest": +ldouble: 1 + +Function: "cosh_towardzero": +double: 1 +float: 1 +ldouble: 2 + +Function: "cosh_upward": +double: 1 +ldouble: 1 + Function: Real part of "cpow": double: 1 float: 4 @@ -1733,6 +2177,30 @@ ifloat: 1 ildouble: 1 ldouble: 1 +Function: "pow_downward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "pow_towardzero": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "pow_upward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + Function: "sin_downward": double: 1 float: 1 @@ -1773,6 +2241,28 @@ Function: "sinh": double: 1 ildouble: 1 +Function: "sinh_downward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ldouble: 5 + +Function: "sinh_tonearest": +ldouble: 6 + +Function: "sinh_towardzero": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ldouble: 5 + +Function: "sinh_upward": +double: 1 +idouble: 1 +ldouble: 27 + Function: "tan": double: 1 idouble: 1 diff --git a/libc/sysdeps/i386/i486/bits/atomic.h b/libc/sysdeps/i386/i486/bits/atomic.h index b633ce984..b59a556db 100644 --- a/libc/sysdeps/i386/i486/bits/atomic.h +++ b/libc/sysdeps/i386/i486/bits/atomic.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2004,2006,2007,2009,2011 Free Software Foundation, Inc. +/* Copyright (C) 2002-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -55,33 +55,10 @@ typedef uintmax_t uatomic_max_t; #endif -#if __GNUC_PREREQ (4, 1) -# define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \ +#define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \ __sync_val_compare_and_swap (mem, oldval, newval) -# define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \ +#define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \ (! __sync_bool_compare_and_swap (mem, oldval, newval)) -#else -# define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK_PREFIX "cmpxchgb %b2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "q" (newval), "m" (*mem), "0" (oldval)); \ - ret; }) - -# define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK_PREFIX "cmpxchgw %w2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "r" (newval), "m" (*mem), "0" (oldval)); \ - ret; }) - -# define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK_PREFIX "cmpxchgl %2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "r" (newval), "m" (*mem), "0" (oldval)); \ - ret; }) -#endif #define __arch_c_compare_and_exchange_val_8_acq(mem, newval, oldval) \ @@ -254,13 +231,8 @@ typedef uintmax_t uatomic_max_t; } \ __result; }) -#if __GNUC_PREREQ (4, 1) -# define atomic_exchange_and_add(mem, value) \ +#define atomic_exchange_and_add(mem, value) \ __sync_fetch_and_add (mem, value) -#else -# define atomic_exchange_and_add(mem, value) \ - __arch_exchange_and_add_body (LOCK_PREFIX, __arch, mem, value) -#endif #define __arch_exchange_and_add_cprefix \ "cmpl $0, %%gs:%P4\n\tje 0f\n\tlock\n0:\t" diff --git a/libc/sysdeps/ieee754/dbl-64/e_pow.c b/libc/sysdeps/ieee754/dbl-64/e_pow.c index 28435fd36..f668b4b5f 100644 --- a/libc/sysdeps/ieee754/dbl-64/e_pow.c +++ b/libc/sysdeps/ieee754/dbl-64/e_pow.c @@ -1,7 +1,7 @@ /* * IBM Accurate Mathematical Library * written by International Business Machines Corp. - * Copyright (C) 2001, 2002, 2004, 2011 Free Software Foundation + * Copyright (C) 2001-2012 Free Software Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -41,6 +41,7 @@ #include "MathLib.h" #include "upow.tbl" #include "math_private.h" +#include <fenv.h> #ifndef SECTION # define SECTION @@ -84,6 +85,11 @@ __ieee754_pow(double x, double y) { (u.i[HIGH_HALF]==0 && u.i[LOW_HALF]!=0)) && /* 2^-1023< x<= 2^-1023 * 0x1.0000ffffffff */ (v.i[HIGH_HALF]&0x7fffffff) < 0x4ff00000) { /* if y<-1 or y>1 */ + fenv_t env; + double retval; + + libc_feholdexcept_setround (&env, FE_TONEAREST); + z = log1(x,&aa,&error); /* x^y =e^(y log (X)) */ t = y*134217729.0; y1 = t - (t-y); @@ -97,7 +103,10 @@ __ieee754_pow(double x, double y) { a2 = (a-a1)+aa; error = error*ABS(y); t = __exp1(a1,a2,1.9e16*error); /* return -10 or 0 if wasn't computed exactly */ - return (t>0)?t:power1(x,y); + retval = (t>0)?t:power1(x,y); + + libc_feupdateenv (&env); + return retval; } if (x == 0) { diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_coshl.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_coshl.c index ebc943639..569b8418b 100644 --- a/libc/sysdeps/ieee754/ldbl-128ibm/e_coshl.c +++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_coshl.c @@ -20,9 +20,9 @@ * 2*exp(x) * * exp(x) + 1/exp(x) - * ln2/2 <= x <= 22 : cosh(x) := ------------------- + * ln2/2 <= x <= 40 : cosh(x) := ------------------- * 2 - * 22 <= x <= lnovft : cosh(x) := exp(x)/2 + * 40 <= x <= lnovft : cosh(x) := exp(x)/2 * lnovft <= x <= ln2ovft: cosh(x) := exp(x/2)/2 * exp(x/2) * ln2ovft < x : cosh(x) := huge*huge (overflow) * @@ -57,13 +57,13 @@ __ieee754_coshl (long double x) return one+(t*t)/(w+w); } - /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */ - if (ix < 0x4036000000000000LL) { + /* |x| in [0.5*ln2,40], return (exp(|x|)+1/exp(|x|)/2; */ + if (ix < 0x4044000000000000LL) { t = __ieee754_expl(fabsl(x)); return half*t+half/t; } - /* |x| in [22, log(maxdouble)] return half*exp(|x|) */ + /* |x| in [40, log(maxdouble)] return half*exp(|x|) */ if (ix < 0x40862e42fefa39efLL) return half*__ieee754_expl(fabsl(x)); /* |x| in [log(maxdouble), overflowthresold] */ diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c index b8e86b1a6..4b53d90c9 100644 --- a/libc/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c +++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c @@ -16,10 +16,10 @@ * 1. Replace x by |x| (sinh(-x) = -sinh(x)). * 2. * E + E/(E+1) - * 0 <= x <= 22 : sinh(x) := --------------, E=expm1(x) + * 0 <= x <= 40 : sinh(x) := --------------, E=expm1(x) * 2 * - * 22 <= x <= lnovft : sinh(x) := exp(x)/2 + * 40 <= x <= lnovft : sinh(x) := exp(x)/2 * lnovft <= x <= ln2ovft: sinh(x) := exp(x/2)/2 * exp(x/2) * ln2ovft < x : sinh(x) := x*shuge (overflow) * @@ -48,8 +48,8 @@ __ieee754_sinhl(long double x) h = 0.5; if (jx<0) h = -h; - /* |x| in [0,22], return sign(x)*0.5*(E+E/(E+1))) */ - if (ix < 0x4036000000000000LL) { /* |x|<22 */ + /* |x| in [0,40], return sign(x)*0.5*(E+E/(E+1))) */ + if (ix < 0x4044000000000000LL) { /* |x|<40 */ if (ix<0x3e20000000000000LL) /* |x|<2**-29 */ if(shuge+x>one) return x;/* sinhl(tiny) = tiny with inexact */ t = __expm1l(fabsl(x)); @@ -57,7 +57,7 @@ __ieee754_sinhl(long double x) return h*(t+t/(t+one)); } - /* |x| in [22, log(maxdouble)] return 0.5*exp(|x|) */ + /* |x| in [40, log(maxdouble)] return 0.5*exp(|x|) */ if (ix < 0x40862e42fefa39efLL) return h*__ieee754_expl(fabsl(x)); /* |x| in [log(maxdouble), overflowthresold] */ diff --git a/libc/sysdeps/ieee754/ldbl-96/printf_fphex.c b/libc/sysdeps/ieee754/ldbl-96/printf_fphex.c index b1c9d7364..acb0508b8 100644 --- a/libc/sysdeps/ieee754/ldbl-96/printf_fphex.c +++ b/libc/sysdeps/ieee754/ldbl-96/printf_fphex.c @@ -1,5 +1,5 @@ /* Print floating point number in hexadecimal notation according to ISO C99. - Copyright (C) 1997, 1998, 1999, 2000, 2005 Free Software Foundation, Inc. + Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -58,6 +58,7 @@ do { \ \ /* We use a full nibble for the leading digit. */ \ leading = *numstr++; \ + wnumstr++; \ \ /* We have 3 bits from the mantissa in the leading nibble. \ Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'. */ \ diff --git a/libc/sysdeps/powerpc/fpu/libm-test-ulps b/libc/sysdeps/powerpc/fpu/libm-test-ulps index 00e994ce7..f3d4dd994 100644 --- a/libc/sysdeps/powerpc/fpu/libm-test-ulps +++ b/libc/sysdeps/powerpc/fpu/libm-test-ulps @@ -32,9 +32,26 @@ float: 1 ifloat: 1 # cabs +Test "cabs (-0.75 + 12.390625 i) == 12.4133028598606664302388810868156657": +float: 1 +ifloat: 1 +Test "cabs (-0.75 - 12.390625 i) == 12.4133028598606664302388810868156657": +float: 1 +ifloat: 1 +Test "cabs (-12.390625 + 0.75 i) == 12.4133028598606664302388810868156657": +float: 1 +ifloat: 1 +Test "cabs (-12.390625 - 0.75 i) == 12.4133028598606664302388810868156657": +float: 1 +ifloat: 1 Test "cabs (0.75 + 1.25 i) == 1.45773797371132511771853821938639577": +float: 1 +ifloat: 1 ildouble: 1 ldouble: 1 +Test "cabs (0.75 + 12.390625 i) == 12.4133028598606664302388810868156657": +float: 1 +ifloat: 1 # cacosh Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": @@ -172,8 +189,8 @@ ifloat: 3 ildouble: 1 ldouble: 1 Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i": -float: 1 -ifloat: 1 +float: 2 +ifloat: 2 ildouble: 2 ldouble: 2 Test "Imaginary part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i": @@ -195,6 +212,9 @@ idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 +Test "Real part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i": +double: 1 +idouble: 1 Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i": double: 1 float: 5 @@ -262,8 +282,8 @@ ifloat: 1 ildouble: 1 ldouble: 1 Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i": -float: 1 -ifloat: 1 +float: 2 +ifloat: 2 ildouble: 3 ldouble: 3 Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i": @@ -315,6 +335,152 @@ float: 1 idouble: 1 ifloat: 1 +# cos_downward +Test "cos_downward (1) == 0.5403023058681397174009366074429766037323": +float: 1 +ifloat: 1 +ildouble: 4 +ldouble: 4 +Test "cos_downward (10) == -0.8390715290764524522588639478240648345199": +ildouble: 1 +ldouble: 1 +Test "cos_downward (2) == -0.4161468365471423869975682295007621897660": +float: 1 +ifloat: 1 +Test "cos_downward (3) == -0.9899924966004454572715727947312613023937": +float: 1 +ifloat: 1 +Test "cos_downward (4) == -0.6536436208636119146391681830977503814241": +float: 1 +ifloat: 1 +Test "cos_downward (5) == 0.2836621854632262644666391715135573083344": +float: 1 +ifloat: 1 +Test "cos_downward (6) == 0.9601702866503660205456522979229244054519": +ildouble: 1 +ldouble: 1 +Test "cos_downward (7) == 0.7539022543433046381411975217191820122183": +float: 1 +ifloat: 1 +Test "cos_downward (8) == -0.1455000338086135258688413818311946826093": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "cos_downward (9) == -0.9111302618846769883682947111811653112463": +ildouble: 1 +ldouble: 1 + +# cos_tonearest +Test "cos_tonearest (7) == 0.7539022543433046381411975217191820122183": +float: 1 +ifloat: 1 + +# cos_towardzero +Test "cos_towardzero (1) == 0.5403023058681397174009366074429766037323": +ildouble: 2 +ldouble: 2 +Test "cos_towardzero (10) == -0.8390715290764524522588639478240648345199": +ildouble: 1 +ldouble: 1 +Test "cos_towardzero (2) == -0.4161468365471423869975682295007621897660": +float: 1 +ifloat: 1 +Test "cos_towardzero (3) == -0.9899924966004454572715727947312613023937": +float: 1 +ifloat: 1 +Test "cos_towardzero (4) == -0.6536436208636119146391681830977503814241": +ildouble: 1 +ldouble: 1 +Test "cos_towardzero (5) == 0.2836621854632262644666391715135573083344": +float: 1 +ifloat: 1 +Test "cos_towardzero (7) == 0.7539022543433046381411975217191820122183": +float: 1 +ifloat: 1 +Test "cos_towardzero (8) == -0.1455000338086135258688413818311946826093": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +# cos_upward +Test "cos_upward (1) == 0.5403023058681397174009366074429766037323": +ildouble: 2 +ldouble: 2 +Test "cos_upward (10) == -0.8390715290764524522588639478240648345199": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_upward (4) == -0.6536436208636119146391681830977503814241": +ildouble: 1 +ldouble: 1 +Test "cos_upward (5) == 0.2836621854632262644666391715135573083344": +ildouble: 1 +ldouble: 1 +Test "cos_upward (6) == 0.9601702866503660205456522979229244054519": +float: 1 +ifloat: 1 +Test "cos_upward (7) == 0.7539022543433046381411975217191820122183": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_upward (9) == -0.9111302618846769883682947111811653112463": +float: 2 +ifloat: 2 + +# cosh_downward +Test "cosh_downward (22) == 1792456423.065795780980053377632656584997": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cosh_downward (23) == 4872401723.124451300068625740569997090344": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cosh_downward (24) == 13244561064.92173614708845674912733665919": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# cosh_tonearest +Test "cosh_tonearest (24) == 13244561064.92173614708845674912733665919": +ildouble: 1 +ldouble: 1 + +# cosh_towardzero +Test "cosh_towardzero (22) == 1792456423.065795780980053377632656584997": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cosh_towardzero (23) == 4872401723.124451300068625740569997090344": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cosh_towardzero (24) == 13244561064.92173614708845674912733665919": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# cosh_upward +Test "cosh_upward (22) == 1792456423.065795780980053377632656584997": +ildouble: 2 +ldouble: 2 +Test "cosh_upward (23) == 4872401723.124451300068625740569997090344": +ildouble: 2 +ldouble: 2 +Test "cosh_upward (24) == 13244561064.92173614708845674912733665919": +ildouble: 2 +ldouble: 2 + # cpow Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i": float: 1 @@ -322,8 +488,8 @@ ifloat: 1 ildouble: 1 ldouble: 1 Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i": -float: 1 -ifloat: 1 +float: 2 +ifloat: 2 ildouble: 1 ldouble: 1 Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i": @@ -331,14 +497,22 @@ double: 1 float: 4 idouble: 1 ifloat: 4 +Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i": +float: 1 +ifloat: 1 Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i": +float: 1 +ifloat: 1 ildouble: 2 ldouble: 2 Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i": double: 2 -float: 3 +float: 4 idouble: 2 -ifloat: 3 +ifloat: 4 +Test "Imaginary part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i": +float: 1 +ifloat: 1 Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i": ildouble: 1 ldouble: 1 @@ -381,9 +555,21 @@ ldouble: 1 Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i": float: 1 ifloat: 1 +Test "Imaginary part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i": +float: 1 +ifloat: 1 Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i": float: 1 ifloat: 1 +Test "Imaginary part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i": +float: 1 +ifloat: 1 +Test "Real part of: csqrt (0 - 1 i) == M_SQRT_2_2 - M_SQRT_2_2 i": +double: 1 +idouble: 1 +Test "Imaginary part of: csqrt (0 - 1 i) == M_SQRT_2_2 - M_SQRT_2_2 i": +double: 1 +idouble: 1 # ctan Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i": @@ -474,6 +660,33 @@ Test "exp2 (10) == 1024": ildouble: 2 ldouble: 2 +# exp_downward +Test "exp_downward (2) == e^2": +float: 1 +ifloat: 1 +Test "exp_downward (3) == e^3": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# exp_towardzero +Test "exp_towardzero (2) == e^2": +float: 1 +ifloat: 1 +Test "exp_towardzero (3) == e^3": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# exp_upward +Test "exp_upward (1) == e": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + # expm1 Test "expm1 (0.75) == 1.11700001661267466854536981983709561": double: 1 @@ -486,31 +699,49 @@ ifloat: 1 # hypot Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "hypot (0.75, 1.25) == 1.45773797371132511771853821938639577": +float: 1 +ifloat: 1 ildouble: 1 ldouble: 1 Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271": +double: 1 float: 1 +idouble: 1 ifloat: 1 # j0 @@ -529,7 +760,9 @@ ifloat: 1 ildouble: 1 ldouble: 1 Test "j0 (2.0) == 0.223890779141235668051827454649948626": +double: 1 float: 2 +idouble: 1 ifloat: 2 Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1": double: 1 @@ -539,7 +772,9 @@ ifloat: 2 ildouble: 1 ldouble: 1 Test "j0 (8.0) == 0.171650807137553906090869407851972001": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 @@ -575,7 +810,9 @@ ifloat: 1 ildouble: 1 ldouble: 1 Test "jn (0, 2.0) == 0.223890779141235668051827454649948626": +double: 1 float: 2 +idouble: 1 ifloat: 2 Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1": double: 1 @@ -585,7 +822,9 @@ ifloat: 2 ildouble: 1 ldouble: 1 Test "jn (0, 8.0) == 0.171650807137553906090869407851972001": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 @@ -621,7 +860,9 @@ Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9": ildouble: 1 ldouble: 1 Test "jn (10, 10.0) == 0.207486106633358857697278723518753428": +double: 2 float: 1 +idouble: 2 ifloat: 1 ildouble: 4 ldouble: 4 @@ -702,9 +943,9 @@ ifloat: 2 ildouble: 4 ldouble: 4 Test "jn (9, 2.4048255576957729) == 0.12517270977961513005428966643852564E-4": -double: 1 +double: 2 float: 2 -idouble: 1 +idouble: 2 ifloat: 2 ildouble: 7 ldouble: 7 @@ -743,11 +984,124 @@ Test "log2 (e) == M_LOG2El": ildouble: 1 ldouble: 1 +# pow_downward +Test "pow_downward (1.0625, 1.125) == 1.070582293028761362162622578677070098674": +ildouble: 1 +ldouble: 1 +Test "pow_downward (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +float: 1 +ifloat: 1 + +# pow_towardzero +Test "pow_towardzero (1.0625, 1.125) == 1.070582293028761362162622578677070098674": +ildouble: 1 +ldouble: 1 +Test "pow_towardzero (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +float: 1 +ifloat: 1 + +# pow_upward +Test "pow_upward (1.0625, 1.125) == 1.070582293028761362162622578677070098674": +float: 1 +ifloat: 1 +Test "pow_upward (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +ildouble: 1 +ldouble: 1 + # sin Test "sin (16.0) == -0.2879033166650652947844562482186175296207": ildouble: 2 ldouble: 2 +# sin_downward +Test "sin_downward (1) == 0.8414709848078965066525023216302989996226": +ildouble: 4 +ldouble: 4 +Test "sin_downward (10) == -0.5440211108893698134047476618513772816836": +float: 1 +ifloat: 1 +Test "sin_downward (2) == 0.9092974268256816953960198659117448427023": +ildouble: 1 +ldouble: 1 +Test "sin_downward (3) == 0.1411200080598672221007448028081102798469": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "sin_downward (4) == -0.7568024953079282513726390945118290941359": +ildouble: 1 +ldouble: 1 +Test "sin_downward (5) == -0.9589242746631384688931544061559939733525": +float: 1 +ifloat: 1 +Test "sin_downward (6) == -0.2794154981989258728115554466118947596280": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "sin_downward (8) == 0.9893582466233817778081235982452886721164": +ildouble: 1 +ldouble: 1 + +# sin_tonearest +Test "sin_tonearest (1) == 0.8414709848078965066525023216302989996226": +float: 1 +ifloat: 1 + +# sin_towardzero +Test "sin_towardzero (1) == 0.8414709848078965066525023216302989996226": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "sin_towardzero (10) == -0.5440211108893698134047476618513772816836": +float: 1 +ifloat: 1 +Test "sin_towardzero (2) == 0.9092974268256816953960198659117448427023": +ildouble: 1 +ldouble: 1 +Test "sin_towardzero (3) == 0.1411200080598672221007448028081102798469": +ildouble: 1 +ldouble: 1 +Test "sin_towardzero (4) == -0.7568024953079282513726390945118290941359": +float: 1 +ifloat: 1 +Test "sin_towardzero (5) == -0.9589242746631384688931544061559939733525": +float: 1 +ifloat: 1 +Test "sin_towardzero (8) == 0.9893582466233817778081235982452886721164": +ildouble: 1 +ldouble: 1 +Test "sin_towardzero (9) == 0.4121184852417565697562725663524351793439": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# sin_upward +Test "sin_upward (1) == 0.8414709848078965066525023216302989996226": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "sin_upward (2) == 0.9092974268256816953960198659117448427023": +float: 2 +ifloat: 2 +Test "sin_upward (3) == 0.1411200080598672221007448028081102798469": +ildouble: 1 +ldouble: 1 +Test "sin_upward (4) == -0.7568024953079282513726390945118290941359": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sin_upward (6) == -0.2794154981989258728115554466118947596280": +ildouble: 1 +ldouble: 1 +Test "sin_upward (9) == 0.4121184852417565697562725663524351793439": +float: 1 +ifloat: 1 + # sincos Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res": double: 1 @@ -773,6 +1127,52 @@ Test "sinh (0.75) == 0.822316731935829980703661634446913849": ildouble: 1 ldouble: 1 +# sinh_downward +Test "sinh_downward (22) == 1792456423.065795780701106568345764104225": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "sinh_downward (23) == 4872401723.124451299966006944252978187305": +float: 1 +ifloat: 1 +Test "sinh_downward (24) == 13244561064.92173614705070540368454568168": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# sinh_towardzero +Test "sinh_towardzero (22) == 1792456423.065795780701106568345764104225": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "sinh_towardzero (23) == 4872401723.124451299966006944252978187305": +float: 1 +ifloat: 1 +Test "sinh_towardzero (24) == 13244561064.92173614705070540368454568168": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# sinh_upward +Test "sinh_upward (23) == 4872401723.124451299966006944252978187305": +ildouble: 1 +ldouble: 1 +Test "sinh_upward (24) == 13244561064.92173614705070540368454568168": +ildouble: 1 +ldouble: 1 + +# sqrt +Test "sqrt (0.75) == 0.866025403784438646763723170752936183": +double: 1 +idouble: 1 +Test "sqrt (2) == M_SQRT2l": +double: 1 +idouble: 1 + # tan Test "tan (pi/4) == 1": double: 1 @@ -780,6 +1180,102 @@ idouble: 1 ildouble: 1 ldouble: 1 +# tan_downward +Test "tan_downward (1) == 1.5574077246549022305069748074583601730873": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "tan_downward (10) == 0.6483608274590866712591249330098086768169": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "tan_downward (2) == -2.1850398632615189916433061023136825434320": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_downward (6) == -0.2910061913847491570536995888681755428312": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_downward (8) == -6.7997114552203786999252627596086333648814": +float: 1 +ifloat: 1 +Test "tan_downward (9) == -0.4523156594418098405903708757987855343087": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# tan_tonearest +Test "tan_tonearest (10) == 0.6483608274590866712591249330098086768169": +ildouble: 1 +ldouble: 1 +Test "tan_tonearest (4) == 1.1578212823495775831373424182673239231198": +ildouble: 1 +ldouble: 1 +Test "tan_tonearest (7) == 0.8714479827243187364564508896003135663222": +ildouble: 1 +ldouble: 1 + +# tan_towardzero +Test "tan_towardzero (10) == 0.6483608274590866712591249330098086768169": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "tan_towardzero (3) == -0.1425465430742778052956354105339134932261": +float: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 +Test "tan_towardzero (4) == 1.1578212823495775831373424182673239231198": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_towardzero (5) == -3.3805150062465856369827058794473439087096": +float: 1 +ifloat: 1 +Test "tan_towardzero (6) == -0.2910061913847491570536995888681755428312": +ildouble: 1 +ldouble: 1 +Test "tan_towardzero (7) == 0.8714479827243187364564508896003135663222": +ildouble: 2 +ldouble: 2 +Test "tan_towardzero (9) == -0.4523156594418098405903708757987855343087": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# tan_upward +Test "tan_upward (10) == 0.6483608274590866712591249330098086768169": +ildouble: 1 +ldouble: 1 +Test "tan_upward (3) == -0.1425465430742778052956354105339134932261": +float: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 +Test "tan_upward (5) == -3.3805150062465856369827058794473439087096": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_upward (6) == -0.2910061913847491570536995888681755428312": +ildouble: 1 +ldouble: 1 +Test "tan_upward (7) == 0.8714479827243187364564508896003135663222": +ildouble: 1 +ldouble: 1 +Test "tan_upward (9) == -0.4523156594418098405903708757987855343087": +ildouble: 1 +ldouble: 1 + # tanh Test "tanh (-0.75) == -0.635148952387287319214434357312496495": ildouble: 1 @@ -855,7 +1351,7 @@ ifloat: 1 ildouble: 2 ldouble: 2 Test "y1 (2.0) == -0.107032431540937546888370772277476637": -double: 1 +double: 2 float: 1 idouble: 2 ifloat: 2 @@ -917,9 +1413,9 @@ ifloat: 1 ildouble: 2 ldouble: 2 Test "yn (1, 2.0) == -0.107032431540937546888370772277476637": -double: 1 +double: 2 float: 1 -idouble: 1 +idouble: 2 ifloat: 1 Test "yn (1, 8.0) == -0.158060461731247494255555266187483550": double: 1 @@ -998,6 +1494,8 @@ float: 1 ifloat: 1 Function: "cabs": +float: 1 +ifloat: 1 ildouble: 1 ldouble: 1 @@ -1120,8 +1618,8 @@ ildouble: 1 ldouble: 1 Function: Real part of "clog": -float: 1 -ifloat: 1 +float: 2 +ifloat: 2 ildouble: 2 ldouble: 2 @@ -1132,16 +1630,18 @@ ildouble: 1 ldouble: 1 Function: Real part of "clog10": -float: 1 -ifloat: 1 +double: 1 +float: 2 +idouble: 1 +ifloat: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "clog10": double: 1 -float: 5 +float: 1 idouble: 1 -ifloat: 5 +ifloat: 1 ildouble: 1 ldouble: 1 @@ -1153,10 +1653,54 @@ ifloat: 1 ildouble: 1 ldouble: 1 +Function: "cos_downward": +float: 1 +ifloat: 1 +ildouble: 4 +ldouble: 4 + +Function: "cos_tonearest": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "cos_towardzero": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: "cos_upward": +float: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 + Function: "cosh": ildouble: 1 ldouble: 1 +Function: "cosh_downward": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "cosh_tonearest": +ildouble: 1 +ldouble: 1 + +Function: "cosh_towardzero": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "cosh_upward": +ildouble: 2 +ldouble: 2 + Function: Real part of "cpow": double: 2 float: 5 @@ -1196,12 +1740,18 @@ ildouble: 1 ldouble: 1 Function: Real part of "csqrt": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 Function: Imaginary part of "csqrt": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 ildouble: 1 ldouble: 1 @@ -1261,6 +1811,28 @@ Function: "exp2": ildouble: 2 ldouble: 2 +Function: "exp_downward": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "exp_tonearest": +ildouble: 1 +ldouble: 1 + +Function: "exp_towardzero": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "exp_upward": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + Function: "expm1": double: 1 float: 1 @@ -1272,7 +1844,9 @@ ildouble: 1 ldouble: 1 Function: "hypot": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 @@ -1335,10 +1909,52 @@ Function: "pow": ildouble: 1 ldouble: 1 +Function: "pow_downward": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "pow_towardzero": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "pow_upward": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + Function: "sin": ildouble: 1 ldouble: 1 +Function: "sin_downward": +float: 1 +ifloat: 1 +ildouble: 4 +ldouble: 4 + +Function: "sin_tonearest": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "sin_towardzero": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: "sin_upward": +float: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 + Function: "sincos": double: 1 float: 1 @@ -1351,12 +1967,58 @@ Function: "sinh": ildouble: 1 ldouble: 1 +Function: "sinh_downward": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: "sinh_tonearest": +ildouble: 1 +ldouble: 1 + +Function: "sinh_towardzero": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: "sinh_upward": +ildouble: 1 +ldouble: 1 + +Function: "sqrt": +double: 1 +idouble: 1 + Function: "tan": double: 1 idouble: 1 ildouble: 1 ldouble: 1 +Function: "tan_downward": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: "tan_tonearest": +ildouble: 1 +ldouble: 1 + +Function: "tan_towardzero": +float: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 + +Function: "tan_upward": +float: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 + Function: "tanh": ildouble: 1 ldouble: 1 diff --git a/libc/sysdeps/sparc/fpu/libm-test-ulps b/libc/sysdeps/sparc/fpu/libm-test-ulps index 71937cbc6..178c1971b 100644 --- a/libc/sysdeps/sparc/fpu/libm-test-ulps +++ b/libc/sysdeps/sparc/fpu/libm-test-ulps @@ -415,6 +415,28 @@ ifloat: 2 ildouble: 1 ldouble: 1 +# cosh_downward +Test "cosh_downward (22) == 1792456423.065795780980053377632656584997": +float: 1 +ifloat: 1 +Test "cosh_downward (23) == 4872401723.124451300068625740569997090344": +float: 1 +ifloat: 1 +Test "cosh_downward (24) == 13244561064.92173614708845674912733665919": +float: 1 +ifloat: 1 + +# cosh_towardzero +Test "cosh_towardzero (22) == 1792456423.065795780980053377632656584997": +float: 1 +ifloat: 1 +Test "cosh_towardzero (23) == 4872401723.124451300068625740569997090344": +float: 1 +ifloat: 1 +Test "cosh_towardzero (24) == 13244561064.92173614708845674912733665919": +float: 1 +ifloat: 1 + # cpow Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i": float: 1 @@ -918,6 +940,21 @@ Test "log2 (0.75) == -.415037499278843818546261056052183492": ildouble: 1 ldouble: 1 +# pow_downward +Test "pow_downward (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +float: 1 +ifloat: 1 + +# pow_towardzero +Test "pow_towardzero (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +float: 1 +ifloat: 1 + +# pow_upward +Test "pow_upward (1.0625, 1.125) == 1.070582293028761362162622578677070098674": +float: 1 +ifloat: 1 + # sin_downward Test "sin_downward (1) == 0.8414709848078965066525023216302989996226": ildouble: 1 @@ -1054,6 +1091,28 @@ Test "sincos (pi/6, &sin_res, &cos_res) puts 0.866025403784438646763723170752936 float: 1 ifloat: 1 +# sinh_downward +Test "sinh_downward (22) == 1792456423.065795780701106568345764104225": +float: 1 +ifloat: 1 +Test "sinh_downward (23) == 4872401723.124451299966006944252978187305": +float: 1 +ifloat: 1 +Test "sinh_downward (24) == 13244561064.92173614705070540368454568168": +float: 1 +ifloat: 1 + +# sinh_towardzero +Test "sinh_towardzero (22) == 1792456423.065795780701106568345764104225": +float: 1 +ifloat: 1 +Test "sinh_towardzero (23) == 4872401723.124451299966006944252978187305": +float: 1 +ifloat: 1 +Test "sinh_towardzero (24) == 13244561064.92173614705070540368454568168": +float: 1 +ifloat: 1 + # sqrt Test "sqrt (2) == M_SQRT2l": ildouble: 1 @@ -1524,6 +1583,14 @@ ifloat: 2 ildouble: 1 ldouble: 1 +Function: "cosh_downward": +float: 1 +ifloat: 1 + +Function: "cosh_towardzero": +float: 1 +ifloat: 1 + Function: Real part of "cpow": double: 2 float: 4 @@ -1704,6 +1771,18 @@ Function: "log2": ildouble: 1 ldouble: 1 +Function: "pow_downward": +float: 1 +ifloat: 1 + +Function: "pow_towardzero": +float: 1 +ifloat: 1 + +Function: "pow_upward": +float: 1 +ifloat: 1 + Function: "sin_downward": float: 1 ifloat: 1 @@ -1736,6 +1815,14 @@ ifloat: 1 ildouble: 1 ldouble: 1 +Function: "sinh_downward": +float: 1 +ifloat: 1 + +Function: "sinh_towardzero": +float: 1 +ifloat: 1 + Function: "sqrt": ildouble: 1 ldouble: 1 diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_llrint.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_llrint.S new file mode 100644 index 000000000..8ec9b4dcb --- /dev/null +++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_llrint.S @@ -0,0 +1,67 @@ +/* llrint(), sparc32 v9 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David S. Miller <davem@davemloft.net>, 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + + /* We pop constants into the FPU registers using the incoming + argument stack slots, since this avoid having to use any PIC + references. We also thus avoid having to allocate a register + window. + + VIS instructions are used to facilitate the formation of + easier constants, and the propagation of the sign bit. */ + +#define TWO_FIFTYTWO 0x43300000 /* 2**52 */ + +#define ZERO %f10 /* 0.0 */ +#define SIGN_BIT %f12 /* -0.0 */ + +ENTRY (__llrint) + sethi %hi(TWO_FIFTYTWO), %o2 + sllx %o0, 32, %o0 + + or %o0, %o1, %o0 + fzero ZERO + + stx %o0, [%sp + 72] + sllx %o2, 32, %o2 + fnegd ZERO, SIGN_BIT + + ldd [%sp + 72], %f0 + + stx %o2, [%sp + 72] + fabsd %f0, %f14 + + ldd [%sp + 72], %f16 + fcmpd %fcc3, %f14, %f16 + + fmovduge %fcc3, ZERO, %f16 + fand %f0, SIGN_BIT, SIGN_BIT + + for %f16, SIGN_BIT, %f16 + faddd %f0, %f16, %f6 + fsubd %f6, %f16, %f0 + fabsd %f0, %f0 + for %f0, SIGN_BIT, %f0 + fdtox %f0, %f4 + std %f4, [%sp + 72] + retl + ldd [%sp + 72], %o0 +END (__llrint) +weak_alias (__llrint, llrint) diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_llrintf.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_llrintf.S new file mode 100644 index 000000000..73e9d6487 --- /dev/null +++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_llrintf.S @@ -0,0 +1,62 @@ +/* llrintf(), sparc32 v9 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David S. Miller <davem@davemloft.net>, 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + + /* We pop constants into the FPU registers using the incoming + argument stack slots, since this avoid having to use any PIC + references. We also thus avoid having to allocate a register + window. + + VIS instructions are used to facilitate the formation of + easier constants, and the propagation of the sign bit. */ + +#define TWO_TWENTYTHREE 0x4b000000 /* 2**23 */ + +#define ZERO %f10 /* 0.0 */ +#define SIGN_BIT %f12 /* -0.0 */ + +ENTRY (__llrintf) + st %o0, [%sp + 68] + sethi %hi(TWO_TWENTYTHREE), %o2 + fzeros ZERO + + ld [%sp + 68], %f1 + fnegs ZERO, SIGN_BIT + + st %o2, [%sp + 68] + fabss %f1, %f14 + + ld [%sp + 68], %f16 + fcmps %fcc3, %f14, %f16 + + fmovsuge %fcc3, ZERO, %f16 + fands %f1, SIGN_BIT, SIGN_BIT + + fors %f16, SIGN_BIT, %f16 + fadds %f1, %f16, %f5 + fsubs %f5, %f16, %f0 + fabss %f0, %f0 + fors %f0, SIGN_BIT, %f0 + fstox %f0, %f4 + std %f4, [%sp + 72] + retl + ldd [%sp + 72], %o0 +END (__llrintf) +weak_alias (__llrintf, llrintf) diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_lrint.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_lrint.S new file mode 100644 index 000000000..062faba17 --- /dev/null +++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_lrint.S @@ -0,0 +1,67 @@ +/* lrint(), sparc32 v9 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David S. Miller <davem@davemloft.net>, 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + + /* We pop constants into the FPU registers using the incoming + argument stack slots, since this avoid having to use any PIC + references. We also thus avoid having to allocate a register + window. + + VIS instructions are used to facilitate the formation of + easier constants, and the propagation of the sign bit. */ + +#define TWO_FIFTYTWO 0x43300000 /* 2**52 */ + +#define ZERO %f10 /* 0.0 */ +#define SIGN_BIT %f12 /* -0.0 */ + +ENTRY (__lrint) + sethi %hi(TWO_FIFTYTWO), %o2 + sllx %o0, 32, %o0 + + or %o0, %o1, %o0 + fzero ZERO + + stx %o0, [%sp + 72] + sllx %o2, 32, %o2 + fnegd ZERO, SIGN_BIT + + ldd [%sp + 72], %f0 + + stx %o2, [%sp + 72] + fabsd %f0, %f14 + + ldd [%sp + 72], %f16 + fcmpd %fcc3, %f14, %f16 + + fmovduge %fcc3, ZERO, %f16 + fand %f0, SIGN_BIT, SIGN_BIT + + for %f16, SIGN_BIT, %f16 + faddd %f0, %f16, %f6 + fsubd %f6, %f16, %f0 + fabsd %f0, %f0 + for %f0, SIGN_BIT, %f0 + fdtoi %f0, %f3 + st %f3, [%sp + 72] + retl + ld [%sp + 72], %o0 +END (__lrint) +weak_alias (__lrint, lrint) diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_lrintf.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_lrintf.S new file mode 100644 index 000000000..c546e67c2 --- /dev/null +++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_lrintf.S @@ -0,0 +1,62 @@ +/* lrintf(), sparc32 v9 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David S. Miller <davem@davemloft.net>, 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + + /* We pop constants into the FPU registers using the incoming + argument stack slots, since this avoid having to use any PIC + references. We also thus avoid having to allocate a register + window. + + VIS instructions are used to facilitate the formation of + easier constants, and the propagation of the sign bit. */ + +#define TWO_TWENTYTHREE 0x4b000000 /* 2**23 */ + +#define ZERO %f10 /* 0.0 */ +#define SIGN_BIT %f12 /* -0.0 */ + +ENTRY (__lrintf) + st %o0, [%sp + 68] + sethi %hi(TWO_TWENTYTHREE), %o2 + fzeros ZERO + + ld [%sp + 68], %f1 + fnegs ZERO, SIGN_BIT + + st %o2, [%sp + 68] + fabss %f1, %f14 + + ld [%sp + 68], %f16 + fcmps %fcc3, %f14, %f16 + + fmovsuge %fcc3, ZERO, %f16 + fands %f1, SIGN_BIT, SIGN_BIT + + fors %f16, SIGN_BIT, %f16 + fadds %f1, %f16, %f5 + fsubs %f5, %f16, %f0 + fabss %f0, %f0 + fors %f0, SIGN_BIT, %f0 + fstoi %f0, %f3 + st %f3, [%sp + 68] + retl + ld [%sp + 68], %o0 +END (__lrintf) +weak_alias (__lrintf, lrintf) diff --git a/libc/sysdeps/sparc/sparc64/fpu/s_llrint.S b/libc/sysdeps/sparc/sparc64/fpu/s_llrint.S new file mode 100644 index 000000000..7c8e941b7 --- /dev/null +++ b/libc/sysdeps/sparc/sparc64/fpu/s_llrint.S @@ -0,0 +1 @@ +/* llrint is implemented in s_lrint.S */ diff --git a/libc/sysdeps/sparc/sparc64/fpu/s_llrintf.S b/libc/sysdeps/sparc/sparc64/fpu/s_llrintf.S new file mode 100644 index 000000000..abab3b9a2 --- /dev/null +++ b/libc/sysdeps/sparc/sparc64/fpu/s_llrintf.S @@ -0,0 +1 @@ +/* llrintf is implemented in s_lrint.S */ diff --git a/libc/sysdeps/sparc/sparc64/fpu/s_lrint.S b/libc/sysdeps/sparc/sparc64/fpu/s_lrint.S new file mode 100644 index 000000000..6bf56e4d0 --- /dev/null +++ b/libc/sysdeps/sparc/sparc64/fpu/s_lrint.S @@ -0,0 +1,63 @@ +/* lrint(), sparc64 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David S. Miller <davem@davemloft.net>, 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + + /* We pop constants into the FPU registers using the incoming + argument stack slots, since this avoid having to use any PIC + references. We also thus avoid having to allocate a register + window. + + VIS instructions are used to facilitate the formation of + easier constants, and the propagation of the sign bit. */ + +#define TWO_FIFTYTWO 0x43300000 /* 2**52 */ + +#define ZERO %f10 /* 0.0 */ +#define SIGN_BIT %f12 /* -0.0 */ + +ENTRY (__lrint) + sethi %hi(TWO_FIFTYTWO), %o2 + sllx %o2, 32, %o2 + fzero ZERO + + fnegd ZERO, SIGN_BIT + stx %o2, [%sp + STACK_BIAS + 128] + fabsd %f0, %f14 + + ldd [%sp + STACK_BIAS + 128], %f16 + fcmpd %fcc3, %f14, %f16 + + fmovduge %fcc3, ZERO, %f16 + fand %f0, SIGN_BIT, SIGN_BIT + + for %f16, SIGN_BIT, %f16 + faddd %f0, %f16, %f6 + fsubd %f6, %f16, %f0 + fabsd %f0, %f0 + for %f0, SIGN_BIT, %f0 + fdtox %f0, %f4 + std %f4, [%sp + STACK_BIAS + 128] + retl + ldx [%sp + STACK_BIAS + 128], %o0 +END (__lrint) +weak_alias (__lrint, lrint) + +strong_alias (__lrint, __llrint) +weak_alias (__llrint, llrint) diff --git a/libc/sysdeps/sparc/sparc64/fpu/s_lrintf.S b/libc/sysdeps/sparc/sparc64/fpu/s_lrintf.S new file mode 100644 index 000000000..2f2938b98 --- /dev/null +++ b/libc/sysdeps/sparc/sparc64/fpu/s_lrintf.S @@ -0,0 +1,62 @@ +/* lrintf(), sparc64 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David S. Miller <davem@davemloft.net>, 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + + /* We pop constants into the FPU registers using the incoming + argument stack slots, since this avoid having to use any PIC + references. We also thus avoid having to allocate a register + window. + + VIS instructions are used to facilitate the formation of + easier constants, and the propagation of the sign bit. */ + +#define TWO_TWENTYTHREE 0x4b000000 /* 2**23 */ + +#define ZERO %f10 /* 0.0 */ +#define SIGN_BIT %f12 /* -0.0 */ + +ENTRY (__lrintf) + sethi %hi(TWO_TWENTYTHREE), %o2 + fzeros ZERO + + fnegs ZERO, SIGN_BIT + st %o2, [%sp + STACK_BIAS + 128] + fabss %f1, %f14 + + ld [%sp + STACK_BIAS + 128], %f16 + fcmps %fcc3, %f14, %f16 + + fmovsuge %fcc3, ZERO, %f16 + fands %f1, SIGN_BIT, SIGN_BIT + + fors %f16, SIGN_BIT, %f16 + fadds %f1, %f16, %f5 + fsubs %f5, %f16, %f0 + fabss %f0, %f0 + fors %f0, SIGN_BIT, %f0 + fstox %f0, %f4 + std %f4, [%sp + STACK_BIAS + 128] + retl + ldx [%sp + STACK_BIAS + 128], %o0 +END (__lrintf) +weak_alias (__lrintf, lrintf) + +strong_alias (__lrintf, __llrintf) +weak_alias (__llrintf, llrintf) diff --git a/libc/sysdeps/unix/sysv/linux/dl-osinfo.h b/libc/sysdeps/unix/sysv/linux/dl-osinfo.h index 874660be1..780b20ab6 100644 --- a/libc/sysdeps/unix/sysv/linux/dl-osinfo.h +++ b/libc/sysdeps/unix/sysv/linux/dl-osinfo.h @@ -84,8 +84,8 @@ _dl_setup_stack_chk_guard (void *dl_random) return ret.num; } # endif - ret.bytes[filllen - 2] = 255; - ret.bytes[filllen - 3] = '\n'; + ret.bytes[filllen] = 255; + ret.bytes[filllen - 1] = '\n'; } else #endif diff --git a/libc/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c b/libc/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c index e181d9d36..ba44a61c8 100644 --- a/libc/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c +++ b/libc/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c @@ -154,6 +154,22 @@ __get_clockfreq_via_proc_openprom (void) return result; } +static void set_obp_int (struct openpromio *op, int val) +{ + char *cp = op->oprom_array; + int *ip = (int *) cp; + + *ip = val; +} + +static int get_obp_int (struct openpromio *op) +{ + char *cp = op->oprom_array; + int *ip = (int *) cp; + + return *ip; +} + static hp_timing_t __get_clockfreq_via_dev_openprom (void) { @@ -171,11 +187,11 @@ __get_clockfreq_via_dev_openprom (void) obp_cmd->oprom_size = sizeof (obp_buf) - sizeof (unsigned int); - *(int *) obp_cmd->oprom_array = 0; + set_obp_int (obp_cmd, 0); ret = ioctl (obp_dev_fd, OPROMCHILD, (char *) obp_cmd); if (ret == 0) { - int cur_node = *(int *) obp_cmd->oprom_array; + int cur_node = get_obp_int (obp_cmd); while (cur_node != 0 && cur_node != -1) { @@ -190,15 +206,14 @@ __get_clockfreq_via_dev_openprom (void) strcpy (obp_cmd->oprom_array, "clock-frequency"); ret = ioctl (obp_dev_fd, OPROMGETPROP, (char *) obp_cmd); if (ret == 0) - result = - (hp_timing_t) *(unsigned int *) obp_cmd->oprom_array; + result = (hp_timing_t) get_obp_int (obp_cmd); } obp_cmd->oprom_size = sizeof (obp_buf) - sizeof (unsigned int); - *(int *) obp_cmd->oprom_array = cur_node; + set_obp_int (obp_cmd, cur_node); ret = ioctl (obp_dev_fd, OPROMNEXT, (char *) obp_cmd); if (ret < 0) break; - cur_node = *(int *)obp_cmd->oprom_array; + cur_node = get_obp_int (obp_cmd); } } } diff --git a/libc/sysdeps/unix/sysv/linux/sparc/sysdep.h b/libc/sysdeps/unix/sysv/linux/sparc/sysdep.h index 336c8538b..30144b9f6 100644 --- a/libc/sysdeps/unix/sysv/linux/sparc/sysdep.h +++ b/libc/sysdeps/unix/sysv/linux/sparc/sysdep.h @@ -23,7 +23,7 @@ #define INLINE_SYSCALL(name, nr, args...) \ ({ INTERNAL_SYSCALL_DECL(err); \ unsigned int resultvar = INTERNAL_SYSCALL(name, err, nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, err), 0)) \ + if (INTERNAL_SYSCALL_ERROR_P (resultvar, err)) \ { \ __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, err)); \ resultvar = 0xffffffff; \ @@ -44,7 +44,8 @@ inline_syscall##nr(__SYSCALL_STRING, err, name, args) #undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) ((err) != 0) +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((void) (val), __builtin_expect((err) != 0, 0)) #undef INTERNAL_SYSCALL_ERRNO #define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) @@ -152,7 +153,7 @@ "0" (__g1), "1" (__o0), "2" (__o1), \ "r" (__o2), "r" (__o3), "r" (__o4) : \ __SYSCALL_CLOBBERS); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (__o0, __g1), 0)) \ + if (INTERNAL_SYSCALL_ERROR_P (__o0, __g1)) \ { \ __set_errno (INTERNAL_SYSCALL_ERRNO (__o0, __g1)); \ __o0 = -1L; \ diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c b/libc/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c index a13948b10..e41fddb29 100644 --- a/libc/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c +++ b/libc/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c @@ -30,7 +30,7 @@ gettimeofday_ifunc (void) PREPARE_VERSION (linux26, "LINUX_2.6", 61765110); /* If the vDSO is not available we fall back on the old vsyscall. */ - return (_dl_vdso_vsym ("gettimeofday", &linux26) + return (_dl_vdso_vsym ("__vdso_gettimeofday", &linux26) ?: (void *) VSYSCALL_ADDR_vgettimeofday); } __asm (".type __gettimeofday, %gnu_indirect_function"); diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/init-first.c b/libc/sysdeps/unix/sysv/linux/x86_64/init-first.c index 0a9948b3f..e8b52eacb 100644 --- a/libc/sysdeps/unix/sysv/linux/x86_64/init-first.c +++ b/libc/sysdeps/unix/sysv/linux/x86_64/init-first.c @@ -36,13 +36,13 @@ _libc_vdso_platform_setup (void) { PREPARE_VERSION (linux26, "LINUX_2.6", 61765110); - void *p = _dl_vdso_vsym ("clock_gettime", &linux26); + void *p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux26); if (p == NULL) p = __syscall_clock_gettime; PTR_MANGLE (p); __GI___vdso_clock_gettime = p; - p = _dl_vdso_vsym ("getcpu", &linux26); + p = _dl_vdso_vsym ("__vdso_getcpu", &linux26); /* If the vDSO is not available we fall back on the old vsyscall. */ #define VSYSCALL_ADDR_vgetcpu 0xffffffffff600800 if (p == NULL) diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/time.c b/libc/sysdeps/unix/sysv/linux/x86_64/time.c index 67afff306..0e05ddd52 100644 --- a/libc/sysdeps/unix/sysv/linux/x86_64/time.c +++ b/libc/sysdeps/unix/sysv/linux/x86_64/time.c @@ -28,7 +28,7 @@ time_ifunc (void) PREPARE_VERSION (linux26, "LINUX_2.6", 61765110); /* If the vDSO is not available we fall back on the old vsyscall. */ - return _dl_vdso_vsym ("time", &linux26) ?: (void *) VSYSCALL_ADDR_vtime; + return _dl_vdso_vsym ("__vdso_time", &linux26) ?: (void *) VSYSCALL_ADDR_vtime; } __asm (".type time, %gnu_indirect_function"); diff --git a/libc/sysdeps/x86_64/bits/atomic.h b/libc/sysdeps/x86_64/bits/atomic.h index 4a0d40b34..4b8d2ab09 100644 --- a/libc/sysdeps/x86_64/bits/atomic.h +++ b/libc/sysdeps/x86_64/bits/atomic.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2004, 2006, 2007, 2009 Free Software Foundation, Inc. +/* Copyright (C) 2002-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -55,41 +55,10 @@ typedef uintmax_t uatomic_max_t; #endif -#if __GNUC_PREREQ (4, 1) -# define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \ +#define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \ __sync_val_compare_and_swap (mem, oldval, newval) -# define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \ +#define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \ (! __sync_bool_compare_and_swap (mem, oldval, newval)) -#else -# define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK_PREFIX "cmpxchgb %b2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "q" (newval), "m" (*mem), "0" (oldval)); \ - ret; }) - -# define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK_PREFIX "cmpxchgw %w2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "r" (newval), "m" (*mem), "0" (oldval)); \ - ret; }) - -# define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK_PREFIX "cmpxchgl %2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "r" (newval), "m" (*mem), "0" (oldval)); \ - ret; }) - -# define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK_PREFIX "cmpxchgq %q2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "r" ((long int) (newval)), "m" (*mem), \ - "0" ((long int) (oldval))); \ - ret; }) -#endif #define __arch_c_compare_and_exchange_val_8_acq(mem, newval, oldval) \ @@ -184,13 +153,8 @@ typedef uintmax_t uatomic_max_t; "i" (offsetof (tcbhead_t, multiple_threads))); \ result; }) -#if __GNUC_PREREQ (4, 1) -# define atomic_exchange_and_add(mem, value) \ +#define atomic_exchange_and_add(mem, value) \ __sync_fetch_and_add (mem, value) -#else -# define atomic_exchange_and_add(mem, value) \ - __arch_exchange_and_add_body (LOCK_PREFIX, mem, value) -#endif #define __arch_exchange_and_add_cprefix \ "cmpl $0, %%fs:%P4\n\tje 0f\n\tlock\n0:\t" diff --git a/libc/sysdeps/x86_64/fpu/libm-test-ulps b/libc/sysdeps/x86_64/fpu/libm-test-ulps index 0185f285a..867e8dd41 100644 --- a/libc/sysdeps/x86_64/fpu/libm-test-ulps +++ b/libc/sysdeps/x86_64/fpu/libm-test-ulps @@ -41,13 +41,151 @@ ildouble: 1 ldouble: 1 # cacos +Test "Imaginary part of: cacos (+0 + 0.5 i) == pi/2 - 0.4812118250596034474977589134243684231352 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Imaginary part of: cacos (+0 + 1.0 i) == pi/2 - 0.8813735870195430252326093249797923090282 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: cacos (+0 + 1.5 i) == pi/2 - 1.194763217287109304111930828519090523536 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Imaginary part of: cacos (+0 - 0.5 i) == pi/2 + 0.4812118250596034474977589134243684231352 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (+0 - 1.0 i) == pi/2 + 0.8813735870195430252326093249797923090282 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (+0 - 1.5 i) == pi/2 + 1.194763217287109304111930828519090523536 i": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0 + 0.5 i) == pi/2 - 0.4812118250596034474977589134243684231352 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Imaginary part of: cacos (-0 + 1.0 i) == pi/2 - 0.8813735870195430252326093249797923090282 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: cacos (-0 + 1.5 i) == pi/2 - 1.194763217287109304111930828519090523536 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Imaginary part of: cacos (-0 - 0.5 i) == pi/2 + 0.4812118250596034474977589134243684231352 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0 - 1.0 i) == pi/2 + 0.8813735870195430252326093249797923090282 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0 - 1.5 i) == pi/2 + 1.194763217287109304111930828519090523536 i": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-1.5 + +0 i) == pi - 0.9624236501192068949955178268487368462704 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-1.5 - 0 i) == pi + 0.9624236501192068949955178268487368462704 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0.5 + +0 i) == 1.047197551196597746154214461093167628066 - 0 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0.5 - 0 i) == 1.047197551196597746154214461093167628066 + +0 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 Test "Imaginary part of: cacos (0.75 + 1.25 i) == 1.11752014915610270578240049553777969 - 1.13239363160530819522266333696834467 i": float: 1 ifloat: 1 ildouble: 2 ldouble: 2 +Test "Imaginary part of: cacos (1.5 + +0 i) == +0 - 0.9624236501192068949955178268487368462704 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (1.5 - 0 i) == +0 + 0.9624236501192068949955178268487368462704 i": +ildouble: 1 +ldouble: 1 # cacosh +Test "Real part of: cacosh (+0 + 0.5 i) == 0.4812118250596034474977589134243684231352 + pi/2 i": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (+0 + 1.0 i) == 0.8813735870195430252326093249797923090282 + pi/2 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (+0 + 1.5 i) == 1.194763217287109304111930828519090523536 + pi/2 i": +double: 1 +idouble: 1 +Test "Real part of: cacosh (+0 - 0.5 i) == 0.4812118250596034474977589134243684231352 - pi/2 i": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (+0 - 1.0 i) == 0.8813735870195430252326093249797923090282 - pi/2 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (+0 - 1.5 i) == 1.194763217287109304111930828519090523536 - pi/2 i": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0 + 0.5 i) == 0.4812118250596034474977589134243684231352 + pi/2 i": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0 + 1.0 i) == 0.8813735870195430252326093249797923090282 + pi/2 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (-0 + 1.5 i) == 1.194763217287109304111930828519090523536 + pi/2 i": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0 - 0.5 i) == 0.4812118250596034474977589134243684231352 - pi/2 i": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0 - 1.0 i) == 0.8813735870195430252326093249797923090282 - pi/2 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (-0 - 1.5 i) == 1.194763217287109304111930828519090523536 - pi/2 i": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (-0.5 + +0 i) == +0 + 2.094395102393195492308428922186335256131 i": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (-0.5 - 0 i) == +0 - 2.094395102393195492308428922186335256131 i": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-1.5 + +0 i) == 0.9624236501192068949955178268487368462704 + pi i": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-1.5 - 0 i) == 0.9624236501192068949955178268487368462704 - pi i": +float: 1 +ifloat: 1 Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": double: 1 float: 7 @@ -65,8 +203,78 @@ ldouble: 1 Test "Real part of: cacosh (0.75 + 1.25 i) == 1.13239363160530819522266333696834467 + 1.11752014915610270578240049553777969 i": ildouble: 1 ldouble: 1 +Test "Real part of: cacosh (1.5 + +0 i) == 0.9624236501192068949955178268487368462704 + +0 i": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (1.5 - 0 i) == 0.9624236501192068949955178268487368462704 - 0 i": +float: 1 +ifloat: 1 # casin +Test "Imaginary part of: casin (+0 + 0.5 i) == +0 + 0.4812118250596034474977589134243684231352 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Imaginary part of: casin (+0 + 1.0 i) == +0 + 0.8813735870195430252326093249797923090282 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: casin (+0 + 1.5 i) == +0 + 1.194763217287109304111930828519090523536 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Imaginary part of: casin (+0 - 0.5 i) == +0 - 0.4812118250596034474977589134243684231352 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (+0 - 1.0 i) == +0 - 0.8813735870195430252326093249797923090282 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (+0 - 1.5 i) == +0 - 1.194763217287109304111930828519090523536 i": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0 + 0.5 i) == -0 + 0.4812118250596034474977589134243684231352 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Imaginary part of: casin (-0 + 1.0 i) == -0 + 0.8813735870195430252326093249797923090282 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: casin (-0 + 1.5 i) == -0 + 1.194763217287109304111930828519090523536 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Imaginary part of: casin (-0 - 0.5 i) == -0 - 0.4812118250596034474977589134243684231352 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0 - 1.0 i) == -0 - 0.8813735870195430252326093249797923090282 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0 - 1.5 i) == -0 - 1.194763217287109304111930828519090523536 i": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-1.5 + +0 i) == -pi/2 + 0.9624236501192068949955178268487368462704 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-1.5 - 0 i) == -pi/2 - 0.9624236501192068949955178268487368462704 i": +ildouble: 1 +ldouble: 1 Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i": double: 1 float: 1 @@ -79,8 +287,66 @@ float: 1 ifloat: 1 ildouble: 2 ldouble: 2 +Test "Imaginary part of: casin (1.5 + +0 i) == pi/2 + 0.9624236501192068949955178268487368462704 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (1.5 - 0 i) == pi/2 - 0.9624236501192068949955178268487368462704 i": +ildouble: 1 +ldouble: 1 # casinh +Test "Real part of: casinh (+0 + 1.5 i) == 0.9624236501192068949955178268487368462704 + pi/2 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (+0 - 1.5 i) == 0.9624236501192068949955178268487368462704 - pi/2 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0 + 1.5 i) == -0.9624236501192068949955178268487368462704 + pi/2 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-0 - 1.5 i) == -0.9624236501192068949955178268487368462704 - pi/2 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 + +0 i) == -0.4812118250596034474977589134243684231352 + +0 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Real part of: casinh (-0.5 - 0 i) == -0.4812118250596034474977589134243684231352 - 0 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Real part of: casinh (-1.0 + +0 i) == -0.8813735870195430252326093249797923090282 + +0 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Real part of: casinh (-1.0 - 0 i) == -0.8813735870195430252326093249797923090282 - 0 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Real part of: casinh (-1.5 + +0 i) == -1.194763217287109304111930828519090523536 + +0 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Real part of: casinh (-1.5 - 0 i) == -1.194763217287109304111930828519090523536 - 0 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i": double: 5 float: 1 @@ -95,6 +361,12 @@ idouble: 3 ifloat: 6 ildouble: 5 ldouble: 5 +Test "Real part of: casinh (0.5 + +0 i) == 0.4812118250596034474977589134243684231352 + +0 i": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 - 0 i) == 0.4812118250596034474977589134243684231352 - 0 i": +float: 1 +ifloat: 1 Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i": float: 1 ifloat: 1 @@ -105,6 +377,22 @@ idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 +Test "Real part of: casinh (1.0 + +0 i) == 0.8813735870195430252326093249797923090282 + +0 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (1.0 - 0 i) == 0.8813735870195430252326093249797923090282 - 0 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (1.5 + +0 i) == 1.194763217287109304111930828519090523536 + +0 i": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.5 - 0 i) == 1.194763217287109304111930828519090523536 - 0 i": +double: 1 +idouble: 1 # catan Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i": @@ -428,6 +716,50 @@ Test "cos_upward (9) == -0.9111302618846769883682947111811653112463": float: 2 ifloat: 2 +# cosh_downward +Test "cosh_downward (22) == 1792456423.065795780980053377632656584997": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "cosh_downward (23) == 4872401723.124451300068625740569997090344": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cosh_downward (24) == 13244561064.92173614708845674912733665919": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# cosh_tonearest +Test "cosh_tonearest (22) == 1792456423.065795780980053377632656584997": +ildouble: 1 +ldouble: 1 + +# cosh_towardzero +Test "cosh_towardzero (22) == 1792456423.065795780980053377632656584997": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "cosh_towardzero (23) == 4872401723.124451300068625740569997090344": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cosh_towardzero (24) == 13244561064.92173614708845674912733665919": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# cosh_upward +Test "cosh_upward (23) == 4872401723.124451300068625740569997090344": +ildouble: 1 +ldouble: 1 + # cpow Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i": float: 1 @@ -932,6 +1264,36 @@ Test "log1p (-0.25) == -0.287682072451780927439219005993827432": float: 1 ifloat: 1 +# pow_downward +Test "pow_downward (1.0625, 1.125) == 1.070582293028761362162622578677070098674": +ildouble: 1 +ldouble: 1 +Test "pow_downward (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# pow_towardzero +Test "pow_towardzero (1.0625, 1.125) == 1.070582293028761362162622578677070098674": +ildouble: 1 +ldouble: 1 +Test "pow_towardzero (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# pow_upward +Test "pow_upward (1.0625, 1.125) == 1.070582293028761362162622578677070098674": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "pow_upward (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +ildouble: 1 +ldouble: 1 + # sin_downward Test "sin_downward (1) == 0.8414709848078965066525023216302989996226": ildouble: 1 @@ -1065,6 +1427,58 @@ Test "sinh (0x8p-32) == 1.86264514923095703232705808926175479e-9": ildouble: 1 ldouble: 1 +# sinh_downward +Test "sinh_downward (22) == 1792456423.065795780701106568345764104225": +float: 1 +ifloat: 1 +ildouble: 4 +ldouble: 4 +Test "sinh_downward (23) == 4872401723.124451299966006944252978187305": +float: 1 +ifloat: 1 +Test "sinh_downward (24) == 13244561064.92173614705070540368454568168": +float: 1 +ifloat: 1 +ildouble: 5 +ldouble: 5 + +# sinh_tonearest +Test "sinh_tonearest (22) == 1792456423.065795780701106568345764104225": +ildouble: 3 +ldouble: 3 +Test "sinh_tonearest (23) == 4872401723.124451299966006944252978187305": +ildouble: 1 +ldouble: 1 +Test "sinh_tonearest (24) == 13244561064.92173614705070540368454568168": +ildouble: 6 +ldouble: 6 + +# sinh_towardzero +Test "sinh_towardzero (22) == 1792456423.065795780701106568345764104225": +float: 1 +ifloat: 1 +ildouble: 4 +ldouble: 4 +Test "sinh_towardzero (23) == 4872401723.124451299966006944252978187305": +float: 1 +ifloat: 1 +Test "sinh_towardzero (24) == 13244561064.92173614705070540368454568168": +float: 1 +ifloat: 1 +ildouble: 5 +ldouble: 5 + +# sinh_upward +Test "sinh_upward (22) == 1792456423.065795780701106568345764104225": +ildouble: 16 +ldouble: 16 +Test "sinh_upward (23) == 4872401723.124451299966006944252978187305": +ildouble: 27 +ldouble: 27 +Test "sinh_upward (24) == 13244561064.92173614705070540368454568168": +ildouble: 7 +ldouble: 7 + # tan Test "tan (pi/4) == 1": double: 1 @@ -1372,8 +1786,16 @@ ifloat: 1 ildouble: 1 ldouble: 1 +Function: Real part of "cacos": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + Function: Imaginary part of "cacos": +double: 2 float: 1 +idouble: 2 ifloat: 1 ildouble: 2 ldouble: 2 @@ -1403,7 +1825,9 @@ ildouble: 2 ldouble: 2 Function: Imaginary part of "casin": +double: 2 float: 1 +idouble: 2 ifloat: 1 ildouble: 2 ldouble: 2 @@ -1546,6 +1970,26 @@ ifloat: 2 ildouble: 1 ldouble: 1 +Function: "cosh_downward": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: "cosh_tonearest": +ildouble: 1 +ldouble: 1 + +Function: "cosh_towardzero": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: "cosh_upward": +ildouble: 1 +ldouble: 1 + Function: Real part of "cpow": double: 2 float: 5 @@ -1718,6 +2162,24 @@ Function: "log1p": float: 1 ifloat: 1 +Function: "pow_downward": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "pow_towardzero": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "pow_upward": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + Function: "sin_downward": float: 1 ifloat: 1 @@ -1754,6 +2216,26 @@ Function: "sinh": ildouble: 1 ldouble: 1 +Function: "sinh_downward": +float: 1 +ifloat: 1 +ildouble: 5 +ldouble: 5 + +Function: "sinh_tonearest": +ildouble: 6 +ldouble: 6 + +Function: "sinh_towardzero": +float: 1 +ifloat: 1 +ildouble: 5 +ldouble: 5 + +Function: "sinh_upward": +ildouble: 27 +ldouble: 27 + Function: "tan": double: 1 idouble: 1 diff --git a/libc/sysdeps/x86_64/fpu/printf_fphex.c b/libc/sysdeps/x86_64/fpu/printf_fphex.c index 0b6bfc6bd..7de7283c4 100644 --- a/libc/sysdeps/x86_64/fpu/printf_fphex.c +++ b/libc/sysdeps/x86_64/fpu/printf_fphex.c @@ -1,5 +1,5 @@ /* Print floating point number in hexadecimal notation according to ISO C99. - Copyright (C) 1997,1998,1999,2000,2001,2005 Free Software Foundation, Inc. + Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -57,6 +57,7 @@ do { \ \ /* We use a full nibble for the leading digit. */ \ leading = *numstr++; \ + wnumstr++; \ \ /* We have 3 bits from the mantissa in the leading nibble. \ Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'. */ \ diff --git a/libc/time/Makefile b/libc/time/Makefile index d47aaed33..14be188c8 100644 --- a/libc/time/Makefile +++ b/libc/time/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991-2003, 2004, 2005, 2007, 2011 Free Software Foundation, Inc. +# Copyright (C) 1991-2005,2007,2011,2012 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -35,7 +35,6 @@ routines := offtime asctime clock ctime ctime_r difftime \ routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \ := wcsftime wcsftime_l aux-$(OPTION_EGLIBC_LOCALE_CODE) += alt_digit era lc-time-cleanup -distribute := datemsk tests := test_time clocktest tst-posixtz \ tst-getdate tst-mktime tst-mktime2 tst-strftime \ diff --git a/libc/timezone/Makefile b/libc/timezone/Makefile index 62e42747d..484e60ad6 100644 --- a/libc/timezone/Makefile +++ b/libc/timezone/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1998,1999,2000,2002,2005,2007 Free Software Foundation, Inc. +# Copyright (C) 1998-2000,2002,2005,2007,2012 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -20,23 +20,18 @@ # subdir := timezone -distribute := tzfile.h private.h scheck.c ialloc.c yearistype \ - iso3166.tab zone.tab tzselect.ksh checktab.awk \ - README - extra-objs := scheck.o ialloc.o others := zdump zic tests := test-tz tst-timezone +# pacificnew doesn't compile; if it is to be used, it should be included in +# northamerica. tzbases := africa antarctica asia australasia europe northamerica \ southamerica etcetera factory \ solar87 solar88 solar89 tzlinks := backward systemv tzfiles := $(tzbases) $(tzlinks) -# pacificnew doesn't compile; if it is to be used, it should be included in -# northamerica. -distribute += $(tzfiles) leapseconds pacificnew simplebackw generated := $(addprefix z.,$(tzfiles)) install-sbin := zic zdump @@ -49,30 +44,6 @@ include ../Makeconfig # Get objpfx defined so we can use it below. CPPFLAGS-zic = -DNOT_IN_libc -# z.* use this variable. -define nl - - -endef -ifndef avoid-generated -ifndef inhibit_timezone_rules --include $(addprefix $(objpfx)z.,$(tzfiles)) -endif -endif - -# Make these absolute file names. -installed-localtime-file := $(firstword $(filter /%,$(inst_localtime-file)) \ - $(addprefix $(inst_zonedir)/, \ - $(localtime-file))) -installed-posixrules-file := $(firstword $(filter /%,$(posixrules-file)) \ - $(addprefix $(inst_zonedir)/, \ - $(posixrules-file))) - -install-others = $(addprefix $(inst_zonedir)/,$(zonenames) \ - $(zonenames:%=posix/%) \ - $(zonenames:%=right/%)) \ - $(installed-localtime-file) $(installed-posixrules-file) - ifeq ($(have-ksh),yes) install-others += $(inst_zonedir)/iso3166.tab $(inst_zonedir)/zone.tab install-bin-script = tzselect @@ -82,99 +53,6 @@ endif include ../Rules -$(tzfiles:%=$(objpfx)z.%): $(objpfx)z.%: % Makefile -# Kludge alert: we use an implicit rule (in what we are generating here) -# because that is the only way to tell Make that the one command builds all -# the files. -# The extra kludge for the $(tzlinks) files is necessary since running zic -# this file requires all other files to exist. Blech! - $(make-target-directory) - (echo 'define $*-zones' ;\ - $(AWK) '$$1 == "Zone" { print $$2 } $$1 == "Link" { print $$3 }' $^ ;\ - echo 'endef' ;\ - echo '$*-zones := $$(subst $$(nl), ,$$($*-zones))' ;\ - echo 'ifdef $*-zones' ;\ - if test x$(findstring $*, $(tzlinks)) != x; then \ - echo '$$(addprefix $$(inst_zonedir)/right/,$$($*-zones)): \';\ - echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/right/,$$($$t-zones)))' ;\ - echo '$$(addprefix $$(inst_zonedir)/posix/,$$($*-zones)): \';\ - echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/posix/,$$($$t-zones)))' ;\ - echo '$$(addprefix $$(inst_zonedir)/,$$($*-zones)): \' ;\ - echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/,$$($$t-zones)))' ;\ - fi ;\ - echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/right/,$$($*-zones)): \' ;) > $@.new - -ifeq (no,$(cross-compiling)) - (echo '$< $$(objpfx)zic leapseconds yearistype' ;) >> $@.new -else - (echo '$< $$(objpfx)cross-zic leapseconds yearistype' ;) >> $@.new -endif - - (echo ' $$(tzcompile)' ;\ - echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/posix/,$$($*-zones)): \' ;) >> $@.new - -ifeq (no,$(cross-compiling)) - (echo '$< $$(objpfx)zic /dev/null yearistype' ;) >> $@.new -else - (echo '$< $$(objpfx)cross-zic /dev/null yearistype' ;) >> $@.new -endif - - (echo ' $$(tzcompile)' ;\ - echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/,$$($*-zones)): \' ;) >> $@.new - -ifeq (no,$(cross-compiling)) - (echo '$< $$(objpfx)zic $$(leapseconds) yearistype' ;) >> $@.new -else - (echo '$< $$(objpfx)cross-zic $$(leapseconds) yearistype' ;) >> $@.new -endif - - (echo ' $$(tzcompile)' ;\ - echo 'endif' ;\ - echo 'zonenames := $$(zonenames) $$($*-zones)' ;) >> $@.new - mv $@.new $@ - -.PHONY: echo-zonenames -echo-zonenames: - @echo 'Known zones: $(zonenames)' - - -# We have to use `-d $(inst_zonedir)' to explictly tell zic where to -# place the output files although $(zonedir) is compiled in. But the -# user might have set $(install_root) on the command line of `make install'. -ifeq (no,$(cross-compiling)) -zic-cmd = $(built-program-cmd) -d $(inst_zonedir) -else -zic-cmd = $(objpfx)cross-zic -d $(inst_zonedir) -endif -tzcompile = $(zic-cmd)$(target-zone-flavor) -L $(word 3,$^) \ - -y $(dir $(word 4,$^))$(notdir $(word 4,$^)) $< - -# The source files specify the zone names relative to the -d directory, -# so for the posix/ and right/ flavors we need to pass -d $(inst_zonedir)/posix -# and the like. This magic extracts /posix or /right if it's the first -# component after $(inst_zonedir) in the target name $@. -target-zone-flavor = $(filter /posix /right, \ - /$(firstword $(subst /, , \ - $(patsubst $(inst_zonedir)/%,%,$@)))) - -ifdef localtime -$(installed-localtime-file): $(inst_zonedir)/$(localtime) $(objpfx)zic \ - $(+force) - $(make-target-directory) - if test -r $@; then \ - echo Site timezone NOT reset to Factory.; \ - else \ - rm -f $@T; \ - $(SHELL) $(..)scripts/rellns-sh $< $@T; \ - mv -f $@T $@; \ - fi -endif -ifdef posixrules -$(installed-posixrules-file): $(inst_zonedir)/$(posixrules) $(objpfx)zic \ - $(+force) - $(zic-cmd) -p $(posixrules) -endif - zic-objs = zic.o ialloc.o scheck.o $(objpfx)zic: $(addprefix $(objpfx), $(zic-objs)) diff --git a/libc/wcsmbs/Makefile b/libc/wcsmbs/Makefile index 2cef1d39e..60172ef04 100644 --- a/libc/wcsmbs/Makefile +++ b/libc/wcsmbs/Makefile @@ -24,7 +24,6 @@ include ../option-groups.mak subdir := wcsmbs headers := wchar.h bits/wchar.h bits/wchar2.h bits/wchar-ldbl.h uchar.h -distribute := wcwidth.h wcsmbsload.h # These functions are used by printf_fp.c, even in the plain case; see # comments there for OPTION_EGLIBC_LOCALE_CODE. diff --git a/libc/wctype/Makefile b/libc/wctype/Makefile index 4e91a6206..878939815 100644 --- a/libc/wctype/Makefile +++ b/libc/wctype/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1996, 1997, 1999, 2000, 2008 Free Software Foundation, Inc. +# Copyright (C) 1996,1997,1999,2000,2008,2012 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -23,7 +23,6 @@ include ../option-groups.mak subdir := wctype headers := wctype.h -distribute := wchar-lookup.h routines := wctrans towctrans towctrans_l routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \ := wcfuncs wctype iswctype \ diff --git a/ports/ChangeLog.alpha b/ports/ChangeLog.alpha index 32e851528..c4ebcd906 100644 --- a/ports/ChangeLog.alpha +++ b/ports/ChangeLog.alpha @@ -1,3 +1,23 @@ +2012-03-04 Richard Henderson <rth@twiddle.net> + + * sysdeps/unix/sysv/linux/alpha/ioperm.c (inline_sethae): Mark + as always_inline. + +2012-03-04 Richard Henderson <rth@twiddle.net> + + * sysdeps/unix/sysv/linux/alpha/bits/socket.h (recvmmsg): Only + declare if __USE_GNU. + (sendmmsg): Add declaration. + +2012-03-04 Richard Henderson <rth@twiddle.net> + + * sysdeps/unix/sysv/linux/alpha/bits/siginfo.h: Don't name the + siginfo_t struct. Add forward declaration of pthread_attr_t; + use it in sigevent. + * sysdeps/unix/sysv/linux/alpha/nptl/bits/pthreadtypes.h + (pthread_attr_t): Add union tag to pthread_attr_t; only define + typedef if not already defined. + 2012-02-21 Richard Henderson <rth@twiddle.net> * sysdeps/unix/sysv/linux/alpha/bits/epoll.h: New file. diff --git a/ports/ChangeLog.arm b/ports/ChangeLog.arm index 982699cb2..18af911ab 100644 --- a/ports/ChangeLog.arm +++ b/ports/ChangeLog.arm @@ -1,3 +1,13 @@ +2012-03-05 Michael Hope <michael.hope@linaro.org> + + * sysdeps/unix/sysv/linux/arm/eabi/getcontext.S: New file. + * sysdeps/unix/sysv/linux/arm/eabi/makecontext.c: New file. + * sysdeps/unix/sysv/linux/arm/eabi/setcontext.S: New file. + * sysdeps/unix/sysv/linux/arm/eabi/swapcontext.S: New file. + * sysdeps/unix/sysv/linux/arm/ucontext_i.sym: New file. + * sysdeps/unix/sysv/linux/arm/Makefile (gen-as-const-headers): Add + ucontext_i.sym. + 2012-02-27 Joseph Myers <joseph@codesourcery.com> * sysdeps/unix/sysv/linux/arm/nptl/bits/pthreadtypes.h diff --git a/ports/ChangeLog.hppa b/ports/ChangeLog.hppa index e7a80e50d..842d1bf5e 100644 --- a/ports/ChangeLog.hppa +++ b/ports/ChangeLog.hppa @@ -1,3 +1,10 @@ +2012-03-03 Carlos O'Donell <carlos@systemhalted.org> + + * sysdeps/unix/sysv/linux/hppa/nptl/bits/pthreadtypes.h: Name + pthread_attr_t union. + * sysdeps/unix/sysv/linux/hppa/nptl/pthread.h: Sync from libc copy. + * sysdeps/unix/sysv/linux/hppa/bits/socket.h: Likewise. + 2012-01-08 Carlos O'Donell <carlos@systemhalted.org> * sysdeps/unix/sysv/linux/hppa/sys/epoll.h (EPOLLONESHOT) diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k index 1ab074f9f..0f1354d7a 100644 --- a/ports/ChangeLog.m68k +++ b/ports/ChangeLog.m68k @@ -1,3 +1,7 @@ +2012-03-05 Andreas Schwab <schwab@linux-m68k.org> + + * sysdeps/m68k/m680x0/fpu/libm-test-ulps: Update. + 2012-03-02 Andreas Schwab <schwab@linux-m68k.org> * sysdeps/m68k/m680x0/fpu/libm-test-ulps: Update ULPs. diff --git a/ports/sysdeps/m68k/m680x0/fpu/libm-test-ulps b/ports/sysdeps/m68k/m680x0/fpu/libm-test-ulps index f884644f7..8fa326d1b 100644 --- a/ports/sysdeps/m68k/m680x0/fpu/libm-test-ulps +++ b/ports/sysdeps/m68k/m680x0/fpu/libm-test-ulps @@ -388,6 +388,52 @@ float: 1 idouble: 1 ifloat: 1 +# cosh_downward +Test "cosh_downward (22) == 1792456423.065795780980053377632656584997": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "cosh_downward (23) == 4872401723.124451300068625740569997090344": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cosh_downward (24) == 13244561064.92173614708845674912733665919": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# cosh_towardzero +Test "cosh_towardzero (22) == 1792456423.065795780980053377632656584997": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "cosh_towardzero (23) == 4872401723.124451300068625740569997090344": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cosh_towardzero (24) == 13244561064.92173614708845674912733665919": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# cosh_upward +Test "cosh_upward (22) == 1792456423.065795780980053377632656584997": +ildouble: 1 +ldouble: 1 +Test "cosh_upward (24) == 13244561064.92173614708845674912733665919": +double: 1 +idouble: 1 + # cpow Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i": float: 1 @@ -890,6 +936,42 @@ ifloat: 1 ildouble: 7 ldouble: 7 +# pow_downward +Test "pow_downward (1.0625, 1.125) == 1.070582293028761362162622578677070098674": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "pow_downward (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# pow_towardzero +Test "pow_towardzero (1.0625, 1.125) == 1.070582293028761362162622578677070098674": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "pow_towardzero (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# pow_upward +Test "pow_upward (1.0625, 1.125) == 1.070582293028761362162622578677070098674": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "pow_upward (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + # sin_downward Test "sin_downward (1) == 0.8414709848078965066525023216302989996226": ildouble: 1 @@ -1035,6 +1117,53 @@ Test "sinh (0.75) == 0.822316731935829980703661634446913849": ildouble: 1 ldouble: 1 +# sinh_downward +Test "sinh_downward (22) == 1792456423.065795780701106568345764104225": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sinh_downward (23) == 4872401723.124451299966006944252978187305": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sinh_downward (24) == 13244561064.92173614705070540368454568168": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# sinh_towardzero +Test "sinh_towardzero (22) == 1792456423.065795780701106568345764104225": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sinh_towardzero (23) == 4872401723.124451299966006944252978187305": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sinh_towardzero (24) == 13244561064.92173614705070540368454568168": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# sinh_upward +Test "sinh_upward (24) == 13244561064.92173614705070540368454568168": +double: 1 +idouble: 1 + # tan Test "tan (0.75) == 0.931596459944072461165202756573936428": ildouble: 1 @@ -1525,6 +1654,28 @@ ifloat: 1 ildouble: 1 ldouble: 1 +Function: "cosh_downward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "cosh_towardzero": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "cosh_upward": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + Function: Real part of "cpow": double: 1 float: 3 @@ -1679,6 +1830,30 @@ ifloat: 1 ildouble: 7 ldouble: 7 +Function: "pow_downward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "pow_towardzero": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "pow_upward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + Function: "sin_downward": double: 1 float: 1 @@ -1715,6 +1890,26 @@ Function: "sinh": ildouble: 1 ldouble: 1 +Function: "sinh_downward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "sinh_towardzero": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "sinh_upward": +double: 1 +idouble: 1 + Function: "tan": double: 1 idouble: 1 diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/siginfo.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/siginfo.h index a2aacc04b..8d0c71653 100644 --- a/ports/sysdeps/unix/sysv/linux/alpha/bits/siginfo.h +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/siginfo.h @@ -1,5 +1,5 @@ /* siginfo_t, sigevent and constants. Linux/Alpha version. - Copyright (C) 1997-2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -42,7 +42,7 @@ typedef union sigval # define __SI_MAX_SIZE 128 # define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4) -typedef struct siginfo +typedef struct { int si_signo; /* Signal number. */ int si_errno; /* If non-zero, an errno value associated with @@ -260,6 +260,12 @@ enum # define __SIGEV_MAX_SIZE 64 # define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 4) +/* Forward declaration. */ +#ifndef __have_pthread_attr_t +typedef union pthread_attr_t pthread_attr_t; +# define __have_pthread_attr_t 1 +#endif + typedef struct sigevent { sigval_t sigev_value; @@ -277,7 +283,7 @@ typedef struct sigevent struct { void (*_function) (sigval_t); /* Function to start. */ - void *_attribute; /* Really pthread_attr_t. */ + pthread_attr_t *_attribute; /* Thread attributes. */ } _sigev_thread; } _sigev_un; } sigevent_t; diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/socket.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/socket.h index a39629cc5..238538e3c 100644 --- a/ports/sysdeps/unix/sysv/linux/alpha/bits/socket.h +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/socket.h @@ -1,6 +1,5 @@ /* System-specific socket constants and types. Linux version. - Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + Copyright (C) 1991-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -417,14 +416,22 @@ struct linger __BEGIN_DECLS -/* Receive a message as described by MESSAGE from socket FD. +#ifdef __USE_GNU +/* Receive up to VLEN messages as described by VMESSAGES from socket FD. Returns the number of bytes read or -1 for errors. - This function is a cancellation point and therefore not marked with __THROW. */ extern int recvmmsg (int __fd, struct mmsghdr *__vmessages, unsigned int __vlen, int __flags, - __const struct timespec *__tmo); + const struct timespec *__tmo); + +/* Send a VLEN messages as described by VMESSAGES to socket FD. + Return the number of datagrams successfully written or -1 for errors. + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int sendmmsg (int __fd, struct mmsghdr *__vmessages, + unsigned int __vlen, int __flags); +#endif __END_DECLS diff --git a/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c b/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c index 32e96ec2f..b4e420b1d 100644 --- a/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c +++ b/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c @@ -220,7 +220,7 @@ port_to_cpu_addr (unsigned long int port, ioswizzle_t ioswiz, int size) return io.base + (port << 7) + ((size - 1) << 5); } -static inline void +static inline __attribute__((always_inline)) void inline_sethae (unsigned long int addr, ioswizzle_t ioswiz) { if (ioswiz == IOSWIZZLE_SPARSE) diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/bits/pthreadtypes.h b/ports/sysdeps/unix/sysv/linux/alpha/nptl/bits/pthreadtypes.h index 41c0be197..bea9955fd 100644 --- a/ports/sysdeps/unix/sysv/linux/alpha/nptl/bits/pthreadtypes.h +++ b/ports/sysdeps/unix/sysv/linux/alpha/nptl/bits/pthreadtypes.h @@ -1,5 +1,5 @@ /* Machine-specific pthread type layouts. Alpha version. - Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 2003-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -36,12 +36,15 @@ typedef unsigned long int pthread_t; -typedef union +union pthread_attr_t { char __size[__SIZEOF_PTHREAD_ATTR_T]; long int __align; -} pthread_attr_t; - +}; +#ifndef __have_pthread_attr_t +typedef union pthread_attr_t pthread_attr_t; +# define __have_pthread_attr_t 1 +#endif typedef struct __pthread_internal_list { diff --git a/ports/sysdeps/unix/sysv/linux/arm/Makefile b/ports/sysdeps/unix/sysv/linux/arm/Makefile index d91b96859..a9817368a 100644 --- a/ports/sysdeps/unix/sysv/linux/arm/Makefile +++ b/ports/sysdeps/unix/sysv/linux/arm/Makefile @@ -20,3 +20,7 @@ endif ifeq ($(subdir),resource) sysdep_routines += oldgetrlimit64 endif + +ifeq ($(subdir),stdlib) +gen-as-const-headers += ucontext_i.sym +endif diff --git a/ports/sysdeps/unix/sysv/linux/arm/eabi/getcontext.S b/ports/sysdeps/unix/sysv/linux/arm/eabi/getcontext.S new file mode 100644 index 000000000..435eb12c8 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/arm/eabi/getcontext.S @@ -0,0 +1,113 @@ +/* Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> +#include <rtld-global-offsets.h> + +#include "ucontext_i.h" + + .syntax unified + .text + +/* int getcontext (ucontext_t *ucp) */ + +ENTRY(__getcontext) + /* No need to save r0-r3, d0-d7, or d16-d31. */ + add r1, r0, #MCONTEXT_ARM_R4 + stmia r1, {r4-r11} + + /* Save R13 separately as Thumb can't STM it. */ + str r13, [r0, #MCONTEXT_ARM_SP] + str r14, [r0, #MCONTEXT_ARM_LR] + /* Return to LR */ + str r14, [r0, #MCONTEXT_ARM_PC] + /* Return zero */ + mov r2, #0 + str r2, [r0, #MCONTEXT_ARM_R0] + + /* Save ucontext_t * across the next call. */ + mov r4, r0 + + /* __sigprocmask(SIG_BLOCK, NULL, &(ucontext->uc_sigmask)) */ + mov r0, #SIG_BLOCK + mov r1, #0 + add r2, r4, #UCONTEXT_SIGMASK + bl PLTJMP(__sigprocmask) + + /* Store FP regs. Much of the FP code is copied from arm/eabi/setjmp.S. */ + +#ifdef PIC + ldr r2, 1f + ldr r1, Lrtld_global_ro +0: add r2, pc, r2 + ldr r2, [r2, r1] + ldr r2, [r2, #RTLD_GLOBAL_RO_DL_HWCAP_OFFSET] +#else + ldr r2, Lhwcap + ldr r2, [r2, #0] +#endif + + add r0, r4, #UCONTEXT_REGSPACE + + tst r2, #HWCAP_ARM_VFP + beq Lno_vfp + + /* Store the VFP registers. + Don't use VFP instructions directly because this code + is used in non-VFP multilibs. */ + /* Following instruction is vstmia r0!, {d8-d15}. */ + stc p11, cr8, [r0], #64 + /* Store the floating-point status register. */ + /* Following instruction is vmrs r1, fpscr. */ + mrc p10, 7, r1, cr1, cr0, 0 + str r1, [r0], #4 +Lno_vfp: + + tst r2, #HWCAP_ARM_IWMMXT + beq Lno_iwmmxt + + /* Save the call-preserved iWMMXt registers. */ + /* Following instructions are wstrd wr10, [r0], #8 (etc.) */ + stcl p1, cr10, [r0], #8 + stcl p1, cr11, [r0], #8 + stcl p1, cr12, [r0], #8 + stcl p1, cr13, [r0], #8 + stcl p1, cr14, [r0], #8 + stcl p1, cr15, [r0], #8 +Lno_iwmmxt: + + /* Restore the clobbered R4 and LR. */ + ldr r14, [r4, #MCONTEXT_ARM_LR] + ldr r4, [r4, #MCONTEXT_ARM_R4] + + mov r0, #0 + + DO_RET(r14) + +END(__getcontext) + +#ifdef PIC +1: .long _GLOBAL_OFFSET_TABLE_ - 0b - 8 +Lrtld_global_ro: + .long C_SYMBOL_NAME(_rtld_global_ro)(GOT) +#else +Lhwcap: + .long C_SYMBOL_NAME(_dl_hwcap) +#endif + + +weak_alias(__getcontext, getcontext) diff --git a/ports/sysdeps/unix/sysv/linux/arm/eabi/makecontext.c b/ports/sysdeps/unix/sysv/linux/arm/eabi/makecontext.c new file mode 100644 index 000000000..d6ae6f0d7 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/arm/eabi/makecontext.c @@ -0,0 +1,73 @@ +/* Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <stdarg.h> +#include <ucontext.h> + +/* Number of arguments that go in registers. */ +#define NREG_ARGS 4 + +/* Take a context previously prepared via getcontext() and set to + call func() with the given int only args. */ +void +__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...) +{ + extern void __startcontext (void); + unsigned long *funcstack; + va_list vl; + unsigned long *regptr; + unsigned int reg; + int misaligned; + + /* Start at the top of stack. */ + funcstack = (unsigned long *) (ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size); + + /* Ensure the stack stays eight byte aligned. */ + misaligned = ((unsigned long) funcstack & 4) != 0; + + if ((argc > NREG_ARGS) && (argc & 1) != 0) + misaligned = !misaligned; + + if (misaligned) + funcstack -= 1; + + va_start (vl, argc); + + /* Reserve space for the on-stack arguments. */ + if (argc > NREG_ARGS) + funcstack -= (argc - NREG_ARGS); + + ucp->uc_mcontext.arm_sp = (unsigned long) funcstack; + ucp->uc_mcontext.arm_pc = (unsigned long) func; + + /* Exit to startcontext() with the next context in R4 */ + ucp->uc_mcontext.arm_r4 = (unsigned long) ucp->uc_link; + ucp->uc_mcontext.arm_lr = (unsigned long) __startcontext; + + /* The first four arguments go into registers. */ + regptr = &(ucp->uc_mcontext.arm_r0); + + for (reg = 0; (reg < argc) && (reg < NREG_ARGS); reg++) + *regptr++ = va_arg (vl, unsigned long); + + /* And the remainder on the stack. */ + for (; reg < argc; reg++) + *funcstack++ = va_arg (vl, unsigned long); + + va_end (vl); +} +weak_alias (__makecontext, makecontext) diff --git a/ports/sysdeps/unix/sysv/linux/arm/eabi/setcontext.S b/ports/sysdeps/unix/sysv/linux/arm/eabi/setcontext.S new file mode 100644 index 000000000..78003f52d --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/arm/eabi/setcontext.S @@ -0,0 +1,101 @@ +/* Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> +#include <rtld-global-offsets.h> + +#include "ucontext_i.h" + + .syntax unified + .text + +/* int setcontext (const ucontext_t *ucp) */ + +ENTRY(__setcontext) + mov r4, r0 + add r0, r0, #UCONTEXT_REGSPACE + + /* Restore the VFP registers. Copied from arm/eabi/__longjmp.S. */ +#ifdef PIC + ldr r2, 1f + ldr r1, Lrtld_global_ro +0: add r2, pc, r2 + ldr r2, [r2, r1] + ldr r2, [r2, #RTLD_GLOBAL_RO_DL_HWCAP_OFFSET] +#else + ldr r2, Lhwcap + ldr r2, [r2, #0] +#endif + + tst r2, #HWCAP_ARM_VFP + beq Lno_vfp_sc + + /* Following instruction is vldmia r0!, {d8-d15}. */ + ldc p11, cr8, [r0], #64 + /* Restore the floating-point status register. */ + ldr r1, [r0], #4 + /* Following instruction is fmxr fpscr, r1. */ + mcr p10, 7, r1, cr1, cr0, 0 +Lno_vfp_sc: + tst r2, #HWCAP_ARM_IWMMXT + beq Lno_iwmmxt_sc + + /* Restore the call-preserved iWMMXt registers. */ + /* Following instructions are wldrd wr10, [r0], #8 (etc.) */ + ldcl p1, cr10, [r0], #8 + ldcl p1, cr11, [r0], #8 + ldcl p1, cr12, [r0], #8 + ldcl p1, cr13, [r0], #8 + ldcl p1, cr14, [r0], #8 + ldcl p1, cr15, [r0], #8 +Lno_iwmmxt_sc: + + /* Now bring back the signal status. */ + mov r0, #SIG_SETMASK + add r1, r4, #UCONTEXT_SIGMASK + mov r2, #0 + bl PLTJMP(__sigprocmask) + + /* Loading r0-r3 makes makecontext easier. */ + add r14, r4, #MCONTEXT_ARM_R0 + ldmia r14, {r0-r12} + ldr r13, [r14, #(MCONTEXT_ARM_SP - MCONTEXT_ARM_R0)] + add r14, r14, #(MCONTEXT_ARM_LR - MCONTEXT_ARM_R0) + ldmia r14, {r14, pc} + +END(setcontext) +weak_alias(__setcontext, setcontext) + + /* Called when a makecontext() context returns. Start the + context in R4 or fall through to exit(). */ +ENTRY(__startcontext) + movs r0, r4 + bne PLTJMP(__setcontext) + + @ New context was 0 - exit + b PLTJMP(_exit) +END(__startcontext) + +#ifdef PIC +1: .long _GLOBAL_OFFSET_TABLE_ - 0b - 8 +Lrtld_global_ro: + .long C_SYMBOL_NAME(_rtld_global_ro)(GOT) +#else +Lhwcap: + .long C_SYMBOL_NAME(_dl_hwcap) +#endif + diff --git a/ports/sysdeps/unix/sysv/linux/arm/eabi/swapcontext.S b/ports/sysdeps/unix/sysv/linux/arm/eabi/swapcontext.S new file mode 100644 index 000000000..09492d000 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/arm/eabi/swapcontext.S @@ -0,0 +1,63 @@ +/* Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + +#include "ucontext_i.h" + + .syntax unified + .text + +/* int swapcontext (ucontext_t *oucp, const ucontext_t *ucp) */ + +ENTRY(swapcontext) + + /* Have getcontext() do most of the work then fix up + LR afterwards. Save R3 to keep the stack aligned. */ + push {r0,r1,r3,r14} + cfi_adjust_cfa_offset (16) + cfi_rel_offset (r0,0) + cfi_rel_offset (r1,4) + cfi_rel_offset (r3,8) + cfi_rel_offset (r14,12) + + bl __getcontext + mov r4, r0 + + pop {r0,r1,r3,r14} + cfi_adjust_cfa_offset (-16) + cfi_restore (r0) + cfi_restore (r1) + cfi_restore (r3) + cfi_restore (r14) + + /* Exit if getcontext() failed. */ + cmp r4, #0 + itt ne + movne r0, r4 + RETINSTR(ne, r14) + + /* Fix up LR and the PC. */ + str r13,[r0, #MCONTEXT_ARM_SP] + str r14,[r0, #MCONTEXT_ARM_LR] + str r14,[r0, #MCONTEXT_ARM_PC] + + /* And swap using swapcontext(). */ + mov r0, r1 + b __setcontext + +END(swapcontext) diff --git a/ports/sysdeps/unix/sysv/linux/arm/ucontext_i.sym b/ports/sysdeps/unix/sysv/linux/arm/ucontext_i.sym new file mode 100644 index 000000000..306292f1f --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/arm/ucontext_i.sym @@ -0,0 +1,30 @@ +#include <inttypes.h> +#include <signal.h> +#include <stddef.h> +#include <sys/ucontext.h> + +SIG_BLOCK +SIG_SETMASK + +-- Offsets of the fields in the ucontext_t structure. +#define ucontext(member) offsetof (ucontext_t, member) +#define mcontext(member) ucontext (uc_mcontext.member) + +UCONTEXT_FLAGS ucontext (uc_flags) +UCONTEXT_LINK ucontext (uc_link) +UCONTEXT_STACK ucontext (uc_stack) +UCONTEXT_MCONTEXT ucontext (uc_mcontext) +UCONTEXT_SIGMASK ucontext (uc_sigmask) + +UCONTEXT_REGSPACE ucontext (uc_regspace) + +MCONTEXT_TRAP_NO mcontext (trap_no) +MCONTEXT_ERROR_CODE mcontext (error_code) +MCONTEXT_OLDMASK mcontext (oldmask) +MCONTEXT_ARM_R0 mcontext (arm_r0) +MCONTEXT_ARM_R4 mcontext (arm_r4) +MCONTEXT_ARM_SP mcontext (arm_sp) +MCONTEXT_ARM_LR mcontext (arm_lr) +MCONTEXT_ARM_PC mcontext (arm_pc) +MCONTEXT_ARM_CPSR mcontext (arm_cpsr) +MCONTEXT_FAULT_ADDRESS mcontext (fault_address) diff --git a/ports/sysdeps/unix/sysv/linux/hppa/bits/socket.h b/ports/sysdeps/unix/sysv/linux/hppa/bits/socket.h index 05814a002..7870f751e 100644 --- a/ports/sysdeps/unix/sysv/linux/hppa/bits/socket.h +++ b/ports/sysdeps/unix/sysv/linux/hppa/bits/socket.h @@ -1,6 +1,5 @@ /* System-specific socket constants and types. Linux version. - Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007, 2008, 2009, - 2010 Free Software Foundation, Inc. + Copyright (C) 1991-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef __BITS_SOCKET_H #define __BITS_SOCKET_H @@ -65,7 +63,6 @@ enum __socket_type SOCK_CLOEXEC = 010000000, /* Atomically set close-on-exec flag for the new descriptor(s). */ #define SOCK_CLOEXEC SOCK_CLOEXEC -#undef SOCK_NONBLOCK SOCK_NONBLOCK = 0x40000000 /* Atomically mark descriptor(s) as non-blocking. */ #define SOCK_NONBLOCK SOCK_NONBLOCK @@ -110,7 +107,10 @@ enum __socket_type #define PF_ISDN 34 /* mISDN sockets. */ #define PF_PHONET 35 /* Phonet sockets. */ #define PF_IEEE802154 36 /* IEEE 802.15.4 sockets. */ -#define PF_MAX 37 /* For now.. */ +#define PF_CAIF 37 /* CAIF sockets. */ +#define PF_ALG 38 /* Algorithm sockets. */ +#define PF_NFC 39 /* NFC sockets. */ +#define PF_MAX 40 /* For now.. */ /* Address families. */ #define AF_UNSPEC PF_UNSPEC @@ -151,6 +151,9 @@ enum __socket_type #define AF_ISDN PF_ISDN #define AF_PHONET PF_PHONET #define AF_IEEE802154 PF_IEEE802154 +#define AF_CAIF PF_CAIF +#define AF_ALG PF_ALG +#define AF_NFC PF_NFC #define AF_MAX PF_MAX /* Socket level values. Others are defined in the appropriate headers. @@ -233,12 +236,12 @@ enum #define MSG_NOSIGNAL MSG_NOSIGNAL MSG_MORE = 0x8000, /* Sender will send more. */ #define MSG_MORE MSG_MORE - MSG_WAITFORONE = 0x10000, /* Wait for at least one packet to return.*/ -#define MSG_WAITFORONE MSG_WAITFORONE + MSG_WAITFORONE = 0x10000, /* Wait for at least one packet to return.*/ +#define MSG_WAITFORONE MSG_WAITFORONE MSG_CMSG_CLOEXEC = 0x40000000 /* Set close_on_exit for file - descriptor received through - SCM_RIGHTS. */ + descriptor received through + SCM_RIGHTS. */ #define MSG_CMSG_CLOEXEC MSG_CMSG_CLOEXEC }; @@ -262,6 +265,15 @@ struct msghdr int msg_flags; /* Flags on received message. */ }; +#ifdef __USE_GNU +/* For `recvmmsg'. */ +struct mmsghdr + { + struct msghdr msg_hdr; /* Actual message header. */ + unsigned int msg_len; /* Number of received bytes for the entry. */ + }; +#endif + /* Structure used for storage of ancillary data object information. */ struct cmsghdr { @@ -304,7 +316,7 @@ __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; + return (struct cmsghdr *) 0; __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)); @@ -313,7 +325,7 @@ __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)) || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len) > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen))) /* No more entries. */ - return 0; + return (struct cmsghdr *) 0; return __cmsg; } #endif /* Use `extern inline'. */ @@ -406,4 +418,27 @@ struct linger int l_linger; /* Time to linger. */ }; + +__BEGIN_DECLS + +#ifdef __USE_GNU +/* Receive up to VLEN messages as described by VMESSAGES from socket FD. + Returns the number of bytes read or -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int recvmmsg (int __fd, struct mmsghdr *__vmessages, + unsigned int __vlen, int __flags, + const struct timespec *__tmo); + +/* Send a VLEN messages as described by VMESSAGES to socket FD. + Return the number of datagrams successfully written or -1 for errors. +This function is a cancellation point and therefore not marked with + __THROW. */ +extern int sendmmsg (int __fd, struct mmsghdr *__vmessages, + unsigned int __vlen, int __flags); +#endif + +__END_DECLS + #endif /* bits/socket.h */ diff --git a/ports/sysdeps/unix/sysv/linux/hppa/nptl/bits/pthreadtypes.h b/ports/sysdeps/unix/sysv/linux/hppa/nptl/bits/pthreadtypes.h index 952e53c93..afd37d32c 100644 --- a/ports/sysdeps/unix/sysv/linux/hppa/nptl/bits/pthreadtypes.h +++ b/ports/sysdeps/unix/sysv/linux/hppa/nptl/bits/pthreadtypes.h @@ -45,11 +45,15 @@ exposed on purpose. */ typedef unsigned long int pthread_t; -typedef union +union pthread_attr_t { char __size[__SIZEOF_PTHREAD_ATTR_T]; long int __align; -} pthread_attr_t; +}; +#ifndef __have_pthread_attr_t +typedef union pthread_attr_t pthread_attr_t; +# define __have_pthread_attr_t 1 +#endif typedef struct __pthread_internal_slist diff --git a/ports/sysdeps/unix/sysv/linux/hppa/nptl/pthread.h b/ports/sysdeps/unix/sysv/linux/hppa/nptl/pthread.h index 8bb30c949..6a0d95354 100644 --- a/ports/sysdeps/unix/sysv/linux/hppa/nptl/pthread.h +++ b/ports/sysdeps/unix/sysv/linux/hppa/nptl/pthread.h @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _PTHREAD_H #define _PTHREAD_H 1 @@ -22,6 +21,7 @@ #include <features.h> #include <endian.h> #include <sched.h> +#define __need_timespec #include <time.h> #include <bits/pthreadtypes.h> @@ -72,7 +72,7 @@ enum #endif -#ifdef __USE_UNIX98 +#if defined __USE_POSIX199506 || defined __USE_UNIX98 /* Mutex protocols. */ enum { @@ -266,7 +266,8 @@ extern int pthread_detach (pthread_t __th) __THROW; extern pthread_t pthread_self (void) __THROW __attribute__ ((__const__)); /* Compare two thread identifiers. */ -extern int pthread_equal (pthread_t __thread1, pthread_t __thread2) __THROW; +extern int pthread_equal (pthread_t __thread1, pthread_t __thread2) + __THROW __attribute__ ((__const__)); /* Thread attribute handling. */ |