summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/argp.h29
-rw-r--r--include/atomic.h18
-rw-r--r--include/elf.h14
-rw-r--r--include/fcntl.h20
-rw-r--r--include/features.h36
-rw-r--r--include/fenv.h10
-rw-r--r--include/internal/time64_helpers.h36
-rw-r--r--include/net/ppp_defs.h2
-rw-r--r--include/setjmp.h22
-rw-r--r--include/spawn.h1
-rw-r--r--include/stdint.h8
-rw-r--r--include/stdio.h5
-rw-r--r--include/stdlib.h8
-rw-r--r--include/string.h1
-rw-r--r--include/sys/auxv.h34
-rw-r--r--include/sys/cdefs.h14
-rw-r--r--include/sys/mount.h25
-rw-r--r--include/sys/resource.h20
-rw-r--r--include/sys/stat.h11
-rw-r--r--include/sys/uio.h19
-rw-r--r--include/ucontext.h4
-rw-r--r--include/unistd.h13
22 files changed, 288 insertions, 62 deletions
diff --git a/include/argp.h b/include/argp.h
index 8e8674296..d67723521 100644
--- a/include/argp.h
+++ b/include/argp.h
@@ -46,12 +46,14 @@
/* This feature is available in gcc versions 2.5 and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || defined(__STRICT_ANSI__)
# define __attribute__(Spec) /* empty */
+# define __UCLIBC_ATTRIBUTE_FALLBACK__
# endif
/* The __-protected variants of `format' and `printf' attributes
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || defined(__STRICT_ANSI__)
# define __format__ format
# define __printf__ printf
+# define __UCLIBC_PRINTF_FALLBACK__
# endif
#endif
@@ -71,7 +73,7 @@
typedef int error_t;
# define __error_t_defined
#endif
-
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -145,7 +147,7 @@ struct argp_option
distinguish these two cases, -x should probably be marked
OPTION_NO_USAGE. */
#define OPTION_NO_USAGE 0x10
-
+
struct argp; /* fwd declare this type */
struct argp_state; /* " */
struct argp_child; /* " */
@@ -283,7 +285,7 @@ struct argp
suppressed. */
#define ARGP_KEY_HELP_DUP_ARGS_NOTE 0x2000005
#define ARGP_KEY_HELP_ARGS_DOC 0x2000006 /* Argument doc string. */
-
+
/* When an argp has a non-zero CHILDREN field, it should point to a vector of
argp_child structures, each of which describes a subsidiary argp. */
struct argp_child
@@ -308,7 +310,7 @@ struct argp_child
(merging the child's grouping levels with the parents). */
int group;
};
-
+
/* Parsing state. This is provided to parsing functions called by argp,
which may examine and, as noted, modify fields. */
struct argp_state
@@ -356,7 +358,7 @@ struct argp_state
void *pstate; /* Private, for use by argp. */
};
-
+
/* Flags for argp_parse (note that the defaults are those that are
convenient for program command line parsing): */
@@ -412,7 +414,7 @@ extern error_t argp_parse (__const struct argp *__restrict __argp,
int __argc, char **__restrict __argv,
unsigned __flags, int *__restrict __arg_index,
void *__restrict __input);
-
+
/* Global variables. */
/* If defined or set by the user program to a non-zero value, then a default
@@ -441,7 +443,7 @@ extern __const char *argp_program_bug_address;
If not defined or set by the user program, this defaults to EX_USAGE from
<sysexits.h>. */
extern error_t argp_err_exit_status;
-
+
/* Flags for argp_help. */
#define ARGP_HELP_USAGE 0x01 /* a Usage: message. */
#define ARGP_HELP_SHORT_USAGE 0x02 /* " but don't actually print options. */
@@ -476,7 +478,7 @@ extern error_t argp_err_exit_status;
extern void argp_help (__const struct argp *__restrict __argp,
FILE *__restrict __stream,
unsigned __flags, char *__restrict __name);
-
+
/* The following routines are intended to be called from within an argp
parsing routine (thus taking an argp_state structure as the first
argument). They may or may not print an error message and exit, depending
@@ -526,7 +528,7 @@ extern int __option_is_end (__const struct argp_option *__opt) __THROW;
extern void *__argp_input (__const struct argp *__restrict __argp,
__const struct argp_state *__restrict __state)
__THROW;
-
+
#ifdef __USE_EXTERN_INLINES
# ifndef ARGP_EI
@@ -562,4 +564,13 @@ __NTH (__option_is_end (__const struct argp_option *__opt))
}
#endif
+#ifdef __UCLIBC_ATTRIBUTE_FALLBACK__
+# undef __attribute__
+#endif
+
+#ifdef __UCLIBC_PRINTF_FALLBACK__
+# undef __format__
+# undef __printf__
+#endif
+
#endif /* argp.h */
diff --git a/include/atomic.h b/include/atomic.h
index 267aff5d5..3adcfbc5f 100644
--- a/include/atomic.h
+++ b/include/atomic.h
@@ -54,15 +54,15 @@
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__); \
+ __atg1_result = (__typeof ((__typeof (*(mem))) *(mem))) pre##_8_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 2) \
- __atg1_result = pre##_16_##post (mem, __VA_ARGS__); \
+ __atg1_result = (__typeof ((__typeof (*(mem))) *(mem))) pre##_16_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 4) \
- __atg1_result = pre##_32_##post (mem, __VA_ARGS__); \
+ __atg1_result = (__typeof ((__typeof (*(mem))) *(mem))) pre##_32_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 8) \
- __atg1_result = pre##_64_##post (mem, __VA_ARGS__); \
+ __atg1_result = (__typeof ((__typeof (*(mem))) *(mem))) pre##_64_##post (mem, __VA_ARGS__); \
else \
abort (); \
__atg1_result; \
@@ -71,13 +71,13 @@
({ \
int __atg2_result; \
if (sizeof (*mem) == 1) \
- __atg2_result = pre##_8_##post (mem, __VA_ARGS__); \
+ __atg2_result = (int) pre##_8_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 2) \
- __atg2_result = pre##_16_##post (mem, __VA_ARGS__); \
+ __atg2_result = (int) pre##_16_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 4) \
- __atg2_result = pre##_32_##post (mem, __VA_ARGS__); \
+ __atg2_result = (int) pre##_32_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 8) \
- __atg2_result = pre##_64_##post (mem, __VA_ARGS__); \
+ __atg2_result = (int) pre##_64_##post (mem, __VA_ARGS__); \
else \
abort (); \
__atg2_result; \
diff --git a/include/elf.h b/include/elf.h
index b7edbade2..1e7c89615 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -60,6 +60,9 @@ typedef uint16_t Elf64_Section;
typedef Elf32_Half Elf32_Versym;
typedef Elf64_Half Elf64_Versym;
+/* Type for relative relocations in DT_RELR format */
+typedef Elf32_Word Elf32_Relr;
+typedef Elf64_Xword Elf64_Relr;
/* The ELF file header. This appears at the start of every ELF file. */
@@ -818,7 +821,10 @@ typedef struct
#define DT_ENCODING 32 /* Start of encoded range */
#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/
#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */
-#define DT_NUM 34 /* Number used */
+#define DT_RELRSZ 35 /* Size in bytes, of DT_RELR table */
+#define DT_RELR 36 /* Address of Relr relocs */
+#define DT_RELRENT 37 /* Size in bytes of one DT_RELR entry */
+#define DT_NUM 38 /* Number used */
#define DT_LOOS 0x6000000d /* Start of OS-specific */
#define DT_HIOS 0x6ffff000 /* End of OS-specific */
#define DT_LOPROC 0x70000000 /* Start of processor-specific */
@@ -3582,8 +3588,12 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_XTENSA_TLSDESC_FN 50
#define R_XTENSA_TLSDESC_ARG 51
#define R_XTENSA_TLS_TPOFF 53
+#define R_XTENSA_SYM32 63
+#define R_XTENSA_FUNCDESC 68
+#define R_XTENSA_FUNCDESC_VALUE 69
+#define R_XTENSA_TLSDESC 72
/* Keep this the last entry. */
-#define R_XTENSA_NUM 54
+#define R_XTENSA_NUM 77
/* C6X specific relocs */
#define R_C6000_NONE 0
diff --git a/include/fcntl.h b/include/fcntl.h
index 136f64d70..ce15ceaf6 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -296,6 +296,26 @@ int name_to_handle_at(int dirfd, const char *pathname,
int open_by_handle_at(int mount_fd, struct file_handle *handle, int flags);
#endif
+#ifdef __USE_GNU
+# define F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */
+# define F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */
+/* Owner types. */
+enum __pid_type
+ {
+ F_OWNER_TID = 0, /* Kernel thread. */
+ F_OWNER_PID, /* Process. */
+ F_OWNER_PGRP, /* Process group. */
+ F_OWNER_GID = F_OWNER_PGRP /* Alternative, obsolete name. */
+ };
+
+/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */
+struct f_owner_ex
+ {
+ enum __pid_type type; /* Owner type of ID. */
+ __pid_t pid; /* ID of owner. */
+ };
+#endif
+
__END_DECLS
#endif /* fcntl.h */
diff --git a/include/features.h b/include/features.h
index d6e45c2ff..1a4efb9db 100644
--- a/include/features.h
+++ b/include/features.h
@@ -40,7 +40,8 @@
_SVID_SOURCE ISO C, POSIX, and SVID things.
_ATFILE_SOURCE Additional *at interfaces.
_GNU_SOURCE All of the above, plus GNU extensions.
- _DEFAULT_SOURCE Equivalent to defining _BSD_SOURCE and _SVID_SOURCE.
+ _DEFAULT_SOURCE Equivalent to defining _BSD_SOURCE and _SVID_SOURCE,
+ as well as _POSIX_C_SOURCE=200809L.
_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
@@ -139,21 +140,34 @@
# define __GNUC_PREREQ(maj, min) 0
#endif
+/* Convenience macro to test the version of clang.
+ Use like this:
+ #if __CLANG_PREREQ(3,2)
+ ... code requiring clang 3.2 or later ...
+ #endif */
+#if defined __clang__
+# define __CLANG_PREREQ(maj, min) \
+ ((__clang_major__ << 16) + __clang_minor__ >= ((maj) << 16) + (min))
+#else
+# define __CLANG_PREREQ(maj, min) 0
+#endif
+
/* Whether to use feature set F. */
#define __GLIBC_USE(F) __GLIBC_USE_ ## F
-/* _DEFAULT_SOURCE is equivalent to defining _BSD_SOURCE and _SVID_SOURCE
- * and vice versa. */
-#ifdef _DEFAULT_SOURCE
+/* _DEFAULT_SOURCE is equivalent to defining _BSD_SOURCE, _SVID_SOURCE
+ * and _POSIX_C_SOURCE=200809L and vice versa. */
+#if defined _DEFAULT_SOURCE || defined _BSD_SOURCE || defined _SVID_SOURCE
+# undef _DEFAULT_SOURCE
+# define _DEFAULT_SOURCE 1
# undef _BSD_SOURCE
# define _BSD_SOURCE 1
# undef _SVID_SOURCE
# define _SVID_SOURCE 1
-#endif
-
-#if defined _BSD_SOURCE || defined _SVID_SOURCE
-# undef _DEFAULT_SOURCE
-# define _DEFAULT_SOURCE 1
+# if _POSIX_C_SOURCE < 200809L
+# undef _POSIX_C_SOURCE
+# define _POSIX_C_SOURCE 200809L
+# endif
#endif
/* If _GNU_SOURCE was defined by the user, turn on all the other features. */
@@ -435,4 +449,8 @@
# include <libc-internal.h>
#endif
+#if defined(__UCLIBC_USE_TIME64__) || __TARGET_ARCH_BITS__ == 64
+#define __USE_TIME_BITS64 1
+#endif
+
#endif /* features.h */
diff --git a/include/fenv.h b/include/fenv.h
index 9ba384756..4b532c573 100644
--- a/include/fenv.h
+++ b/include/fenv.h
@@ -23,6 +23,7 @@
#define _FENV_H 1
#include <features.h>
+#include <stdbool.h>
/* Get the architecture dependend definitions. The following definitions
are expected to be done:
@@ -130,6 +131,15 @@ extern int fedisableexcept (int __excepts) __THROW;
extern int fegetexcept (void) __THROW;
#endif
+/* Rounding mode context. This allows functions to set/restore rounding mode
+ only when the desired rounding mode is different from the current rounding
+ mode. */
+struct rm_ctx
+{
+ fenv_t env;
+ bool updated_status;
+};
+
__END_DECLS
#endif /* fenv.h */
diff --git a/include/internal/time64_helpers.h b/include/internal/time64_helpers.h
new file mode 100644
index 000000000..e2ed0f3bb
--- /dev/null
+++ b/include/internal/time64_helpers.h
@@ -0,0 +1,36 @@
+#ifndef _TIME64_HELPERS_H
+#define _TIME64_HELPERS_H
+
+#include <linux/version.h>
+#include <bits/types.h>
+#include <time.h>
+#include <stddef.h>
+
+#if defined(__UCLIBC_USE_TIME64__) && __TARGET_ARCH_BITS__ == 32 && LINUX_VERSION_CODE < KERNEL_VERSION(5,1,0)
+#error 64bit time on 32bit targets is not supported on Linux < 5.1.0
+#endif
+
+struct __ts64_struct {
+ __S64_TYPE tv_sec;
+ __S64_TYPE tv_nsec;
+};
+
+#define TO_TS64_P(__ts) (((struct timespec *)(__ts)) ? \
+ (&(struct __ts64_struct) {.tv_sec = ((struct timespec *)(__ts))->tv_sec, \
+ .tv_nsec = ((struct timespec *)(__ts))->tv_nsec}) : NULL)
+
+struct __its64_struct {
+ __S64_TYPE interval_tv_sec;
+ __S64_TYPE interval_tv_nsec;
+ __S64_TYPE value_tv_sec;
+ __S64_TYPE value_tv_nsec;
+};
+
+#define TO_ITS64_P(__its) (((struct itimerspec *)(__its)) ? \
+ (&(struct __its64_struct) {.interval_tv_sec = ((struct itimerspec *)(__its))->it_interval.tv_sec, \
+ .interval_tv_nsec = ((struct itimerspec *)(__its))->it_interval.tv_nsec, \
+ .value_tv_sec = ((struct itimerspec *)(__its))->it_value.tv_sec, \
+ .value_tv_nsec = ((struct itimerspec *)(__its))->it_value.tv_nsec}) : NULL)
+
+
+#endif /* _TIME64_HELPERS_H */
diff --git a/include/net/ppp_defs.h b/include/net/ppp_defs.h
index f8924c4f2..904d1933c 100644
--- a/include/net/ppp_defs.h
+++ b/include/net/ppp_defs.h
@@ -4,7 +4,7 @@
#define __need_time_t
#include <time.h>
-#include <asm/types.h>
+#include <sys/types.h>
#include <linux/ppp_defs.h>
#endif /* net/ppp_defs.h */
diff --git a/include/setjmp.h b/include/setjmp.h
index 27cac9500..5d7df3667 100644
--- a/include/setjmp.h
+++ b/include/setjmp.h
@@ -27,21 +27,7 @@
__BEGIN_DECLS
#include <bits/setjmp.h> /* Get `__jmp_buf'. */
-#include <bits/sigset.h> /* Get `__sigset_t'. */
-
-
-/* Calling environment, plus possibly a saved signal mask. */
-struct __jmp_buf_tag
- {
- /* NOTE: The machine-dependent definitions of `__sigsetjmp'
- assume that a `jmp_buf' begins with a `__jmp_buf' and that
- `__mask_was_saved' follows it. Do not move these members
- or add others before it. */
- __jmp_buf __jmpbuf; /* Calling environment. */
- int __mask_was_saved; /* Saved the signal mask? */
- __sigset_t __saved_mask; /* Saved signal mask. */
- };
-
+#include <bits/jmp_buf_tag.h>
__BEGIN_NAMESPACE_STD
@@ -108,8 +94,10 @@ __END_DECLS
#ifdef _LIBC
extern void __longjmp(__jmp_buf __env, int __val) __THROWNL attribute_noreturn;
libc_hidden_proto(__longjmp)
-extern __typeof(longjmp) __libc_longjmp __THROWNL attribute_noreturn;
-extern __typeof(siglongjmp) __libc_siglongjmp __THROWNL attribute_noreturn;
+extern void __libc_longjmp(struct __jmp_buf_tag __env[1], int __val)
+ __THROWNL attribute_noreturn;
+extern void __libc_siglongjmp(sigjmp_buf __env, int __val)
+ __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 3de375b41..cf01639c1 100644
--- a/include/spawn.h
+++ b/include/spawn.h
@@ -103,6 +103,7 @@ int posix_spawnattr_init (posix_spawnattr_t *__attr)
static inline
int posix_spawnattr_destroy (posix_spawnattr_t *__attr)
{
+ (void)__attr;
return 0;
}
diff --git a/include/stdint.h b/include/stdint.h
index 749f73697..5fedfb574 100644
--- a/include/stdint.h
+++ b/include/stdint.h
@@ -144,11 +144,19 @@ typedef unsigned long long int uintmax_t;
# if __WORDSIZE == 64
+# ifndef __INT64_C
# define __INT64_C(c) c ## L
+# endif
+# ifndef __UINT64_C
# define __UINT64_C(c) c ## UL
+# endif
# else
+# ifndef __INT64_C
# define __INT64_C(c) c ## LL
+# endif
+# ifndef __UINT64_C
# define __UINT64_C(c) c ## ULL
+# endif
# endif
/* Limits of integral types. */
diff --git a/include/stdio.h b/include/stdio.h
index 0915da909..a48fa9b78 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -110,7 +110,10 @@ typedef __STDIO_fpos64_t fpos64_t;
#define SEEK_SET 0 /* Seek from beginning of file. */
#define SEEK_CUR 1 /* Seek from current position. */
#define SEEK_END 2 /* Seek from end of file. */
-
+#ifdef __USE_GNU
+# define SEEK_DATA 3 /* Seek to next data. */
+# define SEEK_HOLE 4 /* Seek to next hole. */
+#endif
#if defined __USE_SVID || defined __USE_XOPEN
/* Default path prefix for `mkstemp'. */
diff --git a/include/stdlib.h b/include/stdlib.h
index 987fe2223..448c5e336 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -606,7 +606,7 @@ libc_hidden_proto(unsetenv)
#ifdef __UCLIBC_DYNAMIC_ATEXIT__
# define __UCLIBC_MAX_ATEXIT INT_MAX
#else
-# define __UCLIBC_MAX_ATEXIT 20
+# define __UCLIBC_MAX_ATEXIT 32
#endif
@@ -985,6 +985,12 @@ extern int getpt (void);
three, but may be less than NELEM), or -1 if an error occurred. */
extern int getloadavg (double __loadavg[], int __nelem)
__THROW __nonnull ((1));
+
+/* reallocarray() only provided by the malloc-standard implementation */
+#if defined(__MALLOC_STANDARD__)
+extern void *reallocarray (void *__ptr, size_t __m, size_t __n);
+#endif
+
#endif
#ifdef _LIBC
diff --git a/include/string.h b/include/string.h
index 5ffd97150..1dc994df7 100644
--- a/include/string.h
+++ b/include/string.h
@@ -344,6 +344,7 @@ extern void __bzero (void *__s, size_t __n) __THROW __nonnull ((1));
#endif
#ifdef __USE_BSD
+extern void explicit_bzero (void *__d, size_t __n);
# ifdef __UCLIBC_SUSV3_LEGACY__
/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
extern void bcopy (const void *__src, void *__dest, size_t __n)
diff --git a/include/sys/auxv.h b/include/sys/auxv.h
new file mode 100644
index 000000000..b07026457
--- /dev/null
+++ b/include/sys/auxv.h
@@ -0,0 +1,34 @@
+/* Copyright (C) 2022 uClibc-ng
+ This file is part of the uClibc-ng 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 _SYS_AUXV_H
+#define _SYS_AUXV_H 1
+
+#include <features.h>
+#include <elf.h>
+#include <bits/hwcap.h>
+
+__BEGIN_DECLS
+
+/* Return the value associated with an Elf*_auxv_t type from the auxv list
+ passed to the program on startup. If TYPE was not present in the auxv
+ list, returns zero and sets errno to ENOENT. */
+extern unsigned long int getauxval (unsigned long int __type) __THROW;
+
+__END_DECLS
+
+#endif /* sys/auxv.h */
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
index 5c4daebcd..656548c52 100644
--- a/include/sys/cdefs.h
+++ b/include/sys/cdefs.h
@@ -58,9 +58,15 @@
# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct
# else
# if defined __cplusplus && __GNUC_PREREQ (2,8)
-# define __THROW throw ()
-# define __THROWNL throw ()
-# define __NTH(fct) __LEAF_ATTR fct throw ()
+/* Dynamic exception specification is deprecated since C++11, so
+ we only use it when compiling for an earlier standard. */
+# if __cplusplus < 201103UL
+# define __THROW throw ()
+# else
+# define __THROW noexcept
+# endif
+# define __THROWNL __THROW
+# define __NTH(fct) __LEAF_ATTR fct __THROW
# else
# define __THROW
# define __THROWNL
@@ -314,7 +320,7 @@
inline semantics, unless -fgnu89-inline is used.
For -std=gnu99, forcing gnu_inline attribute does not change behavior,
but may silence spurious warnings (such as in GCC 4.2). */
-#if !defined __cplusplus || __GNUC_PREREQ (4,3)
+#if !defined __cplusplus || __GNUC_PREREQ (4,3) || __CLANG_PREREQ(8,0)
# if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ || defined __cplusplus
# define __extern_inline extern __inline __attribute__ ((__gnu_inline__))
# if __GNUC_PREREQ (4,3)
diff --git a/include/sys/mount.h b/include/sys/mount.h
index c0e7b84f8..f9edbeba3 100644
--- a/include/sys/mount.h
+++ b/include/sys/mount.h
@@ -32,54 +32,79 @@
supported */
enum
{
+#undef MS_RDONLY
MS_RDONLY = 1, /* Mount read-only. */
#define MS_RDONLY MS_RDONLY
+#undef MS_NOSUID
MS_NOSUID = 2, /* Ignore suid and sgid bits. */
#define MS_NOSUID MS_NOSUID
+#undef MS_NODEV
MS_NODEV = 4, /* Disallow access to device special files. */
#define MS_NODEV MS_NODEV
+#undef MS_NOEXEC
MS_NOEXEC = 8, /* Disallow program execution. */
#define MS_NOEXEC MS_NOEXEC
+#undef MS_SYNCHRONOUS
MS_SYNCHRONOUS = 16, /* Writes are synced at once. */
#define MS_SYNCHRONOUS MS_SYNCHRONOUS
+#undef MS_REMOUNT
MS_REMOUNT = 32, /* Alter flags of a mounted FS. */
#define MS_REMOUNT MS_REMOUNT
+#undef MS_MANDLOCK
MS_MANDLOCK = 64, /* Allow mandatory locks on an FS. */
#define MS_MANDLOCK MS_MANDLOCK
+#undef MS_DIRSYNC
MS_DIRSYNC = 128, /* Directory modifications are synchronous. */
#define MS_DIRSYNC MS_DIRSYNC
+#undef MS_NOATIME
MS_NOATIME = 1024, /* Do not update access times. */
#define MS_NOATIME MS_NOATIME
+#undef MS_NODIRATIME
MS_NODIRATIME = 2048, /* Do not update directory access times. */
#define MS_NODIRATIME MS_NODIRATIME
+#undef MS_BIND
MS_BIND = 4096, /* Bind directory at different place. */
#define MS_BIND MS_BIND
+#undef MS_MOVE
MS_MOVE = 8192,
#define MS_MOVE MS_MOVE
+#undef MS_REC
MS_REC = 16384,
#define MS_REC MS_REC
+#undef MS_SILENT
MS_SILENT = 32768,
#define MS_SILENT MS_SILENT
+#undef MS_POSIXACL
MS_POSIXACL = 1 << 16, /* VFS does not apply the umask. */
#define MS_POSIXACL MS_POSIXACL
+#undef MS_UNBINDABLE
MS_UNBINDABLE = 1 << 17, /* Change to unbindable. */
#define MS_UNBINDABLE MS_UNBINDABLE
+#undef MS_PRIVATE
MS_PRIVATE = 1 << 18, /* Change to private. */
#define MS_PRIVATE MS_PRIVATE
+#undef MS_SLAVE
MS_SLAVE = 1 << 19, /* Change to slave. */
#define MS_SLAVE MS_SLAVE
+#undef MS_SHARED
MS_SHARED = 1 << 20, /* Change to shared. */
#define MS_SHARED MS_SHARED
+#undef MS_RELATIME
MS_RELATIME = 1 << 21, /* Update atime relative to mtime/ctime. */
#define MS_RELATIME MS_RELATIME
+#undef MS_KERNMOUNT
MS_KERNMOUNT = 1 << 22, /* This is a kern_mount call. */
#define MS_KERNMOUNT MS_KERNMOUNT
+#undef MS_I_VERSION
MS_I_VERSION = 1 << 23, /* Update inode I_version field. */
#define MS_I_VERSION MS_I_VERSION
+#undef MS_STRICTATIME
MS_STRICTATIME = 1 << 24, /* Always perform atime updates. */
#define MS_STRICTATIME MS_STRICTATIME
+#undef MS_ACTIVE
MS_ACTIVE = 1 << 30,
#define MS_ACTIVE MS_ACTIVE
+#undef MS_NOUSER
MS_NOUSER = 1 << 31
#define MS_NOUSER MS_NOUSER
};
diff --git a/include/sys/resource.h b/include/sys/resource.h
index 00c63ff0f..a5c69d84e 100644
--- a/include/sys/resource.h
+++ b/include/sys/resource.h
@@ -103,9 +103,25 @@ libc_hidden_proto(setpriority)
#ifdef __USE_GNU
/* Modify and return resource limits of a process atomically. */
+# ifndef __USE_FILE_OFFSET64
extern int prlimit (__pid_t __pid, enum __rlimit_resource __resource,
- const struct rlimit *__new_limit,
- struct rlimit *__old_limit) __THROW;
+ const struct rlimit *__new_limit,
+ struct rlimit *__old_limit) __THROW;
+# else
+# ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (prlimit, (__pid_t __pid,
+ enum __rlimit_resource __resource,
+ const struct rlimit *__new_limit,
+ struct rlimit *__old_limit), prlimit64);
+# else
+# define prlimit prlimit64
+# endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern int prlimit64 (__pid_t __pid, enum __rlimit_resource __resource,
+ const struct rlimit64 *__new_limit,
+ struct rlimit64 *__old_limit) __THROW;
+# endif
#endif
__END_DECLS
diff --git a/include/sys/stat.h b/include/sys/stat.h
index b6480bf97..2dca6c552 100644
--- a/include/sys/stat.h
+++ b/include/sys/stat.h
@@ -117,7 +117,8 @@ __BEGIN_DECLS
# ifdef __S_IFLNK
# define S_IFLNK __S_IFLNK
# endif
-# if (defined __USE_BSD || defined __USE_MISC || defined __USE_UNIX98) \
+# if (defined __USE_BSD || defined __USE_MISC || defined __USE_UNIX98 \
+ || defined __USE_XOPEN2K) \
&& defined __S_IFSOCK
# define S_IFSOCK __S_IFSOCK
# endif
@@ -142,7 +143,7 @@ __BEGIN_DECLS
# define S_ISLNK(mode) 0
#endif
-#if (defined __USE_BSD || defined __USE_UNIX98) \
+#if (defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K) \
&& defined __S_IFSOCK
# define S_ISSOCK(mode) __S_ISTYPE((mode), __S_IFSOCK)
#endif
@@ -301,7 +302,7 @@ extern int lchmod (const char *__file, __mode_t __mode)
#endif
/* Set file access permissions of the file FD is open on to MODE. */
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
extern int fchmod (int __fd, __mode_t __mode) __THROW;
#endif
@@ -370,7 +371,7 @@ extern int mkfifo (const char *__path, __mode_t __mode)
extern int mkfifoat (int __fd, const char *__path, __mode_t __mode)
__THROW __nonnull ((2));
#endif
-
+
#ifdef __USE_ATFILE
/* Set file access and modification times relative to directory file
descriptor. */
@@ -385,7 +386,7 @@ libc_hidden_proto(utimensat)
/* Set file access and modification times of the file associated with FD. */
extern int futimens (int __fd, const struct timespec __times[2]) __THROW;
#endif
-
+
/* on uClibc we have unversioned struct stat and mknod.
* bits/stat.h is filled with wrong info, so we undo it here. */
#undef _STAT_VER
diff --git a/include/sys/uio.h b/include/sys/uio.h
index 330426fec..9e9708c0c 100644
--- a/include/sys/uio.h
+++ b/include/sys/uio.h
@@ -74,6 +74,25 @@ extern ssize_t pwritev (int __fd, const struct iovec *__iovec, int __count,
__off64_t __offset) __wur;
#endif /* Use misc. */
+#ifdef __USE_GNU
+/* Read from another process' address space. */
+extern ssize_t process_vm_readv (pid_t __pid, const struct iovec *__lvec,
+ unsigned long int __liovcnt,
+ const struct iovec *__rvec,
+ unsigned long int __riovcnt,
+ unsigned long int __flags)
+ __THROW;
+
+/* Write to another process' address space. */
+extern ssize_t process_vm_writev (pid_t __pid, const struct iovec *__lvec,
+ unsigned long int __liovcnt,
+ const struct iovec *__rvec,
+ unsigned long int __riovcnt,
+ unsigned long int __flags)
+ __THROW;
+
+#endif
+
__END_DECLS
#endif /* sys/uio.h */
diff --git a/include/ucontext.h b/include/ucontext.h
index 4ce114ef1..76b4f375e 100644
--- a/include/ucontext.h
+++ b/include/ucontext.h
@@ -23,11 +23,11 @@
#include <features.h>
-#ifdef __UCLIBC_HAS_CONTEXT_FUNCS__
-
/* Get machine dependent definition of data structures. */
#include <sys/ucontext.h>
+#ifdef __UCLIBC_HAS_CONTEXT_FUNCS__
+
__BEGIN_DECLS
/* Get user context and store it in variable pointed to by UCP. */
diff --git a/include/unistd.h b/include/unistd.h
index 36cd5fcb5..e45266f14 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -316,6 +316,10 @@ libc_hidden_proto(faccessat)
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Seek from end of file. */
+# ifdef __USE_GNU
+# define SEEK_DATA 3 /* Seek to next data. */
+# define SEEK_HOLE 4 /* Seek to next hole. */
+# endif
#endif
#if defined __USE_BSD && !defined L_SET
@@ -1246,6 +1250,15 @@ extern void swab (const void *__restrict __from, void *__restrict __to,
extern char *ctermid (char *__s) __THROW;
#endif
+/* OpenBSD-compatible access to random bytes.
+ May be a cancellation point here, unlike in glibc/musl. */
+#ifdef _DEFAULT_SOURCE
+# ifndef __getentropy_defined
+extern int getentropy(void *__buf, size_t __len) __nonnull ((1)) __wur;
+# define __getentropy_defined
+# endif
+#endif
+
__END_DECLS