diff options
Diffstat (limited to 'libc/sysdeps/linux/common/bits')
20 files changed, 325 insertions, 31 deletions
diff --git a/libc/sysdeps/linux/common/bits/hwcap.h b/libc/sysdeps/linux/common/bits/hwcap.h new file mode 100644 index 000000000..e7b899df0 --- /dev/null +++ b/libc/sysdeps/linux/common/bits/hwcap.h @@ -0,0 +1,22 @@ +/* Defines for bits in AT_HWCAP. + Copyright (C) 2012-2023 Free Software Foundation, Inc. + + 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 + <https://www.gnu.org/licenses/>. */ + +#ifndef _SYS_AUXV_H +# error "Never include <bits/hwcap.h> directly; use <sys/auxv.h> instead." +#endif + +/* No bits defined for this architecture. */ diff --git a/libc/sysdeps/linux/common/bits/ipc.h b/libc/sysdeps/linux/common/bits/ipc.h index 3bd5f1b6f..cf7da2a29 100644 --- a/libc/sysdeps/linux/common/bits/ipc.h +++ b/libc/sysdeps/linux/common/bits/ipc.h @@ -20,6 +20,7 @@ #endif #include <bits/types.h> +#include <bits/wordsize.h> /* Mode bits for `msgget', `semget', and `shmget'. */ #define IPC_CREAT 01000 /* Create key if key does not exist. */ @@ -46,10 +47,14 @@ struct ipc_perm __gid_t gid; /* Owner's group ID. */ __uid_t cuid; /* Creator's user ID. */ __gid_t cgid; /* Creator's group ID. */ +#if __WORDSIZE == 64 + unsigned int mode; +#else unsigned short int mode; /* Read/write permission. */ unsigned short int __pad1; +#endif unsigned short int __seq; /* Sequence number. */ unsigned short int __pad2; - unsigned long int __unused1; - unsigned long int __unused2; + unsigned long int __uclibc_unused1; + unsigned long int __uclibc_unused2; }; diff --git a/libc/sysdeps/linux/common/bits/jmp_buf_tag.h b/libc/sysdeps/linux/common/bits/jmp_buf_tag.h new file mode 100644 index 000000000..367b7bc66 --- /dev/null +++ b/libc/sysdeps/linux/common/bits/jmp_buf_tag.h @@ -0,0 +1,37 @@ +/* Define struct __jmp_buf_tag. + Copyright (C) 1991-2023 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#ifndef __jmp_buf_tag_defined +#define __jmp_buf_tag_defined 1 + +#include <bits/setjmp.h> +#include <bits/sigset.h> + +/* 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. */ + }; + +#endif diff --git a/libc/sysdeps/linux/common/bits/kernel-features.h b/libc/sysdeps/linux/common/bits/kernel-features.h index f1ebe0204..2f4f407bd 100644 --- a/libc/sysdeps/linux/common/bits/kernel-features.h +++ b/libc/sysdeps/linux/common/bits/kernel-features.h @@ -490,6 +490,11 @@ # define __ASSUME_FALLOCATE 1 #endif +/* prlimit64 is available in 2.6.36. */ +#if __LINUX_KERNEL_VERSION >= 0x020624 +# define __ASSUME_PRLIMIT64 1 +#endif + /* getcpu is a syscall for x86-64 since 3.1. */ #if defined __x86_64__ && __LINUX_KERNEL_VERSION >= 0x030100 # define __ASSUME_GETCPU_SYSCALL 1 diff --git a/libc/sysdeps/linux/common/bits/mman-linux.h b/libc/sysdeps/linux/common/bits/mman-linux.h index 6ca08415a..4947ddd89 100644 --- a/libc/sysdeps/linux/common/bits/mman-linux.h +++ b/libc/sysdeps/linux/common/bits/mman-linux.h @@ -46,6 +46,7 @@ /* Other flags. */ #define MAP_FIXED 0x10 /* Interpret addr exactly. */ +# define MAP_FIXED_NOREPLACE 0x100000 /* Used to solve problem with MAP_FIXED */ #ifdef __USE_MISC # define MAP_FILE 0 # ifdef __MAP_ANONYMOUS diff --git a/libc/sysdeps/linux/common/bits/msq.h b/libc/sysdeps/linux/common/bits/msq.h index a1c3ea43d..b594cfff2 100644 --- a/libc/sysdeps/linux/common/bits/msq.h +++ b/libc/sysdeps/linux/common/bits/msq.h @@ -38,18 +38,18 @@ struct msqid_ds { struct ipc_perm msg_perm; /* structure describing operation permission */ __time_t msg_stime; /* time of last msgsnd command */ - unsigned long int __unused1; + unsigned long int __uclibc_unused1; __time_t msg_rtime; /* time of last msgrcv command */ - unsigned long int __unused2; + unsigned long int __uclibc_unused2; __time_t msg_ctime; /* time of last change */ - unsigned long int __unused3; + unsigned long int __uclibc_unused3; unsigned long int __msg_cbytes; /* current number of bytes on queue */ msgqnum_t msg_qnum; /* number of messages currently on queue */ msglen_t msg_qbytes; /* max number of bytes allowed on queue */ __pid_t msg_lspid; /* pid of last msgsnd() */ __pid_t msg_lrpid; /* pid of last msgrcv() */ - unsigned long int __unused4; - unsigned long int __unused5; + unsigned long int __uclibc_unused4; + unsigned long int __uclibc_unused5; }; #ifdef __USE_MISC diff --git a/libc/sysdeps/linux/common/bits/resource.h b/libc/sysdeps/linux/common/bits/resource.h index df0ba56d9..89c3d4e41 100644 --- a/libc/sysdeps/linux/common/bits/resource.h +++ b/libc/sysdeps/linux/common/bits/resource.h @@ -99,7 +99,13 @@ enum __rlimit_resource __RLIMIT_RTPRIO = 14, #define RLIMIT_RTPRIO __RLIMIT_RTPRIO - __RLIMIT_NLIMITS = 15, + /* Maximum CPU time in µs that a process scheduled under a real-time + scheduling policy may consume without making a blocking system + call before being forcibly descheduled. */ + __RLIMIT_RTTIME = 15, +#define RLIMIT_RTTIME __RLIMIT_RTTIME + + __RLIMIT_NLIMITS = 16, __RLIM_NLIMITS = __RLIMIT_NLIMITS #define RLIMIT_NLIMITS __RLIMIT_NLIMITS #define RLIM_NLIMITS __RLIM_NLIMITS @@ -159,6 +165,15 @@ enum __rusage_who /* All of its terminated child processes. */ RUSAGE_CHILDREN = -1 #define RUSAGE_CHILDREN RUSAGE_CHILDREN + +#ifdef __USE_GNU + , + /* The calling thread. */ + RUSAGE_THREAD = 1 +# define RUSAGE_THREAD RUSAGE_THREAD + /* Name for the same functionality on Solaris. */ +# define RUSAGE_LWP RUSAGE_THREAD +#endif }; #define __need_timeval diff --git a/libc/sysdeps/linux/common/bits/sched.h b/libc/sysdeps/linux/common/bits/sched.h index 9d05314f5..18a9fb98d 100644 --- a/libc/sysdeps/linux/common/bits/sched.h +++ b/libc/sysdeps/linux/common/bits/sched.h @@ -31,6 +31,7 @@ #ifdef __USE_GNU # define SCHED_BATCH 3 # define SCHED_IDLE 5 +# define SCHED_DEADLINE 6 # define SCHED_RESET_ON_FORK 0x40000000 #endif diff --git a/libc/sysdeps/linux/common/bits/sem.h b/libc/sysdeps/linux/common/bits/sem.h index 501e0803b..24a130981 100644 --- a/libc/sysdeps/linux/common/bits/sem.h +++ b/libc/sysdeps/linux/common/bits/sem.h @@ -20,6 +20,7 @@ #endif #include <sys/types.h> +#include <bits/wordsize.h> /* Flags for `semop'. */ #define SEM_UNDO 0x1000 /* undo the operation on exit */ @@ -38,13 +39,33 @@ struct semid_ds { struct ipc_perm sem_perm; /* operation permission struct */ +#if defined(__UCLIBC_USE_TIME64__) + unsigned long int __sem_otime_internal_1; + unsigned long int __sem_otime_internal_2; +#else __time_t sem_otime; /* last semop() time */ - unsigned long int __unused1; +#endif +#if (__WORDSIZE == 32 && !defined(__ARC64_ARCH32__) && !defined(__arc__) && !defined(__arm__) && !defined(__or1k__) && !defined(__xtensa__)) || \ + ((defined(__ARC64_ARCH32__) || defined(__arc__) || defined(__arm__) || defined(__or1k__) || defined(__xtensa__)) && !defined(__UCLIBC_USE_TIME64__)) + unsigned long int __uclibc_unused1; +#endif +#if defined(__UCLIBC_USE_TIME64__) + unsigned long int __sem_ctime_internal_1; + unsigned long int __sem_ctime_internal_2; +#else __time_t sem_ctime; /* last time changed by semctl() */ - unsigned long int __unused2; +#endif +#if (__WORDSIZE == 32 && !defined(__ARC64_ARCH32__) && !defined(__arc__) && !defined(__arm__) && !defined(__or1k__) && !defined(__xtensa__)) || \ + ((defined(__ARC64_ARCH32__) || defined(__arc__) || defined(__arm__) || defined(__or1k__) || defined(__xtensa__)) && !defined(__UCLIBC_USE_TIME64__)) + unsigned long int __uclibc_unused2; +#endif unsigned long int sem_nsems; /* number of semaphores in set */ - unsigned long int __unused3; - unsigned long int __unused4; +#if defined(__UCLIBC_USE_TIME64__) + __time_t sem_otime; /* last semop() time */ + __time_t sem_ctime; /* last time changed by semctl() */ +#endif + unsigned long int __uclibc_unused3; + unsigned long int __uclibc_unused4; }; /* The user should define a union like the following to use it for arguments diff --git a/libc/sysdeps/linux/common/bits/shm.h b/libc/sysdeps/linux/common/bits/shm.h index 88bf7a8aa..8906e262b 100644 --- a/libc/sysdeps/linux/common/bits/shm.h +++ b/libc/sysdeps/linux/common/bits/shm.h @@ -50,16 +50,16 @@ struct shmid_ds struct ipc_perm shm_perm; /* operation permission struct */ size_t shm_segsz; /* size of segment in bytes */ __time_t shm_atime; /* time of last shmat() */ - unsigned long int __unused1; + unsigned long int __uclibc_unused1; __time_t shm_dtime; /* time of last shmdt() */ - unsigned long int __unused2; + unsigned long int __uclibc_unused2; __time_t shm_ctime; /* time of last change by shmctl() */ - unsigned long int __unused3; + unsigned long int __uclibc_unused3; __pid_t shm_cpid; /* pid of creator */ __pid_t shm_lpid; /* pid of last shmop */ shmatt_t shm_nattch; /* number of current attaches */ - unsigned long int __unused4; - unsigned long int __unused5; + unsigned long int __uclibc_unused4; + unsigned long int __uclibc_unused5; }; #ifdef __USE_MISC @@ -81,10 +81,10 @@ struct shminfo unsigned long int shmmni; unsigned long int shmseg; unsigned long int shmall; - unsigned long int __unused1; - unsigned long int __unused2; - unsigned long int __unused3; - unsigned long int __unused4; + unsigned long int __uclibc_unused1; + unsigned long int __uclibc_unused2; + unsigned long int __uclibc_unused3; + unsigned long int __uclibc_unused4; }; struct shm_info diff --git a/libc/sysdeps/linux/common/bits/stab.def b/libc/sysdeps/linux/common/bits/stab.def index 8a2b8f39d..8d16c5c2c 100644 --- a/libc/sysdeps/linux/common/bits/stab.def +++ b/libc/sysdeps/linux/common/bits/stab.def @@ -17,7 +17,7 @@ <http://www.gnu.org/licenses/>. */ /* This contains contribution from Cygnus Support. */ - + /* Global variable. Only the name is significant. To find the address, look in the corresponding external symbol. */ __define_stab (N_GSYM, 0x20, "GSYM") @@ -177,7 +177,7 @@ __define_stab (N_NBLCS, 0xF8, "NBLCS") /* Second symbol entry containing a length-value for the preceding entry. The value is the length. */ __define_stab (N_LENG, 0xfe, "LENG") - + /* The above information, in matrix format. STAB MATRIX diff --git a/libc/sysdeps/linux/common/bits/stat.h b/libc/sysdeps/linux/common/bits/stat.h index 19e2f4e13..07c09f50a 100644 --- a/libc/sysdeps/linux/common/bits/stat.h +++ b/libc/sysdeps/linux/common/bits/stat.h @@ -83,8 +83,8 @@ struct stat unsigned long int st_ctimensec; /* Nsecs of last status change. */ #endif #ifndef __USE_FILE_OFFSET64 - unsigned long int __unused4; - unsigned long int __unused5; + unsigned long int __uclibc_unused4; + unsigned long int __uclibc_unused5; #else __ino64_t st_ino; /* File serial number. */ #endif diff --git a/libc/sysdeps/linux/common/bits/statx.h b/libc/sysdeps/linux/common/bits/statx.h new file mode 100644 index 000000000..eb9b8535c --- /dev/null +++ b/libc/sysdeps/linux/common/bits/statx.h @@ -0,0 +1,93 @@ +/* Generic statx-related definitions and declarations. + Copyright (C) 2018-2019 Free Software Foundation, Inc. + + 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 + <https://www.gnu.org/licenses/>. */ + +/* This interface is based on <linux/stat.h> in Linux. */ + +#ifndef _SYS_STAT_H +# error Never include <bits/statx.h> directly, include <sys/stat.h> instead. +#endif + +struct statx_timestamp +{ + __int64_t tv_sec; + __uint32_t tv_nsec; + __int32_t __statx_timestamp_pad1[1]; +}; + +/* Warning: The kernel may add additional fields to this struct in the + future. Only use this struct for calling the statx function, not + for storing data. (Expansion will be controlled by the mask + argument of the statx function.) */ +struct statx +{ + __uint32_t stx_mask; + __uint32_t stx_blksize; + __uint64_t stx_attributes; + __uint32_t stx_nlink; + __uint32_t stx_uid; + __uint32_t stx_gid; + __uint16_t stx_mode; + __uint16_t __statx_pad1[1]; + __uint64_t stx_ino; + __uint64_t stx_size; + __uint64_t stx_blocks; + __uint64_t stx_attributes_mask; + struct statx_timestamp stx_atime; + struct statx_timestamp stx_btime; + struct statx_timestamp stx_ctime; + struct statx_timestamp stx_mtime; + __uint32_t stx_rdev_major; + __uint32_t stx_rdev_minor; + __uint32_t stx_dev_major; + __uint32_t stx_dev_minor; + __uint64_t __statx_pad2[14]; +}; + +#ifndef STATX_TYPE +# define STATX_TYPE 0x0001U +# define STATX_MODE 0x0002U +# define STATX_NLINK 0x0004U +# define STATX_UID 0x0008U +# define STATX_GID 0x0010U +# define STATX_ATIME 0x0020U +# define STATX_MTIME 0x0040U +# define STATX_CTIME 0x0080U +# define STATX_INO 0x0100U +# define STATX_SIZE 0x0200U +# define STATX_BLOCKS 0x0400U +# define STATX_BASIC_STATS 0x07ffU +# define STATX_ALL 0x0fffU +# define STATX_BTIME 0x0800U +# define STATX__RESERVED 0x80000000U + +# define STATX_ATTR_COMPRESSED 0x0004 +# define STATX_ATTR_IMMUTABLE 0x0010 +# define STATX_ATTR_APPEND 0x0020 +# define STATX_ATTR_NODUMP 0x0040 +# define STATX_ATTR_ENCRYPTED 0x0800 +# define STATX_ATTR_AUTOMOUNT 0x1000 +#endif /* !STATX_TYPE */ + +__BEGIN_DECLS + +/* Fill *BUF with information about PATH in DIRFD. */ +int statx (int __dirfd, const char *__restrict __path, int __flags, + unsigned int __mask, struct statx *__restrict __buf) + __THROW __nonnull ((2, 5)); + +__END_DECLS + diff --git a/libc/sysdeps/linux/common/bits/syscalls-common.h b/libc/sysdeps/linux/common/bits/syscalls-common.h index 3665345a6..c3b193e6f 100644..100755 --- a/libc/sysdeps/linux/common/bits/syscalls-common.h +++ b/libc/sysdeps/linux/common/bits/syscalls-common.h @@ -99,21 +99,75 @@ type name(C_DECL_ARGS_##nargs(args)) { \ return (type)INLINE_SYSCALL(name, nargs, C_ARGS_##nargs(args)); \ } +#define SYSCALL_FUNC_TIME64(nargs, type, name, args...) \ +type name(C_DECL_ARGS_##nargs(args)) { \ + return (type)INLINE_SYSCALL(name##_time64, nargs, C_ARGS_##nargs(args)); \ +} + +#define SYSCALL_FUNC_64(nargs, type, name, args...) \ +type name(C_DECL_ARGS_##nargs(args)) { \ + return (type)INLINE_SYSCALL(name##64, nargs, C_ARGS_##nargs(args)); \ +} + + #define SYSCALL_NOERR_FUNC(nargs, type, name, args...) \ type name(C_DECL_ARGS_##nargs(args)) { \ return (type)INLINE_SYSCALL_NOERR(name, nargs, C_ARGS_##nargs(args)); \ } +#define SYSCALL_NOERR_FUNC_TIME64(nargs, type, name, args...) \ +type name(C_DECL_ARGS_##nargs(args)) { \ + return (type)INLINE_SYSCALL_NOERR(name##_time64, nargs, C_ARGS_##nargs(args)); \ +} + +#define SYSCALL_NOERR_FUNC_64(nargs, type, name, args...) \ +type name(C_DECL_ARGS_##nargs(args)) { \ + return (type)INLINE_SYSCALL_NOERR(name##64, nargs, C_ARGS_##nargs(args)); \ +} + +#define SYSCALL_FUNC_BODY(nargs, type, name, args...) \ + return (type)INLINE_SYSCALL(name, nargs, C_ARGS_##nargs(args)); + +#define SYSCALL_FUNC_BODY_TIME64(nargs, type, name, args...) \ + return (type)INLINE_SYSCALL(name##_time64, nargs, C_ARGS_##nargs(args)); + +#define SYSCALL_FUNC_BODY_64(nargs, type, name, args...) \ + return (type)INLINE_SYSCALL(name##64, nargs, C_ARGS_##nargs(args)); + #define _syscall0(args...) SYSCALL_FUNC(0, args) #define _syscall_noerr0(args...) SYSCALL_NOERR_FUNC(0, args) #define _syscall1(args...) SYSCALL_FUNC(1, args) #define _syscall_noerr1(args...) SYSCALL_NOERR_FUNC(1, args) #define _syscall2(args...) SYSCALL_FUNC(2, args) +#define _syscall2_body(args...) SYSCALL_FUNC_BODY(2, args) #define _syscall3(args...) SYSCALL_FUNC(3, args) #define _syscall4(args...) SYSCALL_FUNC(4, args) #define _syscall5(args...) SYSCALL_FUNC(5, args) #define _syscall6(args...) SYSCALL_FUNC(6, args) +#define _syscall0_time64(args...) SYSCALL_FUNC_TIME64(0, args) +#define _syscall_noerr0_time64(args...) SYSCALL_NOERR_FUNC_TIME64(0, args) +#define _syscall1_time64(args...) SYSCALL_FUNC_TIME64(1, args) +#define _syscall_noerr1_time64(args...) SYSCALL_NOERR_FUNC_TIME64(1, args) +#define _syscall2_time64(args...) SYSCALL_FUNC_TIME64(2, args) +#define _syscall2_body_time64(args...) SYSCALL_FUNC_BODY_TIME64(2, args) +#define _syscall3_time64(args...) SYSCALL_FUNC_TIME64(3, args) +#define _syscall4_time64(args...) SYSCALL_FUNC_TIME64(4, args) +#define _syscall5_time64(args...) SYSCALL_FUNC_TIME64(5, args) +#define _syscall6_time64(args...) SYSCALL_FUNC_TIME64(6, args) + +#define _syscall0_64(args...) SYSCALL_FUNC_64(0, args) +#define _syscall_noerr0_64(args...) SYSCALL_NOERR_FUNC_64(0, args) +#define _syscall1_64(args...) SYSCALL_FUNC_64(1, args) +#define _syscall_noerr1_64(args...) SYSCALL_NOERR_FUNC_64(1, args) +#define _syscall2_64(args...) SYSCALL_FUNC_64(2, args) +#define _syscall2_body_64(args...) SYSCALL_FUNC_BODY_64(2, args) +#define _syscall3_64(args...) SYSCALL_FUNC_64(3, args) +#define _syscall4_64(args...) SYSCALL_FUNC_64(4, args) +#define _syscall5_64(args...) SYSCALL_FUNC_64(5, args) +#define _syscall6_64(args...) SYSCALL_FUNC_64(6, args) + + #endif /* _syscall0 */ #endif /* __ASSEMBLER__ */ diff --git a/libc/sysdeps/linux/common/bits/typesizes.h b/libc/sysdeps/linux/common/bits/typesizes.h index e1c5a27bb..dcb2c3b0a 100644 --- a/libc/sysdeps/linux/common/bits/typesizes.h +++ b/libc/sysdeps/linux/common/bits/typesizes.h @@ -46,9 +46,21 @@ #define __FSFILCNT64_T_TYPE __UQUAD_TYPE #define __ID_T_TYPE __U32_TYPE #define __CLOCK_T_TYPE __SLONGWORD_TYPE + +#ifdef __UCLIBC_USE_TIME64__ +#define __TIME_T_TYPE __S64_TYPE +#else #define __TIME_T_TYPE __SLONGWORD_TYPE +#endif /* __UCLIBC_USE_TIME64__ */ + #define __USECONDS_T_TYPE __U32_TYPE + +#ifdef __UCLIBC_USE_TIME64__ +#define __SUSECONDS_T_TYPE __S64_TYPE +#else #define __SUSECONDS_T_TYPE __SLONGWORD_TYPE +#endif + #define __DADDR_T_TYPE __S32_TYPE #define __SWBLK_T_TYPE __SLONGWORD_TYPE #define __KEY_T_TYPE __S32_TYPE diff --git a/libc/sysdeps/linux/common/bits/uClibc_arch_features.h b/libc/sysdeps/linux/common/bits/uClibc_arch_features.h index 37c7ceb60..c79ca7dfa 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_arch_features.h +++ b/libc/sysdeps/linux/common/bits/uClibc_arch_features.h @@ -14,6 +14,9 @@ /* can your target use syscall6() for mmap ? */ #undef __UCLIBC_MMAP_HAS_6_ARGS__ +/* does your target use statx */ +#undef __UCLIBC_HAVE_STATX__ + /* does your target align 64bit values in register pairs ? (32bit arches only) */ #undef __UCLIBC_SYSCALL_ALIGN_64BIT__ diff --git a/libc/sysdeps/linux/common/bits/uClibc_uwchar.h b/libc/sysdeps/linux/common/bits/uClibc_uwchar.h index 47ea3cda1..91b789c80 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_uwchar.h +++ b/libc/sysdeps/linux/common/bits/uClibc_uwchar.h @@ -36,6 +36,7 @@ #include <limits.h> #include <stdint.h> +#include <wchar.h> #if WCHAR_MIN == 0 typedef wchar_t __uwchar_t; diff --git a/libc/sysdeps/linux/common/bits/utmp.h b/libc/sysdeps/linux/common/bits/utmp.h index 6ece31e34..9671d9382 100644 --- a/libc/sysdeps/linux/common/bits/utmp.h +++ b/libc/sysdeps/linux/common/bits/utmp.h @@ -82,7 +82,7 @@ struct utmp #endif int32_t ut_addr_v6[4]; /* Internet address of remote host. */ - char __unused[20]; /* Reserved for future use. */ + char __uclibc_unused[20]; /* Reserved for future use. */ }; /* Backwards compatibility hacks. */ diff --git a/libc/sysdeps/linux/common/bits/utmpx.h b/libc/sysdeps/linux/common/bits/utmpx.h index 815fc90b8..3315ef5e6 100644 --- a/libc/sysdeps/linux/common/bits/utmpx.h +++ b/libc/sysdeps/linux/common/bits/utmpx.h @@ -78,7 +78,7 @@ struct utmpx struct timeval ut_tv; /* Time entry was made. */ #endif __int32_t ut_addr_v6[4]; /* Internet address of remote host. */ - char __unused[20]; /* Reserved for future use. */ + char __uclibc_unused[20]; /* Reserved for future use. */ }; diff --git a/libc/sysdeps/linux/common/bits/wchar.h b/libc/sysdeps/linux/common/bits/wchar.h index a3ff5319e..ce951d9b6 100644 --- a/libc/sysdeps/linux/common/bits/wchar.h +++ b/libc/sysdeps/linux/common/bits/wchar.h @@ -1,5 +1,5 @@ /* wchar_t type related definitions. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000-2023 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,12 +14,36 @@ 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/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _BITS_WCHAR_H #define _BITS_WCHAR_H 1 -#define __WCHAR_MIN (-2147483647 - 1) -#define __WCHAR_MAX (2147483647) +/* The fallback definitions, for when __WCHAR_MAX__ or __WCHAR_MIN__ + are not defined, give the right value and type as long as both int + and wchar_t are 32-bit types. Adding L'\0' to a constant value + ensures that the type is correct; it is necessary to use (L'\0' + + 0) rather than just L'\0' so that the type in C++ is the promoted + version of wchar_t rather than the distinct wchar_t type itself. + Because wchar_t in preprocessor #if expressions is treated as + intmax_t or uintmax_t, the expression (L'\0' - 1) would have the + wrong value for WCHAR_MAX in such expressions and so cannot be used + to define __WCHAR_MAX in the unsigned case. */ + +#ifdef __WCHAR_MAX__ +# define __WCHAR_MAX __WCHAR_MAX__ +#elif L'\0' - 1 > 0 +# define __WCHAR_MAX (0xffffffffu + L'\0') +#else +# define __WCHAR_MAX (0x7fffffff + L'\0') +#endif + +#ifdef __WCHAR_MIN__ +# define __WCHAR_MIN __WCHAR_MIN__ +#elif L'\0' - 1 > 0 +# define __WCHAR_MIN (L'\0' + 0) +#else +# define __WCHAR_MIN (-__WCHAR_MAX - 1) +#endif #endif /* bits/wchar.h */ |