summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/aliases.h6
-rw-r--r--include/alloc_buffer.h367
-rw-r--r--include/alloca.h44
-rw-r--r--include/allocate_once.h95
-rw-r--r--include/argp-fmtstream.h19
-rw-r--r--include/argp.h10
-rw-r--r--include/argz.h37
-rw-r--r--include/arpa/nameser.h10
-rw-r--r--include/arpa/nameser_compat.h9
-rw-r--r--include/array_length.h36
-rw-r--r--include/assert.h4
-rw-r--r--include/atomic.h118
-rw-r--r--include/bits/cpu-set.h1
-rw-r--r--include/bits/getopt_core.h1
-rw-r--r--include/bits/getopt_ext.h1
-rw-r--r--include/bits/getopt_posix.h1
-rw-r--r--include/bits/mathcalls-helper-functions.h1
-rw-r--r--include/bits/mathcalls-narrow.h1
-rw-r--r--include/bits/statx.h1
-rw-r--r--include/bits/string3.h1
-rw-r--r--include/bits/string_fortified.h1
-rw-r--r--include/bits/strings_fortified.h1
-rw-r--r--include/bits/types.h1
-rw-r--r--include/bits/types/FILE.h1
-rw-r--r--include/bits/types/__FILE.h1
-rw-r--r--include/bits/types/__fpos64_t.h1
-rw-r--r--include/bits/types/__fpos_t.h1
-rw-r--r--include/bits/types/__locale_t.h1
-rw-r--r--include/bits/types/__mbstate_t.h1
-rw-r--r--include/bits/types/__sigval_t.h1
-rw-r--r--include/bits/types/clock_t.h1
-rw-r--r--include/bits/types/clockid_t.h1
-rw-r--r--include/bits/types/cookie_io_functions_t.h1
-rw-r--r--include/bits/types/locale_t.h1
-rw-r--r--include/bits/types/mbstate_t.h1
-rw-r--r--include/bits/types/res_state.h1
-rw-r--r--include/bits/types/sig_atomic_t.h1
-rw-r--r--include/bits/types/sigset_t.h1
-rw-r--r--include/bits/types/sigval_t.h1
-rw-r--r--include/bits/types/struct_FILE.h1
-rw-r--r--include/bits/types/struct_iovec.h1
-rw-r--r--include/bits/types/struct_itimerspec.h1
-rw-r--r--include/bits/types/struct_osockaddr.h1
-rw-r--r--include/bits/types/struct_rusage.h1
-rw-r--r--include/bits/types/struct_sigstack.h1
-rw-r--r--include/bits/types/struct_timespec.h1
-rw-r--r--include/bits/types/struct_timeval.h1
-rw-r--r--include/bits/types/struct_tm.h1
-rw-r--r--include/bits/types/time_t.h1
-rw-r--r--include/bits/types/timer_t.h1
-rw-r--r--include/bits/types/wint_t.h1
-rw-r--r--include/bits/wctype-wchar.h1
-rw-r--r--include/bits/xopen_lim.h19
-rw-r--r--include/complex.h3
-rw-r--r--include/crypt.h3
-rw-r--r--include/ctype.h3
-rw-r--r--include/dirent.h50
-rw-r--r--include/dlfcn.h40
-rw-r--r--include/dso_handle.h3
-rw-r--r--include/elf.h21
-rw-r--r--include/envz.h3
-rw-r--r--include/err.h6
-rw-r--r--include/errno.h29
-rw-r--r--include/execinfo.h3
-rw-r--r--include/fcntl.h18
-rw-r--r--include/features.h108
-rw-r--r--include/fenv.h15
-rw-r--r--include/float.h113
-rw-r--r--include/fpu_control.h8
-rw-r--r--include/getopt.h12
-rw-r--r--include/glob.h1
-rw-r--r--include/gmp.h41
-rw-r--r--include/gnu-versions.h4
-rw-r--r--include/gnu/libc-version.h2
-rw-r--r--include/grp-merge.h7
-rw-r--r--include/grp.h6
-rw-r--r--include/gshadow.h9
-rw-r--r--include/ifaddrs.h9
-rw-r--r--include/ifreq.h14
-rw-r--r--include/ifunc-impl-list.h2
-rw-r--r--include/inline-hashtab.h2
-rw-r--r--include/inttypes.h6
-rw-r--r--include/libc-diag.h74
-rw-r--r--include/libc-internal.h96
-rw-r--r--include/libc-pointer-arith.h60
-rw-r--r--include/libc-symbols.h443
-rw-r--r--include/libintl.h4
-rw-r--r--include/libio.h36
-rw-r--r--include/limits.h44
-rw-r--r--include/link.h16
-rw-r--r--include/list.h40
-rw-r--r--include/list_t.h (renamed from include/caller.h)24
-rw-r--r--include/malloc.h4
-rw-r--r--include/math-narrow-eval.h47
-rw-r--r--include/math.h36
-rw-r--r--include/mcheck.h3
-rw-r--r--include/mntent.h4
-rw-r--r--include/monetary.h5
-rw-r--r--include/netdb.h32
-rw-r--r--include/netinet/ether.h3
-rw-r--r--include/nss.h21
-rw-r--r--include/obstack.h6
-rw-r--r--include/plural-exp.h8
-rw-r--r--include/printf.h14
-rw-r--r--include/programs/xmalloc.h2
-rw-r--r--include/pty.h3
-rw-r--r--include/pwd.h6
-rw-r--r--include/regex.h6
-rw-r--r--include/resolv.h48
-rw-r--r--include/rounding-mode.h2
-rw-r--r--include/rpc/auth.h3
-rw-r--r--include/rpc/auth_des.h3
-rw-r--r--include/rpc/auth_unix.h6
-rw-r--r--include/rpc/clnt.h4
-rw-r--r--include/rpc/des_crypt.h3
-rw-r--r--include/rpc/key_prot.h6
-rw-r--r--include/rpc/netdb.h7
-rw-r--r--include/rpc/pmap_clnt.h13
-rw-r--r--include/rpc/pmap_prot.h6
-rw-r--r--include/rpc/pmap_rmt.h6
-rw-r--r--include/rpc/rpc.h21
-rw-r--r--include/rpc/rpc_msg.h3
-rw-r--r--include/rpc/svc.h7
-rw-r--r--include/rpc/svc_auth.h3
-rw-r--r--include/rpc/xdr.h6
-rw-r--r--include/rpcsvc/nis_callback.h3
-rw-r--r--include/rpcsvc/nislib.h37
-rw-r--r--include/rpcsvc/yp.h11
-rw-r--r--include/rpcsvc/ypclnt.h16
-rw-r--r--include/rpcsvc/ypupd.h3
-rw-r--r--include/sched.h5
-rw-r--r--include/scratch_buffer.h9
-rw-r--r--include/search.h1
-rw-r--r--include/set-hooks.h5
-rw-r--r--include/setjmp.h40
-rw-r--r--include/shadow.h10
-rw-r--r--include/shlib-compat.h34
-rw-r--r--include/signal.h28
-rw-r--r--include/stackinfo.h2
-rw-r--r--include/stap-probe.h2
-rw-r--r--include/stdc-predef.h16
-rw-r--r--include/stdio.h178
-rw-r--r--include/stdio_ext.h7
-rw-r--r--include/stdlib.h130
-rw-r--r--include/string.h42
-rw-r--r--include/sys/auxv.h8
-rw-r--r--include/sys/epoll.h3
-rw-r--r--include/sys/file.h4
-rw-r--r--include/sys/gmon.h8
-rw-r--r--include/sys/ioctl.h5
-rw-r--r--include/sys/mman.h5
-rw-r--r--include/sys/prctl.h3
-rw-r--r--include/sys/profil.h3
-rw-r--r--include/sys/resource.h1
-rw-r--r--include/sys/sendfile.h6
-rw-r--r--include/sys/socket.h4
-rw-r--r--include/sys/stat.h6
-rw-r--r--include/sys/statfs.h13
-rw-r--r--include/sys/statvfs.h6
-rw-r--r--include/sys/sysctl.h3
-rw-r--r--include/sys/sysinfo.h9
-rw-r--r--include/sys/sysmacros.h52
-rw-r--r--include/sys/time.h2
-rw-r--r--include/sys/uio.h8
-rw-r--r--include/sys/utsname.h2
-rw-r--r--include/sys/wait.h6
-rw-r--r--include/termios.h3
-rw-r--r--include/time.h61
-rw-r--r--include/ttyent.h7
-rw-r--r--include/unistd.h80
-rw-r--r--include/utmp.h17
-rw-r--r--include/values.h2
-rw-r--r--include/wchar.h83
-rw-r--r--include/wctype.h29
-rw-r--r--include/xlocale.h1
175 files changed, 2717 insertions, 841 deletions
diff --git a/include/aliases.h b/include/aliases.h
index f7cfafcd6c..11b81d4d24 100644
--- a/include/aliases.h
+++ b/include/aliases.h
@@ -1,6 +1,8 @@
#ifndef _ALIASES_H
#include <inet/aliases.h>
+# ifndef _ISOMAC
+
extern int __getaliasent_r (struct aliasent *__restrict __result_buf,
char *__restrict __buffer, size_t __buflen,
struct aliasent **__restrict __result)
@@ -12,7 +14,8 @@ extern int __old_getaliasent_r (struct aliasent *__restrict __result_buf,
extern int __getaliasbyname_r (const char *__restrict __name,
struct aliasent *__restrict __result_buf,
char *__restrict __buffer, size_t __buflen,
- struct aliasent **__restrict __result);
+ struct aliasent **__restrict __result)
+ attribute_hidden;
extern int __old_getaliasbyname_r (const char *__restrict __name,
struct aliasent *__restrict __result_buf,
char *__restrict __buffer, size_t __buflen,
@@ -34,4 +37,5 @@ DECLARE_NSS_PROTOTYPES (nis)
DECLARE_NSS_PROTOTYPES (nisplus)
#undef DECLARE_NSS_PROTOTYPES
+# endif /* !_ISOMAC */
#endif
diff --git a/include/alloc_buffer.h b/include/alloc_buffer.h
new file mode 100644
index 0000000000..e69ed66c8e
--- /dev/null
+++ b/include/alloc_buffer.h
@@ -0,0 +1,367 @@
+/* Allocation from a fixed-size buffer.
+ Copyright (C) 2017-2018 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/>. */
+
+/* Allocation buffers are used to carve out sub-allocations from a
+ larger allocation. Their primary application is in writing NSS
+ modules, which receive a caller-allocated buffer in which they are
+ expected to store variable-length results:
+
+ void *buffer = ...;
+ size_t buffer_size = ...;
+
+ struct alloc_buffer buf = alloc_buffer_create (buffer, buffer_size);
+ result->gr_name = alloc_buffer_copy_string (&buf, name);
+
+ // Allocate a list of group_count groups and copy strings into it.
+ char **group_list = alloc_buffer_alloc_array
+ (&buf, char *, group_count + 1);
+ if (group_list == NULL)
+ return ...; // Request a larger buffer.
+ for (int i = 0; i < group_count; ++i)
+ group_list[i] = alloc_buffer_copy_string (&buf, group_list_src[i]);
+ group_list[group_count] = NULL;
+ ...
+
+ if (alloc_buffer_has_failed (&buf))
+ return ...; // Request a larger buffer.
+ result->gr_mem = group_list;
+ ...
+
+ Note that it is not necessary to check the results of individual
+ allocation operations if the returned pointer is not dereferenced.
+ Allocation failure is sticky, so one check using
+ alloc_buffer_has_failed at the end covers all previous failures.
+
+ A different use case involves combining multiple heap allocations
+ into a single, large one. In the following example, an array of
+ doubles and an array of ints is allocated:
+
+ size_t double_array_size = ...;
+ size_t int_array_size = ...;
+
+ void *heap_ptr;
+ struct alloc_buffer buf = alloc_buffer_allocate
+ (double_array_size * sizeof (double) + int_array_size * sizeof (int),
+ &heap_ptr);
+ _Static_assert (__alignof__ (double) >= __alignof__ (int),
+ "no padding after double array");
+ double *double_array = alloc_buffer_alloc_array
+ (&buf, double, double_array_size);
+ int *int_array = alloc_buffer_alloc_array (&buf, int, int_array_size);
+ if (alloc_buffer_has_failed (&buf))
+ return ...; // Report error.
+ ...
+ free (heap_ptr);
+
+ The advantage over manual coding is that the computation of the
+ allocation size does not need an overflow check. In case of an
+ overflow, one of the subsequent allocations from the buffer will
+ fail. The initial size computation is checked for consistency at
+ run time, too. */
+
+#ifndef _ALLOC_BUFFER_H
+#define _ALLOC_BUFFER_H
+
+#include <inttypes.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <sys/param.h>
+
+/* struct alloc_buffer objects refer to a region of bytes in memory of a
+ fixed size. The functions below can be used to allocate single
+ objects and arrays from this memory region, or write to its end.
+ On allocation failure (or if an attempt to write beyond the end of
+ the buffer with one of the copy functions), the buffer enters a
+ failed state.
+
+ struct alloc_buffer objects can be copied. The backing buffer will
+ be shared, but the current write position will be independent.
+
+ Conceptually, the memory region consists of a current write pointer
+ and a limit, beyond which the write pointer cannot move. */
+struct alloc_buffer
+{
+ /* uintptr_t is used here to simplify the alignment code, and to
+ avoid issues undefined subtractions if the buffer covers more
+ than half of the address space (which would result in differences
+ which could not be represented as a ptrdiff_t value). */
+ uintptr_t __alloc_buffer_current;
+ uintptr_t __alloc_buffer_end;
+};
+
+enum
+ {
+ /* The value for the __alloc_buffer_current member which marks the
+ buffer as invalid (together with a zero-length buffer). */
+ __ALLOC_BUFFER_INVALID_POINTER = 0,
+ };
+
+/* Internal function. Terminate the process using __libc_fatal. */
+void __libc_alloc_buffer_create_failure (void *start, size_t size);
+
+/* Create a new allocation buffer. The byte range from START to START
+ + SIZE - 1 must be valid, and the allocation buffer allocates
+ objects from that range. If START is NULL (so that SIZE must be
+ 0), the buffer is marked as failed immediately. */
+static inline struct alloc_buffer
+alloc_buffer_create (void *start, size_t size)
+{
+ uintptr_t current = (uintptr_t) start;
+ uintptr_t end = (uintptr_t) start + size;
+ if (end < current)
+ __libc_alloc_buffer_create_failure (start, size);
+ return (struct alloc_buffer) { current, end };
+}
+
+/* Internal function. See alloc_buffer_allocate below. */
+struct alloc_buffer __libc_alloc_buffer_allocate (size_t size, void **pptr)
+ __attribute__ ((nonnull (2)));
+
+/* Allocate a buffer of SIZE bytes using malloc. The returned buffer
+ is in a failed state if malloc fails. *PPTR points to the start of
+ the buffer and can be used to free it later, after the returned
+ buffer has been freed. */
+static __always_inline __attribute__ ((nonnull (2)))
+struct alloc_buffer alloc_buffer_allocate (size_t size, void **pptr)
+{
+ return __libc_alloc_buffer_allocate (size, pptr);
+}
+
+/* Mark the buffer as failed. */
+static inline void __attribute__ ((nonnull (1)))
+alloc_buffer_mark_failed (struct alloc_buffer *buf)
+{
+ buf->__alloc_buffer_current = __ALLOC_BUFFER_INVALID_POINTER;
+ buf->__alloc_buffer_end = __ALLOC_BUFFER_INVALID_POINTER;
+}
+
+/* Return the remaining number of bytes in the buffer. */
+static __always_inline __attribute__ ((nonnull (1))) size_t
+alloc_buffer_size (const struct alloc_buffer *buf)
+{
+ return buf->__alloc_buffer_end - buf->__alloc_buffer_current;
+}
+
+/* Return true if the buffer has been marked as failed. */
+static inline bool __attribute__ ((nonnull (1)))
+alloc_buffer_has_failed (const struct alloc_buffer *buf)
+{
+ return buf->__alloc_buffer_current == __ALLOC_BUFFER_INVALID_POINTER;
+}
+
+/* Add a single byte to the buffer (consuming the space for this
+ byte). Mark the buffer as failed if there is not enough room. */
+static inline void __attribute__ ((nonnull (1)))
+alloc_buffer_add_byte (struct alloc_buffer *buf, unsigned char b)
+{
+ if (__glibc_likely (buf->__alloc_buffer_current < buf->__alloc_buffer_end))
+ {
+ *(unsigned char *) buf->__alloc_buffer_current = b;
+ ++buf->__alloc_buffer_current;
+ }
+ else
+ alloc_buffer_mark_failed (buf);
+}
+
+/* Obtain a pointer to LENGTH bytes in BUF, and consume these bytes.
+ NULL is returned if there is not enough room, and the buffer is
+ marked as failed, or if the buffer has already failed.
+ (Zero-length allocations from an empty buffer which has not yet
+ failed succeed.) */
+static inline __attribute__ ((nonnull (1))) void *
+alloc_buffer_alloc_bytes (struct alloc_buffer *buf, size_t length)
+{
+ if (length <= alloc_buffer_size (buf))
+ {
+ void *result = (void *) buf->__alloc_buffer_current;
+ buf->__alloc_buffer_current += length;
+ return result;
+ }
+ else
+ {
+ alloc_buffer_mark_failed (buf);
+ return NULL;
+ }
+}
+
+/* Internal function. Statically assert that the type size is
+ constant and valid. */
+static __always_inline size_t
+__alloc_buffer_assert_size (size_t size)
+{
+ if (!__builtin_constant_p (size))
+ {
+ __errordecl (error, "type size is not constant");
+ error ();
+ }
+ else if (size == 0)
+ {
+ __errordecl (error, "type size is zero");
+ error ();
+ }
+ return size;
+}
+
+/* Internal function. Statically assert that the type alignment is
+ constant and valid. */
+static __always_inline size_t
+__alloc_buffer_assert_align (size_t align)
+{
+ if (!__builtin_constant_p (align))
+ {
+ __errordecl (error, "type alignment is not constant");
+ error ();
+ }
+ else if (align == 0)
+ {
+ __errordecl (error, "type alignment is zero");
+ error ();
+ }
+ else if (!powerof2 (align))
+ {
+ __errordecl (error, "type alignment is not a power of two");
+ error ();
+ }
+ return align;
+}
+
+/* Internal function. Obtain a pointer to an object. */
+static inline __attribute__ ((nonnull (1))) void *
+__alloc_buffer_alloc (struct alloc_buffer *buf, size_t size, size_t align)
+{
+ if (size == 1 && align == 1)
+ return alloc_buffer_alloc_bytes (buf, size);
+
+ size_t current = buf->__alloc_buffer_current;
+ size_t aligned = roundup (current, align);
+ size_t new_current = aligned + size;
+ if (aligned >= current /* No overflow in align step. */
+ && new_current >= size /* No overflow in size computation. */
+ && new_current <= buf->__alloc_buffer_end) /* Room in buffer. */
+ {
+ buf->__alloc_buffer_current = new_current;
+ return (void *) aligned;
+ }
+ else
+ {
+ alloc_buffer_mark_failed (buf);
+ return NULL;
+ }
+}
+
+/* Obtain a TYPE * pointer to an object in BUF of TYPE. Consume these
+ bytes from the buffer. Return NULL and mark the buffer as failed
+ if there is not enough room in the buffer, or if the buffer has
+ failed before. */
+#define alloc_buffer_alloc(buf, type) \
+ ((type *) __alloc_buffer_alloc \
+ (buf, __alloc_buffer_assert_size (sizeof (type)), \
+ __alloc_buffer_assert_align (__alignof__ (type))))
+
+/* Internal function. Obtain a pointer to an object which is
+ subsequently added. */
+static inline const __attribute__ ((nonnull (1))) void *
+__alloc_buffer_next (struct alloc_buffer *buf, size_t align)
+{
+ if (align == 1)
+ return (const void *) buf->__alloc_buffer_current;
+
+ size_t current = buf->__alloc_buffer_current;
+ size_t aligned = roundup (current, align);
+ if (aligned >= current /* No overflow in align step. */
+ && aligned <= buf->__alloc_buffer_end) /* Room in buffer. */
+ {
+ buf->__alloc_buffer_current = aligned;
+ return (const void *) aligned;
+ }
+ else
+ {
+ alloc_buffer_mark_failed (buf);
+ return NULL;
+ }
+}
+
+/* Like alloc_buffer_alloc, but do not advance the pointer beyond the
+ object (so a subseqent call to alloc_buffer_next or
+ alloc_buffer_alloc returns the same pointer). Note that the buffer
+ is still aligned according to the requirements of TYPE. The effect
+ of this function is similar to allocating a zero-length array from
+ the buffer. */
+#define alloc_buffer_next(buf, type) \
+ ((const type *) __alloc_buffer_next \
+ (buf, __alloc_buffer_assert_align (__alignof__ (type))))
+
+/* Internal function. Allocate an array. */
+void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
+ size_t size, size_t align,
+ size_t count)
+ __attribute__ ((nonnull (1)));
+
+/* Obtain a TYPE * pointer to an array of COUNT objects in BUF of
+ TYPE. Consume these bytes from the buffer. Return NULL and mark
+ the buffer as failed if there is not enough room in the buffer,
+ or if the buffer has failed before. (Zero-length allocations from
+ an empty buffer which has not yet failed succeed.) */
+#define alloc_buffer_alloc_array(buf, type, count) \
+ ((type *) __libc_alloc_buffer_alloc_array \
+ (buf, __alloc_buffer_assert_size (sizeof (type)), \
+ __alloc_buffer_assert_align (__alignof__ (type)), \
+ count))
+
+/* Internal function. See alloc_buffer_copy_bytes below. */
+struct alloc_buffer __libc_alloc_buffer_copy_bytes (struct alloc_buffer,
+ const void *, size_t)
+ __attribute__ ((nonnull (2)));
+
+/* Copy SIZE bytes starting at SRC into the buffer. If there is not
+ enough room in the buffer, the buffer is marked as failed. No
+ alignment of the buffer is performed. */
+static inline __attribute__ ((nonnull (1, 2))) void
+alloc_buffer_copy_bytes (struct alloc_buffer *buf, const void *src, size_t size)
+{
+ *buf = __libc_alloc_buffer_copy_bytes (*buf, src, size);
+}
+
+/* Internal function. See alloc_buffer_copy_string below. */
+struct alloc_buffer __libc_alloc_buffer_copy_string (struct alloc_buffer,
+ const char *)
+ __attribute__ ((nonnull (2)));
+
+/* Copy the string at SRC into the buffer, including its null
+ terminator. If there is not enough room in the buffer, the buffer
+ is marked as failed. Return a pointer to the string. */
+static inline __attribute__ ((nonnull (1, 2))) char *
+alloc_buffer_copy_string (struct alloc_buffer *buf, const char *src)
+{
+ char *result = (char *) buf->__alloc_buffer_current;
+ *buf = __libc_alloc_buffer_copy_string (*buf, src);
+ if (alloc_buffer_has_failed (buf))
+ result = NULL;
+ return result;
+}
+
+#ifndef _ISOMAC
+libc_hidden_proto (__libc_alloc_buffer_alloc_array)
+libc_hidden_proto (__libc_alloc_buffer_allocate)
+libc_hidden_proto (__libc_alloc_buffer_copy_bytes)
+libc_hidden_proto (__libc_alloc_buffer_copy_string)
+libc_hidden_proto (__libc_alloc_buffer_create_failure)
+#endif
+
+#endif /* _ALLOC_BUFFER_H */
diff --git a/include/alloca.h b/include/alloca.h
index 01500259b8..c0b8395443 100644
--- a/include/alloca.h
+++ b/include/alloca.h
@@ -1,6 +1,9 @@
#ifndef _ALLOCA_H
#include <stdlib/alloca.h>
+
+# ifndef _ISOMAC
+
#include <stackinfo.h>
#undef __alloca
@@ -20,57 +23,18 @@ libc_hidden_proto (__libc_alloca_cutoff)
#include <allocalim.h>
-#ifndef stackinfo_alloca_round
-# define stackinfo_alloca_round(l) (((l) + 15) & -16)
-#endif
-
-#if _STACK_GROWS_DOWN
-# define extend_alloca(buf, len, newlen) \
- (__typeof (buf)) ({ size_t __newlen = stackinfo_alloca_round (newlen); \
- char *__newbuf = __alloca (__newlen); \
- if (__newbuf + __newlen == (char *) (buf)) \
- len += __newlen; \
- else \
- len = __newlen; \
- __newbuf; })
-#elif _STACK_GROWS_UP
-# define extend_alloca(buf, len, newlen) \
- (__typeof (buf)) ({ size_t __newlen = stackinfo_alloca_round (newlen); \
- char *__newbuf = __alloca (__newlen); \
- char *__buf = (char *) (buf); \
- if (__buf + len == __newbuf) \
- { \
- len += __newlen; \
- __newbuf = __buf; \
- } \
- else \
- len = __newlen; \
- __newbuf; })
-#else
-# define extend_alloca(buf, len, newlen) \
- __alloca (((len) = (newlen)))
-#endif
-
#if defined stackinfo_get_sp && defined stackinfo_sub_sp
# define alloca_account(size, avar) \
({ void *old__ = stackinfo_get_sp (); \
void *m__ = __alloca (size); \
avar += stackinfo_sub_sp (old__); \
m__; })
-# define extend_alloca_account(buf, len, newlen, avar) \
- ({ void *old__ = stackinfo_get_sp (); \
- void *m__ = extend_alloca (buf, len, newlen); \
- avar += stackinfo_sub_sp (old__); \
- m__; })
#else
# define alloca_account(size, avar) \
({ size_t s__ = (size); \
avar += s__; \
__alloca (s__); })
-# define extend_alloca_account(buf, len, newlen, avar) \
- ({ size_t s__ = (newlen); \
- avar += s__; \
- extend_alloca (buf, len, s__); })
#endif
+# endif /* !_ISOMAC */
#endif
diff --git a/include/allocate_once.h b/include/allocate_once.h
new file mode 100644
index 0000000000..26902dde7c
--- /dev/null
+++ b/include/allocate_once.h
@@ -0,0 +1,95 @@
+/* Allocate and initialize an object once, in a thread-safe fashion.
+ Copyright (C) 2018 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/>. */
+
+#ifndef _ALLOCATE_ONCE_H
+#define _ALLOCATE_ONCE_H
+
+#include <atomic.h>
+
+/* Slow path for allocate_once; see below. */
+void *__libc_allocate_once_slow (void **__place,
+ void *(*__allocate) (void *__closure),
+ void (*__deallocate) (void *__closure,
+ void *__ptr),
+ void *__closure);
+
+/* Return an a pointer to an allocated and initialized data structure.
+ If this function returns a non-NULL value, the caller can assume
+ that pointed-to data has been initialized according to the ALLOCATE
+ function.
+
+ It is expected that callers define an inline helper function which
+ adds type safety, like this.
+
+ struct foo { ... };
+ struct foo *global_foo;
+ static void *allocate_foo (void *closure);
+ static void *deallocate_foo (void *closure, void *ptr);
+
+ static inline struct foo *
+ get_foo (void)
+ {
+ return allocate_once (&global_foo, allocate_foo, free_foo, NULL);
+ }
+
+ (Note that the global_foo variable is initialized to zero.)
+ Usage of this helper function looks like this:
+
+ struct foo *local_foo = get_foo ();
+ if (local_foo == NULL)
+ report_allocation_failure ();
+
+ allocate_once first performs an acquire MO load on *PLACE. If the
+ result is not null, it is returned. Otherwise, ALLOCATE (CLOSURE)
+ is called, yielding a value RESULT. If RESULT equals NULL,
+ allocate_once returns NULL, and does not modify *PLACE (but another
+ thread may concurrently perform an allocation which succeeds,
+ updating *PLACE). If RESULT does not equal NULL, the function uses
+ a CAS with acquire-release MO to update the NULL value in *PLACE
+ with the RESULT value. If it turns out that *PLACE was updated
+ concurrently, allocate_once calls DEALLOCATE (CLOSURE, RESULT) to
+ undo the effect of ALLOCATE, and returns the new value of *PLACE
+ (after an acquire MO load). If DEALLOCATE is NULL, free (RESULT)
+ is called instead.
+
+ Compared to __libc_once, allocate_once has the advantage that it
+ does not need separate space for a control variable, and that it is
+ safe with regards to cancellation and other forms of exception
+ handling if the supplied callback functions are safe in that
+ regard. allocate_once passes a closure parameter to the allocation
+ function, too. */
+static inline void *
+allocate_once (void **__place, void *(*__allocate) (void *__closure),
+ void (*__deallocate) (void *__closure, void *__ptr),
+ void *__closure)
+{
+ /* Synchronizes with the release MO CAS in
+ __allocate_once_slow. */
+ void *__result = atomic_load_acquire (__place);
+ if (__result != NULL)
+ return __result;
+ else
+ return __libc_allocate_once_slow (__place, __allocate, __deallocate,
+ __closure);
+}
+
+#ifndef _ISOMAC
+libc_hidden_proto (__libc_allocate_once_slow)
+#endif
+
+#endif /* _ALLOCATE_ONCE_H */
diff --git a/include/argp-fmtstream.h b/include/argp-fmtstream.h
new file mode 100644
index 0000000000..45c65ce834
--- /dev/null
+++ b/include/argp-fmtstream.h
@@ -0,0 +1,19 @@
+#ifndef _ARGP_FMTSTREAM_H
+#include <argp/argp-fmtstream.h>
+
+#ifndef _ISOMAC
+extern __typeof (__argp_fmtstream_ensure) __argp_fmtstream_ensure
+ attribute_hidden;
+extern __typeof (__argp_fmtstream_free) __argp_fmtstream_free
+ attribute_hidden;
+extern __typeof (__argp_fmtstream_printf) __argp_fmtstream_printf
+ attribute_hidden;
+extern __typeof (__argp_fmtstream_update) __argp_fmtstream_update
+ attribute_hidden;
+extern __typeof (__argp_fmtstream_write) __argp_fmtstream_write
+ attribute_hidden;
+extern __typeof (__argp_make_fmtstream) __argp_make_fmtstream
+ attribute_hidden;
+#endif
+
+#endif
diff --git a/include/argp.h b/include/argp.h
index 92be5f90f1..6cf8782060 100644
--- a/include/argp.h
+++ b/include/argp.h
@@ -1 +1,11 @@
+#ifndef _ARGP_H
#include <argp/argp.h>
+
+#ifndef _ISOMAC
+extern __typeof (__argp_error) __argp_error attribute_hidden;
+extern __typeof (__argp_failure) __argp_failure attribute_hidden;
+extern __typeof (__argp_input) __argp_input attribute_hidden;
+extern __typeof (__argp_state_help) __argp_state_help attribute_hidden;
+#endif
+
+#endif
diff --git a/include/argz.h b/include/argz.h
index 4eab0b680b..e081b2aceb 100644
--- a/include/argz.h
+++ b/include/argz.h
@@ -2,8 +2,45 @@
#include <string/argz.h>
+# ifndef _ISOMAC
+
+extern error_t __argz_create_sep (const char *__restrict __string,
+ int __sep, char **__restrict __argz,
+ size_t *__restrict __len)
+ __THROW attribute_hidden;
+extern error_t __argz_append (char **__restrict __argz,
+ size_t *__restrict __argz_len,
+ const char *__restrict __buf, size_t __buf_len)
+ __THROW attribute_hidden;
+extern error_t __argz_add (char **__restrict __argz,
+ size_t *__restrict __argz_len,
+ const char *__restrict __str)
+ __THROW attribute_hidden;
+extern error_t __argz_add_sep (char **__restrict __argz,
+ size_t *__restrict __argz_len,
+ const char *__restrict __string, int __delim)
+ __THROW attribute_hidden;
+extern void __argz_delete (char **__restrict __argz,
+ size_t *__restrict __argz_len,
+ char *__restrict __entry)
+ __THROW attribute_hidden;
+extern error_t __argz_insert (char **__restrict __argz,
+ size_t *__restrict __argz_len,
+ char *__restrict __before,
+ const char *__restrict __entry)
+ __THROW attribute_hidden;
+extern error_t __argz_replace (char **__restrict __argz,
+ size_t *__restrict __argz_len,
+ const char *__restrict __str,
+ const char *__restrict __with,
+ unsigned int *__restrict __replace_count)
+ attribute_hidden;
+
libc_hidden_proto (argz_delete)
libc_hidden_proto (__argz_count)
libc_hidden_proto (__argz_stringify)
+libc_hidden_proto (argz_next)
+libc_hidden_proto (__argz_next)
+# endif /* !_ISOMAC */
#endif
diff --git a/include/arpa/nameser.h b/include/arpa/nameser.h
index 57f7457848..7a8290e1f2 100644
--- a/include/arpa/nameser.h
+++ b/include/arpa/nameser.h
@@ -2,6 +2,8 @@
#include <resolv/arpa/nameser.h>
+# ifndef _ISOMAC
+
/* If the machine allows unaligned access we can do better than using
the NS_GET16, NS_GET32, NS_PUT16, and NS_PUT32 macros from the
installed header. */
@@ -47,8 +49,11 @@ extern const struct _ns_flagdata _ns_flagdata[] attribute_hidden;
#endif
-extern u_int __ns_get16 (const u_char *) __THROW;
-extern u_long __ns_get32 (const u_char *) __THROW;
+extern unsigned int __ns_get16 (const unsigned char *) __THROW;
+extern unsigned long __ns_get32 (const unsigned char *) __THROW;
+int __ns_name_ntop (const unsigned char *, char *, size_t) __THROW;
+int __ns_name_unpack (const unsigned char *, const unsigned char *,
+ const unsigned char *, unsigned char *, size_t) __THROW;
#define ns_msg_getflag(handle, flag) \
(((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift)
@@ -74,4 +79,5 @@ libresolv_hidden_proto (ns_samename)
libresolv_hidden_proto (ns_makecanon)
libresolv_hidden_proto (ns_format_ttl)
+# endif /* !_ISOMAC */
#endif
diff --git a/include/arpa/nameser_compat.h b/include/arpa/nameser_compat.h
index 2e735ede4c..f7d0e043c6 100644
--- a/include/arpa/nameser_compat.h
+++ b/include/arpa/nameser_compat.h
@@ -1,8 +1,11 @@
#ifndef _ARPA_NAMESER_COMPAT_
#include <resolv/arpa/nameser_compat.h>
-/* Picksome unused number to represent lookups of IPv4 and IPv6 (i.e.,
- T_A and T_AAAA). */
-#define T_UNSPEC 62321
+# ifndef _ISOMAC
+/* The number is outside the 16-bit RR type range and is used
+ internally by the implementation. */
+#define T_QUERY_A_AND_AAAA 439963904
+
+# endif /* !_ISOMAC */
#endif
diff --git a/include/array_length.h b/include/array_length.h
new file mode 100644
index 0000000000..94bf2b2d4d
--- /dev/null
+++ b/include/array_length.h
@@ -0,0 +1,36 @@
+/* The array_length and array_end macros.
+ Copyright (C) 2017-2018 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/>. */
+
+#ifndef _ARRAY_LENGTH_H
+#define _ARRAY_LENGTH_H
+
+/* array_length (VAR) is the number of elements in the array VAR. VAR
+ must evaluate to an array, not a pointer. */
+#define array_length(var) \
+ __extension__ ({ \
+ _Static_assert (!__builtin_types_compatible_p \
+ (__typeof (var), __typeof (&(var)[0])), \
+ "argument must be an array"); \
+ sizeof (var) / sizeof ((var)[0]); \
+ })
+
+/* array_end (VAR) is a pointer one past the end of the array VAR.
+ VAR must evaluate to an array, not a pointer. */
+#define array_end(var) (&(var)[array_length (var)])
+
+#endif /* _ARRAY_LENGTH_H */
diff --git a/include/assert.h b/include/assert.h
index c452667956..61cc8aa22f 100644
--- a/include/assert.h
+++ b/include/assert.h
@@ -18,9 +18,9 @@ extern void __assert_perror_fail (int __errnum, const char *__file,
extern void __assert_fail_base (const char *fmt, const char *assertion,
const char *file, unsigned int line,
const char *function)
- __THROW __attribute__ ((__noreturn__));
+ __THROW __attribute__ ((__noreturn__)) attribute_hidden;
-# if IS_IN (libc) || IS_IN (rtld)
+# if IS_IN (libc) || (IS_IN (rtld) && !defined NO_RTLD_HIDDEN)
hidden_proto (__assert_fail)
hidden_proto (__assert_perror_fail)
# endif
diff --git a/include/atomic.h b/include/atomic.h
index 5e8bfffa08..6af07dba58 100644
--- a/include/atomic.h
+++ b/include/atomic.h
@@ -1,5 +1,5 @@
/* Internal macros for atomic operations for GNU C Library.
- Copyright (C) 2002-2016 Free Software Foundation, Inc.
+ Copyright (C) 2002-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -54,7 +54,7 @@
and following args. */
#define __atomic_val_bysize(pre, post, mem, ...) \
({ \
- __typeof (*mem) __atg1_result; \
+ __typeof ((__typeof (*(mem))) *(mem)) __atg1_result; \
if (sizeof (*mem) == 1) \
__atg1_result = pre##_8_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 2) \
@@ -159,29 +159,12 @@
#endif
-#ifndef catomic_compare_and_exchange_bool_rel
-# ifndef atomic_compare_and_exchange_bool_rel
-# define catomic_compare_and_exchange_bool_rel(mem, newval, oldval) \
- catomic_compare_and_exchange_bool_acq (mem, newval, oldval)
-# else
-# define catomic_compare_and_exchange_bool_rel(mem, newval, oldval) \
- atomic_compare_and_exchange_bool_rel (mem, newval, oldval)
-# endif
-#endif
-
-
-#ifndef atomic_compare_and_exchange_bool_rel
-# define atomic_compare_and_exchange_bool_rel(mem, newval, oldval) \
- atomic_compare_and_exchange_bool_acq (mem, newval, oldval)
-#endif
-
-
/* Store NEWVALUE in *MEM and return the old value. */
#ifndef atomic_exchange_acq
# define atomic_exchange_acq(mem, newvalue) \
- ({ __typeof (*(mem)) __atg5_oldval; \
+ ({ __typeof ((__typeof (*(mem))) *(mem)) __atg5_oldval; \
__typeof (mem) __atg5_memp = (mem); \
- __typeof (*(mem)) __atg5_value = (newvalue); \
+ __typeof ((__typeof (*(mem))) *(mem)) __atg5_value = (newvalue); \
\
do \
__atg5_oldval = *__atg5_memp; \
@@ -567,6 +550,20 @@ void __atomic_link_error (void);
if (sizeof (*mem) != 4) \
__atomic_link_error ();
# endif
+/* We additionally provide 8b and 16b atomic loads and stores; we do not yet
+ need other atomic operations of such sizes, and restricting the support to
+ loads and stores makes this easier for archs that do not have native
+ support for atomic operations to less-than-word-sized data. */
+# if __HAVE_64B_ATOMICS == 1
+# define __atomic_check_size_ls(mem) \
+ if ((sizeof (*mem) != 1) && (sizeof (*mem) != 2) && (sizeof (*mem) != 4) \
+ && (sizeof (*mem) != 8)) \
+ __atomic_link_error ();
+# else
+# define __atomic_check_size_ls(mem) \
+ if ((sizeof (*mem) != 1) && (sizeof (*mem) != 2) && sizeof (*mem) != 4) \
+ __atomic_link_error ();
+# endif
# define atomic_thread_fence_acquire() \
__atomic_thread_fence (__ATOMIC_ACQUIRE)
@@ -576,18 +573,20 @@ void __atomic_link_error (void);
__atomic_thread_fence (__ATOMIC_SEQ_CST)
# define atomic_load_relaxed(mem) \
- ({ __atomic_check_size((mem)); __atomic_load_n ((mem), __ATOMIC_RELAXED); })
+ ({ __atomic_check_size_ls((mem)); \
+ __atomic_load_n ((mem), __ATOMIC_RELAXED); })
# define atomic_load_acquire(mem) \
- ({ __atomic_check_size((mem)); __atomic_load_n ((mem), __ATOMIC_ACQUIRE); })
+ ({ __atomic_check_size_ls((mem)); \
+ __atomic_load_n ((mem), __ATOMIC_ACQUIRE); })
# define atomic_store_relaxed(mem, val) \
do { \
- __atomic_check_size((mem)); \
+ __atomic_check_size_ls((mem)); \
__atomic_store_n ((mem), (val), __ATOMIC_RELAXED); \
} while (0)
# define atomic_store_release(mem, val) \
do { \
- __atomic_check_size((mem)); \
+ __atomic_check_size_ls((mem)); \
__atomic_store_n ((mem), (val), __ATOMIC_RELEASE); \
} while (0)
@@ -605,6 +604,9 @@ void __atomic_link_error (void);
__atomic_compare_exchange_n ((mem), (expected), (desired), 1, \
__ATOMIC_RELEASE, __ATOMIC_RELAXED); })
+# define atomic_exchange_relaxed(mem, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_exchange_n ((mem), (desired), __ATOMIC_RELAXED); })
# define atomic_exchange_acquire(mem, desired) \
({ __atomic_check_size((mem)); \
__atomic_exchange_n ((mem), (desired), __ATOMIC_ACQUIRE); })
@@ -625,9 +627,15 @@ void __atomic_link_error (void);
({ __atomic_check_size((mem)); \
__atomic_fetch_add ((mem), (operand), __ATOMIC_ACQ_REL); })
+# define atomic_fetch_and_relaxed(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_and ((mem), (operand), __ATOMIC_RELAXED); })
# define atomic_fetch_and_acquire(mem, operand) \
({ __atomic_check_size((mem)); \
__atomic_fetch_and ((mem), (operand), __ATOMIC_ACQUIRE); })
+# define atomic_fetch_and_release(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_and ((mem), (operand), __ATOMIC_RELEASE); })
# define atomic_fetch_or_relaxed(mem, operand) \
({ __atomic_check_size((mem)); \
@@ -635,6 +643,13 @@ void __atomic_link_error (void);
# define atomic_fetch_or_acquire(mem, operand) \
({ __atomic_check_size((mem)); \
__atomic_fetch_or ((mem), (operand), __ATOMIC_ACQUIRE); })
+# define atomic_fetch_or_release(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_or ((mem), (operand), __ATOMIC_RELEASE); })
+
+# define atomic_fetch_xor_release(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_xor ((mem), (operand), __ATOMIC_RELEASE); })
#else /* !USE_ATOMIC_COMPILER_BUILTINS */
@@ -653,7 +668,7 @@ void __atomic_link_error (void);
# ifndef atomic_load_relaxed
# define atomic_load_relaxed(mem) \
- ({ __typeof (*(mem)) __atg100_val; \
+ ({ __typeof ((__typeof (*(mem))) *(mem)) __atg100_val; \
__asm ("" : "=r" (__atg100_val) : "0" (*(mem))); \
__atg100_val; })
# endif
@@ -701,6 +716,12 @@ void __atomic_link_error (void);
*(expected) == __atg103_expected; })
# endif
+/* XXX Fall back to acquire MO because archs do not define a weaker
+ atomic_exchange. */
+# ifndef atomic_exchange_relaxed
+# define atomic_exchange_relaxed(mem, val) \
+ atomic_exchange_acq ((mem), (val))
+# endif
# ifndef atomic_exchange_acquire
# define atomic_exchange_acquire(mem, val) \
atomic_exchange_acq ((mem), (val))
@@ -732,12 +753,24 @@ void __atomic_link_error (void);
atomic_exchange_and_add_acq ((mem), (operand)); })
# endif
+/* XXX Fall back to acquire MO because archs do not define a weaker
+ atomic_and_val. */
+# ifndef atomic_fetch_and_relaxed
+# define atomic_fetch_and_relaxed(mem, operand) \
+ atomic_fetch_and_acquire ((mem), (operand))
+# endif
/* XXX The default for atomic_and_val has acquire semantics, but this is not
documented. */
# ifndef atomic_fetch_and_acquire
# define atomic_fetch_and_acquire(mem, operand) \
atomic_and_val ((mem), (operand))
# endif
+# ifndef atomic_fetch_and_release
+/* XXX This unnecessarily has acquire MO. */
+# define atomic_fetch_and_release(mem, operand) \
+ ({ atomic_thread_fence_release (); \
+ atomic_and_val ((mem), (operand)); })
+# endif
/* XXX The default for atomic_or_val has acquire semantics, but this is not
documented. */
@@ -751,6 +784,31 @@ void __atomic_link_error (void);
# define atomic_fetch_or_relaxed(mem, operand) \
atomic_fetch_or_acquire ((mem), (operand))
# endif
+/* XXX Contains an unnecessary acquire MO because archs do not define a weaker
+ atomic_or_val. */
+# ifndef atomic_fetch_or_release
+# define atomic_fetch_or_release(mem, operand) \
+ ({ atomic_thread_fence_release (); \
+ atomic_fetch_or_acquire ((mem), (operand)); })
+# endif
+
+# ifndef atomic_fetch_xor_release
+/* Failing the atomic_compare_exchange_weak_release reloads the value in
+ __atg104_expected, so we need only do the XOR again and retry. */
+# define atomic_fetch_xor_release(mem, operand) \
+ ({ __typeof (mem) __atg104_memp = (mem); \
+ __typeof (*(mem)) __atg104_expected = (*__atg104_memp); \
+ __typeof (*(mem)) __atg104_desired; \
+ __typeof (*(mem)) __atg104_op = (operand); \
+ \
+ do \
+ __atg104_desired = __atg104_expected ^ __atg104_op; \
+ while (__glibc_unlikely \
+ (atomic_compare_exchange_weak_release ( \
+ __atg104_memp, &__atg104_expected, __atg104_desired) \
+ == 0)); \
+ __atg104_expected; })
+#endif
#endif /* !USE_ATOMIC_COMPILER_BUILTINS */
@@ -760,4 +818,12 @@ void __atomic_link_error (void);
# define atomic_spin_nop() do { /* nothing */ } while (0)
#endif
+/* ATOMIC_EXCHANGE_USES_CAS is non-zero if atomic_exchange operations
+ are implemented based on a CAS loop; otherwise, this is zero and we assume
+ that the atomic_exchange operations could provide better performance
+ than a CAS loop. */
+#ifndef ATOMIC_EXCHANGE_USES_CAS
+# error ATOMIC_EXCHANGE_USES_CAS has to be defined.
+#endif
+
#endif /* atomic.h */
diff --git a/include/bits/cpu-set.h b/include/bits/cpu-set.h
new file mode 100644
index 0000000000..388f03cfbd
--- /dev/null
+++ b/include/bits/cpu-set.h
@@ -0,0 +1 @@
+#include <posix/bits/cpu-set.h>
diff --git a/include/bits/getopt_core.h b/include/bits/getopt_core.h
new file mode 100644
index 0000000000..1200de81b6
--- /dev/null
+++ b/include/bits/getopt_core.h
@@ -0,0 +1 @@
+#include <posix/bits/getopt_core.h>
diff --git a/include/bits/getopt_ext.h b/include/bits/getopt_ext.h
new file mode 100644
index 0000000000..31b99834ea
--- /dev/null
+++ b/include/bits/getopt_ext.h
@@ -0,0 +1 @@
+#include <posix/bits/getopt_ext.h>
diff --git a/include/bits/getopt_posix.h b/include/bits/getopt_posix.h
new file mode 100644
index 0000000000..e3b70c816c
--- /dev/null
+++ b/include/bits/getopt_posix.h
@@ -0,0 +1 @@
+#include <posix/bits/getopt_posix.h>
diff --git a/include/bits/mathcalls-helper-functions.h b/include/bits/mathcalls-helper-functions.h
new file mode 100644
index 0000000000..bb71f7fb18
--- /dev/null
+++ b/include/bits/mathcalls-helper-functions.h
@@ -0,0 +1 @@
+#include <math/bits/mathcalls-helper-functions.h>
diff --git a/include/bits/mathcalls-narrow.h b/include/bits/mathcalls-narrow.h
new file mode 100644
index 0000000000..0c66ecf889
--- /dev/null
+++ b/include/bits/mathcalls-narrow.h
@@ -0,0 +1 @@
+#include <math/bits/mathcalls-narrow.h>
diff --git a/include/bits/statx.h b/include/bits/statx.h
new file mode 100644
index 0000000000..8ec78a4f37
--- /dev/null
+++ b/include/bits/statx.h
@@ -0,0 +1 @@
+#include <io/bits/statx.h>
diff --git a/include/bits/string3.h b/include/bits/string3.h
deleted file mode 100644
index 1ddd981a90..0000000000
--- a/include/bits/string3.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <string/bits/string3.h>
diff --git a/include/bits/string_fortified.h b/include/bits/string_fortified.h
new file mode 100644
index 0000000000..88bf073c9c
--- /dev/null
+++ b/include/bits/string_fortified.h
@@ -0,0 +1 @@
+#include <string/bits/string_fortified.h>
diff --git a/include/bits/strings_fortified.h b/include/bits/strings_fortified.h
new file mode 100644
index 0000000000..77219c162c
--- /dev/null
+++ b/include/bits/strings_fortified.h
@@ -0,0 +1 @@
+#include <string/bits/strings_fortified.h>
diff --git a/include/bits/types.h b/include/bits/types.h
new file mode 100644
index 0000000000..1c47910607
--- /dev/null
+++ b/include/bits/types.h
@@ -0,0 +1 @@
+#include <posix/bits/types.h>
diff --git a/include/bits/types/FILE.h b/include/bits/types/FILE.h
new file mode 100644
index 0000000000..09b599baa0
--- /dev/null
+++ b/include/bits/types/FILE.h
@@ -0,0 +1 @@
+#include <libio/bits/types/FILE.h>
diff --git a/include/bits/types/__FILE.h b/include/bits/types/__FILE.h
new file mode 100644
index 0000000000..236f60bacd
--- /dev/null
+++ b/include/bits/types/__FILE.h
@@ -0,0 +1 @@
+#include <libio/bits/types/__FILE.h>
diff --git a/include/bits/types/__fpos64_t.h b/include/bits/types/__fpos64_t.h
new file mode 100644
index 0000000000..68cc4e8b66
--- /dev/null
+++ b/include/bits/types/__fpos64_t.h
@@ -0,0 +1 @@
+#include <libio/bits/types/__fpos64_t.h>
diff --git a/include/bits/types/__fpos_t.h b/include/bits/types/__fpos_t.h
new file mode 100644
index 0000000000..2dcdc98d75
--- /dev/null
+++ b/include/bits/types/__fpos_t.h
@@ -0,0 +1 @@
+#include <libio/bits/types/__fpos_t.h>
diff --git a/include/bits/types/__locale_t.h b/include/bits/types/__locale_t.h
new file mode 100644
index 0000000000..610b8197c7
--- /dev/null
+++ b/include/bits/types/__locale_t.h
@@ -0,0 +1 @@
+#include <locale/bits/types/__locale_t.h>
diff --git a/include/bits/types/__mbstate_t.h b/include/bits/types/__mbstate_t.h
new file mode 100644
index 0000000000..13e764e8c9
--- /dev/null
+++ b/include/bits/types/__mbstate_t.h
@@ -0,0 +1 @@
+#include <wcsmbs/bits/types/__mbstate_t.h>
diff --git a/include/bits/types/__sigval_t.h b/include/bits/types/__sigval_t.h
new file mode 100644
index 0000000000..62f8e48ed8
--- /dev/null
+++ b/include/bits/types/__sigval_t.h
@@ -0,0 +1 @@
+#include <signal/bits/types/__sigval_t.h>
diff --git a/include/bits/types/clock_t.h b/include/bits/types/clock_t.h
new file mode 100644
index 0000000000..4cfe8e7e8b
--- /dev/null
+++ b/include/bits/types/clock_t.h
@@ -0,0 +1 @@
+#include <time/bits/types/clock_t.h>
diff --git a/include/bits/types/clockid_t.h b/include/bits/types/clockid_t.h
new file mode 100644
index 0000000000..ff7290bb1d
--- /dev/null
+++ b/include/bits/types/clockid_t.h
@@ -0,0 +1 @@
+#include <time/bits/types/clockid_t.h>
diff --git a/include/bits/types/cookie_io_functions_t.h b/include/bits/types/cookie_io_functions_t.h
new file mode 100644
index 0000000000..87f7930c6e
--- /dev/null
+++ b/include/bits/types/cookie_io_functions_t.h
@@ -0,0 +1 @@
+#include <libio/bits/types/cookie_io_functions_t.h>
diff --git a/include/bits/types/locale_t.h b/include/bits/types/locale_t.h
new file mode 100644
index 0000000000..24b074872f
--- /dev/null
+++ b/include/bits/types/locale_t.h
@@ -0,0 +1 @@
+#include <locale/bits/types/locale_t.h>
diff --git a/include/bits/types/mbstate_t.h b/include/bits/types/mbstate_t.h
new file mode 100644
index 0000000000..99ec08a91a
--- /dev/null
+++ b/include/bits/types/mbstate_t.h
@@ -0,0 +1 @@
+#include <wcsmbs/bits/types/mbstate_t.h>
diff --git a/include/bits/types/res_state.h b/include/bits/types/res_state.h
new file mode 100644
index 0000000000..4b99b68da9
--- /dev/null
+++ b/include/bits/types/res_state.h
@@ -0,0 +1 @@
+#include <resolv/bits/types/res_state.h>
diff --git a/include/bits/types/sig_atomic_t.h b/include/bits/types/sig_atomic_t.h
new file mode 100644
index 0000000000..783693f71c
--- /dev/null
+++ b/include/bits/types/sig_atomic_t.h
@@ -0,0 +1 @@
+#include <signal/bits/types/sig_atomic_t.h>
diff --git a/include/bits/types/sigset_t.h b/include/bits/types/sigset_t.h
new file mode 100644
index 0000000000..20c3dc2095
--- /dev/null
+++ b/include/bits/types/sigset_t.h
@@ -0,0 +1 @@
+#include <signal/bits/types/sigset_t.h>
diff --git a/include/bits/types/sigval_t.h b/include/bits/types/sigval_t.h
new file mode 100644
index 0000000000..296734e827
--- /dev/null
+++ b/include/bits/types/sigval_t.h
@@ -0,0 +1 @@
+#include <signal/bits/types/sigval_t.h>
diff --git a/include/bits/types/struct_FILE.h b/include/bits/types/struct_FILE.h
new file mode 100644
index 0000000000..971407292b
--- /dev/null
+++ b/include/bits/types/struct_FILE.h
@@ -0,0 +1 @@
+#include <libio/bits/types/struct_FILE.h>
diff --git a/include/bits/types/struct_iovec.h b/include/bits/types/struct_iovec.h
new file mode 100644
index 0000000000..f8f163f648
--- /dev/null
+++ b/include/bits/types/struct_iovec.h
@@ -0,0 +1 @@
+#include <misc/bits/types/struct_iovec.h>
diff --git a/include/bits/types/struct_itimerspec.h b/include/bits/types/struct_itimerspec.h
new file mode 100644
index 0000000000..19a3fa3cb8
--- /dev/null
+++ b/include/bits/types/struct_itimerspec.h
@@ -0,0 +1 @@
+#include <time/bits/types/struct_itimerspec.h>
diff --git a/include/bits/types/struct_osockaddr.h b/include/bits/types/struct_osockaddr.h
new file mode 100644
index 0000000000..fe2561bb1f
--- /dev/null
+++ b/include/bits/types/struct_osockaddr.h
@@ -0,0 +1 @@
+#include <socket/bits/types/struct_osockaddr.h>
diff --git a/include/bits/types/struct_rusage.h b/include/bits/types/struct_rusage.h
new file mode 100644
index 0000000000..ff048bbd76
--- /dev/null
+++ b/include/bits/types/struct_rusage.h
@@ -0,0 +1 @@
+#include <resource/bits/types/struct_rusage.h>
diff --git a/include/bits/types/struct_sigstack.h b/include/bits/types/struct_sigstack.h
new file mode 100644
index 0000000000..2b23fb2837
--- /dev/null
+++ b/include/bits/types/struct_sigstack.h
@@ -0,0 +1 @@
+#include <signal/bits/types/struct_sigstack.h>
diff --git a/include/bits/types/struct_timespec.h b/include/bits/types/struct_timespec.h
new file mode 100644
index 0000000000..c27417cfd5
--- /dev/null
+++ b/include/bits/types/struct_timespec.h
@@ -0,0 +1 @@
+#include <time/bits/types/struct_timespec.h>
diff --git a/include/bits/types/struct_timeval.h b/include/bits/types/struct_timeval.h
new file mode 100644
index 0000000000..a5549cbae3
--- /dev/null
+++ b/include/bits/types/struct_timeval.h
@@ -0,0 +1 @@
+#include <time/bits/types/struct_timeval.h>
diff --git a/include/bits/types/struct_tm.h b/include/bits/types/struct_tm.h
new file mode 100644
index 0000000000..412dd8683a
--- /dev/null
+++ b/include/bits/types/struct_tm.h
@@ -0,0 +1 @@
+#include <time/bits/types/struct_tm.h>
diff --git a/include/bits/types/time_t.h b/include/bits/types/time_t.h
new file mode 100644
index 0000000000..70490c6d05
--- /dev/null
+++ b/include/bits/types/time_t.h
@@ -0,0 +1 @@
+#include <time/bits/types/time_t.h>
diff --git a/include/bits/types/timer_t.h b/include/bits/types/timer_t.h
new file mode 100644
index 0000000000..5a33fa40a4
--- /dev/null
+++ b/include/bits/types/timer_t.h
@@ -0,0 +1 @@
+#include <time/bits/types/timer_t.h>
diff --git a/include/bits/types/wint_t.h b/include/bits/types/wint_t.h
new file mode 100644
index 0000000000..f1e373d294
--- /dev/null
+++ b/include/bits/types/wint_t.h
@@ -0,0 +1 @@
+#include <wcsmbs/bits/types/wint_t.h>
diff --git a/include/bits/wctype-wchar.h b/include/bits/wctype-wchar.h
new file mode 100644
index 0000000000..8273cd743e
--- /dev/null
+++ b/include/bits/wctype-wchar.h
@@ -0,0 +1 @@
+#include <wctype/bits/wctype-wchar.h>
diff --git a/include/bits/xopen_lim.h b/include/bits/xopen_lim.h
index 26b4fba970..d14b633a57 100644
--- a/include/bits/xopen_lim.h
+++ b/include/bits/xopen_lim.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -29,9 +29,6 @@
#ifndef _XOPEN_LIM_H
#define _XOPEN_LIM_H 1
-#define __need_IOV_MAX
-#include <bits/stdio_lim.h>
-
/* We do not provide fixed values for
ARG_MAX Maximum length of argument to the `exec' function
@@ -60,10 +57,16 @@
*/
-/* Maximum number of `iovec' structures that one process has available
- for use with `readv' or writev'. */
+/* Maximum number of `iovec' structures that may be used in a single call
+ to `readv', `writev', etc. */
#define _XOPEN_IOV_MAX _POSIX_UIO_MAXIOV
+#include <bits/uio_lim.h>
+#ifdef __IOV_MAX
+# define IOV_MAX __IOV_MAX
+#else
+# undef IOV_MAX
+#endif
/* Maximum value of `digit' in calls to the `printf' and `scanf'
functions. We have no limit, so return a reasonable value. */
@@ -77,7 +80,9 @@
/* Maximum number of bytes in N-to-1 collation mapping. We have no
limit. */
-#define NL_NMAX INT_MAX
+#if defined __USE_GNU || !defined __USE_XOPEN2K8
+# define NL_NMAX INT_MAX
+#endif
/* Maximum set number. We have no limit. */
#define NL_SETMAX INT_MAX
diff --git a/include/complex.h b/include/complex.h
index 082e71fb10..2c86709ced 100644
--- a/include/complex.h
+++ b/include/complex.h
@@ -8,6 +8,9 @@
extern complex float __kernel_casinhf (complex float z, int adj);
extern complex double __kernel_casinh (complex double z, int adj);
extern complex long double __kernel_casinhl (complex long double z, int adj);
+# if __HAVE_DISTINCT_FLOAT128
+extern __CFLOAT128 __kernel_casinhf128 (__CFLOAT128 z, int adj);
+# endif
# endif
#endif
diff --git a/include/crypt.h b/include/crypt.h
new file mode 100644
index 0000000000..544551da21
--- /dev/null
+++ b/include/crypt.h
@@ -0,0 +1,3 @@
+#ifndef _CRYPT_H
+# include <crypt/crypt.h>
+#endif /* _CRYPT_H */
diff --git a/include/ctype.h b/include/ctype.h
index ac6db790b7..493a6f80ce 100644
--- a/include/ctype.h
+++ b/include/ctype.h
@@ -11,6 +11,9 @@ libc_hidden_proto (__ctype_init)
So defeat macro expansion with parens for this declaration. */
extern int (__isctype) (int __c, int __mask);
+libc_hidden_proto (tolower)
+libc_hidden_proto (toupper)
+
# if IS_IN (libc)
/* These accessors are used by the optimized macros to find the
diff --git a/include/dirent.h b/include/dirent.h
index c792e53c96..400835eefe 100644
--- a/include/dirent.h
+++ b/include/dirent.h
@@ -15,13 +15,13 @@ struct scandir_cancel_struct
};
/* Now define the internal interfaces. */
-extern DIR *__opendir (const char *__name);
-extern DIR *__opendirat (int dfd, const char *__name)
- internal_function attribute_hidden;
-extern DIR *__fdopendir (int __fd);
-extern int __closedir (DIR *__dirp);
-extern struct dirent *__readdir (DIR *__dirp);
+extern DIR *__opendir (const char *__name) attribute_hidden;
+extern DIR *__opendirat (int dfd, const char *__name) attribute_hidden;
+extern DIR *__fdopendir (int __fd) attribute_hidden;
+extern int __closedir (DIR *__dirp) attribute_hidden;
+extern struct dirent *__readdir (DIR *__dirp) attribute_hidden;
extern struct dirent64 *__readdir64 (DIR *__dirp);
+libc_hidden_proto (__readdir64)
extern int __readdir_r (DIR *__dirp, struct dirent *__entry,
struct dirent **__result);
extern int __readdir64_r (DIR *__dirp, struct dirent64 *__entry,
@@ -36,18 +36,20 @@ extern __ssize_t __getdirentries (int __fd, char *__restrict __buf,
__off_t *__restrict __basep)
__THROW __nonnull ((2, 4));
extern __ssize_t __getdents (int __fd, char *__buf, size_t __nbytes)
- internal_function attribute_hidden;
+ attribute_hidden;
extern __ssize_t __getdents64 (int __fd, char *__buf, size_t __nbytes)
- internal_function attribute_hidden;
+ attribute_hidden;
extern int __alphasort64 (const struct dirent64 **a, const struct dirent64 **b)
__attribute_pure__;
extern int __versionsort64 (const struct dirent64 **a,
const struct dirent64 **b)
__attribute_pure__;
extern DIR *__alloc_dir (int fd, bool close_fd, int flags,
- const struct stat64 *statp)
- internal_function attribute_hidden;
+ const struct stat64 *statp) attribute_hidden;
extern __typeof (rewinddir) __rewinddir;
+extern __typeof (seekdir) __seekdir;
+extern __typeof (dirfd) __dirfd;
+libc_hidden_proto (dirfd);
extern void __scandir_cancel_handler (void *arg) attribute_hidden;
extern int __scandir_tail (DIR *dp,
@@ -55,32 +57,26 @@ extern int __scandir_tail (DIR *dp,
int (*select) (const struct dirent *),
int (*cmp) (const struct dirent **,
const struct dirent **))
- internal_function attribute_hidden;
-# ifdef _DIRENT_MATCHES_DIRENT64
-# define __scandir64_tail (dp, namelist, select, cmp) \
- __scandir_tail (dp, (struct dirent ***) (namelist), \
- (int (*) (const struct dirent *)) (select), \
- (int (*) (const struct dirent **, \
- const struct dirent **)) (cmp))
-# else
+ attribute_hidden;
+# if !_DIRENT_MATCHES_DIRENT64
+extern int __scandir_tail (DIR *dp,
+ struct dirent ***namelist,
+ int (*select) (const struct dirent *),
+ int (*cmp) (const struct dirent **,
+ const struct dirent **))
+ attribute_hidden;
+# endif
extern int __scandir64_tail (DIR *dp,
struct dirent64 ***namelist,
int (*select) (const struct dirent64 *),
int (*cmp) (const struct dirent64 **,
const struct dirent64 **))
- internal_function attribute_hidden;
-# endif
+ attribute_hidden;
libc_hidden_proto (__rewinddir)
extern __typeof (scandirat) __scandirat;
-libc_hidden_proto (__scandirat)
-libc_hidden_proto (scandirat64)
-# if IS_IN (rtld)
-extern __typeof (__closedir) __closedir attribute_hidden;
-extern __typeof (__fdopendir) __fdopendir attribute_hidden;
-extern __typeof (__readdir) __readdir attribute_hidden;
-extern __typeof (__readdir64) __readdir64 attribute_hidden;
+# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
extern __typeof (__rewinddir) __rewinddir attribute_hidden;
# endif
# endif
diff --git a/include/dlfcn.h b/include/dlfcn.h
index 2524292ebc..0dc57dbe22 100644
--- a/include/dlfcn.h
+++ b/include/dlfcn.h
@@ -31,20 +31,42 @@ extern char **__libc_argv attribute_hidden;
/* Now define the internal interfaces. */
+/* Use RTLD_NOW here because:
+ 1. In pthread_cancel_init we want to use RTLD_NOW to reduce the stack usage
+ of future cancellation operations, particularly when the target thread
+ is running with a small stack. Likewise for consistency we do the same
+ thing in __libgcc_s_init. RTLD_NOW will rarely make a difference for
+ __libgcc_s_init because unwinding is already in progress, so libgcc_s.so
+ has already been loaded if its unwinder is used (Bug 22636).
+ 2. It allows us to provide robust fallback code at dlopen time for
+ incorrectly configured systems that mix old libnss_* modules with newly
+ installed libraries e.g. old libnss_nis.so.2 with new libnsl.so.1. Using
+ RTLD_LAZY here causes a failure at the time the symbol is called and at
+ that point it is much harder to safely return an error (Bug 22766).
+
+ The use of RTLD_NOW also impacts gconv module loading, backtracing
+ (where the unwinder form libgcc_s.so is used), and IDNA functions
+ (which load libidn2), all of which load their respective DSOs on
+ demand, and so should not impact program startup. That is to say
+ that the DSOs are loaded as part of an API call and therefore we
+ will be calling that family of API functions shortly so RTLD_NOW or
+ RTLD_LAZY is not a big difference in performance, but RTLD_NOW has
+ better error handling semantics for the library. */
#define __libc_dlopen(name) \
- __libc_dlopen_mode (name, RTLD_LAZY | __RTLD_DLOPEN)
+ __libc_dlopen_mode (name, RTLD_NOW | __RTLD_DLOPEN)
extern void *__libc_dlopen_mode (const char *__name, int __mode);
extern void *__libc_dlsym (void *__map, const char *__name);
+extern void *__libc_dlvsym (void *map, const char *name, const char *version);
extern int __libc_dlclose (void *__map);
libc_hidden_proto (__libc_dlopen_mode)
libc_hidden_proto (__libc_dlsym)
+libc_hidden_proto (__libc_dlvsym)
libc_hidden_proto (__libc_dlclose)
/* Locate shared object containing the given address. */
#ifdef ElfW
extern int _dl_addr (const void *address, Dl_info *info,
- struct link_map **mapp, const ElfW(Sym) **symbolp)
- internal_function;
+ struct link_map **mapp, const ElfW(Sym) **symbolp);
libc_hidden_proto (_dl_addr)
#endif
@@ -60,23 +82,21 @@ extern void _dl_close_worker (struct link_map *map, bool force)
/* Look up NAME in shared object HANDLE (which may be RTLD_DEFAULT or
RTLD_NEXT). WHO is the calling function, for RTLD_NEXT. Returns
the symbol value, which may be NULL. */
-extern void *_dl_sym (void *handle, const char *name, void *who)
- internal_function;
+extern void *_dl_sym (void *handle, const char *name, void *who);
/* Look up version VERSION of symbol NAME in shared object HANDLE
(which may be RTLD_DEFAULT or RTLD_NEXT). WHO is the calling
function, for RTLD_NEXT. Returns the symbol value, which may be
NULL. */
extern void *_dl_vsym (void *handle, const char *name, const char *version,
- void *who)
- internal_function;
+ void *who);
/* Helper function for <dlfcn.h> functions. Runs the OPERATE function via
_dl_catch_error. Returns zero for success, nonzero for failure; and
arranges for `dlerror' to return the error details.
ARGS is passed as argument to OPERATE. */
extern int _dlerror_run (void (*operate) (void *), void *args)
- internal_function;
+ attribute_hidden;
#ifdef SHARED
# define DL_CALLER_DECL /* Nothing */
@@ -135,6 +155,8 @@ extern void __libc_register_dl_open_hook (struct link_map *map)
extern void __libc_register_dlfcn_hook (struct link_map *map)
attribute_hidden;
#endif
-#endif
+extern void __dlerror_main_freeres (void) attribute_hidden;
+
+#endif
#endif
diff --git a/include/dso_handle.h b/include/dso_handle.h
new file mode 100644
index 0000000000..d9c1ebbce4
--- /dev/null
+++ b/include/dso_handle.h
@@ -0,0 +1,3 @@
+/* __dso_handle is always defined by either crtbegin.o from GCC or our
+ dso_handle.c. */
+extern void *__dso_handle __attribute__ ((__visibility__ ("hidden")));
diff --git a/include/elf.h b/include/elf.h
index 60658c617c..ab76aafb1e 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -1,5 +1,20 @@
#ifndef _ELF_H
-# include <elf/elf.h>
+#include <elf/elf.h>
+
+#ifndef _ISOMAC
+
+# include <libc-pointer-arith.h>
+
+/* Compute the offset of the note descriptor from size of note entry's
+ owner string and note alignment. */
+# define ELF_NOTE_DESC_OFFSET(namesz, align) \
+ ALIGN_UP (sizeof (ElfW(Nhdr)) + (namesz), (align))
+
+/* Compute the offset of the next note entry from size of note entry's
+ owner string, size of the note descriptor and note alignment. */
+# define ELF_NOTE_NEXT_OFFSET(namesz, descsz, align) \
+ ALIGN_UP (ELF_NOTE_DESC_OFFSET ((namesz), (align)) + (descsz), (align))
+
/* Some information which is not meant for the public and therefore not
in <elf.h>. */
# include <dl-dtprocnum.h>
@@ -9,4 +24,6 @@
# define DT_1_SUPPORTED_MASK \
(DF_1_NOW | DF_1_NODELETE | DF_1_INITFIRST | DF_1_NOOPEN \
| DF_1_ORIGIN | DF_1_NODEFLIB)
-#endif
+
+#endif /* !_ISOMAC */
+#endif /* elf.h */
diff --git a/include/envz.h b/include/envz.h
index 8cfd9b57e9..633fcc6f40 100644
--- a/include/envz.h
+++ b/include/envz.h
@@ -2,7 +2,10 @@
#include <string/envz.h>
+# ifndef _ISOMAC
+
libc_hidden_proto (envz_entry)
libc_hidden_proto (envz_remove)
+# endif /* !_ISOMAC */
#endif
diff --git a/include/err.h b/include/err.h
index 737dfc1b6f..382855938e 100644
--- a/include/err.h
+++ b/include/err.h
@@ -1,8 +1,14 @@
+#ifndef _ERR_H
#include <misc/err.h>
+# ifndef _ISOMAC
+
libc_hidden_proto (warn)
libc_hidden_proto (warnx)
libc_hidden_proto (vwarn)
libc_hidden_proto (vwarnx)
libc_hidden_proto (verr)
libc_hidden_proto (verrx)
+
+# endif /* !_ISOMAC */
+#endif /* err.h */
diff --git a/include/errno.h b/include/errno.h
index 1d542ec1d4..457114b27a 100644
--- a/include/errno.h
+++ b/include/errno.h
@@ -1,8 +1,6 @@
#ifndef _ERRNO_H
-
#include <stdlib/errno.h>
-
-#if defined _ERRNO_H && !defined _ISOMAC && !defined __cplusplus
+#if !defined _ISOMAC && !defined __ASSEMBLER__
# if IS_IN (rtld)
# include <dl-sysdep.h>
@@ -22,33 +20,28 @@
# define errno rtld_errno
extern int rtld_errno attribute_hidden;
-# elif IS_IN_LIB
+# elif IS_IN_LIB && !IS_IN (rtld)
# include <tls.h>
-# if !(defined(__GNU__) && IS_IN (rtld))
-# undef errno
-# if IS_IN (libc)
-# define errno __libc_errno
-# else
-# define errno errno /* For #ifndef errno tests. */
-# endif
-extern __thread int errno attribute_tls_model_ie;
+# undef errno
+# if IS_IN (libc)
+# define errno __libc_errno
+# else
+# define errno errno /* For #ifndef errno tests. */
# endif
+extern __thread int errno attribute_tls_model_ie;
# endif /* IS_IN_LIB */
# define __set_errno(val) (errno = (val))
-# ifndef __ASSEMBLER__
-extern int *__errno_location (void) __THROW __attribute__ ((__const__))
+extern int *__errno_location (void) __THROW __attribute_const__
# if RTLD_PRIVATE_ERRNO
attribute_hidden
# endif
;
libc_hidden_proto (__errno_location)
-# endif
-
-#endif /* _ERRNO_H */
-#endif /* ! _ERRNO_H */
+#endif /* !_ISOMAC && !__ASSEMBLER__ */
+#endif /* !_ERRNO_H */
diff --git a/include/execinfo.h b/include/execinfo.h
index c929821e8c..0b132b089f 100644
--- a/include/execinfo.h
+++ b/include/execinfo.h
@@ -1,6 +1,8 @@
#ifndef _EXECINFO_H
#include <debug/execinfo.h>
+# ifndef _ISOMAC
+
extern int __backtrace (void **__array, int __size);
libc_hidden_proto (__backtrace)
@@ -10,4 +12,5 @@ extern void __backtrace_symbols_fd (void *const *__array, int __size,
int __fd);
libc_hidden_proto (__backtrace_symbols_fd)
+# endif /* !_ISOMAC */
#endif
diff --git a/include/fcntl.h b/include/fcntl.h
index 4168ee429f..be435047bc 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -8,15 +8,18 @@ libc_hidden_proto (__open64)
extern int __libc_open64 (const char *file, int oflag, ...);
extern int __libc_open (const char *file, int oflag, ...);
libc_hidden_proto (__libc_open)
-extern int __libc_fcntl (int fd, int cmd, ...) attribute_hidden;
-#ifndef NO_CANCELLATION
-extern int __fcntl_nocancel (int fd, int cmd, ...) attribute_hidden;
+extern int __libc_fcntl (int fd, int cmd, ...);
libc_hidden_proto (__libc_fcntl)
-#endif
+extern int __fcntl64_nocancel_adjusted (int fd, int cmd, void *arg)
+ attribute_hidden;
+extern int __libc_fcntl64 (int fd, int cmd, ...);
+libc_hidden_proto (__libc_fcntl64)
extern int __open (const char *__file, int __oflag, ...);
libc_hidden_proto (__open)
extern int __fcntl (int __fd, int __cmd, ...);
libc_hidden_proto (__fcntl)
+extern int __fcntl64 (int __fd, int __cmd, ...) attribute_hidden;
+libc_hidden_proto (__fcntl64)
extern int __openat (int __fd, const char *__file, int __oflag, ...)
__nonnull ((2));
libc_hidden_proto (__openat)
@@ -31,16 +34,11 @@ extern int __openat64_2 (int __fd, const char *__path, int __oflag);
#if IS_IN (rtld)
-extern __typeof (__open) __open attribute_hidden;
-extern __typeof (__fcntl) __fcntl attribute_hidden;
+# include <dl-fcntl.h>
#endif
/* Flag determining whether the *at system calls are available. */
extern int __have_atfcts attribute_hidden;
-
-#ifdef O_CLOEXEC
-extern int __have_o_cloexec attribute_hidden;
-#endif
#endif
#endif
diff --git a/include/features.h b/include/features.h
index 9514d35718..5bed0a4996 100644
--- a/include/features.h
+++ b/include/features.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2018 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,6 +24,15 @@
__STRICT_ANSI__ ISO Standard C.
_ISOC99_SOURCE Extensions to ISO C89 from ISO C99.
_ISOC11_SOURCE Extensions to ISO C99 from ISO C11.
+ __STDC_WANT_LIB_EXT2__
+ Extensions to ISO C99 from TR 27431-2:2010.
+ __STDC_WANT_IEC_60559_BFP_EXT__
+ Extensions to ISO C11 from TS 18661-1:2014.
+ __STDC_WANT_IEC_60559_FUNCS_EXT__
+ Extensions to ISO C11 from TS 18661-4:2015.
+ __STDC_WANT_IEC_60559_TYPES_EXT__
+ Extensions to ISO C11 from TS 18661-3:2015.
+
_POSIX_SOURCE IEEE Std 1003.1.
_POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2;
if >=199309L, add IEEE Std 1003.1b-1993;
@@ -41,10 +50,12 @@
_GNU_SOURCE All of the above, plus GNU extensions.
_DEFAULT_SOURCE The default set of features (taking precedence over
__STRICT_ANSI__).
- _REENTRANT Select additionally reentrant object.
- _THREAD_SAFE Same as _REENTRANT, often used by other systems.
- _FORTIFY_SOURCE If set to numeric value > 0 additional security
- measures are defined, according to level.
+
+ _FORTIFY_SOURCE Add security hardening to many library functions.
+ Set to 1 or 2; 2 performs stricter checks than 1.
+
+ _REENTRANT, _THREAD_SAFE
+ Obsolete; equivalent to _POSIX_C_SOURCE=199506L.
The `-ansi' switch to the GNU C compiler, and standards conformance
options such as `-std=c99', define __STRICT_ANSI__. If none of
@@ -58,9 +69,14 @@
These are defined by this file and are used by the
header files to decide what to declare or define:
+ __GLIBC_USE (F) Define things from feature set F. This is defined
+ to 1 or 0; the subsequent macros are either defined
+ or undefined, and those tests should be moved to
+ __GLIBC_USE.
__USE_ISOC11 Define ISO C11 things.
__USE_ISOC99 Define ISO C99 things.
__USE_ISOC95 Define ISO C90 AMD1 (C95) things.
+ __USE_ISOCXX11 Define ISO C++11 things.
__USE_POSIX Define IEEE Std 1003.1 things.
__USE_POSIX2 Define IEEE Std 1003.2 things.
__USE_POSIX199309 Define IEEE Std 1003.1, and .1b things.
@@ -78,7 +94,6 @@
__USE_MISC Define things from 4.3BSD or System V Unix.
__USE_ATFILE Define *at interfaces and AT_* constants for them.
__USE_GNU Define GNU extensions.
- __USE_REENTRANT Define reentrant/thread-safe *_r functions.
__USE_FORTIFY_LEVEL Additional security measures used, according to level.
The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are
@@ -90,7 +105,14 @@
explicitly undefined if they are not explicitly defined.
Feature-test macros that are not defined by the user or compiler
but are implied by the other feature-test macros defined (or by the
- lack of any definitions) are defined by the file. */
+ lack of any definitions) are defined by the file.
+
+ ISO C feature test macros depend on the definition of the macro
+ when an affected header is included, not when the first system
+ header is included, and so they are handled in
+ <bits/libc-header-start.h>, which does not have a multiple include
+ guard. Feature test macros that can be handled from the first
+ system header included are handled here. */
/* Undefine everything, so we get a clean slate. */
@@ -115,9 +137,9 @@
#undef __USE_MISC
#undef __USE_ATFILE
#undef __USE_GNU
-#undef __USE_REENTRANT
#undef __USE_FORTIFY_LEVEL
#undef __KERNEL_STRICT_NAMES
+#undef __GLIBC_USE_DEPRECATED_GETS
/* Suppress kernel-name space pollution unless user expressedly asks
for it. */
@@ -125,13 +147,13 @@
# define __KERNEL_STRICT_NAMES
#endif
-/* Convenience macros to test the versions of glibc and gcc.
- Use them like this:
+/* Convenience macro to test the version of gcc.
+ Use like this:
#if __GNUC_PREREQ (2,8)
... code requiring gcc 2.8 or later ...
#endif
- Note - they won't work for gcc1 or glibc1, since the _MINOR macros
- were not defined then. */
+ Note: only works for GCC 2.0 and later, because __GNUC_MINOR__ was
+ added in 2.0. */
#if defined __GNUC__ && defined __GNUC_MINOR__
# define __GNUC_PREREQ(maj, min) \
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
@@ -139,6 +161,20 @@
# define __GNUC_PREREQ(maj, min) 0
#endif
+/* Similarly for clang. Features added to GCC after version 4.2 may
+ or may not also be available in clang, and clang's definitions of
+ __GNUC(_MINOR)__ are fixed at 4 and 2 respectively. Not all such
+ features can be queried via __has_extension/__has_feature. */
+#if defined __clang_major__ && defined __clang_minor__
+# define __glibc_clang_prereq(maj, min) \
+ ((__clang_major__ << 16) + __clang_minor__ >= ((maj) << 16) + (min))
+#else
+# define __glibc_clang_prereq(maj, min) 0
+#endif
+
+/* Whether to use feature set F. */
+#define __GLIBC_USE(F) __GLIBC_USE_ ## F
+
/* _BSD_SOURCE and _SVID_SOURCE are deprecated aliases for
_DEFAULT_SOURCE. If _DEFAULT_SOURCE is present we do not
issue a warning; the expectation is that the source is being
@@ -178,7 +214,7 @@
define _DEFAULT_SOURCE. */
#if (defined _DEFAULT_SOURCE \
|| (!defined __STRICT_ANSI__ \
- && !defined _ISOC99_SOURCE \
+ && !defined _ISOC99_SOURCE && !defined _ISOC11_SOURCE \
&& !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE \
&& !defined _XOPEN_SOURCE))
# undef _DEFAULT_SOURCE
@@ -203,13 +239,17 @@
# define __USE_ISOC95 1
#endif
+#ifdef __cplusplus
+/* This is to enable compatibility for ISO C++17. */
+# if __cplusplus >= 201703L
+# define __USE_ISOC11 1
+# endif
/* This is to enable compatibility for ISO C++11.
-
- So far g++ does not provide a macro. Check the temporary macro for
- now, too. */
-#if ((defined __cplusplus && __cplusplus >= 201103L) \
- || defined __GXX_EXPERIMENTAL_CXX0X__)
-# define __USE_ISOCXX11 1
+ Check the temporary macro for now, too. */
+# if __cplusplus >= 201103L || defined __GXX_EXPERIMENTAL_CXX0X__
+# define __USE_ISOCXX11 1
+# define __USE_ISOC99 1
+# endif
#endif
/* If none of the ANSI/POSIX macros are defined, or if _DEFAULT_SOURCE
@@ -224,6 +264,7 @@
# undef _POSIX_C_SOURCE
# define _POSIX_C_SOURCE 200809L
#endif
+
#if ((!defined __STRICT_ANSI__ \
|| (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500)) \
&& !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE)
@@ -240,6 +281,19 @@
# define __USE_POSIX_IMPLICITLY 1
#endif
+/* Some C libraries once required _REENTRANT and/or _THREAD_SAFE to be
+ defined in all multithreaded code. GNU libc has not required this
+ for many years. We now treat them as compatibility synonyms for
+ _POSIX_C_SOURCE=199506L, which is the earliest level of POSIX with
+ comprehensive support for multithreaded code. Using them never
+ lowers the selected level of POSIX conformance, only raises it. */
+#if ((!defined _POSIX_C_SOURCE || (_POSIX_C_SOURCE - 0) < 199506L) \
+ && (defined _REENTRANT || defined _THREAD_SAFE))
+# define _POSIX_SOURCE 1
+# undef _POSIX_C_SOURCE
+# define _POSIX_C_SOURCE 199506L
+#endif
+
#if (defined _POSIX_SOURCE \
|| (defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 1) \
|| defined _XOPEN_SOURCE)
@@ -322,10 +376,6 @@
# define __USE_GNU 1
#endif
-#if defined _REENTRANT || defined _THREAD_SAFE
-# define __USE_REENTRANT 1
-#endif
-
#if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0
# if !defined __OPTIMIZE__ || __OPTIMIZE__ <= 0
# warning _FORTIFY_SOURCE requires compiling with optimization (-O)
@@ -341,6 +391,16 @@
# define __USE_FORTIFY_LEVEL 0
#endif
+/* The function 'gets' existed in C89, but is impossible to use
+ safely. It has been removed from ISO C11 and ISO C++14. Note: for
+ compatibility with various implementations of <cstdio>, this test
+ must consider only the value of __cplusplus when compiling C++. */
+#if defined __cplusplus ? __cplusplus >= 201402L : defined __USE_ISOC11
+# define __GLIBC_USE_DEPRECATED_GETS 0
+#else
+# define __GLIBC_USE_DEPRECATED_GETS 1
+#endif
+
/* Get definitions of __STDC_* predefined macros, if the compiler has
not preincluded this header automatically. */
#include <stdc-predef.h>
@@ -357,7 +417,7 @@
/* Major and minor version number of the GNU C library package. Use
these macros to test for features in specific releases. */
#define __GLIBC__ 2
-#define __GLIBC_MINOR__ 23
+#define __GLIBC_MINOR__ 28
#define __GLIBC_PREREQ(maj, min) \
((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))
diff --git a/include/fenv.h b/include/fenv.h
index de4d46f8b7..76679e1e18 100644
--- a/include/fenv.h
+++ b/include/fenv.h
@@ -42,6 +42,21 @@ struct rm_ctx
fenv_t env;
bool updated_status;
};
+
+/* Track whether rounding mode macros were defined, since
+ get-rounding-mode.h may define default versions if they weren't.
+ FE_TONEAREST must always be defined (even if no changes of rounding
+ mode are supported, glibc requires it to be defined to represent
+ the default rounding mode). */
+# ifndef FE_TONEAREST
+# error "FE_TONEAREST not defined"
+# endif
+# if defined FE_DOWNWARD || defined FE_TOWARDZERO || defined FE_UPWARD
+# define FE_HAVE_ROUNDING_MODES 1
+# else
+# define FE_HAVE_ROUNDING_MODES 0
+# endif
+
#endif
#endif
diff --git a/include/float.h b/include/float.h
new file mode 100644
index 0000000000..7e65bb83cb
--- /dev/null
+++ b/include/float.h
@@ -0,0 +1,113 @@
+#ifndef _LIBC_FLOAT_H
+#define _LIBC_FLOAT_H
+
+#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
+#include <bits/libc-header-start.h>
+
+#ifndef _ISOMAC
+# define __STDC_WANT_IEC_60559_TYPES_EXT__
+#endif
+
+#include_next <float.h>
+
+/* Supplement float.h macros for _FloatN and _FloatNx for older
+ compilers which do not yet support the type. These are described
+ in TS 18661-3. */
+#include <features.h>
+#include <bits/floatn.h>
+#if !__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
+
+# if __HAVE_FLOAT128
+# define FLT128_MANT_DIG 113
+# define FLT128_DECIMAL_DIG 36
+# define FLT128_DIG 33
+# define FLT128_MIN_EXP (-16381)
+# define FLT128_MIN_10_EXP (-4931)
+# define FLT128_MAX_EXP 16384
+# define FLT128_MAX_10_EXP 4932
+# define FLT128_MAX \
+ __f128 (1.18973149535723176508575932662800702e+4932)
+# define FLT128_EPSILON \
+ __f128 (1.92592994438723585305597794258492732e-34)
+# define FLT128_MIN \
+ __f128 (3.36210314311209350626267781732175260e-4932)
+# define FLT128_TRUE_MIN \
+ __f128 (6.47517511943802511092443895822764655e-4966)
+# endif
+
+/* Types other than _Float128 are typedefs for other types with old
+ compilers. */
+
+# if __HAVE_FLOAT32
+# define FLT32_MANT_DIG FLT_MANT_DIG
+# define FLT32_DECIMAL_DIG FLT_DECIMAL_DIG
+# define FLT32_DIG FLT_DIG
+# define FLT32_MIN_EXP FLT_MIN_EXP
+# define FLT32_MIN_10_EXP FLT_MIN_10_EXP
+# define FLT32_MAX_EXP FLT_MAX_EXP
+# define FLT32_MAX_10_EXP FLT_MAX_10_EXP
+# define FLT32_MAX FLT_MAX
+# define FLT32_EPSILON FLT_EPSILON
+# define FLT32_MIN FLT_MIN
+# define FLT32_TRUE_MIN FLT_TRUE_MIN
+# endif
+
+# if __HAVE_FLOAT64
+# define FLT64_MANT_DIG DBL_MANT_DIG
+# define FLT64_DECIMAL_DIG DBL_DECIMAL_DIG
+# define FLT64_DIG DBL_DIG
+# define FLT64_MIN_EXP DBL_MIN_EXP
+# define FLT64_MIN_10_EXP DBL_MIN_10_EXP
+# define FLT64_MAX_EXP DBL_MAX_EXP
+# define FLT64_MAX_10_EXP DBL_MAX_10_EXP
+# define FLT64_MAX DBL_MAX
+# define FLT64_EPSILON DBL_EPSILON
+# define FLT64_MIN DBL_MIN
+# define FLT64_TRUE_MIN DBL_TRUE_MIN
+# endif
+
+# if __HAVE_FLOAT32X
+# define FLT32X_MANT_DIG DBL_MANT_DIG
+# define FLT32X_DECIMAL_DIG DBL_DECIMAL_DIG
+# define FLT32X_DIG DBL_DIG
+# define FLT32X_MIN_EXP DBL_MIN_EXP
+# define FLT32X_MIN_10_EXP DBL_MIN_10_EXP
+# define FLT32X_MAX_EXP DBL_MAX_EXP
+# define FLT32X_MAX_10_EXP DBL_MAX_10_EXP
+# define FLT32X_MAX DBL_MAX
+# define FLT32X_EPSILON DBL_EPSILON
+# define FLT32X_MIN DBL_MIN
+# define FLT32X_TRUE_MIN DBL_TRUE_MIN
+# endif
+
+# if __HAVE_FLOAT64X
+# if __HAVE_FLOAT64X_LONG_DOUBLE
+# define FLT64X_MANT_DIG LDBL_MANT_DIG
+# define FLT64X_DECIMAL_DIG LDBL_DECIMAL_DIG
+# define FLT64X_DIG LDBL_DIG
+# define FLT64X_MIN_EXP LDBL_MIN_EXP
+# define FLT64X_MIN_10_EXP LDBL_MIN_10_EXP
+# define FLT64X_MAX_EXP LDBL_MAX_EXP
+# define FLT64X_MAX_10_EXP LDBL_MAX_10_EXP
+# define FLT64X_MAX LDBL_MAX
+# define FLT64X_EPSILON LDBL_EPSILON
+# define FLT64X_MIN LDBL_MIN
+# define FLT64X_TRUE_MIN LDBL_TRUE_MIN
+# else
+# define FLT64X_MANT_DIG FLT128_MANT_DIG
+# define FLT64X_DECIMAL_DIG FLT128_DECIMAL_DIG
+# define FLT64X_DIG FLT128_DIG
+# define FLT64X_MIN_EXP FLT128_MIN_EXP
+# define FLT64X_MIN_10_EXP FLT128_MIN_10_EXP
+# define FLT64X_MAX_EXP FLT128_MAX_EXP
+# define FLT64X_MAX_10_EXP FLT128_MAX_10_EXP
+# define FLT64X_MAX FLT128_MAX
+# define FLT64X_EPSILON FLT128_EPSILON
+# define FLT64X_MIN FLT128_MIN
+# define FLT64X_TRUE_MIN FLT128_TRUE_MIN
+# endif
+# endif
+
+#endif
+
+#endif /* _LIBC_FLOAT_H */
diff --git a/include/fpu_control.h b/include/fpu_control.h
index d0b5e9c0d1..5c6b386278 100644
--- a/include/fpu_control.h
+++ b/include/fpu_control.h
@@ -1,4 +1,10 @@
+#ifndef _FPU_CONTROL_H
#include_next <fpu_control.h>
+# ifndef _ISOMAC
+
/* Called at startup. It can be used to manipulate fpu control register. */
-extern void __setfpucw (fpu_control_t);
+extern void __setfpucw (fpu_control_t) attribute_hidden;
+
+# endif /* !_ISOMAC */
+#endif /* fpu_control.h */
diff --git a/include/getopt.h b/include/getopt.h
index 6f2693d21b..74ca6d453a 100644
--- a/include/getopt.h
+++ b/include/getopt.h
@@ -1,13 +1 @@
-#ifndef _GETOPT_H
-
-#include <features.h> /* Get __GNU_LIBRARY__ defined now. */
#include <posix/getopt.h>
-
-# ifdef _GETOPT_H
-
-/* Now define the internal interfaces. */
-extern void __getopt_clean_environment (char **__env);
-
-# endif
-
-#endif
diff --git a/include/glob.h b/include/glob.h
index 228fe30ca8..1d2f78793e 100644
--- a/include/glob.h
+++ b/include/glob.h
@@ -12,6 +12,7 @@ extern int __glob_pattern_p (const char *__pattern, int __quote);
extern int __glob64 (const char *__pattern, int __flags,
int (*__errfunc) (const char *, int),
glob64_t *__pglob);
+libc_hidden_proto (__glob64)
#endif
#endif
diff --git a/include/gmp.h b/include/gmp.h
index b74167097d..657c7a0148 100644
--- a/include/gmp.h
+++ b/include/gmp.h
@@ -6,22 +6,53 @@
#include <stdlib/gmp.h>
+#include <bits/floatn.h>
+
+#ifndef _ISOMAC
/* Now define the internal interfaces. */
extern mp_size_t __mpn_extract_double (mp_ptr res_ptr, mp_size_t size,
int *expt, int *is_neg,
- double value);
+ double value) attribute_hidden;
extern mp_size_t __mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size,
int *expt, int *is_neg,
- long double value);
+ long double value)
+ attribute_hidden;
+
+#if __HAVE_DISTINCT_FLOAT128
+extern mp_size_t __mpn_extract_float128 (mp_ptr res_ptr, mp_size_t size,
+ int *expt, int *is_neg,
+ _Float128 value)
+ attribute_hidden;
+#endif
-extern float __mpn_construct_float (mp_srcptr frac_ptr, int expt, int sign);
+extern float __mpn_construct_float (mp_srcptr frac_ptr, int expt, int sign)
+ attribute_hidden;
extern double __mpn_construct_double (mp_srcptr frac_ptr, int expt,
- int negative);
+ int negative) attribute_hidden;
extern long double __mpn_construct_long_double (mp_srcptr frac_ptr, int expt,
- int sign);
+ int sign)
+ attribute_hidden;
+#if __HAVE_DISTINCT_FLOAT128
+extern _Float128 __mpn_construct_float128 (mp_srcptr frac_ptr, int expt,
+ int sign) attribute_hidden;
+#endif
+
+extern __typeof (mpn_add_1) mpn_add_1 attribute_hidden;
+extern __typeof (mpn_addmul_1) mpn_addmul_1 attribute_hidden;
+extern __typeof (mpn_add_n) mpn_add_n attribute_hidden;
+extern __typeof (mpn_cmp) mpn_cmp attribute_hidden;
+extern __typeof (mpn_divrem) mpn_divrem attribute_hidden;
+extern __typeof (mpn_lshift) mpn_lshift attribute_hidden;
+extern __typeof (mpn_mul) mpn_mul attribute_hidden;
+extern __typeof (mpn_mul_1) mpn_mul_1 attribute_hidden;
+extern __typeof (mpn_rshift) mpn_rshift attribute_hidden;
+extern __typeof (mpn_sub_1) mpn_sub_1 attribute_hidden;
+extern __typeof (mpn_submul_1) mpn_submul_1 attribute_hidden;
+extern __typeof (mpn_sub_n) mpn_sub_n attribute_hidden;
+#endif
#endif
diff --git a/include/gnu-versions.h b/include/gnu-versions.h
index 141a7116c7..92514d4a2c 100644
--- a/include/gnu-versions.h
+++ b/include/gnu-versions.h
@@ -1,5 +1,5 @@
/* Header with interface version macros for library pieces copied elsewhere.
- Copyright (C) 1995-2016 Free Software Foundation, Inc.
+ Copyright (C) 1995-2018 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
@@ -45,7 +45,7 @@
#define _GNU_OBSTACK_INTERFACE_VERSION 1 /* vs malloc/obstack.c */
#define _GNU_REGEX_INTERFACE_VERSION 1 /* vs posix/regex.c */
-#define _GNU_GLOB_INTERFACE_VERSION 1 /* vs posix/glob.c */
+#define _GNU_GLOB_INTERFACE_VERSION 2 /* vs posix/glob.c */
#define _GNU_GETOPT_INTERFACE_VERSION 2 /* vs posix/getopt.c and
posix/getopt1.c */
diff --git a/include/gnu/libc-version.h b/include/gnu/libc-version.h
index 780612eca3..a066ffcf27 100644
--- a/include/gnu/libc-version.h
+++ b/include/gnu/libc-version.h
@@ -1,5 +1,5 @@
/* Interface to GNU libc specific functions for version information.
- Copyright (C) 1998-2016 Free Software Foundation, Inc.
+ Copyright (C) 1998-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/include/grp-merge.h b/include/grp-merge.h
new file mode 100644
index 0000000000..331ac20ea9
--- /dev/null
+++ b/include/grp-merge.h
@@ -0,0 +1,7 @@
+#ifndef _GRP_MERGE_H
+#include <grp/grp-merge.h>
+
+libc_hidden_proto (__copy_grp)
+libc_hidden_proto (__merge_grp)
+
+#endif /* _GRP_MERGE_H */
diff --git a/include/grp.h b/include/grp.h
index 0fb5c9a574..871701adbe 100644
--- a/include/grp.h
+++ b/include/grp.h
@@ -12,12 +12,12 @@ extern int __old_getgrent_r (struct group *__resultbuf, char *buffer,
size_t __buflen, struct group **__result);
extern int __fgetgrent_r (FILE * __stream, struct group *__resultbuf,
char *buffer, size_t __buflen,
- struct group **__result);
+ struct group **__result) attribute_hidden;
/* Search for an entry with a matching group ID. */
extern int __getgrgid_r (__gid_t __gid, struct group *__resultbuf,
char *__buffer, size_t __buflen,
- struct group **__result);
+ struct group **__result) attribute_hidden;
extern int __old_getgrgid_r (__gid_t __gid, struct group *__resultbuf,
char *__buffer, size_t __buflen,
struct group **__result);
@@ -25,7 +25,7 @@ extern int __old_getgrgid_r (__gid_t __gid, struct group *__resultbuf,
/* Search for an entry with a matching group name. */
extern int __getgrnam_r (const char *__name, struct group *__resultbuf,
char *__buffer, size_t __buflen,
- struct group **__result);
+ struct group **__result) attribute_hidden;
extern int __old_getgrnam_r (const char *__name, struct group *__resultbuf,
char *__buffer, size_t __buflen,
struct group **__result);
diff --git a/include/gshadow.h b/include/gshadow.h
index 8a981f688a..aa6a5a693e 100644
--- a/include/gshadow.h
+++ b/include/gshadow.h
@@ -1,10 +1,14 @@
#ifndef _GSHADOW_H
#include <gshadow/gshadow.h>
+# ifndef _ISOMAC
+
extern int __fgetsgent_r (FILE *stream, struct sgrp *resbuf, char *buffer,
- size_t buflen, struct sgrp **result);
+ size_t buflen, struct sgrp **result)
+ attribute_hidden;
extern int __sgetsgent_r (const char *string, struct sgrp *resbuf,
- char *buffer, size_t buflen, struct sgrp **result);
+ char *buffer, size_t buflen, struct sgrp **result)
+ attribute_hidden;
struct parser_data;
extern int _nss_files_parse_sgent (char *line, struct sgrp *result,
@@ -12,4 +16,5 @@ extern int _nss_files_parse_sgent (char *line, struct sgrp *result,
size_t datalen, int *errnop);
libc_hidden_proto (_nss_files_parse_sgent)
+# endif /* !_ISOMAC */
#endif
diff --git a/include/ifaddrs.h b/include/ifaddrs.h
index 2787f21115..416118f1b3 100644
--- a/include/ifaddrs.h
+++ b/include/ifaddrs.h
@@ -1,11 +1,19 @@
#ifndef _IFADDRS_H
#include <inet/ifaddrs.h>
+
+# ifndef _ISOMAC
+
#include <stdbool.h>
#include <stdint.h>
libc_hidden_proto (getifaddrs)
libc_hidden_proto (freeifaddrs)
+extern int __getifaddrs (struct ifaddrs **__ifap);
+libc_hidden_proto (__getifaddrs)
+extern void __freeifaddrs (struct ifaddrs *__ifa);
+libc_hidden_proto (__freeifaddrs)
+
struct in6addrinfo
{
enum {
@@ -30,4 +38,5 @@ extern void __check_native (uint32_t a1_index, int *a1_native,
extern uint32_t __bump_nl_timestamp (void) attribute_hidden;
#endif
+# endif /* !_ISOMAC */
#endif /* ifaddrs.h */
diff --git a/include/ifreq.h b/include/ifreq.h
new file mode 100644
index 0000000000..94e984c73c
--- /dev/null
+++ b/include/ifreq.h
@@ -0,0 +1,14 @@
+#include_next <ifreq.h>
+
+static inline struct ifreq *
+__if_nextreq (struct ifreq *ifr)
+{
+#ifdef _HAVE_SA_LEN
+ if (ifr->ifr_addr.sa_len > sizeof ifr->ifr_addr)
+ return (struct ifreq *) ((char *) &ifr->ifr_addr + ifr->ifr_addr.sa_len);
+#endif
+ return ifr + 1;
+}
+
+extern void __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd)
+ attribute_hidden;
diff --git a/include/ifunc-impl-list.h b/include/ifunc-impl-list.h
index 739d628f78..b437611ccc 100644
--- a/include/ifunc-impl-list.h
+++ b/include/ifunc-impl-list.h
@@ -1,5 +1,5 @@
/* Internal header file for __libc_supported_implementations.
- Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ Copyright (C) 2012-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/include/inline-hashtab.h b/include/inline-hashtab.h
index f7a003f9ae..ad73650ecc 100644
--- a/include/inline-hashtab.h
+++ b/include/inline-hashtab.h
@@ -1,5 +1,5 @@
/* Fully-inline hash table, used mainly for managing TLS descriptors.
- Copyright (C) 1999-2016 Free Software Foundation, Inc.
+ Copyright (C) 1999-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Alexandre Oliva <aoliva@redhat.com>
diff --git a/include/inttypes.h b/include/inttypes.h
new file mode 100644
index 0000000000..33219e2a9f
--- /dev/null
+++ b/include/inttypes.h
@@ -0,0 +1,6 @@
+#ifndef _INTTYPES_H
+#include_next <inttypes.h>
+#ifndef _ISOMAC
+libc_hidden_proto (strtoumax)
+#endif
+#endif
diff --git a/include/libc-diag.h b/include/libc-diag.h
new file mode 100644
index 0000000000..7631762786
--- /dev/null
+++ b/include/libc-diag.h
@@ -0,0 +1,74 @@
+/* Macros for controlling diagnostic output from the compiler.
+ Copyright (C) 2014-2018 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/>. */
+
+#ifndef _LIBC_DIAG_H
+#define _LIBC_DIAG_H 1
+
+/* Ignore the value of an expression when a cast to void does not
+ suffice (in particular, for a call to a function declared with
+ attribute warn_unused_result). */
+#define ignore_value(x) \
+ ({ __typeof__ (x) __ignored_value = (x); (void) __ignored_value; })
+
+/* The macros to control diagnostics are structured like this, rather
+ than a single macro that both pushes and pops diagnostic state and
+ takes the affected code as an argument, because the GCC pragmas
+ work by disabling the diagnostic for a range of source locations
+ and do not work when all the pragmas and the affected code are in a
+ single macro expansion. */
+
+/* Push diagnostic state. */
+#define DIAG_PUSH_NEEDS_COMMENT _Pragma ("GCC diagnostic push")
+
+/* Pop diagnostic state. */
+#define DIAG_POP_NEEDS_COMMENT _Pragma ("GCC diagnostic pop")
+
+#define _DIAG_STR1(s) #s
+#define _DIAG_STR(s) _DIAG_STR1(s)
+
+/* Ignore the diagnostic OPTION. VERSION is the most recent GCC
+ version for which the diagnostic has been confirmed to appear in
+ the absence of the pragma (in the form MAJOR.MINOR for GCC 4.x,
+ just MAJOR for GCC 5 and later). Uses of this pragma should be
+ reviewed when the GCC version given is no longer supported for
+ building glibc; the version number should always be on the same
+ source line as the macro name, so such uses can be found with grep.
+ Uses should come with a comment giving more details of the
+ diagnostic, and an architecture on which it is seen if possibly
+ optimization-related and not in architecture-specific code. This
+ macro should only be used if the diagnostic seems hard to fix (for
+ example, optimization-related false positives). */
+#define DIAG_IGNORE_NEEDS_COMMENT(version, option) \
+ _Pragma (_DIAG_STR (GCC diagnostic ignored option))
+
+/* Similar to DIAG_IGNORE_NEEDS_COMMENT the following macro ignores the
+ diagnostic OPTION but only if optimizations for size are enabled.
+ This is required because different warnings may be generated for
+ different optimization levels. For example a key piece of code may
+ only generate a warning when compiled at -Os, but at -O2 you could
+ still want the warning to be enabled to catch errors. In this case
+ you would use DIAG_IGNORE_Os_NEEDS_COMMENT to disable the warning
+ only for -Os. */
+#ifdef __OPTIMIZE_SIZE__
+# define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option) \
+ _Pragma (_DIAG_STR (GCC diagnostic ignored option))
+#else
+# define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option)
+#endif
+
+#endif /* libc-diag.h */
diff --git a/include/libc-internal.h b/include/libc-internal.h
index 7a185bbdc7..2167990c52 100644
--- a/include/libc-internal.h
+++ b/include/libc-internal.h
@@ -1,5 +1,20 @@
-/* This file contains a number of internal prototype declarations that
- don't fit anywhere else. */
+/* Internal prototype declarations that don't fit anywhere else.
+ Copyright (C) 2000-2018 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/>. */
#ifndef _LIBC_INTERNAL
# define _LIBC_INTERNAL 1
@@ -32,83 +47,12 @@ libc_hidden_proto (__libc_freeres)
extern void __libc_thread_freeres (void);
/* Define and initialize `__progname' et. al. */
-extern void __init_misc (int, char **, char **);
+extern void __init_misc (int, char **, char **) attribute_hidden;
-# if IS_IN (rtld)
+# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
extern __typeof (__profile_frequency) __profile_frequency attribute_hidden;
# endif
-/* 1 if 'type' is a pointer type, 0 otherwise. */
-# define __pointer_type(type) (__builtin_classify_type ((type) 0) == 5)
-
-/* __intptr_t if P is true, or T if P is false. */
-# define __integer_if_pointer_type_sub(T, P) \
- __typeof__ (*(0 ? (__typeof__ (0 ? (T *) 0 : (void *) (P))) 0 \
- : (__typeof__ (0 ? (__intptr_t *) 0 : (void *) (!(P)))) 0))
-
-/* __intptr_t if EXPR has a pointer type, or the type of EXPR otherwise. */
-# define __integer_if_pointer_type(expr) \
- __integer_if_pointer_type_sub(__typeof__ ((__typeof__ (expr)) 0), \
- __pointer_type (__typeof__ (expr)))
-
-/* Cast an integer or a pointer VAL to integer with proper type. */
-# define cast_to_integer(val) ((__integer_if_pointer_type (val)) (val))
-
-/* Align a value by rounding down to closest size.
- e.g. Using size of 4096, we get this behavior:
- {4095, 4096, 4097} = {0, 4096, 4096}. */
-#define ALIGN_DOWN(base, size) ((base) & -((__typeof__ (base)) (size)))
-
-/* Align a value by rounding up to closest size.
- e.g. Using size of 4096, we get this behavior:
- {4095, 4096, 4097} = {4096, 4096, 8192}.
-
- Note: The size argument has side effects (expanded multiple times). */
-#define ALIGN_UP(base, size) ALIGN_DOWN ((base) + (size) - 1, (size))
-
-/* Same as ALIGN_DOWN(), but automatically casts when base is a pointer. */
-#define PTR_ALIGN_DOWN(base, size) \
- ((__typeof__ (base)) ALIGN_DOWN ((uintptr_t) (base), (size)))
-
-/* Same as ALIGN_UP(), but automatically casts when base is a pointer. */
-#define PTR_ALIGN_UP(base, size) \
- ((__typeof__ (base)) ALIGN_UP ((uintptr_t) (base), (size)))
-
-/* Ignore the value of an expression when a cast to void does not
- suffice (in particular, for a call to a function declared with
- attribute warn_unused_result). */
-#define ignore_value(x) \
- ({ __typeof__ (x) __ignored_value = (x); (void) __ignored_value; })
-
-/* The macros to control diagnostics are structured like this, rather
- than a single macro that both pushes and pops diagnostic state and
- takes the affected code as an argument, because the GCC pragmas
- work by disabling the diagnostic for a range of source locations
- and do not work when all the pragmas and the affected code are in a
- single macro expansion. */
-
-/* Push diagnostic state. */
-#define DIAG_PUSH_NEEDS_COMMENT _Pragma ("GCC diagnostic push")
-
-/* Pop diagnostic state. */
-#define DIAG_POP_NEEDS_COMMENT _Pragma ("GCC diagnostic pop")
-
-#define _DIAG_STR1(s) #s
-#define _DIAG_STR(s) _DIAG_STR1(s)
-
-/* Ignore the diagnostic OPTION. VERSION is the most recent GCC
- version for which the diagnostic has been confirmed to appear in
- the absence of the pragma (in the form MAJOR.MINOR for GCC 4.x,
- just MAJOR for GCC 5 and later). Uses of this pragma should be
- reviewed when the GCC version given is no longer supported for
- building glibc; the version number should always be on the same
- source line as the macro name, so such uses can be found with grep.
- Uses should come with a comment giving more details of the
- diagnostic, and an architecture on which it is seen if possibly
- optimization-related and not in architecture-specific code. This
- macro should only be used if the diagnostic seems hard to fix (for
- example, optimization-related false positives). */
-#define DIAG_IGNORE_NEEDS_COMMENT(version, option) \
- _Pragma (_DIAG_STR (GCC diagnostic ignored option))
+extern int __libc_multiple_libcs attribute_hidden;
#endif /* _LIBC_INTERNAL */
diff --git a/include/libc-pointer-arith.h b/include/libc-pointer-arith.h
new file mode 100644
index 0000000000..1ee3362451
--- /dev/null
+++ b/include/libc-pointer-arith.h
@@ -0,0 +1,60 @@
+/* Helper macros for pointer arithmetic.
+ Copyright (C) 2012-2018 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/>. */
+
+#ifndef _LIBC_POINTER_ARITH_H
+#define _LIBC_POINTER_ARITH_H 1
+
+#include <stdint.h>
+
+/* 1 if 'type' is a pointer type, 0 otherwise. */
+# define __pointer_type(type) (__builtin_classify_type ((type) 0) == 5)
+
+/* intptr_t if P is true, or T if P is false. */
+# define __integer_if_pointer_type_sub(T, P) \
+ __typeof__ (*(0 ? (__typeof__ (0 ? (T *) 0 : (void *) (P))) 0 \
+ : (__typeof__ (0 ? (intptr_t *) 0 : (void *) (!(P)))) 0))
+
+/* intptr_t if EXPR has a pointer type, or the type of EXPR otherwise. */
+# define __integer_if_pointer_type(expr) \
+ __integer_if_pointer_type_sub(__typeof__ ((__typeof__ (expr)) 0), \
+ __pointer_type (__typeof__ (expr)))
+
+/* Cast an integer or a pointer VAL to integer with proper type. */
+# define cast_to_integer(val) ((__integer_if_pointer_type (val)) (val))
+
+/* Align a value by rounding down to closest size.
+ e.g. Using size of 4096, we get this behavior:
+ {4095, 4096, 4097} = {0, 4096, 4096}. */
+#define ALIGN_DOWN(base, size) ((base) & -((__typeof__ (base)) (size)))
+
+/* Align a value by rounding up to closest size.
+ e.g. Using size of 4096, we get this behavior:
+ {4095, 4096, 4097} = {4096, 4096, 8192}.
+
+ Note: The size argument has side effects (expanded multiple times). */
+#define ALIGN_UP(base, size) ALIGN_DOWN ((base) + (size) - 1, (size))
+
+/* Same as ALIGN_DOWN(), but automatically casts when base is a pointer. */
+#define PTR_ALIGN_DOWN(base, size) \
+ ((__typeof__ (base)) ALIGN_DOWN ((uintptr_t) (base), (size)))
+
+/* Same as ALIGN_UP(), but automatically casts when base is a pointer. */
+#define PTR_ALIGN_UP(base, size) \
+ ((__typeof__ (base)) ALIGN_UP ((uintptr_t) (base), (size)))
+
+#endif
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 4548e097dc..8b9273c13a 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -1,6 +1,6 @@
/* Support macros for making weak and strong aliases for symbols,
and for using symbol sets and linker warnings with GNU ld.
- Copyright (C) 1995-2016 Free Software Foundation, Inc.
+ Copyright (C) 1995-2018 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,26 +20,46 @@
#ifndef _LIBC_SYMBOLS_H
#define _LIBC_SYMBOLS_H 1
-#define IN_MODULE PASTE_NAME (MODULE_, MODULE_NAME)
-#define IS_IN(lib) (IN_MODULE == MODULE_##lib)
+/* This file is included implicitly in the compilation of every source file,
+ using -include. It includes config.h. */
-/* Returns true if the current module is a versioned library. Versioned
- library names culled from shlib-versions files are assigned a MODULE_*
- value lower than MODULE_LIBS_BEGIN. */
-#define IS_IN_LIB (IN_MODULE > MODULE_LIBS_BEGIN)
-
-#define PASTE_NAME(a,b) PASTE_NAME1 (a,b)
-#define PASTE_NAME1(a,b) a##b
-
-/* This file's macros are included implicitly in the compilation of every
- file in the C library by -imacros.
-
- We include config.h which is generated by configure.
- It should define for us the following symbol:
+/* Enable declarations of GNU extensions, since we are compiling them. */
+#define _GNU_SOURCE 1
+
+#ifdef MODULE_NAME
+
+/* Use `#if IS_IN (module)` to detect what component is being compiled. */
+#define PASTE_NAME1(a,b) a##b
+#define PASTE_NAME(a,b) PASTE_NAME1 (a,b)
+#define IN_MODULE PASTE_NAME (MODULE_, MODULE_NAME)
+#define IS_IN(lib) (IN_MODULE == MODULE_##lib)
+
+/* True if the current module is a versioned library. Versioned
+ library names culled from shlib-versions files are assigned a
+ MODULE_* value greater than MODULE_LIBS_BEGIN. */
+#define IS_IN_LIB (IN_MODULE > MODULE_LIBS_BEGIN)
+
+/* The testsuite, and some other ancillary code, should be compiled against
+ as close an approximation to the installed headers as possible.
+ Defining this symbol disables most internal-use-only declarations
+ provided by this header, and all those provided by other internal
+ wrapper headers. */
+#if IS_IN (testsuite) || defined IS_IN_build || defined __cplusplus
+# define _ISOMAC 1
+#endif
- * HAVE_ASM_SET_DIRECTIVE if we have `.set B, A' instead of `A = B'.
+#else
+/* The generation process for a few files created very early in the
+ build (notably libc-modules.h itself) involves preprocessing this
+ header without defining MODULE_NAME. Under these conditions,
+ internal declarations (especially from config.h) must be visible,
+ but IS_IN should always evaluate as false. */
+# define IS_IN(lib) 0
+# define IS_IN_LIB 0
+# define IN_MODULE (-1)
+#endif
- */
+#ifndef _ISOMAC
/* This is defined for the compilation of all C library code. features.h
tests this to avoid inclusion of stubs.h while compiling the library,
@@ -50,13 +70,28 @@
itself is being compiled, or just some generator program. */
#define _LIBC 1
-/* Enable declarations of GNU extensions, since we are compiling them. */
-#define _GNU_SOURCE 1
-/* And we also need the data for the reentrant functions. */
-#define _REENTRANT 1
+/* Some files must be compiled with optimization on. */
+#if !defined __ASSEMBLER__ && !defined __OPTIMIZE__
+# error "glibc cannot be compiled without optimization"
+#endif
+
+/* -ffast-math cannot be applied to the C library, as it alters the ABI.
+ Some test components that use -ffast-math are currently not part of
+ IS_IN (testsuite) for technical reasons, so we have a secondary override. */
+#if defined __FAST_MATH__ && !defined TEST_FAST_MATH
+# error "glibc must not be compiled with -ffast-math"
+#endif
#include <config.h>
+/* When PIC is defined and SHARED isn't defined, we are building PIE
+ by default. */
+#if defined PIC && !defined SHARED
+# define BUILD_PIE_DEFAULT 1
+#else
+# define BUILD_PIE_DEFAULT 0
+#endif
+
/* Define this for the benefit of portable GNU code that wants to check it.
Code that checks with #if will not #include <config.h> again, since we've
already done it (and this file is implicitly included in every compile,
@@ -121,6 +156,21 @@
# define weak_extern(symbol) _weak_extern (weak symbol)
# define _weak_extern(expr) _Pragma (#expr)
+/* In shared builds, the expression call_function_static_weak
+ (FUNCTION-SYMBOL, ARGUMENTS) invokes FUNCTION-SYMBOL (an
+ identifier) unconditionally, with the (potentially empty) argument
+ list ARGUMENTS. In static builds, if FUNCTION-SYMBOL has a
+ definition, the function is invoked as before; if FUNCTION-SYMBOL
+ is NULL, no call is performed. */
+# ifdef SHARED
+# define call_function_static_weak(func, ...) func (__VA_ARGS__)
+# else /* !SHARED */
+# define call_function_static_weak(func, ...) \
+ ({ \
+ extern __typeof__ (func) func weak_function; \
+ (func != NULL ? func (__VA_ARGS__) : (void)0); \
+ })
+# endif
#else /* __ASSEMBLER__ */
@@ -145,13 +195,6 @@
#endif /* __ASSEMBLER__ */
-/* On some platforms we can make internal function calls (i.e., calls of
- functions not exported) a bit faster by using a different calling
- convention. */
-#ifndef internal_function
-# define internal_function /* empty */
-#endif
-
/* Determine the return address. */
#define RETURN_ADDRESS(nr) \
__builtin_extract_return_addr (__builtin_return_address (nr))
@@ -174,16 +217,6 @@
static const char __evoke_link_warning_##symbol[] \
__attribute__ ((used, section (".gnu.warning." #symbol __sec_comment))) \
= msg;
-#define libc_freeres_ptr(decl) \
- __make_section_unallocated ("__libc_freeres_ptrs, \"aw\", %nobits") \
- decl __attribute__ ((section ("__libc_freeres_ptrs" __sec_comment)))
-#define __libc_freeres_fn_section \
- __attribute__ ((section ("__libc_freeres_fn")))
-
-#define libc_freeres_fn(name) \
- static void name (void) __attribute_used__ __libc_freeres_fn_section; \
- text_set_element (__libc_subfreeres, name); \
- static void name (void)
/* A canned warning for sysdeps/stub functions. */
#define stub_warning(name) \
@@ -201,6 +234,79 @@ requires at runtime the shared libraries from the glibc version used \
for linking")
#endif
+/* Resource Freeing Hooks:
+
+ Normally a process exits and the OS cleans up any allocated
+ memory. However, when tooling like mtrace or valgrind is monitoring
+ the process we need to free all resources that are part of the
+ process in order to provide the consistency required to track
+ memory leaks.
+
+ A single public API exists and is __libc_freeres(), and this is used
+ by applications like valgrind to freee resouces.
+
+ There are 3 cases:
+
+ (a) __libc_freeres
+
+ In this case all you need to do is define the freeing routine:
+
+ foo.c:
+ libfoo_freeres_fn (foo_freeres)
+ {
+ complex_free (mem);
+ }
+
+ This ensures the function is called at the right point to free
+ resources.
+
+ (b) __libc_freeres_ptr
+
+ The framework for (a) iterates over the list of pointers-to-free
+ in (b) and frees them.
+
+ foo.c:
+ libc_freeres_ptr (static char *foo_buffer);
+
+ Freeing these resources alaways happens last and is equivalent
+ to registering a function that does 'free (foo_buffer)'.
+
+ (c) Explicit lists of free routines to call or objects to free.
+
+ It is the intended goal to remove (a) and (b) which have some
+ non-determinism based on link order, and instead use explicit
+ lists of functions and frees to resolve cleanup ordering issues
+ and make it easy to debug and maintain.
+
+ As of today the following subsystems use (c):
+
+ Per-thread cleanup:
+ * malloc/thread-freeres.c
+
+ libdl cleanup:
+ * dlfcn/dlfreeres.c
+
+ libpthread cleanup:
+ * nptl/nptlfreeres.c
+
+ So if you need any shutdown routines to run you should add them
+ directly to the appropriate subsystem's shutdown list. */
+
+/* Resource pointers to free in libc.so. */
+#define libc_freeres_ptr(decl) \
+ __make_section_unallocated ("__libc_freeres_ptrs, \"aw\", %nobits") \
+ decl __attribute__ ((section ("__libc_freeres_ptrs" __sec_comment)))
+
+/* Resource freeing functions from libc.so go in this section. */
+#define __libc_freeres_fn_section \
+ __attribute__ ((section ("__libc_freeres_fn")))
+
+/* Resource freeing functions for libc.so. */
+#define libc_freeres_fn(name) \
+ static void name (void) __attribute_used__ __libc_freeres_fn_section; \
+ text_set_element (__libc_subfreeres, name); \
+ static void name (void)
+
/* Declare SYMBOL to be TYPE (`function' or `object') of SIZE bytes
alias to ORIGINAL, when the assembler supports such declarations
(such as in ELF).
@@ -282,19 +388,28 @@ for linking")
past the last element in SET. */
#define symbol_set_end_p(set, ptr) ((ptr) >= (void *const *) &__stop_##set)
+/* Use symbol_version_reference to specify the version a symbol
+ reference should link to. Use symbol_version or
+ default_symbol_version for the definition of a versioned symbol.
+ The difference is that the latter is a no-op in non-shared
+ builds. */
+#ifdef __ASSEMBLER__
+# define symbol_version_reference(real, name, version) \
+ .symver real, name##@##version
+#else /* !__ASSEMBLER__ */
+# define symbol_version_reference(real, name, version) \
+ __asm__ (".symver " #real "," #name "@" #version)
+#endif
+
#ifdef SHARED
# define symbol_version(real, name, version) \
- _symbol_version(real, name, version)
+ symbol_version_reference(real, name, version)
# define default_symbol_version(real, name, version) \
_default_symbol_version(real, name, version)
# ifdef __ASSEMBLER__
-# define _symbol_version(real, name, version) \
- .symver real, name##@##version
# define _default_symbol_version(real, name, version) \
.symver real, name##@##@##version
# else
-# define _symbol_version(real, name, version) \
- __asm__ (".symver " #real "," #name "@" #version)
# define _default_symbol_version(real, name, version) \
__asm__ (".symver " #real "," #name "@@" #version)
# endif
@@ -304,7 +419,8 @@ for linking")
strong_alias(real, name)
#endif
-#if defined SHARED || defined LIBC_NONSHARED
+#if defined SHARED || defined LIBC_NONSHARED \
+ || (BUILD_PIE_DEFAULT && IS_IN (libc))
# define attribute_hidden __attribute__ ((visibility ("hidden")))
#else
# define attribute_hidden
@@ -314,6 +430,16 @@ for linking")
#define attribute_relro __attribute__ ((section (".data.rel.ro")))
+
+/* Used to disable stack protection in sensitive places, like ifunc
+ resolvers and early static TLS init. */
+#ifdef HAVE_CC_NO_STACK_PROTECTOR
+# define inhibit_stack_protector \
+ __attribute__ ((__optimize__ ("-fno-stack-protector")))
+#else
+# define inhibit_stack_protector
+#endif
+
/* The following macros are used for PLT bypassing within libc.so
(and if needed other libraries similarly).
First of all, you need to have the function prototyped somewhere,
@@ -443,8 +569,21 @@ for linking")
# endif
#else
# ifndef __ASSEMBLER__
-# define hidden_proto(name, attrs...)
-# define hidden_tls_proto(name, attrs...)
+# if !defined SHARED && IS_IN (libc) && !defined LIBC_NONSHARED \
+ && (!defined PIC || !defined NO_HIDDEN_EXTERN_FUNC_IN_PIE) \
+ && !defined NO_HIDDEN
+# define __hidden_proto_hiddenattr(attrs...) \
+ __attribute__ ((visibility ("hidden"), ##attrs))
+# define hidden_proto(name, attrs...) \
+ __hidden_proto (name, , name, ##attrs)
+# define hidden_tls_proto(name, attrs...) \
+ __hidden_proto (name, __thread, name, ##attrs)
+# define __hidden_proto(name, thread, internal, attrs...) \
+ extern thread __typeof (name) name __hidden_proto_hiddenattr (attrs);
+# else
+# define hidden_proto(name, attrs...)
+# define hidden_tls_proto(name, attrs...)
+# endif
# else
# define HIDDEN_JUMPTARGET(name) JUMPTARGET(name)
# endif /* Not __ASSEMBLER__ */
@@ -483,7 +622,7 @@ for linking")
# define libc_hidden_data_ver(local, name)
#endif
-#if IS_IN (rtld)
+#if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
# define rtld_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define rtld_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
# define rtld_hidden_def(name) hidden_def (name)
@@ -631,6 +770,12 @@ for linking")
# define libnsl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define libnsl_hidden_tls_proto(name, attrs...) \
hidden_tls_proto (name, ##attrs)
+# ifdef LINK_OBSOLETE_NSL
+ /* libnsl_hidden_nolink should only get used in libnsl code. */
+# define libnsl_hidden_nolink_def(name, version) libnsl_hidden_def (name)
+# else
+# define libnsl_hidden_nolink_def(name, version) hidden_nolink (name, libnsl, version)
+# endif
# define libnsl_hidden_def(name) hidden_def (name)
# define libnsl_hidden_weak(name) hidden_weak (name)
# define libnsl_hidden_ver(local, name) hidden_ver (local, name)
@@ -713,42 +858,138 @@ for linking")
# define compat_data_section .section ".data.compat", "aw";
#endif
-/* Marker used for indirection function symbols. */
-#define libc_ifunc(name, expr) \
- extern void *name##_ifunc (void) __asm__ (#name); \
- void *name##_ifunc (void) \
+/* Helper / base macros for indirect function symbols. */
+#define __ifunc_resolver(type_name, name, expr, arg, init, classifier) \
+ classifier inhibit_stack_protector \
+ __typeof (type_name) *name##_ifunc (arg) \
{ \
- INIT_ARCH (); \
- __typeof (name) *res = expr; \
+ init (); \
+ __typeof (type_name) *res = expr; \
return res; \
- } \
- __asm__ (".type " #name ", %gnu_indirect_function");
+ }
-/* The body of the function is supposed to use __get_cpu_features
- which will, if necessary, initialize the data first. */
-#define libm_ifunc(name, expr) \
- extern void *name##_ifunc (void) __asm__ (#name); \
- void *name##_ifunc (void) \
- { \
- __typeof (name) *res = expr; \
- return res; \
- } \
- __asm__ (".type " #name ", %gnu_indirect_function");
-
-#ifdef HAVE_ASM_SET_DIRECTIVE
-# define libc_ifunc_hidden_def1(local, name) \
- __asm__ (".globl " #local "\n\t" \
- ".hidden " #local "\n\t" \
- ".set " #local ", " #name);
+#ifdef HAVE_GCC_IFUNC
+# define __ifunc(type_name, name, expr, arg, init) \
+ extern __typeof (type_name) name __attribute__ \
+ ((ifunc (#name "_ifunc"))); \
+ __ifunc_resolver (type_name, name, expr, arg, init, static)
+
+# define __ifunc_hidden(type_name, name, expr, arg, init) \
+ __ifunc (type_name, name, expr, arg, init)
#else
-# define libc_ifunc_hidden_def1(local, name) \
- __asm__ (".globl " #local "\n\t" \
- ".hidden " #local "\n\t" \
- #local " = " #name);
-#endif
+/* Gcc does not support __attribute__ ((ifunc (...))). Use the old behaviour
+ as fallback. But keep in mind that the debug information for the ifunc
+ resolver functions is not correct. It contains the ifunc'ed function as
+ DW_AT_linkage_name. E.g. lldb uses this field and an inferior function
+ call of the ifunc'ed function will fail due to "no matching function for
+ call to ..." because the ifunc'ed function and the resolver function have
+ different signatures. (Gcc support is disabled at least on a ppc64le
+ Ubuntu 14.04 system.) */
+
+# define __ifunc(type_name, name, expr, arg, init) \
+ extern __typeof (type_name) name; \
+ __typeof (type_name) *name##_ifunc (arg) __asm__ (#name); \
+ __ifunc_resolver (type_name, name, expr, arg, init,) \
+ __asm__ (".type " #name ", %gnu_indirect_function");
+
+# define __ifunc_hidden(type_name, name, expr, arg, init) \
+ extern __typeof (type_name) __libc_##name; \
+ __ifunc (type_name, __libc_##name, expr, arg, init) \
+ strong_alias (__libc_##name, name);
+#endif /* !HAVE_GCC_IFUNC */
+
+/* The following macros are used for indirect function symbols in libc.so.
+ First of all, you need to have the function prototyped somewhere,
+ say in foo.h:
+
+ int foo (int __bar);
+
+ If you have an implementation for foo which e.g. uses a special hardware
+ feature which isn't available on all machines where this libc.so will be
+ used but decideable if available at runtime e.g. via hwcaps, you can provide
+ two or multiple implementations of foo:
+
+ int __foo_default (int __bar)
+ {
+ return __bar;
+ }
+
+ int __foo_special (int __bar)
+ {
+ return __bar;
+ }
+
+ If your function foo has no libc_hidden_proto (foo) defined for PLT
+ bypassing, you can use:
+
+ #define INIT_ARCH() unsigned long int hwcap = __GLRO(dl_hwcap);
+
+ libc_ifunc (foo, (hwcap & HWCAP_SPECIAL) ? __foo_special : __foo_default);
+
+ This will define a resolver function for foo which returns __foo_special or
+ __foo_default depending on your specified expression. Please note that you
+ have to define a macro function INIT_ARCH before using libc_ifunc macro as
+ it is called by the resolver function before evaluating the specified
+ expression. In this example it is used to prepare the hwcap variable.
+ The resolver function is assigned to an ifunc'ed symbol foo. Calls to foo
+ from inside or outside of libc.so will be indirected by a PLT call.
-#define libc_ifunc_hidden_def(name) \
- libc_ifunc_hidden_def1 (__GI_##name, name)
+ If your function foo has a libc_hidden_proto (foo) defined for PLT bypassing
+ and calls to foo within libc.so should always go to one specific
+ implementation of foo e.g. __foo_default then you have to add:
+
+ __hidden_ver1 (__foo_default, __GI_foo, __foo_default);
+
+ or a tweaked definition of libc_hidden_def macro after the __foo_default
+ function definition. Calls to foo within libc.so will always go directly to
+ __foo_default. Calls to foo from outside libc.so will be indirected by a
+ PLT call to ifunc'ed symbol foo which you have to define in a separate
+ compile unit:
+
+ #define foo __redirect_foo
+ #include <foo.h>
+ #undef foo
+
+ extern __typeof (__redirect_foo) __foo_default attribute_hidden;
+ extern __typeof (__redirect_foo) __foo_special attribute_hidden;
+
+ libc_ifunc_redirected (__redirect_foo, foo,
+ (hwcap & HWCAP_SPECIAL)
+ ? __foo_special
+ : __foo_default);
+
+ This will define the ifunc'ed symbol foo like above. The redirection of foo
+ in header file is needed to omit an additional defintion of __GI_foo which
+ would end in a linker error while linking libc.so. You have to specify
+ __redirect_foo as first parameter which is used within libc_ifunc_redirected
+ macro in conjunction with typeof to define the ifunc'ed symbol foo.
+
+ If your function foo has a libc_hidden_proto (foo) defined and calls to foo
+ within or from outside libc.so should go via ifunc'ed symbol, then you have
+ to use:
+
+ libc_ifunc_hidden (foo, foo,
+ (hwcap & HWCAP_SPECIAL)
+ ? __foo_special
+ : __foo_default);
+ libc_hidden_def (foo)
+
+ The first parameter foo of libc_ifunc_hidden macro is used in the same way
+ as for libc_ifunc_redirected macro. */
+
+#define libc_ifunc(name, expr) __ifunc (name, name, expr, void, INIT_ARCH)
+
+#define libc_ifunc_redirected(redirected_name, name, expr) \
+ __ifunc (redirected_name, name, expr, void, INIT_ARCH)
+
+#define libc_ifunc_hidden(redirected_name, name, expr) \
+ __ifunc_hidden (redirected_name, name, expr, void, INIT_ARCH)
+
+/* The body of the function is supposed to use __get_cpu_features
+ which will, if necessary, initialize the data first. */
+#define libm_ifunc_init()
+#define libm_ifunc(name, expr) \
+ __ifunc (name, name, expr, void, libm_ifunc_init)
/* Add the compiler optimization to inhibit loop transformation to library
calls. This is used to avoid recursive calls in memset and memmove
@@ -759,5 +1000,49 @@ for linking")
#else
# define inhibit_loop_to_libcall
#endif
+
+/* These macros facilitate sharing source files with gnulib.
+
+ They are here instead of sys/cdefs.h because they should not be
+ used in public header files.
+
+ Their definitions should be kept consistent with the definitions in
+ gnulib-common.m4, but it is not necessary to cater to old non-GCC
+ compilers, since they will only be used while building glibc itself.
+ (Note that _GNUC_PREREQ cannot be used in this file.) */
+
+/* Define as a marker that can be attached to declarations that might not
+ be used. This helps to reduce warnings, such as from
+ GCC -Wunused-parameter. */
+#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+# define _GL_UNUSED __attribute__ ((__unused__))
+#else
+# define _GL_UNUSED
+#endif
+
+/* gcc supports the "unused" attribute on possibly unused labels, and
+ g++ has since version 4.5. Note to support C++ as well as C,
+ _GL_UNUSED_LABEL should be used with a trailing ; */
+#if !defined __cplusplus || __GNUC__ > 4 \
+ || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
+# define _GL_UNUSED_LABEL _GL_UNUSED
+#else
+# define _GL_UNUSED_LABEL
+#endif
+
+/* The __pure__ attribute was added in gcc 2.96. */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+#else
+# define _GL_ATTRIBUTE_PURE /* empty */
+#endif
+
+/* The __const__ attribute was added in gcc 2.95. */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
+#else
+# define _GL_ATTRIBUTE_CONST /* empty */
+#endif
+#endif /* !_ISOMAC */
#endif /* libc-symbols.h */
diff --git a/include/libintl.h b/include/libintl.h
index 0551a04084..9a11367ec6 100644
--- a/include/libintl.h
+++ b/include/libintl.h
@@ -1,5 +1,8 @@
#ifndef _LIBINTL_H
#include <intl/libintl.h>
+
+# ifndef _ISOMAC
+
#include <locale.h>
/* Now define the internal interfaces. */
@@ -46,4 +49,5 @@ libc_hidden_proto (_libc_intl_domainname)
# define _(msgid) \
__dcgettext (_libc_intl_domainname, msgid, LC_MESSAGES)
+# endif /* !_ISOMAC */
#endif
diff --git a/include/libio.h b/include/libio.h
deleted file mode 100644
index 97fc5b548b..0000000000
--- a/include/libio.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#if !defined _ISOMAC && defined _IO_MTSAFE_IO
-# include <stdio-lock.h>
-#endif
-#include <libio/libio.h>
-
-#ifndef _ISOMAC
-#ifndef _LIBC_LIBIO_H
-#define _LIBC_LIBIO_H
-
-libc_hidden_proto (__overflow)
-libc_hidden_proto (__underflow)
-libc_hidden_proto (__uflow)
-libc_hidden_proto (__woverflow)
-libc_hidden_proto (__wunderflow)
-libc_hidden_proto (__wuflow)
-libc_hidden_proto (_IO_free_backup_area)
-libc_hidden_proto (_IO_free_wbackup_area)
-libc_hidden_proto (_IO_padn)
-libc_hidden_proto (_IO_putc)
-libc_hidden_proto (_IO_sgetn)
-libc_hidden_proto (_IO_vfprintf)
-libc_hidden_proto (_IO_vfscanf)
-
-#if defined _IO_MTSAFE_IO && _IO_lock_inexpensive
-# undef _IO_flockfile
-# define _IO_flockfile(_fp) \
- if (((_fp)->_flags & _IO_USER_LOCK) == 0) \
- _IO_lock_lock (*(_fp)->_lock)
-# undef _IO_funlockfile
-# define _IO_funlockfile(_fp) \
- if (((_fp)->_flags & _IO_USER_LOCK) == 0) \
- _IO_lock_unlock (*(_fp)->_lock)
-#endif
-
-#endif
-#endif
diff --git a/include/limits.h b/include/limits.h
index 5add8fceb9..2e4fa683b5 100644
--- a/include/limits.h
+++ b/include/limits.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2018 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,7 +22,8 @@
#ifndef _LIBC_LIMITS_H_
#define _LIBC_LIMITS_H_ 1
-#include <features.h>
+#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
+#include <bits/libc-header-start.h>
/* Maximum length of any multibyte character in any locale.
@@ -138,6 +139,45 @@
# endif
#endif
+/* The integer width macros are not defined by GCC's <limits.h> before
+ GCC 7, or if _GNU_SOURCE rather than
+ __STDC_WANT_IEC_60559_BFP_EXT__ is used to enable this feature. */
+#if __GLIBC_USE (IEC_60559_BFP_EXT)
+# ifndef CHAR_WIDTH
+# define CHAR_WIDTH 8
+# endif
+# ifndef SCHAR_WIDTH
+# define SCHAR_WIDTH 8
+# endif
+# ifndef UCHAR_WIDTH
+# define UCHAR_WIDTH 8
+# endif
+# ifndef SHRT_WIDTH
+# define SHRT_WIDTH 16
+# endif
+# ifndef USHRT_WIDTH
+# define USHRT_WIDTH 16
+# endif
+# ifndef INT_WIDTH
+# define INT_WIDTH 32
+# endif
+# ifndef UINT_WIDTH
+# define UINT_WIDTH 32
+# endif
+# ifndef LONG_WIDTH
+# define LONG_WIDTH __WORDSIZE
+# endif
+# ifndef ULONG_WIDTH
+# define ULONG_WIDTH __WORDSIZE
+# endif
+# ifndef LLONG_WIDTH
+# define LLONG_WIDTH 64
+# endif
+# ifndef ULLONG_WIDTH
+# define ULLONG_WIDTH 64
+# endif
+#endif /* Use IEC_60559_BFP_EXT. */
+
#ifdef __USE_POSIX
/* POSIX adds things to <limits.h>. */
# include <bits/posix1_lim.h>
diff --git a/include/link.h b/include/link.h
index 32a7392f38..5924594548 100644
--- a/include/link.h
+++ b/include/link.h
@@ -1,6 +1,6 @@
/* Data structure for communication from the run-time dynamic linker for
loaded ELF shared objects.
- Copyright (C) 1995-2016 Free Software Foundation, Inc.
+ Copyright (C) 1995-2018 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,12 +24,18 @@
# error this should be impossible
#endif
+# ifndef _ISOMAC
/* Get most of the contents from the public header, but we define a
different `struct link_map' type for private use. The la_objopen
prototype uses the type, so we have to declare it separately. */
-#define link_map link_map_public
-#define la_objopen la_objopen_wrongproto
+# define link_map link_map_public
+# define la_objopen la_objopen_wrongproto
+# endif
+
#include <elf/link.h>
+
+# ifndef _ISOMAC
+
#undef link_map
#undef la_objopen
@@ -197,6 +203,8 @@ struct link_map
freed, ie. not allocated with
the dummy malloc in ld.so. */
+#include <link_map.h>
+
/* Collected information about own RPATH directories. */
struct r_search_path_struct l_rpath_dirs;
@@ -335,10 +343,12 @@ struct link_map
extern int __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
size_t size, void *data),
void *data);
+hidden_proto (__dl_iterate_phdr)
/* We use this macro to refer to ELF macros independent of the native
wordsize. `ELFW(R_TYPE)' is used in place of `ELF32_R_TYPE' or
`ELF64_R_TYPE'. */
#define ELFW(type) _ElfW (ELF, __ELF_NATIVE_CLASS, type)
+# endif /* !_ISOMAC */
#endif /* include/link.h */
diff --git a/include/list.h b/include/list.h
index cf65d46382..bb78c2a2d9 100644
--- a/include/list.h
+++ b/include/list.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2016 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -17,39 +17,23 @@
<http://www.gnu.org/licenses/>. */
#ifndef _LIST_H
+#define _LIST_H 1
-#ifndef __need_list_t
-# define _LIST_H 1
-#endif
+/* Internal: doubly linked lists. */
/* The definitions of this file are adopted from those which can be
found in the Linux kernel headers to enable people familiar with
the latter find their way in these sources as well. */
-
-#if defined __need_list_t || defined _LIST_H
-# ifndef __list_t_defined
-# define __list_t_defined
-/* Basic type for the double-link list. */
-typedef struct list_head
-{
- struct list_head *next;
- struct list_head *prev;
-} list_t;
-# endif
-# undef __need_list_t
-#endif
-
-#ifdef _LIST_H
-
-# include <atomic.h>
+#include <list_t.h>
+#include <atomic.h>
/* Define a variable with the head and tail of the list. */
-# define LIST_HEAD(name) \
+#define LIST_HEAD(name) \
list_t name = { &(name), &(name) }
/* Initialize a new list head. */
-# define INIT_LIST_HEAD(ptr) \
+#define INIT_LIST_HEAD(ptr) \
(ptr)->next = (ptr)->prev = (ptr)
@@ -90,28 +74,26 @@ list_splice (list_t *add, list_t *head)
/* Get typed element from list at a given position. */
-# define list_entry(ptr, type, member) \
+#define list_entry(ptr, type, member) \
((type *) ((char *) (ptr) - (unsigned long) (&((type *) 0)->member)))
/* Iterate forward over the elements of the list. */
-# define list_for_each(pos, head) \
+#define list_for_each(pos, head) \
for (pos = (head)->next; pos != (head); pos = pos->next)
/* Iterate forward over the elements of the list. */
-# define list_for_each_prev(pos, head) \
+#define list_for_each_prev(pos, head) \
for (pos = (head)->prev; pos != (head); pos = pos->prev)
/* Iterate backwards over the elements list. The list elements can be
removed from the list while doing this. */
-# define list_for_each_prev_safe(pos, p, head) \
+#define list_for_each_prev_safe(pos, p, head) \
for (pos = (head)->prev, p = pos->prev; \
pos != (head); \
pos = p, p = pos->prev)
-#endif /* _LIST_H */
-
#endif /* list.h */
diff --git a/include/caller.h b/include/list_t.h
index 19c5c2661b..7ca12a4b01 100644
--- a/include/caller.h
+++ b/include/list_t.h
@@ -1,5 +1,6 @@
-/* Copyright (C) 2004-2016 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -15,17 +16,16 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#ifndef _CALLER_H
-#define _CALLER_H 1
+#ifndef _LIST_T_H
+#define _LIST_T_H 1
-#include <ldsodefs.h>
+/* Internal: doubly linked lists. */
-/* _dl_check_caller only works in DSOs. */
-#ifdef SHARED
-# define __check_caller(caller, mask) \
- GLRO(dl_check_caller) (caller, mask)
-#else
-# define __check_caller(caller, mask) (0)
-#endif
+/* Basic type for the double-link list. */
+typedef struct list_head
+{
+ struct list_head *next;
+ struct list_head *prev;
+} list_t;
-#endif /* caller.h */
+#endif /* list_t.h */
diff --git a/include/malloc.h b/include/malloc.h
index 42fc8ed696..d4cd9a5ffc 100644
--- a/include/malloc.h
+++ b/include/malloc.h
@@ -1,6 +1,7 @@
#ifndef _MALLOC_H
#include <malloc/malloc.h>
+# ifndef _ISOMAC
/* In the GNU libc we rename the global variable
`__malloc_initialized' to `__libc_malloc_initialized'. */
@@ -8,7 +9,10 @@
/* Nonzero if the malloc is already initialized. */
extern int __malloc_initialized attribute_hidden;
+extern __typeof (__malloc_check_init) __malloc_check_init attribute_hidden;
+
struct malloc_state;
typedef struct malloc_state *mstate;
+# endif /* !_ISOMAC */
#endif
diff --git a/include/math-narrow-eval.h b/include/math-narrow-eval.h
new file mode 100644
index 0000000000..4361aa06c0
--- /dev/null
+++ b/include/math-narrow-eval.h
@@ -0,0 +1,47 @@
+/* Narrow floating-point values to their semantic type.
+ Copyright (C) 2015-2018 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/>. */
+
+#ifndef _MATH_NARROW_EVAL_H
+#define _MATH_NARROW_EVAL_H 1
+
+#include <float.h>
+
+/* math_narrow_eval reduces its floating-point argument to the range
+ and precision of its semantic type. (The original evaluation may
+ still occur with excess range and precision, so the result may be
+ affected by double rounding.) */
+#if FLT_EVAL_METHOD == 0
+# define math_narrow_eval(x) (x)
+#else
+# if FLT_EVAL_METHOD == 1
+# define excess_precision(type) __builtin_types_compatible_p (type, float)
+# else
+# define excess_precision(type) (__builtin_types_compatible_p (type, float) \
+ || __builtin_types_compatible_p (type, \
+ double))
+# endif
+# define math_narrow_eval(x) \
+ ({ \
+ __typeof (x) math_narrow_eval_tmp = (x); \
+ if (excess_precision (__typeof (math_narrow_eval_tmp))) \
+ __asm__ ("" : "+m" (math_narrow_eval_tmp)); \
+ math_narrow_eval_tmp; \
+ })
+#endif
+
+#endif /* math-narrow-eval.h */
diff --git a/include/math.h b/include/math.h
index ba7bba018a..e21d34b868 100644
--- a/include/math.h
+++ b/include/math.h
@@ -1,11 +1,13 @@
#ifndef _MATH_H
+#ifdef _ISOMAC
+# undef NO_LONG_DOUBLE
+#endif
+
#include <math/math.h>
#ifndef _ISOMAC
/* Now define the internal interfaces. */
-extern int __matherr (struct exception *__exc);
-
extern int __signgam;
# if IS_IN (libc) || IS_IN (libm)
@@ -21,6 +23,13 @@ hidden_proto (__finitel)
hidden_proto (__isinfl)
hidden_proto (__isnanl)
# endif
+
+# if __HAVE_DISTINCT_FLOAT128
+hidden_proto (__finitef128)
+hidden_proto (__isinff128)
+hidden_proto (__isnanf128)
+hidden_proto (__signbitf128)
+# endif
# endif
libm_hidden_proto (__fpclassify)
@@ -29,6 +38,7 @@ libm_hidden_proto (__issignaling)
libm_hidden_proto (__issignalingf)
libm_hidden_proto (__exp)
libm_hidden_proto (__expf)
+libm_hidden_proto (__roundeven)
# ifndef __NO_LONG_DOUBLE_MATH
libm_hidden_proto (__fpclassifyl)
@@ -37,5 +47,27 @@ libm_hidden_proto (__expl)
libm_hidden_proto (__expm1l)
# endif
+# if __HAVE_DISTINCT_FLOAT128
+libm_hidden_proto (__fpclassifyf128)
+libm_hidden_proto (__issignalingf128)
+libm_hidden_proto (__expf128)
+libm_hidden_proto (__expm1f128)
+# endif
+
+# if !(defined __FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0)
+# ifndef NO_MATH_REDIRECT
+/* Declare sqrt for use within GLIBC. Compilers typically inline sqrt as a
+ single instruction. Use an asm to avoid use of PLTs if it doesn't. */
+float (sqrtf) (float) asm ("__ieee754_sqrtf");
+double (sqrt) (double) asm ("__ieee754_sqrt");
+# ifndef __NO_LONG_DOUBLE_MATH
+long double (sqrtl) (long double) asm ("__ieee754_sqrtl");
+# endif
+# if __HAVE_DISTINCT_FLOAT128 > 0
+_Float128 (sqrtf128) (_Float128) asm ("__ieee754_sqrtf128");
+# endif
+# endif
+# endif
+
#endif
#endif
diff --git a/include/mcheck.h b/include/mcheck.h
index b0037a7107..8883c3d53e 100644
--- a/include/mcheck.h
+++ b/include/mcheck.h
@@ -2,7 +2,10 @@
#include <malloc/mcheck.h>
+# ifndef _ISOMAC
+
libc_hidden_proto (mcheck)
libc_hidden_proto (mcheck_check_all)
+# endif /* !_ISOMAC */
#endif
diff --git a/include/mntent.h b/include/mntent.h
index b34674aa3e..a16298ed6e 100644
--- a/include/mntent.h
+++ b/include/mntent.h
@@ -1,6 +1,8 @@
#ifndef _MNTENT_H
#include <misc/mntent.h>
+# ifndef _ISOMAC
+
/* Now define the internal interfaces. */
extern FILE *__setmntent (const char *__file, const char *__mode);
extern struct mntent *__getmntent_r (FILE *__stream,
@@ -13,5 +15,7 @@ extern char *__hasmntopt (const struct mntent *__mnt, const char *__opt);
libc_hidden_proto (__setmntent)
libc_hidden_proto (__getmntent_r)
libc_hidden_proto (__endmntent)
+libc_hidden_proto (__hasmntopt)
+# endif /* !_ISOMAC */
#endif
diff --git a/include/monetary.h b/include/monetary.h
index e6870138f8..c130ed56a3 100644
--- a/include/monetary.h
+++ b/include/monetary.h
@@ -2,6 +2,7 @@
#ifndef _ISOMAC
#include <stdarg.h>
-extern ssize_t __vstrfmon_l (char *s, size_t maxsize, __locale_t loc,
- const char *format, va_list ap);
+extern ssize_t __vstrfmon_l (char *s, size_t maxsize, locale_t loc,
+ const char *format, va_list ap)
+ attribute_hidden;
#endif
diff --git a/include/netdb.h b/include/netdb.h
index e1f051d16a..e230b1f4fc 100644
--- a/include/netdb.h
+++ b/include/netdb.h
@@ -1,8 +1,8 @@
#ifndef _NETDB_H
#include <resolv/netdb.h>
-#include <stdint.h>
#ifndef _ISOMAC
+# include <stdint.h>
/* Macros for accessing h_errno from inside libc. */
# if IS_IN_LIB
# undef h_errno
@@ -43,7 +43,8 @@ extern int __gethostbyaddr_r (const void *__restrict __addr,
struct hostent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct hostent **__restrict __result,
- int *__restrict __h_errnop);
+ int *__restrict __h_errnop)
+ attribute_hidden;
extern int __old_gethostbyaddr_r (const void *__restrict __addr,
socklen_t __len, int __type,
struct hostent *__restrict __result_buf,
@@ -63,7 +64,8 @@ extern int __gethostbyname_r (const char *__restrict __name,
struct hostent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct hostent **__restrict __result,
- int *__restrict __h_errnop);
+ int *__restrict __h_errnop)
+ attribute_hidden;
extern int __old_gethostbyname_r (const char *__restrict __name,
struct hostent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
@@ -74,7 +76,8 @@ extern int __gethostbyname2_r (const char *__restrict __name, int __af,
struct hostent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct hostent **__restrict __result,
- int *__restrict __h_errnop);
+ int *__restrict __h_errnop)
+ attribute_hidden;
extern int __old_gethostbyname2_r (const char *__restrict __name, int __af,
struct hostent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
@@ -101,7 +104,8 @@ extern int __getnetbyaddr_r (uint32_t __net, int __type,
struct netent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct netent **__restrict __result,
- int *__restrict __h_errnop);
+ int *__restrict __h_errnop)
+ attribute_hidden;
extern int __old_getnetbyaddr_r (uint32_t __net, int __type,
struct netent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
@@ -112,7 +116,8 @@ extern int __getnetbyname_r (const char *__restrict __name,
struct netent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct netent **__restrict __result,
- int *__restrict __h_errnop);
+ int *__restrict __h_errnop)
+ attribute_hidden;
extern int __old_getnetbyname_r (const char *__restrict __name,
struct netent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
@@ -131,7 +136,8 @@ extern int __getservbyname_r (const char *__restrict __name,
const char *__restrict __proto,
struct servent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
- struct servent **__restrict __result);
+ struct servent **__restrict __result)
+ attribute_hidden;
extern int __old_getservbyname_r (const char *__restrict __name,
const char *__restrict __proto,
struct servent *__restrict __result_buf,
@@ -142,7 +148,8 @@ extern int __getservbyport_r (int __port,
const char *__restrict __proto,
struct servent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
- struct servent **__restrict __result);
+ struct servent **__restrict __result)
+ attribute_hidden;
extern int __old_getservbyport_r (int __port,
const char *__restrict __proto,
struct servent *__restrict __result_buf,
@@ -160,7 +167,8 @@ extern int __old_getprotoent_r (struct protoent *__restrict __result_buf,
extern int __getprotobyname_r (const char *__restrict __name,
struct protoent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
- struct protoent **__restrict __result);
+ struct protoent **__restrict __result)
+ attribute_hidden;
extern int __old_getprotobyname_r (const char *__restrict __name,
struct protoent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
@@ -169,7 +177,8 @@ extern int __old_getprotobyname_r (const char *__restrict __name,
extern int __getprotobynumber_r (int __proto,
struct protoent *__restrict __res_buf,
char *__restrict __buf, size_t __buflen,
- struct protoent **__restrict __result);
+ struct protoent **__restrict __result)
+ attribute_hidden;
extern int __old_getprotobynumber_r (int __proto,
struct protoent *__restrict __res_buf,
char *__restrict __buf, size_t __buflen,
@@ -178,7 +187,8 @@ extern int __old_getprotobynumber_r (int __proto,
extern int __getnetgrent_r (char **__restrict __hostp,
char **__restrict __userp,
char **__restrict __domainp,
- char *__restrict __buffer, size_t __buflen);
+ char *__restrict __buffer, size_t __buflen)
+ attribute_hidden;
extern int ruserpass (const char *host, const char **aname,
const char **apass);
diff --git a/include/netinet/ether.h b/include/netinet/ether.h
index 2efe4c04e4..8bfe7e03ad 100644
--- a/include/netinet/ether.h
+++ b/include/netinet/ether.h
@@ -1,6 +1,8 @@
#ifndef _NETINET_ETHER_H
#include <inet/netinet/ether.h>
+# ifndef _ISOMAC
+
libc_hidden_proto (ether_aton_r)
libc_hidden_proto (ether_ntoa_r)
@@ -39,4 +41,5 @@ DECLARE_NSS_PROTOTYPES (nisplus)
#undef DECLARE_NSS_PROTOTYPES
+# endif /* !_ISOMAC */
#endif
diff --git a/include/nss.h b/include/nss.h
index 1e8cc3910d..c5b7c04c82 100644
--- a/include/nss.h
+++ b/include/nss.h
@@ -1,14 +1,23 @@
#ifndef _NSS_H
#include <nss/nss.h>
-#define NSS_INVALID_FIELD_CHARACTERS ":\n"
+#ifndef _ISOMAC
+
+# include <stddef.h>
+# include <stdint.h>
+
+# define NSS_INVALID_FIELD_CHARACTERS ":\n"
extern const char __nss_invalid_field_characters[] attribute_hidden;
-_Bool __nss_valid_field (const char *value)
- attribute_hidden internal_function;
-_Bool __nss_valid_list_field (char **list)
- attribute_hidden internal_function;
+_Bool __nss_valid_field (const char *value) attribute_hidden;
+_Bool __nss_valid_list_field (char **list) attribute_hidden;
const char *__nss_rewrite_field (const char *value, char **to_be_freed)
- attribute_hidden internal_function;
+ attribute_hidden;
+
+/* Compute a hash value for LENGTH bytes starting at KEY. This is the
+ hash function used by the nscd for the cache mapping files. */
+uint32_t __nss_hash (const void *__key, size_t __length);
+libc_hidden_proto (__nss_hash)
+#endif /* !_ISOMAC */
#endif /* _NSS_H */
diff --git a/include/obstack.h b/include/obstack.h
index 349d59bb03..fe2e595381 100644
--- a/include/obstack.h
+++ b/include/obstack.h
@@ -1,3 +1,9 @@
+#ifndef _OBSTACK_H
#include <malloc/obstack.h>
+# ifndef _ISOMAC
+
libc_hidden_proto (_obstack_newchunk)
+
+# endif /* !_ISOMAC */
+#endif /* obstack.h */
diff --git a/include/plural-exp.h b/include/plural-exp.h
new file mode 100644
index 0000000000..3b026f804d
--- /dev/null
+++ b/include/plural-exp.h
@@ -0,0 +1,8 @@
+#ifndef _PLURAL_EXP_H
+#include <intl/plural-exp.h>
+
+#ifndef _ISOMAC
+extern __typeof (__gettextparse) __gettextparse attribute_hidden;
+#endif /* !_ISOMAC */
+
+#endif
diff --git a/include/printf.h b/include/printf.h
index c0bd2d2d65..d051514119 100644
--- a/include/printf.h
+++ b/include/printf.h
@@ -2,11 +2,23 @@
#include <stdio-common/printf.h>
+# ifndef _ISOMAC
+
+#include <bits/types/locale_t.h>
+
/* Now define the internal interfaces. */
extern int __printf_fphex (FILE *, const struct printf_info *,
- const void *const *);
+ const void *const *) attribute_hidden;
extern int __printf_fp (FILE *, const struct printf_info *,
const void *const *);
libc_hidden_proto (__printf_fp)
+extern int __printf_fp_l (FILE *, locale_t, const struct printf_info *,
+ const void *const *);
+libc_hidden_proto (__printf_fp_l)
+
+extern unsigned int __guess_grouping (unsigned int intdig_max,
+ const char *grouping)
+ attribute_hidden;
+# endif /* !_ISOMAC */
#endif
diff --git a/include/programs/xmalloc.h b/include/programs/xmalloc.h
index c795c7f41f..736b5250ea 100644
--- a/include/programs/xmalloc.h
+++ b/include/programs/xmalloc.h
@@ -1,5 +1,5 @@
/* Memory related definitions for program modules.
- Copyright (C) 1998-2016 Free Software Foundation, Inc.
+ Copyright (C) 1998-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
diff --git a/include/pty.h b/include/pty.h
index a91be80852..4979bb765f 100644
--- a/include/pty.h
+++ b/include/pty.h
@@ -1,6 +1,9 @@
#ifndef _PTY_H
#include <login/pty.h>
+# ifndef _ISOMAC
+
libutil_hidden_proto (openpty)
+# endif /* !_ISOMAC */
#endif
diff --git a/include/pwd.h b/include/pwd.h
index 3b0f72540c..fc995065d9 100644
--- a/include/pwd.h
+++ b/include/pwd.h
@@ -10,19 +10,19 @@ extern int __old_getpwent_r (struct passwd *__resultbuf, char *__buffer,
size_t __buflen, struct passwd **__result);
extern int __getpwuid_r (__uid_t __uid, struct passwd *__resultbuf,
char *__buffer, size_t __buflen,
- struct passwd **__result);
+ struct passwd **__result) attribute_hidden;
extern int __old_getpwuid_r (__uid_t __uid, struct passwd *__resultbuf,
char *__buffer, size_t __buflen,
struct passwd **__result);
extern int __getpwnam_r (const char *__name, struct passwd *__resultbuf,
char *__buffer, size_t __buflen,
- struct passwd **__result);
+ struct passwd **__result) attribute_hidden;
extern int __old_getpwnam_r (const char *__name, struct passwd *__resultbuf,
char *__buffer, size_t __buflen,
struct passwd **__result);
extern int __fgetpwent_r (FILE * __stream, struct passwd *__resultbuf,
char *__buffer, size_t __buflen,
- struct passwd **__result);
+ struct passwd **__result) attribute_hidden;
#include <nss.h>
diff --git a/include/regex.h b/include/regex.h
index fd4beeff3d..24eca2c297 100644
--- a/include/regex.h
+++ b/include/regex.h
@@ -8,7 +8,8 @@ extern reg_syntax_t __re_set_syntax (reg_syntax_t syntax);
extern const char *__re_compile_pattern (const char *pattern, size_t length,
struct re_pattern_buffer *buffer);
-extern int __re_compile_fastmap (struct re_pattern_buffer *buffer);
+extern int __re_compile_fastmap (struct re_pattern_buffer *buffer)
+ attribute_hidden;
extern int __re_search (struct re_pattern_buffer *buffer, const char *string,
int length, int start, int range,
@@ -33,13 +34,16 @@ extern void __re_set_registers
unsigned num_regs, regoff_t *starts, regoff_t *ends);
extern int __regcomp (regex_t *__preg, const char *__pattern, int __cflags);
+libc_hidden_proto (__regcomp)
extern int __regexec (const regex_t *__preg, const char *__string,
size_t __nmatch, regmatch_t __pmatch[], int __eflags);
+libc_hidden_proto (__regexec)
extern size_t __regerror (int __errcode, const regex_t *__preg,
char *__errbuf, size_t __errbuf_size);
extern void __regfree (regex_t *__preg);
+libc_hidden_proto (__regfree)
#endif
#endif
diff --git a/include/resolv.h b/include/resolv.h
index 4c614760a8..daf4a74777 100644
--- a/include/resolv.h
+++ b/include/resolv.h
@@ -1,17 +1,19 @@
#ifndef _RESOLV_H_
-#define RES_SET_H_ERRNO(r,x) \
+# ifndef _ISOMAC
+# include <stdbool.h>
+# define RES_SET_H_ERRNO(r,x) \
do \
{ \
(r)->res_h_errno = x; \
__set_h_errno(x); \
} \
while (0)
+# endif
-#include <stdbool.h>
#include <resolv/resolv.h>
-#ifdef _RESOLV_H_
+# if defined _RESOLV_H_ && !defined _ISOMAC
# if IS_IN (libc)
# define __resp __libc_resp
@@ -21,40 +23,23 @@ extern __thread struct __res_state *__resp attribute_tls_model_ie;
# define _res (*__resp)
/* Now define the internal interfaces. */
-extern int __res_vinit (res_state, int);
-extern int __res_maybe_init (res_state, int);
+extern int __res_vinit (res_state, int) attribute_hidden;
extern void _sethtent (int);
-extern void _endhtent (void);
extern struct hostent *_gethtent (void);
extern struct hostent *_gethtbyname (const char *__name);
extern struct hostent *_gethtbyname2 (const char *__name, int __af);
struct hostent *_gethtbyaddr (const char *addr, size_t __len, int __af);
-extern u_int32_t _getlong (const u_char *__src);
-extern u_int16_t _getshort (const u_char *__src);
-extern void res_pquery (const res_state __statp, const u_char *__msg,
- int __len, FILE *__file);
-extern void res_send_setqhook (res_send_qhook __hook);
-extern void res_send_setrhook (res_send_rhook __hook);
+extern uint32_t _getlong (const unsigned char *__src);
+extern uint16_t _getshort (const unsigned char *__src);
extern int res_ourserver_p (const res_state __statp,
const struct sockaddr_in6 *__inp);
extern void __res_iclose (res_state statp, bool free_addr);
-extern int __res_nopt(res_state statp, int n0, u_char *buf, int buflen,
- int anslen);
libc_hidden_proto (__res_ninit)
-libc_hidden_proto (__res_maybe_init)
libc_hidden_proto (__res_nclose)
libc_hidden_proto (__res_iclose)
libc_hidden_proto (__res_randomid)
libc_hidden_proto (__res_state)
-int __libc_res_nquery (res_state, const char *, int, int, u_char *, int,
- u_char **, u_char **, int *, int *, int *);
-int __libc_res_nsearch (res_state, const char *, int, int, u_char *, int,
- u_char **, u_char **, int *, int *, int *);
-int __libc_res_nsend (res_state, const u_char *, int, const u_char *, int,
- u_char *, int, u_char **, u_char **, int *, int *, int *)
- attribute_hidden;
-
libresolv_hidden_proto (_sethtent)
libresolv_hidden_proto (_gethtent)
libresolv_hidden_proto (_gethtbyaddr)
@@ -76,25 +61,10 @@ libresolv_hidden_proto (__p_type)
libresolv_hidden_proto (__loc_ntoa)
libresolv_hidden_proto (__fp_nquery)
libresolv_hidden_proto (__fp_query)
-libresolv_hidden_proto (__hostalias)
-libresolv_hidden_proto (__res_nmkquery)
-libresolv_hidden_proto (__libc_res_nquery)
-libresolv_hidden_proto (__res_nquery)
-libresolv_hidden_proto (__res_nquerydomain)
-libresolv_hidden_proto (__res_hostalias)
-libresolv_hidden_proto (__libc_res_nsearch)
-libresolv_hidden_proto (__res_nsearch)
libresolv_hidden_proto (__res_nameinquery)
libresolv_hidden_proto (__res_queriesmatch)
-libresolv_hidden_proto (__res_nsend)
libresolv_hidden_proto (__b64_ntop)
-libresolv_hidden_proto (__res_nopt)
libresolv_hidden_proto (__dn_count_labels)
-libresolv_hidden_proto (__p_secstodate)
-
-extern const char *_res_opcodes[];
-libresolv_hidden_proto (_res_opcodes)
-
-#endif
+# endif /* _RESOLV_H_ && !_ISOMAC */
#endif
diff --git a/include/rounding-mode.h b/include/rounding-mode.h
index 3e085d938b..b5f3fbb539 100644
--- a/include/rounding-mode.h
+++ b/include/rounding-mode.h
@@ -1,5 +1,5 @@
/* Handle floating-point rounding mode within libc.
- Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ Copyright (C) 2012-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/include/rpc/auth.h b/include/rpc/auth.h
index 0219fd9316..2e55cce11d 100644
--- a/include/rpc/auth.h
+++ b/include/rpc/auth.h
@@ -1,6 +1,8 @@
#ifndef _RPC_AUTH_H
#include <sunrpc/rpc/auth.h>
+# ifndef _ISOMAC
+
libc_hidden_proto (getnetname)
libc_hidden_proto (netname2user)
libc_hidden_proto (host2netname)
@@ -41,4 +43,5 @@ libc_hidden_proto (key_setnet)
libc_hidden_proto (key_setsecret)
libc_hidden_proto (netname2host)
+# endif /* !_ISOMAC */
#endif
diff --git a/include/rpc/auth_des.h b/include/rpc/auth_des.h
index 0e9db1a226..6afed56b71 100644
--- a/include/rpc/auth_des.h
+++ b/include/rpc/auth_des.h
@@ -2,6 +2,8 @@
#include <sunrpc/rpc/auth_des.h>
+# ifndef _ISOMAC
+
libc_hidden_proto (getpublickey)
libc_hidden_proto (getsecretkey)
libc_hidden_proto (rtime)
@@ -32,4 +34,5 @@ libc_hidden_proto (authdes_getucred)
libc_hidden_proto (xdr_authdes_cred)
libc_hidden_proto (xdr_authdes_verf)
+# endif /* !_ISOMAC */
#endif
diff --git a/include/rpc/auth_unix.h b/include/rpc/auth_unix.h
index 07031c9bd9..019efa275a 100644
--- a/include/rpc/auth_unix.h
+++ b/include/rpc/auth_unix.h
@@ -1,3 +1,9 @@
+#ifndef _RPC_AUTH_UNIX_H
#include <sunrpc/rpc/auth_unix.h>
+# ifndef _ISOMAC
+
libc_hidden_proto (xdr_authunix_parms)
+
+# endif /* !_ISOMAC */
+#endif /* rpc/auth_unix.h */
diff --git a/include/rpc/clnt.h b/include/rpc/clnt.h
index d79a6a7b5b..80be0a9cec 100644
--- a/include/rpc/clnt.h
+++ b/include/rpc/clnt.h
@@ -1,6 +1,8 @@
#ifndef _RPC_CLNT_H
#include <sunrpc/rpc/clnt.h>
+# ifndef _ISOMAC
+
/* Now define the internal interfaces. */
extern int _openchild (const char *command, FILE **fto, FILE **ffrom);
@@ -26,5 +28,7 @@ libc_hidden_proto (clntudp_create)
libc_hidden_proto (get_myaddress)
libc_hidden_proto (clntunix_create)
libc_hidden_proto (__libc_clntudp_bufcreate)
+libc_hidden_proto (rpc_createerr)
+# endif /* !_ISOMAC */
#endif
diff --git a/include/rpc/des_crypt.h b/include/rpc/des_crypt.h
index 44f7e669b0..7a34957df8 100644
--- a/include/rpc/des_crypt.h
+++ b/include/rpc/des_crypt.h
@@ -1,6 +1,8 @@
#ifndef __DES_CRYPT_H__
#include <sunrpc/rpc/des_crypt.h>
+# ifndef _ISOMAC
+
/* Now define the internal interfaces. */
extern int xencrypt (char *secret, char *passwd);
@@ -12,4 +14,5 @@ libc_hidden_proto (cbc_crypt)
libc_hidden_proto (xencrypt)
libc_hidden_proto (xdecrypt)
+# endif /* !_ISOMAC */
#endif
diff --git a/include/rpc/key_prot.h b/include/rpc/key_prot.h
index 29d14cc8a0..4711a94edf 100644
--- a/include/rpc/key_prot.h
+++ b/include/rpc/key_prot.h
@@ -1,5 +1,8 @@
+#ifndef _KEY_PROT_H_RPCGEN
#include <sunrpc/rpc/key_prot.h>
+# ifndef _ISOMAC
+
libc_hidden_proto (xdr_cryptkeyarg)
libc_hidden_proto (xdr_cryptkeyarg2)
libc_hidden_proto (xdr_cryptkeyres)
@@ -10,3 +13,6 @@ libc_hidden_proto (xdr_keystatus)
libc_hidden_proto (xdr_getcredres)
libc_hidden_proto (xdr_netnamestr)
libc_hidden_proto (xdr_unixcred)
+
+# endif /* !_ISOMAC */
+#endif /* rpc/key_prot.h */
diff --git a/include/rpc/netdb.h b/include/rpc/netdb.h
index 65af237e50..eb75f3f58c 100644
--- a/include/rpc/netdb.h
+++ b/include/rpc/netdb.h
@@ -1,9 +1,11 @@
#ifndef _RPC_NETDB_H
#include <sunrpc/rpc/netdb.h>
+# ifndef _ISOMAC
+
extern int __getrpcbyname_r (const char *__name, struct rpcent *__result_buf,
char *__buffer, size_t __buflen,
- struct rpcent **__result);
+ struct rpcent **__result) attribute_hidden;
extern int __old_getrpcbyname_r (const char *__name,
struct rpcent *__result_buf,
char *__buffer, size_t __buflen,
@@ -11,7 +13,7 @@ extern int __old_getrpcbyname_r (const char *__name,
extern int __getrpcbynumber_r (int __number, struct rpcent *__result_buf,
char *__buffer, size_t __buflen,
- struct rpcent **__result);
+ struct rpcent **__result) attribute_hidden;
extern int __old_getrpcbynumber_r (int __number, struct rpcent *__result_buf,
char *__buffer, size_t __buflen,
struct rpcent **__result);
@@ -48,4 +50,5 @@ DECLARE_NSS_PROTOTYPES (nisplus)
#undef DECLARE_NSS_PROTOTYPES
+# endif /* !_ISOMAC */
#endif
diff --git a/include/rpc/pmap_clnt.h b/include/rpc/pmap_clnt.h
index 67628e0589..8368a39f6f 100644
--- a/include/rpc/pmap_clnt.h
+++ b/include/rpc/pmap_clnt.h
@@ -1,21 +1,22 @@
#ifndef _RPC_PMAP_CLNT_H
-# include <sunrpc/rpc/pmap_clnt.h>
+#include <sunrpc/rpc/pmap_clnt.h>
+
+# ifndef _ISOMAC
libc_hidden_proto (pmap_getport)
libc_hidden_proto (pmap_set)
libc_hidden_proto (pmap_unset)
/* Defined in pm_getport.c. */
-extern int __get_socket (struct sockaddr_in *saddr)
- attribute_hidden internal_function;
+extern int __get_socket (struct sockaddr_in *saddr) attribute_hidden;
extern u_short __libc_rpc_getport (struct sockaddr_in *address, u_long program,
u_long version, u_int protocol,
- time_t timeout_sec, time_t tottimeout_sec)
- internal_function;
+ time_t timeout_sec, time_t tottimeout_sec);
libc_hidden_proto (__libc_rpc_getport)
libc_hidden_proto (clnt_broadcast)
libc_hidden_proto (pmap_getmaps)
libc_hidden_proto (pmap_rmtcall)
-#endif
+# endif /* !_ISOMAC */
+#endif /* rpc/pmap_clnt.h */
diff --git a/include/rpc/pmap_prot.h b/include/rpc/pmap_prot.h
index 2e9076ee3d..a2573d106f 100644
--- a/include/rpc/pmap_prot.h
+++ b/include/rpc/pmap_prot.h
@@ -1,4 +1,10 @@
+#ifndef _RPC_PMAP_PROT_H
#include <sunrpc/rpc/pmap_prot.h>
+# ifndef _ISOMAC
+
libc_hidden_proto (xdr_pmap)
libc_hidden_proto (xdr_pmaplist)
+
+# endif /* !_ISOMAC */
+#endif /* rpc/pmap_prot.h */
diff --git a/include/rpc/pmap_rmt.h b/include/rpc/pmap_rmt.h
index e8822dabe9..ae53a02652 100644
--- a/include/rpc/pmap_rmt.h
+++ b/include/rpc/pmap_rmt.h
@@ -1,4 +1,10 @@
+#ifndef _RPC_PMAP_RMT_H
#include <sunrpc/rpc/pmap_rmt.h>
+# ifndef _ISOMAC
+
libc_hidden_proto (xdr_rmtcall_args)
libc_hidden_proto (xdr_rmtcallres)
+
+# endif /* !_ISOMAC */
+#endif /* rpc/pmap_rmt.h */
diff --git a/include/rpc/rpc.h b/include/rpc/rpc.h
index 58bdef3cc9..f5cee6caef 100644
--- a/include/rpc/rpc.h
+++ b/include/rpc/rpc.h
@@ -1,5 +1,8 @@
#ifndef _RPC_RPC_H
#include <sunrpc/rpc/rpc.h>
+
+# ifndef _ISOMAC
+
#include <libc-tsd.h>
/* Now define the internal interfaces. */
@@ -10,7 +13,6 @@ extern unsigned long _create_xid (void);
* Group all global and static variables into a single spot.
* This area is allocated on a per-thread basis
*/
-#ifdef _RPC_THREAD_SAFE_
struct rpc_thread_variables {
fd_set svc_fdset_s; /* Global, rpc_common.c */
struct rpc_createerr rpc_createerr_s; /* Global, rpc_common.c */
@@ -38,12 +40,12 @@ struct rpc_thread_variables {
};
extern struct rpc_thread_variables *__rpc_thread_variables(void)
- __attribute__ ((const));
-extern void __rpc_thread_svc_cleanup (void);
-extern void __rpc_thread_clnt_cleanup (void);
-extern void __rpc_thread_key_cleanup (void);
+ __attribute__ ((const)) attribute_hidden;
+extern void __rpc_thread_svc_cleanup (void) attribute_hidden;
+extern void __rpc_thread_clnt_cleanup (void) attribute_hidden;
+extern void __rpc_thread_key_cleanup (void) attribute_hidden;
-extern void __rpc_thread_destroy (void);
+extern void __rpc_thread_destroy (void) attribute_hidden;
__libc_tsd_define (extern, struct rpc_thread_variables *, RPC_VARS)
@@ -54,6 +56,11 @@ libc_hidden_proto (__rpc_thread_svc_pollfd)
libc_hidden_proto (__rpc_thread_svc_fdset)
libc_hidden_proto (__rpc_thread_createerr)
-#endif /* _RPC_THREAD_SAFE_ */
+/* Perform a host name lookup for NAME and return the first IPv4
+ address in *ADDR. Return 0 on success and -1 on error (and set an
+ RPC error). */
+int __libc_rpc_gethostbyname (const char *host, struct sockaddr_in *addr)
+ attribute_hidden;
+# endif /* !_ISOMAC */
#endif
diff --git a/include/rpc/rpc_msg.h b/include/rpc/rpc_msg.h
index be1f4838c9..93c5ab8764 100644
--- a/include/rpc/rpc_msg.h
+++ b/include/rpc/rpc_msg.h
@@ -1,6 +1,8 @@
#ifndef _RPC_MSG_H
#include <sunrpc/rpc/rpc_msg.h>
+# ifndef _ISOMAC
+
libc_hidden_proto (_seterr_reply)
/* Now define the internal interfaces. */
@@ -14,4 +16,5 @@ libc_hidden_proto (xdr_callmsg)
libc_hidden_proto (xdr_rejected_reply)
libc_hidden_proto (xdr_replymsg)
+# endif /* !_ISOMAC */
#endif
diff --git a/include/rpc/svc.h b/include/rpc/svc.h
index 61a8ab3503..40ba2546a9 100644
--- a/include/rpc/svc.h
+++ b/include/rpc/svc.h
@@ -1,6 +1,12 @@
#ifndef _RPC_SVC_H
#include <sunrpc/rpc/svc.h>
+# ifndef _ISOMAC
+
+libc_hidden_proto (svc_pollfd)
+libc_hidden_proto (svc_max_pollfd)
+libc_hidden_proto (svc_fdset)
+
libc_hidden_proto (xprt_register)
libc_hidden_proto (xprt_unregister)
libc_hidden_proto (svc_register)
@@ -37,4 +43,5 @@ libc_hidden_proto (svc_getreq_poll)
extern void __svc_accept_failed (void) attribute_hidden;
+# endif /* !_ISOMAC */
#endif
diff --git a/include/rpc/svc_auth.h b/include/rpc/svc_auth.h
index 582bb31aea..2609d19544 100644
--- a/include/rpc/svc_auth.h
+++ b/include/rpc/svc_auth.h
@@ -1,6 +1,8 @@
#ifndef _RPC_SVC_AUTH_H
#include <sunrpc/rpc/svc_auth.h>
+# ifndef _ISOMAC
+
/* Now define the internal interfaces. */
extern enum auth_stat _svcauth_unix (struct svc_req *rqst,
struct rpc_msg *msg);
@@ -9,4 +11,5 @@ extern enum auth_stat _svcauth_short (struct svc_req *rqst,
libc_hidden_proto (_authenticate)
+# endif /* !_ISOMAC */
#endif
diff --git a/include/rpc/xdr.h b/include/rpc/xdr.h
index 57971d0758..e1bff1cd1c 100644
--- a/include/rpc/xdr.h
+++ b/include/rpc/xdr.h
@@ -1,5 +1,8 @@
+#ifndef _RPC_XDR_H
#include <sunrpc/rpc/xdr.h>
+# ifndef _ISOMAC
+
libc_hidden_proto (xdrstdio_create)
libc_hidden_proto (xdr_array)
libc_hidden_proto (xdr_bool)
@@ -45,3 +48,6 @@ libc_hidden_proto (xdr_int64_t)
libc_hidden_proto (xdr_uint64_t)
libc_hidden_proto (xdr_quad_t)
libc_hidden_proto (xdr_u_quad_t)
+
+# endif /* !_ISOMAC */
+#endif /* rpc/xdr.h */
diff --git a/include/rpcsvc/nis_callback.h b/include/rpcsvc/nis_callback.h
index dfa9cd3ef7..0515d07887 100644
--- a/include/rpcsvc/nis_callback.h
+++ b/include/rpcsvc/nis_callback.h
@@ -1,7 +1,10 @@
#ifndef _RPCSVC_NIS_CALLBACK_H
#include <nis/rpcsvc/nis_callback.h>
+# ifndef _ISOMAC
+
libnsl_hidden_proto (xdr_obj_p)
libnsl_hidden_proto (xdr_cback_data)
+# endif /* !_ISOMAC */
#endif
diff --git a/include/rpcsvc/nislib.h b/include/rpcsvc/nislib.h
index 635c513e4d..ad4d499911 100644
--- a/include/rpcsvc/nislib.h
+++ b/include/rpcsvc/nislib.h
@@ -1,6 +1,8 @@
#ifndef __RPCSVC_NISLIB_H__
#include <nis/rpcsvc/nislib.h>
+# ifndef _ISOMAC
+
libnsl_hidden_proto (nis_leaf_of_r)
libnsl_hidden_proto (nis_name_of_r)
libnsl_hidden_proto (nis_getnames)
@@ -17,6 +19,7 @@ libnsl_hidden_proto (nis_free_directory)
libnsl_hidden_proto (nis_free_object)
libnsl_hidden_proto (nis_freeresult)
libnsl_hidden_proto (readColdStartFile)
+libnsl_hidden_proto (writeColdStartFile)
libnsl_hidden_proto (nis_print_rights)
libnsl_hidden_proto (nis_print_directory)
libnsl_hidden_proto (nis_print_group)
@@ -39,9 +42,43 @@ libnsl_hidden_proto (nis_remove)
libnsl_hidden_proto (nis_add)
libnsl_hidden_proto (__nis_default_owner)
libnsl_hidden_proto (__nis_default_group)
+libnsl_hidden_proto (__nis_default_ttl)
libnsl_hidden_proto (__nis_default_access)
libnsl_hidden_proto (nis_clone_object)
+libnsl_hidden_proto (nis_clone_result)
+libnsl_hidden_proto (nis_print_group_entry)
+libnsl_hidden_proto (nis_verifygroup)
+libnsl_hidden_proto (nis_leaf_of)
+libnsl_hidden_proto (nis_read_obj)
+libnsl_hidden_proto (nis_print_result)
+libnsl_hidden_proto (nis_sperror)
+libnsl_hidden_proto (nis_add_entry)
+libnsl_hidden_proto (nis_mkdir)
+libnsl_hidden_proto (nis_getservlist)
+libnsl_hidden_proto (nis_stats)
+libnsl_hidden_proto (nis_write_obj)
+libnsl_hidden_proto (nis_servstate)
+libnsl_hidden_proto (nis_freetags)
+libnsl_hidden_proto (nis_modify_entry)
+libnsl_hidden_proto (nis_remove_entry)
+libnsl_hidden_proto (nis_first_entry)
+libnsl_hidden_proto (nis_next_entry)
+libnsl_hidden_proto (nis_checkpoint)
+libnsl_hidden_proto (nis_perror)
+libnsl_hidden_proto (nis_lerror)
+libnsl_hidden_proto (nis_freeservlist)
+libnsl_hidden_proto (nis_ismember)
+libnsl_hidden_proto (nis_creategroup)
+libnsl_hidden_proto (nis_destroygroup)
+libnsl_hidden_proto (nis_name_of)
+libnsl_hidden_proto (nis_ping)
+libnsl_hidden_proto (nis_rmdir)
+libnsl_hidden_proto (nis_addmember)
+libnsl_hidden_proto (nis_removemember)
+libnsl_hidden_proto (nis_domain_of)
+libnsl_hidden_proto (nis_clone_directory)
extern const_nis_name __nis_domain_of (const_nis_name) __THROW;
+# endif /* !_ISOMAC */
#endif
diff --git a/include/rpcsvc/yp.h b/include/rpcsvc/yp.h
index 04a973eae7..87cd3827a7 100644
--- a/include/rpcsvc/yp.h
+++ b/include/rpcsvc/yp.h
@@ -1,6 +1,11 @@
#ifndef __RPCSVC_YP_H__
#include <nis/rpcsvc/yp.h>
+# ifndef _ISOMAC
+
+struct ypall_callback;
+bool_t xdr_ypall (XDR *, struct ypall_callback *);
+
libnsl_hidden_proto (xdr_ypstat)
libnsl_hidden_proto (xdr_ypxfrstat)
libnsl_hidden_proto (xdr_domainname)
@@ -22,5 +27,11 @@ libnsl_hidden_proto (xdr_ypresp_maplist)
libnsl_hidden_proto (xdr_ypresp_order)
libnsl_hidden_proto (xdr_ypbind_resp)
libnsl_hidden_proto (xdr_ypresp_master)
+libnsl_hidden_proto (xdr_ypreq_xfr)
+libnsl_hidden_proto (xdr_ypresp_xfr)
+libnsl_hidden_proto (xdr_yppushresp_xfr)
+libnsl_hidden_proto (xdr_ypbind_setdom)
+libnsl_hidden_proto (xdr_ypall)
+# endif /* !_ISOMAC */
#endif
diff --git a/include/rpcsvc/ypclnt.h b/include/rpcsvc/ypclnt.h
index b38dc6bb4c..c6a724814c 100644
--- a/include/rpcsvc/ypclnt.h
+++ b/include/rpcsvc/ypclnt.h
@@ -1,10 +1,26 @@
#ifndef __RPCSVC_YPCLNT_H__
#include <nis/rpcsvc/ypclnt.h>
+# ifndef _ISOMAC
+
+struct ypmaplist;
+int yp_maplist (const char *, struct ypmaplist **) __THROW;
+
libnsl_hidden_proto (ypbinderr_string)
libnsl_hidden_proto (yp_bind)
libnsl_hidden_proto (yp_get_default_domain)
libnsl_hidden_proto (ypprot_err)
libnsl_hidden_proto (yp_master)
+libnsl_hidden_proto (yp_update)
+libnsl_hidden_proto (yperr_string)
+libnsl_hidden_proto (yp_unbind)
+libnsl_hidden_proto (yp_order)
+libnsl_hidden_proto (yp_first)
+libnsl_hidden_proto (yp_next)
+libnsl_hidden_proto (yp_match)
+libnsl_hidden_proto (yp_all)
+libnsl_hidden_proto (__yp_check)
+libnsl_hidden_proto (yp_maplist)
+# endif /* !_ISOMAC */
#endif
diff --git a/include/rpcsvc/ypupd.h b/include/rpcsvc/ypupd.h
index 7601971512..6d179dd306 100644
--- a/include/rpcsvc/ypupd.h
+++ b/include/rpcsvc/ypupd.h
@@ -1,8 +1,11 @@
#ifndef __RPCSVC_YPUPD_H__
#include <nis/rpcsvc/ypupd.h>
+# ifndef _ISOMAC
+
libnsl_hidden_proto (xdr_yp_buf)
libnsl_hidden_proto (xdr_ypdelete_args)
libnsl_hidden_proto (xdr_ypupdate_args)
+# endif /* !_ISOMAC */
#endif
diff --git a/include/sched.h b/include/sched.h
index 4f59397090..b698f78666 100644
--- a/include/sched.h
+++ b/include/sched.h
@@ -5,6 +5,7 @@
/* Now define the internal interfaces. */
extern int __sched_setparam (__pid_t __pid,
const struct sched_param *__param);
+libc_hidden_proto (__sched_setparam)
extern int __sched_getparam (__pid_t __pid, struct sched_param *__param);
extern int __sched_setscheduler (__pid_t __pid, int __policy,
const struct sched_param *__param);
@@ -13,13 +14,17 @@ extern int __sched_getscheduler (__pid_t __pid);
extern int __sched_yield (void);
libc_hidden_proto (__sched_yield)
extern int __sched_get_priority_max (int __algorithm);
+libc_hidden_proto (__sched_get_priority_max)
extern int __sched_get_priority_min (int __algorithm);
+libc_hidden_proto (__sched_get_priority_min)
extern int __sched_rr_get_interval (__pid_t __pid, struct timespec *__t);
/* These are Linux specific. */
extern int __clone (int (*__fn) (void *__arg), void *__child_stack,
int __flags, void *__arg, ...);
+libc_hidden_proto (__clone)
extern int __clone2 (int (*__fn) (void *__arg), void *__child_stack_base,
size_t __child_stack_size, int __flags, void *__arg, ...);
+libc_hidden_proto (__clone2)
#endif
#endif
diff --git a/include/scratch_buffer.h b/include/scratch_buffer.h
index c59e143d77..32552ee940 100644
--- a/include/scratch_buffer.h
+++ b/include/scratch_buffer.h
@@ -1,5 +1,5 @@
/* Variable-sized buffer with on-stack default allocation.
- Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ Copyright (C) 2015-2018 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,8 +66,7 @@
struct scratch_buffer {
void *data; /* Pointer to the beginning of the scratch area. */
size_t length; /* Allocated space at the data pointer, in bytes. */
- char __space[1024]
- __attribute__ ((aligned (__alignof__ (max_align_t))));
+ union { max_align_t __align; char __c[1024]; } __space;
};
/* Initializes *BUFFER so that BUFFER->data points to BUFFER->__space
@@ -75,7 +74,7 @@ struct scratch_buffer {
static inline void
scratch_buffer_init (struct scratch_buffer *buffer)
{
- buffer->data = buffer->__space;
+ buffer->data = buffer->__space.__c;
buffer->length = sizeof (buffer->__space);
}
@@ -83,7 +82,7 @@ scratch_buffer_init (struct scratch_buffer *buffer)
static inline void
scratch_buffer_free (struct scratch_buffer *buffer)
{
- if (buffer->data != buffer->__space)
+ if (buffer->data != buffer->__space.__c)
free (buffer->data);
}
diff --git a/include/search.h b/include/search.h
index a941959dbe..e17693022d 100644
--- a/include/search.h
+++ b/include/search.h
@@ -24,5 +24,6 @@ libc_hidden_proto (__tdelete)
extern void __twalk (const void *__root, __action_fn_t action);
libc_hidden_proto (__twalk)
extern void __tdestroy (void *__root, __free_fn_t freefct);
+libc_hidden_proto (__tdestroy)
#endif
#endif
diff --git a/include/set-hooks.h b/include/set-hooks.h
index f129cbfd8e..b3bd8b4092 100644
--- a/include/set-hooks.h
+++ b/include/set-hooks.h
@@ -1,5 +1,5 @@
/* Macros for using symbol sets for running lists of functions.
- Copyright (C) 1994-2016 Free Software Foundation, Inc.
+ Copyright (C) 1994-2018 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,11 +22,12 @@
#define __need_size_t
#include <stddef.h>
#include <sys/cdefs.h>
+#include <libc-symbols.h>
#ifdef symbol_set_define
/* Define a hook variable called NAME. Functions put on this hook take
arguments described by PROTO. Use `text_set_element (NAME, FUNCTION)'
- from gnu-stabs.h to add a function to the hook. */
+ from include/libc-symbols.h to add a function to the hook. */
# define DEFINE_HOOK(NAME, PROTO) \
typedef void __##NAME##_hook_function_t PROTO; \
diff --git a/include/setjmp.h b/include/setjmp.h
index 90f46976e3..263bc64b3d 100644
--- a/include/setjmp.h
+++ b/include/setjmp.h
@@ -8,6 +8,9 @@
extern void __longjmp (__jmp_buf __env, int __val)
__attribute__ ((__noreturn__)) attribute_hidden;
+extern void ____longjmp_chk (__jmp_buf __env, int __val)
+ __attribute__ ((__noreturn__)) attribute_hidden;
+
/* Internal function to possibly save the current mask of blocked signals
in ENV, and always set the flag saying whether or not it was saved.
This is used by the machine-dependent definition of `__sigsetjmp'.
@@ -20,14 +23,47 @@ extern void __libc_siglongjmp (sigjmp_buf env, int val)
__attribute__ ((noreturn));
extern void __libc_longjmp (sigjmp_buf env, int val)
__attribute__ ((noreturn));
-libc_hidden_proto (__libc_longjmp)
libc_hidden_proto (_setjmp)
libc_hidden_proto (__sigsetjmp)
-# if IS_IN (rtld)
+# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
extern __typeof (__sigsetjmp) __sigsetjmp attribute_hidden;
# endif
+
+/* Check jmp_buf sizes, alignments and offsets. */
+# include <stddef.h>
+# include <jmp_buf-macros.h>
+
+# define STR_HELPER(x) #x
+# define STR(x) STR_HELPER(x)
+
+# define TEST_SIZE(type, size) \
+ _Static_assert (sizeof (type) == size, \
+ "size of " #type " != " \
+ STR (size))
+# define TEST_ALIGN(type, align) \
+ _Static_assert (__alignof__ (type) == align , \
+ "align of " #type " != " \
+ STR (align))
+# define TEST_OFFSET(type, member, offset) \
+ _Static_assert (offsetof (type, member) == offset, \
+ "offset of " #member " field of " #type " != " \
+ STR (offset))
+
+/* Check if jmp_buf have the expected sizes. */
+TEST_SIZE (jmp_buf, JMP_BUF_SIZE);
+TEST_SIZE (sigjmp_buf, SIGJMP_BUF_SIZE);
+
+/* Check if jmp_buf have the expected alignments. */
+TEST_ALIGN (jmp_buf, JMP_BUF_ALIGN);
+TEST_ALIGN (sigjmp_buf, SIGJMP_BUF_ALIGN);
+
+/* Check if internal fields in jmp_buf have the expected offsets. */
+TEST_OFFSET (struct __jmp_buf_tag, __mask_was_saved,
+ MASK_WAS_SAVED_OFFSET);
+TEST_OFFSET (struct __jmp_buf_tag, __saved_mask,
+ SAVED_MASK_OFFSET);
#endif
#endif
diff --git a/include/shadow.h b/include/shadow.h
index a3f897cba1..366ea83482 100644
--- a/include/shadow.h
+++ b/include/shadow.h
@@ -1,6 +1,8 @@
#ifndef _SHADOW_H
#include <shadow/shadow.h>
+# ifndef _ISOMAC
+
/* Now define the internal interfaces. */
extern int __getspent_r (struct spwd *__result_buf, char *__buffer,
size_t __buflen, struct spwd **__result)
@@ -9,16 +11,17 @@ extern int __old_getspent_r (struct spwd *__result_buf, char *__buffer,
size_t __buflen, struct spwd **__result);
extern int __getspnam_r (const char *__name, struct spwd *__result_buf,
char *__buffer, size_t __buflen,
- struct spwd **__result);
+ struct spwd **__result) attribute_hidden;
extern int __old_getspnam_r (const char *__name, struct spwd *__result_buf,
char *__buffer, size_t __buflen,
struct spwd **__result);
extern int __sgetspent_r (const char *__string,
struct spwd *__result_buf, char *__buffer,
- size_t __buflen, struct spwd **__result);
+ size_t __buflen, struct spwd **__result)
+ attribute_hidden;
extern int __fgetspent_r (FILE *__stream, struct spwd *__result_buf,
char *__buffer, size_t __buflen,
- struct spwd **__result);
+ struct spwd **__result) attribute_hidden;
extern int __lckpwdf (void);
extern int __ulckpwdf (void);
@@ -47,4 +50,5 @@ DECLARE_NSS_PROTOTYPES (nisplus)
#undef DECLARE_NSS_PROTOTYPES
+# endif /* !_ISOMAC */
#endif
diff --git a/include/shlib-compat.h b/include/shlib-compat.h
index c1c5e2c3b1..feacf35f03 100644
--- a/include/shlib-compat.h
+++ b/include/shlib-compat.h
@@ -1,5 +1,5 @@
/* Macros for managing ABI-compatibility definitions using ELF symbol versions.
- Copyright (C) 2000-2016 Free Software Foundation, Inc.
+ Copyright (C) 2000-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -19,10 +19,10 @@
#ifndef _SHLIB_COMPAT_H
#define _SHLIB_COMPAT_H 1
-#ifdef SHARED
-
# include <abi-versions.h>
+#ifdef SHARED
+
/* The file abi-versions.h (generated by scripts/abi-versions.awk) defines
symbols like `ABI_libm_GLIBC_2_0' for each version set in the source
code for each library. For a version set that is subsumed by a later
@@ -62,11 +62,7 @@
default_symbol_version (local, symbol, name)
# define compat_symbol(lib, local, symbol, version) \
- compat_symbol_1 (lib, local, symbol, version)
-# define compat_symbol_1(lib, local, symbol, version) \
- compat_symbol_2 (local, symbol, VERSION_##lib##_##version)
-# define compat_symbol_2(local, symbol, name) \
- symbol_version (local, symbol, name)
+ compat_symbol_reference (lib, local, symbol, version)
#else
@@ -82,6 +78,18 @@
#endif
+/* Use compat_symbol_reference for a reference *or* definition of a
+ specific version of a symbol. Definitions are primarily used to
+ ensure tests reference the exact compat symbol required, or define an
+ interposing symbol of the right version e.g. __malloc_initialize_hook
+ in mcheck-init.c. Use compat_symbol to define such a symbol within
+ the shared libraries that are built for users. */
+#define compat_symbol_reference(lib, local, symbol, version) \
+ compat_symbol_reference_1 (lib, local, symbol, version)
+#define compat_symbol_reference_1(lib, local, symbol, version) \
+ compat_symbol_reference_2 (local, symbol, VERSION_##lib##_##version)
+#define compat_symbol_reference_2(local, symbol, name) \
+ symbol_version_reference (local, symbol, name)
# ifdef LINK_OBSOLETE_RPC
/* Export the symbol for both static and dynamic linking. */
@@ -93,4 +101,14 @@
compat_symbol (libc, name, aliasname, version);
# endif
+/* The TEST_COMPAT macro acts just like the SHLIB_COMPAT macro except
+ that it does not check IS_IN. It is used by tests that are testing
+ functionality that is only available in specific GLIBC versions. */
+
+# define TEST_COMPAT(lib, introduced, obsoleted) \
+ _TEST_COMPAT (lib, introduced, obsoleted)
+# define _TEST_COMPAT(lib, introduced, obsoleted) \
+ (!(ABI_##lib##_##obsoleted - 0) \
+ || ((ABI_##lib##_##introduced - 0) < (ABI_##lib##_##obsoleted - 0)))
+
#endif /* shlib-compat.h */
diff --git a/include/signal.h b/include/signal.h
index 276a99d80a..293258ad65 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -1,7 +1,4 @@
#ifndef _SIGNAL_H
-#if defined __need_sig_atomic_t || defined __need_sigset_t
-# include <signal/signal.h>
-#else
# include <signal/signal.h>
# ifndef _ISOMAC
@@ -20,18 +17,18 @@ libc_hidden_proto (_sys_siglist)
/* Now define the internal interfaces. */
extern __sighandler_t __bsd_signal (int __sig, __sighandler_t __handler);
extern int __kill (__pid_t __pid, int __sig);
+libc_hidden_proto (__kill)
extern int __sigaction (int __sig, const struct sigaction *__restrict __act,
struct sigaction *__restrict __oact);
libc_hidden_proto (__sigaction)
extern int __sigblock (int __mask);
+libc_hidden_proto (__sigblock)
extern int __sigsetmask (int __mask);
extern int __sigprocmask (int __how,
const sigset_t *__set, sigset_t *__oset);
+libc_hidden_proto (__sigprocmask)
extern int __sigsuspend (const sigset_t *__set);
libc_hidden_proto (__sigsuspend)
-#ifndef NO_CANCELLATION
-extern int __sigsuspend_nocancel (const sigset_t *__set) attribute_hidden;
-#endif
extern int __sigwait (const sigset_t *__set, int *__sig);
libc_hidden_proto (__sigwait)
extern int __sigwaitinfo (const sigset_t *__set, siginfo_t *__info);
@@ -44,8 +41,9 @@ extern int __sigqueue (__pid_t __pid, int __sig,
#ifdef __USE_MISC
extern int __sigreturn (struct sigcontext *__scp);
#endif
-extern int __sigaltstack (const struct sigaltstack *__ss,
- struct sigaltstack *__oss);
+extern int __sigaltstack (const stack_t *__ss,
+ stack_t *__oss);
+libc_hidden_proto (__sigaltstack)
extern int __libc_sigaction (int sig, const struct sigaction *act,
struct sigaction *oact);
libc_hidden_proto (__libc_sigaction)
@@ -53,19 +51,13 @@ libc_hidden_proto (__libc_sigaction)
extern int __default_sigpause (int mask);
extern int __xpg_sigpause (int sig);
-/* Simplified sigemptyset() implementation without the parameter checking. */
-#undef __sigemptyset
-#define __sigemptyset(ss) \
- ({ __builtin_memset (ss, '\0', sizeof (sigset_t)); 0; })
-
-
/* Allocate real-time signal with highest/lowest available priority. */
extern int __libc_allocate_rtsig (int __high);
-# if IS_IN (rtld)
+# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
extern __typeof (__sigaction) __sigaction attribute_hidden;
extern __typeof (__libc_sigaction) __libc_sigaction attribute_hidden;
# endif
-# endif
-#endif
-#endif
+
+# endif /* _ISOMAC */
+#endif /* signal.h */
diff --git a/include/stackinfo.h b/include/stackinfo.h
index 5f548c78f9..b87e47f942 100644
--- a/include/stackinfo.h
+++ b/include/stackinfo.h
@@ -1,5 +1,5 @@
/* Details about the machine's stack: wrapper header.
- Copyright (C) 2014-2016 Free Software Foundation, Inc.
+ Copyright (C) 2014-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/include/stap-probe.h b/include/stap-probe.h
index d653b45bcc..95c93fdbbf 100644
--- a/include/stap-probe.h
+++ b/include/stap-probe.h
@@ -1,5 +1,5 @@
/* Macros for defining Systemtap <sys/sdt.h> static probe points.
- Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ Copyright (C) 2012-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/include/stdc-predef.h b/include/stdc-predef.h
index f9f7f731d1..c2ab78a2d4 100644
--- a/include/stdc-predef.h
+++ b/include/stdc-predef.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2018 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,12 +49,12 @@
# define __STDC_IEC_559_COMPLEX__ 1
#endif
-/* wchar_t uses Unicode 8.0.0. Version 8.0 of the Unicode Standard is
- synchronized with ISO/IEC 10646:2014, plus Amendment 1 (published
- 2015-05-15). */
-#define __STDC_ISO_10646__ 201505L
-
-/* We do not support C11 <threads.h>. */
-#define __STDC_NO_THREADS__ 1
+/* wchar_t uses Unicode 10.0.0. Version 10.0 of the Unicode Standard is
+ synchronized with ISO/IEC 10646:2017, fifth edition, plus
+ the following additions from Amendment 1 to the fifth edition:
+ - 56 emoji characters
+ - 285 hentaigana
+ - 3 additional Zanabazar Square characters */
+#define __STDC_ISO_10646__ 201706L
#endif
diff --git a/include/stdio.h b/include/stdio.h
index 1ffbc40b3d..9162d4e247 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -1,57 +1,58 @@
#ifndef _STDIO_H
-# if defined __need_FILE || defined __need___FILE || defined _ISOMAC
-# include <libio/stdio.h>
-# else
-# include <libio/stdio.h>
+# if !defined _ISOMAC && defined _IO_MTSAFE_IO
+# include <stdio-lock.h>
+# endif
+# include <libio/stdio.h>
+# ifndef _ISOMAC
+# define _LIBC_STDIO_H 1
+# include <libio/libio.h>
/* Now define the internal interfaces. */
-__BEGIN_DECLS
-extern int __fcloseall (void);
+extern int __fcloseall (void) attribute_hidden;
extern int __snprintf (char *__restrict __s, size_t __maxlen,
const char *__restrict __format, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
+libc_hidden_proto (__snprintf)
extern int __vsnprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, _G_va_list __arg)
+ const char *__restrict __format, __gnuc_va_list __arg)
__attribute__ ((__format__ (__printf__, 3, 0)));
extern int __vfscanf (FILE *__restrict __s,
const char *__restrict __format,
- _G_va_list __arg)
+ __gnuc_va_list __arg)
__attribute__ ((__format__ (__scanf__, 2, 0)));
libc_hidden_proto (__vfscanf)
extern int __vscanf (const char *__restrict __format,
- _G_va_list __arg)
+ __gnuc_va_list __arg)
__attribute__ ((__format__ (__scanf__, 1, 0)));
-extern _IO_ssize_t __getline (char **__lineptr, size_t *__n,
- FILE *__stream);
+extern __ssize_t __getline (char **__lineptr, size_t *__n,
+ FILE *__stream) attribute_hidden;
extern int __vsscanf (const char *__restrict __s,
const char *__restrict __format,
- _G_va_list __arg)
+ __gnuc_va_list __arg)
__attribute__ ((__format__ (__scanf__, 2, 0)));
-# ifndef __cplusplus
extern int __sprintf_chk (char *, int, size_t, const char *, ...) __THROW;
extern int __snprintf_chk (char *, size_t, int, size_t, const char *, ...)
__THROW;
extern int __vsprintf_chk (char *, int, size_t, const char *,
- _G_va_list) __THROW;
+ __gnuc_va_list) __THROW;
extern int __vsnprintf_chk (char *, size_t, int, size_t, const char *,
- _G_va_list) __THROW;
+ __gnuc_va_list) __THROW;
extern int __printf_chk (int, const char *, ...);
extern int __fprintf_chk (FILE *, int, const char *, ...);
-extern int __vprintf_chk (int, const char *, _G_va_list);
-extern int __vfprintf_chk (FILE *, int, const char *, _G_va_list);
+extern int __vprintf_chk (int, const char *, __gnuc_va_list);
+extern int __vfprintf_chk (FILE *, int, const char *, __gnuc_va_list);
extern char *__fgets_unlocked_chk (char *buf, size_t size, int n, FILE *fp);
extern char *__fgets_chk (char *buf, size_t size, int n, FILE *fp);
extern int __asprintf_chk (char **, int, const char *, ...) __THROW;
-extern int __vasprintf_chk (char **, int, const char *, _G_va_list) __THROW;
+extern int __vasprintf_chk (char **, int, const char *, __gnuc_va_list) __THROW;
extern int __dprintf_chk (int, int, const char *, ...);
-extern int __vdprintf_chk (int, int, const char *, _G_va_list);
+extern int __vdprintf_chk (int, int, const char *, __gnuc_va_list);
extern int __obstack_printf_chk (struct obstack *, int, const char *, ...)
__THROW;
extern int __obstack_vprintf_chk (struct obstack *, int, const char *,
- _G_va_list) __THROW;
-# endif
+ __gnuc_va_list) __THROW;
extern int __isoc99_fscanf (FILE *__restrict __stream,
const char *__restrict __format, ...) __wur;
@@ -60,12 +61,12 @@ extern int __isoc99_sscanf (const char *__restrict __s,
const char *__restrict __format, ...) __THROW;
extern int __isoc99_vfscanf (FILE *__restrict __s,
const char *__restrict __format,
- _G_va_list __arg) __wur;
+ __gnuc_va_list __arg) __wur;
extern int __isoc99_vscanf (const char *__restrict __format,
- _G_va_list __arg) __wur;
+ __gnuc_va_list __arg) __wur;
extern int __isoc99_vsscanf (const char *__restrict __s,
const char *__restrict __format,
- _G_va_list __arg) __THROW;
+ __gnuc_va_list __arg) __THROW;
libc_hidden_proto (__isoc99_vsscanf)
libc_hidden_proto (__isoc99_vfscanf)
@@ -73,64 +74,93 @@ libc_hidden_proto (__isoc99_vfscanf)
extern FILE *__new_tmpfile (void);
extern FILE *__old_tmpfile (void);
-
-
# define __need_size_t
-# define __need_wint_t
# include <stddef.h>
+
+# include <bits/types/wint_t.h>
+
/* Generate a unique file name (and possibly open it). */
extern int __path_search (char *__tmpl, size_t __tmpl_len,
const char *__dir, const char *__pfx,
- int __try_tempdir);
+ int __try_tempdir) attribute_hidden;
extern int __gen_tempname (char *__tmpl, int __suffixlen, int __flags,
- int __kind);
+ int __kind) attribute_hidden;
/* The __kind argument to __gen_tempname may be one of: */
# define __GT_FILE 0 /* create a file */
# define __GT_DIR 1 /* create a directory */
# define __GT_NOCREATE 2 /* just find a name not currently in use */
+enum __libc_message_action
+{
+ do_message = 0, /* Print message. */
+ do_abort = 1 << 0, /* Abort. */
+ do_backtrace = 1 << 1 /* Backtrace. */
+};
+
/* Print out MESSAGE on the error output and abort. */
extern void __libc_fatal (const char *__message)
__attribute__ ((__noreturn__));
-extern void __libc_message (int do_abort, const char *__fnt, ...);
-extern void __fortify_fail (const char *msg)
- __attribute__ ((__noreturn__)) internal_function;
+extern void __libc_message (enum __libc_message_action action,
+ const char *__fnt, ...) attribute_hidden;
+extern void __fortify_fail (const char *msg) __attribute__ ((__noreturn__));
+extern void __fortify_fail_abort (_Bool, const char *msg)
+ __attribute__ ((__noreturn__)) attribute_hidden;
libc_hidden_proto (__fortify_fail)
+libc_hidden_proto (__fortify_fail_abort)
/* Acquire ownership of STREAM. */
-extern void __flockfile (FILE *__stream);
+extern void __flockfile (FILE *__stream) attribute_hidden;
/* Relinquish the ownership granted for STREAM. */
-extern void __funlockfile (FILE *__stream);
+extern void __funlockfile (FILE *__stream) attribute_hidden;
/* Try to acquire ownership of STREAM but do not block if it is not
possible. */
extern int __ftrylockfile (FILE *__stream);
-extern int __getc_unlocked (FILE *__fp);
+extern int __getc_unlocked (FILE *__fp) attribute_hidden;
extern wint_t __getwc_unlocked (FILE *__fp);
extern int __fxprintf (FILE *__fp, const char *__fmt, ...)
- __attribute__ ((__format__ (__printf__, 2, 3)));
+ __attribute__ ((__format__ (__printf__, 2, 3))) attribute_hidden;
+extern int __fxprintf_nocancel (FILE *__fp, const char *__fmt, ...)
+ __attribute__ ((__format__ (__printf__, 2, 3))) attribute_hidden;
+
+/* Read the next line from FP into BUFFER, of LENGTH bytes. LINE will
+ include the line terminator and a NUL terminator. On success,
+ return the length of the line, including the line terminator, but
+ excluding the NUL termintor. On EOF, return zero and write a NUL
+ terminator. On error, return -1 and set errno. If the total byte
+ count (line and both terminators) exceeds LENGTH, return -1 and set
+ errno to ERANGE (but do not mark the stream as failed).
+
+ The behavior is undefined if FP is not seekable, or if the stream
+ is already in an error state. */
+ssize_t __libc_readline_unlocked (FILE *fp, char *buffer, size_t length);
+libc_hidden_proto (__libc_readline_unlocked);
extern const char *const _sys_errlist_internal[] attribute_hidden;
extern int _sys_nerr_internal attribute_hidden;
libc_hidden_proto (__asprintf)
# if IS_IN (libc)
-extern _IO_FILE *_IO_new_fopen (const char*, const char*);
+extern FILE *_IO_new_fopen (const char*, const char*);
# define fopen(fname, mode) _IO_new_fopen (fname, mode)
-extern _IO_FILE *_IO_new_fdopen (int, const char*);
+extern FILE *_IO_new_fdopen (int, const char*);
# define fdopen(fd, mode) _IO_new_fdopen (fd, mode)
-extern int _IO_new_fclose (_IO_FILE*);
+extern int _IO_new_fclose (FILE*);
# define fclose(fp) _IO_new_fclose (fp)
-extern int _IO_fputs (const char*, _IO_FILE*);
+extern int _IO_fputs (const char*, FILE*);
libc_hidden_proto (_IO_fputs)
+/* The compiler may optimize calls to fprintf into calls to fputs.
+ Use libc_hidden_proto to ensure that those calls, not redirected by
+ the fputs macro, also do not go through the PLT. */
+libc_hidden_proto (fputs)
# define fputs(str, fp) _IO_fputs (str, fp)
-extern int _IO_new_fsetpos (_IO_FILE *, const _IO_fpos_t *);
+extern int _IO_new_fsetpos (FILE *, const __fpos_t *);
# define fsetpos(fp, posp) _IO_new_fsetpos (fp, posp)
-extern int _IO_new_fgetpos (_IO_FILE *, _IO_fpos_t *);
+extern int _IO_new_fgetpos (FILE *, __fpos_t *);
# define fgetpos(fp, posp) _IO_new_fgetpos (fp, posp)
# endif
@@ -153,6 +183,10 @@ libc_hidden_proto (fwrite)
libc_hidden_proto (fseek)
extern __typeof (ftello) __ftello;
libc_hidden_proto (__ftello)
+extern __typeof (fseeko64) __fseeko64;
+libc_hidden_proto (__fseeko64)
+extern __typeof (ftello64) __ftello64;
+libc_hidden_proto (__ftello64)
libc_hidden_proto (fflush)
libc_hidden_proto (fflush_unlocked)
extern __typeof (fflush_unlocked) __fflush_unlocked;
@@ -166,6 +200,14 @@ libc_hidden_proto (__fgets_unlocked)
libc_hidden_proto (fputs_unlocked)
extern __typeof (fputs_unlocked) __fputs_unlocked;
libc_hidden_proto (__fputs_unlocked)
+libc_hidden_proto (feof_unlocked)
+extern __typeof (feof_unlocked) __feof_unlocked attribute_hidden;
+libc_hidden_proto (ferror_unlocked)
+extern __typeof (ferror_unlocked) __ferror_unlocked attribute_hidden;
+libc_hidden_proto (getc_unlocked)
+libc_hidden_proto (fputc_unlocked)
+libc_hidden_proto (putc_unlocked)
+extern __typeof (putc_unlocked) __putc_unlocked attribute_hidden;
libc_hidden_proto (fmemopen)
/* The prototype needs repeating instead of using __typeof to use
__THROW in C++ tests. */
@@ -180,28 +222,40 @@ libc_hidden_proto (__vasprintf_chk)
libc_hidden_proto (__vdprintf_chk)
libc_hidden_proto (__obstack_vprintf_chk)
-/* The <stdio.h> header does not include the declaration for gets
- anymore when compiling with _GNU_SOURCE. Provide a copy here. */
-extern char *gets (char *__s);
-# if __USE_FORTIFY_LEVEL > 0
-extern char *__gets_chk (char *__str, size_t) __wur;
-extern char *__REDIRECT (__gets_warn, (char *__str), gets)
- __wur __warnattr ("please use fgets or getline instead, gets can't "
- "specify buffer size");
-
-__fortify_function __wur char *
-gets (char *__str)
+extern FILE * __fmemopen (void *buf, size_t len, const char *mode);
+libc_hidden_proto (__fmemopen)
+
+extern int __gen_tempfd (int flags);
+libc_hidden_proto (__gen_tempfd)
+
+# ifdef __USE_EXTERN_INLINES
+__extern_inline int
+__NTH (__feof_unlocked (FILE *__stream))
{
- if (__bos (__str) != (size_t) -1)
- return __gets_chk (__str, __bos (__str));
- return __gets_warn (__str);
+ return __feof_unlocked_body (__stream);
}
-# endif
-extern FILE * __fmemopen (void *buf, size_t len, const char *mode);
-libc_hidden_proto (__fmemopen)
+__extern_inline int
+__NTH (__ferror_unlocked (FILE *__stream))
+{
+ return __ferror_unlocked_body (__stream);
+}
-__END_DECLS
-# endif
+__extern_inline int
+__getc_unlocked (FILE *__fp)
+{
+ return __getc_unlocked_body (__fp);
+}
+
+__extern_inline int
+__putc_unlocked (int __c, FILE *__stream)
+{
+ return __putc_unlocked_body (__c, __stream);
+}
+# endif
+
+extern __typeof (renameat) __renameat;
+libc_hidden_proto (__renameat)
-#endif
+# endif /* not _ISOMAC */
+#endif /* stdio.h */
diff --git a/include/stdio_ext.h b/include/stdio_ext.h
index 354146f8e8..29c6e68cdb 100644
--- a/include/stdio_ext.h
+++ b/include/stdio_ext.h
@@ -1,6 +1,7 @@
#ifndef _STDIO_EXT_H
+#include <stdio-common/stdio_ext.h>
-# include <stdio-common/stdio_ext.h>
+# ifndef _ISOMAC
libc_hidden_proto (__fsetlocking)
@@ -18,5 +19,5 @@ libc_hidden_proto (__fsetlocking)
__result; \
})
-
-#endif
+# endif /* !_ISOMAC */
+#endif /* stdio_ext.h */
diff --git a/include/stdlib.h b/include/stdlib.h
index 352339e859..114e12d255 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -1,20 +1,14 @@
#ifndef _STDLIB_H
-#ifdef __need_malloc_and_calloc
-#define __Need_M_And_C
-#endif
-
#ifndef _ISOMAC
# include <stddef.h>
#endif
#include <stdlib/stdlib.h>
/* Now define the internal interfaces. */
-#if !defined __Need_M_And_C && !defined _ISOMAC
+#if !defined _ISOMAC
# include <sys/stat.h>
-__BEGIN_DECLS
-
extern __typeof (strtol_l) __strtol_l;
extern __typeof (strtoul_l) __strtoul_l;
extern __typeof (strtoll_l) __strtoll_l;
@@ -42,56 +36,65 @@ libc_hidden_proto (__qsort_r)
libc_hidden_proto (lrand48_r)
libc_hidden_proto (wctomb)
-extern long int __random (void);
+extern long int __random (void) attribute_hidden;
extern void __srandom (unsigned int __seed);
extern char *__initstate (unsigned int __seed, char *__statebuf,
size_t __statelen);
extern char *__setstate (char *__statebuf);
-extern int __random_r (struct random_data *__buf, int32_t *__result);
-extern int __srandom_r (unsigned int __seed, struct random_data *__buf);
+extern int __random_r (struct random_data *__buf, int32_t *__result)
+ attribute_hidden;
+extern int __srandom_r (unsigned int __seed, struct random_data *__buf)
+ attribute_hidden;
extern int __initstate_r (unsigned int __seed, char *__statebuf,
- size_t __statelen, struct random_data *__buf);
-extern int __setstate_r (char *__statebuf, struct random_data *__buf);
+ size_t __statelen, struct random_data *__buf)
+ attribute_hidden;
+extern int __setstate_r (char *__statebuf, struct random_data *__buf)
+ attribute_hidden;
extern int __rand_r (unsigned int *__seed);
extern int __erand48_r (unsigned short int __xsubi[3],
- struct drand48_data *__buffer, double *__result);
+ struct drand48_data *__buffer, double *__result)
+ attribute_hidden;
extern int __nrand48_r (unsigned short int __xsubi[3],
struct drand48_data *__buffer,
- long int *__result);
+ long int *__result) attribute_hidden;
extern int __jrand48_r (unsigned short int __xsubi[3],
struct drand48_data *__buffer,
- long int *__result);
+ long int *__result) attribute_hidden;
extern int __srand48_r (long int __seedval,
- struct drand48_data *__buffer);
+ struct drand48_data *__buffer) attribute_hidden;
extern int __seed48_r (unsigned short int __seed16v[3],
- struct drand48_data *__buffer);
+ struct drand48_data *__buffer) attribute_hidden;
extern int __lcong48_r (unsigned short int __param[7],
- struct drand48_data *__buffer);
+ struct drand48_data *__buffer) attribute_hidden;
/* Internal function to compute next state of the generator. */
extern int __drand48_iterate (unsigned short int __xsubi[3],
- struct drand48_data *__buffer);
+ struct drand48_data *__buffer)
+ attribute_hidden;
/* Global state for non-reentrant functions. Defined in drand48-iter.c. */
extern struct drand48_data __libc_drand48_data attribute_hidden;
-extern int __setenv (const char *__name, const char *__value, int __replace);
-extern int __unsetenv (const char *__name);
-extern int __clearenv (void);
+extern int __setenv (const char *__name, const char *__value, int __replace)
+ attribute_hidden;
+extern int __unsetenv (const char *__name) attribute_hidden;
+extern int __clearenv (void) attribute_hidden;
extern char *__mktemp (char *__template) __THROW __nonnull ((1));
extern char *__canonicalize_file_name (const char *__name);
extern char *__realpath (const char *__name, char *__resolved);
-extern int __ptsname_r (int __fd, char *__buf, size_t __buflen);
+libc_hidden_proto (__realpath)
+extern int __ptsname_r (int __fd, char *__buf, size_t __buflen)
+ attribute_hidden;
# ifndef _ISOMAC
extern int __ptsname_internal (int fd, char *buf, size_t buflen,
- struct stat64 *stp);
+ struct stat64 *stp) attribute_hidden;
# endif
extern int __getpt (void);
-extern int __posix_openpt (int __oflag);
+extern int __posix_openpt (int __oflag) attribute_hidden;
extern int __add_to_environ (const char *name, const char *value,
- const char *combines, int replace);
-
+ const char *combines, int replace)
+ attribute_hidden;
extern void _quicksort (void *const pbase, size_t total_elems,
size_t size, __compar_d_fn_t cmp, void *arg);
@@ -116,6 +119,10 @@ extern int __posix_memalign (void **memptr, size_t alignment, size_t size);
extern void *__libc_memalign (size_t alignment, size_t size)
__attribute_malloc__;
+extern void *__libc_reallocarray (void *__ptr, size_t __nmemb, size_t __size)
+ __THROW __attribute_warn_unused_result__;
+libc_hidden_proto (__libc_reallocarray)
+
extern int __libc_system (const char *line);
@@ -158,34 +165,34 @@ libc_hidden_proto (__strtoull_internal)
extern double ____strtod_l_internal (const char *__restrict __nptr,
char **__restrict __endptr, int __group,
- __locale_t __loc);
+ locale_t __loc);
extern float ____strtof_l_internal (const char *__restrict __nptr,
char **__restrict __endptr, int __group,
- __locale_t __loc);
+ locale_t __loc);
extern long double ____strtold_l_internal (const char *__restrict __nptr,
char **__restrict __endptr,
- int __group, __locale_t __loc);
+ int __group, locale_t __loc);
extern long int ____strtol_l_internal (const char *__restrict __nptr,
char **__restrict __endptr,
int __base, int __group,
- __locale_t __loc);
+ locale_t __loc);
extern unsigned long int ____strtoul_l_internal (const char *
__restrict __nptr,
char **__restrict __endptr,
int __base, int __group,
- __locale_t __loc);
+ locale_t __loc);
__extension__
extern long long int ____strtoll_l_internal (const char *__restrict __nptr,
char **__restrict __endptr,
int __base, int __group,
- __locale_t __loc);
+ locale_t __loc);
__extension__
extern unsigned long long int ____strtoull_l_internal (const char *
__restrict __nptr,
char **
__restrict __endptr,
int __base, int __group,
- __locale_t __loc);
+ locale_t __loc);
libc_hidden_proto (____strtof_l_internal)
libc_hidden_proto (____strtod_l_internal)
@@ -203,16 +210,14 @@ libc_hidden_proto (strtoll)
libc_hidden_proto (strtoul)
libc_hidden_proto (strtoull)
-extern float __strtof_nan (const char *, char **, char) internal_function;
-extern double __strtod_nan (const char *, char **, char) internal_function;
-extern long double __strtold_nan (const char *, char **, char)
- internal_function;
-extern float __wcstof_nan (const wchar_t *, wchar_t **, wchar_t)
- internal_function;
-extern double __wcstod_nan (const wchar_t *, wchar_t **, wchar_t)
- internal_function;
-extern long double __wcstold_nan (const wchar_t *, wchar_t **, wchar_t)
- internal_function;
+libc_hidden_proto (atoi)
+
+extern float __strtof_nan (const char *, char **, char);
+extern double __strtod_nan (const char *, char **, char);
+extern long double __strtold_nan (const char *, char **, char);
+extern float __wcstof_nan (const wchar_t *, wchar_t **, wchar_t);
+extern double __wcstod_nan (const wchar_t *, wchar_t **, wchar_t);
+extern long double __wcstold_nan (const wchar_t *, wchar_t **, wchar_t);
libc_hidden_proto (__strtof_nan)
libc_hidden_proto (__strtod_nan)
@@ -221,6 +226,33 @@ libc_hidden_proto (__wcstof_nan)
libc_hidden_proto (__wcstod_nan)
libc_hidden_proto (__wcstold_nan)
+/* Enable _FloatN bits as needed. */
+#include <bits/floatn.h>
+
+#if __HAVE_DISTINCT_FLOAT128
+extern __typeof (strtof128_l) __strtof128_l;
+
+libc_hidden_proto (__strtof128_l)
+libc_hidden_proto (strtof128)
+
+extern _Float128 __strtof128_nan (const char *, char **, char);
+extern _Float128 __wcstof128_nan (const wchar_t *, wchar_t **, wchar_t);
+
+libc_hidden_proto (__strtof128_nan)
+libc_hidden_proto (__wcstof128_nan)
+
+extern _Float128 __strtof128_internal (const char *__restrict __nptr,
+ char **__restrict __endptr,
+ int __group);
+libc_hidden_proto (__strtof128_internal)
+
+extern _Float128 ____strtof128_l_internal (const char *__restrict __nptr,
+ char **__restrict __endptr,
+ int __group, locale_t __loc);
+
+libc_hidden_proto (____strtof128_l_internal)
+#endif
+
extern char *__ecvt (double __value, int __ndigit, int *__restrict __decpt,
int *__restrict __sign);
extern char *__fcvt (double __value, int __ndigit, int *__restrict __decpt,
@@ -229,9 +261,11 @@ extern char *__gcvt (double __value, int __ndigit, char *__buf);
extern int __ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
int *__restrict __sign, char *__restrict __buf,
size_t __len);
+libc_hidden_proto (__ecvt_r)
extern int __fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
int *__restrict __sign, char *__restrict __buf,
size_t __len);
+libc_hidden_proto (__fcvt_r)
extern char *__qecvt (long double __value, int __ndigit,
int *__restrict __decpt, int *__restrict __sign);
extern char *__qfcvt (long double __value, int __ndigit,
@@ -240,9 +274,11 @@ extern char *__qgcvt (long double __value, int __ndigit, char *__buf);
extern int __qecvt_r (long double __value, int __ndigit,
int *__restrict __decpt, int *__restrict __sign,
char *__restrict __buf, size_t __len);
+libc_hidden_proto (__qecvt_r)
extern int __qfcvt_r (long double __value, int __ndigit,
int *__restrict __decpt, int *__restrict __sign,
char *__restrict __buf, size_t __len);
+libc_hidden_proto (__qfcvt_r)
# if IS_IN (libc)
# undef MB_CUR_MAX
@@ -260,15 +296,11 @@ struct abort_msg_s
extern struct abort_msg_s *__abort_msg;
libc_hidden_proto (__abort_msg)
-# if IS_IN (rtld)
+# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
extern __typeof (unsetenv) unsetenv attribute_hidden;
extern __typeof (__strtoul_internal) __strtoul_internal attribute_hidden;
# endif
-__END_DECLS
-
#endif
-#undef __Need_M_And_C
-
#endif /* include/stdlib.h */
diff --git a/include/string.h b/include/string.h
index e145bfdb4c..4d622f1c03 100644
--- a/include/string.h
+++ b/include/string.h
@@ -1,6 +1,8 @@
#ifndef _STRING_H
#ifndef _ISOMAC
+/* Some of these are defined as macros in the real string.h, so we must
+ prototype them before including it. */
#include <sys/types.h>
extern void *__memccpy (void *__dest, const void *__src,
@@ -10,6 +12,7 @@ extern size_t __strnlen (const char *__string, size_t __maxlen)
__attribute_pure__;
extern char *__strsep (char **__stringp, const char *__delim);
+libc_hidden_proto (__strsep)
extern int __strverscmp (const char *__s1, const char *__s2)
__attribute_pure__;
@@ -41,16 +44,19 @@ extern void *__memrchr (const void *__s, int __c, size_t __n)
extern void *__memchr (const void *__s, int __c, size_t __n)
__attribute_pure__;
+extern void __bzero (void *__s, size_t __n) __THROW __nonnull ((1));
+
extern int __ffs (int __i) __attribute__ ((const));
extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen);
-#endif
+
+/* Called as part of the thread shutdown sequence. */
+void __strerror_thread_freeres (void) attribute_hidden;
/* Get _STRING_ARCH_unaligned. */
#include <string_private.h>
+#endif
-/* Now the real definitions. We do this here since some of the functions
- above are defined as macros in the headers. */
#include <string/string.h>
#ifndef _ISOMAC
@@ -74,12 +80,20 @@ extern __typeof (strncasecmp_l) __strncasecmp_l;
#endif
libc_hidden_proto (__mempcpy)
+#ifndef __NO_STRING_INLINES
+# define __mempcpy(dest, src, n) __builtin_mempcpy (dest, src, n)
+#endif
libc_hidden_proto (__stpcpy)
+#ifndef __NO_STRING_INLINES
+# define __stpcpy(dest, src) __builtin_stpcpy (dest, src)
+#endif
libc_hidden_proto (__stpncpy)
libc_hidden_proto (__rawmemchr)
libc_hidden_proto (__strcasecmp)
libc_hidden_proto (__strcasecmp_l)
libc_hidden_proto (__strncasecmp_l)
+extern __typeof (strncat) __strncat;
+libc_hidden_proto (__strncat)
libc_hidden_proto (__strdup)
libc_hidden_proto (__strndup)
libc_hidden_proto (__strerror_r)
@@ -100,6 +114,17 @@ extern __typeof (memmem) __memmem;
libc_hidden_proto (__memmem)
libc_hidden_proto (__ffs)
+#if IS_IN (libc)
+/* Avoid hidden reference to IFUNC symbol __explicit_bzero_chk. */
+void __explicit_bzero_chk_internal (void *, size_t, size_t)
+ __THROW __nonnull ((1)) attribute_hidden;
+# define explicit_bzero(buf, len) \
+ __explicit_bzero_chk_internal (buf, len, __bos0 (buf))
+#elif !IS_IN (nonlib)
+void __explicit_bzero_chk (void *, size_t, size_t) __THROW __nonnull ((1));
+# define explicit_bzero(buf, len) __explicit_bzero_chk (buf, len, __bos0 (buf))
+#endif
+
libc_hidden_builtin_proto (memchr)
libc_hidden_builtin_proto (memcpy)
libc_hidden_builtin_proto (mempcpy)
@@ -121,7 +146,7 @@ libc_hidden_builtin_proto (strspn)
libc_hidden_builtin_proto (strstr)
libc_hidden_builtin_proto (ffs)
-#if IS_IN (rtld)
+#if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
extern __typeof (__stpcpy) __stpcpy attribute_hidden;
extern __typeof (__strdup) __strdup attribute_hidden;
extern __typeof (__strerror_r) __strerror_r attribute_hidden;
@@ -149,15 +174,6 @@ extern __typeof (mempcpy) mempcpy __asm__ ("__mempcpy");
extern __typeof (stpcpy) stpcpy __asm__ ("__stpcpy");
#endif
-# ifndef _ISOMAC
-# ifndef index
-# define index(s, c) (strchr ((s), (c)))
-# endif
-# ifndef rindex
-# define rindex(s, c) (strrchr ((s), (c)))
-# endif
-# endif
-
extern void *__memcpy_chk (void *__restrict __dest,
const void *__restrict __src, size_t __len,
size_t __destlen) __THROW;
diff --git a/include/sys/auxv.h b/include/sys/auxv.h
new file mode 100644
index 0000000000..3bab6d05d4
--- /dev/null
+++ b/include/sys/auxv.h
@@ -0,0 +1,8 @@
+#include <misc/sys/auxv.h>
+
+#ifndef _ISOMAC
+
+extern __typeof (getauxval) __getauxval;
+libc_hidden_proto (__getauxval)
+
+#endif /* !_ISOMAC */
diff --git a/include/sys/epoll.h b/include/sys/epoll.h
index ce1c2e26d5..86e0a54e62 100644
--- a/include/sys/epoll.h
+++ b/include/sys/epoll.h
@@ -1,6 +1,9 @@
#ifndef _SYS_EPOLL_H
#include_next <sys/epoll.h>
+# ifndef _ISOMAC
+
libc_hidden_proto (epoll_pwait)
+# endif /* !_ISOMAC */
#endif
diff --git a/include/sys/file.h b/include/sys/file.h
index e73a4d1c94..d0cd1f9e15 100644
--- a/include/sys/file.h
+++ b/include/sys/file.h
@@ -1,6 +1,10 @@
#ifndef _SYS_FILE_H
#include <misc/sys/file.h>
+# ifndef _ISOMAC
+
/* Now define the internal interfaces. */
extern int __flock (int __fd, int __operation);
+
+# endif /* !_ISOMAC */
#endif
diff --git a/include/sys/gmon.h b/include/sys/gmon.h
index 55739cf00c..06b07fb2a5 100644
--- a/include/sys/gmon.h
+++ b/include/sys/gmon.h
@@ -1,15 +1,15 @@
#ifndef _SYS_GMON_H
#include <gmon/sys/gmon.h>
+# ifndef _ISOMAC
+
/* Now define the internal interfaces. */
/* Write current profiling data to file. */
extern void __write_profiling (void);
extern void write_profiling (void);
-struct __bb;
-extern void __bb_init_func (struct __bb *bb);
-extern void __bb_exit_func (void);
-
extern struct gmonparam _gmonparam attribute_hidden;
+
+# endif /* !_ISOMAC */
#endif
diff --git a/include/sys/ioctl.h b/include/sys/ioctl.h
index ebadd526b9..dd7c3c7c9c 100644
--- a/include/sys/ioctl.h
+++ b/include/sys/ioctl.h
@@ -1,6 +1,11 @@
#ifndef _SYS_IOCTL_H
#include <misc/sys/ioctl.h>
+# ifndef _ISOMAC
+
/* Now define the internal interfaces. */
extern int __ioctl (int __fd, unsigned long int __request, ...);
+libc_hidden_proto (__ioctl)
+
+# endif /* !_ISOMAC */
#endif
diff --git a/include/sys/mman.h b/include/sys/mman.h
index 7026f69f42..503edaae88 100644
--- a/include/sys/mman.h
+++ b/include/sys/mman.h
@@ -5,10 +5,14 @@
/* Now define the internal interfaces. */
extern void *__mmap (void *__addr, size_t __len, int __prot,
int __flags, int __fd, __off_t __offset);
+libc_hidden_proto (__mmap)
extern void *__mmap64 (void *__addr, size_t __len, int __prot,
int __flags, int __fd, __off64_t __offset);
+libc_hidden_proto (__mmap64)
extern int __munmap (void *__addr, size_t __len);
+libc_hidden_proto (__munmap)
extern int __mprotect (void *__addr, size_t __len, int __prot);
+libc_hidden_proto (__mprotect)
extern int __madvise (void *__addr, size_t __len, int __advice);
libc_hidden_proto (__madvise)
@@ -16,6 +20,7 @@ libc_hidden_proto (__madvise)
/* This one is Linux specific. */
extern void *__mremap (void *__addr, size_t __old_len,
size_t __new_len, int __flags, ...);
+libc_hidden_proto (__mremap)
# if IS_IN (rtld)
# include <dl-mman.h>
diff --git a/include/sys/prctl.h b/include/sys/prctl.h
index 316f454c1c..0920ed642b 100644
--- a/include/sys/prctl.h
+++ b/include/sys/prctl.h
@@ -1,6 +1,9 @@
#ifndef _SYS_PRCTL_H
#include_next <sys/prctl.h>
+# ifndef _ISOMAC
+
extern int __prctl (int __option, ...);
+# endif /* !_ISOMAC */
#endif
diff --git a/include/sys/profil.h b/include/sys/profil.h
index 7bf17003ad..2b1133073e 100644
--- a/include/sys/profil.h
+++ b/include/sys/profil.h
@@ -1,9 +1,12 @@
#ifndef _PROFIL_H
#include <gmon/sys/profil.h>
+# ifndef _ISOMAC
+
/* Now define the internal interfaces. */
extern int __sprofil (struct prof *__profp, int __profcnt,
struct timeval *__tvp, unsigned int __flags);
+# endif /* !_ISOMAC */
#endif /* _PROFIL_H */
diff --git a/include/sys/resource.h b/include/sys/resource.h
index 688c46c4ae..c55d4e63bd 100644
--- a/include/sys/resource.h
+++ b/include/sys/resource.h
@@ -23,5 +23,6 @@ extern int __getrusage (enum __rusage_who __who, struct rusage *__usage)
extern int __setrlimit (enum __rlimit_resource __resource,
const struct rlimit *__rlimits);
+libc_hidden_proto (__setrlimit);
#endif
#endif
diff --git a/include/sys/sendfile.h b/include/sys/sendfile.h
index abe09769cc..b88cca27b8 100644
--- a/include/sys/sendfile.h
+++ b/include/sys/sendfile.h
@@ -1 +1,7 @@
#include <io/sys/sendfile.h>
+
+#ifndef _ISOMAC
+
+extern __typeof (sendfile64) __sendfile64 attribute_hidden;
+
+#endif
diff --git a/include/sys/socket.h b/include/sys/socket.h
index a00ab3cf93..26db0e0d77 100644
--- a/include/sys/socket.h
+++ b/include/sys/socket.h
@@ -20,7 +20,7 @@ extern int __socketpair (int __domain, int __type, int __protocol,
/* Return a socket of any type. The socket can be used in subsequent
ioctl calls to talk to the kernel. */
-extern int __opensock (void) internal_function attribute_hidden;
+extern int __opensock (void) attribute_hidden;
/* Put the address of the peer connected to socket FD into *ADDR
(which is *LEN bytes long), and its actual length into *LEN. */
@@ -154,5 +154,7 @@ libc_hidden_proto (__libc_sa_len)
# define SA_LEN(_x) __libc_sa_len((_x)->sa_family)
#endif
+libc_hidden_proto (__cmsg_nxthdr)
+
#endif
#endif
diff --git a/include/sys/stat.h b/include/sys/stat.h
index 4f31c00eca..b82d452780 100644
--- a/include/sys/stat.h
+++ b/include/sys/stat.h
@@ -7,12 +7,14 @@ extern int __stat (const char *__file, struct stat *__buf);
extern int __fstat (int __fd, struct stat *__buf);
extern int __lstat (const char *__file, struct stat *__buf);
extern int __chmod (const char *__file, __mode_t __mode);
+libc_hidden_proto (__chmod)
extern int __fchmod (int __fd, __mode_t __mode);
extern __mode_t __umask (__mode_t __mask);
extern int __mkdir (const char *__path, __mode_t __mode);
+libc_hidden_proto (__mkdir)
extern int __mknod (const char *__path,
__mode_t __mode, __dev_t __dev);
-#if IS_IN (libc) || IS_IN (rtld)
+#if IS_IN (libc) || (IS_IN (rtld) && !defined NO_RTLD_HIDDEN)
hidden_proto (__fxstat)
hidden_proto (__fxstat64)
hidden_proto (__lxstat)
@@ -35,7 +37,7 @@ libc_hidden_proto (__xmknodat)
libc_hidden_proto (__fxstatat)
libc_hidden_proto (__fxstatat64)
-# if IS_IN (rtld)
+# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
extern __typeof (__fxstatat64) __fxstatat64 attribute_hidden;
# endif
diff --git a/include/sys/statfs.h b/include/sys/statfs.h
index e34ad02965..8a9f5a7b3b 100644
--- a/include/sys/statfs.h
+++ b/include/sys/statfs.h
@@ -1,10 +1,17 @@
#ifndef _SYS_STATFS_H
#include <io/sys/statfs.h>
+# ifndef _ISOMAC
+
/* Now define the internal interfaces. */
extern int __statfs (const char *__file, struct statfs *__buf);
libc_hidden_proto (__statfs)
-extern int __fstatfs (int __fildes, struct statfs *__buf);
-extern int __statfs64 (const char *__file, struct statfs64 *__buf);
-extern int __fstatfs64 (int __fildes, struct statfs64 *__buf);
+extern int __fstatfs (int __fildes, struct statfs *__buf)
+ attribute_hidden;
+extern int __statfs64 (const char *__file, struct statfs64 *__buf)
+ attribute_hidden;
+extern int __fstatfs64 (int __fildes, struct statfs64 *__buf)
+ attribute_hidden;
+
+# endif /* !_ISOMAC */
#endif
diff --git a/include/sys/statvfs.h b/include/sys/statvfs.h
index fa3045386d..4cd1977c35 100644
--- a/include/sys/statvfs.h
+++ b/include/sys/statvfs.h
@@ -3,8 +3,10 @@
#ifndef _ISOMAC
/* Now define the internal interfaces. */
-extern int __statvfs64 (const char *__file, struct statvfs64 *__buf);
-extern int __fstatvfs64 (int __fildes, struct statvfs64 *__buf);
+extern int __statvfs64 (const char *__file, struct statvfs64 *__buf)
+ attribute_hidden;
+extern int __fstatvfs64 (int __fildes, struct statvfs64 *__buf)
+ attribute_hidden;
libc_hidden_proto (statvfs)
libc_hidden_proto (fstatvfs)
diff --git a/include/sys/sysctl.h b/include/sys/sysctl.h
index 4fffb4ff49..2a15e91354 100644
--- a/include/sys/sysctl.h
+++ b/include/sys/sysctl.h
@@ -1,10 +1,13 @@
#ifndef _SYS_SYSCTL_H
#include_next <sys/sysctl.h>
+# ifndef _ISOMAC
+
/* Read or write system parameters (Linux, FreeBSD specific). */
extern int __sysctl (int *__name, int __nlen, void *__oldval,
size_t *__oldlenp, void *__newval, size_t __newlen);
libc_hidden_proto (__sysctl)
+# endif /* !_ISOMAC */
#endif /* _SYS_SYSCTL_H */
diff --git a/include/sys/sysinfo.h b/include/sys/sysinfo.h
index d33055a2b3..7388356a19 100644
--- a/include/sys/sysinfo.h
+++ b/include/sys/sysinfo.h
@@ -1,21 +1,28 @@
#ifndef _SYS_SYSINFO_H
#include_next <sys/sysinfo.h>
+# ifndef _ISOMAC
+
/* Now we define the internal interface. */
/* Return number of configured processors. */
extern int __get_nprocs_conf (void);
+libc_hidden_proto (__get_nprocs_conf)
/* Return number of available processors. */
extern int __get_nprocs (void);
+libc_hidden_proto (__get_nprocs)
/* Return number of physical pages of memory in the system. */
extern long int __get_phys_pages (void);
+libc_hidden_proto (__get_phys_pages)
/* Return number of available physical pages of memory in the system. */
extern long int __get_avphys_pages (void);
+libc_hidden_proto (__get_avphys_pages)
/* Return maximum number of processes this real user ID can have. */
-extern long int __get_child_max (void);
+extern long int __get_child_max (void) attribute_hidden;
+# endif /* !_ISOMAC */
#endif /* sys/sysinfo.h */
diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h
new file mode 100644
index 0000000000..3c2b9c2689
--- /dev/null
+++ b/include/sys/sysmacros.h
@@ -0,0 +1,52 @@
+/* Definitions of macros to access 'dev_t' values. Internal header.
+ Copyright (C) 2018 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/>. */
+
+#ifndef _ISOMAC
+# define __SYSMACROS_NEED_IMPLEMENTATION
+#endif
+
+#include <misc/sys/sysmacros.h>
+
+#if !defined _SYS_SYSMACROS_H_WRAPPER && !defined _ISOMAC
+# define _SYS_SYSMACROS_H_WRAPPER 1
+
+libc_hidden_proto (gnu_dev_major)
+libc_hidden_proto (gnu_dev_minor)
+libc_hidden_proto (gnu_dev_makedev)
+
+# undef __SYSMACROS_DECL_TEMPL
+# define __SYSMACROS_DECL_TEMPL(rtype, name, proto) \
+ extern rtype __gnu_dev_##name proto \
+ __THROW __attribute_const__ attribute_hidden;
+
+# undef __SYSMACROS_IMPL_TEMPL
+# define __SYSMACROS_IMPL_TEMPL(rtype, name, proto) \
+ __extension__ __extern_inline __attribute_const__ rtype \
+ __NTH (__gnu_dev_##name proto)
+
+__SYSMACROS_DECLARE_MAJOR (__SYSMACROS_DECL_TEMPL)
+__SYSMACROS_DECLARE_MINOR (__SYSMACROS_DECL_TEMPL)
+__SYSMACROS_DECLARE_MAKEDEV (__SYSMACROS_DECL_TEMPL)
+
+# ifdef __USE_EXTERN_INLINES
+__SYSMACROS_DEFINE_MAJOR (__SYSMACROS_IMPL_TEMPL)
+__SYSMACROS_DEFINE_MINOR (__SYSMACROS_IMPL_TEMPL)
+__SYSMACROS_DEFINE_MAKEDEV (__SYSMACROS_IMPL_TEMPL)
+# endif
+
+#endif
diff --git a/include/sys/time.h b/include/sys/time.h
index 41bf458141..98f6b6b2cc 100644
--- a/include/sys/time.h
+++ b/include/sys/time.h
@@ -1,5 +1,5 @@
/* Time function internal interfaces.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
+ Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/include/sys/uio.h b/include/sys/uio.h
index f44ce182ba..204c4b906d 100644
--- a/include/sys/uio.h
+++ b/include/sys/uio.h
@@ -5,7 +5,15 @@
/* Now define the internal interfaces. */
extern ssize_t __readv (int __fd, const struct iovec *__iovec,
int __count);
+libc_hidden_proto (__readv)
extern ssize_t __writev (int __fd, const struct iovec *__iovec,
int __count);
+libc_hidden_proto (__writev)
+
+/* Used for p{read,write}{v64}v2 implementation. */
+libc_hidden_proto (preadv)
+libc_hidden_proto (preadv64)
+libc_hidden_proto (pwritev)
+libc_hidden_proto (pwritev64)
#endif
#endif
diff --git a/include/sys/utsname.h b/include/sys/utsname.h
index 14f4247dd4..9ed5fa2565 100644
--- a/include/sys/utsname.h
+++ b/include/sys/utsname.h
@@ -7,7 +7,7 @@ extern int __uname (struct utsname *__name);
libc_hidden_proto (uname)
libc_hidden_proto (__uname)
-# if IS_IN (rtld)
+# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
extern __typeof (__uname) __uname attribute_hidden;
# endif
#endif
diff --git a/include/sys/wait.h b/include/sys/wait.h
index 9a38e61be7..5ac9cd6ca6 100644
--- a/include/sys/wait.h
+++ b/include/sys/wait.h
@@ -9,10 +9,10 @@ libc_hidden_proto (__waitpid)
extern int __waitid (idtype_t idtype, id_t id, siginfo_t *infop, int options);
extern __pid_t __libc_wait (int *__stat_loc);
-extern __pid_t __wait (__WAIT_STATUS __stat_loc);
-extern __pid_t __wait3 (__WAIT_STATUS __stat_loc,
+extern __pid_t __wait (int *__stat_loc);
+extern __pid_t __wait3 (int *__stat_loc,
int __options, struct rusage * __usage);
-extern __pid_t __wait4 (__pid_t __pid, __WAIT_STATUS __stat_loc,
+extern __pid_t __wait4 (__pid_t __pid, int *__stat_loc,
int __options, struct rusage *__usage)
attribute_hidden;
#endif
diff --git a/include/termios.h b/include/termios.h
index fad51f8385..e2c35ebbae 100644
--- a/include/termios.h
+++ b/include/termios.h
@@ -4,9 +4,12 @@
#ifndef _ISOMAC
/* Now define the internal interfaces. */
extern int __tcgetattr (int __fd, struct termios *__termios_p);
+extern int __tcsetattr (int __fd, int __optional_actions,
+ const struct termios *__termios_p);
extern int __libc_tcdrain (int __fd);
+libc_hidden_proto (__tcgetattr)
libc_hidden_proto (tcsetattr)
libc_hidden_proto (cfsetispeed)
libc_hidden_proto (cfsetospeed)
diff --git a/include/time.h b/include/time.h
index 8dd10dcdd8..23d2580528 100644
--- a/include/time.h
+++ b/include/time.h
@@ -1,11 +1,8 @@
#ifndef _TIME_H
-#if defined __need_time_t || defined __need_clock_t || defined __need_timespec || defined _ISOMAC
-# include <time/time.h>
-#else
-# include <time/time.h>
-# include <xlocale.h>
+#include <time/time.h>
-__BEGIN_DECLS
+#ifndef _ISOMAC
+# include <bits/types/locale_t.h>
extern __typeof (strftime_l) __strftime_l;
libc_hidden_proto (__strftime_l)
@@ -29,6 +26,10 @@ extern __typeof (clock_getcpuclockid) __clock_getcpuclockid;
/* Now define the internal interfaces. */
struct tm;
+/* time_t variant for representing time zone data, independent of
+ time_t. */
+typedef __int64_t internal_time_t;
+
/* Defined in mktime.c. */
extern const unsigned short int __mon_yday[2][13] attribute_hidden;
@@ -36,24 +37,21 @@ extern const unsigned short int __mon_yday[2][13] attribute_hidden;
extern struct tm _tmbuf attribute_hidden;
/* Defined in tzset.c. */
-extern char *__tzstring (const char *string);
-
-/* Defined in tzset.c. */
-extern size_t __tzname_cur_max attribute_hidden;
-
+extern char *__tzstring (const char *string) attribute_hidden;
extern int __use_tzfile attribute_hidden;
extern void __tzfile_read (const char *file, size_t extra,
- char **extrap);
-extern void __tzfile_compute (time_t timer, int use_localtime,
+ char **extrap) attribute_hidden;
+extern void __tzfile_compute (internal_time_t timer, int use_localtime,
long int *leap_correct, int *leap_hit,
- struct tm *tp);
+ struct tm *tp) attribute_hidden;
extern void __tzfile_default (const char *std, const char *dst,
- long int stdoff, long int dstoff);
-extern void __tzset_parse_tz (const char *tz);
+ long int stdoff, long int dstoff)
+ attribute_hidden;
+extern void __tzset_parse_tz (const char *tz) attribute_hidden;
extern void __tz_compute (time_t timer, struct tm *tm, int use_localtime)
- __THROW internal_function;
+ __THROW attribute_hidden;
/* Subroutine of `mktime'. Return the `time_t' representation of TP and
normalize TP, given that a `struct tm *' maps to a `time_t' as performed
@@ -61,7 +59,7 @@ extern void __tz_compute (time_t timer, struct tm *tm, int use_localtime)
extern time_t __mktime_internal (struct tm *__tp,
struct tm *(*__func) (const time_t *,
struct tm *),
- time_t *__offset);
+ time_t *__offset) attribute_hidden;
extern struct tm *__localtime_r (const time_t *__timer,
struct tm *__tp) attribute_hidden;
@@ -75,36 +73,31 @@ libc_hidden_proto (__gmtime_r)
Return nonzero if successful. */
extern int __offtime (const time_t *__timer,
long int __offset,
- struct tm *__tp);
+ struct tm *__tp) attribute_hidden;
-extern char *__asctime_r (const struct tm *__tp, char *__buf);
-extern void __tzset (void);
+extern char *__asctime_r (const struct tm *__tp, char *__buf)
+ attribute_hidden;
+extern void __tzset (void) attribute_hidden;
/* Prototype for the internal function to get information based on TZ. */
-extern struct tm *__tz_convert (const time_t *timer, int use_localtime, struct tm *tp);
-
-/* Return the maximum length of a timezone name.
- This is what `sysconf (_SC_TZNAME_MAX)' does. */
-extern long int __tzname_max (void);
+extern struct tm *__tz_convert (const time_t *timer, int use_localtime,
+ struct tm *tp) attribute_hidden;
extern int __nanosleep (const struct timespec *__requested_time,
struct timespec *__remaining);
-libc_hidden_proto (__nanosleep)
-extern int __nanosleep_nocancel (const struct timespec *__requested_time,
- struct timespec *__remaining)
+hidden_proto (__nanosleep)
+extern int __getdate_r (const char *__string, struct tm *__resbufp)
attribute_hidden;
-extern int __getdate_r (const char *__string, struct tm *__resbufp);
/* Determine CLK_TCK value. */
-extern int __getclktck (void);
+extern int __getclktck (void) attribute_hidden;
/* strptime support. */
extern char * __strptime_internal (const char *rp, const char *fmt,
struct tm *tm, void *statep,
- __locale_t locparam)
- internal_function;
+ locale_t locparam) attribute_hidden;
extern double __difftime (time_t time1, time_t time0);
@@ -113,7 +106,5 @@ extern double __difftime (time_t time1, time_t time0);
actual clock ID. */
#define CLOCK_IDFIELD_SIZE 3
-__END_DECLS
-
#endif
#endif
diff --git a/include/ttyent.h b/include/ttyent.h
index 81e52116e5..53a66681d2 100644
--- a/include/ttyent.h
+++ b/include/ttyent.h
@@ -1,5 +1,7 @@
#ifndef _TTYENT_H
-# include <misc/ttyent.h>
+#include <misc/ttyent.h>
+
+# ifndef _ISOMAC
extern __typeof (getttyent) __getttyent __THROW;
libc_hidden_proto (__getttyent)
@@ -8,4 +10,5 @@ libc_hidden_proto (__setttyent)
extern __typeof (endttyent) __endttyent __THROW;
libc_hidden_proto (__endttyent)
-#endif
+# endif /* !_ISOMAC */
+#endif /* ttyent.h */
diff --git a/include/unistd.h b/include/unistd.h
index 5152f64f91..a171b00326 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -2,7 +2,6 @@
# include <posix/unistd.h>
# ifndef _ISOMAC
-__BEGIN_DECLS
libc_hidden_proto (_exit, __noreturn__)
rtld_hidden_proto (_exit, __noreturn__)
@@ -24,23 +23,30 @@ libc_hidden_proto (tcgetpgrp)
libc_hidden_proto (readlinkat)
/* Now define the internal interfaces. */
-extern int __access (const char *__name, int __type);
+extern int __access (const char *__name, int __type) attribute_hidden;
extern int __euidaccess (const char *__name, int __type);
-extern __off64_t __lseek64 (int __fd, __off64_t __offset, int __whence);
+extern int __faccessat (int __fd, const char *__file, int __type, int __flag);
+extern int __faccessat_noerrno (int __fd, const char *__file, int __type,
+ int __flag);
+extern __off64_t __lseek64 (int __fd, __off64_t __offset, int __whence)
+ attribute_hidden;
extern __off_t __lseek (int __fd, __off_t __offset, int __whence);
libc_hidden_proto (__lseek)
extern __off_t __libc_lseek (int __fd, __off_t __offset, int __whence);
extern __off64_t __libc_lseek64 (int __fd, __off64_t __offset, int __whence);
extern ssize_t __pread (int __fd, void *__buf, size_t __nbytes,
__off_t __offset);
+libc_hidden_proto (__pread);
extern ssize_t __libc_pread (int __fd, void *__buf, size_t __nbytes,
__off_t __offset);
extern ssize_t __pread64 (int __fd, void *__buf, size_t __nbytes,
__off64_t __offset);
+libc_hidden_proto (__pread64);
extern ssize_t __libc_pread64 (int __fd, void *__buf, size_t __nbytes,
- __off64_t __offset);
+ __off64_t __offset) attribute_hidden;
extern ssize_t __pwrite (int __fd, const void *__buf, size_t __n,
__off_t __offset);
+libc_hidden_proto (__pwrite)
extern ssize_t __libc_pwrite (int __fd, const void *__buf, size_t __n,
__off_t __offset);
extern ssize_t __pwrite64 (int __fd, const void *__buf, size_t __n,
@@ -50,12 +56,14 @@ extern ssize_t __libc_pwrite64 (int __fd, const void *__buf, size_t __n,
__off64_t __offset) attribute_hidden;
extern ssize_t __libc_read (int __fd, void *__buf, size_t __n);
libc_hidden_proto (__libc_read)
+libc_hidden_proto (read)
extern ssize_t __libc_write (int __fd, const void *__buf, size_t __n);
libc_hidden_proto (__libc_write)
+libc_hidden_proto (write)
extern int __pipe (int __pipedes[2]);
libc_hidden_proto (__pipe)
-extern int __pipe2 (int __pipedes[2], int __flags);
-extern unsigned int __sleep (unsigned int __seconds);
+extern int __pipe2 (int __pipedes[2], int __flags) attribute_hidden;
+extern unsigned int __sleep (unsigned int __seconds) attribute_hidden;
extern int __chown (const char *__file,
__uid_t __owner, __gid_t __group);
libc_hidden_proto (__chown)
@@ -63,12 +71,14 @@ extern int __fchown (int __fd,
__uid_t __owner, __gid_t __group);
extern int __lchown (const char *__file, __uid_t __owner,
__gid_t __group);
-extern int __chdir (const char *__path);
-extern int __fchdir (int __fd);
-extern char *__getcwd (char *__buf, size_t __size);
-extern int __rmdir (const char *__path);
+extern int __chdir (const char *__path) attribute_hidden;
+extern int __fchdir (int __fd) attribute_hidden;
+extern char *__getcwd (char *__buf, size_t __size) attribute_hidden;
+extern int __rmdir (const char *__path) attribute_hidden;
extern int __execvpe (const char *file, char *const argv[],
- char *const envp[]);
+ char *const envp[]) attribute_hidden;
+extern int __execvpex (const char *file, char *const argv[],
+ char *const envp[]) attribute_hidden;
/* Get the canonical absolute name of the named directory, and put it in SIZE
bytes of BUF. Returns NULL if the directory couldn't be determined or
@@ -81,12 +91,13 @@ char *__canonicalize_directory_name_internal (const char *__thisdir,
size_t __size) attribute_hidden;
extern int __dup (int __fd);
+libc_hidden_proto (__dup)
extern int __dup2 (int __fd, int __fd2);
libc_hidden_proto (__dup2)
extern int __dup3 (int __fd, int __fd2, int flags);
libc_hidden_proto (__dup3)
extern int __execve (const char *__path, char *const __argv[],
- char *const __envp[]);
+ char *const __envp[]) attribute_hidden;
extern long int __pathconf (const char *__path, int __name);
extern long int __fpathconf (int __fd, int __name);
extern long int __sysconf (int __name);
@@ -94,14 +105,14 @@ libc_hidden_proto (__sysconf)
extern __pid_t __getpid (void);
libc_hidden_proto (__getpid)
extern __pid_t __getppid (void);
-extern __pid_t __setsid (void);
-extern __uid_t __getuid (void);
-extern __uid_t __geteuid (void);
-extern __gid_t __getgid (void);
-extern __gid_t __getegid (void);
-extern int __getgroups (int __size, __gid_t __list[]);
+extern __pid_t __setsid (void) attribute_hidden;
+extern __uid_t __getuid (void) attribute_hidden;
+extern __uid_t __geteuid (void) attribute_hidden;
+extern __gid_t __getgid (void) attribute_hidden;
+extern __gid_t __getegid (void) attribute_hidden;
+extern int __getgroups (int __size, __gid_t __list[]) attribute_hidden;
libc_hidden_proto (__getpgid)
-extern int __group_member (__gid_t __gid);
+extern int __group_member (__gid_t __gid) attribute_hidden;
extern int __setuid (__uid_t __uid);
extern int __setreuid (__uid_t __ruid, __uid_t __euid);
extern int __setgid (__gid_t __gid);
@@ -118,17 +129,21 @@ libc_hidden_proto (__setresuid)
libc_hidden_proto (__setresgid)
extern __pid_t __vfork (void);
libc_hidden_proto (__vfork)
-extern int __ttyname_r (int __fd, char *__buf, size_t __buflen);
-extern int __isatty (int __fd);
+extern int __ttyname_r (int __fd, char *__buf, size_t __buflen)
+ attribute_hidden;
+extern int __isatty (int __fd) attribute_hidden;
extern int __link (const char *__from, const char *__to);
extern int __symlink (const char *__from, const char *__to);
-extern ssize_t __readlink (const char *__path, char *__buf, size_t __len);
-extern int __unlink (const char *__name);
-extern int __gethostname (char *__name, size_t __len);
+extern ssize_t __readlink (const char *__path, char *__buf, size_t __len)
+ attribute_hidden;
+extern int __unlink (const char *__name) attribute_hidden;
+extern int __gethostname (char *__name, size_t __len) attribute_hidden;
+extern int __revoke (const char *__file);
extern int __profil (unsigned short int *__sample_buffer, size_t __size,
- size_t __offset, unsigned int __scale);
-extern int __getdtablesize (void);
-extern int __brk (void *__addr);
+ size_t __offset, unsigned int __scale)
+ attribute_hidden;
+extern int __getdtablesize (void) attribute_hidden;
+extern int __brk (void *__addr) attribute_hidden;
extern int __close (int __fd);
libc_hidden_proto (__close)
extern int __libc_close (int __fd);
@@ -140,8 +155,8 @@ extern __pid_t __fork (void);
libc_hidden_proto (__fork)
extern int __getpagesize (void) __attribute__ ((__const__));
libc_hidden_proto (__getpagesize)
-extern int __ftruncate (int __fd, __off_t __length);
-extern int __ftruncate64 (int __fd, __off64_t __length);
+extern int __ftruncate (int __fd, __off_t __length) attribute_hidden;
+extern int __ftruncate64 (int __fd, __off64_t __length) attribute_hidden;
extern int __truncate (const char *path, __off_t __length);
extern void *__sbrk (intptr_t __delta);
libc_hidden_proto (__sbrk)
@@ -167,11 +182,6 @@ extern __pid_t __libc_fork (void);
/* Suspend the process until a signal arrives.
This always returns -1 and sets `errno' to EINTR. */
extern int __libc_pause (void);
-/* Not cancelable variant. */
-extern int __pause_nocancel (void) attribute_hidden;
-
-extern int __have_pipe2 attribute_hidden;
-extern int __have_dup3 attribute_hidden;
extern int __getlogin_r_loginuid (char *name, size_t namesize)
attribute_hidden;
@@ -180,7 +190,5 @@ extern int __getlogin_r_loginuid (char *name, size_t namesize)
# include <dl-unistd.h>
# endif
-__END_DECLS
# endif
-
#endif
diff --git a/include/utmp.h b/include/utmp.h
index 28207d1282..374184e9b2 100644
--- a/include/utmp.h
+++ b/include/utmp.h
@@ -1,21 +1,32 @@
#ifndef _UTMP_H
#include <login/utmp.h>
+# ifndef _ISOMAC
+
/* Now define the internal interfaces. */
extern void __updwtmp (const char *__wtmp_file, const struct utmp *__utmp);
-extern int __utmpname (const char *__file);
+libc_hidden_proto (__updwtmp)
+extern int __utmpname (const char *__file) attribute_hidden;
extern struct utmp *__getutent (void);
-extern void __setutent (void);
-extern void __endutent (void);
+libc_hidden_proto (__getutent)
+extern void __setutent (void) attribute_hidden;
+extern void __endutent (void) attribute_hidden;
extern struct utmp *__getutid (const struct utmp *__id);
+libc_hidden_proto (__getutid)
extern struct utmp *__getutline (const struct utmp *__line);
+libc_hidden_proto (__getutline)
extern struct utmp *__pututline (const struct utmp *__utmp_ptr);
+libc_hidden_proto (__pututline)
extern int __getutent_r (struct utmp *__buffer, struct utmp **__result);
+libc_hidden_proto (__getutent_r)
extern int __getutid_r (const struct utmp *__id, struct utmp *__buffer,
struct utmp **__result);
+libc_hidden_proto (__getutid_r)
extern int __getutline_r (const struct utmp *__line,
struct utmp *__buffer, struct utmp **__result);
+libc_hidden_proto (__getutline_r)
libutil_hidden_proto (login_tty)
+# endif /* !_ISOMAC */
#endif
diff --git a/include/values.h b/include/values.h
index 5ae2ead1d7..433e87c348 100644
--- a/include/values.h
+++ b/include/values.h
@@ -1,5 +1,5 @@
/* Old compatibility names for <limits.h> and <float.h> constants.
- Copyright (C) 1995-2016 Free Software Foundation, Inc.
+ Copyright (C) 1995-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/include/wchar.h b/include/wchar.h
index 0f33d094ed..1db0ac8278 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -1,8 +1,8 @@
#ifndef _WCHAR_H
-#include <wcsmbs/wchar.h>
-
+# include <wcsmbs/wchar.h>
# ifndef _ISOMAC
-# ifdef _WCHAR_H
+
+#include <bits/floatn.h>
extern __typeof (wcscasecmp_l) __wcscasecmp_l;
extern __typeof (wcsncasecmp_l) __wcsncasecmp_l;
@@ -54,7 +54,7 @@ extern unsigned long long int __wcstoull_internal (const wchar_t *
int __group) __THROW;
extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
wchar_t **, int, int,
- __locale_t);
+ locale_t);
libc_hidden_proto (__wcstof_internal)
libc_hidden_proto (__wcstod_internal)
libc_hidden_proto (__wcstold_internal)
@@ -70,6 +70,40 @@ libc_hidden_proto (wcstoll)
libc_hidden_proto (wcstoul)
libc_hidden_proto (wcstoull)
+extern float ____wcstof_l_internal (const wchar_t *, wchar_t **, int,
+ locale_t) attribute_hidden;
+extern double ____wcstod_l_internal (const wchar_t *, wchar_t **, int,
+ locale_t) attribute_hidden;
+extern long double ____wcstold_l_internal (const wchar_t *, wchar_t **,
+ int, locale_t) attribute_hidden;
+extern long int ____wcstol_l_internal (const wchar_t *, wchar_t **, int,
+ int, locale_t) attribute_hidden;
+extern unsigned long int ____wcstoul_l_internal (const wchar_t *,
+ wchar_t **,
+ int, int, locale_t)
+ attribute_hidden;
+extern long long int ____wcstoll_l_internal (const wchar_t *, wchar_t **,
+ int, int, locale_t)
+ attribute_hidden;
+extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
+ wchar_t **, int, int,
+ locale_t)
+ attribute_hidden;
+
+#if __HAVE_DISTINCT_FLOAT128
+extern __typeof (wcstof128_l) __wcstof128_l;
+libc_hidden_proto (__wcstof128_l)
+extern _Float128 __wcstof128_internal (const wchar_t *__restrict __nptr,
+ wchar_t **__restrict __endptr,
+ int __group) __THROW;
+
+extern _Float128 ____wcstof128_l_internal (const wchar_t *, wchar_t **, int,
+ locale_t) attribute_hidden;
+
+libc_hidden_proto (__wcstof128_internal)
+libc_hidden_proto (wcstof128)
+#endif
+
libc_hidden_proto (__wcscasecmp_l)
libc_hidden_proto (__wcsncasecmp_l)
@@ -102,7 +136,7 @@ extern int __wcscoll (const wchar_t *__s1, const wchar_t *__s2) __THROW;
libc_hidden_proto (__wcscoll)
libc_hidden_proto (wcspbrk)
-extern typeof (wmemset) __wmemset;
+extern __typeof (wmemset) __wmemset;
extern wchar_t *__wmemchr (const wchar_t *__s, wchar_t __c, size_t __n)
__THROW __attribute_pure__;
libc_hidden_proto (wmemchr)
@@ -120,7 +154,7 @@ extern size_t __wcslen (const wchar_t *__s) __attribute_pure__;
extern size_t __wcsnlen (const wchar_t *__s, size_t __maxlen)
__attribute_pure__;
extern wchar_t *__wcscat (wchar_t *dest, const wchar_t *src);
-extern wint_t __btowc (int __c);
+extern wint_t __btowc (int __c) attribute_hidden;
extern int __mbsinit (const __mbstate_t *__ps);
extern size_t __mbrtowc (wchar_t *__restrict __pwc,
const char *__restrict __s, size_t __n,
@@ -128,51 +162,61 @@ extern size_t __mbrtowc (wchar_t *__restrict __pwc,
libc_hidden_proto (__mbrtowc)
libc_hidden_proto (__mbrlen)
extern size_t __wcrtomb (char *__restrict __s, wchar_t __wc,
- __mbstate_t *__restrict __ps);
+ __mbstate_t *__restrict __ps) attribute_hidden;
extern size_t __mbsrtowcs (wchar_t *__restrict __dst,
const char **__restrict __src,
- size_t __len, __mbstate_t *__restrict __ps);
+ size_t __len, __mbstate_t *__restrict __ps)
+ attribute_hidden;
extern size_t __wcsrtombs (char *__restrict __dst,
const wchar_t **__restrict __src,
- size_t __len, __mbstate_t *__restrict __ps);
+ size_t __len, __mbstate_t *__restrict __ps)
+ attribute_hidden;
extern size_t __mbsnrtowcs (wchar_t *__restrict __dst,
const char **__restrict __src, size_t __nmc,
- size_t __len, __mbstate_t *__restrict __ps);
+ size_t __len, __mbstate_t *__restrict __ps)
+ attribute_hidden;
extern size_t __wcsnrtombs (char *__restrict __dst,
const wchar_t **__restrict __src,
size_t __nwc, size_t __len,
- __mbstate_t *__restrict __ps);
+ __mbstate_t *__restrict __ps)
+ attribute_hidden;
extern wchar_t *__wcsncpy (wchar_t *__restrict __dest,
const wchar_t *__restrict __src, size_t __n);
extern wchar_t *__wcpcpy (wchar_t *__dest, const wchar_t *__src);
extern wchar_t *__wcpncpy (wchar_t *__dest, const wchar_t *__src,
size_t __n);
extern wchar_t *__wmemcpy (wchar_t *__s1, const wchar_t *s2,
- size_t __n);
+ size_t __n) attribute_hidden;
extern wchar_t *__wmempcpy (wchar_t *__restrict __s1,
const wchar_t *__restrict __s2,
- size_t __n);
+ size_t __n) attribute_hidden;
extern wchar_t *__wmemmove (wchar_t *__s1, const wchar_t *__s2,
- size_t __n);
+ size_t __n) attribute_hidden;
extern wchar_t *__wcschrnul (const wchar_t *__s, wchar_t __wc)
__attribute_pure__;
+extern wchar_t *__wmemset_chk (wchar_t *__s, wchar_t __c, size_t __n,
+ size_t __ns) __THROW;
+
extern int __vfwscanf (__FILE *__restrict __s,
const wchar_t *__restrict __format,
__gnuc_va_list __arg)
+ attribute_hidden
/* __attribute__ ((__format__ (__wscanf__, 2, 0)) */;
extern int __vswprintf (wchar_t *__restrict __s, size_t __n,
const wchar_t *__restrict __format,
__gnuc_va_list __arg)
+ attribute_hidden
/* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
extern int __fwprintf (__FILE *__restrict __s,
const wchar_t *__restrict __format, ...)
+ attribute_hidden
/* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
extern int __vfwprintf (__FILE *__restrict __s,
const wchar_t *__restrict __format,
__gnuc_va_list __arg)
+ attribute_hidden
/* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
-#ifndef __cplusplus
extern int __vfwprintf_chk (FILE *__restrict __s, int __flag,
const wchar_t *__restrict __format,
__gnuc_va_list __arg)
@@ -184,7 +228,6 @@ extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
/* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
libc_hidden_proto (__vfwprintf_chk)
libc_hidden_proto (__vswprintf_chk)
-#endif
extern int __isoc99_fwscanf (__FILE *__restrict __stream,
const wchar_t *__restrict __format, ...);
@@ -209,7 +252,7 @@ libc_hidden_proto (__isoc99_vfwscanf)
/* Internal functions. */
extern size_t __mbsrtowcs_l (wchar_t *dst, const char **src, size_t len,
- mbstate_t *ps, __locale_t l) attribute_hidden;
+ mbstate_t *ps, locale_t l) attribute_hidden;
/* Special version. We know that all uses of mbsinit inside the libc
have a non-NULL parameter. And certainly we can access the
@@ -218,10 +261,4 @@ extern size_t __mbsrtowcs_l (wchar_t *dst, const char **src, size_t len,
# define __mbsinit(state) ((state)->__count == 0)
# endif
-# endif
#endif
-
-/* Undefine all __need_* constants in case we are included to get those
- constants but the whole file was already read. */
-#undef __need_mbstate_t
-#undef __need_wint_t
diff --git a/include/wctype.h b/include/wctype.h
index a71b10377b..5fd3f863ae 100644
--- a/include/wctype.h
+++ b/include/wctype.h
@@ -1,30 +1,7 @@
#ifndef _WCTYPE_H
+#include <wctype/wctype.h>
#ifndef _ISOMAC
-/* We try to get wint_t from <stddef.h>, but not all GCC versions define it
- there. So define it ourselves if it remains undefined. */
-# define __need_wint_t
-# include <stddef.h>
-# ifndef _WINT_T
-/* Integral type unchanged by default argument promotions that can
- hold any value corresponding to members of the extended character
- set, as well as at least one value that does not correspond to any
- member of the extended character set. */
-# define _WINT_T
-typedef unsigned int wint_t;
-# endif
-
-/* Need to repeat these prototypes here, as wctype/wctype.h defines all
- these as macros and thus we couldn't add libc_hidden_proto. */
-
-extern int iswalpha (wint_t __wc);
-extern int iswalnum (wint_t __wc);
-extern int iswdigit (wint_t __wc);
-extern int iswlower (wint_t __wc);
-extern int iswspace (wint_t __wc);
-extern int iswxdigit (wint_t __wc);
-extern wint_t towlower (wint_t __wc);
-extern wint_t towupper (wint_t __wc);
libc_hidden_proto (iswalpha)
libc_hidden_proto (iswalnum)
@@ -34,11 +11,7 @@ libc_hidden_proto (iswspace)
libc_hidden_proto (iswxdigit)
libc_hidden_proto (towlower)
libc_hidden_proto (towupper)
-#endif
-
-#include <wctype/wctype.h>
-#ifndef _ISOMAC
/* Internal interfaces. */
extern int __iswspace (wint_t __wc);
extern int __iswctype (wint_t __wc, wctype_t __desc);
diff --git a/include/xlocale.h b/include/xlocale.h
deleted file mode 100644
index 5280ef0bc4..0000000000
--- a/include/xlocale.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <locale/xlocale.h>