diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/argp.h | 29 | ||||
-rw-r--r-- | include/arpa/nameser.h | 1 | ||||
-rw-r--r-- | include/assert.h | 5 | ||||
-rw-r--r-- | include/elf.h | 11 | ||||
-rw-r--r-- | include/fcntl.h | 20 | ||||
-rw-r--r-- | include/features.h | 24 | ||||
-rw-r--r-- | include/internal/time64_helpers.h | 31 | ||||
-rw-r--r-- | include/libc-symbols.h | 14 | ||||
-rw-r--r-- | include/resolv.h | 2 | ||||
-rw-r--r-- | include/setjmp.h | 22 | ||||
-rw-r--r-- | include/stdlib.h | 4 | ||||
-rw-r--r-- | include/string.h | 1 | ||||
-rw-r--r-- | include/sys/auxv.h | 34 | ||||
-rw-r--r-- | include/sys/cdefs.h | 11 | ||||
-rw-r--r-- | include/sys/resource.h | 23 | ||||
-rw-r--r-- | include/sys/stat.h | 11 |
16 files changed, 195 insertions, 48 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/arpa/nameser.h b/include/arpa/nameser.h index 17c68f595..315305b1c 100644 --- a/include/arpa/nameser.h +++ b/include/arpa/nameser.h @@ -283,6 +283,7 @@ typedef enum __ns_type { ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */ ns_t_sink = 40, /* Kitchen sink (experimentatl) */ ns_t_opt = 41, /* EDNS0 option (meta-RR) */ + ns_t_tkey = 249, /* Transaction key */ ns_t_tsig = 250, /* Transaction signature. */ ns_t_ixfr = 251, /* Incremental zone transfer. */ ns_t_axfr = 252, /* Transfer zone of authority. */ diff --git a/include/assert.h b/include/assert.h index ee8e85fa2..fd71e833b 100644 --- a/include/assert.h +++ b/include/assert.h @@ -76,3 +76,8 @@ __END_DECLS # endif #endif /* NDEBUG. */ + +#if defined __USE_ISOC11 && !defined __cplusplus +# undef static_assert +# define static_assert _Static_assert +#endif diff --git a/include/elf.h b/include/elf.h index 7d66d70a4..c2efa9978 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. */ @@ -270,9 +273,10 @@ typedef struct #define EM_METAG 174 /* Imagination Technologies Meta */ #define EM_AARCH64 183 /* ARM AARCH64 */ #define EM_MICROBLAZE 189 /* Xilinx Microblaze */ -#define EM_ARCV2 195 /* ARCv2 Cores */ +#define EM_ARCV2 195 /* Synopsys ARCv2 Cores */ #define EM_RISCV 243 /* RISC-V */ #define EM_CSKY 252 /* C-SKY Cores */ +#define EM_ARCV3_32 255 /* Synopsys ARCv3 32-bit Cores */ #define EM_KVX 256 /* Kalray VLIW core of the MPPA processor family */ /* NEXT FREE NUMBER: Increment this after adding your official arch number */ @@ -817,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 */ 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..b5d4e79f2 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 @@ -142,18 +143,19 @@ /* 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 +437,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/internal/time64_helpers.h b/include/internal/time64_helpers.h new file mode 100644 index 000000000..2284aacd9 --- /dev/null +++ b/include/internal/time64_helpers.h @@ -0,0 +1,31 @@ +#ifndef _TIME64_HELPERS_H +#define _TIME64_HELPERS_H + +#include <bits/types.h> +#include <time.h> +#include <stddef.h> + +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/libc-symbols.h b/include/libc-symbols.h index 4dc05c76e..2254375ad 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -156,6 +156,11 @@ # define ASM_LINE_SEP ; #endif +#ifndef __attribute_copy__ +/* Provide an empty definition when cdefs.h is not included. */ +# define __attribute_copy__(arg) +#endif + #ifndef __ASSEMBLER__ /* GCC understands weak symbols and aliases; use its interface where possible, instead of embedded assembly language. */ @@ -163,13 +168,13 @@ /* Define ALIASNAME as a strong alias for NAME. */ # define strong_alias(name, aliasname) _strong_alias(name, aliasname) # define _strong_alias(name, aliasname) \ - extern __typeof (name) aliasname __attribute__ ((alias (#name))); + extern __typeof (name) aliasname __attribute__ ((alias (#name))) __attribute_copy__ (name); /* Same, but does not check for type match. Use sparingly. Example: strong_alias(stat,stat64) may fail, this one works: */ # define strong_alias_untyped(name, aliasname) \ _strong_alias_untyped(name, aliasname) # define _strong_alias_untyped(name, aliasname) \ - extern __typeof (aliasname) aliasname __attribute__ ((alias (#name))); + extern __typeof (aliasname) aliasname __attribute__ ((alias (#name))) __attribute_copy__ (name); # ifdef HAVE_WEAK_SYMBOLS @@ -182,7 +187,7 @@ If weak aliases are not available, this defines a strong alias. */ # define weak_alias(name, aliasname) _weak_alias (name, aliasname) # define _weak_alias(name, aliasname) \ - extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))); + extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))) __attribute_copy__ (name); /* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined). */ # define weak_extern(symbol) _weak_extern (weak symbol) @@ -423,7 +428,8 @@ FIXME! - ? # define __hidden_asmname2(prefix, name) #prefix name # define __hidden_ver1(local, internal, name) \ extern __typeof (name) __EI_##name __asm__(__hidden_asmname (#internal)); \ - extern __typeof (name) __EI_##name __attribute__((alias (__hidden_asmname1 (,#local)))) + extern __typeof (name) __EI_##name __attribute__((alias (__hidden_asmname1 (,#local)))) \ + __attribute_copy__ (name) # define hidden_ver(local, name) __hidden_ver1(local, __GI_##name, name); # define hidden_data_ver(local, name) hidden_ver(local, name) # define hidden_def(name) __hidden_ver1(__GI_##name, name, name); diff --git a/include/resolv.h b/include/resolv.h index 485b8db98..2a82641a4 100644 --- a/include/resolv.h +++ b/include/resolv.h @@ -457,7 +457,7 @@ __END_DECLS # ifndef NOT_IN_libc # define __resp __libc_resp # endif -# define _res (*__resp) +# define _res (*__res_state()) extern __thread struct __res_state *__resp attribute_tls_model_ie; # endif # else 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/stdlib.h b/include/stdlib.h index 6a253cc3f..8b1375184 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -979,12 +979,14 @@ extern int getpt (void); # endif #endif -#if 0 /* def __USE_BSD */ +#ifdef __USE_BSD /* Put the 1 minute, 5 minute and 15 minute load averages into the first NELEM elements of LOADAVG. Return the number written (never more than three, but may be less than NELEM), or -1 if an error occurred. */ extern int getloadavg (double __loadavg[], int __nelem) __THROW __nonnull ((1)); + +extern void *reallocarray (void *__ptr, size_t __m, size_t __n); #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 a4359a05c..5c4daebcd 100644 --- a/include/sys/cdefs.h +++ b/include/sys/cdefs.h @@ -330,6 +330,17 @@ # endif #endif +/* Undefine (also defined in libc-symbols.h). */ +#undef __attribute_copy__ +#if __GNUC_PREREQ (9, 0) +/* Copies attributes from the declaration or type referenced by + the argument. */ +# define __attribute_copy__(arg) __attribute__ ((__copy__ (arg))) +#else +# define __attribute_copy__(arg) +#endif + + /* GCC 4.3 and above allow passing all anonymous arguments of an __extern_always_inline function to some other vararg function. */ #if __GNUC_PREREQ (4,3) diff --git a/include/sys/resource.h b/include/sys/resource.h index 17167ed99..a5c69d84e 100644 --- a/include/sys/resource.h +++ b/include/sys/resource.h @@ -101,6 +101,29 @@ extern int setpriority (__priority_which_t __which, id_t __who, int __prio) __THROW; 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; +# 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 #endif /* sys/resource.h */ 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 |