summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2015-03-29 04:50:56 -0500
committerWaldemar Brodkorb <wbx@openadk.org>2015-03-29 04:50:56 -0500
commitcd5f92704e1e17bbc0c15d197f3bc236c7dc9bf2 (patch)
tree1400302b543e4528aedea5d72731983559cfcf36 /include
parentad2bffbf1926051ef333f9899344f6bddf2c03cf (diff)
parent24946289317ea23bb0d1814cca0a499a905f7d6f (diff)
merge uClibc git master
Diffstat (limited to 'include')
-rw-r--r--include/atomic.h235
-rw-r--r--include/complex.h2
-rw-r--r--include/dlfcn.h6
-rw-r--r--include/fcntl.h2
-rw-r--r--include/iconv.h4
-rw-r--r--include/internal/utmp.h92
-rw-r--r--include/malloc.h4
-rw-r--r--include/math.h2
-rw-r--r--include/pty.h1
-rw-r--r--include/setjmp.h19
-rw-r--r--include/spawn.h24
-rw-r--r--include/stdio.h51
-rw-r--r--include/stdlib.h8
-rw-r--r--include/sys/cdefs.h24
-rw-r--r--include/sys/sysmacros.h29
-rw-r--r--include/sys/wait.h18
-rw-r--r--include/ucontext.h6
-rw-r--r--include/unistd.h75
-rw-r--r--include/utmp.h2
-rw-r--r--include/wchar.h8
20 files changed, 495 insertions, 117 deletions
diff --git a/include/atomic.h b/include/atomic.h
index 307704cba..3680d8714 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-2006, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -32,7 +32,7 @@
the multi-thread case. The interfaces have the prefix
"catomic_".
- - support functions like barriers. They also have the preifx
+ - support functions like barriers. They also have the prefix
"atomic_".
Architectures must provide a few lowlevel macros (the compare
@@ -198,8 +198,12 @@
/* Add VALUE to *MEM and return the old value of *MEM. */
-#ifndef atomic_exchange_and_add
-# define atomic_exchange_and_add(mem, value) \
+#ifndef atomic_exchange_and_add_acq
+# ifdef atomic_exchange_and_add
+# define atomic_exchange_and_add_acq(mem, value) \
+ atomic_exchange_and_add (mem, value)
+# else
+# define atomic_exchange_and_add_acq(mem, value) \
({ __typeof (*(mem)) __atg6_oldval; \
__typeof (mem) __atg6_memp = (mem); \
__typeof (*(mem)) __atg6_value = (value); \
@@ -213,8 +217,18 @@
__atg6_oldval), 0)); \
\
__atg6_oldval; })
+# endif
#endif
+#ifndef atomic_exchange_and_add_rel
+# define atomic_exchange_and_add_rel(mem, value) \
+ atomic_exchange_and_add_acq(mem, value)
+#endif
+
+#ifndef atomic_exchange_and_add
+# define atomic_exchange_and_add(mem, value) \
+ atomic_exchange_and_add_acq(mem, value)
+#endif
#ifndef catomic_exchange_and_add
# define catomic_exchange_and_add(mem, value) \
@@ -528,6 +542,219 @@
({ __typeof (x) __x; __asm__ ("" : "=r" (__x) : "0" (x)); __x; })
#endif
+/* This is equal to 1 iff the architecture supports 64b atomic operations. */
+#define __HAVE_64B_ATOMICS 0 /* TODO: not yet used - Add these to arch bits! */
+#ifndef __HAVE_64B_ATOMICS
+#error Unable to determine if 64-bit atomics are present.
+#endif
+
+/* The following functions are a subset of the atomic operations provided by
+ C11. Usually, a function named atomic_OP_MO(args) is equivalent to C11's
+ atomic_OP_explicit(args, memory_order_MO); exceptions noted below. */
+
+/* Each arch can request to use compiler built-ins for C11 atomics. If it
+ does, all atomics will be based on these. */
+#if 0 /* not yet used USE_ATOMIC_COMPILER_BUILTINS */
+
+/* We require 32b atomic operations; some archs also support 64b atomic
+ operations. */
+void __atomic_link_error (void);
+# if __HAVE_64B_ATOMICS == 1
+# define __atomic_check_size(mem) \
+ if ((sizeof (*mem) != 4) && (sizeof (*mem) != 8)) \
+ __atomic_link_error ();
+# else
+# define __atomic_check_size(mem) \
+ if (sizeof (*mem) != 4) \
+ __atomic_link_error ();
+# endif
+
+# define atomic_thread_fence_acquire() \
+ __atomic_thread_fence (__ATOMIC_ACQUIRE)
+# define atomic_thread_fence_release() \
+ __atomic_thread_fence (__ATOMIC_RELEASE)
+# define atomic_thread_fence_seq_cst() \
+ __atomic_thread_fence (__ATOMIC_SEQ_CST)
+
+# define atomic_load_relaxed(mem) \
+ ({ __atomic_check_size((mem)); __atomic_load_n ((mem), __ATOMIC_RELAXED); })
+# define atomic_load_acquire(mem) \
+ ({ __atomic_check_size((mem)); __atomic_load_n ((mem), __ATOMIC_ACQUIRE); })
+
+# define atomic_store_relaxed(mem, val) \
+ do { \
+ __atomic_check_size((mem)); \
+ __atomic_store_n ((mem), (val), __ATOMIC_RELAXED); \
+ } while (0)
+# define atomic_store_release(mem, val) \
+ do { \
+ __atomic_check_size((mem)); \
+ __atomic_store_n ((mem), (val), __ATOMIC_RELEASE); \
+ } while (0)
+
+/* On failure, this CAS has memory_order_relaxed semantics. */
+# define atomic_compare_exchange_weak_relaxed(mem, expected, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_compare_exchange_n ((mem), (expected), (desired), 1, \
+ __ATOMIC_RELAXED, __ATOMIC_RELAXED); })
+# define atomic_compare_exchange_weak_acquire(mem, expected, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_compare_exchange_n ((mem), (expected), (desired), 1, \
+ __ATOMIC_ACQUIRE, __ATOMIC_RELAXED); })
+# define atomic_compare_exchange_weak_release(mem, expected, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_compare_exchange_n ((mem), (expected), (desired), 1, \
+ __ATOMIC_RELEASE, __ATOMIC_RELAXED); })
+
+# define atomic_exchange_acquire(mem, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_exchange_n ((mem), (desired), __ATOMIC_ACQUIRE); })
+# define atomic_exchange_release(mem, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_exchange_n ((mem), (desired), __ATOMIC_RELEASE); })
+
+# define atomic_fetch_add_relaxed(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_add ((mem), (operand), __ATOMIC_RELAXED); })
+# define atomic_fetch_add_acquire(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_add ((mem), (operand), __ATOMIC_ACQUIRE); })
+# define atomic_fetch_add_release(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_add ((mem), (operand), __ATOMIC_RELEASE); })
+# define atomic_fetch_add_acq_rel(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_add ((mem), (operand), __ATOMIC_ACQ_REL); })
+
+# define atomic_fetch_and_acquire(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_and ((mem), (operand), __ATOMIC_ACQUIRE); })
+
+# define atomic_fetch_or_relaxed(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_or ((mem), (operand), __ATOMIC_RELAXED); })
+# define atomic_fetch_or_acquire(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_or ((mem), (operand), __ATOMIC_ACQUIRE); })
+
+#else /* !USE_ATOMIC_COMPILER_BUILTINS */
+
+/* By default, we assume that read, write, and full barriers are equivalent
+ to acquire, release, and seq_cst barriers. Archs for which this does not
+ hold have to provide custom definitions of the fences. */
+# ifndef atomic_thread_fence_acquire
+# define atomic_thread_fence_acquire() atomic_read_barrier ()
+# endif
+# ifndef atomic_thread_fence_release
+# define atomic_thread_fence_release() atomic_write_barrier ()
+# endif
+# ifndef atomic_thread_fence_seq_cst
+# define atomic_thread_fence_seq_cst() atomic_full_barrier ()
+# endif
+
+# ifndef atomic_load_relaxed
+# define atomic_load_relaxed(mem) \
+ ({ __typeof (*(mem)) __atg100_val; \
+ __asm__ ("" : "=r" (__atg100_val) : "0" (*(mem))); \
+ __atg100_val; })
+# endif
+# ifndef atomic_load_acquire
+# define atomic_load_acquire(mem) \
+ ({ __typeof (*(mem)) __atg101_val = atomic_load_relaxed (mem); \
+ atomic_thread_fence_acquire (); \
+ __atg101_val; })
+# endif
+
+# ifndef atomic_store_relaxed
+/* XXX Use inline asm here? */
+# define atomic_store_relaxed(mem, val) do { *(mem) = (val); } while (0)
+# endif
+# ifndef atomic_store_release
+# define atomic_store_release(mem, val) \
+ do { \
+ atomic_thread_fence_release (); \
+ atomic_store_relaxed ((mem), (val)); \
+ } while (0)
+# endif
+
+/* On failure, this CAS has memory_order_relaxed semantics. */
+/* XXX This potentially has one branch more than necessary, but archs
+ currently do not define a CAS that returns both the previous value and
+ the success flag. */
+# ifndef atomic_compare_exchange_weak_acquire
+# define atomic_compare_exchange_weak_acquire(mem, expected, desired) \
+ ({ __typeof (*(expected)) __atg102_expected = *(expected); \
+ *(expected) = \
+ atomic_compare_and_exchange_val_acq ((mem), (desired), *(expected)); \
+ *(expected) == __atg102_expected; })
+# endif
+# ifndef atomic_compare_exchange_weak_relaxed
+/* XXX Fall back to CAS with acquire MO because archs do not define a weaker
+ CAS. */
+# define atomic_compare_exchange_weak_relaxed(mem, expected, desired) \
+ atomic_compare_exchange_weak_acquire ((mem), (expected), (desired))
+# endif
+# ifndef atomic_compare_exchange_weak_release
+# define atomic_compare_exchange_weak_release(mem, expected, desired) \
+ ({ __typeof (*(expected)) __atg103_expected = *(expected); \
+ *(expected) = \
+ atomic_compare_and_exchange_val_rel ((mem), (desired), *(expected)); \
+ *(expected) == __atg103_expected; })
+# endif
+
+# ifndef atomic_exchange_acquire
+# define atomic_exchange_acquire(mem, val) \
+ atomic_exchange_acq ((mem), (val))
+# endif
+# ifndef atomic_exchange_release
+# define atomic_exchange_release(mem, val) \
+ atomic_exchange_rel ((mem), (val))
+# endif
+
+# ifndef atomic_fetch_add_acquire
+# define atomic_fetch_add_acquire(mem, operand) \
+ atomic_exchange_and_add_acq ((mem), (operand))
+# endif
+# ifndef atomic_fetch_add_relaxed
+/* XXX Fall back to acquire MO because the MO semantics of
+ atomic_exchange_and_add are not documented; the generic version falls back
+ to atomic_exchange_and_add_acq if atomic_exchange_and_add is not defined,
+ and vice versa. */
+# define atomic_fetch_add_relaxed(mem, operand) \
+ atomic_fetch_add_acquire ((mem), (operand))
+# endif
+# ifndef atomic_fetch_add_release
+# define atomic_fetch_add_release(mem, operand) \
+ atomic_exchange_and_add_rel ((mem), (operand))
+# endif
+# ifndef atomic_fetch_add_acq_rel
+# define atomic_fetch_add_acq_rel(mem, operand) \
+ ({ atomic_thread_fence_release (); \
+ atomic_exchange_and_add_acq ((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
+
+/* XXX The default for atomic_or_val has acquire semantics, but this is not
+ documented. */
+# ifndef atomic_fetch_or_acquire
+# define atomic_fetch_or_acquire(mem, operand) \
+ atomic_or_val ((mem), (operand))
+# endif
+/* XXX Fall back to acquire MO because archs do not define a weaker
+ atomic_or_val. */
+# ifndef atomic_fetch_or_relaxed
+# define atomic_fetch_or_relaxed(mem, operand) \
+ atomic_fetch_or_acquire ((mem), (operand))
+# endif
+
+#endif /* !USE_ATOMIC_COMPILER_BUILTINS */
+
#ifndef atomic_delay
# define atomic_delay() do { /* nothing */ } while (0)
diff --git a/include/complex.h b/include/complex.h
index 91efc0d2b..ed7e502b7 100644
--- a/include/complex.h
+++ b/include/complex.h
@@ -79,6 +79,7 @@ __BEGIN_DECLS
#endif
#include <bits/cmathcalls.h>
#undef _Mdouble_
+#undef _Mfloat_
#undef __MATH_PRECNAME
/* And the long double versions. It is non-critical to define them
@@ -97,6 +98,7 @@ __BEGIN_DECLS
# include <bits/cmathcalls.h>
#endif
#undef _Mdouble_
+#undef _Mlong_double_
#undef __MATH_PRECNAME
#undef __MATHDECL_1
#undef __MATHDECL
diff --git a/include/dlfcn.h b/include/dlfcn.h
index 41d0d6fa4..241ec5480 100644
--- a/include/dlfcn.h
+++ b/include/dlfcn.h
@@ -55,11 +55,11 @@ __BEGIN_DECLS
/* Open the shared object FILE and map it in; return a handle that can be
passed to `dlsym' to get symbol values from it. */
-extern void *dlopen (const char *__file, int __mode) __THROW;
+extern void *dlopen (const char *__file, int __mode) __THROWNL;
/* Unmap and close a shared object opened by `dlopen'.
The handle cannot be used again after calling `dlclose'. */
-extern int dlclose (void *__handle) __THROW __nonnull ((1));
+extern int dlclose (void *__handle) __THROWNL __nonnull ((1));
/* Find the run-time address in the shared object HANDLE refers to
of the symbol called NAME. */
@@ -68,7 +68,7 @@ extern void *dlsym (void *__restrict __handle,
#if 0 /*def __USE_GNU*/
/* Like `dlopen', but request object to be allocated in a new namespace. */
-extern void *dlmopen (Lmid_t __nsid, const char *__file, int __mode) __THROW;
+extern void *dlmopen (Lmid_t __nsid, const char *__file, int __mode) __THROWNL;
/* Find the run-time address in the shared object HANDLE refers to
of the symbol called NAME with VERSION. */
diff --git a/include/fcntl.h b/include/fcntl.h
index 04fc2c06d..11000ddb5 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -221,7 +221,7 @@ extern int posix_fadvise64 (int __fd, __off64_t __offset, __off64_t __len,
/* Reserve storage for the data of the file associated with FD.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
# ifndef __USE_FILE_OFFSET64
extern int posix_fallocate (int __fd, __off_t __offset, __off_t __len);
diff --git a/include/iconv.h b/include/iconv.h
index d850de56e..5ab4c6cb9 100644
--- a/include/iconv.h
+++ b/include/iconv.h
@@ -36,7 +36,7 @@ typedef void *iconv_t;
/* Allocate descriptor for code conversion from codeset FROMCODE to
codeset TOCODE.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern iconv_t iconv_open (const char *__tocode, const char *__fromcode);
@@ -50,7 +50,7 @@ extern size_t iconv (iconv_t __cd, char **__restrict __inbuf,
/* Free resources allocated for descriptor CD for code conversion.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int iconv_close (iconv_t __cd);
diff --git a/include/internal/utmp.h b/include/internal/utmp.h
new file mode 100644
index 000000000..49f96b4d8
--- /dev/null
+++ b/include/internal/utmp.h
@@ -0,0 +1,92 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * internal helper for utmp and utmpx handling
+ *
+ * Copyright (C) 2015 by Bernhard Reutner-Fischer
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
+#ifndef __INTERNAL_UTMP_H
+#define __INTERNAL_UTMP_H
+
+#include <utmpx.h>
+#include <utmp.h>
+
+/* Note: _PATH_UTMPX == _PATH_UTMP */
+
+#if (defined __UCLIBC_HAS_UTMPX__ && defined __UCLIBC_HAS_UTMP__) \
+ || !defined __UCLIBC_HAS_UTMP__
+/* implement the X and alias the non-X */
+# define __set_unlocked __setutxent_unlocked
+# define set setutxent
+# define __get_unlocked __getutxent_unlocked
+# define get getutxent
+# define end endutxent
+# define __getid_unlocked __getutxid_unlocked
+# define getid getutxid
+# define getline getutxline
+# define putline pututxline
+# define name utmpxname
+# define updw updwtmpx
+# define UT utmpx
+# ifndef __DEFAULT_PATH_UTMP
+# define __DEFAULT_PATH_UTMP _PATH_UTMPX
+# endif
+# if defined __UCLIBC_HAS_UTMP__
+# define other(n,a) strong_alias_untyped(n,a)
+# else
+# define other(n,a) /* nothing */
+# endif
+#elif defined __UCLIBC_HAS_UTMP__
+# define __set_unlocked __setutent_unlocked
+# define set setutent
+# define __get_unlocked __getutent_unlocked
+# define get getutent
+# define end endutent
+# define __getid_unlocked __getutid_unlocked
+# define getid getutid
+# define getline getutline
+# define putline pututline
+# define name utmpname
+# define updw updwtmp
+# define UT utmp
+# ifndef __DEFAULT_PATH_UTMP
+# define __DEFAULT_PATH_UTMP _PATH_UTMP
+# endif
+# define other(n,a) /* nothing */
+#else
+#error You are supposed to either have UTMP or UTMPX or both here
+#endif
+
+/* not used in libc_hidden_proto(setutxent) */
+/* not used in libc_hidden_proto(endutxent) */
+/* not used in libc_hidden_proto(getutxent) */
+/* not used in libc_hidden_proto(getutxid) */
+/* not used in libc_hidden_proto(getutxline) */
+/* not used in libc_hidden_proto(pututxline) */
+/* not used in libc_hidden_proto(utmpxname) */
+/* not used in libc_hidden_proto(updwtmpx) */
+
+/* not used in libc_hidden_proto(setutent) */
+/* not used in libc_hidden_proto(endutent) */
+/* not used in libc_hidden_proto(getutent) */
+/* not used in libc_hidden_proto(getutid) */
+/* not used in libc_hidden_proto(getutline) */
+/* not used in libc_hidden_proto(pututline) */
+/* not used in libc_hidden_proto(utmpname) */
+/* not used in libc_hidden_proto(updwtmp) */
+
+#ifdef IS_IN_libutil
+# if (defined __UCLIBC_HAS_UTMPX__ && defined __UCLIBC_HAS_UTMP__) \
+ || !defined __UCLIBC_HAS_UTMP__
+ /* monkey-patch to use the POSIX interface */
+# define setutent setutxent
+# define getutline getutxline
+# define pututline pututxline
+# define endutent endutxent
+# define updwtmp updwtmpx
+# endif
+#endif /* IS_IN_libutil */
+
+#endif /* __INTERNAL_UTMP_H */
+
diff --git a/include/malloc.h b/include/malloc.h
index 3209fb070..a289c9317 100644
--- a/include/malloc.h
+++ b/include/malloc.h
@@ -132,6 +132,7 @@ extern __malloc_ptr_t valloc __MALLOC_P ((size_t __size)) __attribute_malloc__;
#ifdef __MALLOC_STANDARD__
+# ifdef __USE_SVID
/* SVID2/XPG mallinfo structure */
struct mallinfo {
int arena; /* total space allocated from system */
@@ -149,10 +150,13 @@ struct mallinfo {
/* Returns a copy of the updated current mallinfo. */
extern struct mallinfo mallinfo __MALLOC_P ((void));
libc_hidden_proto(mallinfo)
+# endif /* __USE_SVID */
+# ifdef __USE_GNU
/* Release all but __pad bytes of freed top-most memory back to the
system. Return 1 if successful, else 0. */
extern int malloc_trim(size_t pad);
+# endif /* __USE_GNU */
#include <stdio.h>
/* Prints brief summary statistics to the specified file.
diff --git a/include/math.h b/include/math.h
index 40dd90ef0..c79af3f35 100644
--- a/include/math.h
+++ b/include/math.h
@@ -131,6 +131,7 @@ __BEGIN_DECLS
# undef _Mdouble_
# undef _Mdouble_BEGIN_NAMESPACE
# undef _Mdouble_END_NAMESPACE
+# undef _Mfloat_
# undef __MATH_PRECNAME
# undef __MATH_maybe_libm_hidden_proto
@@ -178,6 +179,7 @@ extern long double __REDIRECT_NTH (nexttowardl, (long double __x, long double __
# undef _Mdouble_
# undef _Mdouble_BEGIN_NAMESPACE
# undef _Mdouble_END_NAMESPACE
+# undef _Mlong_double_
# undef __MATH_PRECNAME
# undef __MATH_maybe_libm_hidden_proto
diff --git a/include/pty.h b/include/pty.h
index 26c3011c6..f23a260ae 100644
--- a/include/pty.h
+++ b/include/pty.h
@@ -32,6 +32,7 @@ __BEGIN_DECLS
ends in AMASTER and ASLAVE. */
extern int openpty (int *__amaster, int *__aslave, char *__name,
struct termios *__termp, struct winsize *__winp) __THROW;
+libutil_hidden_proto(openpty)
/* Create child process and establish the slave pseudo terminal as the
child's controlling terminal. */
diff --git a/include/setjmp.h b/include/setjmp.h
index c9501379e..71c1d35cb 100644
--- a/include/setjmp.h
+++ b/include/setjmp.h
@@ -49,19 +49,20 @@ typedef struct __jmp_buf_tag jmp_buf[1];
/* Store the calling environment in ENV, also saving the signal mask.
Return 0. */
-extern int setjmp (jmp_buf __env) __THROW;
+extern int setjmp (jmp_buf __env) __THROWNL;
__END_NAMESPACE_STD
/* Store the calling environment in ENV, also saving the
signal mask if SAVEMASK is nonzero. Return 0.
This is the internal name for `sigsetjmp'. */
-extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __THROW;
+extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask)
+ __THROWNL;
#ifndef __FAVOR_BSD
/* Store the calling environment in ENV, not saving the signal mask.
Return 0. */
-extern int _setjmp (struct __jmp_buf_tag __env[1]) __THROW;
+extern int _setjmp (struct __jmp_buf_tag __env[1]) __THROWNL;
/* Do not save the signal mask. This is equivalent to the `_setjmp'
BSD function. */
@@ -79,7 +80,7 @@ __BEGIN_NAMESPACE_STD
/* Jump to the environment saved in ENV, making the
`setjmp' call there return VAL, or 1 if VAL is 0. */
extern void longjmp (struct __jmp_buf_tag __env[1], int __val)
- __THROW __attribute__ ((__noreturn__));
+ __THROWNL __attribute__ ((__noreturn__));
__END_NAMESPACE_STD
@@ -88,7 +89,7 @@ __END_NAMESPACE_STD
the signal mask. But it is how ENV was saved that determines whether
`longjmp' restores the mask; `_longjmp' is just an alias. */
extern void _longjmp (struct __jmp_buf_tag __env[1], int __val)
- __THROW __attribute__ ((__noreturn__));
+ __THROWNL __attribute__ ((__noreturn__));
#endif
@@ -107,16 +108,16 @@ typedef struct __jmp_buf_tag sigjmp_buf[1];
Restore the signal mask if that sigsetjmp call saved it.
This is just an alias `longjmp'. */
extern void siglongjmp (sigjmp_buf __env, int __val)
- __THROW __attribute__ ((__noreturn__));
+ __THROWNL __attribute__ ((__noreturn__));
#endif /* Use POSIX. */
__END_DECLS
#ifdef _LIBC
-extern void __longjmp(__jmp_buf __env, int __val) attribute_noreturn;
+extern void __longjmp(__jmp_buf __env, int __val) __THROWNL attribute_noreturn;
libc_hidden_proto(__longjmp)
-extern __typeof(longjmp) __libc_longjmp attribute_noreturn;
-extern __typeof(siglongjmp) __libc_siglongjmp attribute_noreturn;
+extern __typeof(longjmp) __libc_longjmp __THROWNL attribute_noreturn;
+extern __typeof(siglongjmp) __libc_siglongjmp __THROWNL attribute_noreturn;
extern void _longjmp_unwind(jmp_buf __env, int __val);
libc_hidden_proto(_longjmp_unwind)
extern int __sigjmp_save(sigjmp_buf __env, int __savemask) attribute_hidden;
diff --git a/include/spawn.h b/include/spawn.h
index 95fff356f..3de375b41 100644
--- a/include/spawn.h
+++ b/include/spawn.h
@@ -66,15 +66,6 @@ typedef struct
# define POSIX_SPAWN_USEVFORK 0x40
#endif
-
-#define __POSIX_SPAWN_MASK (POSIX_SPAWN_RESETIDS \
- | POSIX_SPAWN_SETPGROUP \
- | POSIX_SPAWN_SETSIGDEF \
- | POSIX_SPAWN_SETSIGMASK \
- | POSIX_SPAWN_SETSCHEDPARAM \
- | POSIX_SPAWN_SETSCHEDULER \
- | POSIX_SPAWN_USEVFORK)
-
__BEGIN_DECLS
/* Spawn a new process executing PATH with the attributes describes in *ATTRP.
@@ -170,12 +161,27 @@ static inline
int posix_spawnattr_setflags (posix_spawnattr_t *_attr,
short int __flags)
{
+#ifdef POSIX_SPAWN_USEVFORK
+# define __POSIX_SPAWN_USEVFORK POSIX_SPAWN_USEVFORK
+#else
+# define __POSIX_SPAWN_USEVFORK 0
+#endif
+#define __POSIX_SPAWN_MASK (POSIX_SPAWN_RESETIDS \
+ | POSIX_SPAWN_SETPGROUP \
+ | POSIX_SPAWN_SETSIGDEF \
+ | POSIX_SPAWN_SETSIGMASK \
+ | POSIX_SPAWN_SETSCHEDPARAM \
+ | POSIX_SPAWN_SETSCHEDULER \
+ | __POSIX_SPAWN_USEVFORK)
+
/* Check no invalid bits are set. */
if (__flags & ~__POSIX_SPAWN_MASK)
return EINVAL;
_attr->__flags = __flags;
return 0;
+#undef __POSIX_SPAWN_USEVFORK
+#undef __POSIX_SPAWN_MASK
}
/* Get process group ID from the attribute structure. */
diff --git a/include/stdio.h b/include/stdio.h
index 75c146482..9aae5abf4 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -157,7 +157,7 @@ libc_hidden_proto(renameat)
__BEGIN_NAMESPACE_STD
/* Create a temporary file and open it read/write.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
#ifndef __USE_FILE_OFFSET64
extern FILE *tmpfile (void) __wur;
@@ -345,8 +345,8 @@ extern int printf (const char *__restrict __format, ...);
libc_hidden_proto(printf)
/* Write formatted output to S. */
extern int sprintf (char *__restrict __s,
- const char *__restrict __format, ...)
- __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
+ const char *__restrict __format, ...) __THROWNL
+ __attribute__ ((__format__ (__printf__, 2, 3)));
libc_hidden_proto(sprintf)
/* Write formatted output to S from argument list ARG.
@@ -363,8 +363,8 @@ libc_hidden_proto(vfprintf)
extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
/* Write formatted output to S from argument list ARG. */
extern int vsprintf (char *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
+ __gnuc_va_list __arg) __THROWNL
+ __attribute__ ((__format__ (__printf__, 2, 0)));
__END_NAMESPACE_STD
#if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
@@ -372,12 +372,12 @@ __BEGIN_NAMESPACE_C99
/* Maximum chars of output to write in MAXLEN. */
extern int snprintf (char *__restrict __s, size_t __maxlen,
const char *__restrict __format, ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
+ __THROWNL __attribute__ ((__format__ (__printf__, 3, 4)));
libc_hidden_proto(snprintf)
extern int vsnprintf (char *__restrict __s, size_t __maxlen,
const char *__restrict __format, __gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
+ __THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
libc_hidden_proto(vsnprintf)
__END_NAMESPACE_C99
#endif
@@ -387,26 +387,24 @@ __END_NAMESPACE_C99
Store the address of the string in *PTR. */
extern int vasprintf (char **__restrict __ptr, const char *__restrict __f,
__gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
+ __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
libc_hidden_proto(vasprintf)
#if 0 /* uClibc: disabled */
extern int __asprintf (char **__restrict __ptr,
const char *__restrict __fmt, ...)
- __THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
+ __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
#endif
extern int asprintf (char **__restrict __ptr,
const char *__restrict __fmt, ...)
- __THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
+ __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
libc_hidden_proto(asprintf)
#endif
#ifdef __USE_XOPEN2K8
/* Write formatted output to a file descriptor.
- These functions are not part of POSIX and therefore no official
- cancellation point. But due to similarity with an POSIX interface
- or due to the implementation they are cancellation points and
- therefore not marked with __THROW. */
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
extern int vdprintf (int __fd, const char *__restrict __fmt,
__gnuc_va_list __arg)
__attribute__ ((__format__ (__printf__, 2, 0)));
@@ -570,12 +568,21 @@ extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
__wur;
libc_hidden_proto(fgets)
+#if !defined __USE_ISOC11 \
+ || (defined __cplusplus && __cplusplus <= 201103L)
/* Get a newline-terminated string from stdin, removing the newline.
DO NOT USE THIS FUNCTION!! There is no limit on how much it will read.
+ The function has been officially removed in ISO C11. This opportunity
+ is used to also remove it from the GNU feature list. It is now only
+ available when explicitly using an old ISO C, Unix, or POSIX standard.
+ GCC defines _GNU_SOURCE when building C++ code and the function is still
+ in C++11, so it is also available for C++.
+
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern char *gets (char *__s) __wur;
+extern char *gets (char *__s) __wur __attribute_deprecated__;
+#endif
__END_NAMESPACE_STD
#ifdef __USE_GNU
@@ -628,21 +635,21 @@ libc_hidden_proto(getline)
__BEGIN_NAMESPACE_STD
/* Write a string to STREAM.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int fputs (const char *__restrict __s, FILE *__restrict __stream);
libc_hidden_proto(fputs)
/* Write a string, followed by a newline, to stdout.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int puts (const char *__s);
/* Push a character back onto the input buffer of STREAM.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int ungetc (int __c, FILE *__stream);
libc_hidden_proto(ungetc)
@@ -650,14 +657,14 @@ libc_hidden_proto(ungetc)
/* Read chunks of generic data from STREAM.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern size_t fread (void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __stream) __wur;
libc_hidden_proto(fread)
/* Write chunks of generic data to STREAM.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern size_t fwrite (const void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __s) __wur;
@@ -860,11 +867,11 @@ struct obstack; /* See <obstack.h>. */
/* Write formatted output to an obstack. */
extern int obstack_printf (struct obstack *__restrict __obstack,
const char *__restrict __format, ...)
- __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
+ __THROWNL __attribute__ ((__format__ (__printf__, 2, 3)));
extern int obstack_vprintf (struct obstack *__restrict __obstack,
const char *__restrict __format,
__gnuc_va_list __args)
- __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
+ __THROWNL __attribute__ ((__format__ (__printf__, 2, 0)));
libc_hidden_proto(obstack_vprintf)
#endif /* USE_GNU && UCLIBC_HAS_OBSTACK. */
diff --git a/include/stdlib.h b/include/stdlib.h
index b2d70204e..809256d0c 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -38,7 +38,7 @@ __BEGIN_DECLS
#ifndef __need_malloc_and_calloc
#define _STDLIB_H 1
-#if defined __USE_XOPEN && !defined _SYS_WAIT_H
+#if (defined __USE_XOPEN || defined __USE_XOPEN2K8) && !defined _SYS_WAIT_H
/* XPG requires a few symbols from <sys/wait.h> being defined. */
# include <bits/waitflags.h>
# include <bits/waitstatus.h>
@@ -486,11 +486,11 @@ extern int lcong48_r (unsigned short int __param[7],
__BEGIN_NAMESPACE_STD
/* Allocate SIZE bytes of memory. */
extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur;