Commit Graph

19642 Commits

Author SHA1 Message Date
Joseph Myers 29cb929332 Add iscanonical.
TS 18661-1 adds an iscanonical classification macro to <math.h>.

The motivation for this is decimal floating-point, where some values
have both canonical and noncanonical encodings.  For IEEE binary
interchange formats, all encodings are canonical.  For x86/m68k
ldbl-96, and for ldbl-128ibm, there are encodings that do not
represent any valid value of the type; although formally iscanonical
does not need to handle trap representations (and so could just always
return 1), it seems useful, and in line with the description in the TS
of "representations that are extraneous to the floating-point model"
as being non-canonical (as well as "redundant representations of some
or all of its values"), for it to detect those representations and
return 0 for them.

This patch adds iscanonical to glibc.  It goes in a header
<bits/iscanonical.h>, included under appropriate conditions in
<math.h>.  The default header version just evaluates the argument
(converted to its semantic type, though current GCC will probably
discard that conversion and any exceptions resulting from it) and
returns 1.  ldbl-96 and ldbl-128ibm then have versions of the header
that call a function __iscanonicall for long double (the sizeof-based
tests will of course need updating for float128 support, like other
such type-generic macro implementations).  The ldbl-96 version of
__iscanonicall has appropriate conditionals to reflect the differences
in the m68k version of that format (where the high mantissa bit may be
either 0 or 1 when the exponent is 0 or 0x7fff).  Corresponding tests
for those formats are added as well.  Other architectures do not have
any new functions added because just returning 1 is correct for all
their floating-point formats.

Tested for x86_64, x86, mips64 (to test the default macro version) and
powerpc.

	* math/math.h [__GLIBC_USE (IEC_60559_BFP_EXT)]: Include
	<bits/iscanonical.h>.
	* bits/iscanonical.h: New file.
	* math/s_iscanonicall.c: Likewise.
	* math/Versions (__iscanonicall): New libm symbol at version
	GLIBC_2.25.
	* math/libm-test.inc (iscanonical_test_data): New array.
	(iscanonical_test): New function.
	(main): Call iscanonical_test.
	* math/Makefile (headers): Add bits/iscanonical.h.
	(type-ldouble-routines): Add s_iscanonicall.
	* manual/arith.texi (Floating Point Classes): Document
	iscanonical.
	* manual/libm-err-tab.pl: Update comment on interfaces without
	ulps tabulated.
	* sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_iscanonicall.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/test-iscanonical-ldbl-128ibm.c:
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm/Makefile (tests): Add
	test-iscanonical-ldbl-128ibm.
	* sysdeps/ieee754/ldbl-96/bits/iscanonical.h: New file.
	* sysdeps/ieee754/ldbl-96/s_iscanonicall.c: Likewise.
	* sysdeps/ieee754/ldbl-96/test-iscanonical-ldbl-96.c: Likewise.
	* sysdeps/ieee754/ldbl-96/Makefile: Likewise.
	* sysdeps/unix/sysv/linux/i386/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
2016-09-30 00:27:50 +00:00
Adhemerval Zanella 458d6339b7 Remove C++ style comments from string3.h
The new check-installed-headers rule check now complains with C++
comment from string3.h with:

../string/bits/string3.h:129:1: error: C++ style comments are not allowed in ISO C90
 // XXX We have no corresponding builtin yet.

Let use old C style comment to make compiler happy in old modes.

Tested on x86_64.

	* string/bits/string3.h: Remove C++ style comments.
2016-09-29 17:16:41 -07:00
Siddhesh Poyarekar 2bf499708d Use copysign instead of ternary for some sin/cos input ranges
These are remaining cases where we can deduce and conclude that the
sign of the result should be the same as the sign of the input being
checked.  For example, for sin(x), the sign of the result is the same
as the result itself for x < pi.  Likewise, for sine values where x
after range reduction falls into this range and its sign is preserved.

	* sysdeps/ieee754/dbl-64/s_sin.c (do_sincos_1): Use copysign
	instead of ternary condition.
	(do_sincos_2): Likewise.
	(__sin): Likewise.
	(__cos): Likewise.
	(slow): Likewise.
	(sloww): Likewise.
	(sloww1): Likewise.
	(bsloww): Likewise.
	(bsloww1): Likewise.
2016-09-30 05:19:05 +05:30
Siddhesh Poyarekar 3459931a1a Use copysign instead of ternary conditions for positive constants
This is the first very simple substitution of ternary conditions for
correction adjustments with __copysign for positive constants.

	* sysdeps/ieee754/dbl-64/s_sin.c (do_cos_slow): use copysign
	instead of ternary condition.
	(do_sin_slow): Likewise.
	(do_sincos_1): Likewise.
	(do_sincos_2): Likewise.
	(__cos): Likewise.
	(sloww): Likewise.
	(sloww1): Likewise.
	(sloww2): Likewise.
	(bsloww): Likewise.
	(bsloww1): Likewise.
	(bsloww2): Likewise.
2016-09-30 05:17:55 +05:30
Siddhesh Poyarekar a87b5e95ad consolidate sign checks for slow2
Simplify the code a bit by consolidating sign checks in slow1 and
slow2 into __sin at the higher level.

	* sysdeps/ieee754/dbl-64/s_sin.c (slow1): Consolidate sign
	check from here...
	(slow2): ... and here...
	(__sin): ... to here.
2016-09-30 05:15:56 +05:30
Joseph Myers b59ad2db99 Fix iszero for excess precision.
Floating-point classification macros are supposed to remove any excess
range or precision from their arguments.  This patch fixes the
non-sNaN version of iszero to do so, by casting the argument to its
own type.  (This will of course work only for standard-conforming
excess precision, not for what GCC does on 32-bit x86 by default where
the back end hides excess precision from the front end; the same
applies to most of the classification macros in that case, as showed
up when we made them use GCC built-in functions.)

(iseqsig will have the reverse issue, needing to ensure that when an
underlying function is used it's for a type wide enough not to remove
any excess precision, since comparison macros must not remove excess
precision.)

Tested for x86_64 and x86.

	* math/math.h
	[__GLIBC_USE (IEC_60559_BFP_EXT) && !__SUPPORT_SNAN__] (iszero):
	Cast argument to its own type.
	* math/test-iszero-excess-precision.c: New file.
	* math/Makefile (tests): Add test-iszero-excess-precision.
	(CFLAGS-test-iszero-excess-precision.c): New variable.
2016-09-28 21:11:58 +00:00
Adhemerval Zanella e83be73091 posix: Fix open file action for posix_spawn on Linux
On posix_spawn open file action (issued by posix_spawn_file_actions_addopen)
POSIX states that if fildes was already an open file descriptor, it shall be
closed before the new file is openedi [1].  This avoid pontential issues when
posix_spawn plus addopen action is called with the process already at maximum
number of file descriptor opened and also for multiple actions on single-open
special paths (like /dev/watchdog).

This fixes its behavior on Linux posix_spawn implementation and also adds
a tests to check for its behavior.

Checked on x86_64.

	* posix/Makefile (tests): Add tst-spawn3.
	* posix/tst-spawn3.c: New file.
	* sysdeps/unix/sysv/linux/spawni.c (__spawni_child): Close file descriptor
	if it is already opened for open action.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn_file_actions_addclose.html
2016-09-28 14:07:35 -07:00
Rasmus Villemoes 4b4d4056bb linux: spawni.c: simplify error reporting to parent
Using CLONE_VFORK already ensures that the parent does not run until the
child has either exec'ed succesfully or called _exit. Hence we don't
need to read from a CLOEXEC pipe to ensure proper synchronization - we
just make explicit use of the fact the the child and parent run in the
same VM, so the child can write an error code to a field of the
posix_spawn_args struct instead of sending it through a pipe.

To ensure that this mechanism really works, the parent initializes the
field to -1 and the child writes 0 before execing.

This eliminates some annoying bookkeeping that is necessary to avoid
the file actions from clobbering the write end of the pipe, and
getting rid of the pipe creation in the first place means fewer system
calls (four in the parent, usually one in the child) and fewer
chanches for the spawn to fail (e.g. if we're close to EMFILE).

Checked on x86_64 and i686.

	* sysdeps/unix/sysv/linux/spawni.c (posix_spawn_args): Remove pipe
	field, add err field.
	(__spawni_child): Report error through err member instead of pipe.
	(__spawnix): Likewise.
2016-09-28 11:16:21 -07:00
Zack Weinberg 8d3bd94748 Minor corrections to scripts/check-installed-headers.sh.
* scripts/check-installed-headers.sh: Generalize treatment of
	sys/elf.h to all target architectures.
2016-09-28 07:28:00 -04:00
Zack Weinberg 32daf20b54 Minor correction to the "installed header hygiene" patches.
* sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Restore accidentally-
	deleted typedef ucontext_t.
2016-09-28 07:19:59 -04:00
Adhemerval Zanella e33a23fbe8 Add INTERNAL_SYSCALL_CALL
This patch adds two new macros for internal and inline syscall to use
within GLIBC: INTERNAL_SYSCALL_CALL and INLINE_SYSCALL_CALL.  They are
similar to the old INTERNAL_SYSCALL and INLINE_SYSCALL with the difference
the new macros accept a variable argument call and do not require to pass
the expected argument size.

The advantage is it is possible to use variable argument macros like
SYSCALL_LL{64} without the need to also handle the argument size.  So
for an ABI where SYSCALL_LL might split the argument in high and low
parts, instead of:

  INTERNAL_SYSCALL_DECL (err);
 #if ...
  INTERNAL_SYSCALL (syscall, err, 2, SYSCALL_LL (len));
 #else
  INTERNAL_SYSCALL (syscall, err, 1, SYSCALL_LL (len));
 #endif

It will be just:

  INTERNAL_SYSCALL_CALL (syscall, err, SYSCALL_LL (len));

The INLINE_SYSCALL_CALL follows the same semanthic regarding the argument
and is similar to INLINE_SYSCALL regarding setting errno.

Checked with a build for x86_64, i386, aach64, armhf, powerpc64le, powerpc32,
and mips32.  No code generation changed.

	* sysdeps/unix/sysdep.h (__INTERNAL_SYSCALL0): New macro.
	(__INTERNAL_SYSCALL1): Likewise.
	(__INTERNAL_SYSCALL2): Likewise.
	(__INTERNAL_SYSCALL3): Likewise.
	(__INTERNAL_SYSCALL4): Likewise.
	(__INTERNAL_SYSCALL5): Likewise.
	(__INTERNAL_SYSCALL6): Likewise.
	(__INTERNAL_SYSCALL7): Likewise.
	(__INTERNAL_SYSCALL_NARGS_X): Likewise.
	(__INTERNAL_SYSCALL_NARGS): Likewise.
	(__INTERNAL_SYSCALL_DISP): Likewise.
	(INTERNAL_SYSCALL_CALL): Likewise.
	(__SYSCALL0): Rename to __INLINE_SYSCALL0.
	(__SYSCALL1): Rename to __INLINE_SYSCALL1.
	(__SYSCALL2): Rename to __INLINE_SYSCALL2.
	(__SYSCALL3): Rename to __INLINE_SYSCALL3.
	(__SYSCALL4): Rename to __INLINE_SYSCALL4.
	(__SYSCALL5): Rename to __INLINE_SYSCALL5.
	(__SYSCALL6): Rename to __INLINE_SYSCALL6.
	(__SYSCALL7): Rename to __INLINE_SYSCALL7.
	(__SYSCALL_NARGS_X): Rename to __INLINE_SYSCALL_NARGS_X.
	(__SYSCALL_NARGS): Rename to __INLINE_SYSCALL_NARGS.
	(__SYSCALL_DISP): Rename to __INLINE_SYSCALL_DISP.
	(__SYSCALL_CALL): Rename to INLINE_SYSCALL_CALL.
	(SYSCALL_CANCEL): Replace __SYSCALL_CALL with INLINE_SYSCALL_CALL.
2016-09-26 08:47:13 -07:00
Joseph Myers bb8081f57f Add iszero.
TS 18661-1 adds an iszero classification macro to <math.h>.  This
patch implements it for glibc.  There are no new underlying functions
in libm because the implementation uses fpclassify when sNaN support
is required and a direct comparison otherwise; any optimizations for
this macro should be done through adding __builtin_iszero in GCC and
using it in the header for suitable GCC versions, not through adding
other optimized inline or out-of-line versions to glibc.

Tested for x86_64 and x86.

	* math/math.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (iszero): New
	macro.
	* math/libm-test.inc (iszero_test_data): New array.
	(iszero_test): New function.
	(main): Call iszero_test.
	* manual/arith.texi (Floating Point Classes): Document iszero.
	* manual/libm-err-tab.pl: Update comment on interfaces without
	ulps tabulated.
2016-09-23 21:54:21 +00:00
Zack Weinberg 4775578486 Installed header hygiene (BZ#20366): Test of installed headers.
This adds a test to ensure that the problems fixed in the last several
patches do not recur.  Each directory checks the headers that it
installs for two properties: first, each header must be compilable in
isolation, as both C and C++, under a representative combination of
language and library conformance levels; second, there is a blacklist
of identifiers that may not appear in any installed header, currently
consisting of the legacy BSD typedefs.  (There is an exemption for the
headers that define those typedefs, and for the RPC headers.  It may be
necessary to make this more sophisticated if we add more stuff to the
blacklist in the future.)

In order for this test to work correctly, every wrapper header
that actually defines something must guard those definitions with
 #ifndef _ISOMAC.  This is the existing mechanism used by the conform/
tests to tell wrapper headers not to define anything that the public
header wouldn't, and not to use anything from libc-symbols.h.  conform/
only cares for headers that we need to check for standards conformance,
whereas this test applies to *every* header.  (Headers in include/ that
are either installed directly, or are internal-use-only and do *not*
correspond to any installed header, are not affected.)

	* scripts/check-installed-headers.sh: New script.
	* Rules: In each directory that defines header files to be installed,
	run check-installed-headers.sh on them as a special test.
	* Makefile: Likewise for the headers installed at top level.

	* include/aliases.h, include/alloca.h, include/argz.h
	* include/arpa/nameser.h, include/arpa/nameser_compat.h
	* include/elf.h, include/envz.h, include/err.h
	* include/execinfo.h, include/fpu_control.h, include/getopt.h
	* include/gshadow.h, include/ifaddrs.h, include/libintl.h
	* include/link.h, include/malloc.h, include/mcheck.h
	* include/mntent.h, include/netinet/ether.h
	* include/nss.h, include/obstack.h, include/printf.h
	* include/pty.h, include/resolv.h, include/rpc/auth.h
	* include/rpc/auth_des.h, include/rpc/auth_unix.h
	* include/rpc/clnt.h, include/rpc/des_crypt.h
	* include/rpc/key_prot.h, include/rpc/netdb.h
	* include/rpc/pmap_clnt.h, include/rpc/pmap_prot.h
	* include/rpc/pmap_rmt.h, include/rpc/rpc.h
	* include/rpc/rpc_msg.h, include/rpc/svc.h
	* include/rpc/svc_auth.h, include/rpc/xdr.h
	* include/rpcsvc/nis_callback.h, include/rpcsvc/nislib.h
	* include/rpcsvc/yp.h, include/rpcsvc/ypclnt.h
	* include/rpcsvc/ypupd.h, include/shadow.h
	* include/stdio_ext.h, include/sys/epoll.h
	* include/sys/file.h, include/sys/gmon.h, include/sys/ioctl.h
	* include/sys/prctl.h, include/sys/profil.h
	* include/sys/statfs.h, include/sys/sysctl.h
	* include/sys/sysinfo.h, include/ttyent.h, include/utmp.h
	* sysdeps/arm/nacl/include/bits/setjmp.h
	* sysdeps/mips/include/sys/asm.h
	* sysdeps/unix/sysv/linux/include/sys/sysinfo.h
	* sysdeps/unix/sysv/linux/include/sys/timex.h
	* sysdeps/x86/fpu/include/bits/fenv.h:
	Add #ifndef _ISOMAC guard around internal declarations.
	Add multiple-inclusion guard if not already present.
2016-09-23 08:43:56 -04:00
Zack Weinberg c66b29f9cc Installed-header hygiene (BZ#20366): stack_t.
sys/ucontext.h unconditionally uses stack_t, and it does not make
sense to change that.  But signal.h only declares stack_t under
__USE_XOPEN_EXTENDED || __USE_XOPEN2K8.  The actual definition is
already in a bits header, bits/sigstack.h, but that header insists on
only being included by signal.h, so we have to change that as well as
all of the sys/ucontext.h variants.  (Some but not all variants of
bits/sigcontext.h, which sys/ucontext.h may also need, had already
received this adjustment; for consistency, I made them all the same,
even if that's not strictly necessary in some configurations.)
bits/sigcontext.h and bits/sigstack.h also all need to receive
multiple inclusion guards.

	* sysdeps/generic/sys/ucontext.h
	* sysdeps/arm/sys/ucontext.h
	* sysdeps/i386/sys/ucontext.h
	* sysdeps/m68k/sys/ucontext.h
	* sysdeps/mips/sys/ucontext.h
	* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
	* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h
	* sysdeps/unix/sysv/linux/arm/sys/ucontext.h
	* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h
	* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h
	* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h
	* sysdeps/unix/sysv/linux/mips/sys/ucontext.h
	* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h
	* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
	* sysdeps/unix/sysv/linux/s390/sys/ucontext.h
	* sysdeps/unix/sysv/linux/sh/sys/ucontext.h
	* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h
	* sysdeps/unix/sysv/linux/tile/sys/ucontext.h
	* sysdeps/unix/sysv/linux/x86/sys/ucontext.h:
	Include both bits/sigcontext.h and bits/sigstack.h.
	Fix grammar error in comment, if present.

	* bits/sigstack.h
	* sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h
	* sysdeps/unix/sysv/linux/alpha/bits/sigstack.h
	* sysdeps/unix/sysv/linux/bits/sigstack.h
	* sysdeps/unix/sysv/linux/ia64/bits/sigstack.h
	* sysdeps/unix/sysv/linux/mips/bits/sigstack.h
	* sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h
	* sysdeps/unix/sysv/linux/sparc/bits/sigstack.h
	* bits/sigcontext.h
	* sysdeps/mach/hurd/i386/bits/sigcontext.h
	* sysdeps/unix/sysv/linux/bits/sigcontext.h
	* sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h
	* sysdeps/unix/sysv/linux/sparc/bits/sigcontext.h:
	Add multiple inclusion guard.  Permit inclusion by sys/ucontext.h
	as well as signal.h, if this was not already allowed.  Request
	definition of size_t if necessary.  Minimize semantically-null
	differences across files.
2016-09-23 08:43:56 -04:00
Zack Weinberg 05b68e14b1 Installed-header hygiene (BZ#20366): time.h types.
Many headers are expected to expose a subset of the type definitions
in time.h.  time.h has a whole bunch of messy logic for conditionally
defining some its types and structs, but, as best I can tell, this
has never worked 100%.  In particular, __need_timespec is ineffective
if _TIME_H has already been defined, which means that if you compile

  #include <time.h>
  #include <sched.h>

with e.g. -fsyntax-only -std=c89 -Wall -Wsystem-headers, you will get

In file included from test.c:2:0:
/usr/include/sched.h:74:57: warning: "struct timespec" declared inside
  parameter list will not be visible outside of this definition or declaration
 extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __THROW;
                                                         ^~~~~~~~

And if you want to _use_ sched_rr_get_interval in a TU compiled that
way, you're hosed.

This patch replaces all of that with small bits/types/TYPE.h headers
as introduced earlier.  time.h and bits/time.h are now *much* simpler,
and a lot of other headers are slightly simpler.

	* time/time.h, bits/time.h, sysdeps/unix/sysv/linux/bits/time.h:
	Remove all logic conditional on __need macros.  Move all the
	conditionally defined types to their own headers...
	* time/bits/types/clock_t.h: Define clock_t here.
	* time/bits/types/clockid_t.h: Define clockid_t here.
	* time/bits/types/struct_itimerspec.h: Define struct itimerspec here.
	* time/bits/types/struct_timespec.h: Define struct timespec here.
	* time/bits/types/struct_timeval.h: Define struct timeval here.
	* time/bits/types/struct_tm.h: Define struct tm here.
	* time/bits/types/time_t.h: Define time_t here.
	* time/bits/types/timer_t.h: Define timer_t here.
	* time/Makefile: Install the new headers.

	* bits/resource.h, io/fcntl.h, io/sys/poll.h, io/sys/stat.h
	* io/utime.h, misc/sys/select.h, posix/sched.h, posix/sys/times.h
	* posix/sys/types.h, resolv/netdb.h, rt/aio.h, rt/mqueue.h
	* signal/signal.h, pthread/semaphore.h, sysdeps/nptl/pthread.h
	* sysdeps/unix/sysv/linux/alpha/bits/resource.h
	* sysdeps/unix/sysv/linux/alpha/sys/acct.h
	* sysdeps/unix/sysv/linux/bits/resource.h
	* sysdeps/unix/sysv/linux/bits/timex.h
	* sysdeps/unix/sysv/linux/mips/bits/resource.h
	* sysdeps/unix/sysv/linux/net/ppp_defs.h
	* sysdeps/unix/sysv/linux/sparc/bits/resource.h
	* sysdeps/unix/sysv/linux/sys/acct.h
	* sysdeps/unix/sysv/linux/sys/timerfd.h
	* sysvipc/sys/msg.h, sysvipc/sys/sem.h, sysvipc/sys/shm.h
	* time/sys/time.h, time/sys/timeb.h
	Use the new bits/types headers.

	* include/time.h: Remove __need logic.
	* include/bits/time.h
	* include/bits/types/clock_t.h, include/bits/types/clockid_t.h
	* include/bits/types/time_t.h, include/bits/types/timer_t.h
	* include/bits/types/struct_itimerspec.h
	* include/bits/types/struct_timespec.h
	* include/bits/types/struct_timeval.h
	* include/bits/types/struct_tm.h:
	New wrapper headers.
2016-09-23 08:43:56 -04:00
Zack Weinberg f2bea4da2e Installed-header hygiene (BZ#20366): conditionally defined structures.
Several network-related structures are defined conditionally under
__USE_MISC, but unconditionally used by other headers.  The path of
least resistance is usually to condition the uses on __USE_MISC as
well.

	* sysdeps/mach/hurd/net/if_ppp.h
	* sysdeps/unix/sysv/linux/net/if_ppp.h:
        Only define struct ifpppstatsreq and struct ifpppcstatsreq
        if __USE_MISC is defined, to ensure struct ifreq is declared.

	* inet/netinet/ether.h: Condition all function prototypes
        on __USE_MISC, to ensure struct ether_addr is declared.

sys/socket.h defines struct osockaddr only under __USE_MISC, whereas
protocols/talkd.h requires it unconditionally.  Here it doesn't make
sense to condition the entire body of protocols/talkd.h on __USE_MISC.
Rather than complicate sys/socket.h with a __need macro or duplicate
the definition, I am introducing a new concept: tiny headers named
bits/types/TYPE.h that define TYPE and nothing else.  This can, I hope,
ultimately replace *all* the __need macros.  The guard macro for such
headers will be __TYPE_defined, just in case application or third-party
library code is looking at them.

	* socket/bits/types/struct_osockaddr.h: New header.
	* include/bits/types/struct_osockaddr.h: New wrapper.
	* socket/Makefile: Install the new header.
	* socket/sys/socket.h,  inet/protocols/talkd.h:
	Refer to bits/types/struct_osockaddr.h for the definition of
	struct osockaddr.
2016-09-23 08:43:56 -04:00
Zack Weinberg 11160cb76f Installed-header hygiene (BZ#20366): obsolete BSD u_* types.
The types u_char, u_short, u_int, u_long, ushort, uint, ulong, u_int8_t,
u_int16_t, u_int32_t, u_int64_t, quad_t, and u_quad_t are BSDisms that
have never been standardized.  While glibc should continue to *provide*
these types for compatibility's sake, its public headers should not
use them.

The meat of this change was mechanically generated by the following
shell command:

    perl -pi~ -e '
        s/\b(__)?u_char\b/unsigned char/g;
        s/\b(__)?u_?short\b/unsigned short/g;
        s/\b(__)?u_?int\b/unsigned int/g;
        s/\b(__)?u_?long\b/unsigned long/g;
        s/\b(__)?u_int8_t\b/uint8_t/g;
        s/\b(__)?u_int16_t\b/uint16_t/g;
        s/\b(__)?u_int32_t\b/uint32_t/g;
        s/\b(__)?u_int64_t\b/uint64_t/g;
        s/\b(__)?u_quad_t\b/uint64_t/g;
        s/\b(__)?quad_t\b/uint64_t/g;
    ' $(grep -lE -e '\<((__)?(quad_t|u(short|int|long|_(char|short|int([0-9]+_t)?|long|quad_t))))\>' \
        $(grep -LE '\<(_(SYS|BITS)_TYPES_H|rpc/(rpc|rpc_msg|types|xdr)\.h)\>' \
          $(find . \( -false $(sed 's/^/-o -name /' all-installed-headers) \
                   \) -printf '%P\n' | sort -u)))

where 'all-installed-headers' was a list of the basenames of all installed
header files, manually extracted from the Makefiles.  Non-installed
wrapper headers in include/ are also adjusted, for consistency.
I then manually fixed up indentation and line-wrapping.

sys/types.h and bits/types.h are excluded because they must continue
to define the u_* types (under __USE_MISC) for compatibility with
applications.  They do not use these types themselves.

All headers that (transitively) include rpc/types.h are also excluded,
for three reasons.  First, the u_* types are defined by rpc/types.h,
unconditionally (not just under __USE_MISC) so they are logically part
of the SunRPC API.  Second, many of those headers appear to be
machine-generated.  Third, it's my understanding that we are getting
rid of as much of SunRPC as possible in the near future.

(The one file under sunrpc/ that's touched, sunrpc/rpc/rpc_des.h, does
*not* include rpc/types.h.  This may itself be a bug.)

After changing from u_intNN_t to uintNN_t, a number of headers now
need to include stdint.h to pick up those types.  It might be more
hygenic, namespace-wise, to use __uintNN_t instead, but none of these
headers are bound by ISO or POSIX to do so, and it's unlikely that
anyone using them will be bothered.  (The two files that were using
__-prefixed versions of the u_types, sysdeps/mach/hurd/net/route.h and
sysdeps/unix/sysv/linux/net/route.h, both already also contained uses of
the unprefixed versions.)

Some of these files directly included features.h and/or sys/cdefs.h,
which I removed, as the style generally seems to be to let sys/types.h
do that for us.  (This does not change the set of definitions exposed
by any header; sys/types.h unconditionally includes both features.h
and sys/cdefs.h.)

One file included asm/types.h unnecessarily.

	* bits/in.h, gmon/sys/gmon.h, inet/netinet/igmp.h
	* inet/protocols/routed.h, inet/protocols/talkd.h
	* inet/protocols/timed.h, io/fts.h, nptl_db/thread_db.h
	* resolv/arpa/nameser.h, resolv/resolv.h, sunrpc/rpc/rpc_des.h
	* sysdeps/generic/netinet/if_ether.h
	* sysdeps/generic/netinet/in_systm.h
	* sysdeps/generic/netinet/ip.h, sysdeps/generic/netinet/tcp.h
	* sysdeps/gnu/netinet/ip_icmp.h, sysdeps/gnu/netinet/tcp.h
	* sysdeps/gnu/netinet/udp.h, sysdeps/mach/hurd/net/ethernet.h
	* sysdeps/mach/hurd/net/if_arp.h
	* sysdeps/mach/hurd/net/if_ppp.h
	* sysdeps/mach/hurd/net/route.h, sysdeps/mach/sys/reboot.h
	* sysdeps/unix/sysv/linux/bits/in.h
	* sysdeps/unix/sysv/linux/net/ethernet.h
	* sysdeps/unix/sysv/linux/net/if_arp.h
	* sysdeps/unix/sysv/linux/net/if_ppp.h
	* sysdeps/unix/sysv/linux/net/if_shaper.h
	* sysdeps/unix/sysv/linux/net/route.h
	* sysdeps/unix/sysv/linux/netinet/if_ether.h
	* sysdeps/unix/sysv/linux/netinet/if_fddi.h
	* sysdeps/unix/sysv/linux/netinet/if_tr.h
	* sysdeps/unix/sysv/linux/netipx/ipx.h
	* sysdeps/unix/sysv/linux/sys/acct.h
	* include/arpa/nameser.h, include/resolv.h:
	Change all uses of u_char to unsigned char,
	u_short and ushort to unsigned short, u_int and uint to unsigned int,
	u_long and ulong to unsigned long, u_int8_t to uint8_t,
        u_int16_t to uint16_t, u_int32_t to uint32_t, quad_t to int64_t,
	and u_int64_t and u_quad_t to uint64_t.

	* mach/sys/reboot.h: Remove two casts of integer literals
	to the types they already have.

	* bits/in.h: Correct error in description of IP_MULTICAST_LOOP.
	* sysdeps/unix/sysv/linux/bits/in.h: Likewise.
	* sysdeps/unix/sysv/linux/netinet/if_ether.h: Change a comment
	from referring to 'unsigned char' to 'uint8_t' for consistency with
	the macro definition below.

	* gmon/sys/gmon.h, inet/netinet/igmp.h, inet/protocols/talkd.h
	* io/fts.h, resolv/arpa/nameser.h, resolv/resolv.h
	* sunrpc/rpc/rpc_des.h, sysdeps/generic/netinet/ip.h
	* sysdeps/gnu/netinet/tcp.h, sysdeps/gnu/netinet/udp.h
	* sysdeps/mach/hurd/net/if_ppp.h, sysdeps/unix/sysv/linux/net/if_ppp.h
	* sysdeps/unix/sysv/linux/sys/acct.h
	* include/arpa/nameser.h, include/resolv.h:
	Fix indentation disrupted by mechanical edits.

	* inet/protocols/talkd.h, resolv/arpa/nameser.h
	* sysdeps/generic/netinet/in_systm.h
	* sysdeps/gnu/netinet/ip_icmp.h, sysdeps/gnu/netinet/tcp.h
	* sysdeps/gnu/netinet/udp.h
	* sysdeps/unix/sysv/linux/net/ethernet.h
	* sysdeps/unix/sysv/linux/net/if_arp.h
	* sysdeps/unix/sysv/linux/net/if_ppp.h
	* sysdeps/unix/sysv/linux/net/if_shaper.h
	* sysdeps/unix/sysv/linux/netinet/if_fddi.h
	* sysdeps/unix/sysv/linux/netinet/if_tr.h
	* sysdeps/unix/sysv/linux/netipx/ipx.h
	* sysdeps/unix/sysv/linux/sys/acct.h
	Include stdint.h for uintNN_t definitions.
	Don't include sys/cdefs.h, features.h, or asm/types.h directly.
2016-09-23 08:43:56 -04:00
Zack Weinberg cb765808fb Installed-header hygiene (BZ#20366): Simple self-contained fixes.
Some headers did not include all of their prerequisite headers.

	* rpcsvc/nislib.h: Include rpcsvc/nis.h.
	* sysdeps/unix/sysv/linux/netrose/rose.h:
	Include sys/socket.h and netax25/ax25.h.

<endian.h> only defines BYTE_ORDER, BIG_ENDIAN, LITTLE_ENDIAN,
etc. under __USE_MISC; glibc's headers should use __BYTE_ORDER,
__BIG_ENDIAN, __LITTLE_ENDIAN, etc. instead.

	* inet/netinet/icmp6.h, inet/netinet/ip6.h
	* resolv/arpa/nameser_compat.h:
	Use __BYTE_ORDER etc. instead of BYTE_ORDER etc.

sys/types.h only conditionally defines caddr_t and clockid_t.

	* sysdeps/unix/sysv/linux/sys/quota.h:
	Use __caddr_t instead of caddr_t.
	* sysdeps/unix/sysv/linux/sys/timerfd.h:
	Use __clockid_t instead of clockid_t.

Remove a #warning that was the sole actual problem with using sys/ipc.h
without _GNU_SOURCE/_XOPEN_SOURCE.

	* sysvipc/sys/ipc.h: Remove unnecessary #warning.

_LIBC, __USE_XOPEN2K8, and __STDC_VERSION__ are not always defined.

It seems to me that _LIBC should not appear in installed headers, but
avoiding that for argp specifically would require more surgery than
feels appropriate for this patch set.  It's possible that
"#ifdef _LIBC" would be sufficient, but I wanted to be conservative.

All three versions of bits/socket.h want to know whether __flexarr
will produce a real flexible array member -- specifically, one that
doesn't alter sizeof(the structure containing it).  They were testing
for this with a complicated #if condition that did not agree with
sys/cdefs.h and that tripped -Wundef warnings under -std=c90.
I added a new macro to sys/cdefs.h, __glibc_c99_flexarr_available,
which reveals exactly what these headers want to know.  I also took
the opportunity to flatten the rather messy conditional nest defining
__flexarr.

	* argp/argp.h: Check whether _LIBC is defined before expanding it.
	* posix/glob.h: Check whether __USE_XOPEN2K8 is defined instead
	of expanding it.

	* misc/sys/cdefs.h: Tidy up conditional nest defining __flexarr.
	Define __glibc_c99_flexarr_available to 1 when the compiler
	supports C99-compatible flexible array members, 0 otherwise.
	* sysdeps/unix/sysv/linux/bits/socket.h
	* sysdeps/mach/hurd/bits/socket.h
	* bits/socket.h: Use __glibc_c99_flexarr_available in
	definitions of struct cmsghdr and CMSG_DATA.
2016-09-23 08:43:55 -04:00
Florian Weimer 3a35923e97 manual: Clarify NSS error reporting
The manual already required that NSS implementation functions set
error codes if they return a value that is not NSS_STATUS_SUCCESS,
but this was not very explicit.  The errnop parameter was omitted
in a few places, and the function return value was incorrect.
2016-09-23 14:18:09 +02:00
Florian Weimer 67b73ea479 tst-open-tmpfile: Add checks for open64, openat64, linkat
The /proc/self/fd approach is expected to work for all users
(with and without CAP_DAC_READ_SEARCH).
2016-09-23 13:38:09 +02:00
Florian Weimer 51364ff23e test-skeleton.c: Remove unintended #include <stdarg.h>. 2016-09-23 09:41:35 +02:00
Alexandre Oliva 17af5da98c [PR19826] fix non-LE TLS in static programs
An earlier fix for TLS dropped early initialization of DTV entries for
modules using static TLS, leaving it for __tls_get_addr to set them
up.  That worked on platforms that require the GD access model to be
relaxed to LE in the main executable, but it caused a regression on
platforms that allow GD in the main executable, particularly in
statically-linked programs: they use a custom __tls_get_addr that does
not update the DTV, which fails when the DTV early initialization is
not performed.

In static programs, __libc_setup_tls performs the DTV initialization
for the main thread, but the DTV of other threads is set up in
_dl_allocate_tls_init, so that's the fix that matters.

Restoring the initialization in the remaining functions modified by
this patch was just for uniformity.  It's not clear that it is ever
needed: even on platforms that allow GD in the main executable, the
dynamically-linked version of __tls_get_addr would set up the DTV
entries, even for static TLS modules, while updating the DTV counter.

for  ChangeLog

	[BZ #19826]
	* elf/dl-tls.c (_dl_allocate_tls_init): Restore DTV early
	initialization of static TLS entries.
	* elf/dl-reloc.c (_dl_nothread_init_static_tls): Likewise.
	* nptl/allocatestack.c (init_one_static_tls): Likewise.
2016-09-21 22:01:16 -03:00
Samuel Thibault 444eacba82 hurd: Fix stack pointer corruption in syscall
Thanks Justus Winter for the report.

	* sysdeps/mach/i386/syscall.S (syscall): Push back syscall number.
2016-09-22 02:43:39 +02:00
Samuel Thibault e67f54ab1a hurdmalloc: Run fork handler as late as possible [BZ #19431]
This is the hurd-specific follow-up for
29d794863c : hurdmalloc also needs the
same fix

	* hurd/hurdmalloc.c (malloc_fork_prepare): Rename to
	_hurd_malloc_fork_prepare.
	(malloc_fork_parent): Rename to _hurd_malloc_fork_parent.
	(malloc_fork_child): Rename to _hurd_malloc_fork_child.
	(_hurd_fork_prepare_hook): Drop malloc_fork_prepare.
	(_hurd_fork_parent_hook): Drop malloc_fork_parent.
	(_hurd_fork_child_hook): Drop malloc_fork_child.
	* hurd/hurdmalloc.h (_hurd_malloc_fork_prepare,
	_hurd_malloc_fork_parent, _hurd_malloc_fork_child): Add declarations.
	* sysdeps/mach/hurd/fork.c (__fork): Call __malloc_fork_lock_parent
	after locking locks (notably hurd_dtable_lock). Call
	_hurd_malloc_fork_prepare after that. Call _hurd_malloc_fork_parent
	before __malloc_fork_unlock_parent and _hurd_malloc_fork_child before
	__malloc_fork_unlock_child.
2016-09-22 01:45:48 +02:00
James Greenhalgh 87ab10d652 [soft-fp] Add support for various half-precision conversion routines.
This patch adds conversion routines required for _Float16 support in
AArch64.

These are one-step conversions to and from TImode and TFmode. We need
these on AArch64 regardless of presence of the ARMv8.2-A 16-bit
floating-point extensions.

In the patch, soft-fp/half.h is derived from soft-fp/single.h .  The
conversion routines are derivatives of their respective SFmode
variants.

	* soft-fp/extendhftf2.c: New.
	* soft-fp/fixhfti.c: Likewise.
	* soft-fp/fixunshfti.c: Likewise.
	* soft-fp/floattihf.c: Likewise.
	* soft-fp/floatuntihf.c: Likewise.
	* soft-fp/half.h: Likewise.
	* soft-fp/trunctfhf2.c: Likewise.
2016-09-21 21:02:54 +00:00
Joseph Myers d942e95cd7 Add issubnormal.
TS 18661-1 adds an issubnormal classification macro to <math.h>.  This
patch implements it for glibc.  There are no new underlying functions
in libm because the implementation uses fpclassify; any optimizations
for this macro should be done through adding __builtin_subnormal in
GCC and using it in the header for suitable GCC versions, not through
adding other optimized inline or out-of-line versions to glibc.

The intended structure of the NEWS entry for <math.h> features from TS
18661-1 is like:

* New <math.h> features are added from TS 18661-1:2014:

  - Nearest integer functions: roundeven, roundevenf, roundevenl.

  - Comparison macros: iseqsig.

  - Classification macros: iscanonical, issubnormal, iszero.

(that is, following the grouping of interfaces in TS 18661-1:2014,
with any group where any interfaces are new in glibc 2.25 being listed
like that).

Tested for x86_64 and x86.

	* math/math.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (issubnormal): New
	macro.
	* math/libm-test.inc (issubnormal_test_data): New array.
	(issubnormal_test): New function.
	* manual/arith.texi (Floating Point Classes): Document
	issubnormal.
	* manual/libm-err-tab.pl: Update comment on interfaces without
	ulps tabulated.
2016-09-21 20:52:02 +00:00
Joseph Myers 5b17fd0da6 Add <stdint.h> integer width macros.
TS 18661-1 defines macros for the width of integer types, intended for
use with the fromfp functions to convert from floating-point types to
integer types of any width, in any rounding mode and with control over
whether "inexact" is raised.  Such macros are, of course, more
generally useful than just with those functions.

Those macros are added to <limits.h> and <stdint.h>.  Having
previously added the <limits.h> macros, this patch adds the <stdint.h>
ones.  I've also added these macros to GCC's headers for GCC 7, but
for glibc systems, the definitions in GCC's <stdint.h> will only be
used with -ffreestanding.

Tested for x86_64 and x86.

	* sysdeps/generic/stdint.h: Define
	__GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION and include
	<bits/libc-header-start.h> instead of including <features.h>.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT8_WIDTH): New macro.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT8_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT16_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT16_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT32_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT32_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT64_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT64_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_LEAST8_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_LEAST8_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_LEAST16_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_LEAST16_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_LEAST32_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_LEAST32_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_LEAST64_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_LEAST64_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_FAST8_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_FAST8_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_FAST16_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_FAST16_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_FAST32_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_FAST32_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_FAST64_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_FAST64_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INTPTR_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINTPTR_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INTMAX_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINTMAX_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (PTRDIFF_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (SIG_ATOMIC_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (SIZE_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (WCHAR_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (WINT_WIDTH): Likewise.
	* manual/arith.texi (Integers): Document these macros for types
	specified by width properties.
	* manual/lang.texi (Width of Type): Document these macros for
	other standard typedefs.
	* stdlib/tst-width-stdint.c: New file.
	* stdlib/Makefile (tests): Add tst-width-stdint.
2016-09-21 17:06:36 +00:00
Florian Weimer 6815a33d53 resolv: Remove unsupported hook functions from the API [BZ #20016] 2016-09-21 16:30:27 +02:00
Florian Weimer cbb47fa1c6 malloc: Manual part of conversion to __libc_lock
This removes the old mutex_t-related definitions from malloc-machine.h,
too.
2016-09-21 16:28:08 +02:00
Florian Weimer be728303a6 <arpa/nameser.h>: Remove RR type classification macros [BZ #20592]
The macros are no longer up-to-date, and the classification is not
useful.  In this particular case, removal without prior deprecation
seems the right approach.
2016-09-21 16:27:14 +02:00
Florian Weimer 006768c72a <arpa/nameser.h>, <arpa/nameser_compat.h>: Remove versions
Our header files no longer match the BIND versions.
2016-09-21 16:09:21 +02:00
Florian Weimer 17b09beee7 resolv: Remove the BIND_4_COMPAT macro 2016-09-21 16:09:03 +02:00
Florian Weimer 3a2a1d2cc2 Remove obsolete DNSSEC support [BZ #20591]
The removed function declaration have never been implemented in libresolv.
2016-09-21 16:08:32 +02:00
Florian Weimer f4a36548d8 manual: Clarify the documentation of strverscmp [BZ #20524] 2016-09-21 15:41:17 +02:00
Florian Weimer 85f7554cd9 Add test case for O_TMPFILE handling in open, openat
Also put xasprintf into test-skeleton.c (written in such a way that
including <stdarg.h> is not needed).
2016-09-21 15:24:01 +02:00
Florian Weimer fc3e1337be Avoid running $(CXX) during build to obtain header file paths
This reduces the build time somewhat and is particularly noticeable
during rebuilds with few code changes.
2016-09-21 10:45:32 +02:00
Florian Weimer 612148c660 Generate .op pattern rules for profiling builds only
.op pattern rules are not used in non-profiling builds.

This does not cause any changes to both profiling and non-profiling
builds.
2016-09-21 10:45:19 +02:00
Florian Weimer 1d2ea31ca9 sln: Preprocessor cleanups 2016-09-21 10:42:52 +02:00
Samuel Thibault e299076fef Fix old-style function definition
* mach/errstring.c (mach_error_type, mach_error_string): Fix old-style
function definition.
2016-09-20 23:10:51 +02:00
Samuel Thibault d145a456d9 mach: Fix old-style function definition.
* mach/mach_error.c (mach_error): Fix old-style function definition.
2016-09-20 23:10:51 +02:00
Adhemerval Zanella 802c1c5a65 posix: Correctly block/unblock all signals on Linux posix_spawn
This patch correctly block and unblocks all signals when executing
Linux posix_spawn by using the __libc_signal_{un}block_all functions
instead of default sigprocmask.  The latter might remove both
SIGCANCEL and SIGSETXID from the blocked signal list.

Checked on x86_64, i686, powerpc64le, and aarch64.

	* sysdeps/unix/sysv/linux/spawni.c (__spawnix): Correctly block and unblock
	all signals when executing the clone vfork child.
	(SIGALL_SET): Remove macro.
2016-09-20 17:18:15 -03:00
Adhemerval Zanella 706e6749de posix: Correctly enable/disable cancellation on Linux posix_spawn
This patch correctly enable and disable asynchronous cancellation on
Linux posix_spawn.  Current code invert the logic by enabling and
disabling instead.  It also adds a new test to check if posix_spawn
is not a cancellation entrypoint.

Checked on x86_64, i686, powerpc64le, and aarch64.

	* nptl/Makefile (tests): Add tst-exec5.
	* nptl/tst-exec5.c: New file.
	* sysdeps/unix/sysv/linux/spawni.c (__spawni): Correctly enable and disable
	asynchronous cancellation.
2016-09-20 17:18:15 -03:00
Samuel Thibault aea5c83461 Fix exc2signal.c template
As a follow-up to 0e3426bbcf

	* hurd/exc2signal.c: #include <hurd/signal.h>
	(_hurd_exception2signal): Replace 'exception', 'code', 'subcode',
	'sigcode', 'error' parameters with 'detail' parameter.  Fix code
	accordingly.
2016-09-20 21:58:36 +02:00
Paul E. Murphy 2c46d11486 Build s_nan* objects from a generic template
This requires adding a macro to synthesize the call
to __strto*_nan.  Since this is likely to be the only
usage ever for strto* functions in generated libm
calls, a dedicated macro is defined for it.
2016-09-20 14:37:42 -05:00
Paul E. Murphy fc7f4691d3 Remove __nan{f,,l} macros
Use the GCC builtin instead.  With the exception of the
files built from a template, they are unused.  This
is preparation for making the s_nanF objects generated.
2016-09-20 14:37:41 -05:00
Paul E. Murphy 9f9834f582 Make ldexpF generic.
This one is a little more tricky since it is built both for
libm and libc, and exports multiple aliases.

To simplify aliasing, a new macro is introduced which handles
aliasing to two symbols.  By default, it just applies
declare_mgen_alias to both target symbols.

Likewise, the makefile is tweaked a little to generate
templates for shared files too, and a new rule is added
to build m_*.c objects from the objpfx directory.

Verified there are no symbol or code changes using a script
to diff the *_ldexp* object files on s390x, aarch64, arm,
x86_64, and ppc64.
2016-09-20 14:37:40 -05:00
Florian Weimer 8837917cf1 Remove remnants of .og patterns
This was used by --enable-omitfp, and the bulk of it was removed in this
commit:

commit bdeba1354b
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Sat Jan 7 11:29:31 2012 -0500

    Remove --enable-omitfp support
2016-09-20 12:18:13 +02:00
Florian Weimer e68c8d2757 sysd-rules: Cut down the number of rtld-% pattern rules
rtld only needs shared objects, so the other patterns are pointless and
significantly increase the work make has to perform while identifying
which pattern rule to apply.
2016-09-20 10:41:05 +02:00
Tulio Magno Quites Machado Filho 1850ce5a2e powerpc: Fix POWER9 implies
Fix multiarch build for POWER9 by correcting the order of the
directories listed at sysnames configure variable.
2016-09-19 09:35:38 -03:00
Joseph Myers a292f45acd Add <limits.h> integer width macros.
TS 18661-1 defines macros for the width of integer types, intended for
use with the fromfp functions to convert from floating-point types to
integer types of any width, in any rounding mode and with control over
whether "inexact" is raised.  Such macros are, of course, more
generally useful than just with those functions.

Those macros are added to <limits.h> and <stdint.h>.  This patch adds
the <limits.h> macros to glibc's header, with the <stdint.h> ones
intended to be added in a separate patch (which would add to the NEWS
entry created by this patch).  I've also added these macros to GCC's
headers for GCC 7, but definitions in glibc's <limits.h> are still
useful for older GCC, for non-GNU compilers and for when it's
_GNU_SOURCE rather than __STDC_WANT_IEC_60559_BFP_EXT__ that implies
the macros should be defined since the GCC header only considers
__STDC_WANT_IEC_60559_BFP_EXT__ (and for glibc systems, the
definitions in GCC's <stdint.h> will only be used with
-ffreestanding).

Tested for x86_64 and x86.

	* include/limits.h: Define
	__GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION and include
	<bits/libc-header-start.h> instead of including <features.h>.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (CHAR_WIDTH): New macro.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (SCHAR_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UCHAR_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (SHRT_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (USHRT_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (LONG_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (ULONG_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (LLONG_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (ULLONG_WIDTH): Likewise.
	* manual/lang.texi (Width of Type): Document these macros.
	* stdlib/tst-width.c: New file.
	* stdlib/Makefile (tests): Add tst-width.
2016-09-19 12:25:36 +00:00