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/atomic.h | 18 | ||||
-rw-r--r-- | include/ctype.h | 32 | ||||
-rw-r--r-- | include/elf.h | 172 | ||||
-rw-r--r-- | include/fcntl.h | 44 | ||||
-rw-r--r-- | include/features.h | 36 | ||||
-rw-r--r-- | include/fenv.h | 10 | ||||
-rw-r--r-- | include/internal/time64_helpers.h | 36 | ||||
-rw-r--r-- | include/libc-symbols.h | 14 | ||||
-rw-r--r-- | include/net/ppp_defs.h | 2 | ||||
-rw-r--r-- | include/resolv.h | 10 | ||||
-rw-r--r-- | include/setjmp.h | 22 | ||||
-rw-r--r-- | include/spawn.h | 1 | ||||
-rw-r--r-- | include/stdint.h | 8 | ||||
-rw-r--r-- | include/stdio.h | 5 | ||||
-rw-r--r-- | include/stdlib.h | 10 | ||||
-rw-r--r-- | include/string.h | 4 | ||||
-rw-r--r-- | include/sys/auxv.h | 34 | ||||
-rw-r--r-- | include/sys/cdefs.h | 25 | ||||
-rw-r--r-- | include/sys/mount.h | 25 | ||||
-rw-r--r-- | include/sys/personality.h | 18 | ||||
-rw-r--r-- | include/sys/resource.h | 23 | ||||
-rw-r--r-- | include/sys/socket.h | 2 | ||||
-rw-r--r-- | include/sys/stat.h | 18 | ||||
-rw-r--r-- | include/sys/uio.h | 23 | ||||
-rw-r--r-- | include/ucontext.h | 4 | ||||
-rw-r--r-- | include/unistd.h | 17 |
29 files changed, 533 insertions, 115 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/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/ctype.h b/include/ctype.h index ecd5e7308..05f21c553 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -350,46 +350,14 @@ libc_hidden_proto(tolower_l) /* Return the uppercase version of C. */ extern int toupper_l (int __c, __locale_t __l) __THROW; -# if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus -# define tolower_l(c, locale) __tobody(c, tolower_l, (locale)->__ctype_tolower, (c, locale)) -# define toupper_l(c, locale) __tobody(c, toupper_l, (locale)->__ctype_toupper, (c, locale)) -# endif /* Optimizing gcc */ - - # define __isctype_l(c, type, locale) ((locale)->__ctype_b[(int) (c)] & (__ctype_mask_t) type) # ifndef __NO_CTYPE -# define __isalnum_l(c,l) __isctype_l((c), _ISalnum, (l)) -# define __isalpha_l(c,l) __isctype_l((c), _ISalpha, (l)) -# define __iscntrl_l(c,l) __isctype_l((c), _IScntrl, (l)) -# define __isdigit_l(c,l) __isctype_l((c), _ISdigit, (l)) -# define __islower_l(c,l) __isctype_l((c), _ISlower, (l)) -# define __isgraph_l(c,l) __isctype_l((c), _ISgraph, (l)) -# define __isprint_l(c,l) __isctype_l((c), _ISprint, (l)) -# define __ispunct_l(c,l) __isctype_l((c), _ISpunct, (l)) -# define __isspace_l(c,l) __isctype_l((c), _ISspace, (l)) -# define __isupper_l(c,l) __isctype_l((c), _ISupper, (l)) -# define __isxdigit_l(c,l) __isctype_l((c), _ISxdigit, (l)) -# define __isblank_l(c,l) __isctype_l((c), _ISblank, (l)) - # if (defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN) \ && defined __UCLIBC_SUSV4_LEGACY__ # define __isascii_l(c,l) ((l), __isascii (c)) # define __toascii_l(c,l) ((l), __toascii (c)) # endif -# define isalnum_l(c,l) __isalnum_l ((c), (l)) -# define isalpha_l(c,l) __isalpha_l ((c), (l)) -# define iscntrl_l(c,l) __iscntrl_l ((c), (l)) -# define isdigit_l(c,l) __isdigit_l ((c), (l)) -# define islower_l(c,l) __islower_l ((c), (l)) -# define isgraph_l(c,l) __isgraph_l ((c), (l)) -# define isprint_l(c,l) __isprint_l ((c), (l)) -# define ispunct_l(c,l) __ispunct_l ((c), (l)) -# define isspace_l(c,l) __isspace_l ((c), (l)) -# define isupper_l(c,l) __isupper_l ((c), (l)) -# define isxdigit_l(c,l) __isxdigit_l ((c), (l)) -# define isblank_l(c,l) __isblank_l ((c), (l)) - # if (defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN) \ && defined __UCLIBC_SUSV4_LEGACY__ # define isascii_l(c,l) __isascii_l ((c), (l)) diff --git a/include/elf.h b/include/elf.h index a9957fc31..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. */ @@ -270,10 +273,14 @@ 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 */ -#define EM_NUM 196 +#define EM_NUM 257 /* If it is necessary to assign new unofficial EM_* values, please pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision @@ -814,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 */ @@ -1251,6 +1261,90 @@ typedef struct #define ELF64_M_SIZE(info) ELF32_M_SIZE (info) #define ELF64_M_INFO(sym, size) ELF32_M_INFO (sym, size) +/* KVX relocs */ +#define R_KVX_NONE 0 +#define R_KVX_16 1 +#define R_KVX_32 2 +#define R_KVX_64 3 +#define R_KVX_S16_PCREL 4 +#define R_KVX_PCREL17 5 +#define R_KVX_PCREL27 6 +#define R_KVX_32_PCREL 7 +#define R_KVX_S37_PCREL_LO10 8 +#define R_KVX_S37_PCREL_UP27 9 +#define R_KVX_S43_PCREL_LO10 10 +#define R_KVX_S43_PCREL_UP27 11 +#define R_KVX_S43_PCREL_EX6 12 +#define R_KVX_S64_PCREL_LO10 13 +#define R_KVX_S64_PCREL_UP27 14 +#define R_KVX_S64_PCREL_EX27 15 +#define R_KVX_64_PCREL 16 +#define R_KVX_S16 17 +#define R_KVX_S32_LO5 18 +#define R_KVX_S32_UP27 19 +#define R_KVX_S37_LO10 20 +#define R_KVX_S37_UP27 21 +#define R_KVX_S37_GOTOFF_LO10 22 +#define R_KVX_S37_GOTOFF_UP27 23 +#define R_KVX_S43_GOTOFF_LO10 24 +#define R_KVX_S43_GOTOFF_UP27 25 +#define R_KVX_S43_GOTOFF_EX6 26 +#define R_KVX_32_GOTOFF 27 +#define R_KVX_64_GOTOFF 28 +#define R_KVX_32_GOT 29 +#define R_KVX_S37_GOT_LO10 30 +#define R_KVX_S37_GOT_UP27 31 +#define R_KVX_S43_GOT_LO10 32 +#define R_KVX_S43_GOT_UP27 33 +#define R_KVX_S43_GOT_EX6 34 +#define R_KVX_64_GOT 35 +#define R_KVX_GLOB_DAT 36 +#define R_KVX_COPY 37 +#define R_KVX_JMP_SLOT 38 +#define R_KVX_RELATIVE 39 +#define R_KVX_S43_LO10 40 +#define R_KVX_S43_UP27 41 +#define R_KVX_S43_EX6 42 +#define R_KVX_S64_LO10 43 +#define R_KVX_S64_UP27 44 +#define R_KVX_S64_EX27 45 +#define R_KVX_S37_GOTADDR_LO10 46 +#define R_KVX_S37_GOTADDR_UP27 47 +#define R_KVX_S43_GOTADDR_LO10 48 +#define R_KVX_S43_GOTADDR_UP27 49 +#define R_KVX_S43_GOTADDR_EX6 50 +#define R_KVX_S64_GOTADDR_LO10 51 +#define R_KVX_S64_GOTADDR_UP27 52 +#define R_KVX_S64_GOTADDR_EX27 53 +#define R_KVX_64_DTPMOD 54 +#define R_KVX_64_DTPOFF 55 +#define R_KVX_S37_TLS_DTPOFF_LO10 56 +#define R_KVX_S37_TLS_DTPOFF_UP27 57 +#define R_KVX_S43_TLS_DTPOFF_LO10 58 +#define R_KVX_S43_TLS_DTPOFF_UP27 59 +#define R_KVX_S43_TLS_DTPOFF_EX6 60 +#define R_KVX_S37_TLS_GD_LO10 61 +#define R_KVX_S37_TLS_GD_UP27 62 +#define R_KVX_S43_TLS_GD_LO10 63 +#define R_KVX_S43_TLS_GD_UP27 64 +#define R_KVX_S43_TLS_GD_EX6 65 +#define R_KVX_S37_TLS_LD_LO10 66 +#define R_KVX_S37_TLS_LD_UP27 67 +#define R_KVX_S43_TLS_LD_LO10 68 +#define R_KVX_S43_TLS_LD_UP27 69 +#define R_KVX_S43_TLS_LD_EX6 70 +#define R_KVX_64_TPOFF 71 +#define R_KVX_S37_TLS_IE_LO10 72 +#define R_KVX_S37_TLS_IE_UP27 73 +#define R_KVX_S43_TLS_IE_LO10 74 +#define R_KVX_S43_TLS_IE_UP27 75 +#define R_KVX_S43_TLS_IE_EX6 76 +#define R_KVX_S37_TLS_LE_LO10 77 +#define R_KVX_S37_TLS_LE_UP27 78 +#define R_KVX_S43_TLS_LE_LO10 79 +#define R_KVX_S43_TLS_LE_UP27 80 +#define R_KVX_S43_TLS_LE_EX6 81 + /* C-SKY relocs. */ #define R_CKCORE_NONE 0 @@ -3494,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 @@ -3724,6 +3822,72 @@ typedef Elf32_Addr Elf32_Conflict; #define R_ARC_TLS_LE_S9 0x4a #define R_ARC_TLS_LE_32 0x4b +/* RISC-V ELF Flags */ +#define EF_RISCV_RVC 0x0001 +#define EF_RISCV_FLOAT_ABI 0x0006 +#define EF_RISCV_FLOAT_ABI_SOFT 0x0000 +#define EF_RISCV_FLOAT_ABI_SINGLE 0x0002 +#define EF_RISCV_FLOAT_ABI_DOUBLE 0x0004 +#define EF_RISCV_FLOAT_ABI_QUAD 0x0006 + +/* RISC-V relocations. */ +#define R_RISCV_NONE 0 +#define R_RISCV_32 1 +#define R_RISCV_64 2 +#define R_RISCV_RELATIVE 3 +#define R_RISCV_COPY 4 +#define R_RISCV_JUMP_SLOT 5 +#define R_RISCV_TLS_DTPMOD32 6 +#define R_RISCV_TLS_DTPMOD64 7 +#define R_RISCV_TLS_DTPREL32 8 +#define R_RISCV_TLS_DTPREL64 9 +#define R_RISCV_TLS_TPREL32 10 +#define R_RISCV_TLS_TPREL64 11 +#define R_RISCV_BRANCH 16 +#define R_RISCV_JAL 17 +#define R_RISCV_CALL 18 +#define R_RISCV_CALL_PLT 19 +#define R_RISCV_GOT_HI20 20 +#define R_RISCV_TLS_GOT_HI20 21 +#define R_RISCV_TLS_GD_HI20 22 +#define R_RISCV_PCREL_HI20 23 +#define R_RISCV_PCREL_LO12_I 24 +#define R_RISCV_PCREL_LO12_S 25 +#define R_RISCV_HI20 26 +#define R_RISCV_LO12_I 27 +#define R_RISCV_LO12_S 28 +#define R_RISCV_TPREL_HI20 29 +#define R_RISCV_TPREL_LO12_I 30 +#define R_RISCV_TPREL_LO12_S 31 +#define R_RISCV_TPREL_ADD 32 +#define R_RISCV_ADD8 33 +#define R_RISCV_ADD16 34 +#define R_RISCV_ADD32 35 +#define R_RISCV_ADD64 36 +#define R_RISCV_SUB8 37 +#define R_RISCV_SUB16 38 +#define R_RISCV_SUB32 39 +#define R_RISCV_SUB64 40 +#define R_RISCV_GNU_VTINHERIT 41 +#define R_RISCV_GNU_VTENTRY 42 +#define R_RISCV_ALIGN 43 +#define R_RISCV_RVC_BRANCH 44 +#define R_RISCV_RVC_JUMP 45 +#define R_RISCV_RVC_LUI 46 +#define R_RISCV_GPREL_I 47 +#define R_RISCV_GPREL_S 48 +#define R_RISCV_TPREL_I 49 +#define R_RISCV_TPREL_S 50 +#define R_RISCV_RELAX 51 +#define R_RISCV_SUB6 52 +#define R_RISCV_SET6 53 +#define R_RISCV_SET8 54 +#define R_RISCV_SET16 55 +#define R_RISCV_SET32 56 +#define R_RISCV_32_PCREL 57 + +#define R_RISCV_NUM 58 + #ifdef __cplusplus } #endif diff --git a/include/fcntl.h b/include/fcntl.h index adcd7ef4b..ce15ceaf6 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -67,6 +67,11 @@ __BEGIN_DECLS # define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal. */ # define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname. */ +# define AT_STATX_SYNC_TYPE 0x6000 +# define AT_STATX_SYNC_AS_STAT 0x0000 +# define AT_STATX_FORCE_SYNC 0x2000 +# define AT_STATX_DONT_SYNC 0x4000 +# define AT_RECURSIVE 0x8000 /* Apply to the entire subtree. */ # endif # define AT_EACCESS 0x200 /* Test access permitted for effective IDs, not real IDs. */ @@ -99,8 +104,9 @@ libc_hidden_proto(fcntl64) #endif /* Open FILE and return a new file descriptor for it, or -1 on error. - OFLAG determines the type of access used. If O_CREAT is on OFLAG, - the third argument is taken as a `mode_t', the mode of the created file. + OFLAG determines the type of access used. If O_CREAT or O_TMPFILE + is on OFLAG, the third argument is taken as a `mode_t', the mode of + the created file. This function is a cancellation point and therefore not marked with __THROW. */ @@ -276,6 +282,40 @@ extern int fallocate64 (int __fd, int __mode, __off64_t __offset, __off64_t __le # endif #endif +#if (defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU) +struct file_handle { + unsigned handle_bytes; + int handle_type; + unsigned char f_handle[]; +}; + +#define MAX_HANDLE_SZ 128 + +int name_to_handle_at(int dirfd, const char *pathname, + struct file_handle *handle, int *mount_id, int flags); +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/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/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/resolv.h b/include/resolv.h index 9349be11f..2a82641a4 100644 --- a/include/resolv.h +++ b/include/resolv.h @@ -329,9 +329,11 @@ int res_send (const u_char *, int, u_char *, int) __THROW; #endif __END_DECLS -#if 0 +#ifdef __UCLIBC_HAS_BSD_B64_NTOP_B64_PTON__ #define b64_ntop __b64_ntop #define b64_pton __b64_pton +#endif +#if 0 #define dn_count_labels __dn_count_labels #endif #define dn_comp __dn_comp @@ -384,8 +386,12 @@ int res_dnok (const char *) __THROW; int sym_ston (const struct res_sym *, const char *, int *) __THROW; const char * sym_ntos (const struct res_sym *, int, int *) __THROW; const char * sym_ntop (const struct res_sym *, int, int *) __THROW; +#endif +#ifdef __UCLIBC_HAS_BSD_B64_NTOP_B64_PTON__ int b64_ntop (u_char const *, size_t, char *, size_t) __THROW; int b64_pton (char const *, u_char *, size_t) __THROW; +#endif +#if 0 int loc_aton (const char *ascii, u_char *binary) __THROW; const char * loc_ntoa (const u_char *binary, char *ascii) __THROW; void putlong (u_int32_t, u_char *) __THROW; @@ -451,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 #in |