| author | |
| committer | |
| log | 19ca2415f26b07b399a60fd17a4cf85f290da0fd |
| tree | dbbd6affde21ad2a59b2b2e1f4d7948e21133a13 |
| parent | 1edf8efa4243eb1715ace35b1a99f7eaa0863fdd |
This commit introduces tools/update_glibc.zig to update the start files
for next time.
Some notable changes in recent glibc:
* abi-note.S has been changed to abi-note.c but we resist the change to
keep it easier to compile the start files.
* elf-init.c has been deleted upstream. Further testing should be done
to verify that binaries against glibc omitting elf-init.c still run
properly on oldel glibc linux systems.
Closes #4926295 files changed, 4070 insertions(+), 8630 deletions(-)
lib/libc/glibc/bits/byteswap.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Macros and inline functions to swap the order of bytes in integer values. |
| 2 | Copyright (C) 1997-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1997-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/bits/floatn-common.h+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | /* Macros to control TS 18661-3 glibc features where the same |
| 2 | 2 | definitions are appropriate for all platforms. |
| 3 | Copyright (C) 2017-2020 Free Software Foundation, Inc. | |
| 3 | Copyright (C) 2017-2021 Free Software Foundation, Inc. | |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 | |
| 6 | 6 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/bits/libc-header-start.h+27-3| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Handle feature test macros at the start of a header. |
| 2 | Copyright (C) 2016-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2016-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -44,8 +44,26 @@ |
| 44 | 44 | |
| 45 | 45 | /* ISO/IEC TS 18661-1:2014 defines the __STDC_WANT_IEC_60559_BFP_EXT__ |
| 46 | 46 | macro. Most but not all symbols enabled by that macro in TS |
| 47 | 18661-1 are enabled unconditionally in C2X; the symbols in Annex F | |
| 48 | still require that macro in C2X. */ | |
| 47 | 18661-1 are enabled unconditionally in C2X. In C2X, the symbols in | |
| 48 | Annex F still require a new feature test macro | |
| 49 | __STDC_WANT_IEC_60559_EXT__ instead (C2X does not define | |
| 50 | __STDC_WANT_IEC_60559_BFP_EXT__), while a few features from TS | |
| 51 | 18661-1 are not included in C2X (and thus should depend on | |
| 52 | __STDC_WANT_IEC_60559_BFP_EXT__ even when C2X features are | |
| 53 | enabled). | |
| 54 | ||
| 55 | __GLIBC_USE (IEC_60559_BFP_EXT) controls those features from TS | |
| 56 | 18661-1 not included in C2X. | |
| 57 | ||
| 58 | __GLIBC_USE (IEC_60559_BFP_EXT_C2X) controls those features from TS | |
| 59 | 18661-1 that are also included in C2X (with no feature test macro | |
| 60 | required in C2X). | |
| 61 | ||
| 62 | __GLIBC_USE (IEC_60559_EXT) controls those features from TS 18661-1 | |
| 63 | that are included in C2X but conditional on | |
| 64 | __STDC_WANT_IEC_60559_EXT__. (There are currently no features | |
| 65 | conditional on __STDC_WANT_IEC_60559_EXT__ that are not in TS | |
| 66 | 18661-1.) */ | |
| 49 | 67 | #undef __GLIBC_USE_IEC_60559_BFP_EXT |
| 50 | 68 | #if defined __USE_GNU || defined __STDC_WANT_IEC_60559_BFP_EXT__ |
| 51 | 69 | # define __GLIBC_USE_IEC_60559_BFP_EXT 1 |
| ... | ... | @@ -58,6 +76,12 @@ |
| 58 | 76 | #else |
| 59 | 77 | # define __GLIBC_USE_IEC_60559_BFP_EXT_C2X 0 |
| 60 | 78 | #endif |
| 79 | #undef __GLIBC_USE_IEC_60559_EXT | |
| 80 | #if __GLIBC_USE (IEC_60559_BFP_EXT) || defined __STDC_WANT_IEC_60559_EXT__ | |
| 81 | # define __GLIBC_USE_IEC_60559_EXT 1 | |
| 82 | #else | |
| 83 | # define __GLIBC_USE_IEC_60559_EXT 0 | |
| 84 | #endif | |
| 61 | 85 | |
| 62 | 86 | /* ISO/IEC TS 18661-4:2015 defines the |
| 63 | 87 | __STDC_WANT_IEC_60559_FUNCS_EXT__ macro. Other than the reduction |
lib/libc/glibc/bits/long-double.h+15-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Properties of long double type. |
| 2 | Copyright (C) 2016-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2016-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -37,4 +37,17 @@ |
| 37 | 37 | #ifndef __NO_LONG_DOUBLE_MATH |
| 38 | 38 | # define __NO_LONG_DOUBLE_MATH	1 |
| 39 | 39 | #endif |
| 40 | #define __LONG_DOUBLE_USES_FLOAT128 0 | |
| 40 | ||
| 41 | /* The macro __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI is used to determine the | |
| 42 | choice of the underlying ABI of long double. It will always assume | |
| 43 | a constant value for each translation unit. | |
| 44 | ||
| 45 | If the value is non-zero, any API which is parameterized by the long | |
| 46 | double type (i.e the scanf/printf family of functions or the explicitly | |
| 47 | parameterized math.h functions) will be redirected to a compatible | |
| 48 | implementation using _Float128 ABI via symbols suffixed with ieee128. | |
| 49 | ||
| 50 | The mechanism this macro uses to acquire may be a function | |
| 51 | of architecture, or target specific options used to invoke the | |
| 52 | compiler. */ | |
| 53 | #define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0 |
lib/libc/glibc/bits/select.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1997-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1997-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/bits/signum-generic.h+4-25| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Signal number constants. Generic template. |
| 2 | Copyright (C) 1991-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1991-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -57,31 +57,9 @@ |
| 57 | 57 | #define	SIGQUIT		3	/* Quit. */ |
| 58 | 58 | #define	SIGTRAP		5	/* Trace/breakpoint trap. */ |
| 59 | 59 | #define	SIGKILL		9	/* Killed. */ |
| 60 | #define SIGBUS		10	/* Bus error. */ | |
| 61 | #define	SIGSYS		12	/* Bad system call. */ | |
| 62 | 60 | #define	SIGPIPE		13	/* Broken pipe. */ |
| 63 | 61 | #define	SIGALRM		14	/* Alarm clock. */ |
| 64 | 62 | |
| 65 | /* New(er) POSIX signals (1003.1-2008, 1003.1-2013). */ | |
| 66 | #define	SIGURG		16	/* Urgent data is available at a socket. */ | |
| 67 | #define	SIGSTOP		17	/* Stop, unblockable. */ | |
| 68 | #define	SIGTSTP		18	/* Keyboard stop. */ | |
| 69 | #define	SIGCONT		19	/* Continue. */ | |
| 70 | #define	SIGCHLD		20	/* Child terminated or stopped. */ | |
| 71 | #define	SIGTTIN		21	/* Background read from control terminal. */ | |
| 72 | #define	SIGTTOU		22	/* Background write to control terminal. */ | |
| 73 | #define	SIGPOLL		23	/* Pollable event occurred (System V). */ | |
| 74 | #define	SIGXCPU		24	/* CPU time limit exceeded. */ | |
| 75 | #define	SIGXFSZ		25	/* File size limit exceeded. */ | |
| 76 | #define	SIGVTALRM	26	/* Virtual timer expired. */ | |
| 77 | #define	SIGPROF		27	/* Profiling timer expired. */ | |
| 78 | #define	SIGUSR1		30	/* User-defined signal 1. */ | |
| 79 | #define	SIGUSR2		31	/* User-defined signal 2. */ | |
| 80 | ||
| 81 | /* Nonstandard signals found in all modern POSIX systems | |
| 82 | (including both BSD and Linux). */ | |
| 83 | #define	SIGWINCH	28	/* Window size change (4.3 BSD, Sun). */ | |
| 84 | ||
| 85 | 63 | /* Archaic names for compatibility. */ |
| 86 | 64 | #define	SIGIO		SIGPOLL	/* I/O now possible (4.2 BSD). */ |
| 87 | 65 | #define	SIGIOT		SIGABRT	/* IOT instruction, abort() on a PDP-11. */ |
| ... | ... | @@ -93,8 +71,9 @@ |
| 93 | 71 | but some real-time signals may be used internally by glibc. Do not |
| 94 | 72 | use these constants in application code; use SIGRTMIN and SIGRTMAX |
| 95 | 73 | (defined in signal.h) instead. */ |
| 96 | #define __SIGRTMIN	32 | |
| 97 | #define __SIGRTMAX	__SIGRTMIN | |
| 74 | ||
| 75 | /* Include system specific bits. */ | |
| 76 | #include <bits/signum-arch.h> | |
| 98 | 77 | |
| 99 | 78 | /* Biggest signal number + 1 (including real-time signals). */ |
| 100 | 79 | #define _NSIG		(__SIGRTMAX + 1) |
lib/libc/glibc/bits/stat.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1992-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/bits/stdint-intn.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Define intN_t types. |
| 2 | Copyright (C) 2017-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2017-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/bits/stdlib-bsearch.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Perform binary search - inline version. |
| 2 | Copyright (C) 1991-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1991-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/bits/time64.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* bits/time64.h -- underlying types for __time64_t. Generic version. |
| 2 | Copyright (C) 2018-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2018-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/bits/timesize.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Bit size of the time_t type at glibc build time, general case. |
| 2 | Copyright (C) 2018-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2018-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/bits/types/struct_sched_param.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Sched parameter structure. Generic version. |
| 2 | Copyright (C) 1996-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1996-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/bits/typesizes.h+8-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* bits/typesizes.h -- underlying types for *_t. Generic version. |
| 2 | Copyright (C) 2002-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2002-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -50,6 +50,7 @@ |
| 50 | 50 | #define __TIME_T_TYPE		__SLONGWORD_TYPE |
| 51 | 51 | #define __USECONDS_T_TYPE	__U32_TYPE |
| 52 | 52 | #define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE |
| 53 | #define __SUSECONDS64_T_TYPE	__SQUAD_TYPE | |
| 53 | 54 | #define __DADDR_T_TYPE		__S32_TYPE |
| 54 | 55 | #define __KEY_T_TYPE		__S32_TYPE |
| 55 | 56 | #define __CLOCKID_T_TYPE	__S32_TYPE |
| ... | ... | @@ -75,10 +76,16 @@ |
| 75 | 76 | |
| 76 | 77 | /* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ |
| 77 | 78 | # define __STATFS_MATCHES_STATFS64 1 |
| 79 | ||
| 80 | /* And for getitimer, setitimer and rusage */ | |
| 81 | # define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1 | |
| 78 | 82 | #else |
| 79 | 83 | # define __RLIM_T_MATCHES_RLIM64_T	0 |
| 80 | 84 | |
| 81 | 85 | # define __STATFS_MATCHES_STATFS64 0 |
| 86 | ||
| 87 | /* And for getitimer, setitimer and rusage */ | |
| 88 | # define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0 | |
| 82 | 89 | #endif |
| 83 | 90 | |
| 84 | 91 | /* Number of descriptors that can fit in an `fd_set'. */ |
lib/libc/glibc/bits/uintn-identity.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Inline functions to return unsigned integer values unchanged. |
| 2 | Copyright (C) 2017-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2017-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/bits/waitflags.h+9-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Definitions of flag bits for `waitpid' et al. |
| 2 | Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1992-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -24,3 +24,11 @@ |
| 24 | 24 | /* Bits in the third argument to `waitpid'. */ |
| 25 | 25 | #define	WNOHANG		1	/* Don't block waiting. */ |
| 26 | 26 | #define	WUNTRACED	2	/* Report status of stopped children. */ |
| 27 | ||
| 28 | /* Bits in the fourth argument to `waitid'. */ | |
| 29 | #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 | |
| 30 | # define WSTOPPED	WUNTRACED	/* Report stopped child. */ | |
| 31 | # define WCONTINUED	4		/* Report continued child. */ | |
| 32 | # define WNOWAIT	8		/* Don't reap, just poll status. */ | |
| 33 | # define WEXITED	16		/* Report dead child. */ | |
| 34 | #endif |
lib/libc/glibc/bits/waitstatus.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Definitions of status bits for `wait' et al. |
| 2 | Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1992-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/csu/elf-init.c deleted-106| ... | ... | @@ -1,106 +0,0 @@ |
| 1 | /* Startup support for ELF initializers/finalizers in the main executable. | |
| 2 | Copyright (C) 2002-2020 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | In addition to the permissions in the GNU Lesser General Public | |
| 11 | License, the Free Software Foundation gives you unlimited | |
| 12 | permission to link the compiled version of this file with other | |
| 13 | programs, and to distribute those programs without any restriction | |
| 14 | coming from the use of this file. (The GNU Lesser General Public | |
| 15 | License restrictions do apply in other respects; for example, they | |
| 16 | cover modification of the file, and distribution when not linked | |
| 17 | into another program.) | |
| 18 | ||
| 19 | Note that people who make modified versions of this file are not | |
| 20 | obligated to grant this special exception for their modified | |
| 21 | versions; it is their choice whether to do so. The GNU Lesser | |
| 22 | General Public License gives permission to release a modified | |
| 23 | version without this exception; this exception also makes it | |
| 24 | possible to release a modified version which carries forward this | |
| 25 | exception. | |
| 26 | ||
| 27 | The GNU C Library is distributed in the hope that it will be useful, | |
| 28 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 29 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 30 | Lesser General Public License for more details. | |
| 31 | ||
| 32 | You should have received a copy of the GNU Lesser General Public | |
| 33 | License along with the GNU C Library; if not, see | |
| 34 | <https://www.gnu.org/licenses/>. */ | |
| 35 | ||
| 36 | #include <stddef.h> | |
| 37 | ||
| 38 | ||
| 39 | /* These magic symbols are provided by the linker. */ | |
| 40 | extern void (*__preinit_array_start []) (int, char **, char **) | |
| 41 | attribute_hidden; | |
| 42 | extern void (*__preinit_array_end []) (int, char **, char **) | |
| 43 | attribute_hidden; | |
| 44 | extern void (*__init_array_start []) (int, char **, char **) | |
| 45 | attribute_hidden; | |
| 46 | extern void (*__init_array_end []) (int, char **, char **) | |
| 47 | attribute_hidden; | |
| 48 | extern void (*__fini_array_start []) (void) attribute_hidden; | |
| 49 | extern void (*__fini_array_end []) (void) attribute_hidden; | |
| 50 | ||
| 51 | ||
| 52 | #ifndef NO_INITFINI | |
| 53 | /* These function symbols are provided for the .init/.fini section entry | |
| 54 | points automagically by the linker. */ | |
| 55 | extern void _init (void); | |
| 56 | extern void _fini (void); | |
| 57 | #endif | |
| 58 | ||
| 59 | ||
| 60 | /* These functions are passed to __libc_start_main by the startup code. | |
| 61 | These get statically linked into each program. For dynamically linked | |
| 62 | programs, this module will come from libc_nonshared.a and differs from | |
| 63 | the libc.a module in that it doesn't call the preinit array. */ | |
| 64 | ||
| 65 | ||
| 66 | void | |
| 67 | __libc_csu_init (int argc, char **argv, char **envp) | |
| 68 | { | |
| 69 | /* For dynamically linked executables the preinit array is executed by | |
| 70 | the dynamic linker (before initializing any shared object). */ | |
| 71 | ||
| 72 | #ifndef LIBC_NONSHARED | |
| 73 | /* For static executables, preinit happens right before init. */ | |
| 74 | { | |
| 75 | const size_t size = __preinit_array_end - __preinit_array_start; | |
| 76 | size_t i; | |
| 77 | for (i = 0; i < size; i++) | |
| 78 | (*__preinit_array_start [i]) (argc, argv, envp); | |
| 79 | } | |
| 80 | #endif | |
| 81 | ||
| 82 | #ifndef NO_INITFINI | |
| 83 | _init (); | |
| 84 | #endif | |
| 85 | ||
| 86 | const size_t size = __init_array_end - __init_array_start; | |
| 87 | for (size_t i = 0; i < size; i++) | |
| 88 | (*__init_array_start [i]) (argc, argv, envp); | |
| 89 | } | |
| 90 | ||
| 91 | /* This function should not be used anymore. We run the executable's | |
| 92 | destructor now just like any other. We cannot remove the function, | |
| 93 | though. */ | |
| 94 | void | |
| 95 | __libc_csu_fini (void) | |
| 96 | { | |
| 97 | #ifndef LIBC_NONSHARED | |
| 98 | size_t i = __fini_array_end - __fini_array_start; | |
| 99 | while (i-- > 0) | |
| 100 | (*__fini_array_start [i]) (); | |
| 101 | ||
| 102 | # ifndef NO_INITFINI | |
| 103 | _fini (); | |
| 104 | # endif | |
| 105 | #endif | |
| 106 | } |
lib/libc/glibc/csu/errno.c created+35| ... | ... | @@ -0,0 +1,35 @@ |
| 1 | /* Definition of `errno' variable. Canonical version. | |
| 2 | Copyright (C) 2002-2021 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <https://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #include <errno.h> | |
| 20 | #include <tls.h> | |
| 21 | #include <dl-sysdep.h> | |
| 22 | #undef errno | |
| 23 | ||
| 24 | #if RTLD_PRIVATE_ERRNO | |
| 25 | ||
| 26 | /* Code compiled for rtld refers only to this name. */ | |
| 27 | int rtld_errno attribute_hidden; | |
| 28 | ||
| 29 | #else | |
| 30 | ||
| 31 | __thread int errno; | |
| 32 | extern __thread int __libc_errno __attribute__ ((alias ("errno"))) | |
| 33 | attribute_hidden; | |
| 34 | ||
| 35 | #endif |
lib/libc/glibc/debug/stack_chk_fail_local.c+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 2005-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 2005-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/elf/elf.h+108-35| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* This file defines standard ELF types, structures, and macros. |
| 2 | Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -19,10 +19,6 @@ |
| 19 | 19 | #ifndef _ELF_H |
| 20 | 20 | #define	_ELF_H 1 |
| 21 | 21 | |
| 22 | #include <features.h> | |
| 23 | ||
| 24 | __BEGIN_DECLS | |
| 25 | ||
| 26 | 22 | /* Standard ELF types. */ |
| 27 | 23 | |
| 28 | 24 | #include <stdint.h> |
| ... | ... | @@ -322,7 +318,7 @@ typedef struct |
| 322 | 318 | 				/* reserved 184 */ |
| 323 | 319 | #define EM_AVR32	185	/* Amtel 32-bit microprocessor */ |
| 324 | 320 | #define EM_STM8		186	/* STMicroelectronics STM8 */ |
| 325 | #define EM_TILE64	187	/* Tileta TILE64 */ | |
| 321 | #define EM_TILE64	187	/* Tilera TILE64 */ | |
| 326 | 322 | #define EM_TILEPRO	188	/* Tilera TILEPro */ |
| 327 | 323 | #define EM_MICROBLAZE	189	/* Xilinx MicroBlaze */ |
| 328 | 324 | #define EM_CUDA		190	/* NVIDIA CUDA */ |
| ... | ... | @@ -330,7 +326,7 @@ typedef struct |
| 330 | 326 | #define EM_CLOUDSHIELD	192	/* CloudShield */ |
| 331 | 327 | #define EM_COREA_1ST	193	/* KIPO-KAIST Core-A 1st gen. */ |
| 332 | 328 | #define EM_COREA_2ND	194	/* KIPO-KAIST Core-A 2nd gen. */ |
| 333 | #define EM_ARC_COMPACT2	195	/* Synopsys ARCompact V2 */ | |
| 329 | #define EM_ARCV2	195	/* Synopsys ARCv2 ISA. */ | |
| 334 | 330 | #define EM_OPEN8	196	/* Open8 RISC */ |
| 335 | 331 | #define EM_RL78		197	/* Renesas RL78 */ |
| 336 | 332 | #define EM_VIDEOCORE5	198	/* Broadcom VideoCore V */ |
| ... | ... | @@ -340,7 +336,8 @@ typedef struct |
| 340 | 336 | #define EM_BA2		202	/* Beyond BA2 */ |
| 341 | 337 | #define EM_XCORE	203	/* XMOS xCORE */ |
| 342 | 338 | #define EM_MCHP_PIC	204	/* Microchip 8-bit PIC(r) */ |
| 343 | 				/* reserved 205-209 */ | |
| 339 | #define EM_INTELGT	205	/* Intel Graphics Technology */ | |
| 340 | 				/* reserved 206-209 */ | |
| 344 | 341 | #define EM_KM32		210	/* KM211 KM32 */ |
| 345 | 342 | #define EM_KMX32	211	/* KM211 KMX32 */ |
| 346 | 343 | #define EM_EMX16	212	/* KM211 KMX16 */ |
| ... | ... | @@ -445,7 +442,7 @@ typedef struct |
| 445 | 442 | #define SHT_FINI_ARRAY	 15		/* Array of destructors */ |
| 446 | 443 | #define SHT_PREINIT_ARRAY 16		/* Array of pre-constructors */ |
| 447 | 444 | #define SHT_GROUP	 17		/* Section group */ |
| 448 | #define SHT_SYMTAB_SHNDX 18		/* Extended section indeces */ | |
| 445 | #define SHT_SYMTAB_SHNDX 18		/* Extended section indices */ | |
| 449 | 446 | #define	SHT_NUM		 19		/* Number of defined types. */ |
| 450 | 447 | #define SHT_LOOS	 0x60000000	/* Start OS-specific. */ |
| 451 | 448 | #define SHT_GNU_ATTRIBUTES 0x6ffffff5	/* Object attributes. */ |
| ... | ... | @@ -482,6 +479,7 @@ typedef struct |
| 482 | 479 | #define SHF_COMPRESSED	 (1 << 11)	/* Section with compressed data. */ |
| 483 | 480 | #define SHF_MASKOS	 0x0ff00000	/* OS-specific. */ |
| 484 | 481 | #define SHF_MASKPROC	 0xf0000000	/* Processor-specific */ |
| 482 | #define SHF_GNU_RETAIN	 (1 << 21) /* Not to be GCed by linker. */ | |
| 485 | 483 | #define SHF_ORDERED	 (1 << 30)	/* Special ordering requirement |
| 486 | 484 | 					 (Solaris). */ |
| 487 | 485 | #define SHF_EXCLUDE	 (1U << 31)	/* Section is excluded unless |
| ... | ... | @@ -721,6 +719,7 @@ typedef struct |
| 721 | 719 | #define PT_GNU_EH_FRAME	0x6474e550	/* GCC .eh_frame_hdr segment */ |
| 722 | 720 | #define PT_GNU_STACK	0x6474e551	/* Indicates stack executability */ |
| 723 | 721 | #define PT_GNU_RELRO	0x6474e552	/* Read-only after relocation */ |
| 722 | #define PT_GNU_PROPERTY	0x6474e553	/* GNU property */ | |
| 724 | 723 | #define PT_LOSUNW	0x6ffffffa |
| 725 | 724 | #define PT_SUNWBSS	0x6ffffffa	/* Sun Specific segment */ |
| 726 | 725 | #define PT_SUNWSTACK	0x6ffffffb	/* Stack segment */ |
| ... | ... | @@ -815,6 +814,10 @@ typedef struct |
| 815 | 814 | 					 address keys. */ |
| 816 | 815 | #define NT_ARM_PACG_KEYS	0x408	/* ARM pointer authentication |
| 817 | 816 | 					 generic key. */ |
| 817 | #define NT_ARM_TAGGED_ADDR_CTRL	0x409	/* AArch64 tagged address | |
| 818 | 					 control. */ | |
| 819 | #define NT_ARM_PAC_ENABLED_KEYS	0x40a	/* AArch64 pointer authentication | |
| 820 | 					 enabled keys. */ | |
| 818 | 821 | #define NT_VMCOREDD	0x700		/* Vmcore Device Dump Note. */ |
| 819 | 822 | #define NT_MIPS_DSP	0x800		/* MIPS DSP ASE registers. */ |
| 820 | 823 | #define NT_MIPS_FP_MODE	0x801		/* MIPS floating-point mode. */ |
| ... | ... | @@ -1049,7 +1052,7 @@ typedef struct |
| 1049 | 1052 | #define	VER_NDX_LORESERVE	0xff00	/* Beginning of reserved entries. */ |
| 1050 | 1053 | #define	VER_NDX_ELIMINATE	0xff01	/* Symbol is to be eliminated. */ |
| 1051 | 1054 | |
| 1052 | /* Auxialiary version information. */ | |
| 1055 | /* Auxiliary version information. */ | |
| 1053 | 1056 | |
| 1054 | 1057 | typedef struct |
| 1055 | 1058 | { |
| ... | ... | @@ -1318,33 +1321,34 @@ typedef struct |
| 1318 | 1321 | /* Application-specific semantics, hi */ |
| 1319 | 1322 | #define GNU_PROPERTY_HIUSER			0xffffffff |
| 1320 | 1323 | |
| 1324 | /* AArch64 specific GNU properties. */ | |
| 1325 | #define GNU_PROPERTY_AARCH64_FEATURE_1_AND	0xc0000000 | |
| 1326 | ||
| 1327 | #define GNU_PROPERTY_AARCH64_FEATURE_1_BTI	(1U << 0) | |
| 1328 | #define GNU_PROPERTY_AARCH64_FEATURE_1_PAC	(1U << 1) | |
| 1329 | ||
| 1321 | 1330 | /* The x86 instruction sets indicated by the corresponding bits are |
| 1322 | 1331 | used in program. Their support in the hardware is optional. */ |
| 1323 | #define GNU_PROPERTY_X86_ISA_1_USED		0xc0000000 | |
| 1332 | #define GNU_PROPERTY_X86_ISA_1_USED		0xc0010002 | |
| 1324 | 1333 | /* The x86 instruction sets indicated by the corresponding bits are |
| 1325 | 1334 | used in program and they must be supported by the hardware. */ |
| 1326 | #define GNU_PROPERTY_X86_ISA_1_NEEDED		0xc0000001 | |
| 1335 | #define GNU_PROPERTY_X86_ISA_1_NEEDED		0xc0008002 | |
| 1327 | 1336 | /* X86 processor-specific features used in program. */ |
| 1328 | 1337 | #define GNU_PROPERTY_X86_FEATURE_1_AND		0xc0000002 |
| 1329 | 1338 | |
| 1330 | #define GNU_PROPERTY_X86_ISA_1_486		(1U << 0) | |
| 1331 | #define GNU_PROPERTY_X86_ISA_1_586		(1U << 1) | |
| 1332 | #define GNU_PROPERTY_X86_ISA_1_686		(1U << 2) | |
| 1333 | #define GNU_PROPERTY_X86_ISA_1_SSE		(1U << 3) | |
| 1334 | #define GNU_PROPERTY_X86_ISA_1_SSE2		(1U << 4) | |
| 1335 | #define GNU_PROPERTY_X86_ISA_1_SSE3		(1U << 5) | |
| 1336 | #define GNU_PROPERTY_X86_ISA_1_SSSE3		(1U << 6) | |
| 1337 | #define GNU_PROPERTY_X86_ISA_1_SSE4_1		(1U << 7) | |
| 1338 | #define GNU_PROPERTY_X86_ISA_1_SSE4_2		(1U << 8) | |
| 1339 | #define GNU_PROPERTY_X86_ISA_1_AVX		(1U << 9) | |
| 1340 | #define GNU_PROPERTY_X86_ISA_1_AVX2		(1U << 10) | |
| 1341 | #define GNU_PROPERTY_X86_ISA_1_AVX512F		(1U << 11) | |
| 1342 | #define GNU_PROPERTY_X86_ISA_1_AVX512CD		(1U << 12) | |
| 1343 | #define GNU_PROPERTY_X86_ISA_1_AVX512ER		(1U << 13) | |
| 1344 | #define GNU_PROPERTY_X86_ISA_1_AVX512PF		(1U << 14) | |
| 1345 | #define GNU_PROPERTY_X86_ISA_1_AVX512VL		(1U << 15) | |
| 1346 | #define GNU_PROPERTY_X86_ISA_1_AVX512DQ		(1U << 16) | |
| 1347 | #define GNU_PROPERTY_X86_ISA_1_AVX512BW		(1U << 17) | |
| 1339 | /* GNU_PROPERTY_X86_ISA_1_BASELINE: CMOV, CX8 (cmpxchg8b), FPU (fld), | |
| 1340 | MMX, OSFXSR (fxsave), SCE (syscall), SSE and SSE2. */ | |
| 1341 | #define GNU_PROPERTY_X86_ISA_1_BASELINE		(1U << 0) | |
| 1342 | /* GNU_PROPERTY_X86_ISA_1_V2: GNU_PROPERTY_X86_ISA_1_BASELINE, | |
| 1343 | CMPXCHG16B (cmpxchg16b), LAHF-SAHF (lahf), POPCNT (popcnt), SSE3, | |
| 1344 | SSSE3, SSE4.1 and SSE4.2. */ | |
| 1345 | #define GNU_PROPERTY_X86_ISA_1_V2		(1U << 1) | |
| 1346 | /* GNU_PROPERTY_X86_ISA_1_V3: GNU_PROPERTY_X86_ISA_1_V2, AVX, AVX2, BMI1, | |
| 1347 | BMI2, F16C, FMA, LZCNT, MOVBE, XSAVE. */ | |
| 1348 | #define GNU_PROPERTY_X86_ISA_1_V3		(1U << 2) | |
| 1349 | /* GNU_PROPERTY_X86_ISA_1_V4: GNU_PROPERTY_X86_ISA_1_V3, AVX512F, | |
| 1350 | AVX512BW, AVX512CD, AVX512DQ and AVX512VL. */ | |
| 1351 | #define GNU_PROPERTY_X86_ISA_1_V4		(1U << 3) | |
| 1348 | 1352 | |
| 1349 | 1353 | /* This indicates that all executable sections are compatible with |
| 1350 | 1354 | IBT. */ |
| ... | ... | @@ -2136,9 +2140,9 @@ enum |
| 2136 | 2140 | #define EFA_PARISC_1_1		 0x0210 /* PA-RISC 1.1 big-endian. */ |
| 2137 | 2141 | #define EFA_PARISC_2_0		 0x0214 /* PA-RISC 2.0 big-endian. */ |
| 2138 | 2142 | |
| 2139 | /* Additional section indeces. */ | |
| 2143 | /* Additional section indices. */ | |
| 2140 | 2144 | |
| 2141 | #define SHN_PARISC_ANSI_COMMON	0xff00	 /* Section for tenatively declared | |
| 2145 | #define SHN_PARISC_ANSI_COMMON	0xff00	 /* Section for tentatively declared | |
| 2142 | 2146 | 					 symbols in ANSI C. */ |
| 2143 | 2147 | #define SHN_PARISC_HUGE_COMMON	0xff01	 /* Common blocks in huge model. */ |
| 2144 | 2148 | |
| ... | ... | @@ -2868,6 +2872,8 @@ enum |
| 2868 | 2872 | #define R_AARCH64_IRELATIVE	1032	/* STT_GNU_IFUNC relocation. */ |
| 2869 | 2873 | |
| 2870 | 2874 | /* AArch64 specific values for the Dyn d_tag field. */ |
| 2875 | #define DT_AARCH64_BTI_PLT	(DT_LOPROC + 1) | |
| 2876 | #define DT_AARCH64_PAC_PLT	(DT_LOPROC + 3) | |
| 2871 | 2877 | #define DT_AARCH64_VARIANT_PCS	(DT_LOPROC + 5) |
| 2872 | 2878 | #define DT_AARCH64_NUM		6 |
| 2873 | 2879 | |
| ... | ... | @@ -3946,8 +3952,9 @@ enum |
| 3946 | 3952 | #define R_RISCV_SET16		55 |
| 3947 | 3953 | #define R_RISCV_SET32		56 |
| 3948 | 3954 | #define R_RISCV_32_PCREL	57 |
| 3955 | #define R_RISCV_IRELATIVE	58 | |
| 3949 | 3956 | |
| 3950 | #define R_RISCV_NUM		58 | |
| 3957 | #define R_RISCV_NUM		59 | |
| 3951 | 3958 | |
| 3952 | 3959 | /* BPF specific declarations. */ |
| 3953 | 3960 | |
| ... | ... | @@ -3964,7 +3971,7 @@ enum |
| 3964 | 3971 | #define R_METAG_RELBRANCH	4 |
| 3965 | 3972 | #define R_METAG_GETSETOFF	5 |
| 3966 | 3973 | |
| 3967 | /* Backward compatability */ | |
| 3974 | /* Backward compatibility */ | |
| 3968 | 3975 | #define R_METAG_REG32OP1	6 |
| 3969 | 3976 | #define R_METAG_REG32OP2	7 |
| 3970 | 3977 | #define R_METAG_REG32OP3	8 |
| ... | ... | @@ -4027,6 +4034,72 @@ enum |
| 4027 | 4034 | #define R_NDS32_TLS_TPOFF	102 |
| 4028 | 4035 | #define R_NDS32_TLS_DESC	119 |
| 4029 | 4036 | |
| 4030 | __END_DECLS | |
| 4037 | /* ARCompact/ARCv2 specific relocs. */ | |
| 4038 | #define R_ARC_NONE		0x0 | |
| 4039 | #define R_ARC_8			0x1 | |
| 4040 | #define R_ARC_16		0x2 | |
| 4041 | #define R_ARC_24		0x3 | |
| 4042 | #define R_ARC_32		0x4 | |
| 4043 | #define R_ARC_B26		0x5 | |
| 4044 | #define R_ARC_B22_PCREL		0x6 | |
| 4045 | #define R_ARC_H30		0x7 | |
| 4046 | #define R_ARC_N8		0x8 | |
| 4047 | #define R_ARC_N16		0x9 | |
| 4048 | #define R_ARC_N24		0xA | |
| 4049 | #define R_ARC_N32		0xB | |
| 4050 | #define R_ARC_SDA		0xC | |
| 4051 | #define R_ARC_SECTOFF		0xD | |
| 4052 | #define R_ARC_S21H_PCREL	0xE | |
| 4053 | #define R_ARC_S21W_PCREL	0xF | |
| 4054 | #define R_ARC_S25H_PCREL	0x10 | |
| 4055 | #define R_ARC_S25W_PCREL	0x11 | |
| 4056 | #define R_ARC_SDA32		0x12 | |
| 4057 | #define R_ARC_SDA_LDST		0x13 | |
| 4058 | #define R_ARC_SDA_LDST1		0x14 | |
| 4059 | #define R_ARC_SDA_LDST2		0x15 | |
| 4060 | #define R_ARC_SDA16_LD		0x16 | |
| 4061 | #define R_ARC_SDA16_LD1		0x17 | |
| 4062 | #define R_ARC_SDA16_LD2		0x18 | |
| 4063 | #define R_ARC_S13_PCREL		0x19 | |
| 4064 | #define R_ARC_W			0x1A | |
| 4065 | #define R_ARC_32_ME		0x1B | |
| 4066 | #define R_ARC_N32_ME		0x1C | |
| 4067 | #define R_ARC_SECTOFF_ME	0x1D | |
| 4068 | #define R_ARC_SDA32_ME		0x1E | |
| 4069 | #define R_ARC_W_ME		0x1F | |
| 4070 | #define R_ARC_H30_ME		0x20 | |
| 4071 | #define R_ARC_SECTOFF_U8	0x21 | |
| 4072 | #define R_ARC_SECTOFF_S9	0x22 | |
| 4073 | #define R_AC_SECTOFF_U8		0x23 | |
| 4074 | #define R_AC_SECTOFF_U8_1	0x24 | |
| 4075 | #define R_AC_SECTOFF_U8_2	0x25 | |
| 4076 | #define R_AC_SECTOFF_S9		0x26 | |
| 4077 | #define R_AC_SECTOFF_S9_1	0x27 | |
| 4078 | #define R_AC_SECTOFF_S9_2	0x28 | |
| 4079 | #define R_ARC_SECTOFF_ME_1	0x29 | |
| 4080 | #define R_ARC_SECTOFF_ME_2	0x2A | |
| 4081 | #define R_ARC_SECTOFF_1		0x2B | |
| 4082 | #define R_ARC_SECTOFF_2		0x2C | |
| 4083 | #define R_ARC_PC32		0x32 | |
| 4084 | #define R_ARC_GOTPC32		0x33 | |
| 4085 | #define R_ARC_PLT32		0x34 | |
| 4086 | #define R_ARC_COPY		0x35 | |
| 4087 | #define R_ARC_GLOB_DAT		0x36 | |
| 4088 | #define R_ARC_JUMP_SLOT		0x37 | |
| 4089 | #define R_ARC_RELATIVE		0x38 | |
| 4090 | #define R_ARC_GOTOFF		0x39 | |
| 4091 | #define R_ARC_GOTPC		0x3A | |
| 4092 | #define R_ARC_GOT32		0x3B | |
| 4093 | ||
| 4094 | #define R_ARC_TLS_DTPMOD	0x42 | |
| 4095 | #define R_ARC_TLS_DTPOFF	0x43 | |
| 4096 | #define R_ARC_TLS_TPOFF		0x44 | |
| 4097 | #define R_ARC_TLS_GD_GOT	0x45 | |
| 4098 | #define R_ARC_TLS_GD_LD	 0x46 | |
| 4099 | #define R_ARC_TLS_GD_CALL	0x47 | |
| 4100 | #define R_ARC_TLS_IE_GOT	0x48 | |
| 4101 | #define R_ARC_TLS_DTPOFF_S9	0x4a | |
| 4102 | #define R_ARC_TLS_LE_S9		0x4a | |
| 4103 | #define R_ARC_TLS_LE_32		0x4b | |
| 4031 | 4104 | |
| 4032 | 4105 | #endif	/* elf.h */ |
lib/libc/glibc/include/bits/cpu-set.h+8| ... | ... | @@ -1 +1,9 @@ |
| 1 | #ifndef _BITS_CPU_SET_H | |
| 1 | 2 | #include <posix/bits/cpu-set.h> |
| 3 | ||
| 4 | #ifndef _ISOMAC | |
| 5 | int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp); | |
| 6 | libc_hidden_proto (__sched_cpucount) | |
| 7 | #endif | |
| 8 | ||
| 9 | #endif /* _BITS_CPU_SET_H */ |
lib/libc/glibc/include/errno.h created+45| ... | ... | @@ -0,0 +1,45 @@ |
| 1 | #ifndef _ERRNO_H | |
| 2 | #include <stdlib/errno.h> | |
| 3 | #if !defined _ISOMAC && !defined __ASSEMBLER__ | |
| 4 | ||
| 5 | # if IS_IN (rtld) | |
| 6 | # include <dl-sysdep.h> | |
| 7 | # ifndef RTLD_PRIVATE_ERRNO | |
| 8 | # error "dl-sysdep.h must define RTLD_PRIVATE_ERRNO!" | |
| 9 | # endif | |
| 10 | # else | |
| 11 | # define RTLD_PRIVATE_ERRNO	0 | |
| 12 | # endif | |
| 13 | ||
| 14 | # if RTLD_PRIVATE_ERRNO | |
| 15 | /* The dynamic linker uses its own private errno variable. | |
| 16 | All access to errno inside the dynamic linker is serialized, | |
| 17 | so a single (hidden) global variable is all it needs. */ | |
| 18 | ||
| 19 | # undef errno | |
| 20 | # define errno rtld_errno | |
| 21 | extern int rtld_errno attribute_hidden; | |
| 22 | ||
| 23 | # elif IS_IN_LIB && !IS_IN (rtld) | |
| 24 | ||
| 25 | # undef errno | |
| 26 | # if IS_IN (libc) | |
| 27 | # define errno __libc_errno | |
| 28 | # else | |
| 29 | # define errno errno		/* For #ifndef errno tests. */ | |
| 30 | # endif | |
| 31 | extern __thread int errno attribute_tls_model_ie; | |
| 32 | ||
| 33 | # endif	/* IS_IN_LIB */ | |
| 34 | ||
| 35 | # define __set_errno(val) (errno = (val)) | |
| 36 | ||
| 37 | extern int *__errno_location (void) __THROW __attribute_const__ | |
| 38 | # if RTLD_PRIVATE_ERRNO | |
| 39 | attribute_hidden | |
| 40 | # endif | |
| 41 | ; | |
| 42 | libc_hidden_proto (__errno_location) | |
| 43 | ||
| 44 | #endif /* !_ISOMAC && !__ASSEMBLER__ */ | |
| 45 | #endif /* !_ERRNO_H */ |
lib/libc/glibc/include/features.h+25-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1991-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1991-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -33,6 +33,8 @@ |
| 33 | 33 | 			Extensions to ISO C11 from TS 18661-4:2015. |
| 34 | 34 | __STDC_WANT_IEC_60559_TYPES_EXT__ |
| 35 | 35 | 			Extensions to ISO C11 from TS 18661-3:2015. |
| 36 | __STDC_WANT_IEC_60559_EXT__ | |
| 37 | 			ISO C2X interfaces defined only in Annex F. | |
| 36 | 38 | |
| 37 | 39 | _POSIX_SOURCE	IEEE Std 1003.1. |
| 38 | 40 | _POSIX_C_SOURCE	If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2; |
| ... | ... | @@ -48,6 +50,8 @@ |
| 48 | 50 | _LARGEFILE64_SOURCE	Additional functionality from LFS for large files. |
| 49 | 51 | _FILE_OFFSET_BITS=N	Select default filesystem interface. |
| 50 | 52 | _ATFILE_SOURCE	Additional *at interfaces. |
| 53 | _DYNAMIC_STACK_SIZE_SOURCE Select correct (but non compile-time constant) | |
| 54 | 			MINSIGSTKSZ, SIGSTKSZ and PTHREAD_STACK_MIN. | |
| 51 | 55 | _GNU_SOURCE		All of the above, plus GNU extensions. |
| 52 | 56 | _DEFAULT_SOURCE	The default set of features (taking precedence over |
| 53 | 57 | 			__STRICT_ANSI__). |
| ... | ... | @@ -94,6 +98,8 @@ |
| 94 | 98 | __USE_FILE_OFFSET64	Define 64bit interface as default. |
| 95 | 99 | __USE_MISC		Define things from 4.3BSD or System V Unix. |
| 96 | 100 | __USE_ATFILE		Define *at interfaces and AT_* constants for them. |
| 101 | __USE_DYNAMIC_STACK_SIZE Define correct (but non compile-time constant) | |
| 102 | 			MINSIGSTKSZ, SIGSTKSZ and PTHREAD_STACK_MIN. | |
| 97 | 103 | __USE_GNU		Define GNU extensions. |
| 98 | 104 | __USE_FORTIFY_LEVEL	Additional security measures used, according to level. |
| 99 | 105 | |
| ... | ... | @@ -137,6 +143,7 @@ |
| 137 | 143 | #undef	__USE_FILE_OFFSET64 |
| 138 | 144 | #undef	__USE_MISC |
| 139 | 145 | #undef	__USE_ATFILE |
| 146 | #undef	__USE_DYNAMIC_STACK_SIZE | |
| 140 | 147 | #undef	__USE_GNU |
| 141 | 148 | #undef	__USE_FORTIFY_LEVEL |
| 142 | 149 | #undef	__KERNEL_STRICT_NAMES |
| ... | ... | @@ -213,6 +220,8 @@ |
| 213 | 220 | # define _DEFAULT_SOURCE	1 |
| 214 | 221 | # undef _ATFILE_SOURCE |
| 215 | 222 | # define _ATFILE_SOURCE	1 |
| 223 | # undef _DYNAMIC_STACK_SIZE_SOURCE | |
| 224 | # define _DYNAMIC_STACK_SIZE_SOURCE 1 | |
| 216 | 225 | #endif |
| 217 | 226 | |
| 218 | 227 | /* If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, |
| ... | ... | @@ -380,6 +389,8 @@ |
| 380 | 389 | # define __USE_FILE_OFFSET64	1 |
| 381 | 390 | #endif |
| 382 | 391 | |
| 392 | #include <features-time64.h> | |
| 393 | ||
| 383 | 394 | #if defined _DEFAULT_SOURCE |
| 384 | 395 | # define __USE_MISC	1 |
| 385 | 396 | #endif |
| ... | ... | @@ -388,6 +399,10 @@ |
| 388 | 399 | # define __USE_ATFILE	1 |
| 389 | 400 | #endif |
| 390 | 401 | |
| 402 | #ifdef	_DYNAMIC_STACK_SIZE_SOURCE | |
| 403 | # define __USE_DYNAMIC_STACK_SIZE	1 | |
| 404 | #endif | |
| 405 | ||
| 391 | 406 | #ifdef	_GNU_SOURCE |
| 392 | 407 | # define __USE_GNU	1 |
| 393 | 408 | #endif |
| ... | ... | @@ -397,7 +412,15 @@ |
| 397 | 412 | # warning _FORTIFY_SOURCE requires compiling with optimization (-O) |
| 398 | 413 | # elif !__GNUC_PREREQ (4, 1) |
| 399 | 414 | # warning _FORTIFY_SOURCE requires GCC 4.1 or later |
| 415 | # elif _FORTIFY_SOURCE > 2 && __glibc_clang_prereq (9, 0) | |
| 416 | # if _FORTIFY_SOURCE > 3 | |
| 417 | # warning _FORTIFY_SOURCE > 3 is treated like 3 on this platform | |
| 418 | # endif | |
| 419 | # define __USE_FORTIFY_LEVEL 3 | |
| 400 | 420 | # elif _FORTIFY_SOURCE > 1 |
| 421 | # if _FORTIFY_SOURCE > 2 | |
| 422 | # warning _FORTIFY_SOURCE > 2 is treated like 2 on this platform | |
| 423 | # endif | |
| 401 | 424 | # define __USE_FORTIFY_LEVEL 2 |
| 402 | 425 | # else |
| 403 | 426 | # define __USE_FORTIFY_LEVEL 1 |
| ... | ... | @@ -454,7 +477,7 @@ |
| 454 | 477 | /* Major and minor version number of the GNU C library package. Use |
| 455 | 478 | these macros to test for features in specific releases. */ |
| 456 | 479 | #define	__GLIBC__	2 |
| 457 | #define	__GLIBC_MINOR__	31 | |
| 480 | #define	__GLIBC_MINOR__	34 | |
| 458 | 481 | |
| 459 | 482 | #define __GLIBC_PREREQ(maj, min) \ |
| 460 | 483 | 	((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min)) |
lib/libc/glibc/include/libc-pointer-arith.h+4-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Helper macros for pointer arithmetic. |
| 2 | Copyright (C) 2012-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2012-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -37,6 +37,9 @@ |
| 37 | 37 | /* Cast an integer or a pointer VAL to integer with proper type. */ |
| 38 | 38 | # define cast_to_integer(val) ((__integer_if_pointer_type (val)) (val)) |
| 39 | 39 | |
| 40 | /* Cast an integer VAL to void * pointer. */ | |
| 41 | # define cast_to_pointer(val) ((void *) (uintptr_t) (val)) | |
| 42 | ||
| 40 | 43 | /* Align a value by rounding down to closest size. |
| 41 | 44 | e.g. Using size of 4096, we get this behavior: |
| 42 | 45 | 	{4095, 4096, 4097} = {0, 4096, 4096}. */ |
lib/libc/glibc/include/libc-symbols.h+62-83| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | /* Support macros for making weak and strong aliases for symbols, |
| 2 | 2 | and for using symbol sets and linker warnings with GNU ld. |
| 3 | Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 3 | Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 | |
| 6 | 6 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -84,6 +84,9 @@ |
| 84 | 84 | |
| 85 | 85 | #include <config.h> |
| 86 | 86 | |
| 87 | /* Obtain the definition of symbol_version_reference. */ | |
| 88 | #include <libc-symver.h> | |
| 89 | ||
| 87 | 90 | /* When PIC is defined and SHARED isn't defined, we are building PIE |
| 88 | 91 | by default. */ |
| 89 | 92 | #if defined PIC && !defined SHARED |
| ... | ... | @@ -307,7 +310,7 @@ for linking") |
| 307 | 310 | |
| 308 | 311 | /* Resource freeing functions from libc.so go in this section. */ |
| 309 | 312 | #define __libc_freeres_fn_section \ |
| 310 | __attribute__ ((section ("__libc_freeres_fn"))) | |
| 313 | __attribute__ ((__used__, section ("__libc_freeres_fn"))) | |
| 311 | 314 | |
| 312 | 315 | /* Resource freeing functions for libc.so. */ |
| 313 | 316 | #define libc_freeres_fn(name) \ |
| ... | ... | @@ -349,6 +352,12 @@ for linking") |
| 349 | 352 | |
| 350 | 353 | */ |
| 351 | 354 | |
| 355 | #ifdef HAVE_GNU_RETAIN | |
| 356 | # define attribute_used_retain __attribute__ ((__used__, __retain__)) | |
| 357 | #else | |
| 358 | # define attribute_used_retain __attribute__ ((__used__)) | |
| 359 | #endif | |
| 360 | ||
| 352 | 361 | /* Symbol set support macros. */ |
| 353 | 362 | |
| 354 | 363 | /* Make SYMBOL, which is in the text segment, an element of SET. */ |
| ... | ... | @@ -364,12 +373,12 @@ for linking") |
| 364 | 373 | /* When building a shared library, make the set section writable, |
| 365 | 374 | because it will need to be relocated at run time anyway. */ |
| 366 | 375 | # define _elf_set_element(set, symbol) \ |
| 367 | static const void *__elf_set_##set##_element_##symbol##__ \ | |
| 368 | __attribute__ ((used, section (#set))) = &(symbol) | |
| 376 | static const void *__elf_set_##set##_element_##symbol##__ \ | |
| 377 | attribute_used_retain __attribute__ ((section (#set))) = &(symbol) | |
| 369 | 378 | #else |
| 370 | 379 | # define _elf_set_element(set, symbol) \ |
| 371 | static const void *const __elf_set_##set##_element_##symbol##__ \ | |
| 372 | __attribute__ ((used, section (#set))) = &(symbol) | |
| 380 | static const void *const __elf_set_##set##_element_##symbol##__ \ | |
| 381 | attribute_used_retain __attribute__ ((section (#set))) = &(symbol) | |
| 373 | 382 | #endif |
| 374 | 383 | |
| 375 | 384 | /* Define SET as a symbol set. This may be required (it is in a.out) to |
| ... | ... | @@ -396,32 +405,27 @@ for linking") |
| 396 | 405 | past the last element in SET. */ |
| 397 | 406 | #define symbol_set_end_p(set, ptr) ((ptr) >= (void *const *) &__stop_##set) |
| 398 | 407 | |
| 399 | /* Use symbol_version_reference to specify the version a symbol | |
| 400 | reference should link to. Use symbol_version or | |
| 401 | default_symbol_version for the definition of a versioned symbol. | |
| 402 | The difference is that the latter is a no-op in non-shared | |
| 403 | builds. */ | |
| 404 | #ifdef __ASSEMBLER__ | |
| 405 | # define symbol_version_reference(real, name, version) \ | |
| 406 | .symver real, name##@##version | |
| 407 | #else /* !__ASSEMBLER__ */ | |
| 408 | # define symbol_version_reference(real, name, version) \ | |
| 409 | __asm__ (".symver " #real "," #name "@" #version) | |
| 410 | #endif | |
| 411 | ||
| 412 | 408 | #ifdef SHARED |
| 413 | 409 | # define symbol_version(real, name, version) \ |
| 414 | 410 | symbol_version_reference(real, name, version) |
| 415 | 411 | # define default_symbol_version(real, name, version) \ |
| 416 | 412 | _default_symbol_version(real, name, version) |
| 413 | /* See <libc-symver.h>. */ | |
| 417 | 414 | # ifdef __ASSEMBLER__ |
| 418 | 415 | # define _default_symbol_version(real, name, version) \ |
| 419 | .symver real, name##@##@##version | |
| 416 | _set_symbol_version (real, name@@version) | |
| 420 | 417 | # else |
| 421 | 418 | # define _default_symbol_version(real, name, version) \ |
| 422 | __asm__ (".symver " #real "," #name "@@" #version) | |
| 419 | _set_symbol_version (real, #name "@@" #version) | |
| 423 | 420 | # endif |
| 424 | #else | |
| 421 | ||
| 422 | /* Evalutes to a string literal for VERSION in LIB. */ | |
| 423 | # define symbol_version_string(lib, version) \ | |
| 424 | _symbol_version_stringify_1 (VERSION_##lib##_##version) | |
| 425 | # define _symbol_version_stringify_1(arg) _symbol_version_stringify_2 (arg) | |
| 426 | # define _symbol_version_stringify_2(arg) #arg | |
| 427 | ||
| 428 | #else /* !SHARED */ | |
| 425 | 429 | # define symbol_version(real, name, version) |
| 426 | 430 | # define default_symbol_version(real, name, version) \ |
| 427 | 431 | strong_alias(real, name) |
| ... | ... | @@ -618,12 +622,7 @@ for linking") |
| 618 | 622 | # define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs) |
| 619 | 623 | # define libc_hidden_def(name) hidden_def (name) |
| 620 | 624 | # define libc_hidden_weak(name) hidden_weak (name) |
| 621 | # ifdef LINK_OBSOLETE_RPC | |
| 622 | /* libc_hidden_nolink_sunrpc should only get used in sunrpc code. */ | |
| 623 | # define libc_hidden_nolink_sunrpc(name, version) hidden_def (name) | |
| 624 | # else | |
| 625 | # define libc_hidden_nolink_sunrpc(name, version) hidden_nolink (name, libc, version) | |
| 626 | # endif | |
| 625 | # define libc_hidden_nolink_sunrpc(name, version) hidden_nolink (name, libc, version) | |
| 627 | 626 | # define libc_hidden_ver(local, name) hidden_ver (local, name) |
| 628 | 627 | # define libc_hidden_data_def(name) hidden_data_def (name) |
| 629 | 628 | # define libc_hidden_tls_def(name) hidden_tls_def (name) |
| ... | ... | @@ -641,7 +640,7 @@ for linking") |
| 641 | 640 | # define libc_hidden_data_ver(local, name) |
| 642 | 641 | #endif |
| 643 | 642 | |
| 644 | #if IS_IN (rtld) && !defined NO_RTLD_HIDDEN | |
| 643 | #if IS_IN (rtld) | |
| 645 | 644 | # define rtld_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) |
| 646 | 645 | # define rtld_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs) |
| 647 | 646 | # define rtld_hidden_def(name) hidden_def (name) |
| ... | ... | @@ -730,6 +729,29 @@ for linking") |
| 730 | 729 | # define libresolv_hidden_data_ver(local, name) |
| 731 | 730 | #endif |
| 732 | 731 | |
| 732 | #if IS_IN (libpthread) | |
| 733 | # define libpthread_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) | |
| 734 | # define libpthread_hidden_tls_proto(name, attrs...) \ | |
| 735 | hidden_tls_proto (name, ##attrs) | |
| 736 | # define libpthread_hidden_def(name) hidden_def (name) | |
| 737 | # define libpthread_hidden_weak(name) hidden_weak (name) | |
| 738 | # define libpthread_hidden_ver(local, name) hidden_ver (local, name) | |
| 739 | # define libpthread_hidden_data_def(name) hidden_data_def (name) | |
| 740 | # define libpthread_hidden_tls_def(name) hidden_tls_def (name) | |
| 741 | # define libpthread_hidden_data_weak(name) hidden_data_weak (name) | |
| 742 | # define libpthread_hidden_data_ver(local, name) hidden_data_ver (local, name) | |
| 743 | #else | |
| 744 | # define libpthread_hidden_proto(name, attrs...) | |
| 745 | # define libpthread_hidden_tls_proto(name, attrs...) | |
| 746 | # define libpthread_hidden_def(name) | |
| 747 | # define libpthread_hidden_weak(name) | |
| 748 | # define libpthread_hidden_ver(local, name) | |
| 749 | # define libpthread_hidden_data_def(name) | |
| 750 | # define libpthread_hidden_tls_def(name) | |
| 751 | # define libpthread_hidden_data_weak(name) | |
| 752 | # define libpthread_hidden_data_ver(local, name) | |
| 753 | #endif | |
| 754 | ||
| 733 | 755 | #if IS_IN (librt) |
| 734 | 756 | # define librt_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) |
| 735 | 757 | # define librt_hidden_tls_proto(name, attrs...) \ |
| ... | ... | @@ -776,40 +798,11 @@ for linking") |
| 776 | 798 | # define libdl_hidden_data_ver(local, name) |
| 777 | 799 | #endif |
| 778 | 800 | |
| 779 | #if IS_IN (libnss_files) | |
| 780 | # define libnss_files_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) | |
| 781 | # define libnss_files_hidden_tls_proto(name, attrs...) \ | |
| 782 | hidden_tls_proto (name, ##attrs) | |
| 783 | # define libnss_files_hidden_def(name) hidden_def (name) | |
| 784 | # define libnss_files_hidden_weak(name) hidden_weak (name) | |
| 785 | # define libnss_files_hidden_ver(local, name) hidden_ver (local, name) | |
| 786 | # define libnss_files_hidden_data_def(name) hidden_data_def (name) | |
| 787 | # define libnss_files_hidden_tls_def(name) hidden_tls_def (name) | |
| 788 | # define libnss_files_hidden_data_weak(name) hidden_data_weak (name) | |
| 789 | # define libnss_files_hidden_data_ver(local, name) hidden_data_ver(local, name) | |
| 790 | #else | |
| 791 | # define libnss_files_hidden_proto(name, attrs...) | |
| 792 | # define libnss_files_hidden_tls_proto(name, attrs...) | |
| 793 | # define libnss_files_hidden_def(name) | |
| 794 | # define libnss_files_hidden_weak(name) | |
| 795 | # define libnss_files_hidden_ver(local, name) | |
| 796 | # define libnss_files_hidden_data_def(name) | |
| 797 | # define libnss_files_hidden_tls_def(name) | |
| 798 | # define libnss_files_hidden_data_weak(name) | |
| 799 | # define libnss_files_hidden_data_ver(local, name) | |
| 800 | #endif | |
| 801 | ||
| 802 | 801 | #if IS_IN (libnsl) |
| 803 | 802 | # define libnsl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) |
| 804 | 803 | # define libnsl_hidden_tls_proto(name, attrs...) \ |
| 805 | 804 | hidden_tls_proto (name, ##attrs) |
| 806 | # ifdef LINK_OBSOLETE_NSL | |
| 807 | /* libnsl_hidden_nolink should only get used in libnsl code. */ | |
| 808 | # define libnsl_hidden_nolink_def(name, version) libnsl_hidden_def (name) | |
| 809 | # else | |
| 810 | # define libnsl_hidden_nolink_def(name, version) hidden_nolink (name, libnsl, version) | |
| 811 | # endif | |
| 812 | # define libnsl_hidden_def(name) hidden_def (name) | |
| 805 | # define libnsl_hidden_nolink_def(name, version) hidden_nolink (name, libnsl, version) | |
| 813 | 806 | # define libnsl_hidden_weak(name) hidden_weak (name) |
| 814 | 807 | # define libnsl_hidden_ver(local, name) hidden_ver (local, name) |
| 815 | 808 | # define libnsl_hidden_data_def(name) hidden_data_def (name) |
| ... | ... | @@ -819,7 +812,6 @@ for linking") |
| 819 | 812 | #else |
| 820 | 813 | # define libnsl_hidden_proto(name, attrs...) |
| 821 | 814 | # define libnsl_hidden_tls_proto(name, attrs...) |
| 822 | # define libnsl_hidden_def(name) | |
| 823 | 815 | # define libnsl_hidden_weak(name) |
| 824 | 816 | # define libnsl_hidden_ver(local, name) |
| 825 | 817 | # define libnsl_hidden_data_def(name) |
| ... | ... | @@ -828,33 +820,12 @@ for linking") |
| 828 | 820 | # define libnsl_hidden_data_ver(local, name) |
| 829 | 821 | #endif |
| 830 | 822 | |
| 831 | #if IS_IN (libnss_nisplus) | |
| 832 | # define libnss_nisplus_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) | |
| 833 | # define libnss_nisplus_hidden_tls_proto(name, attrs...) \ | |
| 834 | hidden_tls_proto (name, ##attrs) | |
| 835 | # define libnss_nisplus_hidden_def(name) hidden_def (name) | |
| 836 | # define libnss_nisplus_hidden_weak(name) hidden_weak (name) | |
| 837 | # define libnss_nisplus_hidden_ver(local, name) hidden_ver (local, name) | |
| 838 | # define libnss_nisplus_hidden_data_def(name) hidden_data_def (name) | |
| 839 | # define libnss_nisplus_hidden_tls_def(name) hidden_tls_def (name) | |
| 840 | # define libnss_nisplus_hidden_data_weak(name) hidden_data_weak (name) | |
| 841 | # define libnss_nisplus_hidden_data_ver(local, name) hidden_data_ver (local, name) | |
| 842 | #else | |
| 843 | # define libnss_nisplus_hidden_proto(name, attrs...) | |
| 844 | # define libnss_nisplus_hidden_tls_proto(name, attrs...) | |
| 845 | # define libnss_nisplus_hidden_def(name) | |
| 846 | # define libnss_nisplus_hidden_weak(name) | |
| 847 | # define libnss_nisplus_hidden_ver(local, name) | |
| 848 | # define libnss_nisplus_hidden_data_def(name) | |
| 849 | # define libnss_nisplus_hidden_tls_def(name) | |
| 850 | # define libnss_nisplus_hidden_data_weak(name) | |
| 851 | # define libnss_nisplus_hidden_data_ver(local, name) | |
| 852 | #endif | |
| 853 | ||
| 854 | 823 | #define libc_hidden_builtin_proto(name, attrs...) libc_hidden_proto (name, ##attrs) |
| 855 | 824 | #define libc_hidden_builtin_def(name) libc_hidden_def (name) |
| 856 | 825 | #define libc_hidden_builtin_weak(name) libc_hidden_weak (name) |
| 857 | 826 | #define libc_hidden_builtin_ver(local, name) libc_hidden_ver (local, name) |
| 827 | ||
| 828 | #define libc_hidden_ldbl_proto(name, attrs...) libc_hidden_proto (name, ##attrs) | |
| 858 | 829 | #ifdef __ASSEMBLER__ |
| 859 | 830 | # define HIDDEN_BUILTIN_JUMPTARGET(name) HIDDEN_JUMPTARGET(name) |
| 860 | 831 | #endif |
| ... | ... | @@ -882,6 +853,14 @@ for linking") |
| 882 | 853 | # define libutil_hidden_data_ver(local, name) |
| 883 | 854 | #endif |
| 884 | 855 | |
| 856 | #if IS_IN (libanl) | |
| 857 | # define libanl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) | |
| 858 | # define libanl_hidden_def(name) hidden_def (name) | |
| 859 | #else | |
| 860 | # define libanl_hidden_proto(name, attrs...) | |
| 861 | # define libanl_hidden_def(name) | |
| 862 | #endif | |
| 863 | ||
| 885 | 864 | /* Get some dirty hacks. */ |
| 886 | 865 | #include <symbol-hacks.h> |
| 887 | 866 |
lib/libc/glibc/include/pthread.h+11| ... | ... | @@ -8,9 +8,20 @@ extern int __pthread_barrier_init (pthread_barrier_t *__restrict __barrier, |
| 8 | 8 | 				 const pthread_barrierattr_t *__restrict |
| 9 | 9 | 				 __attr, unsigned int __count) |
| 10 | 10 | __THROW __nonnull ((1)); |
| 11 | #if PTHREAD_IN_LIBC | |
| 12 | libc_hidden_proto (__pthread_barrier_init) | |
| 13 | #endif | |
| 11 | 14 | extern int __pthread_barrier_wait (pthread_barrier_t *__barrier) |
| 12 | 15 | __THROWNL __nonnull ((1)); |
| 16 | #if PTHREAD_IN_LIBC | |
| 17 | libc_hidden_proto (__pthread_barrier_wait) | |
| 18 | #endif | |
| 13 | 19 | |
| 14 | 20 | /* This function is called to initialize the pthread library. */ |
| 15 | 21 | extern void __pthread_initialize (void) __attribute__ ((weak)); |
| 22 | ||
| 23 | extern int __pthread_kill (pthread_t threadid, int signo); | |
| 24 | ||
| 25 | extern pthread_t __pthread_self (void); | |
| 26 | ||
| 16 | 27 | #endif |
lib/libc/glibc/include/signal.h+15-2| ... | ... | @@ -2,6 +2,8 @@ |
| 2 | 2 | # include <signal/signal.h> |
| 3 | 3 | |
| 4 | 4 | # ifndef _ISOMAC |
| 5 | # include <sigsetops.h> | |
| 6 | ||
| 5 | 7 | libc_hidden_proto (sigemptyset) |
| 6 | 8 | libc_hidden_proto (sigfillset) |
| 7 | 9 | libc_hidden_proto (sigaddset) |
| ... | ... | @@ -12,7 +14,10 @@ libc_hidden_proto (__sigpause) |
| 12 | 14 | libc_hidden_proto (raise) |
| 13 | 15 | libc_hidden_proto (__libc_current_sigrtmin) |
| 14 | 16 | libc_hidden_proto (__libc_current_sigrtmax) |
| 15 | libc_hidden_proto (_sys_siglist) | |
| 17 | extern const char * const __sys_siglist[_NSIG]; | |
| 18 | libc_hidden_proto (__sys_siglist) | |
| 19 | extern const char * const __sys_sigabbrev[_NSIG]; | |
| 20 | libc_hidden_proto (__sys_sigabbrev) | |
| 16 | 21 | |
| 17 | 22 | /* Now define the internal interfaces. */ |
| 18 | 23 | extern __sighandler_t __bsd_signal (int __sig, __sighandler_t __handler); |
| ... | ... | @@ -33,6 +38,14 @@ extern int __sigwait (const sigset_t *__set, int *__sig); |
| 33 | 38 | libc_hidden_proto (__sigwait) |
| 34 | 39 | extern int __sigwaitinfo (const sigset_t *__set, siginfo_t *__info); |
| 35 | 40 | libc_hidden_proto (__sigwaitinfo) |
| 41 | #if __TIMESIZE == 64 | |
| 42 | # define __sigtimedwait64 __sigtimedwait | |
| 43 | #else | |
| 44 | # include <struct___timespec64.h> | |
| 45 | extern int __sigtimedwait64 (const sigset_t *__set, siginfo_t *__info, | |
| 46 | 			 const struct __timespec64 *__timeout); | |
| 47 | libc_hidden_proto (__sigtimedwait64) | |
| 48 | #endif | |
| 36 | 49 | extern int __sigtimedwait (const sigset_t *__set, siginfo_t *__info, |
| 37 | 50 | 			 const struct timespec *__timeout); |
| 38 | 51 | libc_hidden_proto (__sigtimedwait) |
| ... | ... | @@ -54,7 +67,7 @@ extern int __xpg_sigpause (int sig); |
| 54 | 67 | /* Allocate real-time signal with highest/lowest available priority. */ |
| 55 | 68 | extern int __libc_allocate_rtsig (int __high); |
| 56 | 69 | |
| 57 | # if IS_IN (rtld) && !defined NO_RTLD_HIDDEN | |
| 70 | # if IS_IN (rtld) | |
| 58 | 71 | extern __typeof (__sigaction) __sigaction attribute_hidden; |
| 59 | 72 | extern __typeof (__libc_sigaction) __libc_sigaction attribute_hidden; |
| 60 | 73 | # endif |
lib/libc/glibc/include/stap-probe.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Macros for defining Systemtap <sys/sdt.h> static probe points. |
| 2 | Copyright (C) 2012-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2012-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/include/stdc-predef.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1991-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1991-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/include/stdlib.h+20-5| ... | ... | @@ -3,12 +3,23 @@ |
| 3 | 3 | #ifndef _ISOMAC |
| 4 | 4 | # include <stddef.h> |
| 5 | 5 | #endif |
| 6 | ||
| 7 | /* Workaround PR90731 with GCC 9 when using ldbl redirects in C++. */ | |
| 8 | #include <bits/floatn.h> | |
| 9 | #if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 | |
| 10 | # if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3) | |
| 11 | # pragma GCC system_header | |
| 12 | # endif | |
| 13 | #endif | |
| 14 | ||
| 6 | 15 | #include <stdlib/stdlib.h> |
| 7 | 16 | |
| 8 | 17 | /* Now define the internal interfaces. */ |
| 9 | 18 | #if !defined _ISOMAC |
| 10 | 19 | # include <sys/stat.h> |
| 11 | 20 | |
| 21 | # include <rtld-malloc.h> | |
| 22 | ||
| 12 | 23 | extern __typeof (strtol_l) __strtol_l; |
| 13 | 24 | extern __typeof (strtoul_l) __strtoul_l; |
| 14 | 25 | extern __typeof (strtoll_l) __strtoll_l; |
| ... | ... | @@ -80,6 +91,7 @@ extern int __setenv (const char *__name, const char *__value, int __replace) |
| 80 | 91 | extern int __unsetenv (const char *__name) attribute_hidden; |
| 81 | 92 | extern int __clearenv (void) attribute_hidden; |
| 82 | 93 | extern char *__mktemp (char *__template) __THROW __nonnull ((1)); |
| 94 | libc_hidden_proto (__mktemp) | |
| 83 | 95 | extern char *__canonicalize_file_name (const char *__name); |
| 84 | 96 | extern char *__realpath (const char *__name, char *__resolved); |
| 85 | 97 | libc_hidden_proto (__realpath) |
| ... | ... | @@ -125,6 +137,12 @@ libc_hidden_proto (__libc_reallocarray) |
| 125 | 137 | |
| 126 | 138 | extern int __libc_system (const char *line); |
| 127 | 139 | |
| 140 | extern __typeof (getpt) __getpt; | |
| 141 | extern __typeof (ptsname_r) __ptsname_r; | |
| 142 | libc_hidden_proto (__getpt) | |
| 143 | libc_hidden_proto (__ptsname_r) | |
| 144 | libc_hidden_proto (grantpt) | |
| 145 | libc_hidden_proto (unlockpt) | |
| 128 | 146 | |
| 129 | 147 | extern double __strtod_internal (const char *__restrict __nptr, |
| 130 | 148 | 				 char **__restrict __endptr, int __group) |
| ... | ... | @@ -205,7 +223,7 @@ libc_hidden_proto (____strtoull_l_internal) |
| 205 | 223 | #include <bits/floatn.h> |
| 206 | 224 | libc_hidden_proto (strtof) |
| 207 | 225 | libc_hidden_proto (strtod) |
| 208 | #if __LONG_DOUBLE_USES_FLOAT128 == 0 | |
| 226 | #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0 | |
| 209 | 227 | libc_hidden_proto (strtold) |
| 210 | 228 | #endif |
| 211 | 229 | libc_hidden_proto (strtol) |
| ... | ... | @@ -288,9 +306,6 @@ libc_hidden_proto (__qfcvt_r) |
| 288 | 306 | # define MB_CUR_MAX (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MB_CUR_MAX)) |
| 289 | 307 | # endif |
| 290 | 308 | |
| 291 | extern void *__default_morecore (ptrdiff_t) __THROW; | |
| 292 | libc_hidden_proto (__default_morecore) | |
| 293 | ||
| 294 | 309 | struct abort_msg_s |
| 295 | 310 | { |
| 296 | 311 | unsigned int size; |
| ... | ... | @@ -299,7 +314,7 @@ struct abort_msg_s |
| 299 | 314 | extern struct abort_msg_s *__abort_msg; |
| 300 | 315 | libc_hidden_proto (__abort_msg) |
| 301 | 316 | |
| 302 | # if IS_IN (rtld) && !defined NO_RTLD_HIDDEN | |
| 317 | # if IS_IN (rtld) | |
| 303 | 318 | extern __typeof (unsetenv) unsetenv attribute_hidden; |
| 304 | 319 | extern __typeof (__strtoul_internal) __strtoul_internal attribute_hidden; |
| 305 | 320 | # endif |
lib/libc/glibc/include/struct___timespec64.h created+27| ... | ... | @@ -0,0 +1,27 @@ |
| 1 | #ifndef _STRUCT_TIMESPEC64_H | |
| 2 | #define _STRUCT_TIMESPEC64_H | |
| 3 | ||
| 4 | #if __TIMESIZE == 64 | |
| 5 | # define __timespec64 timespec | |
| 6 | #else | |
| 7 | #include <endian.h> | |
| 8 | /* The glibc Y2038-proof struct __timespec64 structure for a time value. | |
| 9 | To keep things Posix-ish, we keep the nanoseconds field a 32-bit | |
| 10 | signed long, but since the Linux field is a 64-bit signed int, we | |
| 11 | pad our tv_nsec with a 32-bit unnamed bit-field padding. | |
| 12 | ||
| 13 | As a general rule the Linux kernel is ignoring upper 32 bits of | |
| 14 | tv_nsec field. */ | |
| 15 | struct __timespec64 | |
| 16 | { | |
| 17 | __time64_t tv_sec; /* Seconds */ | |
| 18 | # if BYTE_ORDER == BIG_ENDIAN | |
| 19 | __int32_t :32; /* Padding */ | |
| 20 | __int32_t tv_nsec; /* Nanoseconds */ | |
| 21 | # else | |
| 22 | __int32_t tv_nsec; /* Nanoseconds */ | |
| 23 | __int32_t :32; /* Padding */ | |
| 24 | # endif | |
| 25 | }; | |
| 26 | #endif | |
| 27 | #endif /* _STRUCT_TIMESPEC64_H */ |
lib/libc/glibc/include/struct___timeval64.h created+17| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | #ifndef _STRUCT_TIMEVAL64_H | |
| 2 | #define _STRUCT_TIMEVAL64_H | |
| 3 | ||
| 4 | #if __TIMESIZE == 64 | |
| 5 | # define __timeval64 timeval | |
| 6 | #else | |
| 7 | /* The glibc Y2038-proof struct __timeval64 structure for a time value. | |
| 8 | This structure is NOT supposed to be passed to the Linux kernel. | |
| 9 | Instead, it shall be converted to struct __timespec64 and time shall | |
| 10 | be [sg]et via clock_[sg]ettime (which are now Y2038 safe). */ | |
| 11 | struct __timeval64 | |
| 12 | { | |
| 13 | __time64_t tv_sec; /* Seconds */ | |
| 14 | __suseconds64_t tv_usec; /* Microseconds */ | |
| 15 | }; | |
| 16 | #endif | |
| 17 | #endif /* _STRUCT_TIMEVAL64_H */ |
lib/libc/glibc/include/sys/cdefs.h+20| ... | ... | @@ -13,6 +13,26 @@ extern void __chk_fail (void) __attribute__ ((__noreturn__)); |
| 13 | 13 | libc_hidden_proto (__chk_fail) |
| 14 | 14 | rtld_hidden_proto (__chk_fail) |
| 15 | 15 | |
| 16 | /* If we are using redirects internally to support long double, | |
| 17 | we need to tweak some macros to ensure the PLT bypass tricks | |
| 18 | continue to work in libc. */ | |
| 19 | #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc) && defined SHARED | |
| 20 | ||
| 21 | # undef __LDBL_REDIR_DECL | |
| 22 | # define __LDBL_REDIR_DECL(func) \ | |
| 23 | extern __typeof(func) func __asm (__ASMNAME ("__GI____ieee128_" #func)); | |
| 24 | ||
| 25 | # undef libc_hidden_ldbl_proto | |
| 26 | # define libc_hidden_ldbl_proto(func, attrs...) \ | |
| 27 | extern __typeof(func) ___ieee128_ ## func; \ | |
| 28 | libc_hidden_proto (___ieee128_ ## func, ##attrs); | |
| 29 | ||
| 30 | # undef __LDBL_REDIR2_DECL | |
| 31 | # define __LDBL_REDIR2_DECL(func) \ | |
| 32 | extern __typeof(__ ## func) __ ## func __asm (__ASMNAME ("__GI____ieee128___" #func)); | |
| 33 | ||
| 16 | 34 | #endif |
| 17 | 35 | |
| 36 | #endif /* !defined _ISOMAC */ | |
| 37 | ||
| 18 | 38 | #endif |
lib/libc/glibc/include/sys/select.h+29| ... | ... | @@ -3,6 +3,35 @@ |
| 3 | 3 | |
| 4 | 4 | #ifndef _ISOMAC |
| 5 | 5 | /* Now define the internal interfaces. */ |
| 6 | # if __TIMESIZE == 64 | |
| 7 | # define __pselect64 __pselect | |
| 8 | # define __select64 __select | |
| 9 | #else | |
| 10 | # include <struct___timespec64.h> | |
| 11 | # include <struct___timeval64.h> | |
| 12 | ||
| 13 | extern int __pselect64 (int __nfds, fd_set *__readfds, | |
| 14 | 			fd_set *__writefds, fd_set *__exceptfds, | |
| 15 | 			const struct __timespec64 *__timeout, | |
| 16 | 			const __sigset_t *__sigmask); | |
| 17 | libc_hidden_proto (__pselect64) | |
| 18 | ||
| 19 | extern int __pselect32 (int __nfds, fd_set *__readfds, | |
| 20 | 			fd_set *__writefds, fd_set *__exceptfds, | |
| 21 | 			const struct __timespec64 *__timeout, | |
| 22 | 			const __sigset_t *__sigmask) | |
| 23 | attribute_hidden; | |
| 24 | extern int __select32 (int __nfds, fd_set *__readfds, | |
| 25 | 		 fd_set *__writefds, fd_set *__exceptfds, | |
| 26 | 		 const struct __timespec64 *ts64, | |
| 27 | 		 struct __timeval64 *timeout) | |
| 28 | attribute_hidden; | |
| 29 | ||
| 30 | extern int __select64 (int __nfds, fd_set *__readfds, | |
| 31 | 		 fd_set *__writefds, fd_set *__exceptfds, | |
| 32 | 		 struct __timeval64 *__timeout); | |
| 33 | libc_hidden_proto (__select64) | |
| 34 | #endif | |
| 6 | 35 | extern int __pselect (int __nfds, fd_set *__readfds, |
| 7 | 36 | 		 fd_set *__writefds, fd_set *__exceptfds, |
| 8 | 37 | 		 const struct timespec *__timeout, |
lib/libc/glibc/include/sys/stat.h+77-43| ... | ... | @@ -2,63 +2,97 @@ |
| 2 | 2 | #include <io/sys/stat.h> |
| 3 | 3 | |
| 4 | 4 | #ifndef _ISOMAC |
| 5 | # include <xstatver.h> | |
| 6 | # include <struct___timespec64.h> | |
| 7 | # include <struct_stat_time64.h> | |
| 8 | # include <stdbool.h> | |
| 9 | ||
| 10 | static inline bool | |
| 11 | in_ino_t_range (__ino64_t v) | |
| 12 | { | |
| 13 | __ino_t s = v; | |
| 14 | return s == v; | |
| 15 | } | |
| 16 | ||
| 17 | static inline bool | |
| 18 | in_off_t_range (__off64_t v) | |
| 19 | { | |
| 20 | __off_t s = v; | |
| 21 | return s == v; | |
| 22 | } | |
| 23 | ||
| 24 | static inline bool | |
| 25 | in_blkcnt_t_range (__blkcnt64_t v) | |
| 26 | { | |
| 27 | __blkcnt_t s = v; | |
| 28 | return s == v; | |
| 29 | } | |
| 30 | ||
| 5 | 31 | /* Now define the internal interfaces. */ |
| 6 | 32 | extern int __stat (const char *__file, struct stat *__buf); |
| 33 | extern int __stat64 (const char *__file, struct stat64 *__buf); | |
| 7 | 34 | extern int __fstat (int __fd, struct stat *__buf); |
| 35 | extern int __fstat64 (int __fd, struct stat64 *__buf); | |
| 8 | 36 | extern int __lstat (const char *__file, struct stat *__buf); |
| 37 | extern int __lstat64 (const char *__file, struct stat64 *__buf); | |
| 38 | extern int __fstatat (int dirfd, const char *pathname, struct stat *buf, | |
| 39 | 		 int flags); | |
| 40 | extern int __fstatat64 (int dirfd, const char *pathname, struct stat64 *buf, | |
| 41 | 			int flags); | |
| 42 | # if IS_IN (libc) || (IS_IN (rtld) && !defined NO_RTLD_HIDDEN) | |
| 43 | hidden_proto (__stat64) | |
| 44 | hidden_proto (__fstat64) | |
| 45 | hidden_proto (__lstat64) | |
| 46 | hidden_proto (__fstatat64) | |
| 47 | # endif | |
| 48 | ||
| 49 | # if __TIMESIZE == 64 || defined NO_RTLD_HIDDEN | |
| 50 | # define __stat64_time64 __stat64 | |
| 51 | # define __fstat64_time64 __fstat64 | |
| 52 | # define __lstat64_time64 __lstat64 | |
| 53 | # define __fstatat64_time64 __fstatat64 | |
| 54 | # else | |
| 55 | extern int __stat64_time64 (const char *file, struct __stat64_t64 *buf); | |
| 56 | hidden_proto (__stat64_time64); | |
| 57 | extern int __lstat64_time64 (const char *file, struct __stat64_t64 *buf); | |
| 58 | hidden_proto (__lstat64_time64); | |
| 59 | extern int __fstat64_time64 (int fd, struct __stat64_t64 *buf); | |
| 60 | hidden_proto (__fstat64_time64); | |
| 61 | extern int __fstatat64_time64 (int dirfd, const char *pathname, | |
| 62 | 			 struct __stat64_t64 *buf, int flags); | |
| 63 | hidden_proto (__fstatat64_time64); | |
| 64 | # endif | |
| 65 | ||
| 9 | 66 | extern int __chmod (const char *__file, __mode_t __mode); |
| 10 | 67 | libc_hidden_proto (__chmod) |
| 11 | 68 | extern int __fchmod (int __fd, __mode_t __mode); |
| 69 | libc_hidden_proto (fchmodat) | |
| 12 | 70 | extern __mode_t __umask (__mode_t __mask); |
| 13 | 71 | extern int __mkdir (const char *__path, __mode_t __mode); |
| 14 | 72 | libc_hidden_proto (__mkdir) |
| 73 | ||
| 74 | extern int __mknodat (int fd, const char *path, mode_t mode, dev_t dev); | |
| 75 | libc_hidden_proto (__mknodat); | |
| 15 | 76 | extern int __mknod (const char *__path, |
| 16 | 77 | 		 __mode_t __mode, __dev_t __dev); |
| 17 | #if IS_IN (libc) || (IS_IN (rtld) && !defined NO_RTLD_HIDDEN) | |
| 18 | hidden_proto (__fxstat) | |
| 19 | hidden_proto (__fxstat64) | |
| 20 | hidden_proto (__lxstat) | |
| 21 | hidden_proto (__lxstat64) | |
| 22 | hidden_proto (__xstat) | |
| 23 | hidden_proto (__xstat64) | |
| 24 | #endif | |
| 25 | extern __inline__ int __stat (const char *__path, struct stat *__statbuf) | |
| 26 | { | |
| 27 | return __xstat (_STAT_VER, __path, __statbuf); | |
| 28 | } | |
| 29 | libc_hidden_proto (__xmknod) | |
| 30 | extern __inline__ int __mknod (const char *__path, __mode_t __mode, | |
| 31 | 			 __dev_t __dev) | |
| 32 | { | |
| 33 | return __xmknod (_MKNOD_VER, __path, __mode, &__dev); | |
| 34 | } | |
| 35 | libc_hidden_proto (__xmknodat) | |
| 78 | libc_hidden_proto (__mknod); | |
| 36 | 79 | |
| 37 | libc_hidden_proto (__fxstatat) | |
| 38 | libc_hidden_proto (__fxstatat64) | |
| 80 | extern int __xmknod (int __ver, const char *__path, __mode_t __mode, | |
| 81 | 		 __dev_t *__dev); | |
| 82 | extern int __xmknodat (int __ver, int __fd, const char *__path, | |
| 83 | 		 __mode_t __mode, __dev_t *__dev); | |
| 39 | 84 | |
| 40 | # if IS_IN (rtld) && !defined NO_RTLD_HIDDEN | |
| 41 | extern __typeof (__fxstatat64) __fxstatat64 attribute_hidden; | |
| 42 | # endif | |
| 85 | int __fxstat (int __ver, int __fildes, struct stat *__stat_buf); | |
| 86 | int __xstat (int __ver, const char *__filename, | |
| 87 | 	 struct stat *__stat_buf); | |
| 88 | int __lxstat (int __ver, const char *__filename, struct stat *__stat_buf); | |
| 89 | int __fxstatat (int __ver, int __fildes, const char *__filename, | |
| 90 | 		struct stat *__stat_buf, int __flag); | |
| 91 | int __fxstat64 (int ver, int __fildes, struct stat64 *__stat_buf); | |
| 92 | int __xstat64 (int ver, const char *__filename, struct stat64 *__stat_buf); | |
| 93 | int __lxstat64 (int ver, const char *__filename, struct stat64 *__stat_buf); | |
| 94 | int __fxstatat64 (int ver, int __fildes, const char *__filename, | |
| 95 | 		 struct stat64 *__stat_buf, int __flag); | |
| 43 | 96 | |
| 44 | /* The `stat', `fstat', `lstat' functions have to be handled special since | |
| 45 | even while not compiling the library with optimization calls to these | |
| 46 | functions in the shared library must reference the `xstat' etc functions. | |
| 47 | We have to use macros but we cannot define them in the normal headers | |
| 48 | since on user level we must use real functions. */ | |
| 49 | #define stat(fname, buf) __xstat (_STAT_VER, fname, buf) | |
| 50 | #define lstat(fname, buf) __lxstat (_STAT_VER, fname, buf) | |
| 51 | #define __lstat(fname, buf) __lxstat (_STAT_VER, fname, buf) | |
| 52 | #define lstat64(fname, buf) __lxstat64 (_STAT_VER, fname, buf) | |
| 53 | #define __lstat64(fname, buf) __lxstat64 (_STAT_VER, fname, buf) | |
| 54 | #define stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf) | |
| 55 | #define fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf) | |
| 56 | #define __fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf) | |
| 57 | #define fstat(fd, buf) __fxstat (_STAT_VER, fd, buf) | |
| 58 | #define __fstat(fd, buf) __fxstat (_STAT_VER, fd, buf) | |
| 59 | #define __fstatat(dfd, fname, buf, flag) \ | |
| 60 | __fxstatat (_STAT_VER, dfd, fname, buf, flag) | |
| 61 | #define __fstatat64(dfd, fname, buf, flag) \ | |
| 62 | __fxstatat64 (_STAT_VER, dfd, fname, buf, flag) | |
| 63 | 97 | #endif |
| 64 | 98 | #endif |
lib/libc/glibc/io/bits/statx.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* statx-related definitions and declarations. Generic version. |
| 2 | Copyright (C) 2018-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2018-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/io/fcntl.h created+347| ... | ... | @@ -0,0 +1,347 @@ |
| 1 | /* Copyright (C) 1991-2021 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library; if not, see | |
| 16 | <https://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | /* | |
| 19 | *	POSIX Standard: 6.5 File Control Operations	<fcntl.h> | |
| 20 | */ | |
| 21 | ||
| 22 | #ifndef	_FCNTL_H | |
| 23 | #define	_FCNTL_H	1 | |
| 24 | ||
| 25 | #include <features.h> | |
| 26 | ||
| 27 | /* This must be early so <bits/fcntl.h> can define types winningly. */ | |
| 28 | __BEGIN_DECLS | |
| 29 | ||
| 30 | /* Get __mode_t, __dev_t and __off_t .*/ | |
| 31 | #include <bits/types.h> | |
| 32 | ||
| 33 | /* Get the definitions of O_*, F_*, FD_*: all the | |
| 34 | numbers and flag bits for `open', `fcntl', et al. */ | |
| 35 | #include <bits/fcntl.h> | |
| 36 | ||
| 37 | /* Detect if open needs mode as a third argument (or for openat as a fourth | |
| 38 | argument). */ | |
| 39 | #ifdef __O_TMPFILE | |
| 40 | # define __OPEN_NEEDS_MODE(oflag) \ | |
| 41 | (((oflag) & O_CREAT) != 0 || ((oflag) & __O_TMPFILE) == __O_TMPFILE) | |
| 42 | #else | |
| 43 | # define __OPEN_NEEDS_MODE(oflag) (((oflag) & O_CREAT) != 0) | |
| 44 | #endif | |
| 45 | ||
| 46 | /* POSIX.1-2001 specifies that these types are defined by <fcntl.h>. | |
| 47 | Earlier POSIX standards permitted any type ending in `_t' to be defined | |
| 48 | by any POSIX header, so we don't conditionalize the definitions here. */ | |
| 49 | #ifndef __mode_t_defined | |
| 50 | typedef __mode_t mode_t; | |
| 51 | # define __mode_t_defined | |
| 52 | #endif | |
| 53 | ||
| 54 | #ifndef __off_t_defined | |
| 55 | # ifndef __USE_FILE_OFFSET64 | |
| 56 | typedef __off_t off_t; | |
| 57 | # else | |
| 58 | typedef __off64_t off_t; | |
| 59 | # endif | |
| 60 | # define __off_t_defined | |
| 61 | #endif | |
| 62 | ||
| 63 | #if defined __USE_LARGEFILE64 && !defined __off64_t_defined | |
| 64 | typedef __off64_t off64_t; | |
| 65 | # define __off64_t_defined | |
| 66 | #endif | |
| 67 | ||
| 68 | #ifndef __pid_t_defined | |
| 69 | typedef __pid_t pid_t; | |
| 70 | # define __pid_t_defined | |
| 71 | #endif | |
| 72 | ||
| 73 | /* For XPG all symbols from <sys/stat.h> should also be available. */ | |
| 74 | #ifdef __USE_XOPEN2K8 | |
| 75 | # include <bits/types/struct_timespec.h> | |
| 76 | #endif | |
| 77 | #if defined __USE_XOPEN || defined __USE_XOPEN2K8 | |
| 78 | # include <bits/stat.h> | |
| 79 | ||
| 80 | # define S_IFMT		__S_IFMT | |
| 81 | # define S_IFDIR	__S_IFDIR | |
| 82 | # define S_IFCHR	__S_IFCHR | |
| 83 | # define S_IFBLK	__S_IFBLK | |
| 84 | # define S_IFREG	__S_IFREG | |
| 85 | # ifdef __S_IFIFO | |
| 86 | # define S_IFIFO	__S_IFIFO | |
| 87 | # endif | |
| 88 | # ifdef __S_IFLNK | |
| 89 | # define S_IFLNK	__S_IFLNK | |
| 90 | # endif | |
| 91 | # if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) && defined __S_IFSOCK | |
| 92 | # define S_IFSOCK	__S_IFSOCK | |
| 93 | # endif | |
| 94 | ||
| 95 | /* Protection bits. */ | |
| 96 | ||
| 97 | # define S_ISUID	__S_ISUID /* Set user ID on execution. */ | |
| 98 | # define S_ISGID	__S_ISGID /* Set group ID on execution. */ | |
| 99 | ||
| 100 | # if defined __USE_MISC || defined __USE_XOPEN | |
| 101 | /* Save swapped text after use (sticky bit). This is pretty well obsolete. */ | |
| 102 | # define S_ISVTX	__S_ISVTX | |
| 103 | # endif | |
| 104 | ||
| 105 | # define S_IRUSR	__S_IREAD /* Read by owner. */ | |
| 106 | # define S_IWUSR	__S_IWRITE /* Write by owner. */ | |
| 107 | # define S_IXUSR	__S_IEXEC /* Execute by owner. */ | |
| 108 | /* Read, write, and execute by owner. */ | |
| 109 | # define S_IRWXU	(__S_IREAD|__S_IWRITE|__S_IEXEC) | |
| 110 | ||
| 111 | # define S_IRGRP	(S_IRUSR >> 3) /* Read by group. */ | |
| 112 | # define S_IWGRP	(S_IWUSR >> 3) /* Write by group. */ | |
| 113 | # define S_IXGRP	(S_IXUSR >> 3) /* Execute by group. */ | |
| 114 | /* Read, write, and execute by group. */ | |
| 115 | # define S_IRWXG	(S_IRWXU >> 3) | |
| 116 | ||
| 117 | # define S_IROTH	(S_IRGRP >> 3) /* Read by others. */ | |
| 118 | # define S_IWOTH	(S_IWGRP >> 3) /* Write by others. */ | |
| 119 | # define S_IXOTH	(S_IXGRP >> 3) /* Execute by others. */ | |
| 120 | /* Read, write, and execute by others. */ | |
| 121 | # define S_IRWXO	(S_IRWXG >> 3) | |
| 122 | #endif | |
| 123 | ||
| 124 | #ifdef	__USE_MISC | |
| 125 | # ifndef R_OK			/* Verbatim from <unistd.h>. Ugh. */ | |
| 126 | /* Values for the second argument to access. | |
| 127 | These may be OR'd together. */ | |
| 128 | # define R_OK	4		/* Test for read permission. */ | |
| 129 | # define W_OK	2		/* Test for write permission. */ | |
| 130 | # define X_OK	1		/* Test for execute permission. */ | |
| 131 | # define F_OK	0		/* Test for existence. */ | |
| 132 | # endif | |
| 133 | #endif /* Use misc. */ | |
| 134 | ||
| 135 | /* XPG wants the following symbols. <stdio.h> has the same definitions. */ | |
| 136 | #if defined __USE_XOPEN || defined __USE_XOPEN2K8 | |
| 137 | # define SEEK_SET	0	/* Seek from beginning of file. */ | |
| 138 | # define SEEK_CUR	1	/* Seek from current position. */ | |
| 139 | # define SEEK_END	2	/* Seek from end of file. */ | |
| 140 | #endif	/* XPG */ | |
| 141 | ||
| 142 | /* The constants AT_REMOVEDIR and AT_EACCESS have the same value. AT_EACCESS | |
| 143 | is meaningful only to faccessat, while AT_REMOVEDIR is meaningful only to | |
| 144 | unlinkat. The two functions do completely different things and therefore, | |
| 145 | the flags can be allowed to overlap. For example, passing AT_REMOVEDIR to | |
| 146 | faccessat would be undefined behavior and thus treating it equivalent to | |
| 147 | AT_EACCESS is valid undefined behavior. */ | |
| 148 | #ifdef __USE_ATFILE | |
| 149 | # define AT_FDCWD		-100	/* Special value used to indicate | |
| 150 | 					 the *at functions should use the | |
| 151 | 					 current working directory. */ | |
| 152 | # define AT_SYMLINK_NOFOLLOW	0x100	/* Do not follow symbolic links. */ | |
| 153 | # define AT_REMOVEDIR		0x200	/* Remove directory instead of | |
| 154 | 					 unlinking file. */ | |
| 155 | # define AT_SYMLINK_FOLLOW	0x400	/* Follow symbolic links. */ | |
| 156 | # ifdef __USE_GNU | |
| 157 | # define AT_NO_AUTOMOUNT	0x800	/* Suppress terminal automount | |
| 158 | 					 traversal. */ | |
| 159 | # define AT_EMPTY_PATH		0x1000	/* Allow empty relative pathname. */ | |
| 160 | # define AT_STATX_SYNC_TYPE	0x6000 | |
| 161 | # define AT_STATX_SYNC_AS_STAT	0x0000 | |
| 162 | # define AT_STATX_FORCE_SYNC	0x2000 | |
| 163 | # define AT_STATX_DONT_SYNC	0x4000 | |
| 164 | # define AT_RECURSIVE		0x8000	/* Apply to the entire subtree. */ | |
| 165 | # endif | |
| 166 | # define AT_EACCESS		0x200	/* Test access permitted for | |
| 167 | 					 effective IDs, not real IDs. */ | |
| 168 | #endif | |
| 169 | ||
| 170 | /* Do the file control operation described by CMD on FD. | |
| 171 | The remaining arguments are interpreted depending on CMD. | |
| 172 | ||
| 173 | This function is a cancellation point and therefore not marked with | |
| 174 | __THROW. */ | |
| 175 | #ifndef __USE_TIME_BITS64 | |
| 176 | # ifndef __USE_FILE_OFFSET64 | |
| 177 | extern int fcntl (int __fd, int __cmd, ...); | |
| 178 | # else | |
| 179 | # ifdef __REDIRECT | |
| 180 | extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64); | |
| 181 | # else | |
| 182 | # define fcntl fcntl64 | |
| 183 | # endif | |
| 184 | # endif | |
| 185 | # ifdef __USE_LARGEFILE64 | |
| 186 | extern int fcntl64 (int __fd, int __cmd, ...); | |
| 187 | # endif | |
| 188 | #else /* __USE_TIME_BITS64 */ | |
| 189 | # ifdef __REDIRECT | |
| 190 | extern int __REDIRECT (fcntl, (int __fd, int __request, ...), | |
| 191 | 		 __fcntl_time64) __THROW; | |
| 192 | extern int __REDIRECT (fcntl64, (int __fd, int __request, ...), | |
| 193 | 		 __fcntl_time64) __THROW; | |
| 194 | # else | |
| 195 | extern int __fcntl_time64 (int __fd, int __request, ...) __THROW; | |
| 196 | # define fcntl64 __fcntl_time64 | |
| 197 | # define fcntl __fcntl_time64 | |
| 198 | # endif | |
| 199 | #endif | |
| 200 | ||
| 201 | /* Open FILE and return a new file descriptor for it, or -1 on error. | |
| 202 | OFLAG determines the type of access used. If O_CREAT or O_TMPFILE is set | |
| 203 | in OFLAG, the third argument is taken as a `mode_t', the mode of the | |
| 204 | created file. | |
| 205 | ||
| 206 | This function is a cancellation point and therefore not marked with | |
| 207 | __THROW. */ | |
| 208 | #ifndef __USE_FILE_OFFSET64 | |
| 209 | extern int open (const char *__file, int __oflag, ...) __nonnull ((1)); | |
| 210 | #else | |
| 211 | # ifdef __REDIRECT | |
| 212 | extern int __REDIRECT (open, (const char *__file, int __oflag, ...), open64) | |
| 213 | __nonnull ((1)); | |
| 214 | # else | |
| 215 | # define open open64 | |
| 216 | # endif | |
| 217 | #endif | |
| 218 | #ifdef __USE_LARGEFILE64 | |
| 219 | extern int open64 (const char *__file, int __oflag, ...) __nonnull ((1)); | |
| 220 | #endif | |
| 221 | ||
| 222 | #ifdef __USE_ATFILE | |
| 223 | /* Similar to `open' but a relative path name is interpreted relative to | |
| 224 | the directory for which FD is a descriptor. | |
| 225 | ||
| 226 | NOTE: some other `openat' implementation support additional functionality | |
| 227 | through this interface, especially using the O_XATTR flag. This is not | |
| 228 | yet supported here. | |
| 229 | ||
| 230 | This function is a cancellation point and therefore not marked with | |
| 231 | __THROW. */ | |
| 232 | # ifndef __USE_FILE_OFFSET64 | |
| 233 | extern int openat (int __fd, const char *__file, int __oflag, ...) | |
| 234 | __nonnull ((2)); | |
| 235 | # else | |
| 236 | # ifdef __REDIRECT | |
| 237 | extern int __REDIRECT (openat, (int __fd, const char *__file, int __oflag, | |
| 238 | 				...), openat64) __nonnull ((2)); | |
| 239 | # else | |
| 240 | # define openat openat64 | |
| 241 | # endif | |
| 242 | # endif | |
| 243 | # ifdef __USE_LARGEFILE64 | |
| 244 | extern int openat64 (int __fd, const char *__file, int __oflag, ...) | |
| 245 | __nonnull ((2)); | |
| 246 | # endif | |
| 247 | #endif | |
| 248 | ||
| 249 | /* Create and open FILE, with mode MODE. This takes an `int' MODE | |
| 250 | argument because that is what `mode_t' will be widened to. | |
| 251 | ||
| 252 | This function is a cancellation point and therefore not marked with | |
| 253 | __THROW. */ | |
| 254 | #ifndef __USE_FILE_OFFSET64 | |
| 255 | extern int creat (const char *__file, mode_t __mode) __nonnull ((1)); | |
| 256 | #else | |
| 257 | # ifdef __REDIRECT | |
| 258 | extern int __REDIRECT (creat, (const char *__file, mode_t __mode), | |
| 259 | 		 creat64) __nonnull ((1)); | |
| 260 | # else | |
| 261 | # define creat creat64 | |
| 262 | # endif | |
| 263 | #endif | |
| 264 | #ifdef __USE_LARGEFILE64 | |
| 265 | extern int creat64 (const char *__file, mode_t __mode) __nonnull ((1)); | |
| 266 | #endif | |
| 267 | ||
| 268 | #if !defined F_LOCK && (defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \ | |
| 269 | 					 && !defined __USE_POSIX)) | |
| 270 | /* NOTE: These declarations also appear in <unistd.h>; be sure to keep both | |
| 271 | files consistent. Some systems have them there and some here, and some | |
| 272 | software depends on the macros being defined without including both. */ | |
| 273 | ||
| 274 | /* `lockf' is a simpler interface to the locking facilities of `fcntl'. | |
| 275 | LEN is always relative to the current file position. | |
| 276 | The CMD argument is one of the following. */ | |
| 277 | ||
| 278 | # define F_ULOCK 0	/* Unlock a previously locked region. */ | |
| 279 | # define F_LOCK 1	/* Lock a region for exclusive use. */ | |
| 280 | # define F_TLOCK 2	/* Test and lock a region for exclusive use. */ | |
| 281 | # define F_TEST 3	/* Test a region for other processes locks. */ | |
| 282 | ||
| 283 | # ifndef __USE_FILE_OFFSET64 | |
| 284 | extern int lockf (int __fd, int __cmd, off_t __len); | |
| 285 | # else | |
| 286 | # ifdef __REDIRECT | |
| 287 | extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len), lockf64); | |
| 288 | # else | |
| 289 | # define lockf lockf64 | |
| 290 | # endif | |
| 291 | # endif | |
| 292 | # ifdef __USE_LARGEFILE64 | |
| 293 | extern int lockf64 (int __fd, int __cmd, off64_t __len); | |
| 294 | # endif | |
| 295 | #endif | |
| 296 | ||
| 297 | #ifdef __USE_XOPEN2K | |
| 298 | /* Advice the system about the expected behaviour of the application with | |
| 299 | respect to the file associated with FD. */ | |
| 300 | # ifndef __USE_FILE_OFFSET64 | |
| 301 | extern int posix_fadvise (int __fd, off_t __offset, off_t __len, | |
| 302 | 			 int __advise) __THROW; | |
| 303 | # else | |
| 304 | # ifdef __REDIRECT_NTH | |
| 305 | extern int __REDIRECT_NTH (posix_fadvise, (int __fd, __off64_t __offset, | |
| 306 | 					 __off64_t __len, int __advise), | |
| 307 | 			 posix_fadvise64); | |
| 308 | # else | |
| 309 | # define posix_fadvise posix_fadvise64 | |
| 310 | # endif | |
| 311 | # endif | |
| 312 | # ifdef __USE_LARGEFILE64 | |
| 313 | extern int posix_fadvise64 (int __fd, off64_t __offset, off64_t __len, | |
| 314 | 			 int __advise) __THROW; | |
| 315 | # endif | |
| 316 | ||
| 317 | ||
| 318 | /* Reserve storage for the data of the file associated with FD. | |
| 319 | ||
| 320 | This function is a possible cancellation point and therefore not | |
| 321 | marked with __THROW. */ | |
| 322 | # ifndef __USE_FILE_OFFSET64 | |
| 323 | extern int posix_fallocate (int __fd, off_t __offset, off_t __len); | |
| 324 | # else | |
| 325 | # ifdef __REDIRECT | |
| 326 | extern int __REDIRECT (posix_fallocate, (int __fd, __off64_t __offset, | |
| 327 | 					 __off64_t __len), | |
| 328 | 		 posix_fallocate64); | |
| 329 | # else | |
| 330 | # define posix_fallocate posix_fallocate64 | |
| 331 | # endif | |
| 332 | # endif | |
| 333 | # ifdef __USE_LARGEFILE64 | |
| 334 | extern int posix_fallocate64 (int __fd, off64_t __offset, off64_t __len); | |
| 335 | # endif | |
| 336 | #endif | |
| 337 | ||
| 338 | ||
| 339 | /* Define some inlines helping to catch common problems. */ | |
| 340 | #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \ | |
| 341 | && defined __va_arg_pack_len | |
| 342 | # include <bits/fcntl2.h> | |
| 343 | #endif | |
| 344 | ||
| 345 | __END_DECLS | |
| 346 | ||
| 347 | #endif /* fcntl.h */ |
lib/libc/glibc/io/fstat.c+10-32| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1996-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1996-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -6,23 +6,6 @@ |
| 6 | 6 | License as published by the Free Software Foundation; either |
| 7 | 7 | version 2.1 of the License, or (at your option) any later version. |
| 8 | 8 | |
| 9 | In addition to the permissions in the GNU Lesser General Public | |
| 10 | License, the Free Software Foundation gives you unlimited | |
| 11 | permission to link the compiled version of this file with other | |
| 12 | programs, and to distribute those programs without any restriction | |
| 13 | coming from the use of this file. (The GNU Lesser General Public | |
| 14 | License restrictions do apply in other respects; for example, they | |
| 15 | cover modification of the file, and distribution when not linked | |
| 16 | into another program.) | |
| 17 | ||
| 18 | Note that people who make modified versions of this file are not | |
| 19 | obligated to grant this special exception for their modified | |
| 20 | versions; it is their choice whether to do so. The GNU Lesser | |
| 21 | General Public License gives permission to release a modified | |
| 22 | version without this exception; this exception also makes it | |
| 23 | possible to release a modified version which carries forward this | |
| 24 | exception. | |
| 25 | ||
| 26 | 9 | The GNU C Library is distributed in the hope that it will be useful, |
| 27 | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 28 | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| ... | ... | @@ -33,23 +16,18 @@ |
| 33 | 16 | <https://www.gnu.org/licenses/>. */ |
| 34 | 17 | |
| 35 | 18 | #include <sys/stat.h> |
| 19 | #include <errno.h> | |
| 20 | #include <fcntl.h> | |
| 36 | 21 | |
| 37 | /* This definition is only used if inlining fails for this function; see | |
| 38 | the last page of <sys/stat.h>. The real work is done by the `x' | |
| 39 | function which is passed a version number argument. We arrange in the | |
| 40 | makefile that when not inlined this function is always statically | |
| 41 | linked; that way a dynamically-linked executable always encodes the | |
| 42 | version number corresponding to the data structures it uses, so the `x' | |
| 43 | functions in the shared library can adapt without needing to recompile | |
| 44 | all callers. */ | |
| 45 | ||
| 46 | #undef fstat | |
| 47 | #undef __fstat | |
| 48 | 22 | int |
| 49 | attribute_hidden | |
| 50 | 23 | __fstat (int fd, struct stat *buf) |
| 51 | 24 | { |
| 52 | return __fxstat (_STAT_VER, fd, buf); | |
| 25 | if (fd < 0) | |
| 26 | { | |
| 27 | __set_errno (EBADF); | |
| 28 | return -1; | |
| 29 | } | |
| 30 | return __fstatat (fd, "", buf, AT_EMPTY_PATH); | |
| 53 | 31 | } |
| 54 | 32 | |
| 55 | weak_hidden_alias (__fstat, fstat) | |
| 33 | weak_alias (__fstat, fstat) |
lib/libc/glibc/io/fstat64.c+12-31| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1996-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1996-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -6,23 +6,6 @@ |
| 6 | 6 | License as published by the Free Software Foundation; either |
| 7 | 7 | version 2.1 of the License, or (at your option) any later version. |
| 8 | 8 | |
| 9 | In addition to the permissions in the GNU Lesser General Public | |
| 10 | License, the Free Software Foundation gives you unlimited | |
| 11 | permission to link the compiled version of this file with other | |
| 12 | programs, and to distribute those programs without any restriction | |
| 13 | coming from the use of this file. (The GNU Lesser General Public | |
| 14 | License restrictions do apply in other respects; for example, they | |
| 15 | cover modification of the file, and distribution when not linked | |
| 16 | into another program.) | |
| 17 | ||
| 18 | Note that people who make modified versions of this file are not | |
| 19 | obligated to grant this special exception for their modified | |
| 20 | versions; it is their choice whether to do so. The GNU Lesser | |
| 21 | General Public License gives permission to release a modified | |
| 22 | version without this exception; this exception also makes it | |
| 23 | possible to release a modified version which carries forward this | |
| 24 | exception. | |
| 25 | ||
| 26 | 9 | The GNU C Library is distributed in the hope that it will be useful, |
| 27 | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 28 | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| ... | ... | @@ -33,20 +16,18 @@ |
| 33 | 16 | <https://www.gnu.org/licenses/>. */ |
| 34 | 17 | |
| 35 | 18 | #include <sys/stat.h> |
| 19 | #include <errno.h> | |
| 20 | #include <fcntl.h> | |
| 36 | 21 | |
| 37 | /* This definition is only used if inlining fails for this function; see | |
| 38 | the last page of <sys/stat.h>. The real work is done by the `x' | |
| 39 | function which is passed a version number argument. We arrange in the | |
| 40 | makefile that when not inlined this function is always statically | |
| 41 | linked; that way a dynamically-linked executable always encodes the | |
| 42 | version number corresponding to the data structures it uses, so the `x' | |
| 43 | functions in the shared library can adapt without needing to recompile | |
| 44 | all callers. */ | |
| 45 | ||
| 46 | #undef fstat64 | |
| 47 | 22 | int |
| 48 | attribute_hidden | |
| 49 | fstat64 (int fd, struct stat64 *buf) | |
| 23 | __fstat64 (int fd, struct stat64 *buf) | |
| 50 | 24 | { |
| 51 | return __fxstat64 (_STAT_VER, fd, buf); | |
| 25 | if (fd < 0) | |
| 26 | { | |
| 27 | __set_errno (EBADF); | |
| 28 | return -1; | |
| 29 | } | |
| 30 | return __fstatat64 (fd, "", buf, AT_EMPTY_PATH); | |
| 52 | 31 | } |
| 32 | hidden_def (__fstat64) | |
| 33 | weak_alias (__fstat64, fstat64) |
lib/libc/glibc/io/fstatat.c+21-31| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 2005-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 2005-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -6,23 +6,6 @@ |
| 6 | 6 | License as published by the Free Software Foundation; either |
| 7 | 7 | version 2.1 of the License, or (at your option) any later version. |
| 8 | 8 | |
| 9 | In addition to the permissions in the GNU Lesser General Public | |
| 10 | License, the Free Software Foundation gives you unlimited | |
| 11 | permission to link the compiled version of this file with other | |
| 12 | programs, and to distribute those programs without any restriction | |
| 13 | coming from the use of this file. (The GNU Lesser General Public | |
| 14 | License restrictions do apply in other respects; for example, they | |
| 15 | cover modification of the file, and distribution when not linked | |
| 16 | into another program.) | |
| 17 | ||
| 18 | Note that people who make modified versions of this file are not | |
| 19 | obligated to grant this special exception for their modified | |
| 20 | versions; it is their choice whether to do so. The GNU Lesser | |
| 21 | General Public License gives permission to release a modified | |
| 22 | version without this exception; this exception also makes it | |
| 23 | possible to release a modified version which carries forward this | |
| 24 | exception. | |
| 25 | ||
| 26 | 9 | The GNU C Library is distributed in the hope that it will be useful, |
| 27 | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 28 | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| ... | ... | @@ -33,20 +16,27 @@ |
| 33 | 16 | <https://www.gnu.org/licenses/>. */ |
| 34 | 17 | |
| 35 | 18 | #include <sys/stat.h> |
| 19 | #include <errno.h> | |
| 20 | #include <fcntl.h> | |
| 36 | 21 | |
| 37 | /* This definition is only used if inlining fails for this function; see | |
| 38 | the last page of <sys/stat.h>. The real work is done by the `x' | |
| 39 | function which is passed a version number argument. We arrange in the | |
| 40 | makefile that when not inlined this function is always statically | |
| 41 | linked; that way a dynamically-linked executable always encodes the | |
| 42 | version number corresponding to the data structures it uses, so the `x' | |
| 43 | functions in the shared library can adapt without needing to recompile | |
| 44 | all callers. */ | |
| 45 | ||
| 46 | #undef fstatat | |
| 47 | 22 | int |
| 48 | attribute_hidden | |
| 49 | fstatat (int fd, const char *file, struct stat *buf, int flag) | |
| 23 | __fstatat (int fd, const char *file, struct stat *buf, int flag) | |
| 50 | 24 | { |
| 51 | return __fxstatat (_STAT_VER, fd, file, buf, flag); | |
| 25 | if (fd < 0 && fd != AT_FDCWD) | |
| 26 | { | |
| 27 | __set_errno (EBADF); | |
| 28 | return -1; | |
| 29 | } | |
| 30 | if (buf == 0 || (flag & ~AT_SYMLINK_NOFOLLOW) != 0) | |
| 31 | { | |
| 32 | __set_errno (EINVAL); | |
| 33 | return -1; | |
| 34 | } | |
| 35 | ||
| 36 | __set_errno (ENOSYS); | |
| 37 | return -1; | |
| 52 | 38 | } |
| 39 | ||
| 40 | weak_alias (__fstatat, fstatat) | |
| 41 | ||
| 42 | stub_warning (fstatat) |
lib/libc/glibc/io/fstatat64.c+21-31| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 2005-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 2005-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -6,23 +6,6 @@ |
| 6 | 6 | License as published by the Free Software Foundation; either |
| 7 | 7 | version 2.1 of the License, or (at your option) any later version. |
| 8 | 8 | |
| 9 | In addition to the permissions in the GNU Lesser General Public | |
| 10 | License, the Free Software Foundation gives you unlimited | |
| 11 | permission to link the compiled version of this file with other | |
| 12 | programs, and to distribute those programs without any restriction | |
| 13 | coming from the use of this file. (The GNU Lesser General Public | |
| 14 | License restrictions do apply in other respects; for example, they | |
| 15 | cover modification of the file, and distribution when not linked | |
| 16 | into another program.) | |
| 17 | ||
| 18 | Note that people who make modified versions of this file are not | |
| 19 | obligated to grant this special exception for their modified | |
| 20 | versions; it is their choice whether to do so. The GNU Lesser | |
| 21 | General Public License gives permission to release a modified | |
| 22 | version without this exception; this exception also makes it | |
| 23 | possible to release a modified version which carries forward this | |
| 24 | exception. | |
| 25 | ||
| 26 | 9 | The GNU C Library is distributed in the hope that it will be useful, |
| 27 | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 28 | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| ... | ... | @@ -33,20 +16,27 @@ |
| 33 | 16 | <https://www.gnu.org/licenses/>. */ |
| 34 | 17 | |
| 35 | 18 | #include <sys/stat.h> |
| 19 | #include <errno.h> | |
| 20 | #include <fcntl.h> | |
| 36 | 21 | |
| 37 | /* This definition is only used if inlining fails for this function; see | |
| 38 | the last page of <sys/stat.h>. The real work is done by the `x' | |
| 39 | function which is passed a version number argument. We arrange in the | |
| 40 | makefile that when not inlined this function is always statically | |
| 41 | linked; that way a dynamically-linked executable always encodes the | |
| 42 | version number corresponding to the data structures it uses, so the `x' | |
| 43 | functions in the shared library can adapt without needing to recompile | |
| 44 | all callers. */ | |
| 45 | ||
| 46 | #undef fstatat64 | |
| 47 | 22 | int |
| 48 | attribute_hidden | |
| 49 | fstatat64 (int fd, const char *file, struct stat64 *buf, int flag) | |
| 23 | __fstatat64 (int fd, const char *file, struct stat64 *buf, int flag) | |
| 50 | 24 | { |
| 51 | return __fxstatat64 (_STAT_VER, fd, file, buf, flag); | |
| 25 | if (fd < 0 && fd != AT_FDCWD) | |
| 26 | { | |
| 27 | __set_errno (EBADF); | |
| 28 | return -1; | |
| 29 | } | |
| 30 | if (buf == 0 || (flag & ~AT_SYMLINK_NOFOLLOW) != 0) | |
| 31 | { | |
| 32 | __set_errno (EINVAL); | |
| 33 | return -1; | |
| 34 | } | |
| 35 | ||
| 36 | __set_errno (ENOSYS); | |
| 37 | return -1; | |
| 52 | 38 | } |
| 39 | hidden_def (__fstatat64) | |
| 40 | weak_alias (__fstatat64, fstatat64) | |
| 41 | ||
| 42 | stub_warning (fstatat64) |
lib/libc/glibc/io/lstat.c+4-32| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1996-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1996-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -6,23 +6,6 @@ |
| 6 | 6 | License as published by the Free Software Foundation; either |
| 7 | 7 | version 2.1 of the License, or (at your option) any later version. |
| 8 | 8 | |
| 9 | In addition to the permissions in the GNU Lesser General Public | |
| 10 | License, the Free Software Foundation gives you unlimited | |
| 11 | permission to link the compiled version of this file with other | |
| 12 | programs, and to distribute those programs without any restriction | |
| 13 | coming from the use of this file. (The GNU Lesser General Public | |
| 14 | License restrictions do apply in other respects; for example, they | |
| 15 | cover modification of the file, and distribution when not linked | |
| 16 | into another program.) | |
| 17 | ||
| 18 | Note that people who make modified versions of this file are not | |
| 19 | obligated to grant this special exception for their modified | |
| 20 | versions; it is their choice whether to do so. The GNU Lesser | |
| 21 | General Public License gives permission to release a modified | |
| 22 | version without this exception; this exception also makes it | |
| 23 | possible to release a modified version which carries forward this | |
| 24 | exception. | |
| 25 | ||
| 26 | 9 | The GNU C Library is distributed in the hope that it will be useful, |
| 27 | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 28 | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| ... | ... | @@ -33,23 +16,12 @@ |
| 33 | 16 | <https://www.gnu.org/licenses/>. */ |
| 34 | 17 | |
| 35 | 18 | #include <sys/stat.h> |
| 19 | #include <fcntl.h> | |
| 36 | 20 | |
| 37 | /* This definition is only used if inlining fails for this function; see | |
| 38 | the last page of <sys/stat.h>. The real work is done by the `x' | |
| 39 | function which is passed a version number argument. We arrange in the | |
| 40 | makefile that when not inlined this function is always statically | |
| 41 | linked; that way a dynamically-linked executable always encodes the | |
| 42 | version number corresponding to the data structures it uses, so the `x' | |
| 43 | functions in the shared library can adapt without needing to recompile | |
| 44 | all callers. */ | |
| 45 | ||
| 46 | #undef lstat | |
| 47 | #undef __lstat | |
| 48 | 21 | int |
| 49 | attribute_hidden | |
| 50 | 22 | __lstat (const char *file, struct stat *buf) |
| 51 | 23 | { |
| 52 | return __lxstat (_STAT_VER, file, buf); | |
| 24 | return __fstatat (AT_FDCWD, file, buf, AT_SYMLINK_NOFOLLOW); | |
| 53 | 25 | } |
| 54 | 26 | |
| 55 | weak_hidden_alias (__lstat, lstat) | |
| 27 | weak_alias (__lstat, lstat) |
lib/libc/glibc/io/lstat64.c+6-31| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1996-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1996-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -6,23 +6,6 @@ |
| 6 | 6 | License as published by the Free Software Foundation; either |
| 7 | 7 | version 2.1 of the License, or (at your option) any later version. |
| 8 | 8 | |
| 9 | In addition to the permissions in the GNU Lesser General Public | |
| 10 | License, the Free Software Foundation gives you unlimited | |
| 11 | permission to link the compiled version of this file with other | |
| 12 | programs, and to distribute those programs without any restriction | |
| 13 | coming from the use of this file. (The GNU Lesser General Public | |
| 14 | License restrictions do apply in other respects; for example, they | |
| 15 | cover modification of the file, and distribution when not linked | |
| 16 | into another program.) | |
| 17 | ||
| 18 | Note that people who make modified versions of this file are not | |
| 19 | obligated to grant this special exception for their modified | |
| 20 | versions; it is their choice whether to do so. The GNU Lesser | |
| 21 | General Public License gives permission to release a modified | |
| 22 | version without this exception; this exception also makes it | |
| 23 | possible to release a modified version which carries forward this | |
| 24 | exception. | |
| 25 | ||
| 26 | 9 | The GNU C Library is distributed in the hope that it will be useful, |
| 27 | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 28 | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| ... | ... | @@ -33,20 +16,12 @@ |
| 33 | 16 | <https://www.gnu.org/licenses/>. */ |
| 34 | 17 | |
| 35 | 18 | #include <sys/stat.h> |
| 19 | #include <fcntl.h> | |
| 36 | 20 | |
| 37 | /* This definition is only used if inlining fails for this function; see | |
| 38 | the last page of <sys/stat.h>. The real work is done by the `x' | |
| 39 | function which is passed a version number argument. We arrange in the | |
| 40 | makefile that when not inlined this function is always statically | |
| 41 | linked; that way a dynamically-linked executable always encodes the | |
| 42 | version number corresponding to the data structures it uses, so the `x' | |
| 43 | functions in the shared library can adapt without needing to recompile | |
| 44 | all callers. */ | |
| 45 | ||
| 46 | #undef lstat64 | |
| 47 | 21 | int |
| 48 | attribute_hidden | |
| 49 | lstat64 (const char *file, struct stat64 *buf) | |
| 22 | __lstat64 (const char *file, struct stat64 *buf) | |
| 50 | 23 | { |
| 51 | return __lxstat64 (_STAT_VER, file, buf); | |
| 24 | return __fstatat64 (AT_FDCWD, file, buf, AT_SYMLINK_NOFOLLOW); | |
| 52 | 25 | } |
| 26 | hidden_def (__lstat64) | |
| 27 | weak_alias (__lstat64, lstat64) |
lib/libc/glibc/io/mknod.c+5-33| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -6,23 +6,6 @@ |
| 6 | 6 | License as published by the Free Software Foundation; either |
| 7 | 7 | version 2.1 of the License, or (at your option) any later version. |
| 8 | 8 | |
| 9 | In addition to the permissions in the GNU Lesser General Public | |
| 10 | License, the Free Software Foundation gives you unlimited | |
| 11 | permission to link the compiled version of this file with other | |
| 12 | programs, and to distribute those programs without any restriction | |
| 13 | coming from the use of this file. (The GNU Lesser General Public | |
| 14 | License restrictions do apply in other respects; for example, they | |
| 15 | cover modification of the file, and distribution when not linked | |
| 16 | into another program.) | |
| 17 | ||
| 18 | Note that people who make modified versions of this file are not | |
| 19 | obligated to grant this special exception for their modified | |
| 20 | versions; it is their choice whether to do so. The GNU Lesser | |
| 21 | General Public License gives permission to release a modified | |
| 22 | version without this exception; this exception also makes it | |
| 23 | possible to release a modified version which carries forward this | |
| 24 | exception. | |
| 25 | ||
| 26 | 9 | The GNU C Library is distributed in the hope that it will be useful, |
| 27 | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 28 | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| ... | ... | @@ -32,24 +15,13 @@ |
| 32 | 15 | License along with the GNU C Library; if not, see |
| 33 | 16 | <https://www.gnu.org/licenses/>. */ |
| 34 | 17 | |
| 35 | ||
| 36 | #include <sys/types.h> | |
| 37 | 18 | #include <sys/stat.h> |
| 38 | ||
| 39 | /* This definition is only used if inlining fails for this function; see | |
| 40 | the last page of <sys/stat.h>. The real work is done by the `x' | |
| 41 | function which is passed a version number argument. We arrange in the | |
| 42 | makefile that when not inlined this function is always statically | |
| 43 | linked; that way a dynamically-linked executable always encodes the | |
| 44 | version number corresponding to the data structures it uses, so the `x' | |
| 45 | functions in the shared library can adapt without needing to recompile | |
| 46 | all callers. */ | |
| 19 | #include <fcntl.h> | |
| 47 | 20 | |
| 48 | 21 | int |
| 49 | attribute_hidden | |
| 50 | 22 | __mknod (const char *path, mode_t mode, dev_t dev) |
| 51 | 23 | { |
| 52 | return __xmknod (_MKNOD_VER, path, mode, &dev); | |
| 24 | return __mknodat (AT_FDCWD, path, mode, dev); | |
| 53 | 25 | } |
| 54 | ||
| 55 | weak_hidden_alias (__mknod, mknod) | |
| 26 | libc_hidden_def (__mknod) | |
| 27 | weak_alias (__mknod, mknod) |
lib/libc/glibc/io/mknodat.c+9-31| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -6,23 +6,6 @@ |
| 6 | 6 | License as published by the Free Software Foundation; either |
| 7 | 7 | version 2.1 of the License, or (at your option) any later version. |
| 8 | 8 | |
| 9 | In addition to the permissions in the GNU Lesser General Public | |
| 10 | License, the Free Software Foundation gives you unlimited | |
| 11 | permission to link the compiled version of this file with other | |
| 12 | programs, and to distribute those programs without any restriction | |
| 13 | coming from the use of this file. (The GNU Lesser General Public | |
| 14 | License restrictions do apply in other respects; for example, they | |
| 15 | cover modification of the file, and distribution when not linked | |
| 16 | into another program.) | |
| 17 | ||
| 18 | Note that people who make modified versions of this file are not | |
| 19 | obligated to grant this special exception for their modified | |
| 20 | versions; it is their choice whether to do so. The GNU Lesser | |
| 21 | General Public License gives permission to release a modified | |
| 22 | version without this exception; this exception also makes it | |
| 23 | possible to release a modified version which carries forward this | |
| 24 | exception. | |
| 25 | ||
| 26 | 9 | The GNU C Library is distributed in the hope that it will be useful, |
| 27 | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 28 | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| ... | ... | @@ -32,22 +15,17 @@ |
| 32 | 15 | License along with the GNU C Library; if not, see |
| 33 | 16 | <https://www.gnu.org/licenses/>. */ |
| 34 | 17 | |
| 35 | ||
| 36 | 18 | #include <sys/types.h> |
| 37 | 19 | #include <sys/stat.h> |
| 38 | ||
| 39 | /* This definition is only used if inlining fails for this function; see | |
| 40 | the last page of <sys/stat.h>. The real work is done by the `x' | |
| 41 | function which is passed a version number argument. We arrange in the | |
| 42 | makefile that when not inlined this function is always statically | |
| 43 | linked; that way a dynamically-linked executable always encodes the | |
| 44 | version number corresponding to the data structures it uses, so the `x' | |
| 45 | functions in the shared library can adapt without needing to recompile | |
| 46 | all callers. */ | |
| 20 | #include <errno.h> | |
| 47 | 21 | |
| 48 | 22 | int |
| 49 | attribute_hidden | |
| 50 | mknodat (int fd, const char *path, mode_t mode, dev_t dev) | |
| 23 | __mknodat (int fd, const char *path, mode_t mode, dev_t dev) | |
| 51 | 24 | { |
| 52 | return __xmknodat (_MKNOD_VER, fd, path, mode, &dev); | |
| 25 | __set_errno (ENOSYS); | |
| 26 | return -1; | |
| 53 | 27 | } |
| 28 | libc_hidden_def (__mknodat) | |
| 29 | weak_alias (__mknodat, mknodat) | |
| 30 | ||
| 31 | stub_warning (mknodat) |
lib/libc/glibc/io/stat.c+4-31| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1996-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1996-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -6,23 +6,6 @@ |
| 6 | 6 | License as published by the Free Software Foundation; either |
| 7 | 7 | version 2.1 of the License, or (at your option) any later version. |
| 8 | 8 | |
| 9 | In addition to the permissions in the GNU Lesser General Public | |
| 10 | License, the Free Software Foundation gives you unlimited | |
| 11 | permission to link the compiled version of this file with other | |
| 12 | programs, and to distribute those programs without any restriction | |
| 13 | coming from the use of this file. (The GNU Lesser General Public | |
| 14 | License restrictions do apply in other respects; for example, they | |
| 15 | cover modification of the file, and distribution when not linked | |
| 16 | into another program.) | |
| 17 | ||
| 18 | Note that people who make modified versions of this file are not | |
| 19 | obligated to grant this special exception for their modified | |
| 20 | versions; it is their choice whether to do so. The GNU Lesser | |
| 21 | General Public License gives permission to release a modified | |
| 22 | version without this exception; this exception also makes it | |
| 23 | possible to release a modified version which carries forward this | |
| 24 | exception. | |
| 25 | ||
| 26 | 9 | The GNU C Library is distributed in the hope that it will be useful, |
| 27 | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 28 | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| ... | ... | @@ -33,22 +16,12 @@ |
| 33 | 16 | <https://www.gnu.org/licenses/>. */ |
| 34 | 17 | |
| 35 | 18 | #include <sys/stat.h> |
| 19 | #include <fcntl.h> | |
| 36 | 20 | |
| 37 | /* This definition is only used if inlining fails for this function; see | |
| 38 | the last page of <sys/stat.h>. The real work is done by the `x' | |
| 39 | function which is passed a version number argument. We arrange in the | |
| 40 | makefile that when not inlined this function is always statically | |
| 41 | linked; that way a dynamically-linked executable always encodes the | |
| 42 | version number corresponding to the data structures it uses, so the `x' | |
| 43 | functions in the shared library can adapt without needing to recompile | |
| 44 | all callers. */ | |
| 45 | ||
| 46 | #undef stat | |
| 47 | 21 | int |
| 48 | attribute_hidden | |
| 49 | 22 | __stat (const char *file, struct stat *buf) |
| 50 | 23 | { |
| 51 | return __xstat (_STAT_VER, file, buf); | |
| 24 | return __fstatat (AT_FDCWD, file, buf, 0); | |
| 52 | 25 | } |
| 53 | 26 | |
| 54 | weak_hidden_alias (__stat, stat) | |
| 27 | weak_alias (__stat, stat) |
lib/libc/glibc/io/stat64.c+6-31| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1996-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1996-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -6,23 +6,6 @@ |
| 6 | 6 | License as published by the Free Software Foundation; either |
| 7 | 7 | version 2.1 of the License, or (at your option) any later version. |
| 8 | 8 | |
| 9 | In addition to the permissions in the GNU Lesser General Public | |
| 10 | License, the Free Software Foundation gives you unlimited | |
| 11 | permission to link the compiled version of this file with other | |
| 12 | programs, and to distribute those programs without any restriction | |
| 13 | coming from the use of this file. (The GNU Lesser General Public | |
| 14 | License restrictions do apply in other respects; for example, they | |
| 15 | cover modification of the file, and distribution when not linked | |
| 16 | into another program.) | |
| 17 | ||
| 18 | Note that people who make modified versions of this file are not | |
| 19 | obligated to grant this special exception for their modified | |
| 20 | versions; it is their choice whether to do so. The GNU Lesser | |
| 21 | General Public License gives permission to release a modified | |
| 22 | version without this exception; this exception also makes it | |
| 23 | possible to release a modified version which carries forward this | |
| 24 | exception. | |
| 25 | ||
| 26 | 9 | The GNU C Library is distributed in the hope that it will be useful, |
| 27 | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 28 | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| ... | ... | @@ -33,20 +16,12 @@ |
| 33 | 16 | <https://www.gnu.org/licenses/>. */ |
| 34 | 17 | |
| 35 | 18 | #include <sys/stat.h> |
| 19 | #include <fcntl.h> | |
| 36 | 20 | |
| 37 | /* This definition is only used if inlining fails for this function; see | |
| 38 | the last page of <sys/stat.h>. The real work is done by the `x' | |
| 39 | function which is passed a version number argument. We arrange in the | |
| 40 | makefile that when not inlined this function is always statically | |
| 41 | linked; that way a dynamically-linked executable always encodes the | |
| 42 | version number corresponding to the data structures it uses, so the `x' | |
| 43 | functions in the shared library can adapt without needing to recompile | |
| 44 | all callers. */ | |
| 45 | ||
| 46 | #undef stat64 | |
| 47 | 21 | int |
| 48 | attribute_hidden | |
| 49 | stat64 (const char *file, struct stat64 *buf) | |
| 22 | __stat64 (const char *file, struct stat64 *buf) | |
| 50 | 23 | { |
| 51 | return __xstat64 (_STAT_VER, file, buf); | |
| 24 | return __fstatat64 (AT_FDCWD, file, buf, 0); | |
| 52 | 25 | } |
| 26 | hidden_def (__stat64) | |
| 27 | weak_alias (__stat64, stat64) |
lib/libc/glibc/io/sys/stat.h+101-167| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1991-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1991-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -209,21 +209,51 @@ extern int stat (const char *__restrict __file, |
| 209 | 209 | that file descriptor FD is open on and put them in BUF. */ |
| 210 | 210 | extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2)); |
| 211 | 211 | #else |
| 212 | # ifdef __REDIRECT_NTH | |
| 212 | # ifdef __USE_TIME_BITS64 | |
| 213 | # ifdef __REDIRECT_NTH | |
| 214 | extern int __REDIRECT_NTH (stat, (const char *__restrict __file, | |
| 215 | 				 struct stat *__restrict __buf), | |
| 216 | 				 __stat64_time64) | |
| 217 | __nonnull ((1, 2)); | |
| 218 | extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), | |
| 219 | 				 __fstat64_time64) | |
| 220 | __nonnull ((2)); | |
| 221 | # else | |
| 222 | # define stat __stat64_time64 | |
| 223 | # define fstat __fstat64_time64 | |
| 224 | # endif | |
| 225 | # else | |
| 226 | # ifdef __REDIRECT_NTH | |
| 213 | 227 | extern int __REDIRECT_NTH (stat, (const char *__restrict __file, |
| 214 | 228 | 				 struct stat *__restrict __buf), stat64) |
| 215 | 229 | __nonnull ((1, 2)); |
| 216 | 230 | extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64) |
| 217 | 231 | __nonnull ((2)); |
| 218 | # else | |
| 219 | # define stat stat64 | |
| 220 | # define fstat fstat64 | |
| 232 | # else | |
| 233 | # define stat stat64 | |
| 234 | # define fstat fstat64 | |
| 235 | # endif | |
| 221 | 236 | # endif |
| 222 | 237 | #endif |
| 223 | 238 | #ifdef __USE_LARGEFILE64 |
| 239 | # ifndef __USE_TIME_BITS64 | |
| 224 | 240 | extern int stat64 (const char *__restrict __file, |
| 225 | 241 | 		 struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2)); |
| 226 | 242 | extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2)); |
| 243 | # else | |
| 244 | # ifdef __REDIRECT_NTH | |
| 245 | extern int __REDIRECT_NTH (stat64, (const char *__restrict __file, | |
| 246 | 				 struct stat64 *__restrict __buf), | |
| 247 | 			 __stat64_time64) | |
| 248 | __nonnull ((1, 2)); | |
| 249 | extern int __REDIRECT_NTH (fstat64, (int __fd, struct stat64 *__buf), | |
| 250 | 			 __fstat64_time64) | |
| 251 | __nonnull ((2)); | |
| 252 | # else | |
| 253 | # define stat64 __stat64_time64 | |
| 254 | # define fstat64 __fstat64_time | |
| 255 | # endif | |
| 256 | # endif | |
| 227 | 257 | #endif |
| 228 | 258 | |
| 229 | 259 | #ifdef __USE_ATFILE |
| ... | ... | @@ -235,20 +265,44 @@ extern int fstatat (int __fd, const char *__restrict __file, |
| 235 | 265 | 		 struct stat *__restrict __buf, int __flag) |
| 236 | 266 | __THROW __nonnull ((2, 3)); |
| 237 | 267 | # else |
| 238 | # ifdef __REDIRECT_NTH | |
| 268 | # ifdef __USE_TIME_BITS64 | |
| 269 | # ifdef __REDIRECT_NTH | |
| 239 | 270 | extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file, |
| 240 | 271 | 				 struct stat *__restrict __buf, |
| 241 | 272 | 				 int __flag), |
| 242 | 			 fstatat64) __nonnull ((2, 3)); | |
| 273 | 			 __fstatat64_time64) __nonnull ((2, 3)); | |
| 274 | # else | |
| 275 | # define fstatat __fstatat64_time64 | |
| 276 | # endif | |
| 243 | 277 | # else |
| 244 | # define fstatat fstatat64 | |
| 278 | # ifdef __REDIRECT_NTH | |
| 279 | extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file, | |
| 280 | 				 struct stat *__restrict __buf, | |
| 281 | 				 int __flag), | |
| 282 | 			 fstatat64) __nonnull ((2, 3)); | |
| 283 | # else | |
| 284 | # define fstatat fstatat64 | |
| 285 | # endif | |
| 245 | 286 | # endif |
| 246 | 287 | # endif |
| 247 | 288 | |
| 248 | 289 | # ifdef __USE_LARGEFILE64 |
| 290 | # ifndef __USE_TIME_BITS64 | |
| 249 | 291 | extern int fstatat64 (int __fd, const char *__restrict __file, |
| 250 | 292 | 		 struct stat64 *__restrict __buf, int __flag) |
| 251 | 293 | __THROW __nonnull ((2, 3)); |
| 294 | # else | |
| 295 | # ifdef __REDIRECT_NTH | |
| 296 | extern int __REDIRECT_NTH (fstatat64, (int __fd, | |
| 297 | 				 const char *__restrict __file, | |
| 298 | 				 struct stat64 *__restrict __buf, | |
| 299 | 				 int __flag), | |
| 300 | 			 __fstatat64_time64) | |
| 301 | __nonnull ((2, 3)); | |
| 302 | # else | |
| 303 | # define fstatat64 __fstatat64_time64 | |
| 304 | # endif | |
| 305 | # endif | |
| 252 | 306 | # endif |
| 253 | 307 | #endif |
| 254 | 308 | |
| ... | ... | @@ -259,19 +313,37 @@ extern int fstatat64 (int __fd, const char *__restrict __file, |
| 259 | 313 | extern int lstat (const char *__restrict __file, |
| 260 | 314 | 		 struct stat *__restrict __buf) __THROW __nonnull ((1, 2)); |
| 261 | 315 | # else |
| 262 | # ifdef __REDIRECT_NTH | |
| 316 | # ifdef __USE_TIME_BITS64 | |
| 317 | # ifdef __REDIRECT_NTH | |
| 263 | 318 | extern int __REDIRECT_NTH (lstat, |
| 264 | 319 | 			 (const char *__restrict __file, |
| 265 | 			 struct stat *__restrict __buf), lstat64) | |
| 320 | 			 struct stat *__restrict __buf), __lstat64_time64) | |
| 266 | 321 | __nonnull ((1, 2)); |
| 322 | # else | |
| 323 | # define lstat __lstat64_time64 | |
| 324 | # endif | |
| 267 | 325 | # else |
| 268 | # define lstat lstat64 | |
| 326 | # ifdef __REDIRECT_NTH | |
| 327 | extern int __REDIRECT_NTH (lstat, | |
| 328 | 			 (const char *__restrict __file, | |
| 329 | 			 struct stat *__restrict __buf), lstat64) | |
| 330 | __nonnull ((1, 2)); | |
| 331 | # else | |
| 332 | # define lstat lstat64 | |
| 333 | # endif | |
| 269 | 334 | # endif |
| 270 | 335 | # endif |
| 271 | 336 | # ifdef __USE_LARGEFILE64 |
| 337 | # ifndef __USE_TIME_BITS64 | |
| 272 | 338 | extern int lstat64 (const char *__restrict __file, |
| 273 | 339 | 		 struct stat64 *__restrict __buf) |
| 274 | 340 | __THROW __nonnull ((1, 2)); |
| 341 | # else | |
| 342 | extern int __REDIRECT_NTH (lstat64, (const char *__restrict __file, | |
| 343 | 				 struct stat64 *__restrict __buf), | |
| 344 | 			 __lstat64_time64) | |
| 345 | __nonnull ((1, 2)); | |
| 346 | # endif | |
| 275 | 347 | # endif |
| 276 | 348 | #endif |
| 277 | 349 | |
| ... | ... | @@ -355,182 +427,44 @@ extern int mkfifoat (int __fd, const char *__path, __mode_t __mode) |
| 355 | 427 | #endif |
| 356 | 428 | |
| 357 | 429 | #ifdef __USE_ATFILE |
| 430 | # ifndef __USE_TIME_BITS64 | |
| 358 | 431 | /* Set file access and modification times relative to directory file |
| 359 | 432 | descriptor. */ |
| 360 | 433 | extern int utimensat (int __fd, const char *__path, |
| 361 | 434 | 		 const struct timespec __times[2], |
| 362 | 435 | 		 int __flags) |
| 363 | 436 | __THROW __nonnull ((2)); |
| 437 | # else | |
| 438 | # ifdef __REDIRECT_NTH | |
| 439 | extern int __REDIRECT_NTH (utimensat, (int fd, const char *__path, | |
| 440 | const struct timespec __times[2], | |
| 441 | int flags), | |
| 442 | __utimensat64) __nonnull ((2)); | |
| 443 | # else | |
| 444 | # define utimensat __utimensat64 | |
| 445 | # endif | |
| 446 | # endif | |
| 364 | 447 | #endif |
| 365 | 448 | |
| 366 | 449 | #ifdef __USE_XOPEN2K8 |
| 450 | # ifndef __USE_TIME_BITS64 | |
| 367 | 451 | /* Set file access and modification times of the file associated with FD. */ |
| 368 | 452 | extern int futimens (int __fd, const struct timespec __times[2]) __THROW; |
| 369 | #endif | |
| 370 | ||
| 371 | /* To allow the `struct stat' structure and the file type `mode_t' | |
| 372 | bits to vary without changing shared library major version number, | |
| 373 | the `stat' family of functions and `mknod' are in fact inline | |
| 374 | wrappers around calls to `xstat', `fxstat', `lxstat', and `xmknod', | |
| 375 | which all take a leading version-number argument designating the | |
| 376 | data structure and bits used. <bits/stat.h> defines _STAT_VER with | |
| 377 | the version number corresponding to `struct stat' as defined in | |
| 378 | that file; and _MKNOD_VER with the version number corresponding to | |
| 379 | the S_IF* macros defined therein. It is arranged that when not | |
| 380 | inlined these function are always statically linked; that way a | |
| 381 | dynamically-linked executable always encodes the version number | |
| 382 | corresponding to the data structures it uses, so the `x' functions | |
| 383 | in the shared library can adapt without needing to recompile all | |
| 384 | callers. */ | |
| 385 | ||
| 386 | #ifndef _STAT_VER | |
| 387 | # define _STAT_VER	0 | |
| 388 | #endif | |
| 389 | #ifndef _MKNOD_VER | |
| 390 | # define _MKNOD_VER	0 | |
| 391 | #endif | |
| 392 | ||
| 393 | /* Wrappers for stat and mknod system calls. */ | |
| 394 | #ifndef __USE_FILE_OFFSET64 | |
| 395 | extern int __fxstat (int __ver, int __fildes, struct stat *__stat_buf) | |
| 396 | __THROW __nonnull ((3)); | |
| 397 | extern int __xstat (int __ver, const char *__filename, | |
| 398 | 		 struct stat *__stat_buf) __THROW __nonnull ((2, 3)); | |
| 399 | extern int __lxstat (int __ver, const char *__filename, | |
| 400 | 		 struct stat *__stat_buf) __THROW __nonnull ((2, 3)); | |
| 401 | extern int __fxstatat (int __ver, int __fildes, const char *__filename, | |
| 402 | 		 struct stat *__stat_buf, int __flag) | |
| 403 | __THROW __nonnull ((3, 4)); | |
| 404 | #else | |
| 405 | # ifdef __REDIRECT_NTH | |
| 406 | extern int __REDIRECT_NTH (__fxstat, (int __ver, int __fildes, | |
| 407 | 				 struct stat *__stat_buf), __fxstat64) | |
| 408 | __nonnull ((3)); | |
| 409 | extern int __REDIRECT_NTH (__xstat, (int __ver, const char *__filename, | |
| 410 | 				 struct stat *__stat_buf), __xstat64) | |
| 411 | __nonnull ((2, 3)); | |
| 412 | extern int __REDIRECT_NTH (__lxstat, (int __ver, const char *__filename, | |
| 413 | 				 struct stat *__stat_buf), __lxstat64) | |
| 414 | __nonnull ((2, 3)); | |
| 415 | extern int __REDIRECT_NTH (__fxstatat, (int __ver, int __fildes, | |
| 416 | 					const char *__filename, | |
| 417 | 					struct stat *__stat_buf, int __flag), | |
| 418 | 			 __fxstatat64) __nonnull ((3, 4)); | |
| 419 | 453 | |
| 420 | 454 | # else |
| 421 | # define __fxstat __fxstat64 | |
| 422 | # define __xstat __xstat64 | |
| 423 | # define __lxstat __lxstat64 | |
| 455 | # ifdef __REDIRECT_NTH | |
| 456 | extern int __REDIRECT_NTH (futimens, (int fd, const struct timespec __times[2]), | |
| 457 | __futimens64); | |
| 458 | # else | |
| 459 | # define futimens __futimens64 | |
| 460 | # endif | |
| 424 | 461 | # endif |
| 425 | 462 | #endif |
| 426 | 463 | |
| 427 | #ifdef __USE_LARGEFILE64 | |
| 428 | extern int __fxstat64 (int __ver, int __fildes, struct stat64 *__stat_buf) | |
| 429 | __THROW __nonnull ((3)); | |
| 430 | extern int __xstat64 (int __ver, const char *__filename, | |
| 431 | 		 struct stat64 *__stat_buf) __THROW __nonnull ((2, 3)); | |
| 432 | extern int __lxstat64 (int __ver, const char *__filename, | |
| 433 | 		 struct stat64 *__stat_buf) __THROW __nonnull ((2, 3)); | |
| 434 | extern int __fxstatat64 (int __ver, int __fildes, const char *__filename, | |
| 435 | 			 struct stat64 *__stat_buf, int __flag) | |
| 436 | __THROW __nonnull ((3, 4)); | |
| 437 | #endif | |
| 438 | extern int __xmknod (int __ver, const char *__path, __mode_t __mode, | |
| 439 | 		 __dev_t *__dev) __THROW __nonnull ((2, 4)); | |
| 440 | ||
| 441 | extern int __xmknodat (int __ver, int __fd, const char *__path, | |
| 442 | 		 __mode_t __mode, __dev_t *__dev) | |
| 443 | __THROW __nonnull ((3, 5)); | |
| 444 | ||
| 445 | 464 | #ifdef __USE_GNU |
| 446 | 465 | # include <bits/statx.h> |
| 447 | 466 | #endif |
| 448 | 467 | |
| 449 | #ifdef __USE_EXTERN_INLINES | |
| 450 | /* Inlined versions of the real stat and mknod functions. */ | |
| 451 | ||
| 452 | __extern_inline int | |
| 453 | __NTH (stat (const char *__path, struct stat *__statbuf)) | |
| 454 | { | |
| 455 | return __xstat (_STAT_VER, __path, __statbuf); | |
| 456 | } | |
| 457 | ||
| 458 | # if defined __USE_MISC || defined __USE_XOPEN_EXTENDED | |
| 459 | __extern_inline int | |
| 460 | __NTH (lstat (const char *__path, struct stat *__statbuf)) | |
| 461 | { | |
| 462 | return __lxstat (_STAT_VER, __path, __statbuf); | |
| 463 | } | |
| 464 | # endif | |
| 465 | ||
| 466 | __extern_inline int | |
| 467 | __NTH (fstat (int __fd, struct stat *__statbuf)) | |
| 468 | { | |
| 469 | return __fxstat (_STAT_VER, __fd, __statbuf); | |
| 470 | } | |
| 471 | ||
| 472 | # ifdef __USE_ATFILE | |
| 473 | __extern_inline int | |
| 474 | __NTH (fstatat (int __fd, const char *__filename, struct stat *__statbuf, | |
| 475 | 		int __flag)) | |
| 476 | { | |
| 477 | return __fxstatat (_STAT_VER, __fd, __filename, __statbuf, __flag); | |
| 478 | } | |
| 479 | # endif | |
| 480 | ||
| 481 | # ifdef __USE_MISC | |
| 482 | __extern_inline int | |
| 483 | __NTH (mknod (const char *__path, __mode_t __mode, __dev_t __dev)) | |
| 484 | { | |
| 485 | return __xmknod (_MKNOD_VER, __path, __mode, &__dev); | |
| 486 | } | |
| 487 | # endif | |
| 488 | ||
| 489 | # ifdef __USE_ATFILE | |
| 490 | __extern_inline int | |
| 491 | __NTH (mknodat (int __fd, const char *__path, __mode_t __mode, | |
| 492 | 		__dev_t __dev)) | |
| 493 | { | |
| 494 | return __xmknodat (_MKNOD_VER, __fd, __path, __mode, &__dev); | |
| 495 | } | |
| 496 | # endif | |
| 497 | ||
| 498 | # if defined __USE_LARGEFILE64 \ | |
| 499 | && (! defined __USE_FILE_OFFSET64 \ | |
| 500 | || (defined __REDIRECT_NTH && defined __OPTIMIZE__)) | |
| 501 | __extern_inline int | |
| 502 | __NTH (stat64 (const char *__path, struct stat64 *__statbuf)) | |
| 503 | { | |
| 504 | return __xstat64 (_STAT_VER, __path, __statbuf); | |
| 505 | } | |
| 506 | ||
| 507 | # if defined __USE_MISC || defined __USE_XOPEN_EXTENDED | |
| 508 | __extern_inline int | |
| 509 | __NTH (lstat64 (const char *__path, struct stat64 *__statbuf)) | |
| 510 | { | |
| 511 | return __lxstat64 (_STAT_VER, __path, __statbuf); | |
| 512 | } | |
| 513 | # endif | |
| 514 | ||
| 515 | __extern_inline int | |
| 516 | __NTH (fstat64 (int __fd, struct stat64 *__statbuf)) | |
| 517 | { | |
| 518 | return __fxstat64 (_STAT_VER, __fd, __statbuf); | |
| 519 | } | |
| 520 | ||
| 521 | # ifdef __USE_ATFILE | |
| 522 | __extern_inline int | |
| 523 | __NTH (fstatat64 (int __fd, const char *__filename, struct stat64 *__statbuf, | |
| 524 | 		 int __flag)) | |
| 525 | { | |
| 526 | return __fxstatat64 (_STAT_VER, __fd, __filename, __statbuf, __flag); | |
| 527 | } | |
| 528 | # endif | |
| 529 | ||
| 530 | # endif | |
| 531 | ||
| 532 | #endif | |
| 533 | ||
| 534 | 468 | __END_DECLS |
| 535 | 469 | |
| 536 | 470 |
lib/libc/glibc/locale/bits/types/__locale_t.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Definition of struct __locale_struct and __locale_t. |
| 2 | Copyright (C) 1997-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1997-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. |
| 5 | 5 |
lib/libc/glibc/locale/bits/types/locale_t.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Definition of locale_t. |
| 2 | Copyright (C) 2017-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2017-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/misc/sys/cdefs.h+187-69| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1992-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | |
| 26 | 26 | /* The GNU libc does not support any K&R compilers or the traditional mode |
| 27 | 27 | of ISO C compilers anymore. Check for some of the combinations not |
| 28 | anymore supported. */ | |
| 28 | supported anymore. */ | |
| 29 | 29 | #if defined __GNUC__ && !defined __STDC__ |
| 30 | 30 | # error "You need a ISO C conforming compiler to use the glibc headers" |
| 31 | 31 | #endif |
| ... | ... | @@ -34,7 +34,29 @@ |
| 34 | 34 | #undef	__P |
| 35 | 35 | #undef	__PMT |
| 36 | 36 | |
| 37 | #ifdef __GNUC__ | |
| 37 | /* Compilers that lack __has_attribute may object to | |
| 38 | #if defined __has_attribute && __has_attribute (...) | |
| 39 | even though they do not need to evaluate the right-hand side of the &&. | |
| 40 | Similarly for __has_builtin, etc. */ | |
| 41 | #if (defined __has_attribute \ | |
| 42 | && (!defined __clang_minor__ \ | |
| 43 | || 3 < __clang_major__ + (5 <= __clang_minor__))) | |
| 44 | # define __glibc_has_attribute(attr) __has_attribute (attr) | |
| 45 | #else | |
| 46 | # define __glibc_has_attribute(attr) 0 | |
| 47 | #endif | |
| 48 | #ifdef __has_builtin | |
| 49 | # define __glibc_has_builtin(name) __has_builtin (name) | |
| 50 | #else | |
| 51 | # define __glibc_has_builtin(name) 0 | |
| 52 | #endif | |
| 53 | #ifdef __has_extension | |
| 54 | # define __glibc_has_extension(ext) __has_extension (ext) | |
| 55 | #else | |
| 56 | # define __glibc_has_extension(ext) 0 | |
| 57 | #endif | |
| 58 | ||
| 59 | #if defined __GNUC__ || defined __clang__ | |
| 38 | 60 | |
| 39 | 61 | /* All functions, except those with callbacks or those that |
| 40 | 62 | synchronize memory, are leaf functions. */ |
| ... | ... | @@ -47,21 +69,26 @@ |
| 47 | 69 | # endif |
| 48 | 70 | |
| 49 | 71 | /* GCC can always grok prototypes. For C++ programs we add throw() |
| 50 | to help it optimize the function calls. But this works only with | |
| 51 | gcc 2.8.x and egcs. For gcc 3.2 and up we even mark C functions | |
| 72 | to help it optimize the function calls. But this only works with | |
| 73 | gcc 2.8.x and egcs. For gcc 3.4 and up we even mark C functions | |
| 52 | 74 | as non-throwing using a function attribute since programs can use |
| 53 | 75 | the -fexceptions options for C code as well. */ |
| 54 | # if !defined __cplusplus && __GNUC_PREREQ (3, 3) | |
| 76 | # if !defined __cplusplus \ | |
| 77 | && (__GNUC_PREREQ (3, 4) || __glibc_has_attribute (__nothrow__)) | |
| 55 | 78 | # define __THROW	__attribute__ ((__nothrow__ __LEAF)) |
| 56 | 79 | # define __THROWNL	__attribute__ ((__nothrow__)) |
| 57 | 80 | # define __NTH(fct)	__attribute__ ((__nothrow__ __LEAF)) fct |
| 58 | 81 | # define __NTHNL(fct) __attribute__ ((__nothrow__)) fct |
| 59 | 82 | # else |
| 60 | # if defined __cplusplus && __GNUC_PREREQ (2,8) | |
| 61 | # define __THROW	throw () | |
| 62 | # define __THROWNL	throw () | |
| 63 | # define __NTH(fct)	__LEAF_ATTR fct throw () | |
| 64 | # define __NTHNL(fct) fct throw () | |
| 83 | # if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major >= 4) | |
| 84 | # if __cplusplus >= 201103L | |
| 85 | # define __THROW	noexcept (true) | |
| 86 | # else | |
| 87 | # define __THROW	throw () | |
| 88 | # endif | |
| 89 | # define __THROWNL	__THROW | |
| 90 | # define __NTH(fct)	__LEAF_ATTR fct __THROW | |
| 91 | # define __NTHNL(fct) fct __THROW | |
| 65 | 92 | # else |
| 66 | 93 | # define __THROW |
| 67 | 94 | # define __THROWNL |
| ... | ... | @@ -70,7 +97,7 @@ |
| 70 | 97 | # endif |
| 71 | 98 | # endif |
| 72 | 99 | |
| 73 | #else	/* Not GCC. */ | |
| 100 | #else	/* Not GCC or clang. */ | |
| 74 | 101 | |
| 75 | 102 | # if (defined __cplusplus						\ |
| 76 | 103 | || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)) |
| ... | ... | @@ -83,16 +110,7 @@ |
| 83 | 110 | # define __THROWNL |
| 84 | 111 | # define __NTH(fct)	fct |
| 85 | 112 | |
| 86 | #endif	/* GCC. */ | |
| 87 | ||
| 88 | /* Compilers that are not clang may object to | |
| 89 | #if defined __clang__ && __has_extension(...) | |
| 90 | even though they do not need to evaluate the right-hand side of the &&. */ | |
| 91 | #if defined __clang__ && defined __has_extension | |
| 92 | # define __glibc_clang_has_extension(ext) __has_extension (ext) | |
| 93 | #else | |
| 94 | # define __glibc_clang_has_extension(ext) 0 | |
| 95 | #endif | |
| 113 | #endif	/* GCC || clang. */ | |
| 96 | 114 | |
| 97 | 115 | /* These two macros are not used in glibc anymore. They are kept here |
| 98 | 116 | only because some other projects expect the macros to be defined. */ |
| ... | ... | @@ -123,14 +141,20 @@ |
| 123 | 141 | #define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) |
| 124 | 142 | #define __bos0(ptr) __builtin_object_size (ptr, 0) |
| 125 | 143 | |
| 144 | /* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */ | |
| 145 | #if __USE_FORTIFY_LEVEL == 3 && __glibc_clang_prereq (9, 0) | |
| 146 | # define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0) | |
| 147 | # define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1) | |
| 148 | #else | |
| 149 | # define __glibc_objsize0(__o) __bos0 (__o) | |
| 150 | # define __glibc_objsize(__o) __bos (__o) | |
| 151 | #endif | |
| 152 | ||
| 126 | 153 | #if __GNUC_PREREQ (4,3) |
| 127 | # define __warndecl(name, msg) \ | |
| 128 | extern void name (void) __attribute__((__warning__ (msg))) | |
| 129 | 154 | # define __warnattr(msg) __attribute__((__warning__ (msg))) |
| 130 | 155 | # define __errordecl(name, msg) \ |
| 131 | 156 | extern void name (void) __attribute__((__error__ (msg))) |
| 132 | 157 | #else |
| 133 | # define __warndecl(name, msg) extern void name (void) | |
| 134 | 158 | # define __warnattr(msg) |
| 135 | 159 | # define __errordecl(name, msg) extern void name (void) |
| 136 | 160 | #endif |
| ... | ... | @@ -139,11 +163,11 @@ |
| 139 | 163 | Headers that should use flexible arrays only if they're "real" |
| 140 | 164 | (e.g. only if they won't affect sizeof()) should test |
| 141 | 165 | #if __glibc_c99_flexarr_available. */ |
| 142 | #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L | |
| 166 | #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L && !defined __HP_cc | |
| 143 | 167 | # define __flexarr	[] |
| 144 | 168 | # define __glibc_c99_flexarr_available 1 |
| 145 | #elif __GNUC_PREREQ (2,97) | |
| 146 | /* GCC 2.97 supports C99 flexible array members as an extension, | |
| 169 | #elif __GNUC_PREREQ (2,97) || defined __clang__ | |
| 170 | /* GCC 2.97 and clang support C99 flexible array members as an extension, | |
| 147 | 171 | even when in C89 mode or compiling C++ (any version). */ |
| 148 | 172 | # define __flexarr	[] |
| 149 | 173 | # define __glibc_c99_flexarr_available 1 |
| ... | ... | @@ -169,7 +193,7 @@ |
| 169 | 193 | Example: |
| 170 | 194 | int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */ |
| 171 | 195 | |
| 172 | #if defined __GNUC__ && __GNUC__ >= 2 | |
| 196 | #if (defined __GNUC__ && __GNUC__ >= 2) || (__clang_major__ >= 4) | |
| 173 | 197 | |
| 174 | 198 | # define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias)) |
| 175 | 199 | # ifdef __cplusplus |
| ... | ... | @@ -194,17 +218,17 @@ |
| 194 | 218 | */ |
| 195 | 219 | #endif |
| 196 | 220 | |
| 197 | /* GCC has various useful declarations that can be made with the | |
| 198 | `__attribute__' syntax. All of the ways we use this do fine if | |
| 199 | they are omitted for compilers that don't understand it. */ | |
| 200 | #if !defined __GNUC__ || __GNUC__ < 2 | |
| 221 | /* GCC and clang have various useful declarations that can be made with | |
| 222 | the '__attribute__' syntax. All of the ways we use this do fine if | |
| 223 | they are omitted for compilers that don't understand it. */ | |
| 224 | #if !(defined __GNUC__ || defined __clang__) | |
| 201 | 225 | # define __attribute__(xyz)	/* Ignore */ |
| 202 | 226 | #endif |
| 203 | 227 | |
| 204 | 228 | /* At some point during the gcc 2.96 development the `malloc' attribute |
| 205 | 229 | for functions was introduced. We don't want to use it unconditionally |
| 206 | 230 | (although this would be possible) since it generates warnings. */ |
| 207 | #if __GNUC_PREREQ (2,96) | |
| 231 | #if __GNUC_PREREQ (2,96) || __glibc_has_attribute (__malloc__) | |
| 208 | 232 | # define __attribute_malloc__ __attribute__ ((__malloc__)) |
| 209 | 233 | #else |
| 210 | 234 | # define __attribute_malloc__ /* Ignore */ |
| ... | ... | @@ -222,23 +246,29 @@ |
| 222 | 246 | /* At some point during the gcc 2.96 development the `pure' attribute |
| 223 | 247 | for functions was introduced. We don't want to use it unconditionally |
| 224 | 248 | (although this would be possible) since it generates warnings. */ |
| 225 | #if __GNUC_PREREQ (2,96) | |
| 249 | #if __GNUC_PREREQ (2,96) || __glibc_has_attribute (__pure__) | |
| 226 | 250 | # define __attribute_pure__ __attribute__ ((__pure__)) |
| 227 | 251 | #else |
| 228 | 252 | # define __attribute_pure__ /* Ignore */ |
| 229 | 253 | #endif |
| 230 | 254 | |
| 231 | 255 | /* This declaration tells the compiler that the value is constant. */ |
| 232 | #if __GNUC_PREREQ (2,5) | |
| 256 | #if __GNUC_PREREQ (2,5) || __glibc_has_attribute (__const__) | |
| 233 | 257 | # define __attribute_const__ __attribute__ ((__const__)) |
| 234 | 258 | #else |
| 235 | 259 | # define __attribute_const__ /* Ignore */ |
| 236 | 260 | #endif |
| 237 | 261 | |
| 262 | #if __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__) | |
| 263 | # define __attribute_maybe_unused__ __attribute__ ((__unused__)) | |
| 264 | #else | |
| 265 | # define __attribute_maybe_unused__ /* Ignore */ | |
| 266 | #endif | |
| 267 | ||
| 238 | 268 | /* At some point during the gcc 3.1 development the `used' attribute |
| 239 | 269 | for functions was introduced. We don't want to use it unconditionally |
| 240 | 270 | (although this would be possible) since it generates warnings. */ |
| 241 | #if __GNUC_PREREQ (3,1) | |
| 271 | #if __GNUC_PREREQ (3,1) || __glibc_has_attribute (__used__) | |
| 242 | 272 | # define __attribute_used__ __attribute__ ((__used__)) |
| 243 | 273 | # define __attribute_noinline__ __attribute__ ((__noinline__)) |
| 244 | 274 | #else |
| ... | ... | @@ -247,7 +277,7 @@ |
| 247 | 277 | #endif |
| 248 | 278 | |
| 249 | 279 | /* Since version 3.2, gcc allows marking deprecated functions. */ |
| 250 | #if __GNUC_PREREQ (3,2) | |
| 280 | #if __GNUC_PREREQ (3,2) || __glibc_has_attribute (__deprecated__) | |
| 251 | 281 | # define __attribute_deprecated__ __attribute__ ((__deprecated__)) |
| 252 | 282 | #else |
| 253 | 283 | # define __attribute_deprecated__ /* Ignore */ |
| ... | ... | @@ -257,7 +287,7 @@ |
| 257 | 287 | when a deprecated function is used. clang claims to be gcc 4.2, but |
| 258 | 288 | may also support this feature. */ |
| 259 | 289 | #if __GNUC_PREREQ (4,5) \ |
| 260 | || __glibc_clang_has_extension (__attribute_deprecated_with_message__) | |
| 290 | || __glibc_has_extension (__attribute_deprecated_with_message__) | |
| 261 | 291 | # define __attribute_deprecated_msg__(msg) \ |
| 262 | 292 | 	 __attribute__ ((__deprecated__ (msg))) |
| 263 | 293 | #else |
| ... | ... | @@ -270,7 +300,7 @@ |
| 270 | 300 | If several `format_arg' attributes are given for the same function, in |
| 271 | 301 | gcc-3.0 and older, all but the last one are ignored. In newer gccs, |
| 272 | 302 | all designated arguments are considered. */ |
| 273 | #if __GNUC_PREREQ (2,8) | |
| 303 | #if __GNUC_PREREQ (2,8) || __glibc_has_attribute (__format_arg__) | |
| 274 | 304 | # define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x))) |
| 275 | 305 | #else |
| 276 | 306 | # define __attribute_format_arg__(x) /* Ignore */ |
| ... | ... | @@ -280,27 +310,42 @@ |
| 280 | 310 | attribute for functions was introduced. We don't want to use it |
| 281 | 311 | unconditionally (although this would be possible) since it |
| 282 | 312 | generates warnings. */ |
| 283 | #if __GNUC_PREREQ (2,97) | |
| 313 | #if __GNUC_PREREQ (2,97) || __glibc_has_attribute (__format__) | |
| 284 | 314 | # define __attribute_format_strfmon__(a,b) \ |
| 285 | 315 | __attribute__ ((__format__ (__strfmon__, a, b))) |
| 286 | 316 | #else |
| 287 | 317 | # define __attribute_format_strfmon__(a,b) /* Ignore */ |
| 288 | 318 | #endif |
| 289 | 319 | |
| 290 | /* The nonull function attribute allows to mark pointer parameters which | |
| 320 | /* The nonnull function attribute marks pointer parameters that | |
| 291 | 321 | must not be NULL. */ |
| 292 | #if __GNUC_PREREQ (3,3) | |
| 293 | # define __nonnull(params) __attribute__ ((__nonnull__ params)) | |
| 294 | #else | |
| 295 | # define __nonnull(params) | |
| 322 | #ifndef __nonnull | |
| 323 | # if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__) | |
| 324 | # define __nonnull(params) __attribute__ ((__nonnull__ params)) | |
| 325 | # else | |
| 326 | # define __nonnull(params) | |
| 327 | # endif | |
| 328 | #elif !defined __GLIBC__ | |
| 329 | # undef __nonnull | |
| 330 | # define __nonnull(params) _GL_ATTRIBUTE_NONNULL (params) | |
| 331 | #endif | |
| 332 | ||
| 333 | /* The returns_nonnull function attribute marks the return type of the function | |
| 334 | as always being non-null. */ | |
| 335 | #ifndef __returns_nonnull | |
| 336 | # if __GNUC_PREREQ (4, 9) || __glibc_has_attribute (__returns_nonnull__) | |
| 337 | # define __returns_nonnull __attribute__ ((__returns_nonnull__)) | |
| 338 | # else | |
| 339 | # define __returns_nonnull | |
| 340 | # endif | |
| 296 | 341 | #endif |
| 297 | 342 | |
| 298 | 343 | /* If fortification mode, we warn about unused results of certain |
| 299 | 344 | function calls which can lead to problems. */ |
| 300 | #if __GNUC_PREREQ (3,4) | |
| 345 | #if __GNUC_PREREQ (3,4) || __glibc_has_attribute (__warn_unused_result__) | |
| 301 | 346 | # define __attribute_warn_unused_result__ \ |
| 302 | 347 | __attribute__ ((__warn_unused_result__)) |
| 303 | # if __USE_FORTIFY_LEVEL > 0 | |
| 348 | # if defined __USE_FORTIFY_LEVEL && __USE_FORTIFY_LEVEL > 0 | |
| 304 | 349 | # define __wur __attribute_warn_unused_result__ |
| 305 | 350 | # endif |
| 306 | 351 | #else |
| ... | ... | @@ -311,7 +356,7 @@ |
| 311 | 356 | #endif |
| 312 | 357 | |
| 313 | 358 | /* Forces a function to be always inlined. */ |
| 314 | #if __GNUC_PREREQ (3,2) | |
| 359 | #if __GNUC_PREREQ (3,2) || __glibc_has_attribute (__always_inline__) | |
| 315 | 360 | /* The Linux kernel defines __always_inline in stddef.h (283d7573), and |
| 316 | 361 | it conflicts with this definition. Therefore undefine it first to |
| 317 | 362 | allow either header to be included first. */ |
| ... | ... | @@ -324,7 +369,7 @@ |
| 324 | 369 | |
| 325 | 370 | /* Associate error messages with the source location of the call site rather |
| 326 | 371 | than with the source location inside the function. */ |
| 327 | #if __GNUC_PREREQ (4,3) | |
| 372 | #if __GNUC_PREREQ (4,3) || __glibc_has_attribute (__artificial__) | |
| 328 | 373 | # define __attribute_artificial__ __attribute__ ((__artificial__)) |
| 329 | 374 | #else |
| 330 | 375 | # define __attribute_artificial__ /* Ignore */ |
| ... | ... | @@ -367,12 +412,14 @@ |
| 367 | 412 | run in pedantic mode if the uses are carefully marked using the |
| 368 | 413 | `__extension__' keyword. But this is not generally available before |
| 369 | 414 | version 2.8. */ |
| 370 | #if !__GNUC_PREREQ (2,8) | |
| 415 | #if !(__GNUC_PREREQ (2,8) || defined __clang__) | |
| 371 | 416 | # define __extension__		/* Ignore */ |
| 372 | 417 | #endif |
| 373 | 418 | |
| 374 | /* __restrict is known in EGCS 1.2 and above. */ | |
| 375 | #if !__GNUC_PREREQ (2,92) | |
| 419 | /* __restrict is known in EGCS 1.2 and above, and in clang. | |
| 420 | It works also in C++ mode (outside of arrays), but only when spelled | |
| 421 | as '__restrict', not 'restrict'. */ | |
| 422 | #if !(__GNUC_PREREQ (2,92) || __clang_major__ >= 3) | |
| 376 | 423 | # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L |
| 377 | 424 | # define __restrict	restrict |
| 378 | 425 | # else |
| ... | ... | @@ -382,8 +429,9 @@ |
| 382 | 429 | |
| 383 | 430 | /* ISO C99 also allows to declare arrays as non-overlapping. The syntax is |
| 384 | 431 | array_name[restrict] |
| 385 | GCC 3.1 supports this. */ | |
| 386 | #if __GNUC_PREREQ (3,1) && !defined __GNUG__ | |
| 432 | GCC 3.1 and clang support this. | |
| 433 | This syntax is not usable in C++ mode. */ | |
| 434 | #if (__GNUC_PREREQ (3,1) || __clang_major__ >= 3) && !defined __cplusplus | |
| 387 | 435 | # define __restrict_arr	__restrict |
| 388 | 436 | #else |
| 389 | 437 | # ifdef __GNUC__ |
| ... | ... | @@ -398,7 +446,7 @@ |
| 398 | 446 | # endif |
| 399 | 447 | #endif |
| 400 | 448 | |
| 401 | #if __GNUC__ >= 3 | |
| 449 | #if (__GNUC__ >= 3) || __glibc_has_builtin (__builtin_expect) | |
| 402 | 450 | # define __glibc_unlikely(cond)	__builtin_expect ((cond), 0) |
| 403 | 451 | # define __glibc_likely(cond)	__builtin_expect ((cond), 1) |
| 404 | 452 | #else |
| ... | ... | @@ -406,15 +454,10 @@ |
| 406 | 454 | # define __glibc_likely(cond)	(cond) |
| 407 | 455 | #endif |
| 408 | 456 | |
| 409 | #ifdef __has_attribute | |
| 410 | # define __glibc_has_attribute(attr)	__has_attribute (attr) | |
| 411 | #else | |
| 412 | # define __glibc_has_attribute(attr)	0 | |
| 413 | #endif | |
| 414 | ||
| 415 | 457 | #if (!defined _Noreturn \ |
| 416 | 458 | && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ |
| 417 | && !__GNUC_PREREQ (4,7)) | |
| 459 | && !(__GNUC_PREREQ (4,7) \ | |
| 460 | || (3 < __clang_major__ + (5 <= __clang_minor__)))) | |
| 418 | 461 | # if __GNUC_PREREQ (2,8) |
| 419 | 462 | # define _Noreturn __attribute__ ((__noreturn__)) |
| 420 | 463 | # else |
| ... | ... | @@ -443,16 +486,51 @@ |
| 443 | 486 | |
| 444 | 487 | #if (!defined _Static_assert && !defined __cplusplus \ |
| 445 | 488 | && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ |
| 446 | && (!__GNUC_PREREQ (4, 6) || defined __STRICT_ANSI__)) | |
| 489 | && (!(__GNUC_PREREQ (4, 6) || __clang_major__ >= 4) \ | |
| 490 | || defined __STRICT_ANSI__)) | |
| 447 | 491 | # define _Static_assert(expr, diagnostic) \ |
| 448 | 492 | extern int (*__Static_assert_function (void)) \ |
| 449 | 493 | [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })] |
| 450 | 494 | #endif |
| 451 | 495 | |
| 452 | #include <bits/wordsize.h> | |
| 453 | #include <bits/long-double.h> | |
| 496 | /* The #ifndef lets Gnulib avoid including these on non-glibc | |
| 497 | platforms, where the includes typically do not exist. */ | |
| 498 | #ifdef __GLIBC__ | |
| 499 | # include <bits/wordsize.h> | |
| 500 | # include <bits/long-double.h> | |
| 501 | #endif | |
| 502 | ||
| 503 | #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 | |
| 504 | # ifdef __REDIRECT | |
| 505 | ||
| 506 | /* Alias name defined automatically. */ | |
| 507 | # define __LDBL_REDIR(name, proto) ... unused__ldbl_redir | |
| 508 | # define __LDBL_REDIR_DECL(name) \ | |
| 509 | extern __typeof (name) name __asm (__ASMNAME ("__" #name "ieee128")); | |
| 510 | ||
| 511 | /* Alias name defined automatically, with leading underscores. */ | |
| 512 | # define __LDBL_REDIR2_DECL(name) \ | |
| 513 | extern __typeof (__##name) __##name \ | |
| 514 | __asm (__ASMNAME ("__" #name "ieee128")); | |
| 515 | ||
| 516 | /* Alias name defined manually. */ | |
| 517 | # define __LDBL_REDIR1(name, proto, alias) ... unused__ldbl_redir1 | |
| 518 | # define __LDBL_REDIR1_DECL(name, alias) \ | |
| 519 | extern __typeof (name) name __asm (__ASMNAME (#alias)); | |
| 520 | ||
| 521 | # define __LDBL_REDIR1_NTH(name, proto, alias) \ | |
| 522 | __REDIRECT_NTH (name, proto, alias) | |
| 523 | # define __REDIRECT_NTH_LDBL(name, proto, alias) \ | |
| 524 | __LDBL_REDIR1_NTH (name, proto, __##alias##ieee128) | |
| 525 | ||
| 526 | /* Unused. */ | |
| 527 | # define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl | |
| 528 | # define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth | |
| 454 | 529 | |
| 455 | #if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH | |
| 530 | # else | |
| 531 | _Static_assert (0, "IEEE 128-bits long double requires redirection on this platform"); | |
| 532 | # endif | |
| 533 | #elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH | |
| 456 | 534 | # define __LDBL_COMPAT 1 |
| 457 | 535 | # ifdef __REDIRECT |
| 458 | 536 | # define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias) |
| ... | ... | @@ -461,6 +539,8 @@ |
| 461 | 539 | # define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias) |
| 462 | 540 | # define __LDBL_REDIR_NTH(name, proto) \ |
| 463 | 541 | __LDBL_REDIR1_NTH (name, proto, __nldbl_##name) |
| 542 | # define __LDBL_REDIR2_DECL(name) \ | |
| 543 | extern __typeof (__##name) __##name __asm (__ASMNAME ("__nldbl___" #name)); | |
| 464 | 544 | # define __LDBL_REDIR1_DECL(name, alias) \ |
| 465 | 545 | extern __typeof (name) name __asm (__ASMNAME (#alias)); |
| 466 | 546 | # define __LDBL_REDIR_DECL(name) \ |
| ... | ... | @@ -471,11 +551,13 @@ |
| 471 | 551 | __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias) |
| 472 | 552 | # endif |
| 473 | 553 | #endif |
| 474 | #if !defined __LDBL_COMPAT || !defined __REDIRECT | |
| 554 | #if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \ | |
| 555 | || !defined __REDIRECT | |
| 475 | 556 | # define __LDBL_REDIR1(name, proto, alias) name proto |
| 476 | 557 | # define __LDBL_REDIR(name, proto) name proto |
| 477 | 558 | # define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW |
| 478 | 559 | # define __LDBL_REDIR_NTH(name, proto) name proto __THROW |
| 560 | # define __LDBL_REDIR2_DECL(name) | |
| 479 | 561 | # define __LDBL_REDIR_DECL(name) |
| 480 | 562 | # ifdef __REDIRECT |
| 481 | 563 | # define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias) |
| ... | ... | @@ -506,7 +588,7 @@ |
| 506 | 588 | check is required to enable the use of generic selection. */ |
| 507 | 589 | #if !defined __cplusplus \ |
| 508 | 590 | && (__GNUC_PREREQ (4, 9) \ |
| 509 | 	|| __glibc_clang_has_extension (c_generic_selections) \ | |
| 591 | 	|| __glibc_has_extension (c_generic_selections) \ | |
| 510 | 592 | 	|| (!defined __GNUC__ && defined __STDC_VERSION__ \ |
| 511 | 593 | 	 && __STDC_VERSION__ >= 201112L)) |
| 512 | 594 | # define __HAVE_GENERIC_SELECTION 1 |
| ... | ... | @@ -514,4 +596,40 @@ |
| 514 | 596 | # define __HAVE_GENERIC_SELECTION 0 |
| 515 | 597 | #endif |
| 516 | 598 | |
| 599 | #if __GNUC_PREREQ (10, 0) | |
| 600 | /* Designates a 1-based positional argument ref-index of pointer type | |
| 601 | that can be used to access size-index elements of the pointed-to | |
| 602 | array according to access mode, or at least one element when | |
| 603 | size-index is not provided: | |
| 604 | access (access-mode, <ref-index> [, <size-index>]) */ | |
| 605 | # define __attr_access(x) __attribute__ ((__access__ x)) | |
| 606 | # if __GNUC_PREREQ (11, 0) | |
| 607 | # define __attr_access_none(argno) __attribute__ ((__access__ (__none__, argno))) | |
| 608 | # else | |
| 609 | # define __attr_access_none(argno) | |
| 610 | # endif | |
| 611 | #else | |
| 612 | # define __attr_access(x) | |
| 613 | # define __attr_access_none(argno) | |
| 614 | #endif | |
| 615 | ||
| 616 | #if __GNUC_PREREQ (11, 0) | |
| 617 | /* Designates dealloc as a function to call to deallocate objects | |
| 618 | allocated by the declared function. */ | |
| 619 | # define __attr_dealloc(dealloc, argno) \ | |
| 620 | __attribute__ ((__malloc__ (dealloc, argno))) | |
| 621 | # define __attr_dealloc_free __attr_dealloc (__builtin_free, 1) | |
| 622 | #else | |
| 623 | # define __attr_dealloc(dealloc, argno) | |
| 624 | # define __attr_dealloc_free | |
| 625 | #endif | |
| 626 | ||
| 627 | /* Specify that a function such as setjmp or vfork may return | |
| 628 | twice. */ | |
| 629 | #if __GNUC_PREREQ (4, 1) | |
| 630 | # define __attribute_returns_twice__ __attribute__ ((__returns_twice__)) | |
| 631 | #else | |
| 632 | # define __attribute_returns_twice__ /* Ignore. */ | |
| 633 | #endif | |
| 634 | ||
| 517 | 635 | #endif	 /* sys/cdefs.h */ |
lib/libc/glibc/misc/sys/select.h+28-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* `fd_set' type and related macros, and `select'/`pselect' declarations. |
| 2 | Copyright (C) 1996-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1996-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -98,10 +98,23 @@ __BEGIN_DECLS |
| 98 | 98 | |
| 99 | 99 | This function is a cancellation point and therefore not marked with |
| 100 | 100 | __THROW. */ |
| 101 | #ifndef __USE_TIME_BITS64 | |
| 101 | 102 | extern int select (int __nfds, fd_set *__restrict __readfds, |
| 102 | 103 | 		 fd_set *__restrict __writefds, |
| 103 | 104 | 		 fd_set *__restrict __exceptfds, |
| 104 | 105 | 		 struct timeval *__restrict __timeout); |
| 106 | #else | |
| 107 | # ifdef __REDIRECT | |
| 108 | extern int __REDIRECT (select, | |
| 109 | (int __nfds, fd_set *__restrict __readfds, | |
| 110 | fd_set *__restrict __writefds, | |
| 111 | fd_set *__restrict __exceptfds, | |
| 112 | struct timeval *__restrict __timeout), | |
| 113 | __select64); | |
| 114 | # else | |
| 115 | # define select __select64 | |
| 116 | # endif | |
| 117 | #endif | |
| 105 | 118 | |
| 106 | 119 | #ifdef __USE_XOPEN2K |
| 107 | 120 | /* Same as above only that the TIMEOUT value is given with higher |
| ... | ... | @@ -110,11 +123,25 @@ extern int select (int __nfds, fd_set *__restrict __readfds, |
| 110 | 123 | |
| 111 | 124 | This function is a cancellation point and therefore not marked with |
| 112 | 125 | __THROW. */ |
| 126 | # ifndef __USE_TIME_BITS64 | |
| 113 | 127 | extern int pselect (int __nfds, fd_set *__restrict __readfds, |
| 114 | 128 | 		 fd_set *__restrict __writefds, |
| 115 | 129 | 		 fd_set *__restrict __exceptfds, |
| 116 | 130 | 		 const struct timespec *__restrict __timeout, |
| 117 | 131 | 		 const __sigset_t *__restrict __sigmask); |
| 132 | # else | |
| 133 | # ifdef __REDIRECT | |
| 134 | extern int __REDIRECT (pselect, | |
| 135 | (int __nfds, fd_set *__restrict __readfds, | |
| 136 | fd_set *__restrict __writefds, | |
| 137 | fd_set *__restrict __exceptfds, | |
| 138 | const struct timespec *__restrict __timeout, | |
| 139 | const __sigset_t *__restrict __sigmask), | |
| 140 | __pselect64); | |
| 141 | # else | |
| 142 | # define pselect __pselect64 | |
| 143 | # endif | |
| 144 | # endif | |
| 118 | 145 | #endif |
| 119 | 146 | |
| 120 | 147 |
lib/libc/glibc/nptl/pthread_atfork.c deleted-61| ... | ... | @@ -1,61 +0,0 @@ |
| 1 | /* Copyright (C) 2002-2020 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | In addition to the permissions in the GNU Lesser General Public | |
| 11 | License, the Free Software Foundation gives you unlimited | |
| 12 | permission to link the compiled version of this file with other | |
| 13 | programs, and to distribute those programs without any restriction | |
| 14 | coming from the use of this file. (The GNU Lesser General Public | |
| 15 | License restrictions do apply in other respects; for example, they | |
| 16 | cover modification of the file, and distribution when not linked | |
| 17 | into another program.) | |
| 18 | ||
| 19 | Note that people who make modified versions of this file are not | |
| 20 | obligated to grant this special exception for their modified | |
| 21 | versions; it is their choice whether to do so. The GNU Lesser | |
| 22 | General Public License gives permission to release a modified | |
| 23 | version without this exception; this exception also makes it | |
| 24 | possible to release a modified version which carries forward this | |
| 25 | exception. | |
| 26 | ||
| 27 | The GNU C Library is distributed in the hope that it will be useful, | |
| 28 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 29 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 30 | Lesser General Public License for more details. | |
| 31 | ||
| 32 | You should have received a copy of the GNU Lesser General Public | |
| 33 | License along with the GNU C Library; if not, see | |
| 34 | <https://www.gnu.org/licenses/>. */ | |
| 35 | ||
| 36 | extern int __pthread_atfork (void (*prepare) (void), void (*parent) (void), | |
| 37 | void (*child) (void)); | |
| 38 | extern int __register_atfork (void (*__prepare) (void), | |
| 39 | void (*__parent) (void), | |
| 40 | void (*__child) (void), | |
| 41 | void *dso_handle); | |
| 42 | libc_hidden_proto (__register_atfork) | |
| 43 | extern void *__dso_handle __attribute__ ((__visibility__ ("hidden"))); | |
| 44 | ||
| 45 | /* Hide the symbol so that no definition but the one locally in the | |
| 46 | executable or DSO is used. */ | |
| 47 | int | |
| 48 | #ifndef __pthread_atfork | |
| 49 | /* Don't mark the compatibility function as hidden. */ | |
| 50 | attribute_hidden | |
| 51 | #endif | |
| 52 | __pthread_atfork (void (*prepare) (void), void (*parent) (void), | |
| 53 | 		 void (*child) (void)) | |
| 54 | { | |
| 55 | return __register_atfork (prepare, parent, child, __dso_handle); | |
| 56 | } | |
| 57 | #ifndef __pthread_atfork | |
| 58 | extern int pthread_atfork (void (*prepare) (void), void (*parent) (void), | |
| 59 | 			 void (*child) (void)) attribute_hidden; | |
| 60 | weak_alias (__pthread_atfork, pthread_atfork) | |
| 61 | #endif |
lib/libc/glibc/posix/bits/cpu-set.h+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | /* Definition of the cpu_set_t structure used by the POSIX 1003.1b-1993 |
| 2 | 2 | scheduling interface. |
| 3 | Copyright (C) 1996-2020 Free Software Foundation, Inc. | |
| 3 | Copyright (C) 1996-2021 Free Software Foundation, Inc. | |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 | |
| 6 | 6 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/posix/bits/types.h+2-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* bits/types.h -- definitions of __*_t types underlying *_t types. |
| 2 | Copyright (C) 2002-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2002-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -160,6 +160,7 @@ __STD_TYPE __ID_T_TYPE __id_t;		/* General type for IDs. */ |
| 160 | 160 | __STD_TYPE __TIME_T_TYPE __time_t;	/* Seconds since the Epoch. */ |
| 161 | 161 | __STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds. */ |
| 162 | 162 | __STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds. */ |
| 163 | __STD_TYPE __SUSECONDS64_T_TYPE __suseconds64_t; | |
| 163 | 164 | |
| 164 | 165 | __STD_TYPE __DADDR_T_TYPE __daddr_t;	/* The type of a disk address. */ |
| 165 | 166 | __STD_TYPE __KEY_T_TYPE __key_t;	/* Type of an IPC key. */ |
lib/libc/glibc/posix/sys/types.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1991-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1991-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/signal/signal.h+32-15| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1991-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1991-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -27,7 +27,7 @@ |
| 27 | 27 | __BEGIN_DECLS |
| 28 | 28 | |
| 29 | 29 | #include <bits/types.h> |
| 30 | #include <bits/signum.h> | |
| 30 | #include <bits/signum-generic.h> | |
| 31 | 31 | |
| 32 | 32 | #include <bits/types/sig_atomic_t.h> |
| 33 | 33 | |
| ... | ... | @@ -148,7 +148,8 @@ extern void psiginfo (const siginfo_t *__pinfo, const char *__s); |
| 148 | 148 | |
| 149 | 149 | #ifdef __USE_XOPEN_EXTENDED |
| 150 | 150 | # ifdef __GNUC__ |
| 151 | extern int sigpause (int __sig) __asm__ ("__xpg_sigpause"); | |
| 151 | extern int sigpause (int __sig) __asm__ ("__xpg_sigpause") | |
| 152 | __attribute_deprecated_msg__ ("Use the sigsuspend function instead"); | |
| 152 | 153 | # else |
| 153 | 154 | extern int __sigpause (int __sig_or_mask, int __is_sig); |
| 154 | 155 | /* Remove a signal from the signal mask and suspend the process. */ |
| ... | ... | @@ -164,7 +165,9 @@ extern int __sigpause (int __sig_or_mask, int __is_sig); |
| 164 | 165 | simply do not work in many situations. Use `sigprocmask' instead. */ |
| 165 | 166 | |
| 166 | 167 | /* Compute mask for signal SIG. */ |
| 167 | # define sigmask(sig) ((int)(1u << ((sig) - 1))) | |
| 168 | # define sigmask(sig) \ | |
| 169 | __glibc_macro_warning ("sigmask is deprecated") \ | |
| 170 | ((int)(1u << ((sig) - 1))) | |
| 168 | 171 | |
| 169 | 172 | /* Block signals in MASK, returning the old mask. */ |
| 170 | 173 | extern int sigblock (int __mask) __THROW __attribute_deprecated__; |
| ... | ... | @@ -266,10 +269,23 @@ extern int sigwaitinfo (const sigset_t *__restrict __set, |
| 266 | 269 | |
| 267 | 270 | This function is a cancellation point and therefore not marked with |
| 268 | 271 | __THROW. */ |
| 272 | # ifndef __USE_TIME_BITS64 | |
| 269 | 273 | extern int sigtimedwait (const sigset_t *__restrict __set, |
| 270 | 274 | 			 siginfo_t *__restrict __info, |
| 271 | 275 | 			 const struct timespec *__restrict __timeout) |
| 272 | 276 | __nonnull ((1)); |
| 277 | # else | |
| 278 | # ifdef __REDIRECT | |
| 279 | extern int __REDIRECT (sigtimedwait, | |
| 280 | (const sigset_t *__restrict __set, | |
| 281 | siginfo_t *__restrict __info, | |
| 282 | const struct timespec *__restrict __timeout), | |
| 283 | __sigtimedwait64) | |
| 284 | __nonnull ((1)); | |
| 285 | # else | |
| 286 | # define sigtimedwait __sigtimedwait64 | |
| 287 | # endif | |
| 288 | # endif | |
| 273 | 289 | |
| 274 | 290 | /* Send signal SIG to the process PID. Associate data in VAL with the |
| 275 | 291 | signal. */ |
| ... | ... | @@ -281,12 +297,6 @@ extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val) |
| 281 | 297 | |
| 282 | 298 | #ifdef __USE_MISC |
| 283 | 299 | |
| 284 | /* Names of the signals. This variable exists only for compatibility. | |
| 285 | Use `strsignal' instead (see <string.h>). */ | |
| 286 | extern const char *const _sys_siglist[_NSIG]; | |
| 287 | extern const char *const sys_siglist[_NSIG]; | |
| 288 | ||
| 289 | ||
| 290 | 300 | /* Get machine-dependent `struct sigcontext' and signal subcodes. */ |
| 291 | 301 | # include <bits/sigcontext.h> |
| 292 | 302 | |
| ... | ... | @@ -311,9 +321,11 @@ extern int sigreturn (struct sigcontext *__scp) __THROW; |
| 311 | 321 | /* If INTERRUPT is nonzero, make signal SIG interrupt system calls |
| 312 | 322 | (causing them to fail with EINTR); if INTERRUPT is zero, make system |
| 313 | 323 | calls be restarted after signal SIG. */ |
| 314 | extern int siginterrupt (int __sig, int __interrupt) __THROW; | |
| 324 | extern int siginterrupt (int __sig, int __interrupt) __THROW | |
| 325 | __attribute_deprecated_msg__ ("Use sigaction with SA_RESTART instead"); | |
| 315 | 326 | |
| 316 | 327 | # include <bits/sigstack.h> |
| 328 | # include <bits/sigstksz.h> | |
| 317 | 329 | # include <bits/ss_flags.h> |
| 318 | 330 | |
| 319 | 331 | /* Alternate signal handler stack interface. |
| ... | ... | @@ -340,16 +352,21 @@ extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) |
| 340 | 352 | /* Simplified interface for signal management. */ |
| 341 | 353 | |
| 342 | 354 | /* Add SIG to the calling process' signal mask. */ |
| 343 | extern int sighold (int __sig) __THROW; | |
| 355 | extern int sighold (int __sig) __THROW | |
| 356 | __attribute_deprecated_msg__ ("Use the sigprocmask function instead"); | |
| 344 | 357 | |
| 345 | 358 | /* Remove SIG from the calling process' signal mask. */ |
| 346 | extern int sigrelse (int __sig) __THROW; | |
| 359 | extern int sigrelse (int __sig) __THROW | |
| 360 | __attribute_deprecated_msg__ ("Use the sigprocmask function instead"); | |
| 347 | 361 | |
| 348 | 362 | /* Set the disposition of SIG to SIG_IGN. */ |
| 349 | extern int sigignore (int __sig) __THROW; | |
| 363 | extern int sigignore (int __sig) __THROW | |
| 364 | __attribute_deprecated_msg__ ("Use the signal function instead"); | |
| 350 | 365 | |
| 351 | 366 | /* Set the disposition of SIG. */ |
| 352 | extern __sighandler_t sigset (int __sig, __sighandler_t __disp) __THROW; | |
| 367 | extern __sighandler_t sigset (int __sig, __sighandler_t __disp) __THROW | |
| 368 | __attribute_deprecated_msg__ | |
| 369 | ("Use the signal and sigprocmask functions instead"); | |
| 353 | 370 | #endif |
| 354 | 371 | |
| 355 | 372 | #if defined __USE_POSIX199506 || defined __USE_UNIX98 |
lib/libc/glibc/stdlib/alloca.h+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1992-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | |
| 26 | 26 | __BEGIN_DECLS |
| 27 | 27 | |
| 28 | /* Remove any previous definitions. */ | |
| 28 | /* Remove any previous definition. */ | |
| 29 | 29 | #undef	alloca |
| 30 | 30 | |
| 31 | 31 | /* Allocate a block that will be freed when the calling function exits. */ |
lib/libc/glibc/stdlib/at_quick_exit.c+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1991-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1991-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/stdlib/atexit.c+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1991-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1991-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/stdlib/bits/stdlib-float.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Floating-point inline functions for stdlib.h. |
| 2 | Copyright (C) 2012-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2012-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/stdlib/errno.h created+55| ... | ... | @@ -0,0 +1,55 @@ |
| 1 | /* Copyright (C) 1991-2021 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library; if not, see | |
| 16 | <https://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | /* | |
| 19 | *	ISO C99 Standard: 7.5 Errors	<errno.h> | |
| 20 | */ | |
| 21 | ||
| 22 | #ifndef	_ERRNO_H | |
| 23 | #define	_ERRNO_H 1 | |
| 24 | ||
| 25 | #include <features.h> | |
| 26 | ||
| 27 | /* The system-specific definitions of the E* constants, as macros. */ | |
| 28 | #include <bits/errno.h> | |
| 29 | ||
| 30 | /* When included from assembly language, this header only provides the | |
| 31 | E* constants. */ | |
| 32 | #ifndef __ASSEMBLER__ | |
| 33 | ||
| 34 | __BEGIN_DECLS | |
| 35 | ||
| 36 | /* The error code set by various library functions. */ | |
| 37 | extern int *__errno_location (void) __THROW __attribute_const__; | |
| 38 | # define errno (*__errno_location ()) | |
| 39 | ||
| 40 | # ifdef __USE_GNU | |
| 41 | ||
| 42 | /* The full and simple forms of the name with which the program was | |
| 43 | invoked. These variables are set up automatically at startup based on | |
| 44 | the value of argv[0]. */ | |
| 45 | extern char *program_invocation_name; | |
| 46 | extern char *program_invocation_short_name; | |
| 47 | ||
| 48 | #include <bits/types/error_t.h> | |
| 49 | ||
| 50 | # endif /* __USE_GNU */ | |
| 51 | ||
| 52 | __END_DECLS | |
| 53 | ||
| 54 | #endif /* !__ASSEMBLER__ */ | |
| 55 | #endif /* errno.h */ |
lib/libc/glibc/stdlib/exit.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1991-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1991-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/stdlib/stdlib.h+21-12| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1991-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1991-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -397,7 +397,7 @@ extern long int a64l (const char *__s) |
| 397 | 397 | `initstate' and `setstate' functions are those from BSD Unices. |
| 398 | 398 | The `rand' and `srand' functions are required by the ANSI standard. |
| 399 | 399 | We provide both interfaces to the same random number generator. */ |
| 400 | /* Return a random long integer between 0 and RAND_MAX inclusive. */ | |
| 400 | /* Return a random long integer between 0 and 2^31-1 inclusive. */ | |
| 401 | 401 | extern long int random (void) __THROW; |
| 402 | 402 | |
| 403 | 403 | /* Seed the random number generator with the given number. */ |
| ... | ... | @@ -550,6 +550,9 @@ extern void *calloc (size_t __nmemb, size_t __size) |
| 550 | 550 | extern void *realloc (void *__ptr, size_t __size) |
| 551 | 551 | __THROW __attribute_warn_unused_result__ __attribute_alloc_size__ ((2)); |
| 552 | 552 | |
| 553 | /* Free a block allocated by `malloc', `realloc' or `calloc'. */ | |
| 554 | extern void free (void *__ptr) __THROW; | |
| 555 | ||
| 553 | 556 | #ifdef __USE_MISC |
| 554 | 557 | /* Re-allocate the previously allocated block in PTR, making the new |
| 555 | 558 | block large enough for NMEMB elements of SIZE bytes each. */ |
| ... | ... | @@ -558,11 +561,13 @@ extern void *realloc (void *__ptr, size_t __size) |
| 558 | 561 | between objects pointed by the old and new pointers. */ |
| 559 | 562 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size) |
| 560 | 563 | __THROW __attribute_warn_unused_result__ |
| 561 | __attribute_alloc_size__ ((2, 3)); | |
| 562 | #endif | |
| 564 | __attribute_alloc_size__ ((2, 3)) | |
| 565 | __attr_dealloc_free; | |
| 563 | 566 | |
| 564 | /* Free a block allocated by `malloc', `realloc' or `calloc'. */ | |
| 565 | extern void free (void *__ptr) __THROW; | |
| 567 | /* Add reallocarray as its own deallocator. */ | |
| 568 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size) | |
| 569 | __THROW __attr_dealloc (reallocarray, 1); | |
| 570 | #endif | |
| 566 | 571 | |
| 567 | 572 | #ifdef __USE_MISC |
| 568 | 573 | # include <alloca.h> |
| ... | ... | @@ -788,7 +793,8 @@ extern int system (const char *__command) __wur; |
| 788 | 793 | /* Return a malloc'd string containing the canonical absolute name of the |
| 789 | 794 | existing named file. */ |
| 790 | 795 | extern char *canonicalize_file_name (const char *__name) |
| 791 | __THROW __nonnull ((1)) __wur; | |
| 796 | __THROW __nonnull ((1)) __attribute_malloc__ | |
| 797 | __attr_dealloc_free __wur; | |
| 792 | 798 | #endif |
| 793 | 799 | |
| 794 | 800 | #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED |
| ... | ... | @@ -931,12 +937,13 @@ extern int wctomb (char *__s, wchar_t __wchar) __THROW; |
| 931 | 937 | |
| 932 | 938 | /* Convert a multibyte string to a wide char string. */ |
| 933 | 939 | extern size_t mbstowcs (wchar_t *__restrict __pwcs, |
| 934 | 			const char *__restrict __s, size_t __n) __THROW; | |
| 940 | 			const char *__restrict __s, size_t __n) __THROW | |
| 941 | __attr_access ((__read_only__, 2)); | |
| 935 | 942 | /* Convert a wide char string to multibyte string. */ |
| 936 | 943 | extern size_t wcstombs (char *__restrict __s, |
| 937 | 944 | 			const wchar_t *__restrict __pwcs, size_t __n) |
| 938 | __THROW; | |
| 939 | ||
| 945 | __THROW | |
| 946 | __attr_access ((__write_only__, 1, 3)) __attr_access ((__read_only__, 2)); | |
| 940 | 947 | |
| 941 | 948 | #ifdef __USE_MISC |
| 942 | 949 | /* Determine whether the string value of RESPONSE matches the affirmation |
| ... | ... | @@ -990,7 +997,7 @@ extern char *ptsname (int __fd) __THROW __wur; |
| 990 | 997 | terminal associated with the master FD is open on in BUF. |
| 991 | 998 | Return 0 on success, otherwise an error number. */ |
| 992 | 999 | extern int ptsname_r (int __fd, char *__buf, size_t __buflen) |
| 993 | __THROW __nonnull ((2)); | |
| 1000 | __THROW __nonnull ((2)) __attr_access ((__write_only__, 2, 3)); | |
| 994 | 1001 | |
| 995 | 1002 | /* Open a master pseudo terminal and return its file descriptor. */ |
| 996 | 1003 | extern int getpt (void); |
| ... | ... | @@ -1016,7 +1023,9 @@ extern int ttyslot (void) __THROW; |
| 1016 | 1023 | #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function |
| 1017 | 1024 | # include <bits/stdlib.h> |
| 1018 | 1025 | #endif |
| 1019 | #ifdef __LDBL_COMPAT | |
| 1026 | ||
| 1027 | #include <bits/floatn.h> | |
| 1028 | #if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 | |
| 1020 | 1029 | # include <bits/stdlib-ldbl.h> |
| 1021 | 1030 | #endif |
| 1022 | 1031 |
lib/libc/glibc/string/bits/endian.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Endian macros for string.h functions |
| 2 | Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1992-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/string/endian.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1992-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/aarch64/crti.S+11-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for AArch64. |
| 2 | Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 3 | 3 | |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 | |
| ... | ... | @@ -75,6 +75,11 @@ call_weak_fn: |
| 75 | 75 | 	.hidden	_init |
| 76 | 76 | 	.type	_init, %function |
| 77 | 77 | _init: |
| 78 | #if HAVE_AARCH64_PAC_RET | |
| 79 | 	PACIASP | |
| 80 | #else | |
| 81 | 	BTI_C | |
| 82 | #endif | |
| 78 | 83 | 	stp	x29, x30, [sp, -16]! |
| 79 | 84 | 	mov	x29, sp |
| 80 | 85 | #if PREINIT_FUNCTION_WEAK |
| ... | ... | @@ -89,5 +94,10 @@ _init: |
| 89 | 94 | 	.hidden	_fini |
| 90 | 95 | 	.type	_fini, %function |
| 91 | 96 | _fini: |
| 97 | #if HAVE_AARCH64_PAC_RET | |
| 98 | 	PACIASP | |
| 99 | #else | |
| 100 | 	BTI_C | |
| 101 | #endif | |
| 92 | 102 | 	stp	x29, x30, [sp, -16]! |
| 93 | 103 | 	mov	x29, sp |
lib/libc/glibc/sysdeps/aarch64/crtn.S+9-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for AArch64. |
| 2 | Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 3 | 3 | |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 | |
| ... | ... | @@ -37,10 +37,18 @@ |
| 37 | 37 | /* crtn.S puts function epilogues in the .init and .fini sections |
| 38 | 38 | corresponding to the prologues in crti.S. */ |
| 39 | 39 | |
| 40 | #include <sysdep.h> | |
| 41 | ||
| 40 | 42 | 	.section .init,"ax",%progbits |
| 41 | 43 | 	ldp	x29, x30, [sp], 16 |
| 44 | #if HAVE_AARCH64_PAC_RET | |
| 45 | 	AUTIASP | |
| 46 | #endif | |
| 42 | 47 | 	RET |
| 43 | 48 | |
| 44 | 49 | 	.section .fini,"ax",%progbits |
| 45 | 50 | 	ldp	x29, x30, [sp], 16 |
| 51 | #if HAVE_AARCH64_PAC_RET | |
| 52 | 	AUTIASP | |
| 53 | #endif | |
| 46 | 54 | 	RET |
lib/libc/glibc/sysdeps/aarch64/dl-sysdep.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 2002-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 2002-2021 Free Software Foundation, Inc. | |
| 2 | 2 | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 |
lib/libc/glibc/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 2002-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 2002-2021 Free Software Foundation, Inc. | |
| 2 | 2 | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 |
lib/libc/glibc/sysdeps/aarch64/start.S+7-16| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 2 | 2 | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| ... | ... | @@ -43,10 +43,9 @@ |
| 43 | 43 | */ |
| 44 | 44 | |
| 45 | 45 | 	.text |
| 46 | 	.globl _start | |
| 47 | 	.type _start,#function | |
| 48 | _start: | |
| 46 | ENTRY(_start) | |
| 49 | 47 | 	/* Create an initial frame with 0 LR and FP */ |
| 48 | 	cfi_undefined (x30) | |
| 50 | 49 | 	mov	x29, #0 |
| 51 | 50 | 	mov	x30, #0 |
| 52 | 51 | |
| ... | ... | @@ -64,26 +63,16 @@ _start: |
| 64 | 63 | # ifdef SHARED |
| 65 | 64 | adrp x0, :got:main |
| 66 | 65 | 	ldr PTR_REG (0), [x0, #:got_lo12:main] |
| 67 | ||
| 68 | adrp x3, :got:__libc_csu_init | |
| 69 | 	ldr PTR_REG (3), [x3, #:got_lo12:__libc_csu_init] | |
| 70 | ||
| 71 | adrp x4, :got:__libc_csu_fini | |
| 72 | 	ldr PTR_REG (4), [x4, #:got_lo12:__libc_csu_fini] | |
| 73 | 66 | # else |
| 74 | 67 | 	adrp	x0, __wrap_main |
| 75 | 68 | 	add	x0, x0, :lo12:__wrap_main |
| 76 | 	adrp	x3, __libc_csu_init | |
| 77 | 	add	x3, x3, :lo12:__libc_csu_init | |
| 78 | 	adrp	x4, __libc_csu_fini | |
| 79 | 	add	x4, x4, :lo12:__libc_csu_fini | |
| 80 | 69 | # endif |
| 81 | 70 | #else |
| 82 | 71 | 	/* Set up the other arguments in registers */ |
| 83 | 72 | 	MOVL (0, main) |
| 84 | 	MOVL (3, __libc_csu_init) | |
| 85 | 	MOVL (4, __libc_csu_fini) | |
| 86 | 73 | #endif |
| 74 | 	mov	x3, #0		/* Used to be init. */ | |
| 75 | 	mov	x4, #0		/* Used to be fini. */ | |
| 87 | 76 | |
| 88 | 77 | 	/* __libc_start_main (main, argc, argv, init, fini, rtld_fini, |
| 89 | 78 | 			 stack_end) */ |
| ... | ... | @@ -100,8 +89,10 @@ _start: |
| 100 | 89 | 	 because crt1.o and rcrt1.o share code and the later must avoid the |
| 101 | 90 | 	 use of GOT relocations before __libc_start_main is called. */ |
| 102 | 91 | __wrap_main: |
| 92 | 	BTI_C | |
| 103 | 93 | 	b	main |
| 104 | 94 | #endif |
| 95 | END(_start) | |
| 105 | 96 | |
| 106 | 97 | 	/* Define a symbol for the first piece of initialized data. */ |
| 107 | 98 | 	.data |
lib/libc/glibc/sysdeps/aarch64/sysdep.h+68-5| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1997-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1997-2021 Free Software Foundation, Inc. | |
| 2 | 2 | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| ... | ... | @@ -25,29 +25,90 @@ |
| 25 | 25 | # define AARCH64_R(NAME)	R_AARCH64_ ## NAME |
| 26 | 26 | # define PTR_REG(n)		x##n |
| 27 | 27 | # define PTR_LOG_SIZE		3 |
| 28 | # define DELOUSE(n) | |
| 28 | # define PTR_ARG(n) | |
| 29 | # define SIZE_ARG(n) | |
| 29 | 30 | #else |
| 30 | 31 | # define AARCH64_R(NAME)	R_AARCH64_P32_ ## NAME |
| 31 | 32 | # define PTR_REG(n)		w##n |
| 32 | 33 | # define PTR_LOG_SIZE		2 |
| 33 | # define DELOUSE(n)		mov w##n, w##n | |
| 34 | # define PTR_ARG(n)		mov w##n, w##n | |
| 35 | # define SIZE_ARG(n)		mov w##n, w##n | |
| 34 | 36 | #endif |
| 35 | 37 | |
| 36 | 38 | #define PTR_SIZE	(1<<PTR_LOG_SIZE) |
| 37 | 39 | |
| 40 | #ifndef __ASSEMBLER__ | |
| 41 | /* Strip pointer authentication code from pointer p. */ | |
| 42 | static inline void * | |
| 43 | strip_pac (void *p) | |
| 44 | { | |
| 45 | register void *ra asm ("x30") = (p); | |
| 46 | asm ("hint 7 // xpaclri" : "+r"(ra)); | |
| 47 | return ra; | |
| 48 | } | |
| 49 | ||
| 50 | /* This is needed when glibc is built with -mbranch-protection=pac-ret | |
| 51 | with a gcc that is affected by PR target/94891. */ | |
| 52 | # if HAVE_AARCH64_PAC_RET | |
| 53 | # undef RETURN_ADDRESS | |
| 54 | # define RETURN_ADDRESS(n) strip_pac (__builtin_return_address (n)) | |
| 55 | # endif | |
| 56 | #endif | |
| 57 | ||
| 38 | 58 | #ifdef	__ASSEMBLER__ |
| 39 | 59 | |
| 40 | 60 | /* Syntactic details of assembler. */ |
| 41 | 61 | |
| 42 | 62 | #define ASM_SIZE_DIRECTIVE(name) .size name,.-name |
| 43 | 63 | |
| 64 | /* Branch Target Identitication support. */ | |
| 65 | #if HAVE_AARCH64_BTI | |
| 66 | # define BTI_C		hint	34 | |
| 67 | # define BTI_J		hint	36 | |
| 68 | #else | |
| 69 | # define BTI_C		nop | |
| 70 | # define BTI_J		nop | |
| 71 | #endif | |
| 72 | ||
| 73 | /* Return address signing support (pac-ret). */ | |
| 74 | #define PACIASP		hint	25 | |
| 75 | #define AUTIASP		hint	29 | |
| 76 | ||
| 77 | /* GNU_PROPERTY_AARCH64_* macros from elf.h for use in asm code. */ | |
| 78 | #define FEATURE_1_AND 0xc0000000 | |
| 79 | #define FEATURE_1_BTI 1 | |
| 80 | #define FEATURE_1_PAC 2 | |
| 81 | ||
| 82 | /* Add a NT_GNU_PROPERTY_TYPE_0 note. */ | |
| 83 | #define GNU_PROPERTY(type, value)	\ | |
| 84 | .section .note.gnu.property, "a";	\ | |
| 85 | .p2align 3;				\ | |
| 86 | .word 4;				\ | |
| 87 | .word 16;				\ | |
| 88 | .word 5;				\ | |
| 89 | .asciz "GNU";				\ | |
| 90 | .word type;				\ | |
| 91 | .word 4;				\ | |
| 92 | .word value;				\ | |
| 93 | .word 0;				\ | |
| 94 | .text | |
| 95 | ||
| 96 | /* Add GNU property note with the supported features to all asm code | |
| 97 | where sysdep.h is included. */ | |
| 98 | #if HAVE_AARCH64_BTI && HAVE_AARCH64_PAC_RET | |
| 99 | GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_PAC) | |
| 100 | #elif HAVE_AARCH64_BTI | |
| 101 | GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI) | |
| 102 | #endif | |
| 103 | ||
| 44 | 104 | /* Define an entry point visible from C. */ |
| 45 | 105 | #define ENTRY(name)						\ |
| 46 | 106 | .globl C_SYMBOL_NAME(name);					\ |
| 47 | 107 | .type C_SYMBOL_NAME(name),%function;				\ |
| 48 | .align 4;							\ | |
| 108 | .p2align 6;							\ | |
| 49 | 109 | C_LABEL(name)							\ |
| 50 | 110 | cfi_startproc;						\ |
| 111 | BTI_C;							\ | |
| 51 | 112 | CALL_MCOUNT |
| 52 | 113 | |
| 53 | 114 | /* Define an entry point visible from C. */ |
| ... | ... | @@ -57,6 +118,7 @@ |
| 57 | 118 | .p2align align;						\ |
| 58 | 119 | C_LABEL(name)							\ |
| 59 | 120 | cfi_startproc;						\ |
| 121 | BTI_C;							\ | |
| 60 | 122 | CALL_MCOUNT |
| 61 | 123 | |
| 62 | 124 | /* Define an entry point visible from C with a specified alignment and |
| ... | ... | @@ -68,11 +130,12 @@ |
| 68 | 130 | .globl C_SYMBOL_NAME(name);					\ |
| 69 | 131 | .type C_SYMBOL_NAME(name),%function;				\ |
| 70 | 132 | .p2align align;						\ |
| 71 | .rep padding;							\ | |
| 133 | .rep padding - 1; /* -1 for bti c. */			\ | |
| 72 | 134 | nop;								\ |
| 73 | 135 | .endr;							\ |
| 74 | 136 | C_LABEL(name)							\ |
| 75 | 137 | cfi_startproc;						\ |
| 138 | BTI_C;							\ | |
| 76 | 139 | CALL_MCOUNT |
| 77 | 140 | |
| 78 | 141 | #undef	END |
lib/libc/glibc/sysdeps/alpha/crti.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for Alpha. |
| 2 | Copyright (C) 2001-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2001-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/alpha/crtn.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for Alpha. |
| 2 | Copyright (C) 2001-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2001-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/alpha/dl-sysdep.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* System-specific settings for dynamic linker code. Alpha version. |
| 2 | Copyright (C) 2002-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2002-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h deleted-61| ... | ... | @@ -1,61 +0,0 @@ |
| 1 | /* Machine-specific pthread type layouts. Alpha version. | |
| 2 | Copyright (C) 2003-2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library. If not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _BITS_PTHREADTYPES_ARCH_H | |
| 20 | #define _BITS_PTHREADTYPES_ARCH_H	1 | |
| 21 | ||
| 22 | #define __SIZEOF_PTHREAD_ATTR_T		56 | |
| 23 | #define __SIZEOF_PTHREAD_MUTEX_T	40 | |
| 24 | #define __SIZEOF_PTHREAD_MUTEXATTR_T	4 | |
| 25 | #define __SIZEOF_PTHREAD_COND_T		48 | |
| 26 | #define __SIZEOF_PTHREAD_CONDATTR_T	4 | |
| 27 | #define __SIZEOF_PTHREAD_RWLOCK_T	56 | |
| 28 | #define __SIZEOF_PTHREAD_RWLOCKATTR_T	8 | |
| 29 | #define __SIZEOF_PTHREAD_BARRIER_T	32 | |
| 30 | #define __SIZEOF_PTHREAD_BARRIERATTR_T	4 | |
| 31 | ||
| 32 | /* Definitions for internal mutex struct. */ | |
| 33 | #define __PTHREAD_COMPAT_PADDING_MID | |
| 34 | #define __PTHREAD_COMPAT_PADDING_END | |
| 35 | #define __PTHREAD_MUTEX_LOCK_ELISION 0 | |
| 36 | #define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0 | |
| 37 | #define __PTHREAD_MUTEX_USE_UNION 0 | |
| 38 | ||
| 39 | #define __LOCK_ALIGNMENT | |
| 40 | #define __ONCE_ALIGNMENT | |
| 41 | ||
| 42 | struct __pthread_rwlock_arch_t | |
| 43 | { | |
| 44 | unsigned int __readers; | |
| 45 | unsigned int __writers; | |
| 46 | unsigned int __wrphase_futex; | |
| 47 | unsigned int __writers_futex; | |
| 48 | unsigned int __pad3; | |
| 49 | unsigned int __pad4; | |
| 50 | int __cur_writer; | |
| 51 | int __shared; | |
| 52 | unsigned long int __pad1; | |
| 53 | unsigned long int __pad2; | |
| 54 | /* FLAGS must stay at this position in the structure to maintain | |
| 55 | binary compatibility. */ | |
| 56 | unsigned int __flags; | |
| 57 | }; | |
| 58 | ||
| 59 | #define __PTHREAD_RWLOCK_ELISION_EXTRA 0 | |
| 60 | ||
| 61 | #endif	/* bits/pthreadtypes.h */ |
lib/libc/glibc/sysdeps/alpha/start.S+3-4| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Startup code for Alpha/ELF. |
| 2 | Copyright (C) 1993-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1993-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | Contributed by Richard Henderson <rth@tamu.edu> |
| 5 | 5 | |
| ... | ... | @@ -55,9 +55,8 @@ _start: |
| 55 | 55 | 	ldl	a1, 16(sp)	/* get argc */ |
| 56 | 56 | 	lda	a2, 24(sp)	/* get argv */ |
| 57 | 57 | |
| 58 | /* Load address of our own entry points to .fini and .init. */ | |
| 59 | 	lda	a3, __libc_csu_init | |
| 60 | 	lda	a4, __libc_csu_fini | |
| 58 | 	mov	$r31, a3 	/* Used to be init. */ | |
| 59 | 	mov	$r31, a4 	/* Used to be fini. */ | |
| 61 | 60 | |
| 62 | 61 | /* Store address of the shared library termination function. */ |
| 63 | 62 | 	mov	v0, a5 |
lib/libc/glibc/sysdeps/arm/crti.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for ARM. |
| 2 | Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/arm/crtn.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for ARM. |
| 2 | Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/arm/dl-sysdep.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* System-specific settings for dynamic linker code. Alpha version. |
| 2 | Copyright (C) 2002-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2002-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/arm/nptl/bits/pthreadtypes-arch.h deleted-71| ... | ... | @@ -1,71 +0,0 @@ |
| 1 | /* Copyright (C) 2002-2019 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library. If not, see | |
| 16 | <http://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | #ifndef _BITS_PTHREADTYPES_ARCH_H | |
| 19 | #define _BITS_PTHREADTYPES_ARCH_H	1 | |
| 20 | ||
| 21 | #include <endian.h> | |
| 22 | ||
| 23 | #define __SIZEOF_PTHREAD_ATTR_T 36 | |
| 24 | #define __SIZEOF_PTHREAD_MUTEX_T 24 | |
| 25 | #define __SIZEOF_PTHREAD_MUTEXATTR_T 4 | |
| 26 | #define __SIZEOF_PTHREAD_COND_T 48 | |
| 27 | #define __SIZEOF_PTHREAD_CONDATTR_T 4 | |
| 28 | #define __SIZEOF_PTHREAD_RWLOCK_T 32 | |
| 29 | #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 | |
| 30 | #define __SIZEOF_PTHREAD_BARRIER_T 20 | |
| 31 | #define __SIZEOF_PTHREAD_BARRIERATTR_T 4 | |
| 32 | ||
| 33 | /* Data structure for mutex handling. */ | |
| 34 | #define __PTHREAD_COMPAT_PADDING_MID | |
| 35 | #define __PTHREAD_COMPAT_PADDING_END | |
| 36 | #define __PTHREAD_MUTEX_LOCK_ELISION 0 | |
| 37 | #define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1 | |
| 38 | #define __PTHREAD_MUTEX_USE_UNION 1 | |
| 39 | ||
| 40 | #define __LOCK_ALIGNMENT | |
| 41 | #define __ONCE_ALIGNMENT | |
| 42 | ||
| 43 | struct __pthread_rwlock_arch_t | |
| 44 | { | |
| 45 | unsigned int __readers; | |
| 46 | unsigned int __writers; | |
| 47 | unsigned int __wrphase_futex; | |
| 48 | unsigned int __writers_futex; | |
| 49 | unsigned int __pad3; | |
| 50 | unsigned int __pad4; | |
| 51 | #if __BYTE_ORDER == __BIG_ENDIAN | |
| 52 | unsigned char __pad1; | |
| 53 | unsigned char __pad2; | |
| 54 | unsigned char __shared; | |
| 55 | /* FLAGS must stay at this position in the structure to maintain | |
| 56 | binary compatibility. */ | |
| 57 | unsigned char __flags; | |
| 58 | #else | |
| 59 | /* FLAGS must stay at this position in the structure to maintain | |
| 60 | binary compatibility. */ | |
| 61 | unsigned char __flags; | |
| 62 | unsigned char __shared; | |
| 63 | unsigned char __pad1; | |
| 64 | unsigned char __pad2; | |
| 65 | #endif | |
| 66 | int __cur_writer; | |
| 67 | }; | |
| 68 | ||
| 69 | #define __PTHREAD_RWLOCK_ELISION_EXTRA 0 | |
| 70 | ||
| 71 | #endif	/* bits/pthreadtypes.h */ |
lib/libc/glibc/sysdeps/arm/start.S+6-18| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Startup code for ARM & ELF |
| 2 | Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -94,30 +94,20 @@ _start: |
| 94 | 94 | 	adr a4, .L_GOT |
| 95 | 95 | 	add sl, sl, a4 |
| 96 | 96 | |
| 97 | 	ldr ip, .L_GOT+4	/* __libc_csu_fini */ | |
| 98 | 	ldr ip, [sl, ip] | |
| 97 | 	mov a4, #0		/* Used to be init. */ | |
| 98 | 	push { a4 }		/* Used to be fini. */ | |
| 99 | 99 | |
| 100 | 	push { ip }		/* Push __libc_csu_fini */ | |
| 101 | ||
| 102 | 	ldr a4, .L_GOT+8	/* __libc_csu_init */ | |
| 103 | 	ldr a4, [sl, a4] | |
| 104 | ||
| 105 | 	ldr a1, .L_GOT+12	/* main */ | |
| 100 | 	ldr a1, .L_GOT+4	/* main */ | |
| 106 | 101 | 	ldr a1, [sl, a1] |
| 107 | 102 | |
| 108 | 103 | 	/* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */ |
| 109 | 104 | 	/* Let the libc call main and exit with its return code. */ |
| 110 | 105 | 	bl __libc_start_main(PLT) |
| 111 | 106 | #else |
| 112 | 	/* Fetch address of __libc_csu_fini */ | |
| 113 | 	ldr ip, =__libc_csu_fini | |
| 114 | ||
| 115 | 	/* Push __libc_csu_fini */ | |
| 116 | 	push { ip } | |
| 117 | 107 | |
| 118 | 	/* Set up the other arguments in registers */ | |
| 108 | 	mov a4, #0		/* Used to init. */ | |
| 109 | 	push { a4 }		/* Used to fini. */ | |
| 119 | 110 | 	ldr a1, =main |
| 120 | 	ldr a4, =__libc_csu_init | |
| 121 | 111 | |
| 122 | 112 | 	/* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */ |
| 123 | 113 | 	/* Let the libc call main and exit with its return code. */ |
| ... | ... | @@ -131,8 +121,6 @@ _start: |
| 131 | 121 | 	.align 2 |
| 132 | 122 | .L_GOT: |
| 133 | 123 | 	.word _GLOBAL_OFFSET_TABLE_ - .L_GOT |
| 134 | 	.word __libc_csu_fini(GOT) | |
| 135 | 	.word __libc_csu_init(GOT) | |
| 136 | 124 | 	.word main(GOT) |
| 137 | 125 | #endif |
| 138 | 126 |
lib/libc/glibc/sysdeps/arm/sysdep.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Assembler macros for ARM. |
| 2 | Copyright (C) 1997-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1997-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/generic/dl-dtprocnum.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Configuration of lookup functions. |
| 2 | Copyright (C) 2000-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2000-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/generic/dl-sysdep.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* System-specific settings for dynamic linker code. Generic version. |
| 2 | Copyright (C) 2002-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2002-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/generic/dwarf2.h+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | /* Declarations and definitions of codes relating to the DWARF2 symbolic |
| 2 | 2 | debugging information format. |
| 3 | Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 3 | Copyright (C) 1992-2021 Free Software Foundation, Inc. | |
| 4 | 4 | Contributed by Gary Funck (gary@intrepid.com). Derived from the |
| 5 | 5 | DWARF 1 implementation written by Ron Guilmette (rfg@monkeys.com). |
| 6 | 6 |
lib/libc/glibc/sysdeps/generic/libc-lock.h+1-13| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* libc-internal interface for mutex locks. Stub version. |
| 2 | Copyright (C) 1996-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1996-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -125,16 +125,4 @@ |
| 125 | 125 | /* We need portable names for some of the functions. */ |
| 126 | 126 | #define __libc_mutex_unlock |
| 127 | 127 | |
| 128 | /* Type for key of thread specific data. */ | |
| 129 | typedef int __libc_key_t; | |
| 130 | ||
| 131 | /* Create key for thread specific data. */ | |
| 132 | #define __libc_key_create(KEY,DEST)	((void) (KEY), (void) (DEST), -1) | |
| 133 | ||
| 134 | /* Set thread-specific data associated with KEY to VAL. */ | |
| 135 | #define __libc_setspecific(KEY,VAL)	((void) (KEY), (void) (VAL)) | |
| 136 | ||
| 137 | /* Get thread-specific data associated with KEY. */ | |
| 138 | #define __libc_getspecific(KEY)		((void) (KEY), (void *) 0) | |
| 139 | ||
| 140 | 128 | #endif	/* libc-lock.h */ |
lib/libc/glibc/sysdeps/generic/libc-symver.h created+88| ... | ... | @@ -0,0 +1,88 @@ |
| 1 | /* Symbol version management. | |
| 2 | Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <https://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | /* This file is included from <libc-symbols.h> for !_ISOMAC, and | |
| 20 | unconditionally from <shlib-compat.h>. */ | |
| 21 | ||
| 22 | #ifndef _LIBC_SYMVER_H | |
| 23 | #define _LIBC_SYMVER_H 1 | |
| 24 | ||
| 25 | #include <config.h> | |
| 26 | ||
| 27 | /* Use symbol_version_reference to specify the version a symbol | |
| 28 | reference should link to. Use symbol_version or | |
| 29 | default_symbol_version for the definition of a versioned symbol. | |
| 30 | The difference is that the latter is a no-op in non-shared | |
| 31 | builds. | |
| 32 | ||
| 33 | _set_symbol_version is similar to symbol_version_reference, except | |
| 34 | that this macro expects the name and symbol version as a single | |
| 35 | string or token sequence, with an @ or @@ separator. (A string is | |
| 36 | used in C mode and a token sequence in assembler mode.) | |
| 37 | _set_symbol_version only be used for definitions because it may | |
| 38 | introduce an alias symbol that would not be globally unique for | |
| 39 | mere references. The _set_symbol_version macro is used to define | |
| 40 | default_symbol_version and compat_symbol. */ | |
| 41 | ||
| 42 | #ifdef __ASSEMBLER__ | |
| 43 | # define symbol_version_reference(real, name, version) \ | |
| 44 | .symver real, name##@##version | |
| 45 | #else | |
| 46 | # define symbol_version_reference(real, name, version) \ | |
| 47 | __asm__ (".symver " #real "," #name "@" #version) | |
| 48 | #endif /* !__ASSEMBLER__ */ | |
| 49 | ||
| 50 | #if SYMVER_NEEDS_ALIAS | |
| 51 | /* If the assembler cannot support multiple versions for the same | |
| 52 | symbol, introduce __SInnn_ aliases to which the symbol version is | |
| 53 | attached. */ | |
| 54 | # define __symbol_version_unique_concat(x, y) __SI ## x ## _ ## y | |
| 55 | # define _symbol_version_unique_concat(x, y) \ | |
| 56 | __symbol_version_unique_concat (x, y) | |
| 57 | # define _symbol_version_unique_alias(name) \ | |
| 58 | _symbol_version_unique_concat (name, __COUNTER__) | |
| 59 | # ifdef __ASSEMBLER__ | |
| 60 | # define _set_symbol_version_2(real, alias, name_version) \ | |
| 61 | .globl alias ASM_LINE_SEP \ | |
| 62 | .equiv alias, real ASM_LINE_SEP \ | |
| 63 | .symver alias, name_version | |
| 64 | # else | |
| 65 | # define _set_symbol_version_2(real, alias, name_version) \ | |
| 66 | __asm__ (".globl " #alias "\n\t" \ | |
| 67 | ".equiv " #alias ", " #real "\n\t" \ | |
| 68 | ".symver " #alias "," name_version) | |
| 69 | # endif | |
| 70 | # define _set_symbol_version_1(real, alias, name_version) \ | |
| 71 | _set_symbol_version_2 (real, alias, name_version) | |
| 72 | /* REAL must be globally unique, so that the counter also produces | |
| 73 | globally unique symbols. */ | |
| 74 | # define _set_symbol_version(real, name_version) \ | |
| 75 | _set_symbol_version_1 (real, _symbol_version_unique_alias (real), \ | |
| 76 | name_version) | |
| 77 | # else /* !SYMVER_NEEDS_ALIAS */ | |
| 78 | # ifdef __ASSEMBLER__ | |
| 79 | # define _set_symbol_version(real, name_version) \ | |
| 80 | .symver real, name_version | |
| 81 | # else | |
| 82 | # define _set_symbol_version(real, name_version) \ | |
| 83 | __asm__ (".symver " #real "," name_version) | |
| 84 | # endif | |
| 85 | #endif /* !SYMVER_NEEDS_ALIAS */ | |
| 86 | ||
| 87 | ||
| 88 | #endif /* _LIBC_SYMVER_H */ |
lib/libc/glibc/sysdeps/generic/single-thread.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Single thread optimization, generic version. |
| 2 | Copyright (C) 2019-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2019-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/generic/struct_stat_time64.h created+6| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | #ifndef _BITS_STRUCT_STAT_TIME64_H | |
| 2 | #define _BITS_STRUCT_STAT_TIME64_H 1 | |
| 3 | ||
| 4 | #define __stat64_t64 stat64 | |
| 5 | ||
| 6 | #endif |
lib/libc/glibc/sysdeps/generic/sysdep.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Generic asm macros used on many machines. |
| 2 | Copyright (C) 1991-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1991-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/generic/tls.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Definition for thread-local data handling. Generic version. |
| 2 | Copyright (C) 2002-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2002-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/generic/xstatver.h created+4| ... | ... | @@ -0,0 +1,4 @@ |
| 1 | /* Versions of the 'struct stat' data structure used in compatibility xstat | |
| 2 | functions. */ | |
| 3 | #define _STAT_VER 0 | |
| 4 | #define _MKNOD_VER 0 |
lib/libc/glibc/sysdeps/hppa/crti.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for HPPA |
| 2 | Copyright (C) 2000-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2000-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/hppa/crtn.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for HPPA |
| 2 | Copyright (C) 2000-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2000-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 2005-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 2005-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/hppa/start.S+5-23| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* ELF startup code for HPPA. |
| 2 | Copyright (C) 2002-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2002-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -36,8 +36,6 @@ |
| 36 | 36 | 	.import main, code |
| 37 | 37 | 	.import $global$, data |
| 38 | 38 | 	.import __libc_start_main, code |
| 39 | 	.import __libc_csu_fini, code | |
| 40 | 	.import __libc_csu_init, code | |
| 41 | 39 | |
| 42 | 40 | 	/* Have the linker create plabel words so we get PLABEL32 |
| 43 | 41 | 	 relocs and not 21/14. The use of 21/14 relocs is only |
| ... | ... | @@ -52,10 +50,6 @@ |
| 52 | 50 | 	.word P%main |
| 53 | 51 | .Lp__libc_start_main: |
| 54 | 52 | 	.word P%__libc_start_main |
| 55 | .Lp__libc_csu_fini: | |
| 56 | 	.word P%__libc_csu_fini | |
| 57 | .Lp__libc_csu_init: | |
| 58 | 	.word P%__libc_csu_init | |
| 59 | 53 | |
| 60 | 54 | 	.text |
| 61 | 55 | 	.align 4 |
| ... | ... | @@ -77,8 +71,8 @@ _start: |
| 77 | 71 | 		1. r26 - Application main |
| 78 | 72 | 		2. r25 - argc |
| 79 | 73 | 		3. r24 - argv |
| 80 | 		4. r23 - __libc_csu_init | |
| 81 | 		5. sp-52 - __libc_csu_fini | |
| 74 | 		4. r23 - init (unused) | |
| 75 | 		5. sp-52 - fini (unused) | |
| 82 | 76 | 		6. sp-56 - rtld_fini |
| 83 | 77 | 		7. sp-60 - stackend */ |
| 84 | 78 | |
| ... | ... | @@ -108,14 +102,6 @@ _start: |
| 108 | 102 | 	addil	LT'.Lpmain, %r19 |
| 109 | 103 | 	ldw	RT'.Lpmain(%r1), %r26 |
| 110 | 104 | 	ldw	0(%r26),%r26 |
| 111 | 	/* void (*init) (void) (4th argument) */ | |
| 112 | 	addil	LT'.Lp__libc_csu_init, %r19 | |
| 113 | 	ldw	RT'.Lp__libc_csu_init(%r1), %r23 | |
| 114 | 	ldw	0(%r23), %r23 | |
| 115 | 	/* void (*fini) (void) (5th argument) */ | |
| 116 | 	addil	LT'.Lp__libc_csu_fini, %r19 | |
| 117 | 	ldw	RT'.Lp__libc_csu_fini(%r1), %r22 | |
| 118 | 	ldw	0(%r22), %r22 | |
| 119 | 105 | #else |
| 120 | 106 | 	/* Load $global$ address into %dp */ |
| 121 | 107 | 	ldil	L%$global$, %dp |
| ... | ... | @@ -124,13 +110,9 @@ _start: |
| 124 | 110 | 	/* load main (1st argument) */ |
| 125 | 111 | 	ldil	LR'.Lpmain, %r26 |
| 126 | 112 | 	ldw	RR'.Lpmain(%r26), %r26 |
| 127 | 	/* void (*init) (void) (4th argument) */ | |
| 128 | 	ldil	LR'.Lp__libc_csu_init, %r23 | |
| 129 | 	ldw	RR'.Lp__libc_csu_init(%r23), %r23 | |
| 130 | 	/* void (*fini) (void) (5th argument) */ | |
| 131 | 	ldil	LR'.Lp__libc_csu_fini, %r22 | |
| 132 | 	ldw	RR'.Lp__libc_csu_fini(%r22), %r22 | |
| 133 | 113 | #endif |
| 114 | 	ldi	0,%r23		/* Used to be init. */ | |
| 115 | 	ldi	0,%r22		/* Used to be fini. */ | |
| 134 | 116 | 	/* Store 5th argument */ |
| 135 | 117 | 	stw	%r22, -52(%sp) |
| 136 | 118 | 	/* void *stack_end (7th argument) */ |
lib/libc/glibc/sysdeps/hppa/sysdep.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Assembler macros for HP/PA. |
| 2 | Copyright (C) 1999-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1999-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | Contributed by Ulrich Drepper, <drepper@cygnus.com>, August 1999. |
| 5 | 5 |
lib/libc/glibc/sysdeps/htl/bits/pthread.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Pthread data structures. Generic version. |
| 2 | Copyright (C) 2002-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2002-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/htl/bits/thread-shared-types.h+14-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Common threading primitives definitions for both POSIX and C11. |
| 2 | Copyright (C) 2017-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2017-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -20,5 +20,18 @@ |
| 20 | 20 | #define _THREAD_SHARED_TYPES_H 1 |
| 21 | 21 | |
| 22 | 22 | #include <bits/pthreadtypes-arch.h> |
| 23 | #include <bits/types/struct___pthread_once.h> | |
| 24 | ||
| 25 | typedef int __tss_t; | |
| 26 | typedef int __thrd_t; | |
| 27 | ||
| 28 | typedef union | |
| 29 | { | |
| 30 | struct __pthread_once __data; | |
| 31 | int __align __ONCE_ALIGNMENT; | |
| 32 | char __size[__SIZEOF_PTHREAD_ONCE_T]; | |
| 33 | } __once_flag; | |
| 34 | ||
| 35 | #define __ONCE_FLAG_INIT { { __PTHREAD_ONCE_INIT } } | |
| 23 | 36 | |
| 24 | 37 | #endif /* _THREAD_SHARED_TYPES_H */ |
lib/libc/glibc/sysdeps/htl/libc-lockP.h+1-14| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Private libc-internal interface for mutex locks. |
| 2 | Copyright (C) 2015-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2015-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -22,9 +22,6 @@ |
| 22 | 22 | #include <pthread.h> |
| 23 | 23 | #include <pthread-functions.h> |
| 24 | 24 | |
| 25 | /* Type for key to thread-specific data. */ | |
| 26 | typedef pthread_key_t __libc_key_t; | |
| 27 | ||
| 28 | 25 | /* If we check for a weakly referenced symbol and then perform a |
| 29 | 26 | normal jump to it te code generated for some platforms in case of |
| 30 | 27 | PIC is unnecessarily slow. What would happen is that the function |
| ... | ... | @@ -109,16 +106,6 @@ extern int __pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock); |
| 109 | 106 | |
| 110 | 107 | extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock); |
| 111 | 108 | |
| 112 | extern int __pthread_key_create (pthread_key_t *__key, | |
| 113 | 				 void (*__destr_function) (void *)); | |
| 114 | ||
| 115 | extern int __pthread_key_delete (pthread_key_t __key); | |
| 116 | ||
| 117 | extern int __pthread_setspecific (pthread_key_t __key, | |
| 118 | 				 const void *__pointer); | |
| 119 | ||
| 120 | extern void *__pthread_getspecific (pthread_key_t __key); | |
| 121 | ||
| 122 | 109 | extern int __pthread_once (pthread_once_t *__once_control, |
| 123 | 110 | 			 void (*__init_routine) (void)); |
| 124 | 111 |
lib/libc/glibc/sysdeps/htl/pthread.h+66-39| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Posix threads. Hurd version. |
| 2 | Copyright (C) 2000-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2000-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -222,6 +222,32 @@ extern void pthread_exit (void *__status) __attribute__ ((__noreturn__)); |
| 222 | 222 | the exit status of the thread in *STATUS. */ |
| 223 | 223 | extern int pthread_join (pthread_t __threadp, void **__status); |
| 224 | 224 | |
| 225 | #ifdef __USE_GNU | |
| 226 | /* Check whether thread TH has terminated. If yes return the status of | |
| 227 | the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL. */ | |
| 228 | extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW; | |
| 229 | ||
| 230 | /* Make calling thread wait for termination of the thread TH, but only | |
| 231 | until TIMEOUT. The exit status of the thread is stored in | |
| 232 | *THREAD_RETURN, if THREAD_RETURN is not NULL. | |
| 233 | ||
| 234 | This function is a cancellation point and therefore not marked with | |
| 235 | __THROW. */ | |
| 236 | extern int pthread_timedjoin_np (pthread_t __th, void **__thread_return, | |
| 237 | 				 const struct timespec *__abstime); | |
| 238 | ||
| 239 | /* Make calling thread wait for termination of the thread TH, but only | |
| 240 | until TIMEOUT measured against the clock specified by CLOCKID. The | |
| 241 | exit status of the thread is stored in *THREAD_RETURN, if | |
| 242 | THREAD_RETURN is not NULL. | |
| 243 | ||
| 244 | This function is a cancellation point and therefore not marked with | |
| 245 | __THROW. */ | |
| 246 | extern int pthread_clockjoin_np (pthread_t __th, void **__thread_return, | |
| 247 | clockid_t __clockid, | |
| 248 | 				 const struct timespec *__abstime); | |
| 249 | #endif | |
| 250 | ||
| 225 | 251 | /* Indicate that the storage for THREAD can be reclaimed when it |
| 226 | 252 | terminates. */ |
| 227 | 253 | extern int pthread_detach (pthread_t __threadp); |
| ... | ... | @@ -273,6 +299,7 @@ extern pthread_t pthread_self (void) __THROW; |
| 273 | 299 | #ifdef __USE_XOPEN2K |
| 274 | 300 | # define PTHREAD_MUTEX_STALLED __PTHREAD_MUTEX_STALLED |
| 275 | 301 | # define PTHREAD_MUTEX_ROBUST __PTHREAD_MUTEX_ROBUST |
| 302 | # define PTHREAD_MUTEX_ROBUST_NP __PTHREAD_MUTEX_ROBUST | |
| 276 | 303 | #endif |
| 277 | 304 | |
| 278 | 305 | #include <bits/types/struct___pthread_mutexattr.h> |
| ... | ... | @@ -400,6 +427,13 @@ extern int pthread_mutex_timedlock (struct __pthread_mutex *__restrict __mutex, |
| 400 | 427 | 	__THROWNL __nonnull ((1, 2)); |
| 401 | 428 | #endif |
| 402 | 429 | |
| 430 | #ifdef __USE_GNU | |
| 431 | extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex, | |
| 432 | 				 clockid_t __clockid, | |
| 433 | 				 const struct timespec *__restrict | |
| 434 | 				 __abstime) __THROWNL __nonnull ((1, 3)); | |
| 435 | #endif | |
| 436 | ||
| 403 | 437 | /* Unlock MUTEX. */ |
| 404 | 438 | extern int pthread_mutex_unlock (pthread_mutex_t *__mutex) |
| 405 | 439 | 	__THROWNL __nonnull ((1)); |
| ... | ... | @@ -516,6 +550,21 @@ extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, |
| 516 | 550 | 				 pthread_mutex_t *__restrict __mutex, |
| 517 | 551 | 				 __const struct timespec *__restrict __abstime) |
| 518 | 552 | 	 __nonnull ((1, 2, 3)); |
| 553 | ||
| 554 | # ifdef __USE_GNU | |
| 555 | /* Wait for condition variable COND to be signaled or broadcast until | |
| 556 | ABSTIME measured by the specified clock. MUTEX is assumed to be | |
| 557 | locked before. CLOCK is the clock to use. ABSTIME is an absolute | |
| 558 | time specification against CLOCK's epoch. | |
| 559 | ||
| 560 | This function is a cancellation point and therefore not marked with | |
| 561 | __THROW. */ | |
| 562 | extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond, | |
| 563 | 				 pthread_mutex_t *__restrict __mutex, | |
| 564 | 				 __clockid_t __clock_id, | |
| 565 | 				 const struct timespec *__restrict __abstime) | |
| 566 | __nonnull ((1, 2, 4)); | |
| 567 | # endif | |
| 519 | 568 | |
| 520 | 569 | |
| 521 | 570 | /* Spin locks. */ |
| ... | ... | @@ -549,42 +598,6 @@ extern int pthread_spin_trylock (pthread_spinlock_t *__lock) |
| 549 | 598 | extern int pthread_spin_unlock (pthread_spinlock_t *__lock) |
| 550 | 599 | 	__nonnull ((1)); |
| 551 | 600 | |
| 552 | # if defined __USE_EXTERN_INLINES && defined _LIBC | |
| 553 | ||
| 554 | # include <bits/spin-lock-inline.h> | |
| 555 | ||
| 556 | __extern_inline int | |
| 557 | pthread_spin_destroy (pthread_spinlock_t *__lock) | |
| 558 | { | |
| 559 | return __pthread_spin_destroy (__lock); | |
| 560 | } | |
| 561 | ||
| 562 | __extern_inline int | |
| 563 | pthread_spin_init (pthread_spinlock_t *__lock, int __pshared) | |
| 564 | { | |
| 565 | return __pthread_spin_init (__lock, __pshared); | |
| 566 | } | |
| 567 | ||
| 568 | __extern_inline int | |
| 569 | pthread_spin_lock (pthread_spinlock_t *__lock) | |
| 570 | { | |
| 571 | return __pthread_spin_lock (__lock); | |
| 572 | } | |
| 573 | ||
| 574 | __extern_inline int | |
| 575 | pthread_spin_trylock (pthread_spinlock_t *__lock) | |
| 576 | { | |
| 577 | return __pthread_spin_trylock (__lock); | |
| 578 | } | |
| 579 | ||
| 580 | __extern_inline int | |
| 581 | pthread_spin_unlock (pthread_spinlock_t *__lock) | |
| 582 | { | |
| 583 | return __pthread_spin_unlock (__lock); | |
| 584 | } | |
| 585 | ||
| 586 | # endif /* Use extern inlines. */ | |
| 587 | ||
| 588 | 601 | #endif /* XPG6. */ |
| 589 | 602 | |
| 590 | 603 | |
| ... | ... | @@ -658,6 +671,13 @@ extern int pthread_rwlock_timedrdlock (struct __pthread_rwlock *__restrict __rwl |
| 658 | 671 | 	__THROWNL __nonnull ((1, 2)); |
| 659 | 672 | # endif |
| 660 | 673 | |
| 674 | # ifdef __USE_GNU | |
| 675 | extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock, | |
| 676 | 				 clockid_t __clockid, | |
| 677 | 				 const struct timespec *__restrict | |
| 678 | 				 __abstime) __THROWNL __nonnull ((1, 3)); | |
| 679 | # endif | |
| 680 | ||
| 661 | 681 | /* Acquire the rwlock *RWLOCK for writing. */ |
| 662 | 682 | extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock) |
| 663 | 683 | 	__THROWNL __nonnull ((1)); |
| ... | ... | @@ -674,6 +694,13 @@ extern int pthread_rwlock_timedwrlock (struct __pthread_rwlock *__restrict __rwl |
| 674 | 694 | 	__THROWNL __nonnull ((1, 2)); |
| 675 | 695 | # endif |
| 676 | 696 | |
| 697 | # ifdef __USE_GNU | |
| 698 | extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock, | |
| 699 | 				 clockid_t __clockid, | |
| 700 | 				 const struct timespec *__restrict | |
| 701 | 				 __abstime) __THROWNL __nonnull ((1, 3)); | |
| 702 | # endif | |
| 703 | ||
| 677 | 704 | /* Release the lock held by the current thread on *RWLOCK. */ |
| 678 | 705 | extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock) |
| 679 | 706 | 	__THROWNL __nonnull ((1)); |
| ... | ... | @@ -795,14 +822,14 @@ extern void *pthread_getspecific (pthread_key_t __key) __THROW; |
| 795 | 822 | |
| 796 | 823 | /* Set the caller thread's thread specific value of KEY to VALUE. */ |
| 797 | 824 | extern int pthread_setspecific (pthread_key_t __key, const void *__value) |
| 798 | 	__THROW; | |
| 825 | 	__THROW __attr_access_none (2); | |
| 799 | 826 | |
| 800 | 827 | |
| 801 | 828 | /* Dynamic package initialization. */ |
| 802 | 829 | |
| 803 | 830 | #include <bits/types/struct___pthread_once.h> |
| 804 | 831 | |
| 805 | #define PTHREAD_ONCE_INIT __PTHREAD_ONCE_INIT | |
| 832 | #define PTHREAD_ONCE_INIT (struct __pthread_once) { __PTHREAD_ONCE_INIT } | |
| 806 | 833 | |
| 807 | 834 | /* Call INIT_ROUTINE if this function has never been called with |
| 808 | 835 | *ONCE_CONTROL, otherwise do nothing. */ |
lib/libc/glibc/sysdeps/i386/crti.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for x86. |
| 2 | Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/i386/crtn.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for x86. |
| 2 | Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/i386/htl/bits/pthreadtypes-arch.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Machine-specific pthread type layouts. Hurd i386 version. |
| 2 | Copyright (C) 2002-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2002-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/i386/start.S+7-9| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Startup code compliant to the ELF i386 ABI. |
| 2 | Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -87,11 +87,9 @@ ENTRY (_start) |
| 87 | 87 | 	call 1f |
| 88 | 88 | 	addl $_GLOBAL_OFFSET_TABLE_, %ebx |
| 89 | 89 | |
| 90 | 	/* Push address of our own entry points to .fini and .init. */ | |
| 91 | 	leal __libc_csu_fini@GOTOFF(%ebx), %eax | |
| 92 | 	pushl %eax | |
| 93 | 	leal __libc_csu_init@GOTOFF(%ebx), %eax | |
| 94 | 	pushl %eax | |
| 90 | 	/* This used to be the addresses of .fini and .init. */ | |
| 91 | 	pushl $0 | |
| 92 | 	pushl $0 | |
| 95 | 93 | |
| 96 | 94 | 	pushl %ecx		/* Push second argument: argv. */ |
| 97 | 95 | 	pushl %esi		/* Push first argument: argc. */ |
| ... | ... | @@ -112,9 +110,9 @@ ENTRY (_start) |
| 112 | 110 | 	 But let the libc call main. */ |
| 113 | 111 | 	call __libc_start_main@PLT |
| 114 | 112 | #else |
| 115 | 	/* Push address of our own entry points to .fini and .init. */ | |
| 116 | 	pushl $__libc_csu_fini | |
| 117 | 	pushl $__libc_csu_init | |
| 113 | 	/* This used to be the addresses of .fini and .init. */ | |
| 114 | 	pushl $0 | |
| 115 | 	pushl $0 | |
| 118 | 116 | |
| 119 | 117 | 	pushl %ecx		/* Push second argument: argv. */ |
| 120 | 118 | 	pushl %esi		/* Push first argument: argc. */ |
lib/libc/glibc/sysdeps/i386/symbol-hacks.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Hacks needed for symbol manipulation. i386 version. |
| 2 | Copyright (C) 2017-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2017-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/i386/sysdep.h+3-5| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Assembler macros for i386. |
| 2 | Copyright (C) 1991-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1991-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -18,8 +18,6 @@ |
| 18 | 18 | |
| 19 | 19 | #include <sysdeps/x86/sysdep.h> |
| 20 | 20 | |
| 21 | #include <features.h> /* For __GNUC_PREREQ. */ | |
| 22 | ||
| 23 | 21 | /* It is desirable that the names of PIC thunks match those used by |
| 24 | 22 | GCC so that multiple copies are eliminated by the linker. Because |
| 25 | 23 | GCC 4.6 and earlier use __i686 in the names, it is necessary to |
| ... | ... | @@ -97,9 +95,9 @@ GET_PC_THUNK(reg):							 \ |
| 97 | 95 | |
| 98 | 96 | # define SETUP_PIC_REG_STR(reg)						\ |
| 99 | 97 | ".ifndef " GET_PC_THUNK_STR (reg) "\n"				\ |
| 100 | "section .text." GET_PC_THUNK_STR (reg) ",\"axG\",@progbits," 	\ | |
| 98 | ".section .text." GET_PC_THUNK_STR (reg) ",\"axG\",@progbits,"	\ | |
| 99 | GET_PC_THUNK_STR (reg) ",comdat\n"					\ | |
| 101 | 100 | ".globl " GET_PC_THUNK_STR (reg) "\n"					\ |
| 102 | GET_PC_THUNK_STR (reg) ",comdat\n" \ | |
| 103 | 101 | ".hidden " GET_PC_THUNK_STR (reg) "\n"				\ |
| 104 | 102 | ".p2align 4\n"							\ |
| 105 | 103 | ".type " GET_PC_THUNK_STR (reg) ",@function\n"			\ |
lib/libc/glibc/sysdeps/ia64/crti.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for IA64. |
| 2 | Copyright (C) 2000-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2000-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/ia64/crtn.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for ARM. |
| 2 | Copyright (C) 2000-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2000-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/ia64/dl-dtprocnum.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Configuration of lookup functions. IA-64 version. |
| 2 | Copyright (C) 2000-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2000-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/ia64/dl-sysdep.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* System-specific settings for dynamic linker code. IA-64 version. |
| 2 | Copyright (C) 2002-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2002-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h deleted-63| ... | ... | @@ -1,63 +0,0 @@ |
| 1 | /* Copyright (C) 2003-2019 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | Contributed by Jakub Jelinek <jakub@redhat.com>, 2003. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _BITS_PTHREADTYPES_ARCH_H | |
| 20 | #define _BITS_PTHREADTYPES_ARCH_H	1 | |
| 21 | ||
| 22 | #define __SIZEOF_PTHREAD_ATTR_T 56 | |
| 23 | #define __SIZEOF_PTHREAD_MUTEX_T 40 | |
| 24 | #define __SIZEOF_PTHREAD_MUTEXATTR_T 4 | |
| 25 | #define __SIZEOF_PTHREAD_COND_T 48 | |
| 26 | #define __SIZEOF_PTHREAD_CONDATTR_T 4 | |
| 27 | #define __SIZEOF_PTHREAD_RWLOCK_T 56 | |
| 28 | #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 | |
| 29 | #define __SIZEOF_PTHREAD_BARRIER_T 32 | |
| 30 | #define __SIZEOF_PTHREAD_BARRIERATTR_T 4 | |
| 31 | ||
| 32 | /* Definitions for internal mutex struct. */ | |
| 33 | #define __PTHREAD_COMPAT_PADDING_MID | |
| 34 | #define __PTHREAD_COMPAT_PADDING_END | |
| 35 | #define __PTHREAD_MUTEX_LOCK_ELISION 0 | |
| 36 | #define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0 | |
| 37 | #define __PTHREAD_MUTEX_USE_UNION 0 | |
| 38 | ||
| 39 | #define __LOCK_ALIGNMENT | |
| 40 | #define __ONCE_ALIGNMENT | |
| 41 | ||
| 42 | /* Data structure for reader-write lock variable handling. The | |
| 43 | structure of the attribute type is not exposed on purpose. */ | |
| 44 | struct __pthread_rwlock_arch_t | |
| 45 | { | |
| 46 | unsigned int __readers; | |
| 47 | unsigned int __writers; | |
| 48 | unsigned int __wrphase_futex; | |
| 49 | unsigned int __writers_futex; | |
| 50 | unsigned int __pad3; | |
| 51 | unsigned int __pad4; | |
| 52 | int __cur_writer; | |
| 53 | int __shared; | |
| 54 | unsigned long int __pad1; | |
| 55 | unsigned long int __pad2; | |
| 56 | /* FLAGS must stay at this position in the structure to maintain | |
| 57 | binary compatibility. */ | |
| 58 | unsigned int __flags; | |
| 59 | }; | |
| 60 | ||
| 61 | #define __PTHREAD_RWLOCK_ELISION_EXTRA 0 | |
| 62 | ||
| 63 | #endif	/* bits/pthreadtypes.h */ |
lib/libc/glibc/sysdeps/ia64/start.S+3-8| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1999-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1999-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999. |
| 4 | 4 | |
| ... | ... | @@ -82,20 +82,15 @@ _start: |
| 82 | 82 | 	{ |
| 83 | 83 | 	 addl r11 = @ltoff(__libc_ia64_register_backing_store_base), gp |
| 84 | 84 | 	 addl out0 = @ltoff(@fptr(main)), gp |
| 85 | 	 addl out3 = @ltoff(@fptr(__libc_csu_init)), gp | |
| 85 | 	 mov out3 = r0		/* Used to be init. */ | |
| 86 | 86 | 	 ;; |
| 87 | 87 | 	} |
| 88 | 88 | 	{ .mmi |
| 89 | 89 | 	 ld8 r3 = [r11]	/* pointer to __libc_ia64_register_backing_store_base */ |
| 90 | 90 | 	 ld8 out0 = [out0]	/* pointer to `main' function descriptor */ |
| 91 | 	 addl out4 = @ltoff(@fptr(__libc_csu_fini)), gp | |
| 91 | 	 mov out4 = r0		/* Used to be fini. */ | |
| 92 | 92 | 	 ;; |
| 93 | 93 | 	} |
| 94 | 	{ .mmi | |
| 95 | 	 ld8 out3 = [out3]	/* pointer to `init' function descriptor */ | |
| 96 | 	 ld8 out4 = [out4]	/* pointer to `fini' function descriptor */ | |
| 97 | 	 nop 0 | |
| 98 | 	} | |
| 99 | 94 | 	.body |
| 100 | 95 | 	{ .mib |
| 101 | 96 | 	 st8 [r3] = r10 |
lib/libc/glibc/sysdeps/ia64/sysdep.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 2000-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 2000-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | Contributed by David Mosberger-Tang <davidm@hpl.hp.com> |
| 4 | 4 |
lib/libc/glibc/sysdeps/init_array/crti.S deleted-27| ... | ... | @@ -1,27 +0,0 @@ |
| 1 | /* Dummy crti file. | |
| 2 | ||
| 3 | In this configuration, crti.o and crtn.o are both empty because the | |
| 4 | .init_array/.fini_array sections are used exclusively. | |
| 5 | ||
| 6 | Older ports cannot use this because even if the linker used to | |
| 7 | build libc itself has .init_array support, we don't want to produce | |
| 8 | a crt[in].o that presume a linker that new will be used to link | |
| 9 | other things later. | |
| 10 | ||
| 11 | But new configurations without compatibility concerns for | |
| 12 | toolchains without .init_array support can use this to avoid the | |
| 13 | superfluous .init and .fini boilerplate code. */ | |
| 14 | ||
| 15 | #ifdef PREINIT_FUNCTION | |
| 16 | ||
| 17 | #if PREINIT_FUNCTION_WEAK | |
| 18 | # error PREINIT_FUNCTION_WEAK is unsupported | |
| 19 | #endif | |
| 20 | ||
| 21 | /* This arranges for PREINIT_FUNCTION to be called upon loading a library that | |
| 22 | contains crti.o. */ | |
| 23 | ||
| 24 | 	.section .init_array,"a",%init_array | |
| 25 | 	.dc.a PREINIT_FUNCTION | |
| 26 | ||
| 27 | #endif |
lib/libc/glibc/sysdeps/init_array/crtn.S deleted-13| ... | ... | @@ -1,13 +0,0 @@ |
| 1 | /* Dummy crtn file. | |
| 2 | ||
| 3 | In this configuration, crti.o and crtn.o are both empty because the | |
| 4 | .init_array/.fini_array sections are used exclusively. | |
| 5 | ||
| 6 | Older ports cannot use this because even if the linker used to | |
| 7 | build libc itself has .init_array support, we don't want to produce | |
| 8 | a crt[in].o that presume a linker that new will be used to link | |
| 9 | other things later. | |
| 10 | ||
| 11 | But new configurations without compatibility concerns for | |
| 12 | toolchains without .init_array support can use this to avoid the | |
| 13 | superfluous .init and .fini boilerplate code. */ |
lib/libc/glibc/sysdeps/m68k/coldfire/sysdep.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Assembler macros for Coldfire. |
| 2 | Copyright (C) 1998-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1998-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/m68k/crti.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for m68k. |
| 2 | Copyright (C) 2012-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2012-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/m68k/crtn.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for m68k. |
| 2 | Copyright (C) 2012-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2012-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/m68k/m680x0/sysdep.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Assembler macros for m680x0. |
| 2 | Copyright (C) 2010-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2010-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 2010-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 2010-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010. |
| 4 | 4 |
lib/libc/glibc/sysdeps/m68k/start.S+5-10| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Startup code compliant to the ELF m68k ABI. |
| 2 | Copyright (C) 1996-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1996-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -76,15 +76,14 @@ _start: |
| 76 | 76 | 	pea (%a1)		/* Push address of the shared library |
| 77 | 77 | 				 termination function. */ |
| 78 | 78 | |
| 79 | 	/* These used to be addresses of the .fini and .init entry points. */ | |
| 80 | 	clr.l -(%sp) | |
| 81 | 	clr.l -(%sp) | |
| 82 | ||
| 79 | 83 | #ifdef PIC |
| 80 | 84 | 	/* Load PIC register. */ |
| 81 | 85 | 	LOAD_GOT (%a5) |
| 82 | 86 | |
| 83 | 	/* Push the address of our own entry points to `.fini' and | |
| 84 | 	 `.init'. */ | |
| 85 | 	move.l __libc_csu_fini@GOT(%a5), -(%sp) | |
| 86 | 	move.l __libc_csu_init@GOT(%a5), -(%sp) | |
| 87 | ||
| 88 | 87 | 	pea (%a0)		/* Push second argument: argv. */ |
| 89 | 88 | 	move.l %d0, -(%sp)	/* Push first argument: argc. */ |
| 90 | 89 | |
| ... | ... | @@ -94,10 +93,6 @@ _start: |
| 94 | 93 | 	 let the libc call main. */ |
| 95 | 94 | 	jbsr __libc_start_main@PLTPC |
| 96 | 95 | #else |
| 97 | 	/* Push the address of our own entry points to `.fini' and | |
| 98 | 	 `.init'. */ | |
| 99 | 	pea __libc_csu_fini | |
| 100 | 	pea __libc_csu_init | |
| 101 | 96 | |
| 102 | 97 | 	pea (%a0)		/* Push second argument: argv. */ |
| 103 | 98 | 	move.l %d0, -(%sp)	/* Push first argument: argc. */ |
lib/libc/glibc/sysdeps/m68k/symbol-hacks.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Hacks needed for symbol manipulation. m68k version. |
| 2 | Copyright (C) 2017-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2017-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/m68k/sysdep.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Assembler macros for m68k. |
| 2 | Copyright (C) 1998-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1998-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/mach/hurd/bits/stat.h deleted-263| ... | ... | @@ -1,263 +0,0 @@ |
| 1 | /* Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library; if not, see | |
| 16 | <https://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | #if !defined _SYS_STAT_H && !defined _FCNTL_H | |
| 19 | # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." | |
| 20 | #endif | |
| 21 | ||
| 22 | #ifndef _BITS_STAT_H | |
| 23 | #define _BITS_STAT_H	1 | |
| 24 | ||
| 25 | #include <bits/types.h> | |
| 26 | ||
| 27 | /* NOTE: The size of this structure (32 ints) is known in | |
| 28 | <hurd/hurd_types.defs>, since it is used in the `io_stat' RPC. MiG | |
| 29 | does not cope at all well with the passed C structure not being of | |
| 30 | the expected size. There are some filler words at the end to allow | |
| 31 | for future expansion. To increase the size of the structure used | |
| 32 | in the RPC and retain binary compatibility, we would need to assign | |
| 33 | a new message number. */ | |
| 34 | ||
| 35 | struct stat | |
| 36 | { | |
| 37 | int st_fstype;		/* File system type. */ | |
| 38 | __fsid_t st_fsid;		/* File system ID. */ | |
| 39 | #define	st_dev	st_fsid | |
| 40 | ||
| 41 | #ifndef __USE_FILE_OFFSET64 | |
| 42 | __ino_t st_ino;		/* File number. */ | |
| 43 | #else | |
| 44 | __ino64_t st_ino;		/* File number. */ | |
| 45 | #endif | |
| 46 | unsigned int st_gen;	/* To detect reuse of file numbers. */ | |
| 47 | __dev_t st_rdev;		/* Device if special file. */ | |
| 48 | __mode_t st_mode;		/* File mode. */ | |
| 49 | __nlink_t st_nlink;		/* Number of links. */ | |
| 50 | ||
| 51 | __uid_t st_uid;		/* Owner. */ | |
| 52 | __gid_t st_gid;		/* Owning group. */ | |
| 53 | ||
| 54 | #ifndef __USE_FILE_OFFSET64 | |
| 55 | __off_t st_size;		/* Size in bytes. */ | |
| 56 | #else | |
| 57 | __off64_t st_size;		/* Size in bytes. */ | |
| 58 | #endif | |
| 59 | ||
| 60 | #ifdef __USE_XOPEN2K8 | |
| 61 | /* Nanosecond resolution timestamps are stored in a format | |
| 62 | equivalent to 'struct timespec'. This is the type used | |
| 63 | whenever possible but the Unix namespace rules do not allow the | |
| 64 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 65 | Therefore we have to handle the use of this header in strictly | |
| 66 | standard-compliant sources special. */ | |
| 67 | struct timespec st_atim;		/* Time of last access. */ | |
| 68 | struct timespec st_mtim;		/* Time of last modification. */ | |
| 69 | struct timespec st_ctim;		/* Time of last status change. */ | |
| 70 | # define st_atime st_atim.tv_sec	/* Backward compatibility. */ | |
| 71 | # define st_mtime st_mtim.tv_sec | |
| 72 | # define st_ctime st_ctim.tv_sec | |
| 73 | #else | |
| 74 | __time_t st_atime;			/* Time of last access. */ | |
| 75 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 76 | __time_t st_mtime;			/* Time of last modification. */ | |
| 77 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 78 | __time_t st_ctime;			/* Time of last status change. */ | |
| 79 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 80 | #endif | |
| 81 | ||
| 82 | __blksize_t st_blksize;	/* Optimal size for I/O. */ | |
| 83 | ||
| 84 | #ifndef __USE_FILE_OFFSET64 | |
| 85 | __blkcnt_t st_blocks;	/* Number of 512-byte blocks allocated. | |
| 86 | 				 Not related to `st_blksize'. */ | |
| 87 | #else | |
| 88 | __blkcnt64_t st_blocks;	/* Number of 512-byte blocks allocated. | |
| 89 | 				 Not related to `st_blksize'. */ | |
| 90 | #endif | |
| 91 | ||
| 92 | __uid_t st_author;		/* File author. */ | |
| 93 | ||
| 94 | unsigned int st_flags;	/* User-defined flags. | |
| 95 | 				 High 16 bits can be set only by root. */ | |
| 96 | ||
| 97 | #ifndef __USE_FILE_OFFSET64 | |
| 98 | # define _SPARE_SIZE	((sizeof (__fsid_t) == sizeof (int)) ? 12 : 11) | |
| 99 | #else | |
| 100 | # define _SPARE_SIZE	((sizeof (__fsid_t) == sizeof (int)) ? 9 : 8) | |
| 101 | #endif | |
| 102 | int st_spare[_SPARE_SIZE];	/* Room for future expansion. */ | |
| 103 | #undef _SPARE_SIZE | |
| 104 | }; | |
| 105 | ||
| 106 | #ifdef __USE_LARGEFILE64 | |
| 107 | struct stat64 | |
| 108 | { | |
| 109 | int st_fstype;		/* File system type. */ | |
| 110 | __fsid_t st_fsid;		/* File system ID. */ | |
| 111 | # define st_dev	st_fsid | |
| 112 | ||
| 113 | __ino64_t st_ino;		/* File number. */ | |
| 114 | unsigned int st_gen;	/* To detect reuse of file numbers. */ | |
| 115 | __dev_t st_rdev;		/* Device if special file. */ | |
| 116 | __mode_t st_mode;		/* File mode. */ | |
| 117 | __nlink_t st_nlink;		/* Number of links. */ | |
| 118 | ||
| 119 | __uid_t st_uid;		/* Owner. */ | |
| 120 | __gid_t st_gid;		/* Owning group. */ | |
| 121 | ||
| 122 | __off64_t st_size;		/* Size in bytes. */ | |
| 123 | ||
| 124 | #ifdef __USE_XOPEN2K8 | |
| 125 | /* Nanosecond resolution timestamps are stored in a format | |
| 126 | equivalent to 'struct timespec'. This is the type used | |
| 127 | whenever possible but the Unix namespace rules do not allow the | |
| 128 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 129 | Therefore we have to handle the use of this header in strictly | |
| 130 | standard-compliant sources special. */ | |
| 131 | struct timespec st_atim;		/* Time of last access. */ | |
| 132 | struct timespec st_mtim;		/* Time of last modification. */ | |
| 133 | struct timespec st_ctim;		/* Time of last status change. */ | |
| 134 | #else | |
| 135 | __time_t st_atime;			/* Time of last access. */ | |
| 136 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 137 | __time_t st_mtime;			/* Time of last modification. */ | |
| 138 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 139 | __time_t st_ctime;			/* Time of last status change. */ | |
| 140 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 141 | #endif | |
| 142 | ||
| 143 | __blksize_t st_blksize;	/* Optimal size for I/O. */ | |
| 144 | ||
| 145 | __blkcnt64_t st_blocks;	/* Number of 512-byte blocks allocated. | |
| 146 | 				 Not related to `st_blksize'. */ | |
| 147 | ||
| 148 | __uid_t st_author;		/* File author. */ | |
| 149 | ||
| 150 | unsigned int st_flags;	/* User-defined flags. | |
| 151 | 				 High 16 bits can be set only by root. */ | |
| 152 | ||
| 153 | #define _SPARE_SIZE	((sizeof (__fsid_t) == sizeof (int)) ? 9 : 8) | |
| 154 | int st_spare[_SPARE_SIZE];	/* Room for future expansion. */ | |
| 155 | #undef _SPARE_SIZE | |
| 156 | }; | |
| 157 | #endif | |
| 158 | ||
| 159 | /* Tell code we have these members. */ | |
| 160 | #define	_STATBUF_ST_BLKSIZE | |
| 161 | /* Nanosecond resolution time values are supported. */ | |
| 162 | #define _STATBUF_ST_NSEC | |
| 163 | ||
| 164 | /* Encoding of the file mode. */ | |
| 165 | ||
| 166 | #define	__S_IFMT	0170000	/* These bits determine file type. */ | |
| 167 | ||
| 168 | /* File types. */ | |
| 169 | #define	__S_IFDIR	0040000	/* Directory. */ | |
| 170 | #define	__S_IFCHR	0020000	/* Character device. */ | |
| 171 | #define	__S_IFBLK	0060000	/* Block device. */ | |
| 172 | #define	__S_IFREG	0100000	/* Regular file. */ | |
| 173 | #define	__S_IFLNK	0120000	/* Symbolic link. */ | |
| 174 | #define	__S_IFSOCK	0140000	/* Socket. */ | |
| 175 | #define	__S_IFIFO	0010000	/* FIFO. */ | |
| 176 | ||
| 177 | /* POSIX.1b objects. */ | |
| 178 | #define __S_TYPEISMQ(buf) (0) | |
| 179 | #define __S_TYPEISSEM(buf) (0) | |
| 180 | #define __S_TYPEISSHM(buf) (0) | |
| 181 | ||
| 182 | /* Protection bits. */ | |
| 183 | ||
| 184 | #define	__S_ISUID	04000	/* Set user ID on execution. */ | |
| 185 | #define	__S_ISGID	02000	/* Set group ID on execution. */ | |
| 186 | #define	__S_ISVTX	01000	/* Save swapped text after use (sticky). */ | |
| 187 | #define	__S_IREAD	00400	/* Read by owner. */ | |
| 188 | #define	__S_IWRITE	00200	/* Write by owner. */ | |
| 189 | #define	__S_IEXEC	00100	/* Execute by owner. */ | |
| 190 | ||
| 191 | ||
| 192 | #ifdef	__USE_GNU | |
| 193 | /* If set, there is no benefit in caching the contents of this file. */ | |
| 194 | #define S_INOCACHE	000000200000 | |
| 195 | ||
| 196 | /* If the S_IUSEUNK bit is set, then the S_IUNKNOWN bits (see below) | |
| 197 | control access for unknown users. If S_IUSEUNK is clear, then unknown | |
| 198 | users are treated as "others" for purposes of access control. */ | |
| 199 | #define S_IUSEUNK	000000400000 | |
| 200 | /* Mask of protection bits for unknown users (no effective IDs at all). */ | |
| 201 | #define S_IUNKNOWN 000007000000 | |
| 202 | /* Shift S_IREAD, S_IWRITE, S_IEXEC left this many bits to produce the | |
| 203 | protection bits for unknown users. */ | |
| 204 | #define S_IUNKSHIFT	12 | |
| 205 | ||
| 206 | /* Read only bits: */ | |
| 207 | ||
| 208 | /* There is a passive translator set for this file */ | |
| 209 | #define S_IPTRANS	000010000000 | |
| 210 | /* There is an active translator running on this file */ | |
| 211 | #define S_IATRANS	000020000000 | |
| 212 | /* This is the root of a filesystem (or single node translator) */ | |
| 213 | #define S_IROOT		000040000000 | |
| 214 | /* All the bits relevant to translators */ | |
| 215 | #define S_ITRANS	000070000000 | |
| 216 | ||
| 217 | /* Definitely no mmaps to this. */ | |
| 218 | #define S_IMMAP0	000100000000 | |
| 219 | ||
| 220 | /* ALL the unused bits. */ | |
| 221 | #define	S_ISPARE	(~(S_IFMT|S_ITRANS|S_INOCACHE|S_IMMAP0 \ | |
| 222 | 			 |S_IUSEUNK|S_IUNKNOWN|07777)) | |
| 223 | #endif | |
| 224 | ||
| 225 | #ifdef	__USE_MISC | |
| 226 | /* Default file creation mask (umask). */ | |
| 227 | # define CMASK		0022 | |
| 228 | ||
| 229 | /* Definitions of flags stored in file flags word. */ | |
| 230 | ||
| 231 | /* Super-user and owner changeable flags. */ | |
| 232 | # define UF_SETTABLE	0x0000ffff	/* mask of owner changeable flags */ | |
| 233 | # define UF_NODUMP	0x00000001	/* do not dump file */ | |
| 234 | # define UF_IMMUTABLE	0x00000002	/* file may not be changed */ | |
| 235 | # define UF_APPEND	0x00000004	/* writes to file may only append */ | |
| 236 | # define UF_OPAQUE	0x00000008	/* directory is opaque wrt. union */ | |
| 237 | # define UF_NOUNLINK	0x00000010	/* file may not be removed or renamed */ | |
| 238 | ||
| 239 | /* Super-user changeable flags. */ | |
| 240 | # define SF_SETTABLE	0xffff0000	/* mask of superuser changeable flags */ | |
| 241 | # define SF_ARCHIVED	0x00010000	/* file is archived */ | |
| 242 | # define SF_IMMUTABLE	0x00020000	/* file may not be changed */ | |
| 243 | # define SF_APPEND	0x00040000	/* writes to file may only append */ | |
| 244 | # define SF_NOUNLINK	0x00100000	/* file may not be removed or renamed */ | |
| 245 | # define SF_SNAPSHOT	0x00200000	/* snapshot inode */ | |
| 246 | ||
| 247 | __BEGIN_DECLS | |
| 248 | ||
| 249 | /* Set file flags for FILE to FLAGS. */ | |
| 250 | extern int chflags (__const char *__file, unsigned long int __flags) __THROW; | |
| 251 | ||
| 252 | /* Set file flags of the file referred to by FD to FLAGS. */ | |
| 253 | extern int fchflags (int __fd, unsigned long int __flags) __THROW; | |
| 254 | ||
| 255 | __END_DECLS | |
| 256 | #endif | |
| 257 | ||
| 258 | #ifdef __USE_ATFILE | |
| 259 | # define UTIME_NOW -1 /* corresponds to the current time */ | |
| 260 | # define UTIME_OMIT -2 /* target time is omitted */ | |
| 261 | #endif | |
| 262 | ||
| 263 | #endif	/* bits/stat.h */ |
lib/libc/glibc/sysdeps/mach/hurd/bits/typesizes.h deleted-72| ... | ... | @@ -1,72 +0,0 @@ |
| 1 | /* bits/typesizes.h -- underlying types for *_t. Hurd version. | |
| 2 | Copyright (C) 2002-2020 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <https://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _BITS_TYPES_H | |
| 20 | # error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | #ifndef	_BITS_TYPESIZES_H | |
| 24 | #define	_BITS_TYPESIZES_H	1 | |
| 25 | ||
| 26 | /* See <bits/types.h> for the meaning of these macros. This file exists so | |
| 27 | that <bits/types.h> need not vary across different GNU platforms. */ | |
| 28 | ||
| 29 | #define __DEV_T_TYPE		__U32_TYPE | |
| 30 | #define __UID_T_TYPE		__U32_TYPE | |
| 31 | #define __GID_T_TYPE		__U32_TYPE | |
| 32 | #define __INO_T_TYPE		__ULONGWORD_TYPE | |
| 33 | #define __INO64_T_TYPE		__UQUAD_TYPE | |
| 34 | #define __MODE_T_TYPE		__U32_TYPE | |
| 35 | #define __NLINK_T_TYPE		__UWORD_TYPE | |
| 36 | #define __OFF_T_TYPE		__SLONGWORD_TYPE | |
| 37 | #define __OFF64_T_TYPE		__SQUAD_TYPE | |
| 38 | #define __PID_T_TYPE		__S32_TYPE | |
| 39 | #define __RLIM_T_TYPE		__ULONGWORD_TYPE | |
| 40 | #define __RLIM64_T_TYPE		__UQUAD_TYPE | |
| 41 | #define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE | |
| 42 | #define	__BLKCNT64_T_TYPE	__SQUAD_TYPE | |
| 43 | #define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE | |
| 44 | #define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE | |
| 45 | #define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE | |
| 46 | #define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE | |
| 47 | #define	__FSWORD_T_TYPE		__SWORD_TYPE | |
| 48 | #define	__ID_T_TYPE		__U32_TYPE | |
| 49 | #define __CLOCK_T_TYPE		__SLONGWORD_TYPE | |
| 50 | #define __TIME_T_TYPE		__SLONGWORD_TYPE | |
| 51 | #define __USECONDS_T_TYPE	__U32_TYPE | |
| 52 | #define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE | |
| 53 | #define __DADDR_T_TYPE		__S32_TYPE | |
| 54 | #define __KEY_T_TYPE		__S32_TYPE | |
| 55 | #define __CLOCKID_T_TYPE	__S32_TYPE | |
| 56 | #define __TIMER_T_TYPE		__S32_TYPE | |
| 57 | #define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE | |
| 58 | #define __FSID_T_TYPE		__UQUAD_TYPE | |
| 59 | #define __SSIZE_T_TYPE		__SWORD_TYPE | |
| 60 | #define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE | |
| 61 | #define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE | |
| 62 | #define __CPU_MASK_TYPE 	__ULONGWORD_TYPE | |
| 63 | ||
| 64 | /* Number of descriptors that can fit in an `fd_set'. */ | |
| 65 | #define	__FD_SETSIZE		256 | |
| 66 | ||
| 67 | /* Tell the libc code that fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and | |
| 68 | fsfilcnt64_t are not the same type for all ABI purposes. */ | |
| 69 | # define __STATFS_MATCHES_STATFS64 0 | |
| 70 | ||
| 71 | ||
| 72 | #endif /* bits/typesizes.h */ |
lib/libc/glibc/sysdeps/mach/hurd/dl-sysdep.h deleted-31| ... | ... | @@ -1,31 +0,0 @@ |
| 1 | /* System-specific settings for dynamic linker code. Hurd version. | |
| 2 | Copyright (C) 2002-2020 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <https://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | /* The private errno doesn't make sense on the Hurd. errno is always the | |
| 20 | thread-local slot shared with libc, and it matters to share the cell | |
| 21 | with libc because after startup we use libc functions that set errno | |
| 22 | (open, mmap, etc). */ | |
| 23 | ||
| 24 | #define RTLD_PRIVATE_ERRNO 0 | |
| 25 | ||
| 26 | #ifdef SHARED | |
| 27 | /* _dl_argv and __libc_stack_end cannot be attribute_relro, because the stack-switching | |
| 28 | libc initializer for using cthreads might write into it. */ | |
| 29 | # define DL_ARGV_NOT_RELRO 1 | |
| 30 | # define LIBC_STACK_END_NOT_RELRO 1 | |
| 31 | #endif |
lib/libc/glibc/sysdeps/mach/hurd/kernel-features.h deleted-21| ... | ... | @@ -1,21 +0,0 @@ |
| 1 | /* Set flags signalling availability of certain operating system features. | |
| 2 | Copyright (C) 2012-2020 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <https://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | /* This file can define __ASSUME_* macros checked by certain source files. | |
| 20 | Almost none of these are used outside of sysdeps/unix/sysv/linux code. | |
| 21 | But those referring to POSIX-level features like O_* flags can be. */ |
lib/libc/glibc/sysdeps/mach/i386/sysdep.h+1-11| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1991-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1991-2021 Free Software Foundation, Inc. | |
| 2 | 2 | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| ... | ... | @@ -39,16 +39,6 @@ |
| 39 | 39 | envp = p;							 \ |
| 40 | 40 | } while (0) |
| 41 | 41 | |
| 42 | #define CALL_WITH_SP(fn, info, sp) \ | |
| 43 | do {									 \ | |
| 44 | 	void **ptr = (void **) sp;					 \ | |
| 45 | 	*--(__typeof (info) *) ptr = info;				 \ | |
| 46 | 	ptr[-1] = ptr;							 \ | |
| 47 | 	--ptr;								 \ | |
| 48 | asm volatile ("movl %0, %%esp; call %1" : : 			 \ | |
| 49 | 		 "g" (ptr), "m" (*(long int *) (fn)) : "%esp"); 	 \ | |
| 50 | } while (0) | |
| 51 | ||
| 52 | 42 | #define RETURN_TO(sp, pc, retval) \ |
| 53 | 43 | asm volatile ("movl %0, %%esp; jmp %*%1 # %2" \ |
| 54 | 44 | 		: : "g" (sp), "r" (pc), "a" (retval)) |
lib/libc/glibc/sysdeps/mach/libc-lock.h+11-14| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* libc-internal interface for mutex locks. Mach cthreads version. |
| 2 | Copyright (C) 1996-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1996-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -24,9 +24,6 @@ |
| 24 | 24 | #include <tls.h> |
| 25 | 25 | #include <lowlevellock.h> |
| 26 | 26 | |
| 27 | /* The locking here is very inexpensive, even for inlining. */ | |
| 28 | #define _IO_lock_inexpensive 1 | |
| 29 | ||
| 30 | 27 | typedef unsigned int __libc_lock_t; |
| 31 | 28 | typedef struct |
| 32 | 29 | { |
| ... | ... | @@ -57,13 +54,13 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t; |
| 57 | 54 | CLASS __libc_lock_t NAME; |
| 58 | 55 | |
| 59 | 56 | /* Define an initialized lock variable NAME with storage class CLASS. */ |
| 60 | #define _LIBC_LOCK_INITIALIZER LLL_INITIALIZER | |
| 57 | #define _LIBC_LOCK_INITIALIZER LLL_LOCK_INITIALIZER | |
| 61 | 58 | #define __libc_lock_define_initialized(CLASS,NAME) \ |
| 62 | CLASS __libc_lock_t NAME = LLL_INITIALIZER; | |
| 59 | CLASS __libc_lock_t NAME = LLL_LOCK_INITIALIZER; | |
| 63 | 60 | |
| 64 | 61 | /* Initialize the named lock variable, leaving it in a consistent, unlocked |
| 65 | 62 | state. */ |
| 66 | #define __libc_lock_init(NAME) (NAME) = LLL_INITIALIZER | |
| 63 | #define __libc_lock_init(NAME) (NAME) = LLL_LOCK_INITIALIZER | |
| 67 | 64 | |
| 68 | 65 | /* Finalize the named lock variable, which must be locked. It cannot be |
| 69 | 66 | used again until __libc_lock_init is called again on it. This must be |
| ... | ... | @@ -74,19 +71,19 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t; |
| 74 | 71 | |
| 75 | 72 | /* Lock the named lock variable. */ |
| 76 | 73 | #define __libc_lock_lock(NAME) \ |
| 77 | ({ lll_lock (&(NAME), 0); 0; }) | |
| 74 | ({ lll_lock ((NAME), 0); 0; }) | |
| 78 | 75 | |
| 79 | 76 | /* Lock the named lock variable. */ |
| 80 | #define __libc_lock_trylock(NAME) lll_trylock (&(NAME)) | |
| 77 | #define __libc_lock_trylock(NAME) lll_trylock (NAME) | |
| 81 | 78 | |
| 82 | 79 | /* Unlock the named lock variable. */ |
| 83 | 80 | #define __libc_lock_unlock(NAME) \ |
| 84 | ({ lll_unlock (&(NAME), 0); 0; }) | |
| 81 | ({ lll_unlock ((NAME), 0); 0; }) | |
| 85 | 82 | |
| 86 | 83 | #define __libc_lock_define_recursive(CLASS,NAME) \ |
| 87 | 84 | CLASS __libc_lock_recursive_t NAME; |
| 88 | 85 | |
| 89 | #define _LIBC_LOCK_RECURSIVE_INITIALIZER { LLL_INITIALIZER, 0, 0 } | |
| 86 | #define _LIBC_LOCK_RECURSIVE_INITIALIZER { LLL_LOCK_INITIALIZER, 0, 0 } | |
| 90 | 87 | |
| 91 | 88 | #define __libc_lock_define_initialized_recursive(CLASS,NAME) \ |
| 92 | 89 | CLASS __libc_lock_recursive_t NAME = _LIBC_LOCK_RECURSIVE_INITIALIZER; |
| ... | ... | @@ -111,7 +108,7 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t; |
| 111 | 108 | int __r = 0; \ |
| 112 | 109 | if (__self == __lock->owner) \ |
| 113 | 110 | ++__lock->cnt; \ |
| 114 | else if ((__r = lll_trylock (&__lock->lock)) == 0) \ | |
| 111 | else if ((__r = lll_trylock (__lock->lock)) == 0) \ | |
| 115 | 112 | __lock->owner = __self, __lock->cnt = 1; \ |
| 116 | 113 | __r; \ |
| 117 | 114 | }) |
| ... | ... | @@ -122,7 +119,7 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t; |
| 122 | 119 | void *__self = __libc_lock_owner_self (); \ |
| 123 | 120 | if (__self != __lock->owner) \ |
| 124 | 121 | { \ |
| 125 | lll_lock (&__lock->lock, 0); \ | |
| 122 | lll_lock (__lock->lock, 0); \ | |
| 126 | 123 | __lock->owner = __self; \ |
| 127 | 124 | } \ |
| 128 | 125 | ++__lock->cnt; \ |
| ... | ... | @@ -135,7 +132,7 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t; |
| 135 | 132 | if (--__lock->cnt == 0) \ |
| 136 | 133 | { \ |
| 137 | 134 | __lock->owner = 0; \ |
| 138 | lll_unlock (&__lock->lock, 0); \ | |
| 135 | lll_unlock (__lock->lock, 0); \ | |
| 139 | 136 | } \ |
| 140 | 137 | }) |
| 141 | 138 |
lib/libc/glibc/sysdeps/mach/sysdep.h+1-9| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1994-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1994-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -62,14 +62,6 @@ |
| 62 | 62 | #error SNARF_ARGS not defined by sysdeps/mach/MACHINE/sysdep.h |
| 63 | 63 | #endif |
| 64 | 64 | |
| 65 | /* Call the C function FN with no arguments, | |
| 66 | on a stack starting at SP (as returned by *_cthread_init_routine). | |
| 67 | You don't need to deal with FN returning; it shouldn't. */ | |
| 68 | #ifndef	CALL_WITH_SP | |
| 69 | #define CALL_WITH_SP(fn, sp) | |
| 70 | #error CALL_WITH_SP not defined by sysdeps/mach/MACHINE/sysdep.h | |
| 71 | #endif | |
| 72 | ||
| 73 | 65 | /* LOSE can be defined as the `halt' instruction or something |
| 74 | 66 | similar which will cause the process to die in a characteristic |
| 75 | 67 | way suggesting a bug. */ |
lib/libc/glibc/sysdeps/microblaze/crti.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for MicroBlaze. |
| 2 | Copyright (C) 2012-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2012-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/microblaze/crtn.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for MicroBlaze. |
| 2 | Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h deleted-72| ... | ... | @@ -1,72 +0,0 @@ |
| 1 | /* Copyright (C) 2002-2019 Free Software Foundation, Inc. | |
| 2 | ||
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _BITS_PTHREADTYPES_ARCH_H | |
| 20 | # define _BITS_PTHREADTYPES_ARCH_H	1 | |
| 21 | ||
| 22 | # include <endian.h> | |
| 23 | ||
| 24 | # define __SIZEOF_PTHREAD_ATTR_T 36 | |
| 25 | # define __SIZEOF_PTHREAD_MUTEX_T 24 | |
| 26 | # define __SIZEOF_PTHREAD_MUTEXATTR_T 4 | |
| 27 | # define __SIZEOF_PTHREAD_COND_T 48 | |
| 28 | # define __SIZEOF_PTHREAD_CONDATTR_T 4 | |
| 29 | # define __SIZEOF_PTHREAD_RWLOCK_T 32 | |
| 30 | # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 | |
| 31 | # define __SIZEOF_PTHREAD_BARRIER_T 20 | |
| 32 | # define __SIZEOF_PTHREAD_BARRIERATTR_T 4 | |
| 33 | ||
| 34 | /* Definitions for internal mutex struct. */ | |
| 35 | #define __PTHREAD_COMPAT_PADDING_MID | |
| 36 | #define __PTHREAD_COMPAT_PADDING_END | |
| 37 | #define __PTHREAD_MUTEX_LOCK_ELISION 0 | |
| 38 | #define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1 | |
| 39 | #define __PTHREAD_MUTEX_USE_UNION 1 | |
| 40 | ||
| 41 | #define __LOCK_ALIGNMENT | |
| 42 | #define __ONCE_ALIGNMENT | |
| 43 | ||
| 44 | struct __pthread_rwlock_arch_t | |
| 45 | { | |
| 46 | unsigned int __readers; | |
| 47 | unsigned int __writers; | |
| 48 | unsigned int __wrphase_futex; | |
| 49 | unsigned int __writers_futex; | |
| 50 | unsigned int __pad3; | |
| 51 | unsigned int __pad4; | |
| 52 | # if __BYTE_ORDER == __BIG_ENDIAN | |
| 53 | unsigned char __pad1; | |
| 54 | unsigned char __pad2; | |
| 55 | unsigned char __shared; | |
| 56 | /* FLAGS must stay at this position in the structure to maintain | |
| 57 | binary compatibility. */ | |
| 58 | unsigned char __flags; | |
| 59 | # else | |
| 60 | /* FLAGS must stay at this position in the structure to maintain | |
| 61 | binary compatibility. */ | |
| 62 | unsigned char __flags; | |
| 63 | unsigned char __shared; | |
| 64 | unsigned char __pad1; | |
| 65 | unsigned char __pad2; | |
| 66 | # endif | |
| 67 | int __cur_writer; | |
| 68 | }; | |
| 69 | ||
| 70 | # define __PTHREAD_RWLOCK_ELISION_EXTRA 0 | |
| 71 | ||
| 72 | #endif	/* bits/pthreadtypes.h. */ |
lib/libc/glibc/sysdeps/microblaze/start.S+5-5| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 2 | 2 | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| ... | ... | @@ -63,14 +63,14 @@ _start: |
| 63 | 63 | mfs r20,rpc |
| 64 | 64 | addik r20,r20,_GLOBAL_OFFSET_TABLE_+8 |
| 65 | 65 | lwi r5,r20,main@GOT |
| 66 | lwi r8,r20,__libc_csu_init@GOT | |
| 67 | lwi r9,r20,__libc_csu_fini@GOT | |
| 66 | addk r8,r0,r0		/* Used to be init. */ | |
| 67 | addk r9,r0,r0		/* Used to be fini. */ | |
| 68 | 68 | brid __libc_start_main@PLT |
| 69 | 69 | addk r10,r0,r0 |
| 70 | 70 | #else |
| 71 | 71 | addik r5,r0,main |
| 72 | addik r8,r0,__libc_csu_init | |
| 73 | addik r9,r0,__libc_csu_fini | |
| 72 | addk r8,r0,r0		/* Used to be init. */ | |
| 73 | addk r9,r0,r0		/* Used to be fini. */ | |
| 74 | 74 | brid __libc_start_main |
| 75 | 75 | addk r10,r0,r0 |
| 76 | 76 | #endif |
lib/libc/glibc/sysdeps/microblaze/sysdep.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1997-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1997-2021 Free Software Foundation, Inc. | |
| 2 | 2 | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 |
lib/libc/glibc/sysdeps/mips/dl-dtprocnum.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Configuration of lookup functions. MIPS version. |
| 2 | Copyright (C) 2000-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2000-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/mips/mips32/crti.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for MIPS (o32). |
| 2 | Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/mips/mips32/crtn.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for MIPS (o32). |
| 2 | Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/mips/mips64/n32/crti.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for MIPS (n32). |
| 2 | Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/mips/mips64/n32/crtn.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for MIPS (n32). |
| 2 | Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/mips/mips64/n64/crti.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for MIPS (n64). |
| 2 | Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/mips/mips64/n64/crtn.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for MIPS (n64). |
| 2 | Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/mips/nptl/bits/pthreadtypes-arch.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Machine-specific pthread type layouts. MIPS version. |
| 2 | Copyright (C) 2005-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2005-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/mips/start.S+8-12| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Startup code compliant to the ELF Mips ABI. |
| 2 | Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -96,13 +96,13 @@ ENTRY_POINT: |
| 96 | 96 | # if _MIPS_SIM == _ABIO32 |
| 97 | 97 | 	PTR_SUBIU $29, 32 |
| 98 | 98 | # endif |
| 99 | 	PTR_LA $7, __libc_csu_init		/* init */ | |
| 100 | 	PTR_LA $8, __libc_csu_fini | |
| 99 | 	move $7, $0			/* Used to be init. */ | |
| 101 | 100 | # if _MIPS_SIM == _ABIO32 |
| 102 | 	PTR_S $8, 16($29)		/* fini */ | |
| 101 | 	PTR_S $0, 16($29)		/* Used to be fini. */ | |
| 103 | 102 | 	PTR_S $2, 20($29)		/* rtld_fini */ |
| 104 | 103 | 	PTR_S $29, 24($29)		/* stack_end */ |
| 105 | 104 | # else |
| 105 | 	move $8, $0		/* Used to be fini. */ | |
| 106 | 106 | 	move $9, $2		/* rtld_fini */ |
| 107 | 107 | 	move $10, $29		/* stack_end */ |
| 108 | 108 | # endif |
| ... | ... | @@ -143,19 +143,17 @@ ENTRY_POINT: |
| 143 | 143 | 	/* Lay out last arguments, and call __libc_start_main(). */ |
| 144 | 144 | # ifdef __PIC__ |
| 145 | 145 | 	sw	$7, 24($sp)			/* stack_end */ |
| 146 | 	lw	$4, %got(__libc_csu_fini)($3) | |
| 147 | 	lw	$7, %got(__libc_csu_init)($3)	/* init */ | |
| 148 | 	sw	$4, 16($sp)			/* fini */ | |
| 146 | 	move	$4, $0				/* Used to be ini. */ | |
| 147 | 	sw	$0, 16($sp)			/* Used to be fini. */ | |
| 149 | 148 | 	lw	$4, %got(main)($3)		/* main */ |
| 150 | 149 | 	lw	$3, %call16(__libc_start_main)($3) |
| 151 | 150 | 	sw	$2, 20($sp)			/* rtld_fini */ |
| 152 | 151 | 	move	$25, $3 |
| 153 | 152 | 	jalr	$3 |
| 154 | 153 | # else |
| 155 | 	lw	$4, 1f | |
| 156 | 154 | 	sw	$7, 24($sp)			/* stack_end */ |
| 157 | 	lw	$7, 2f				/* init */ | |
| 158 | 	sw	$4, 16($sp)			/* fini */ | |
| 155 | 	move	$7, $0				/* Used to be init. */ | |
| 156 | 	sw	$0, 16($sp)			/* Used to be fini. */ | |
| 159 | 157 | 	lw	$4, 3f				/* main */ |
| 160 | 158 | 	sw	$2, 20($sp)			/* rtld_fini */ |
| 161 | 159 | 	/* Load and call __libc_start_main(). */ |
| ... | ... | @@ -165,8 +163,6 @@ ENTRY_POINT: |
| 165 | 163 | hlt:	b	hlt		/* Crash if somehow it does return. */ |
| 166 | 164 | # ifndef __PIC__ |
| 167 | 165 | 	.align	2 |
| 168 | 1:	.word	__libc_csu_fini | |
| 169 | 2:	.word	__libc_csu_init | |
| 170 | 166 | 3:	.word	main |
| 171 | 167 | 4:	.word	__libc_start_main |
| 172 | 168 | # endif |
lib/libc/glibc/sysdeps/nptl/bits/pthreadtypes.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Declaration of common pthread types for all architectures. |
| 2 | Copyright (C) 2017-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2017-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/nptl/bits/thread-shared-types.h+11-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Common threading primitives definitions for both POSIX and C11. |
| 2 | Copyright (C) 2017-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2017-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -116,4 +116,14 @@ struct __pthread_cond_s |
| 116 | 116 | unsigned int __g_signals[2]; |
| 117 | 117 | }; |
| 118 | 118 | |
| 119 | typedef unsigned int __tss_t; | |
| 120 | typedef unsigned long int __thrd_t; | |
| 121 | ||
| 122 | typedef struct | |
| 123 | { | |
| 124 | int __data __ONCE_ALIGNMENT; | |
| 125 | } __once_flag; | |
| 126 | ||
| 127 | #define __ONCE_FLAG_INIT { 0 } | |
| 128 | ||
| 119 | 129 | #endif /* _THREAD_SHARED_TYPES_H */ |
lib/libc/glibc/sysdeps/nptl/libc-lock.h+31-30| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* libc-internal interface for mutex locks. NPTL version. |
| 2 | Copyright (C) 1996-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1996-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -143,39 +143,40 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t; |
| 143 | 143 | __libc_maybe_call (__pthread_mutex_unlock, (&(NAME).mutex), 0) |
| 144 | 144 | #endif |
| 145 | 145 | |
| 146 | /* Note that for I/O cleanup handling we are using the old-style | |
| 147 | cancel handling. It does not have to be integrated with C++ since | |
| 148 | no C++ code is called in the middle. The old-style handling is | |
| 149 | faster and the support is not going away. */ | |
| 150 | extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer, | |
| 151 | 					 void (*routine) (void *), void *arg); | |
| 152 | extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer, | |
| 153 | 					 int execute); | |
| 146 | /* Put the unwind buffer BUFFER on the per-thread callback stack. The | |
| 147 | caller must fill BUFFER->__routine and BUFFER->__arg before calling | |
| 148 | this function. */ | |
| 149 | void __libc_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer); | |
| 150 | libc_hidden_proto (__libc_cleanup_push_defer) | |
| 151 | /* Remove BUFFER from the unwind callback stack. The caller must invoke | |
| 152 | the callback if desired. */ | |
| 153 | void __libc_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer); | |
| 154 | libc_hidden_proto (__libc_cleanup_pop_restore) | |
| 154 | 155 | |
| 155 | 156 | /* Start critical region with cleanup. */ |
| 156 | #define __libc_cleanup_region_start(DOIT, FCT, ARG) \ | |
| 157 | { struct _pthread_cleanup_buffer _buffer;				 \ | |
| 158 | int _avail;								 \ | |
| 159 | if (DOIT) {								 \ | |
| 160 | _avail = PTFAVAIL (_pthread_cleanup_push_defer);			 \ | |
| 161 | if (_avail) {							 \ | |
| 162 | 	__libc_ptf_call_always (_pthread_cleanup_push_defer, (&_buffer, FCT, \ | |
| 163 | 							 ARG));	 \ | |
| 164 | } else {								 \ | |
| 165 | 	_buffer.__routine = (FCT);					 \ | |
| 166 | 	_buffer.__arg = (ARG);						 \ | |
| 167 | }									 \ | |
| 168 | } else {								 \ | |
| 169 | _avail = 0;							 \ | |
| 170 | } | |
| 157 | #define __libc_cleanup_region_start(DOIT, FCT, ARG)			\ | |
| 158 | { bool _cleanup_start_doit;						\ | |
| 159 | struct _pthread_cleanup_buffer _buffer;				\ | |
| 160 | /* Non-addressable copy of FCT, so that we avoid indirect calls on	\ | |
| 161 | the non-unwinding path. */					\ | |
| 162 | void (*_cleanup_routine) (void *) = (FCT);				\ | |
| 163 | _buffer.__arg = (ARG);						\ | |
| 164 | if (DOIT)								\ | |
| 165 | {									\ | |
| 166 | _cleanup_start_doit = true;					\ | |
| 167 | _buffer.__routine = _cleanup_routine;				\ | |
| 168 | __libc_cleanup_push_defer (&_buffer);				\ | |
| 169 | }									\ | |
| 170 | else									\ | |
| 171 | _cleanup_start_doit = false; | |
| 171 | 172 | |
| 172 | 173 | /* End critical region with cleanup. */ |
| 173 | #define __libc_cleanup_region_end(DOIT) \ | |
| 174 | if (_avail) {							 \ | |
| 175 | __libc_ptf_call_always (_pthread_cleanup_pop_restore, (&_buffer, DOIT));\ | |
| 176 | } else if (DOIT)							 \ | |
| 177 | _buffer.__routine (_buffer.__arg);				 \ | |
| 178 | } | |
| 174 | #define __libc_cleanup_region_end(DOIT)		\ | |
| 175 | if (_cleanup_start_doit)			\ | |
| 176 | __libc_cleanup_pop_restore (&_buffer);	\ | |
| 177 | if (DOIT)					\ | |
| 178 | _cleanup_routine (_buffer.__arg);		\ | |
| 179 | } /* matches __libc_cleanup_region_start */ | |
| 179 | 180 | |
| 180 | 181 | |
| 181 | 182 | /* Hide the definitions which are only supposed to be used inside libc in |
lib/libc/glibc/sysdeps/nptl/libc-lockP.h+49-224| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Private libc-internal interface for mutex locks. NPTL version. |
| 2 | Copyright (C) 1996-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1996-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -32,26 +32,12 @@ |
| 32 | 32 | ld.so might be used on old kernels with a different libc.so. */ |
| 33 | 33 | #include <lowlevellock.h> |
| 34 | 34 | #include <tls.h> |
| 35 | #include <pthread-functions.h> | |
| 36 | ||
| 37 | #if IS_IN (libpthread) | |
| 38 | /* This gets us the declarations of the __pthread_* internal names, | |
| 39 | and hidden_proto for them. */ | |
| 40 | # include <nptl/pthreadP.h> | |
| 41 | #endif | |
| 42 | 35 | |
| 43 | 36 | /* Mutex type. */ |
| 44 | #if !IS_IN (libc) && !IS_IN (libpthread) | |
| 45 | typedef pthread_mutex_t __libc_lock_t; | |
| 46 | #else | |
| 47 | 37 | typedef int __libc_lock_t; |
| 48 | #endif | |
| 49 | 38 | typedef struct { pthread_mutex_t mutex; } __rtld_lock_recursive_t; |
| 50 | 39 | typedef pthread_rwlock_t __libc_rwlock_t; |
| 51 | 40 | |
| 52 | /* Type for key to thread-specific data. */ | |
| 53 | typedef pthread_key_t __libc_key_t; | |
| 54 | ||
| 55 | 41 | /* Define a lock variable NAME with storage class CLASS. The lock must be |
| 56 | 42 | initialized with __libc_lock_init before it can be used (or define it |
| 57 | 43 | with __libc_lock_define_initialized, below). Use `extern' for CLASS to |
| ... | ... | @@ -103,126 +89,48 @@ _Static_assert (LLL_LOCK_INITIALIZER == 0, "LLL_LOCK_INITIALIZER != 0"); |
| 103 | 89 | (FUNC != NULL ? FUNC ARGS : ELSE) |
| 104 | 90 | #endif |
| 105 | 91 | |
| 106 | /* Call thread functions through the function pointer table. */ | |
| 107 | #if defined SHARED && IS_IN (libc) | |
| 108 | # define PTFAVAIL(NAME) __libc_pthread_functions_init | |
| 109 | # define __libc_ptf_call(FUNC, ARGS, ELSE) \ | |
| 110 | (__libc_pthread_functions_init ? PTHFCT_CALL (ptr_##FUNC, ARGS) : ELSE) | |
| 111 | # define __libc_ptf_call_always(FUNC, ARGS) \ | |
| 112 | PTHFCT_CALL (ptr_##FUNC, ARGS) | |
| 113 | #elif IS_IN (libpthread) | |
| 114 | # define PTFAVAIL(NAME) 1 | |
| 115 | # define __libc_ptf_call(FUNC, ARGS, ELSE) \ | |
| 116 | FUNC ARGS | |
| 117 | # define __libc_ptf_call_always(FUNC, ARGS) \ | |
| 118 | FUNC ARGS | |
| 119 | #else | |
| 120 | # define PTFAVAIL(NAME) (NAME != NULL) | |
| 121 | # define __libc_ptf_call(FUNC, ARGS, ELSE) \ | |
| 122 | __libc_maybe_call (FUNC, ARGS, ELSE) | |
| 123 | # define __libc_ptf_call_always(FUNC, ARGS) \ | |
| 124 | FUNC ARGS | |
| 125 | #endif | |
| 126 | ||
| 92 | /* All previously forwarded functions are now called directly (either | |
| 93 | via local call in libc, or through a __export), but __libc_ptf_call | |
| 94 | is still used in generic code shared with Hurd. */ | |
| 95 | #define PTFAVAIL(NAME) 1 | |
| 96 | #define __libc_ptf_call(FUNC, ARGS, ELSE) FUNC ARGS | |
| 97 | #define __libc_ptf_call_always(FUNC, ARGS) FUNC ARGS | |
| 127 | 98 | |
| 128 | 99 | /* Initialize the named lock variable, leaving it in a consistent, unlocked |
| 129 | 100 | state. */ |
| 130 | #if IS_IN (libc) || IS_IN (libpthread) | |
| 131 | # define __libc_lock_init(NAME) \ | |
| 132 | ((void) ((NAME) = LLL_LOCK_INITIALIZER)) | |
| 133 | #else | |
| 134 | # define __libc_lock_init(NAME) \ | |
| 135 | __libc_maybe_call (__pthread_mutex_init, (&(NAME), NULL), 0) | |
| 136 | #endif | |
| 137 | #if defined SHARED && IS_IN (libc) | |
| 138 | /* ((NAME) = (__libc_rwlock_t) PTHREAD_RWLOCK_INITIALIZER) is inefficient. */ | |
| 139 | # define __libc_rwlock_init(NAME) \ | |
| 140 | ((void) __builtin_memset (&(NAME), '\0', sizeof (NAME))) | |
| 141 | #else | |
| 142 | # define __libc_rwlock_init(NAME) \ | |
| 143 | __libc_maybe_call (__pthread_rwlock_init, (&(NAME), NULL), 0) | |
| 144 | #endif | |
| 101 | #define __libc_lock_init(NAME) ((void) ((NAME) = LLL_LOCK_INITIALIZER)) | |
| 102 | #define __libc_rwlock_init(NAME) __pthread_rwlock_init (&(NAME), NULL) | |
| 145 | 103 | |
| 146 | 104 | /* Finalize the named lock variable, which must be locked. It cannot be |
| 147 | 105 | used again until __libc_lock_init is called again on it. This must be |
| 148 | 106 | called on a lock variable before the containing storage is reused. */ |
| 149 | #if IS_IN (libc) || IS_IN (libpthread) | |
| 150 | # define __libc_lock_fini(NAME) ((void) 0) | |
| 151 | #else | |
| 152 | # define __libc_lock_fini(NAME) \ | |
| 153 | __libc_maybe_call (__pthread_mutex_destroy, (&(NAME)), 0) | |
| 154 | #endif | |
| 155 | #if defined SHARED && IS_IN (libc) | |
| 156 | # define __libc_rwlock_fini(NAME) ((void) 0) | |
| 157 | #else | |
| 158 | # define __libc_rwlock_fini(NAME) \ | |
| 159 | __libc_maybe_call (__pthread_rwlock_destroy, (&(NAME)), 0) | |
| 160 | #endif | |
| 107 | #define __libc_lock_fini(NAME) ((void) 0) | |
| 108 | #define __libc_rwlock_fini(NAME) ((void) 0) | |
| 161 | 109 | |
| 162 | 110 | /* Lock the named lock variable. */ |
| 163 | #if IS_IN (libc) || IS_IN (libpthread) | |
| 164 | # ifndef __libc_lock_lock | |
| 165 | # define __libc_lock_lock(NAME) \ | |
| 166 | ({ lll_lock (NAME, LLL_PRIVATE); 0; }) | |
| 167 | # endif | |
| 168 | #else | |
| 169 | # undef __libc_lock_lock | |
| 170 | # define __libc_lock_lock(NAME) \ | |
| 171 | __libc_maybe_call (__pthread_mutex_lock, (&(NAME)), 0) | |
| 172 | #endif | |
| 173 | #define __libc_rwlock_rdlock(NAME) \ | |
| 174 | __libc_ptf_call (__pthread_rwlock_rdlock, (&(NAME)), 0) | |
| 175 | #define __libc_rwlock_wrlock(NAME) \ | |
| 176 | __libc_ptf_call (__pthread_rwlock_wrlock, (&(NAME)), 0) | |
| 111 | #define __libc_lock_lock(NAME) ({ lll_lock (NAME, LLL_PRIVATE); 0; }) | |
| 112 | #define __libc_rwlock_rdlock(NAME) __pthread_rwlock_rdlock (&(NAME)) | |
| 113 | #define __libc_rwlock_wrlock(NAME) __pthread_rwlock_wrlock (&(NAME)) | |
| 177 | 114 | |
| 178 | 115 | /* Try to lock the named lock variable. */ |
| 179 | #if IS_IN (libc) || IS_IN (libpthread) | |
| 180 | # ifndef __libc_lock_trylock | |
| 181 | # define __libc_lock_trylock(NAME) \ | |
| 182 | lll_trylock (NAME) | |
| 183 | # endif | |
| 184 | #else | |
| 185 | # undef __libc_lock_trylock | |
| 186 | # define __libc_lock_trylock(NAME) \ | |
| 187 | __libc_maybe_call (__pthread_mutex_trylock, (&(NAME)), 0) | |
| 188 | #endif | |
| 189 | #define __libc_rwlock_tryrdlock(NAME) \ | |
| 190 | __libc_maybe_call (__pthread_rwlock_tryrdlock, (&(NAME)), 0) | |
| 191 | #define __libc_rwlock_trywrlock(NAME) \ | |
| 192 | __libc_maybe_call (__pthread_rwlock_trywrlock, (&(NAME)), 0) | |
| 193 | ||
| 194 | #define __rtld_lock_trylock_recursive(NAME) \ | |
| 195 | __libc_maybe_call (__pthread_mutex_trylock, (&(NAME).mutex), 0) | |
| 116 | #define __libc_lock_trylock(NAME) lll_trylock (NAME) | |
| 196 | 117 | |
| 197 | 118 | /* Unlock the named lock variable. */ |
| 198 | #if IS_IN (libc) || IS_IN (libpthread) | |
| 199 | # define __libc_lock_unlock(NAME) \ | |
| 200 | lll_unlock (NAME, LLL_PRIVATE) | |
| 201 | #else | |
| 202 | # define __libc_lock_unlock(NAME) \ | |
| 203 | __libc_maybe_call (__pthread_mutex_unlock, (&(NAME)), 0) | |
| 204 | #endif | |
| 205 | #define __libc_rwlock_unlock(NAME) \ | |
| 206 | __libc_ptf_call (__pthread_rwlock_unlock, (&(NAME)), 0) | |
| 207 | ||
| 208 | #ifdef SHARED | |
| 209 | # define __rtld_lock_default_lock_recursive(lock) \ | |
| 210 | ++((pthread_mutex_t *)(lock))->__data.__count; | |
| 211 | ||
| 212 | # define __rtld_lock_default_unlock_recursive(lock) \ | |
| 213 | --((pthread_mutex_t *)(lock))->__data.__count; | |
| 119 | #define __libc_lock_unlock(NAME) lll_unlock (NAME, LLL_PRIVATE) | |
| 120 | #define __libc_rwlock_unlock(NAME) __pthread_rwlock_unlock (&(NAME)) | |
| 214 | 121 | |
| 122 | #if IS_IN (rtld) | |
| 215 | 123 | # define __rtld_lock_lock_recursive(NAME) \ |
| 216 | GL(dl_rtld_lock_recursive) (&(NAME).mutex) | |
| 124 | ___rtld_mutex_lock (&(NAME).mutex) | |
| 217 | 125 | |
| 218 | 126 | # define __rtld_lock_unlock_recursive(NAME) \ |
| 219 | GL(dl_rtld_unlock_recursive) (&(NAME).mutex) | |
| 220 | #else | |
| 127 | ___rtld_mutex_unlock (&(NAME).mutex) | |
| 128 | #else /* Not in the dynamic loader. */ | |
| 221 | 129 | # define __rtld_lock_lock_recursive(NAME) \ |
| 222 | __libc_maybe_call (__pthread_mutex_lock, (&(NAME).mutex), 0) | |
| 130 | __pthread_mutex_lock (&(NAME).mutex) | |
| 223 | 131 | |
| 224 | 132 | # define __rtld_lock_unlock_recursive(NAME) \ |
| 225 | __libc_maybe_call (__pthread_mutex_unlock, (&(NAME).mutex), 0) | |
| 133 | __pthread_mutex_unlock (&(NAME).mutex) | |
| 226 | 134 | #endif |
| 227 | 135 | |
| 228 | 136 | /* Define once control variable. */ |
| ... | ... | @@ -236,74 +144,42 @@ _Static_assert (LLL_LOCK_INITIALIZER == 0, "LLL_LOCK_INITIALIZER != 0"); |
| 236 | 144 | CLASS pthread_once_t NAME = PTHREAD_ONCE_INIT |
| 237 | 145 | #endif |
| 238 | 146 | |
| 239 | /* Call handler iff the first call. */ | |
| 240 | #define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \ | |
| 241 | do {									 \ | |
| 242 | if (PTFAVAIL (__pthread_once))					 \ | |
| 243 | __libc_ptf_call_always (__pthread_once, (&(ONCE_CONTROL),		 \ | |
| 244 | 					 INIT_FUNCTION));		 \ | |
| 245 | else if ((ONCE_CONTROL) == PTHREAD_ONCE_INIT) {			 \ | |
| 246 | INIT_FUNCTION ();							 \ | |
| 247 | (ONCE_CONTROL) |= 2;						 \ | |
| 248 | }									 \ | |
| 249 | } while (0) | |
| 147 | /* Call handler iff the first call. Use a local call in libc, but the | |
| 148 | global pthread_once symbol elsewhere. */ | |
| 149 | #if IS_IN (libc) | |
| 150 | # define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \ | |
| 151 | __pthread_once (&(ONCE_CONTROL), INIT_FUNCTION) | |
| 152 | #else | |
| 153 | # define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \ | |
| 154 | pthread_once (&(ONCE_CONTROL), INIT_FUNCTION) | |
| 155 | #endif | |
| 250 | 156 | |
| 251 | 157 | /* Get once control variable. */ |
| 252 | 158 | #define __libc_once_get(ONCE_CONTROL)	((ONCE_CONTROL) != PTHREAD_ONCE_INIT) |
| 253 | 159 | |
| 254 | /* Note that for I/O cleanup handling we are using the old-style | |
| 255 | cancel handling. It does not have to be integrated with C++ snce | |
| 256 | no C++ code is called in the middle. The old-style handling is | |
| 257 | faster and the support is not going away. */ | |
| 258 | extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *buffer, | |
| 259 | 				 void (*routine) (void *), void *arg); | |
| 260 | extern void _pthread_cleanup_pop (struct _pthread_cleanup_buffer *buffer, | |
| 261 | 				 int execute); | |
| 262 | extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer, | |
| 263 | 					 void (*routine) (void *), void *arg); | |
| 264 | extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer, | |
| 265 | 					 int execute); | |
| 266 | ||
| 267 | /* Sometimes we have to exit the block in the middle. */ | |
| 268 | #define __libc_cleanup_end(DOIT) \ | |
| 269 | if (_avail) {							 \ | |
| 270 | __libc_ptf_call_always (_pthread_cleanup_pop_restore, (&_buffer, DOIT));\ | |
| 271 | } else if (DOIT)							 \ | |
| 272 | _buffer.__routine (_buffer.__arg) | |
| 273 | ||
| 160 | /* __libc_cleanup_push and __libc_cleanup_pop depend on exception | |
| 161 | handling and stack unwinding. */ | |
| 162 | #ifdef __EXCEPTIONS | |
| 274 | 163 | |
| 275 | 164 | /* Normal cleanup handling, based on C cleanup attribute. */ |
| 276 | __extern_inline void | |
| 165 | static __always_inline void | |
| 277 | 166 | __libc_cleanup_routine (struct __pthread_cleanup_frame *f) |
| 278 | 167 | { |
| 279 | 168 | if (f->__do_it) |
| 280 | 169 | f->__cancel_routine (f->__cancel_arg); |
| 281 | 170 | } |
| 282 | 171 | |
| 283 | #define __libc_cleanup_push(fct, arg) \ | |
| 172 | # define __libc_cleanup_push(fct, arg) \ | |
| 284 | 173 | do {									 \ |
| 285 | 174 | struct __pthread_cleanup_frame __clframe				 \ |
| 286 | 175 | __attribute__ ((__cleanup__ (__libc_cleanup_routine)))		 \ |
| 287 | 176 | = { .__cancel_routine = (fct), .__cancel_arg = (arg),		 \ |
| 288 | 177 | 	 .__do_it = 1 }; |
| 289 | 178 | |
| 290 | #define __libc_cleanup_pop(execute) \ | |
| 179 | # define __libc_cleanup_pop(execute) \ | |
| 291 | 180 | __clframe.__do_it = (execute);					 \ |
| 292 | 181 | } while (0) |
| 293 | ||
| 294 | ||
| 295 | /* Create thread-specific key. */ | |
| 296 | #define __libc_key_create(KEY, DESTRUCTOR) \ | |
| 297 | __libc_ptf_call (__pthread_key_create, (KEY, DESTRUCTOR), 1) | |
| 298 | ||
| 299 | /* Get thread-specific data. */ | |
| 300 | #define __libc_getspecific(KEY) \ | |
| 301 | __libc_ptf_call (__pthread_getspecific, (KEY), NULL) | |
| 302 | ||
| 303 | /* Set thread-specific data. */ | |
| 304 | #define __libc_setspecific(KEY, VALUE) \ | |
| 305 | __libc_ptf_call (__pthread_setspecific, (KEY, VALUE), 0) | |
| 306 | ||
| 182 | #endif /* __EXCEPTIONS */ | |
| 307 | 183 | |
| 308 | 184 | /* Register handlers to execute before and after `fork'. Note that the |
| 309 | 185 | last parameter is NULL. The handlers registered by the libc are |
| ... | ... | @@ -318,107 +194,56 @@ extern int __register_atfork (void (*__prepare) (void), |
| 318 | 194 | |
| 319 | 195 | extern int __pthread_mutex_init (pthread_mutex_t *__mutex, |
| 320 | 196 | 				 const pthread_mutexattr_t *__mutex_attr); |
| 321 | ||
| 197 | libc_hidden_proto (__pthread_mutex_init) | |
| 322 | 198 | extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex); |
| 323 | ||
| 199 | libc_hidden_proto (__pthread_mutex_destroy) | |
| 324 | 200 | extern int __pthread_mutex_trylock (pthread_mutex_t *__mutex); |
| 325 | 201 | |
| 326 | 202 | extern int __pthread_mutex_lock (pthread_mutex_t *__mutex); |
| 327 | ||
| 203 | libc_hidden_proto (__pthread_mutex_lock) | |
| 328 | 204 | extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex); |
| 329 | ||
| 330 | extern int __pthread_mutexattr_init (pthread_mutexattr_t *__attr); | |
| 205 | libc_hidden_proto (__pthread_mutex_unlock) | |
| 331 | 206 | |
| 332 | 207 | extern int __pthread_mutexattr_destroy (pthread_mutexattr_t *__attr); |
| 333 | 208 | |
| 334 | extern int __pthread_mutexattr_settype (pthread_mutexattr_t *__attr, | |
| 335 | 					int __kind); | |
| 336 | ||
| 337 | 209 | extern int __pthread_rwlock_init (pthread_rwlock_t *__rwlock, |
| 338 | 210 | 				 const pthread_rwlockattr_t *__attr); |
| 211 | libc_hidden_proto (__pthread_rwlock_init) | |
| 339 | 212 | |
| 340 | 213 | extern int __pthread_rwlock_destroy (pthread_rwlock_t *__rwlock); |
| 341 | 214 | |
| 342 | 215 | extern int __pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock); |
| 343 | ||
| 344 | extern int __pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock); | |
| 216 | libc_hidden_proto (__pthread_rwlock_rdlock) | |
| 345 | 217 | |
| 346 | 218 | extern int __pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock); |
| 347 | ||
| 348 | extern int __pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock); | |
| 219 | libc_hidden_proto (__pthread_rwlock_wrlock) | |
| 349 | 220 | |
| 350 | 221 | extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock); |
| 351 | ||
| 352 | extern int __pthread_key_create (pthread_key_t *__key, | |
| 353 | 				 void (*__destr_function) (void *)); | |
| 354 | ||
| 355 | extern int __pthread_setspecific (pthread_key_t __key, | |
| 356 | 				 const void *__pointer); | |
| 357 | ||
| 358 | extern void *__pthread_getspecific (pthread_key_t __key); | |
| 359 | ||
| 222 | libc_hidden_proto (__pthread_rwlock_unlock) | |
| 360 | 223 | extern int __pthread_once (pthread_once_t *__once_control, |
| 361 | 224 | 			 void (*__init_routine) (void)); |
| 225 | libc_hidden_proto (__pthread_once) | |
| 362 | 226 | |
| 363 | 227 | extern int __pthread_atfork (void (*__prepare) (void), |
| 364 | 228 | 			 void (*__parent) (void), |
| 365 | 229 | 			 void (*__child) (void)); |
| 366 | 230 | |
| 367 | 231 | extern int __pthread_setcancelstate (int state, int *oldstate); |
| 368 | ||
| 232 | libc_hidden_proto (__pthread_setcancelstate) | |
| 369 | 233 | |
| 370 | 234 | /* Make the pthread functions weak so that we can elide them from |
| 371 | 235 | single-threaded processes. */ |
| 372 | 236 | #ifndef __NO_WEAK_PTHREAD_ALIASES |
| 373 | 237 | # ifdef weak_extern |
| 374 | weak_extern (__pthread_mutex_init) | |
| 375 | weak_extern (__pthread_mutex_destroy) | |
| 376 | weak_extern (__pthread_mutex_lock) | |
| 377 | 238 | weak_extern (__pthread_mutex_trylock) |
| 378 | weak_extern (__pthread_mutex_unlock) | |
| 379 | weak_extern (__pthread_mutexattr_init) | |
| 380 | 239 | weak_extern (__pthread_mutexattr_destroy) |
| 381 | weak_extern (__pthread_mutexattr_settype) | |
| 382 | weak_extern (__pthread_rwlock_init) | |
| 383 | weak_extern (__pthread_rwlock_destroy) | |
| 384 | weak_extern (__pthread_rwlock_rdlock) | |
| 385 | weak_extern (__pthread_rwlock_tryrdlock) | |
| 386 | weak_extern (__pthread_rwlock_wrlock) | |
| 387 | weak_extern (__pthread_rwlock_trywrlock) | |
| 388 | weak_extern (__pthread_rwlock_unlock) | |
| 389 | weak_extern (__pthread_key_create) | |
| 390 | weak_extern (__pthread_setspecific) | |
| 391 | weak_extern (__pthread_getspecific) | |
| 392 | weak_extern (__pthread_once) | |
| 393 | 240 | weak_extern (__pthread_initialize) |
| 394 | 241 | weak_extern (__pthread_atfork) |
| 395 | weak_extern (__pthread_setcancelstate) | |
| 396 | weak_extern (_pthread_cleanup_push_defer) | |
| 397 | weak_extern (_pthread_cleanup_pop_restore) | |
| 398 | 242 | # else |
| 399 | # pragma weak __pthread_mutex_init | |
| 400 | # pragma weak __pthread_mutex_destroy | |
| 401 | # pragma weak __pthread_mutex_lock | |
| 402 | 243 | # pragma weak __pthread_mutex_trylock |
| 403 | # pragma weak __pthread_mutex_unlock | |
| 404 | # pragma weak __pthread_mutexattr_init | |
| 405 | 244 | # pragma weak __pthread_mutexattr_destroy |
| 406 | # pragma weak __pthread_mutexattr_settype | |
| 407 | # pragma weak __pthread_rwlock_destroy | |
| 408 | # pragma weak __pthread_rwlock_rdlock | |
| 409 | # pragma weak __pthread_rwlock_tryrdlock | |
| 410 | # pragma weak __pthread_rwlock_wrlock | |
| 411 | # pragma weak __pthread_rwlock_trywrlock | |
| 412 | # pragma weak __pthread_rwlock_unlock | |
| 413 | # pragma weak __pthread_key_create | |
| 414 | # pragma weak __pthread_setspecific | |
| 415 | # pragma weak __pthread_getspecific | |
| 416 | # pragma weak __pthread_once | |
| 417 | 245 | # pragma weak __pthread_initialize |
| 418 | 246 | # pragma weak __pthread_atfork |
| 419 | # pragma weak __pthread_setcancelstate | |
| 420 | # pragma weak _pthread_cleanup_push_defer | |
| 421 | # pragma weak _pthread_cleanup_pop_restore | |
| 422 | 247 | # endif |
| 423 | 248 | #endif |
| 424 | 249 |
lib/libc/glibc/sysdeps/nptl/pthread.h+203-28| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 2002-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 2002-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -27,7 +27,11 @@ |
| 27 | 27 | #include <bits/setjmp.h> |
| 28 | 28 | #include <bits/wordsize.h> |
| 29 | 29 | #include <bits/types/struct_timespec.h> |
| 30 | ||
| 30 | #include <bits/types/__sigset_t.h> | |
| 31 | #include <bits/types/struct___jmp_buf_tag.h> | |
| 32 | #ifdef __USE_MISC | |
| 33 | # include <bits/pthread_stack_min-dynamic.h> | |
| 34 | #endif | |
| 31 | 35 | |
| 32 | 36 | /* Detach state. */ |
| 33 | 37 | enum |
| ... | ... | @@ -219,6 +223,7 @@ extern int pthread_join (pthread_t __th, void **__thread_return); |
| 219 | 223 | the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL. */ |
| 220 | 224 | extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW; |
| 221 | 225 | |
| 226 | # ifndef __USE_TIME_BITS64 | |
| 222 | 227 | /* Make calling thread wait for termination of the thread TH, but only |
| 223 | 228 | until TIMEOUT. The exit status of the thread is stored in |
| 224 | 229 | *THREAD_RETURN, if THREAD_RETURN is not NULL. |
| ... | ... | @@ -238,6 +243,23 @@ extern int pthread_timedjoin_np (pthread_t __th, void **__thread_return, |
| 238 | 243 | extern int pthread_clockjoin_np (pthread_t __th, void **__thread_return, |
| 239 | 244 | clockid_t __clockid, |
| 240 | 245 | 				 const struct timespec *__abstime); |
| 246 | # else | |
| 247 | # ifdef __REDIRECT | |
| 248 | extern int __REDIRECT (pthread_timedjoin_np, | |
| 249 | (pthread_t __th, void **__thread_return, | |
| 250 | const struct timespec *__abstime), | |
| 251 | __pthread_timedjoin_np64); | |
| 252 | ||
| 253 | extern int __REDIRECT (pthread_clockjoin_np, | |
| 254 | (pthread_t __th, void **__thread_return, | |
| 255 | clockid_t __clockid, | |
| 256 | const struct timespec *__abstime), | |
| 257 | __pthread_clockjoin_np64); | |
| 258 | # else | |
| 259 | # define pthread_timedjoin_np __pthread_timedjoin_np64 | |
| 260 | # define pthread_clockjoin_np __pthread_clockjoin_np64 | |
| 261 | # endif | |
| 262 | # endif | |
| 241 | 263 | #endif |
| 242 | 264 | |
| 243 | 265 | /* Indicate that the thread TH is never to be joined with PTHREAD_JOIN. |
| ... | ... | @@ -385,6 +407,20 @@ extern int pthread_attr_getaffinity_np (const pthread_attr_t *__attr, |
| 385 | 407 | extern int pthread_getattr_default_np (pthread_attr_t *__attr) |
| 386 | 408 | __THROW __nonnull ((1)); |
| 387 | 409 | |
| 410 | /* Store *SIGMASK as the signal mask for the new thread in *ATTR. */ | |
| 411 | extern int pthread_attr_setsigmask_np (pthread_attr_t *__attr, | |
| 412 | 				 const __sigset_t *sigmask); | |
| 413 | ||
| 414 | /* Store the signal mask of *ATTR in *SIGMASK. If there is no signal | |
| 415 | mask stored, return PTHREAD_ATTR_NOSIGMASK_NP. Return zero on | |
| 416 | success. */ | |
| 417 | extern int pthread_attr_getsigmask_np (const pthread_attr_t *__attr, | |
| 418 | 				 __sigset_t *sigmask); | |
| 419 | ||
| 420 | /* Special return value from pthread_attr_getsigmask_np if the signal | |
| 421 | mask has not been set. */ | |
| 422 | #define PTHREAD_ATTR_NO_SIGMASK_NP (-1) | |
| 423 | ||
| 388 | 424 | /* Set the default attributes to be used by pthread_create in this |
| 389 | 425 | process. */ |
| 390 | 426 | extern int pthread_setattr_default_np (const pthread_attr_t *__attr) |
| ... | ... | @@ -438,11 +474,14 @@ extern int pthread_setconcurrency (int __level) __THROW; |
| 438 | 474 | #endif |
| 439 | 475 | |
| 440 | 476 | #ifdef __USE_GNU |
| 441 | /* Yield the processor to another thread or process. | |
| 442 | This function is similar to the POSIX `sched_yield' function but | |
| 443 | might be differently implemented in the case of a m-on-n thread | |
| 444 | implementation. */ | |
| 445 | 477 | extern int pthread_yield (void) __THROW; |
| 478 | # ifdef __REDIRECT_NTH | |
| 479 | extern int __REDIRECT_NTH (pthread_yield, (void), sched_yield) | |
| 480 | __attribute_deprecated_msg__ ("\ | |
| 481 | pthread_yield is deprecated, use sched_yield instead"); | |
| 482 | # else | |
| 483 | # define pthread_yield sched_yield | |
| 484 | # endif | |
| 446 | 485 | |
| 447 | 486 | |
| 448 | 487 | /* Limit specified thread TH to run only on the processors represented |
| ... | ... | @@ -496,13 +535,15 @@ extern void pthread_testcancel (void); |
| 496 | 535 | |
| 497 | 536 | /* Cancellation handling with integration into exception handling. */ |
| 498 | 537 | |
| 538 | struct __cancel_jmp_buf_tag | |
| 539 | { | |
| 540 | __jmp_buf __cancel_jmp_buf; | |
| 541 | int __mask_was_saved; | |
| 542 | }; | |
| 543 | ||
| 499 | 544 | typedef struct |
| 500 | 545 | { |
| 501 | struct | |
| 502 | { | |
| 503 | __jmp_buf __cancel_jmp_buf; | |
| 504 | int __mask_was_saved; | |
| 505 | } __cancel_jmp_buf[1]; | |
| 546 | struct __cancel_jmp_buf_tag __cancel_jmp_buf[1]; | |
| 506 | 547 | void *__pad[4]; |
| 507 | 548 | } __pthread_unwind_buf_t __attribute__ ((__aligned__)); |
| 508 | 549 | |
| ... | ... | @@ -642,8 +683,8 @@ __pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame) |
| 642 | 683 | __pthread_unwind_buf_t __cancel_buf;				 \ |
| 643 | 684 | void (*__cancel_routine) (void *) = (routine);			 \ |
| 644 | 685 | void *__cancel_arg = (arg);						 \ |
| 645 | int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \ | |
| 646 | 					__cancel_buf.__cancel_jmp_buf, 0); \ | |
| 686 | int __not_first_call = __sigsetjmp_cancel (__cancel_buf.__cancel_jmp_buf, \ | |
| 687 | 					 0);			 \ | |
| 647 | 688 | if (__glibc_unlikely (__not_first_call))				 \ |
| 648 | 689 | {									 \ |
| 649 | 690 | 	__cancel_routine (__cancel_arg);				 \ |
| ... | ... | @@ -677,8 +718,8 @@ extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf) |
| 677 | 718 | __pthread_unwind_buf_t __cancel_buf;				 \ |
| 678 | 719 | void (*__cancel_routine) (void *) = (routine);			 \ |
| 679 | 720 | void *__cancel_arg = (arg);						 \ |
| 680 | int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \ | |
| 681 | 					__cancel_buf.__cancel_jmp_buf, 0); \ | |
| 721 | int __not_first_call = __sigsetjmp_cancel (__cancel_buf.__cancel_jmp_buf, \ | |
| 722 | 					 0);			 \ | |
| 682 | 723 | if (__glibc_unlikely (__not_first_call))				 \ |
| 683 | 724 | {									 \ |
| 684 | 725 | 	__cancel_routine (__cancel_arg);				 \ |
| ... | ... | @@ -714,9 +755,24 @@ extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf) |
| 714 | 755 | ; |
| 715 | 756 | #endif |
| 716 | 757 | |
| 717 | /* Function used in the macros. */ | |
| 718 | struct __jmp_buf_tag; | |
| 719 | extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL; | |
| 758 | /* Function used in the macros. Calling __sigsetjmp, with its first | |
| 759 | argument declared as an array, results in a -Wstringop-overflow | |
| 760 | warning from GCC 11 because struct pthread_unwind_buf is smaller | |
| 761 | than jmp_buf. The calls from the macros have __SAVEMASK set to 0, | |
| 762 | so nothing beyond the common prefix is used and this warning is a | |
| 763 | false positive. Use an alias with its first argument declared to | |
| 764 | use the type in the macros if possible to avoid this warning. */ | |
| 765 | #if __GNUC_PREREQ (11, 0) | |
| 766 | extern int __REDIRECT_NTHNL (__sigsetjmp_cancel, | |
| 767 | 			 (struct __cancel_jmp_buf_tag __env[1], | |
| 768 | 			 int __savemask), | |
| 769 | 			 __sigsetjmp) __attribute_returns_twice__; | |
| 770 | #else | |
| 771 | # define __sigsetjmp_cancel(env, savemask) \ | |
| 772 | __sigsetjmp ((struct __jmp_buf_tag *) (void *) (env), (savemask)) | |
| 773 | extern int __sigsetjmp (struct __jmp_buf_tag __env[1], | |
| 774 | 			int __savemask) __THROWNL; | |
| 775 | #endif | |
| 720 | 776 | |
| 721 | 777 | |
| 722 | 778 | /* Mutex handling. */ |
| ... | ... | @@ -740,16 +796,39 @@ extern int pthread_mutex_lock (pthread_mutex_t *__mutex) |
| 740 | 796 | |
| 741 | 797 | #ifdef __USE_XOPEN2K |
| 742 | 798 | /* Wait until lock becomes available, or specified time passes. */ |
| 799 | # ifndef __USE_TIME_BITS64 | |
| 743 | 800 | extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex, |
| 744 | 801 | 				 const struct timespec *__restrict |
| 745 | 802 | 				 __abstime) __THROWNL __nonnull ((1, 2)); |
| 803 | # else | |
| 804 | # ifdef __REDIRECT_NTHNL | |
| 805 | extern int __REDIRECT_NTHNL (pthread_mutex_timedlock, | |
| 806 | (pthread_mutex_t *__restrict __mutex, | |
| 807 | const struct timespec *__restrict __abstime), | |
| 808 | __pthread_mutex_timedlock64) __nonnull ((1, 2)); | |
| 809 | # else | |
| 810 | # define pthread_mutex_timedlock __pthread_mutex_timedlock64 | |
| 811 | # endif | |
| 812 | # endif | |
| 746 | 813 | #endif |
| 747 | 814 | |
| 748 | 815 | #ifdef __USE_GNU |
| 816 | # ifndef __USE_TIME_BITS64 | |
| 749 | 817 | extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex, |
| 750 | 818 | 				 clockid_t __clockid, |
| 751 | 819 | 				 const struct timespec *__restrict |
| 752 | 820 | 				 __abstime) __THROWNL __nonnull ((1, 3)); |
| 821 | # else | |
| 822 | # ifdef __REDIRECT_NTHNL | |
| 823 | extern int __REDIRECT_NTHNL (pthread_mutex_clocklock, | |
| 824 | (pthread_mutex_t *__restrict __mutex, | |
| 825 | clockid_t __clockid, | |
| 826 | const struct timespec *__restrict __abstime), | |
| 827 | __pthread_mutex_clocklock64) __nonnull ((1, 3)); | |
| 828 | # else | |
| 829 | # define pthread_mutex_clocklock __pthread_mutex_clocklock64 | |
| 830 | # endif | |
| 831 | # endif | |
| 753 | 832 | #endif |
| 754 | 833 | |
| 755 | 834 | /* Unlock a mutex. */ |
| ... | ... | @@ -776,8 +855,14 @@ extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex, |
| 776 | 855 | extern int pthread_mutex_consistent (pthread_mutex_t *__mutex) |
| 777 | 856 | __THROW __nonnull ((1)); |
| 778 | 857 | # ifdef __USE_GNU |
| 779 | extern int pthread_mutex_consistent_np (pthread_mutex_t *__mutex) | |
| 780 | __THROW __nonnull ((1)); | |
| 858 | # ifdef __REDIRECT_NTH | |
| 859 | extern int __REDIRECT_NTH (pthread_mutex_consistent_np, (pthread_mutex_t *), | |
| 860 | 			 pthread_mutex_consistent) __nonnull ((1)) | |
| 861 | __attribute_deprecated_msg__ ("\ | |
| 862 | pthread_mutex_consistent_np is deprecated, use pthread_mutex_consistent"); | |
| 863 | # else | |
| 864 | # define pthread_mutex_consistent_np pthread_mutex_consistent | |
| 865 | # endif | |
| 781 | 866 | # endif |
| 782 | 867 | #endif |
| 783 | 868 | |
| ... | ... | @@ -846,9 +931,15 @@ extern int pthread_mutexattr_getrobust (const pthread_mutexattr_t *__attr, |
| 846 | 931 | 					int *__robustness) |
| 847 | 932 | __THROW __nonnull ((1, 2)); |
| 848 | 933 | # ifdef __USE_GNU |
| 849 | extern int pthread_mutexattr_getrobust_np (const pthread_mutexattr_t *__attr, | |
| 850 | 					 int *__robustness) | |
| 851 | __THROW __nonnull ((1, 2)); | |
| 934 | # ifdef __REDIRECT_NTH | |
| 935 | extern int __REDIRECT_NTH (pthread_mutexattr_getrobust_np, | |
| 936 | 			 (pthread_mutex_t *, int *), | |
| 937 | 			 pthread_mutexattr_getrobust) __nonnull ((1)) | |
| 938 | __attribute_deprecated_msg__ ("\ | |
| 939 | pthread_mutexattr_getrobust_np is deprecated, use pthread_mutexattr_getrobust"); | |
| 940 | # else | |
| 941 | # define pthread_mutexattr_getrobust_np pthread_mutexattr_getrobust | |
| 942 | # endif | |
| 852 | 943 | # endif |
| 853 | 944 | |
| 854 | 945 | /* Set the robustness flag of the mutex attribute ATTR. */ |
| ... | ... | @@ -856,13 +947,18 @@ extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr, |
| 856 | 947 | 					int __robustness) |
| 857 | 948 | __THROW __nonnull ((1)); |
| 858 | 949 | # ifdef __USE_GNU |
| 859 | extern int pthread_mutexattr_setrobust_np (pthread_mutexattr_t *__attr, | |
| 860 | 					 int __robustness) | |
| 861 | __THROW __nonnull ((1)); | |
| 950 | # ifdef __REDIRECT_NTH | |
| 951 | extern int __REDIRECT_NTH (pthread_mutexattr_setrobust_np, | |
| 952 | 			 (pthread_mutex_t *, int), | |
| 953 | 			 pthread_mutexattr_setrobust) __nonnull ((1)) | |
| 954 | __attribute_deprecated_msg__ ("\ | |
| 955 | pthread_mutexattr_setrobust_np is deprecated, use pthread_mutexattr_setrobust"); | |
| 956 | # else | |
| 957 | # define pthread_mutexattr_setrobust_np pthread_mutexattr_setrobust | |
| 958 | # endif | |
| 862 | 959 | # endif |
| 863 | 960 | #endif |
| 864 | 961 | |
| 865 | ||
| 866 | 962 | #if defined __USE_UNIX98 || defined __USE_XOPEN2K |
| 867 | 963 | /* Functions for handling read-write locks. */ |
| 868 | 964 | |
| ... | ... | @@ -886,16 +982,41 @@ extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock) |
| 886 | 982 | |
| 887 | 983 | # ifdef __USE_XOPEN2K |
| 888 | 984 | /* Try to acquire read lock for RWLOCK or return after specfied time. */ |
| 985 | # ifndef __USE_TIME_BITS64 | |
| 889 | 986 | extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock, |
| 890 | 987 | 				 const struct timespec *__restrict |
| 891 | 988 | 				 __abstime) __THROWNL __nonnull ((1, 2)); |
| 989 | # else | |
| 990 | # ifdef __REDIRECT_NTHNL | |
| 991 | extern int __REDIRECT_NTHNL (pthread_rwlock_timedrdlock, | |
| 992 | (pthread_rwlock_t *__restrict __rwlock, | |
| 993 | const struct timespec *__restrict __abstime), | |
| 994 | __pthread_rwlock_timedrdlock64) | |
| 995 | __nonnull ((1, 2)); | |
| 996 | # else | |
| 997 | # define pthread_rwlock_timedrdlock __pthread_rwlock_timedrdlock64 | |
| 998 | # endif | |
| 999 | # endif | |
| 892 | 1000 | # endif |
| 893 | 1001 | |
| 894 | 1002 | # ifdef __USE_GNU |
| 1003 | # ifndef __USE_TIME_BITS64 | |
| 895 | 1004 | extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock, |
| 896 | 1005 | 				 clockid_t __clockid, |
| 897 | 1006 | 				 const struct timespec *__restrict |
| 898 | 1007 | 				 __abstime) __THROWNL __nonnull ((1, 3)); |
| 1008 | # else | |
| 1009 | # ifdef __REDIRECT_NTHNL | |
| 1010 | extern int __REDIRECT_NTHNL (pthread_rwlock_clockrdlock, | |
| 1011 | (pthread_rwlock_t *__restrict __rwlock, | |
| 1012 | clockid_t __clockid, | |
| 1013 | const struct timespec *__restrict __abstime), | |
| 1014 | __pthread_rwlock_clockrdlock64) | |
| 1015 | __nonnull ((1, 3)); | |
| 1016 | # else | |
| 1017 | # define pthread_rwlock_clockrdlock __pthread_rwlock_clockrdlock64 | |
| 1018 | # endif | |
| 1019 | # endif | |
| 899 | 1020 | # endif |
| 900 | 1021 | |
| 901 | 1022 | /* Acquire write lock for RWLOCK. */ |
| ... | ... | @@ -908,16 +1029,42 @@ extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock) |
| 908 | 1029 | |
| 909 | 1030 | # ifdef __USE_XOPEN2K |
| 910 | 1031 | /* Try to acquire write lock for RWLOCK or return after specfied time. */ |
| 1032 | # ifndef __USE_TIME_BITS64 | |
| 911 | 1033 | extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock, |
| 912 | 1034 | 				 const struct timespec *__restrict |
| 913 | 1035 | 				 __abstime) __THROWNL __nonnull ((1, 2)); |
| 1036 | # else | |
| 1037 | # ifdef __REDIRECT_NTHNL | |
| 1038 | extern int __REDIRECT_NTHNL (pthread_rwlock_timedwrlock, | |
| 1039 | (pthread_rwlock_t *__restrict __rwlock, | |
| 1040 | const struct timespec *__restrict __abstime), | |
| 1041 | __pthread_rwlock_timedwrlock64) | |
| 1042 | __nonnull ((1, 2)); | |
| 1043 | # else | |
| 1044 | # define pthread_rwlock_timedwrlock __pthread_rwlock_timedwrlock64 | |
| 1045 | # endif | |
| 1046 | # endif | |
| 914 | 1047 | # endif |
| 915 | 1048 | |
| 916 | 1049 | # ifdef __USE_GNU |
| 1050 | # ifndef __USE_TIME_BITS64 | |
| 917 | 1051 | extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock, |
| 918 | 1052 | 				 clockid_t __clockid, |
| 919 | 1053 | 				 const struct timespec *__restrict |
| 920 | 1054 | 				 __abstime) __THROWNL __nonnull ((1, 3)); |
| 1055 | ||
| 1056 | # else | |
| 1057 | # ifdef __REDIRECT_NTHNL | |
| 1058 | extern int __REDIRECT_NTHNL (pthread_rwlock_clockwrlock, | |
| 1059 | (pthread_rwlock_t *__restrict __rwlock, | |
| 1060 | clockid_t __clockid, | |
| 1061 | const struct timespec *__restrict __abstime), | |
| 1062 | __pthread_rwlock_clockwrlock64) | |
| 1063 | __nonnull ((1, 3)); | |
| 1064 | # else | |
| 1065 | # define pthread_rwlock_clockwrlock __pthread_rwlock_clockwrlock64 | |
| 1066 | # endif | |
| 1067 | # endif | |
| 921 | 1068 | # endif |
| 922 | 1069 | |
| 923 | 1070 | /* Unlock RWLOCK. */ |
| ... | ... | @@ -994,10 +1141,23 @@ extern int pthread_cond_wait (pthread_cond_t *__restrict __cond, |
| 994 | 1141 | |
| 995 | 1142 | This function is a cancellation point and therefore not marked with |
| 996 | 1143 | __THROW. */ |
| 1144 | # ifndef __USE_TIME_BITS64 | |
| 997 | 1145 | extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, |
| 998 | 1146 | 				 pthread_mutex_t *__restrict __mutex, |
| 999 | 1147 | 				 const struct timespec *__restrict __abstime) |
| 1000 | 1148 | __nonnull ((1, 2, 3)); |
| 1149 | # else | |
| 1150 | # ifdef __REDIRECT | |
| 1151 | extern int __REDIRECT (pthread_cond_timedwait, | |
| 1152 | (pthread_cond_t *__restrict __cond, | |
| 1153 | pthread_mutex_t *__restrict __mutex, | |
| 1154 | const struct timespec *__restrict __abstime), | |
| 1155 | __pthread_cond_timedwait64) | |
| 1156 | __nonnull ((1, 2, 3)); | |
| 1157 | # else | |
| 1158 | # define pthread_cond_timedwait __pthread_cond_timedwait64 | |
| 1159 | # endif | |
| 1160 | # endif | |
| 1001 | 1161 | |
| 1002 | 1162 | # ifdef __USE_GNU |
| 1003 | 1163 | /* Wait for condition variable COND to be signaled or broadcast until |
| ... | ... | @@ -1007,11 +1167,25 @@ extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, |
| 1007 | 1167 | |
| 1008 | 1168 | This function is a cancellation point and therefore not marked with |
| 1009 | 1169 | __THROW. */ |
| 1170 | # ifndef __USE_TIME_BITS64 | |
| 1010 | 1171 | extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond, |
| 1011 | 1172 | 				 pthread_mutex_t *__restrict __mutex, |
| 1012 | 1173 | 				 __clockid_t __clock_id, |
| 1013 | 1174 | 				 const struct timespec *__restrict __abstime) |
| 1014 | 1175 | __nonnull ((1, 2, 4)); |
| 1176 | # else | |
| 1177 | # ifdef __REDIRECT | |
| 1178 | extern int __REDIRECT (pthread_cond_clockwait, | |
| 1179 | (pthread_cond_t *__restrict __cond, | |
| 1180 | pthread_mutex_t *__restrict __mutex, | |
| 1181 | __clockid_t __clock_id, | |
| 1182 | const struct timespec *__restrict __abstime), | |
| 1183 | __pthread_cond_clockwait64) | |
| 1184 | __nonnull ((1, 2, 4)); | |
| 1185 | # else | |
| 1186 | # define pthread_cond_clockwait __pthread_cond_clockwait64 | |
| 1187 | # endif | |
| 1188 | # endif | |
| 1015 | 1189 | # endif |
| 1016 | 1190 | |
| 1017 | 1191 | /* Functions for handling condition variable attributes. */ |
| ... | ... | @@ -1132,7 +1306,8 @@ extern void *pthread_getspecific (pthread_key_t __key) __THROW; |
| 1132 | 1306 | |
| 1133 | 1307 | /* Store POINTER in the thread-specific data slot identified by KEY. */ |
| 1134 | 1308 | extern int pthread_setspecific (pthread_key_t __key, |
| 1135 | 				const void *__pointer) __THROW ; | |
| 1309 | 				const void *__pointer) | |
| 1310 | __THROW __attr_access_none (2); | |
| 1136 | 1311 | |
| 1137 | 1312 | |
| 1138 | 1313 | #ifdef __USE_XOPEN2K |
lib/libc/glibc/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h deleted-81| ... | ... | @@ -1,81 +0,0 @@ |
| 1 | /* Machine-specific pthread type layouts. PowerPC version. | |
| 2 | Copyright (C) 2003-2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _BITS_PTHREADTYPES_ARCH_H | |
| 20 | #define _BITS_PTHREADTYPES_ARCH_H	1 | |
| 21 | ||
| 22 | #include <bits/wordsize.h> | |
| 23 | ||
| 24 | #if __WORDSIZE == 64 | |
| 25 | # define __SIZEOF_PTHREAD_MUTEX_T 40 | |
| 26 | # define __SIZEOF_PTHREAD_ATTR_T 56 | |
| 27 | # define __SIZEOF_PTHREAD_RWLOCK_T 56 | |
| 28 | # define __SIZEOF_PTHREAD_BARRIER_T 32 | |
| 29 | #else | |
| 30 | # define __SIZEOF_PTHREAD_MUTEX_T 24 | |
| 31 | # define __SIZEOF_PTHREAD_ATTR_T 36 | |
| 32 | # define __SIZEOF_PTHREAD_RWLOCK_T 32 | |
| 33 | # define __SIZEOF_PTHREAD_BARRIER_T 20 | |
| 34 | #endif | |
| 35 | #define __SIZEOF_PTHREAD_MUTEXATTR_T 4 | |
| 36 | #define __SIZEOF_PTHREAD_COND_T 48 | |
| 37 | #define __SIZEOF_PTHREAD_CONDATTR_T 4 | |
| 38 | #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 | |
| 39 | #define __SIZEOF_PTHREAD_BARRIERATTR_T 4 | |
| 40 | ||
| 41 | /* Definitions for internal mutex struct. */ | |
| 42 | #define __PTHREAD_COMPAT_PADDING_MID | |
| 43 | #define __PTHREAD_COMPAT_PADDING_END | |
| 44 | #define __PTHREAD_MUTEX_LOCK_ELISION 1 | |
| 45 | #define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (__WORDSIZE != 64) | |
| 46 | #define __PTHREAD_MUTEX_USE_UNION (__WORDSIZE != 64) | |
| 47 | ||
| 48 | #define __LOCK_ALIGNMENT | |
| 49 | #define __ONCE_ALIGNMENT | |
| 50 | ||
| 51 | struct __pthread_rwlock_arch_t | |
| 52 | { | |
| 53 | unsigned int __readers; | |
| 54 | unsigned int __writers; | |
| 55 | unsigned int __wrphase_futex; | |
| 56 | unsigned int __writers_futex; | |
| 57 | unsigned int __pad3; | |
| 58 | unsigned int __pad4; | |
| 59 | #if __WORDSIZE == 64 | |
| 60 | int __cur_writer; | |
| 61 | int __shared; | |
| 62 | unsigned char __rwelision; | |
| 63 | unsigned char __pad1[7]; | |
| 64 | unsigned long int __pad2; | |
| 65 | /* FLAGS must stay at this position in the structure to maintain | |
| 66 | binary compatibility. */ | |
| 67 | unsigned int __flags; | |
| 68 | # define __PTHREAD_RWLOCK_ELISION_EXTRA 0, {0, 0, 0, 0, 0, 0, 0 } | |
| 69 | #else | |
| 70 | unsigned char __rwelision; | |
| 71 | unsigned char __pad2; | |
| 72 | unsigned char __shared; | |
| 73 | /* FLAGS must stay at this position in the structure to maintain | |
| 74 | binary compatibility. */ | |
| 75 | unsigned char __flags; | |
| 76 | int __cur_writer; | |
| 77 | # define __PTHREAD_RWLOCK_ELISION_EXTRA 0 | |
| 78 | #endif | |
| 79 | }; | |
| 80 | ||
| 81 | #endif	/* bits/pthreadtypes.h */ |
lib/libc/glibc/sysdeps/powerpc/powerpc32/crti.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for PowerPC. |
| 2 | Copyright (C) 2012-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2012-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/powerpc/powerpc32/crtn.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for PowerPC. |
| 2 | Copyright (C) 2012-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2012-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/powerpc/powerpc32/start.S+3-3| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Startup code for programs linked with GNU libc. |
| 2 | Copyright (C) 1998-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1998-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -52,8 +52,8 @@ |
| 52 | 52 | L(start_addresses): |
| 53 | 53 | 	.long	_SDA_BASE_ |
| 54 | 54 | 	.long	main |
| 55 | 	.long 	__libc_csu_init | |
| 56 | 	.long 	__libc_csu_fini | |
| 55 | 	.long 	0 /* Used to be init. */ | |
| 56 | 	.long 	0 /* Used to be fini. */ | |
| 57 | 57 | 	ASM_SIZE_DIRECTIVE(L(start_addresses)) |
| 58 | 58 | |
| 59 | 59 | 	.section ".text" |
lib/libc/glibc/sysdeps/powerpc/powerpc32/symbol-hacks.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Hacks needed for symbol manipulation. powerpc version. |
| 2 | Copyright (C) 2017-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2017-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/powerpc/powerpc32/sysdep.h+15-6| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Assembly macros for 32-bit PowerPC. |
| 2 | Copyright (C) 1999-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1999-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -92,7 +92,10 @@ GOT_LABEL:			;					 \ |
| 92 | 92 | |
| 93 | 93 | #define DO_CALL(syscall)						 \ |
| 94 | 94 | li 0,syscall;							 \ |
| 95 | sc | |
| 95 | DO_CALL_SC | |
| 96 | ||
| 97 | #define DO_CALL_SC \ | |
| 98 | 	sc | |
| 96 | 99 | |
| 97 | 100 | #undef JUMPTARGET |
| 98 | 101 | #ifdef PIC |
| ... | ... | @@ -106,14 +109,20 @@ GOT_LABEL:			;					 \ |
| 106 | 109 | # define HIDDEN_JUMPTARGET(name) __GI_##name##@local |
| 107 | 110 | #endif |
| 108 | 111 | |
| 112 | #define TAIL_CALL_SYSCALL_ERROR \ | |
| 113 | b __syscall_error@local | |
| 114 | ||
| 109 | 115 | #define PSEUDO(name, syscall_name, args)				 \ |
| 110 | 116 | .section ".text";							 \ |
| 111 | 117 | ENTRY (name)								 \ |
| 112 | 118 | DO_CALL (SYS_ify (syscall_name)); |
| 113 | 119 | |
| 120 | #define RET_SC \ | |
| 121 | bnslr+; | |
| 122 | ||
| 114 | 123 | #define PSEUDO_RET							 \ |
| 115 | bnslr+;								 \ | |
| 116 | b __syscall_error@local | |
| 124 | RET_SC;								 \ | |
| 125 | TAIL_CALL_SYSCALL_ERROR | |
| 117 | 126 | #define ret PSEUDO_RET |
| 118 | 127 | |
| 119 | 128 | #undef	PSEUDO_END |
| ... | ... | @@ -179,8 +188,8 @@ GOT_LABEL:			;					 \ |
| 179 | 188 | #else |
| 180 | 189 | /* Position-dependent code does not require access to the GOT. */ |
| 181 | 190 | # define __GLRO(rOUT, rGOT, member, offset)				\ |
| 182 | 	lis rOUT,(member+LOWORD)@ha;					\ | |
| 183 | 	lwz rOUT,(member+LOWORD)@l(rOUT) | |
| 191 | 	lis rOUT,(member)@ha;					\ | |
| 192 | 	lwz rOUT,(member)@l(rOUT) | |
| 184 | 193 | #endif	/* PIC */ |
| 185 | 194 | |
| 186 | 195 | #endif	/* __ASSEMBLER__ */ |
lib/libc/glibc/sysdeps/powerpc/powerpc64/crti.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for PowerPC64. |
| 2 | Copyright (C) 2012-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2012-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/powerpc/powerpc64/crtn.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for PowerPC64. |
| 2 | Copyright (C) 2012-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2012-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/powerpc/powerpc64/dl-dtprocnum.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Configuration of lookup functions. PowerPC64 version. |
| 2 | Copyright (C) 2002-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2002-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/powerpc/powerpc64/start.S+3-3| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Startup code for programs linked with GNU libc. PowerPC64 version. |
| 2 | Copyright (C) 1998-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1998-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -53,8 +53,8 @@ L(start_addresses): |
| 53 | 53 | 	.quad	0 /* was _SDA_BASE_ but not in 64-bit ABI*/ |
| 54 | 54 | /* function descriptors so don't need JUMPTARGET */ |
| 55 | 55 | 	.quad	main |
| 56 | 	.quad 	__libc_csu_init | |
| 57 | 	.quad 	__libc_csu_fini | |
| 56 | 	.quad 	0 /* Used to be init. */ | |
| 57 | 	.quad 	0 /* Used to be fini. */ | |
| 58 | 58 | |
| 59 | 59 | 	ASM_SIZE_DIRECTIVE(L(start_addresses)) |
| 60 | 60 |
lib/libc/glibc/sysdeps/powerpc/powerpc64/sysdep.h+126-8| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Assembly macros for 64-bit PowerPC. |
| 2 | Copyright (C) 2002-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2002-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -17,6 +17,7 @@ |
| 17 | 17 | <https://www.gnu.org/licenses/>. */ |
| 18 | 18 | |
| 19 | 19 | #include <sysdeps/powerpc/sysdep.h> |
| 20 | #include <tls.h> | |
| 20 | 21 | |
| 21 | 22 | #ifdef __ASSEMBLER__ |
| 22 | 23 | |
| ... | ... | @@ -263,10 +264,83 @@ LT_LABELSUFFIX(name,_name_end): ; \ |
| 263 | 264 | TRACEBACK_MASK(name,mask);	\ |
| 264 | 265 | END_2(name) |
| 265 | 266 | |
| 266 | #define DO_CALL(syscall) \ | |
| 267 | li 0,syscall; \ | |
| 267 | /* We will allocate a new frame to save LR and the non-volatile register used to | |
| 268 | read the TCB when checking for scv support on syscall code. We actually just | |
| 269 | need the minimum frame size plus room for 1 reg (8 bytes). But the ABI | |
| 270 | mandates stack frames should be aligned at 16 Bytes, so we end up allocating | |
| 271 | a bit more space then what will actually be used. */ | |
| 272 | #define SCV_FRAME_SIZE (FRAME_MIN_SIZE+16) | |
| 273 | #define SCV_FRAME_NVOLREG_SAVE FRAME_MIN_SIZE | |
| 274 | ||
| 275 | /* Allocate frame and save register */ | |
| 276 | #define NVOLREG_SAVE \ | |
| 277 | stdu r1,-SCV_FRAME_SIZE(r1); \ | |
| 278 | std r31,SCV_FRAME_NVOLREG_SAVE(r1); \ | |
| 279 | cfi_adjust_cfa_offset(SCV_FRAME_SIZE); | |
| 280 | ||
| 281 | /* Restore register and destroy frame */ | |
| 282 | #define NVOLREG_RESTORE	\ | |
| 283 | ld r31,SCV_FRAME_NVOLREG_SAVE(r1); \ | |
| 284 | addi r1,r1,SCV_FRAME_SIZE; \ | |
| 285 | cfi_adjust_cfa_offset(-SCV_FRAME_SIZE); | |
| 286 | ||
| 287 | /* Check PPC_FEATURE2_SCV bit from hwcap2 in the TCB. If it is not set, scv is | |
| 288 | not available, then go to JUMPFALSE (label given by the macro's caller). We | |
| 289 | save the value we read from the TCB in a non-volatile register so we can | |
| 290 | reuse it later when exiting from the syscall in PSEUDO_RET. Note that for | |
| 291 | the static case we need an extra check to guarantee the thread pointer has | |
| 292 | already been initialized, otherwise we may try to access an invalid address | |
| 293 | if a syscall is called before the TLS has been setup. */ | |
| 294 | .macro CHECK_SCV_SUPPORT REG JUMPFALSE | |
| 295 | ||
| 296 | #ifndef SHARED | |
| 297 | /* Check if thread pointer has already been setup. */ | |
| 298 | cmpdi r13,0 | |
| 299 | beq \JUMPFALSE | |
| 300 | #endif | |
| 301 | ||
| 302 | /* Read PPC_FEATURE2_SCV from TCB and store it in REG */ | |
| 303 | ld \REG,TCB_HWCAP(PT_THREAD_POINTER) | |
| 304 | andis. \REG,\REG,PPC_FEATURE2_SCV>>16 | |
| 305 | ||
| 306 | beq \JUMPFALSE | |
| 307 | .endm | |
| 308 | ||
| 309 | #if !defined(USE_PPC_SCV) || IS_IN(rtld) | |
| 310 | # define DO_CALL(syscall) \ | |
| 311 | li r0,syscall; \ | |
| 312 | DO_CALL_SC | |
| 313 | #else | |
| 314 | /* Before doing the syscall, check if we can use scv. scv is supported by P9 | |
| 315 | and later with Linux v5.9 and later. If so, use it. Otherwise, fallback to | |
| 316 | sc. We use a non-volatile register to save hwcap2 from the TCB, so we need | |
| 317 | to save its content beforehand. */ | |
| 318 | # define DO_CALL(syscall) \ | |
| 319 | li r0,syscall; \ | |
| 320 | NVOLREG_SAVE; \ | |
| 321 | CHECK_SCV_SUPPORT r31 0f; \ | |
| 322 | DO_CALL_SCV; \ | |
| 323 | b 1f; \ | |
| 324 | 0: DO_CALL_SC; \ | |
| 325 | 1: | |
| 326 | #endif /* !defined(USE_PPC_SCV) || IS_IN(rtld) */ | |
| 327 | ||
| 328 | /* DO_CALL_SC and DO_CALL_SCV expect the syscall number to be in r0. */ | |
| 329 | #define DO_CALL_SC \ | |
| 268 | 330 | sc |
| 269 | 331 | |
| 332 | #define DO_CALL_SCV \ | |
| 333 | mflr r9; \ | |
| 334 | std r9,FRAME_LR_SAVE(r1); \ | |
| 335 | cfi_offset(lr,FRAME_LR_SAVE); \ | |
| 336 | .machine "push"; \ | |
| 337 | .machine "power9"; \ | |
| 338 | scv 0; \ | |
| 339 | .machine "pop"; \ | |
| 340 | ld r9,FRAME_LR_SAVE(r1); \ | |
| 341 | mtlr r9; \ | |
| 342 | cfi_restore(lr); | |
| 343 | ||
| 270 | 344 | /* ppc64 is always PIC */ |
| 271 | 345 | #undef JUMPTARGET |
| 272 | 346 | #define JUMPTARGET(name) FUNC_LABEL(name) |
| ... | ... | @@ -278,7 +352,7 @@ LT_LABELSUFFIX(name,_name_end): ; \ |
| 278 | 352 | |
| 279 | 353 | #ifdef SHARED |
| 280 | 354 | #define TAIL_CALL_SYSCALL_ERROR \ |
| 281 | b JUMPTARGET(__syscall_error) | |
| 355 | b JUMPTARGET (NOTOC (__syscall_error)) | |
| 282 | 356 | #else |
| 283 | 357 | /* Static version might be linked into a large app with a toc exceeding |
| 284 | 358 | 64k. We can't put a toc adjusting stub on a plain branch, so can't |
| ... | ... | @@ -304,9 +378,33 @@ LT_LABELSUFFIX(name,_name_end): ; \ |
| 304 | 378 | .endif |
| 305 | 379 | #endif |
| 306 | 380 | |
| 307 | #define PSEUDO_RET \ | |
| 308 | bnslr+; \ | |
| 381 | #if !defined(USE_PPC_SCV) || IS_IN(rtld) | |
| 382 | # define PSEUDO_RET \ | |
| 383 | RET_SC; \ | |
| 309 | 384 | TAIL_CALL_SYSCALL_ERROR |
| 385 | #else | |
| 386 | /* This should only be called after a DO_CALL. In such cases, r31 contains the | |
| 387 | value of PPC_FEATURE2_SCV read from hwcap2 by CHECK_SCV_SUPPORT. If it is | |
| 388 | set, we know we have entered the kernel using scv, so handle the return code | |
| 389 | accordingly. */ | |
| 390 | # define PSEUDO_RET \ | |
| 391 | cmpdi cr5,r31,0; \ | |
| 392 | NVOLREG_RESTORE; \ | |
| 393 | beq cr5,0f; \ | |
| 394 | RET_SCV; \ | |
| 395 | b 1f; \ | |
| 396 | 0: RET_SC; \ | |
| 397 | 1: TAIL_CALL_SYSCALL_ERROR | |
| 398 | #endif /* !defined(USE_PPC_SCV) || IS_IN(rtld) */ | |
| 399 | ||
| 400 | #define RET_SCV \ | |
| 401 | li r9,-4095; \ | |
| 402 | cmpld r3,r9; \ | |
| 403 | bltlr+; \ | |
| 404 | neg r3,r3; | |
| 405 | ||
| 406 | #define RET_SC \ | |
| 407 | bnslr+; | |
| 310 | 408 | |
| 311 | 409 | #define ret PSEUDO_RET |
| 312 | 410 | |
| ... | ... | @@ -319,8 +417,15 @@ LT_LABELSUFFIX(name,_name_end): ; \ |
| 319 | 417 | ENTRY (name);						\ |
| 320 | 418 | DO_CALL (SYS_ify (syscall_name)) |
| 321 | 419 | |
| 322 | #define PSEUDO_RET_NOERRNO \ | |
| 420 | #if !defined(USE_PPC_SCV) || IS_IN(rtld) | |
| 421 | # define PSEUDO_RET_NOERRNO \ | |
| 422 | blr | |
| 423 | #else | |
| 424 | /* This should only be called after a DO_CALL. */ | |
| 425 | # define PSEUDO_RET_NOERRNO \ | |
| 426 | NVOLREG_RESTORE; \ | |
| 323 | 427 | blr |
| 428 | #endif /* !defined(USE_PPC_SCV) || IS_IN(rtld) */ | |
| 324 | 429 | |
| 325 | 430 | #define ret_NOERRNO PSEUDO_RET_NOERRNO |
| 326 | 431 | |
| ... | ... | @@ -333,8 +438,15 @@ LT_LABELSUFFIX(name,_name_end): ; \ |
| 333 | 438 | ENTRY (name);						\ |
| 334 | 439 | DO_CALL (SYS_ify (syscall_name)) |
| 335 | 440 | |
| 336 | #define PSEUDO_RET_ERRVAL \ | |
| 441 | #if !defined(USE_PPC_SCV) || IS_IN(rtld) | |
| 442 | # define PSEUDO_RET_ERRVAL \ | |
| 443 | blr | |
| 444 | #else | |
| 445 | /* This should only be called after a DO_CALL. */ | |
| 446 | # define PSEUDO_RET_ERRVAL \ | |
| 447 | NVOLREG_RESTORE; \ | |
| 337 | 448 | blr |
| 449 | #endif /* !defined(USE_PPC_SCV) || IS_IN(rtld) */ | |
| 338 | 450 | |
| 339 | 451 | #define ret_ERRVAL PSEUDO_RET_ERRVAL |
| 340 | 452 | |
| ... | ... | @@ -366,6 +478,12 @@ LT_LABELSUFFIX(name,_name_end): ; \ |
| 366 | 478 | 	lwz	rOUT,0(rOUT) |
| 367 | 479 | #endif |
| 368 | 480 | |
| 481 | #ifdef USE_PPC64_NOTOC | |
| 482 | # define NOTOC(l) l@notoc | |
| 483 | #else | |
| 484 | # define NOTOC(l) l | |
| 485 | #endif | |
| 486 | ||
| 369 | 487 | #else /* !__ASSEMBLER__ */ |
| 370 | 488 | |
| 371 | 489 | #if _CALL_ELF != 2 |
lib/libc/glibc/sysdeps/powerpc/sysdep.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1999-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1999-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/pthread/pthread_atfork.c created+61| ... | ... | @@ -0,0 +1,61 @@ |
| 1 | /* Copyright (C) 2002-2021 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | In addition to the permissions in the GNU Lesser General Public | |
| 11 | License, the Free Software Foundation gives you unlimited | |
| 12 | permission to link the compiled version of this file with other | |
| 13 | programs, and to distribute those programs without any restriction | |
| 14 | coming from the use of this file. (The GNU Lesser General Public | |
| 15 | License restrictions do apply in other respects; for example, they | |
| 16 | cover modification of the file, and distribution when not linked | |
| 17 | into another program.) | |
| 18 | ||
| 19 | Note that people who make modified versions of this file are not | |
| 20 | obligated to grant this special exception for their modified | |
| 21 | versions; it is their choice whether to do so. The GNU Lesser | |
| 22 | General Public License gives permission to release a modified | |
| 23 | version without this exception; this exception also makes it | |
| 24 | possible to release a modified version which carries forward this | |
| 25 | exception. | |
| 26 | ||
| 27 | The GNU C Library is distributed in the hope that it will be useful, | |
| 28 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 29 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 30 | Lesser General Public License for more details. | |
| 31 | ||
| 32 | You should have received a copy of the GNU Lesser General Public | |
| 33 | License along with the GNU C Library; if not, see | |
| 34 | <https://www.gnu.org/licenses/>. */ | |
| 35 | ||
| 36 | extern int __pthread_atfork (void (*prepare) (void), void (*parent) (void), | |
| 37 | void (*child) (void)); | |
| 38 | extern int __register_atfork (void (*__prepare) (void), | |
| 39 | void (*__parent) (void), | |
| 40 | void (*__child) (void), | |
| 41 | void *dso_handle); | |
| 42 | libc_hidden_proto (__register_atfork) | |
| 43 | extern void *__dso_handle __attribute__ ((__visibility__ ("hidden"))); | |
| 44 | ||
| 45 | /* Hide the symbol so that no definition but the one locally in the | |
| 46 | executable or DSO is used. */ | |
| 47 | int | |
| 48 | #ifndef __pthread_atfork | |
| 49 | /* Don't mark the compatibility function as hidden. */ | |
| 50 | attribute_hidden | |
| 51 | #endif | |
| 52 | __pthread_atfork (void (*prepare) (void), void (*parent) (void), | |
| 53 | 		 void (*child) (void)) | |
| 54 | { | |
| 55 | return __register_atfork (prepare, parent, child, __dso_handle); | |
| 56 | } | |
| 57 | #ifndef __pthread_atfork | |
| 58 | extern int pthread_atfork (void (*prepare) (void), void (*parent) (void), | |
| 59 | 			 void (*child) (void)) attribute_hidden; | |
| 60 | weak_alias (__pthread_atfork, pthread_atfork) | |
| 61 | #endif |
lib/libc/glibc/sysdeps/riscv/nptl/bits/pthreadtypes-arch.h+16-12| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Machine-specific pthread type layouts. RISC-V version. |
| 2 | Copyright (C) 2011-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2011-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -21,18 +21,22 @@ |
| 21 | 21 | |
| 22 | 22 | #include <bits/endian.h> |
| 23 | 23 | |
| 24 | #if __riscv_xlen == 64 | |
| 25 | # define __SIZEOF_PTHREAD_ATTR_T 		56 | |
| 26 | # define __SIZEOF_PTHREAD_MUTEX_T 		40 | |
| 27 | # define __SIZEOF_PTHREAD_MUTEXATTR_T 		 4 | |
| 28 | # define __SIZEOF_PTHREAD_COND_T 		48 | |
| 29 | # define __SIZEOF_PTHREAD_CONDATTR_T 		 4 | |
| 30 | # define __SIZEOF_PTHREAD_RWLOCK_T 		56 | |
| 31 | # define __SIZEOF_PTHREAD_RWLOCKATTR_T 		 8 | |
| 32 | # define __SIZEOF_PTHREAD_BARRIER_T 		32 | |
| 33 | # define __SIZEOF_PTHREAD_BARRIERATTR_T 	 4 | |
| 24 | #define __SIZEOF_PTHREAD_MUTEXATTR_T		4 | |
| 25 | #define __SIZEOF_PTHREAD_COND_T			48 | |
| 26 | #define __SIZEOF_PTHREAD_CONDATTR_T		4 | |
| 27 | #define __SIZEOF_PTHREAD_RWLOCKATTR_T		8 | |
| 28 | #define __SIZEOF_PTHREAD_BARRIERATTR_T		4 | |
| 29 | ||
| 30 | #if __WORDSIZE == 64 | |
| 31 | # define __SIZEOF_PTHREAD_ATTR_T		56 | |
| 32 | # define __SIZEOF_PTHREAD_MUTEX_T		40 | |
| 33 | # define __SIZEOF_PTHREAD_RWLOCK_T		56 | |
| 34 | # define __SIZEOF_PTHREAD_BARRIER_T		32 | |
| 34 | 35 | #else |
| 35 | # error "rv32i-based systems are not supported" | |
| 36 | # define __SIZEOF_PTHREAD_ATTR_T		32 | |
| 37 | # define __SIZEOF_PTHREAD_MUTEX_T		32 | |
| 38 | # define __SIZEOF_PTHREAD_RWLOCK_T		48 | |
| 39 | # define __SIZEOF_PTHREAD_BARRIER_T		20 | |
| 36 | 40 | #endif |
| 37 | 41 | |
| 38 | 42 | #define __LOCK_ALIGNMENT |
lib/libc/glibc/sysdeps/riscv/start.S+3-3| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Startup code compliant to the ELF RISC-V ABI. |
| 2 | Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -54,8 +54,8 @@ ENTRY (ENTRY_POINT) |
| 54 | 54 | 	REG_L a1, 0(sp) /* argc. */ |
| 55 | 55 | 	addi a2, sp, SZREG /* argv. */ |
| 56 | 56 | 	andi sp, sp, ALMASK /* Align stack. */ |
| 57 | 	lla a3, __libc_csu_init | |
| 58 | 	lla a4, __libc_csu_fini | |
| 57 | 	li a3, 0	 /* Used to be init. */ | |
| 58 | 	li a4, 0	 /* Used to be fini. */ | |
| 59 | 59 | 	mv a6, sp /* stack_end. */ |
| 60 | 60 | |
| 61 | 61 | 	call __libc_start_main@plt |
lib/libc/glibc/sysdeps/s390/nptl/bits/pthreadtypes-arch.h deleted-79| ... | ... | @@ -1,79 +0,0 @@ |
| 1 | /* Copyright (C) 2003-2019 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library; if not, see | |
| 16 | <http://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | #ifndef _BITS_PTHREADTYPES_ARCH_H | |
| 19 | #define _BITS_PTHREADTYPES_ARCH_H	1 | |
| 20 | ||
| 21 | #include <bits/wordsize.h> | |
| 22 | ||
| 23 | #if __WORDSIZE == 64 | |
| 24 | # define __SIZEOF_PTHREAD_ATTR_T 56 | |
| 25 | # define __SIZEOF_PTHREAD_MUTEX_T 40 | |
| 26 | # define __SIZEOF_PTHREAD_RWLOCK_T 56 | |
| 27 | # define __SIZEOF_PTHREAD_BARRIER_T 32 | |
| 28 | #else | |
| 29 | # define __SIZEOF_PTHREAD_ATTR_T 36 | |
| 30 | # define __SIZEOF_PTHREAD_MUTEX_T 24 | |
| 31 | # define __SIZEOF_PTHREAD_RWLOCK_T 32 | |
| 32 | # define __SIZEOF_PTHREAD_BARRIER_T 20 | |
| 33 | #endif | |
| 34 | #define __SIZEOF_PTHREAD_MUTEXATTR_T 4 | |
| 35 | #define __SIZEOF_PTHREAD_CONDATTR_T 4 | |
| 36 | #define __SIZEOF_PTHREAD_COND_T 48 | |
| 37 | #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 | |
| 38 | #define __SIZEOF_PTHREAD_BARRIERATTR_T 4 | |
| 39 | ||
| 40 | /* Definitions for internal mutex struct. */ | |
| 41 | #define __PTHREAD_COMPAT_PADDING_MID | |
| 42 | #define __PTHREAD_COMPAT_PADDING_END | |
| 43 | #define __PTHREAD_MUTEX_LOCK_ELISION 1 | |
| 44 | #define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (__WORDSIZE != 64) | |
| 45 | #define __PTHREAD_MUTEX_USE_UNION (__WORDSIZE != 64) | |
| 46 | ||
| 47 | #define __LOCK_ALIGNMENT | |
| 48 | #define __ONCE_ALIGNMENT | |
| 49 | ||
| 50 | struct __pthread_rwlock_arch_t | |
| 51 | { | |
| 52 | unsigned int __readers; | |
| 53 | unsigned int __writers; | |
| 54 | unsigned int __wrphase_futex; | |
| 55 | unsigned int __writers_futex; | |
| 56 | unsigned int __pad3; | |
| 57 | unsigned int __pad4; | |
| 58 | #if __WORDSIZE == 64 | |
| 59 | int __cur_writer; | |
| 60 | int __shared; | |
| 61 | unsigned long int __pad1; | |
| 62 | unsigned long int __pad2; | |
| 63 | /* FLAGS must stay at this position in the structure to maintain | |
| 64 | binary compatibility. */ | |
| 65 | unsigned int __flags; | |
| 66 | # else | |
| 67 | unsigned char __pad1; | |
| 68 | unsigned char __pad2; | |
| 69 | unsigned char __shared; | |
| 70 | /* FLAGS must stay at this position in the structure to maintain | |
| 71 | binary compatibility. */ | |
| 72 | unsigned char __flags; | |
| 73 | int __cur_writer; | |
| 74 | #endif | |
| 75 | }; | |
| 76 | ||
| 77 | #define __PTHREAD_RWLOCK_ELISION_EXTRA 0 | |
| 78 | ||
| 79 | #endif	/* bits/pthreadtypes.h */ |
lib/libc/glibc/sysdeps/s390/s390-32/crti.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for S/390. |
| 2 | Copyright (C) 2000-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2000-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/s390/s390-32/crtn.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for S/390. |
| 2 | Copyright (C) 2000-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2000-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/s390/s390-32/dl-sysdep.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* System-specific settings for dynamic linker code. S/390 version. |
| 2 | Copyright (C) 2014-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2014-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/s390/s390-32/start.S+3-9| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Startup code compliant to the ELF s390 ABI. |
| 2 | Copyright (C) 2000-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2000-2021 Free Software Foundation, Inc. | |
| 3 | 3 | Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 | |
| ... | ... | @@ -175,18 +175,16 @@ _start: |
| 175 | 175 | 	 */ |
| 176 | 176 | 	stm %r14,%r15,96(%r15) # store rtld_fini/stack_end to parameter area |
| 177 | 177 | 	la %r7,96(%r15) |
| 178 | 	l %r6,.L2-.Llit(%r13) # load pointer to __libc_csu_fini | |
| 179 | 	l %r5,.L1-.Llit(%r13) # load pointer to __libc_csu_init | |
| 180 | 178 | 	l %r2,.L3-.Llit(%r13) # load pointer to main |
| 181 | 179 | 	l %r1,.L4-.Llit(%r13)	# load pointer to __libc_start_main |
| 182 | 180 | #ifdef PIC |
| 183 | 181 | 	l %r12,.L5-.Llit(%r13) # load .got pointer |
| 184 | 	la	%r6,0(%r13,%r6) | |
| 185 | 	la	%r5,0(%r13,%r5) | |
| 186 | 182 | 	la	%r12,0(%r13,%r12) |
| 187 | 183 | 	l	%r2,0(%r12,%r2) |
| 188 | 184 | 	la	%r1,0(%r13,%r1) |
| 189 | 185 | #endif |
| 186 | 	lhi	%r6, 0			# Used to fini. | |
| 187 | 	lhi	%r5, 0			# Used to init. | |
| 190 | 188 | |
| 191 | 189 | 	/* ok, now branch to the libc main routine */ |
| 192 | 190 | 	basr %r14,%r1 |
| ... | ... | @@ -197,13 +195,9 @@ _start: |
| 197 | 195 | 	cfi_endproc |
| 198 | 196 | .Llit: |
| 199 | 197 | #ifndef PIC |
| 200 | .L1: .long __libc_csu_init | |
| 201 | .L2: .long __libc_csu_fini | |
| 202 | 198 | .L3: .long main |
| 203 | 199 | .L4: .long __libc_start_main |
| 204 | 200 | #else |
| 205 | .L1: .long __libc_csu_init-.Llit | |
| 206 | .L2: .long __libc_csu_fini-.Llit | |
| 207 | 201 | .L3: .long main@GOT |
| 208 | 202 | .L4: .long __libc_start_main@plt-.Llit |
| 209 | 203 | .L5: .long _GLOBAL_OFFSET_TABLE_-.Llit |
lib/libc/glibc/sysdeps/s390/s390-32/symbol-hacks.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Hacks needed for symbol manipulation. s390 version. |
| 2 | Copyright (C) 2017-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2017-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/s390/s390-32/sysdep.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Assembler macros for s390. |
| 2 | Copyright (C) 2000-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2000-2021 Free Software Foundation, Inc. | |
| 3 | 3 | Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 |
lib/libc/glibc/sysdeps/s390/s390-64/crti.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for 64 bit S/390. |
| 2 | Copyright (C) 2001-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2001-2021 Free Software Foundation, Inc. | |
| 3 | 3 | Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 |
lib/libc/glibc/sysdeps/s390/s390-64/crtn.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for 64 bit S/390. |
| 2 | Copyright (C) 2001-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2001-2021 Free Software Foundation, Inc. | |
| 3 | 3 | Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 |
lib/libc/glibc/sysdeps/s390/s390-64/start.S+3-3| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Startup code compliant to the 64 bit S/390 ELF ABI. |
| 2 | Copyright (C) 2001-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2001-2021 Free Software Foundation, Inc. | |
| 3 | 3 | Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 | |
| ... | ... | @@ -80,8 +80,8 @@ _start: |
| 80 | 80 | 	 */ |
| 81 | 81 | 	stmg	%r14,%r15,160(%r15)	# store rtld_fini/stack_end to parameter area |
| 82 | 82 | 	la	%r7,160(%r15) |
| 83 | 	larl	%r6,__libc_csu_fini	# load pointer to __libc_csu_fini | |
| 84 | 	larl	%r5,__libc_csu_init	# load pointer to __libc_csu_init | |
| 83 | 	lghi	%r6,0			# Used to be fini. | |
| 84 | 	lghi	%r5,0			# Used to be init. | |
| 85 | 85 | |
| 86 | 86 | 	/* Ok, now branch to the libc main routine. */ |
| 87 | 87 | #ifdef PIC |
lib/libc/glibc/sysdeps/s390/s390-64/sysdep.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Assembler macros for 64 bit S/390. |
| 2 | Copyright (C) 2001-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2001-2021 Free Software Foundation, Inc. | |
| 3 | 3 | Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 |
lib/libc/glibc/sysdeps/sh/crti.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for SH. |
| 2 | Copyright (C) 2000-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2000-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/sh/crtn.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for SH. |
| 2 | Copyright (C) 2000-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2000-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/sh/nptl/bits/pthreadtypes-arch.h deleted-71| ... | ... | @@ -1,71 +0,0 @@ |
| 1 | /* Copyright (C) 2002-2019 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library; if not, see | |
| 16 | <http://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | #ifndef _BITS_PTHREADTYPES_ARCH_H | |
| 19 | #define _BITS_PTHREADTYPES_ARCH_H	1 | |
| 20 | ||
| 21 | #include <endian.h> | |
| 22 | ||
| 23 | #define __SIZEOF_PTHREAD_ATTR_T 36 | |
| 24 | #define __SIZEOF_PTHREAD_MUTEX_T 24 | |
| 25 | #define __SIZEOF_PTHREAD_MUTEXATTR_T 4 | |
| 26 | #define __SIZEOF_PTHREAD_COND_T 48 | |
| 27 | #define __SIZEOF_PTHREAD_CONDATTR_T 4 | |
| 28 | #define __SIZEOF_PTHREAD_RWLOCK_T 32 | |
| 29 | #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 | |
| 30 | #define __SIZEOF_PTHREAD_BARRIER_T 20 | |
| 31 | #define __SIZEOF_PTHREAD_BARRIERATTR_T 4 | |
| 32 | ||
| 33 | /* Definitions for internal mutex struct. */ | |
| 34 | #define __PTHREAD_COMPAT_PADDING_MID | |
| 35 | #define __PTHREAD_COMPAT_PADDING_END | |
| 36 | #define __PTHREAD_MUTEX_LOCK_ELISION 0 | |
| 37 | #define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1 | |
| 38 | #define __PTHREAD_MUTEX_USE_UNION 1 | |
| 39 | ||
| 40 | #define __LOCK_ALIGNMENT | |
| 41 | #define __ONCE_ALIGNMENT | |
| 42 | ||
| 43 | struct __pthread_rwlock_arch_t | |
| 44 | { | |
| 45 | unsigned int __readers; | |
| 46 | unsigned int __writers; | |
| 47 | unsigned int __wrphase_futex; | |
| 48 | unsigned int __writers_futex; | |
| 49 | unsigned int __pad3; | |
| 50 | unsigned int __pad4; | |
| 51 | #if __BYTE_ORDER == __BIG_ENDIAN | |
| 52 | unsigned char __pad1; | |
| 53 | unsigned char __pad2; | |
| 54 | unsigned char __shared; | |
| 55 | /* FLAGS must stay at this position in the structure to maintain | |
| 56 | binary compatibility. */ | |
| 57 | unsigned char __flags; | |
| 58 | #else | |
| 59 | /* FLAGS must stay at this position in the structure to maintain | |
| 60 | binary compatibility. */ | |
| 61 | unsigned char __flags; | |
| 62 | unsigned char __shared; | |
| 63 | unsigned char __pad1; | |
| 64 | unsigned char __pad2; | |
| 65 | #endif | |
| 66 | unsigned long int __cur_writer; | |
| 67 | }; | |
| 68 | ||
| 69 | #define __PTHREAD_RWLOCK_ELISION_EXTRA 0 | |
| 70 | ||
| 71 | #endif	/* bits/pthreadtypes.h */ |
lib/libc/glibc/sysdeps/sh/start.S+3-8| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Startup code for SH & ELF. |
| 2 | Copyright (C) 1999-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1999-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -70,12 +70,11 @@ _start: |
| 70 | 70 | |
| 71 | 71 | 	/* Push the last arguments to main() onto the stack */ |
| 72 | 72 | 	mov.l r4,@-r15 |
| 73 | 	mov.l L_fini,r0 | |
| 74 | 	mov.l r0,@-r15 | |
| 73 | 	mov.l r14,@-r15		/* Used to be fini. */ | |
| 75 | 74 | |
| 76 | 75 | 	/* Set up the other arguments for main() that go in registers */ |
| 77 | 76 | 	mov.l L_main,r4 |
| 78 | 	mov.l L_init,r7 | |
| 77 | 	mov #0,r7		/* Used to be init. */ | |
| 79 | 78 | |
| 80 | 79 | 	/* __libc_start_main (main, argc, argv, init, fini, rtld_fini) */ |
| 81 | 80 | |
| ... | ... | @@ -90,10 +89,6 @@ _start: |
| 90 | 89 | 	.align	2 |
| 91 | 90 | L_main: |
| 92 | 91 | 	.long	main |
| 93 | L_init: | |
| 94 | 	.long	__libc_csu_init | |
| 95 | L_fini: | |
| 96 | 	.long	__libc_csu_fini | |
| 97 | 92 | L_libc_start_main: |
| 98 | 93 | 	.long	__libc_start_main |
| 99 | 94 | L_abort: |
lib/libc/glibc/sysdeps/sh/sysdep.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Assembler macros for SH. |
| 2 | Copyright (C) 1999-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1999-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/sparc/crti.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for sparc. |
| 2 | Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/sparc/crtn.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for sparc. |
| 2 | Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/sparc/dl-dtprocnum.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Configuration of lookup functions. SPARC version. |
| 2 | Copyright (C) 2000-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2000-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/sparc/dl-sysdep.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* System-specific settings for dynamic linker code. SPARC version. |
| 2 | Copyright (C) 2002-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2002-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/sparc/sparc32/start.S+3-11| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Startup code for elf32-sparc |
| 2 | Copyright (C) 1997-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1997-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997. |
| 5 | 5 | |
| ... | ... | @@ -59,22 +59,14 @@ _start: |
| 59 | 59 | /* Load the addresses of the user entry points. */ |
| 60 | 60 | #ifndef PIC |
| 61 | 61 | 	sethi	%hi(main), %o0 |
| 62 | 	sethi	%hi(__libc_csu_init), %o3 | |
| 63 | 	sethi	%hi(__libc_csu_fini), %o4 | |
| 64 | 62 | 	or	%o0, %lo(main), %o0 |
| 65 | 	or	%o3, %lo(__libc_csu_init), %o3 | |
| 66 | 	or	%o4, %lo(__libc_csu_fini), %o4 | |
| 67 | 63 | #else |
| 68 | 64 | 	sethi	%gdop_hix22(main), %o0 |
| 69 | 	sethi	%gdop_hix22(__libc_csu_init), %o3 | |
| 70 | 	sethi	%gdop_hix22(__libc_csu_fini), %o4 | |
| 71 | 65 | 	xor	%o0, %gdop_lox10(main), %o0 |
| 72 | 	xor	%o3, %gdop_lox10(__libc_csu_init), %o3 | |
| 73 | 	xor	%o4, %gdop_lox10(__libc_csu_fini), %o4 | |
| 74 | 66 | 	ld	[%l7 + %o0], %o0, %gdop(main) |
| 75 | 	ld	[%l7 + %o3], %o3, %gdop(__libc_csu_init) | |
| 76 | 	ld	[%l7 + %o4], %o4, %gdop(__libc_csu_fini) | |
| 77 | 67 | #endif |
| 68 | 	mov	0, %o3		/* Used to be init. */ | |
| 69 | 	mov	0, %o4		/* Used to be fini. */ | |
| 78 | 70 | |
| 79 | 71 | /* When starting a binary via the dynamic linker, %g1 contains the |
| 80 | 72 | address of the shared library termination function, which will be |
lib/libc/glibc/sysdeps/sparc/sparc64/start.S+3-11| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Startup code for elf64-sparc |
| 2 | Copyright (C) 1997-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1997-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997. |
| 5 | 5 | |
| ... | ... | @@ -60,22 +60,14 @@ _start: |
| 60 | 60 | /* Load the addresses of the user entry points. */ |
| 61 | 61 | #ifndef PIC |
| 62 | 62 | 	sethi	%hi(main), %o0 |
| 63 | 	sethi	%hi(__libc_csu_init), %o3 | |
| 64 | 	sethi	%hi(__libc_csu_fini), %o4 | |
| 65 | 63 | 	or	%o0, %lo(main), %o0 |
| 66 | 	or	%o3, %lo(__libc_csu_init), %o3 | |
| 67 | 	or	%o4, %lo(__libc_csu_fini), %o4 | |
| 68 | 64 | #else |
| 69 | 65 | 	sethi	%gdop_hix22(main), %o0 |
| 70 | 	sethi	%gdop_hix22(__libc_csu_init), %o3 | |
| 71 | 	sethi	%gdop_hix22(__libc_csu_fini), %o4 | |
| 72 | 66 | 	xor	%o0, %gdop_lox10(main), %o0 |
| 73 | 	xor	%o3, %gdop_lox10(__libc_csu_init), %o3 | |
| 74 | 	xor	%o4, %gdop_lox10(__libc_csu_fini), %o4 | |
| 75 | 67 | 	ldx	[%l7 + %o0], %o0, %gdop(main) |
| 76 | 	ldx	[%l7 + %o3], %o3, %gdop(__libc_csu_init) | |
| 77 | 	ldx	[%l7 + %o4], %o4, %gdop(__libc_csu_fini) | |
| 78 | 68 | #endif |
| 69 | 	mov	0, %o3		/* Used to be init. */ | |
| 70 | 	mov	0, %o4		/* Used to be fini. */ | |
| 79 | 71 | |
| 80 | 72 | /* When starting a binary via the dynamic linker, %g1 contains the |
| 81 | 73 | address of the shared library termination function, which will be |
lib/libc/glibc/sysdeps/sparc/sysdep.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 2011-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 2011-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/unix/alpha/sysdep.h deleted-382| ... | ... | @@ -1,382 +0,0 @@ |
| 1 | /* Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | Contributed by Brendan Kehoe (brendan@zen.org). | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library. If not, see | |
| 17 | <https://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #include <sysdeps/unix/sysdep.h> | |
| 20 | #include <dl-sysdep.h> /* Defines RTLD_PRIVATE_ERRNO. */ | |
| 21 | ||
| 22 | #ifdef __ASSEMBLER__ | |
| 23 | ||
| 24 | #ifdef __linux__ | |
| 25 | # include <alpha/regdef.h> | |
| 26 | #else | |
| 27 | # include <regdef.h> | |
| 28 | #endif | |
| 29 | ||
| 30 | #define __LABEL(x)	x##: | |
| 31 | ||
| 32 | #define LEAF(name, framesize)			\ | |
| 33 | .globl name;					\ | |
| 34 | .align 4;					\ | |
| 35 | .ent name, 0;					\ | |
| 36 | __LABEL(name)					\ | |
| 37 | .frame sp, framesize, ra | |
| 38 | ||
| 39 | #define ENTRY(name)				\ | |
| 40 | .globl name;					\ | |
| 41 | .align 4;					\ | |
| 42 | .ent name, 0;					\ | |
| 43 | __LABEL(name)					\ | |
| 44 | .frame sp, 0, ra | |
| 45 | ||
| 46 | /* Mark the end of function SYM. */ | |
| 47 | #undef END | |
| 48 | #define END(sym)	.end sym | |
| 49 | ||
| 50 | #ifdef PROF | |
| 51 | # define PSEUDO_PROF				\ | |
| 52 | 	.set noat;				\ | |
| 53 | 	lda	AT, _mcount;			\ | |
| 54 | 	jsr	AT, (AT), _mcount;		\ | |
| 55 | 	.set at | |
| 56 | #else | |
| 57 | # define PSEUDO_PROF | |
| 58 | #endif | |
| 59 | ||
| 60 | #ifdef PROF | |
| 61 | # define PSEUDO_PROLOGUE			\ | |
| 62 | 	.frame sp, 0, ra;			\ | |
| 63 | 	ldgp	gp,0(pv);			\ | |
| 64 | 	PSEUDO_PROF;				\ | |
| 65 | 	.prologue 1 | |
| 66 | #elif defined PIC | |
| 67 | # define PSEUDO_PROLOGUE			\ | |
| 68 | 	.frame sp, 0, ra;			\ | |
| 69 | 	.prologue 0 | |
| 70 | #else | |
| 71 | # define PSEUDO_PROLOGUE			\ | |
| 72 | 	.frame sp, 0, ra;			\ | |
| 73 | 	ldgp	gp,0(pv);			\ | |
| 74 | 	.prologue 1 | |
| 75 | #endif /* PROF */ | |
| 76 | ||
| 77 | #ifdef PROF | |
| 78 | # define USEPV_PROF	std | |
| 79 | #else | |
| 80 | # define USEPV_PROF	no | |
| 81 | #endif | |
| 82 | ||
| 83 | #if RTLD_PRIVATE_ERRNO | |
| 84 | # define SYSCALL_ERROR_LABEL	$syscall_error | |
| 85 | # define SYSCALL_ERROR_HANDLER			\ | |
| 86 | $syscall_error:					\ | |
| 87 | 	stl	v0, rtld_errno(gp)	!gprel;	\ | |
| 88 | 	lda	v0, -1;				\ | |
| 89 | 	ret | |
| 90 | # define SYSCALL_ERROR_FALLTHRU | |
| 91 | #elif defined(PIC) | |
| 92 | # define SYSCALL_ERROR_LABEL		__syscall_error !samegp | |
| 93 | # define SYSCALL_ERROR_HANDLER | |
| 94 | # define SYSCALL_ERROR_FALLTHRU		br SYSCALL_ERROR_LABEL | |
| 95 | #else | |
| 96 | # define SYSCALL_ERROR_LABEL		$syscall_error | |
| 97 | # define SYSCALL_ERROR_HANDLER			\ | |
| 98 | $syscall_error:					\ | |
| 99 | 	jmp $31, __syscall_error | |
| 100 | # define SYSCALL_ERROR_FALLTHRU | |
| 101 | #endif /* RTLD_PRIVATE_ERRNO */ | |
| 102 | ||
| 103 | /* Overridden by specific syscalls. */ | |
| 104 | #undef PSEUDO_PREPARE_ARGS | |
| 105 | #define PSEUDO_PREPARE_ARGS	/* Nothing. */ | |
| 106 | ||
| 107 | #define PSEUDO(name, syscall_name, args)	\ | |
| 108 | 	.globl name;				\ | |
| 109 | 	.align 4;				\ | |
| 110 | 	.ent name,0;				\ | |
| 111 | __LABEL(name)					\ | |
| 112 | 	PSEUDO_PROLOGUE;			\ | |
| 113 | 	PSEUDO_PREPARE_ARGS			\ | |
| 114 | 	lda	v0, SYS_ify(syscall_name);	\ | |
| 115 | 	call_pal PAL_callsys;			\ | |
| 116 | 	bne	a3, SYSCALL_ERROR_LABEL | |
| 117 | ||
| 118 | #undef PSEUDO_END | |
| 119 | #define PSEUDO_END(sym)				\ | |
| 120 | 	SYSCALL_ERROR_HANDLER;			\ | |
| 121 | 	END(sym) | |
| 122 | ||
| 123 | #define PSEUDO_NOERRNO(name, syscall_name, args)	\ | |
| 124 | 	.globl name;					\ | |
| 125 | 	.align 4;					\ | |
| 126 | 	.ent name,0;					\ | |
| 127 | __LABEL(name)						\ | |
| 128 | 	PSEUDO_PROLOGUE;				\ | |
| 129 | 	PSEUDO_PREPARE_ARGS				\ | |
| 130 | 	lda	v0, SYS_ify(syscall_name);		\ | |
| 131 | 	call_pal PAL_callsys; | |
| 132 | ||
| 133 | #undef PSEUDO_END_NOERRNO | |
| 134 | #define PSEUDO_END_NOERRNO(sym) END(sym) | |
| 135 | ||
| 136 | #define ret_NOERRNO ret | |
| 137 | ||
| 138 | #define PSEUDO_ERRVAL(name, syscall_name, args)	\ | |
| 139 | 	.globl name;					\ | |
| 140 | 	.align 4;					\ | |
| 141 | 	.ent name,0;					\ | |
| 142 | __LABEL(name)						\ | |
| 143 | 	PSEUDO_PROLOGUE;				\ | |
| 144 | 	PSEUDO_PREPARE_ARGS				\ | |
| 145 | 	lda	v0, SYS_ify(syscall_name);		\ | |
| 146 | 	call_pal PAL_callsys; | |
| 147 | ||
| 148 | #undef PSEUDO_END_ERRVAL | |
| 149 | #define PSEUDO_END_ERRVAL(sym) END(sym) | |
| 150 | ||
| 151 | #define ret_ERRVAL ret | |
| 152 | ||
| 153 | #define r0	v0 | |
| 154 | #define r1	a4 | |
| 155 | ||
| 156 | #define MOVE(x,y)	mov x,y | |
| 157 | ||
| 158 | #else /* !ASSEMBLER */ | |
| 159 | ||
| 160 | /* In order to get __set_errno() definition in INLINE_SYSCALL. */ | |
| 161 | #include <errno.h> | |
| 162 | ||
| 163 | /* ??? Linux needs to be able to override INLINE_SYSCALL for one | |
| 164 | particular special case. Make this easy. */ | |
| 165 | ||
| 166 | #undef INLINE_SYSCALL | |
| 167 | #define INLINE_SYSCALL(name, nr, args...) \ | |
| 168 | 	INLINE_SYSCALL1(name, nr, args) | |
| 169 | ||
| 170 | #define INLINE_SYSCALL1(name, nr, args...)	\ | |
| 171 | ({						\ | |
| 172 | 	long _sc_ret, _sc_err;			\ | |
| 173 | 	inline_syscall##nr(__NR_##name, args);	\ | |
| 174 | 	if (__builtin_expect (_sc_err, 0))	\ | |
| 175 | 	 {					\ | |
| 176 | 	 __set_errno (_sc_ret);		\ | |
| 177 | 	 _sc_ret = -1L;			\ | |
| 178 | 	 }					\ | |
| 179 | 	_sc_ret;				\ | |
| 180 | }) | |
| 181 | ||
| 182 | #define INTERNAL_SYSCALL(name, err_out, nr, args...) \ | |
| 183 | 	INTERNAL_SYSCALL1(name, err_out, nr, args) | |
| 184 | ||
| 185 | #define INTERNAL_SYSCALL1(name, err_out, nr, args...)	\ | |
| 186 | 	INTERNAL_SYSCALL_NCS(__NR_##name, err_out, nr, args) | |
| 187 | ||
| 188 | #define INTERNAL_SYSCALL_NCS(name, err_out, nr, args...) \ | |
| 189 | ({							\ | |
| 190 | 	long _sc_ret, _sc_err;				\ | |
| 191 | 	inline_syscall##nr(name, args);			\ | |
| 192 | 	err_out = _sc_err;				\ | |
| 193 | 	_sc_ret;					\ | |
| 194 | }) | |
| 195 | ||
| 196 | #define INTERNAL_SYSCALL_DECL(err) \ | |
| 197 | 	long int err __attribute__((unused)) | |
| 198 | ||
| 199 | /* The normal Alpha calling convention sign-extends 32-bit quantties | |
| 200 | no matter what the "real" sign of the 32-bit type. We want to | |
| 201 | preserve that when filling in values for the kernel. */ | |
| 202 | #define syscall_promote(arg) \ | |
| 203 | (sizeof (arg) == 4 ? (long)(int)(long)(arg) : (long)(arg)) | |
| 204 | ||
| 205 | /* Make sure and "use" the variable that we're not returning, | |
| 206 | in order to suppress unused variable warnings. */ | |
| 207 | #define INTERNAL_SYSCALL_ERROR_P(val, err)	((void)val, err) | |
| 208 | #define INTERNAL_SYSCALL_ERRNO(val, err)	((void)err, val) | |
| 209 | ||
| 210 | #define inline_syscall_clobbers				\ | |
| 211 | 	"$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8",	\ | |
| 212 | 	"$22", "$23", "$24", "$25", "$27", "$28", "memory" | |
| 213 | ||
| 214 | /* It is moderately important optimization-wise to limit the lifetime | |
| 215 | of the hard-register variables as much as possible. Thus we copy | |
| 216 | in/out as close to the asm as possible. */ | |
| 217 | ||
| 218 | #define inline_syscall0(name, args...)				\ | |
| 219 | {								\ | |
| 220 | 	register long _sc_19 __asm__("$19");			\ | |
| 221 | 	register long _sc_0 = name;				\ | |
| 222 | 	__asm__ __volatile__					\ | |
| 223 | 	 ("callsys # %0 %1 <= %2"				\ | |
| 224 | 	 : "+v"(_sc_0), "=r"(_sc_19)				\ | |
| 225 | 	 : : inline_syscall_clobbers,				\ | |
| 226 | 	 "$16", "$17", "$18", "$20", "$21");		\ | |
| 227 | 	_sc_ret = _sc_0, _sc_err = _sc_19;			\ | |
| 228 | } | |
| 229 | ||
| 230 | #define inline_syscall1(name,arg1)				\ | |
| 231 | {								\ | |
| 232 | 	register long _tmp_16 = syscall_promote (arg1);		\ | |
| 233 | 	register long _sc_0 = name;				\ | |
| 234 | 	register long _sc_16 __asm__("$16") = _tmp_16;		\ | |
| 235 | 	register long _sc_19 __asm__("$19");			\ | |
| 236 | 	__asm__ __volatile__					\ | |
| 237 | 	 ("callsys # %0 %1 <= %2 %3"				\ | |
| 238 | 	 : "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16)		\ | |
| 239 | 	 : : inline_syscall_clobbers,				\ | |
| 240 | 	 "$17", "$18", "$20", "$21");			\ | |
| 241 | 	_sc_ret = _sc_0, _sc_err = _sc_19;			\ | |
| 242 | } | |
| 243 | ||
| 244 | #define inline_syscall2(name,arg1,arg2)				\ | |
| 245 | {								\ | |
| 246 | 	register long _tmp_16 = syscall_promote (arg1);		\ | |
| 247 | 	register long _tmp_17 = syscall_promote (arg2);		\ | |
| 248 | 	register long _sc_0 = name;				\ | |
| 249 | 	register long _sc_16 __asm__("$16") = _tmp_16;		\ | |
| 250 | 	register long _sc_17 __asm__("$17") = _tmp_17;		\ | |
| 251 | 	register long _sc_19 __asm__("$19");			\ | |
| 252 | 	__asm__ __volatile__					\ | |
| 253 | 	 ("callsys # %0 %1 <= %2 %3 %4"			\ | |
| 254 | 	 : "+v"(_sc_0), "=r"(_sc_19),				\ | |
| 255 | 	 "+r"(_sc_16), "+r"(_sc_17)				\ | |
| 256 | 	 : : inline_syscall_clobbers,				\ | |
| 257 | 	 "$18", "$20", "$21");				\ | |
| 258 | 	_sc_ret = _sc_0, _sc_err = _sc_19;			\ | |
| 259 | } | |
| 260 | ||
| 261 | #define inline_syscall3(name,arg1,arg2,arg3)			\ | |
| 262 | {								\ | |
| 263 | 	register long _tmp_16 = syscall_promote (arg1);		\ | |
| 264 | 	register long _tmp_17 = syscall_promote (arg2);		\ | |
| 265 | 	register long _tmp_18 = syscall_promote (arg3);		\ | |
| 266 | 	register long _sc_0 = name;				\ | |
| 267 | 	register long _sc_16 __asm__("$16") = _tmp_16;		\ | |
| 268 | 	register long _sc_17 __asm__("$17") = _tmp_17;		\ | |
| 269 | 	register long _sc_18 __asm__("$18") = _tmp_18;		\ | |
| 270 | 	register long _sc_19 __asm__("$19");			\ | |
| 271 | 	__asm__ __volatile__					\ | |
| 272 | 	 ("callsys # %0 %1 <= %2 %3 %4 %5"			\ | |
| 273 | 	 : "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16),		\ | |
| 274 | 	 "+r"(_sc_17), "+r"(_sc_18)				\ | |
| 275 | 	 : : inline_syscall_clobbers, "$20", "$21");		\ | |
| 276 | 	_sc_ret = _sc_0, _sc_err = _sc_19;			\ | |
| 277 | } | |
| 278 | ||
| 279 | #define inline_syscall4(name,arg1,arg2,arg3,arg4)		\ | |
| 280 | {								\ | |
| 281 | 	register long _tmp_16 = syscall_promote (arg1);		\ | |
| 282 | 	register long _tmp_17 = syscall_promote (arg2);		\ | |
| 283 | 	register long _tmp_18 = syscall_promote (arg3);		\ | |
| 284 | 	register long _tmp_19 = syscall_promote (arg4);		\ | |
| 285 | 	register long _sc_0 = name;				\ | |
| 286 | 	register long _sc_16 __asm__("$16") = _tmp_16;		\ | |
| 287 | 	register long _sc_17 __asm__("$17") = _tmp_17;		\ | |
| 288 | 	register long _sc_18 __asm__("$18") = _tmp_18;		\ | |
| 289 | 	register long _sc_19 __asm__("$19") = _tmp_19;		\ | |
| 290 | 	__asm__ __volatile__					\ | |
| 291 | 	 ("callsys # %0 %1 <= %2 %3 %4 %5 %6"			\ | |
| 292 | 	 : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16),		\ | |
| 293 | 	 "+r"(_sc_17), "+r"(_sc_18)				\ | |
| 294 | 	 : : inline_syscall_clobbers, "$20", "$21");		\ | |
| 295 | 	_sc_ret = _sc_0, _sc_err = _sc_19;			\ | |
| 296 | } | |
| 297 | ||
| 298 | #define inline_syscall5(name,arg1,arg2,arg3,arg4,arg5)		\ | |
| 299 | {								\ | |
| 300 | 	register long _tmp_16 = syscall_promote (arg1);		\ | |
| 301 | 	register long _tmp_17 = syscall_promote (arg2);		\ | |
| 302 | 	register long _tmp_18 = syscall_promote (arg3);		\ | |
| 303 | 	register long _tmp_19 = syscall_promote (arg4);		\ | |
| 304 | 	register long _tmp_20 = syscall_promote (arg5);		\ | |
| 305 | 	register long _sc_0 = name;				\ | |
| 306 | 	register long _sc_16 __asm__("$16") = _tmp_16;		\ | |
| 307 | 	register long _sc_17 __asm__("$17") = _tmp_17;		\ | |
| 308 | 	register long _sc_18 __asm__("$18") = _tmp_18;		\ | |
| 309 | 	register long _sc_19 __asm__("$19") = _tmp_19;		\ | |
| 310 | 	register long _sc_20 __asm__("$20") = _tmp_20;		\ | |
| 311 | 	__asm__ __volatile__					\ | |
| 312 | 	 ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7"		\ | |
| 313 | 	 : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16),		\ | |
| 314 | 	 "+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20)		\ | |
| 315 | 	 : : inline_syscall_clobbers, "$21");			\ | |
| 316 | 	_sc_ret = _sc_0, _sc_err = _sc_19;			\ | |
| 317 | } | |
| 318 | ||
| 319 | #define inline_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6)	\ | |
| 320 | {								\ | |
| 321 | 	register long _tmp_16 = syscall_promote (arg1);		\ | |
| 322 | 	register long _tmp_17 = syscall_promote (arg2);		\ | |
| 323 | 	register long _tmp_18 = syscall_promote (arg3);		\ | |
| 324 | 	register long _tmp_19 = syscall_promote (arg4);		\ | |
| 325 | 	register long _tmp_20 = syscall_promote (arg5);		\ | |
| 326 | 	register long _tmp_21 = syscall_promote (arg6);		\ | |
| 327 | 	register long _sc_0 = name;				\ | |
| 328 | 	register long _sc_16 __asm__("$16") = _tmp_16;		\ | |
| 329 | 	register long _sc_17 __asm__("$17") = _tmp_17;		\ | |
| 330 | 	register long _sc_18 __asm__("$18") = _tmp_18;		\ | |
| 331 | 	register long _sc_19 __asm__("$19") = _tmp_19;		\ | |
| 332 | 	register long _sc_20 __asm__("$20") = _tmp_20;		\ | |
| 333 | 	register long _sc_21 __asm__("$21") = _tmp_21;		\ | |
| 334 | 	__asm__ __volatile__					\ | |
| 335 | 	 ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7 %8"		\ | |
| 336 | 	 : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16),		\ | |
| 337 | 	 "+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20),		\ | |
| 338 | 	 "+r"(_sc_21)					\ | |
| 339 | 	 : : inline_syscall_clobbers);			\ | |
| 340 | 	_sc_ret = _sc_0, _sc_err = _sc_19;			\ | |
| 341 | } | |
| 342 | #endif /* ASSEMBLER */ | |
| 343 | ||
| 344 | /* Pointer mangling support. Note that tls access is slow enough that | |
| 345 | we don't deoptimize things by placing the pointer check value there. */ | |
| 346 | ||
| 347 | #ifdef __ASSEMBLER__ | |
| 348 | # if IS_IN (rtld) | |
| 349 | # define PTR_MANGLE(dst, src, tmp)				\ | |
| 350 | 	ldah	tmp, __pointer_chk_guard_local($29) !gprelhigh;	\ | |
| 351 | 	ldq	tmp, __pointer_chk_guard_local(tmp) !gprellow;	\ | |
| 352 | 	xor	src, tmp, dst | |
| 353 | # define PTR_MANGLE2(dst, src, tmp)				\ | |
| 354 | 	xor	src, tmp, dst | |
| 355 | # elif defined SHARED | |
| 356 | # define PTR_MANGLE(dst, src, tmp)		\ | |
| 357 | 	ldq	tmp, __pointer_chk_guard;	\ | |
| 358 | 	xor	src, tmp, dst | |
| 359 | # else | |
| 360 | # define PTR_MANGLE(dst, src, tmp)		\ | |
| 361 | 	ldq	tmp, __pointer_chk_guard_local;	\ | |
| 362 | 	xor	src, tmp, dst | |
| 363 | # endif | |
| 364 | # define PTR_MANGLE2(dst, src, tmp)		\ | |
| 365 | 	xor	src, tmp, dst | |
| 366 | # define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp) | |
| 367 | # define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp) | |
| 368 | #else | |
| 369 | # include <stdint.h> | |
| 370 | # if (IS_IN (rtld) \ | |
| 371 | || (!defined SHARED && (IS_IN (libc) \ | |
| 372 | 			 || IS_IN (libpthread)))) | |
| 373 | extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; | |
| 374 | # define PTR_MANGLE(var) \ | |
| 375 | 	(var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local) | |
| 376 | # else | |
| 377 | extern uintptr_t __pointer_chk_guard attribute_relro; | |
| 378 | # define PTR_MANGLE(var) \ | |
| 379 | 	(var) = (__typeof(var)) ((uintptr_t) (var) ^ __pointer_chk_guard) | |
| 380 | # endif | |
| 381 | # define PTR_DEMANGLE(var) PTR_MANGLE(var) | |
| 382 | #endif /* ASSEMBLER */ |
lib/libc/glibc/sysdeps/unix/arm/sysdep.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1997-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1997-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/unix/i386/sysdep.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1991-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1991-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/unix/mips/mips32/sysdep.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1992-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | Contributed by Brendan Kehoe (brendan@zen.org). |
| 4 | 4 |
lib/libc/glibc/sysdeps/unix/mips/mips64/n32/sysdep.h deleted-64| ... | ... | @@ -1,64 +0,0 @@ |
| 1 | /* Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | Contributed by Alexandre Oliva <aoliva@redhat.com>. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library. If not, see | |
| 17 | <https://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #include <sysdeps/unix/mips/sysdep.h> | |
| 20 | ||
| 21 | #ifdef __ASSEMBLER__ | |
| 22 | ||
| 23 | /* Note that while it's better structurally, going back to call __syscall_error | |
| 24 | can make things confusing if you're debugging---it looks like it's jumping | |
| 25 | backwards into the previous fn. */ | |
| 26 | #ifdef __PIC__ | |
| 27 | #define PSEUDO(name, syscall_name, args) \ | |
| 28 | .align 2;								 \ | |
| 29 | .set nomips16;							 \ | |
| 30 | cfi_startproc;							 \ | |
| 31 | 99:;									 \ | |
| 32 | .set noat;								 \ | |
| 33 | .cpsetup t9, $1, name;						 \ | |
| 34 | cfi_register (gp, $1);						 \ | |
| 35 | .set at;								 \ | |
| 36 | la t9,__syscall_error;						 \ | |
| 37 | .cpreturn;								 \ | |
| 38 | cfi_restore (gp);							 \ | |
| 39 | jr t9;								 \ | |
| 40 | cfi_endproc;								 \ | |
| 41 | ENTRY(name)								 \ | |
| 42 | li v0, SYS_ify(syscall_name);						 \ | |
| 43 | syscall;								 \ | |
| 44 | bne a3, zero, 99b;							 \ | |
| 45 | L(syse1): | |
| 46 | #else | |
| 47 | #define PSEUDO(name, syscall_name, args) \ | |
| 48 | .set noreorder;							 \ | |
| 49 | .align 2;								 \ | |
| 50 | .set nomips16;							 \ | |
| 51 | cfi_startproc;							 \ | |
| 52 | 99: j __syscall_error;						 \ | |
| 53 | nop; \ | |
| 54 | cfi_endproc;								 \ | |
| 55 | ENTRY(name)								 \ | |
| 56 | .set noreorder;							 \ | |
| 57 | li v0, SYS_ify(syscall_name);						 \ | |
| 58 | syscall;								 \ | |
| 59 | .set reorder;								 \ | |
| 60 | bne a3, zero, 99b;							 \ | |
| 61 | L(syse1): | |
| 62 | #endif | |
| 63 | ||
| 64 | #endif |
lib/libc/glibc/sysdeps/unix/mips/mips64/n64/sysdep.h deleted-64| ... | ... | @@ -1,64 +0,0 @@ |
| 1 | /* Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | Contributed by Alexandre Oliva <aoliva@redhat.com>. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library. If not, see | |
| 17 | <https://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #include <sysdeps/unix/mips/sysdep.h> | |
| 20 | ||
| 21 | #ifdef __ASSEMBLER__ | |
| 22 | ||
| 23 | /* Note that while it's better structurally, going back to call __syscall_error | |
| 24 | can make things confusing if you're debugging---it looks like it's jumping | |
| 25 | backwards into the previous fn. */ | |
| 26 | #ifdef __PIC__ | |
| 27 | #define PSEUDO(name, syscall_name, args) \ | |
| 28 | .align 2;								 \ | |
| 29 | .set nomips16;							 \ | |
| 30 | cfi_startproc;							 \ | |
| 31 | 99:;									 \ | |
| 32 | .set noat;								 \ | |
| 33 | .cpsetup t9, $1, name;						 \ | |
| 34 | cfi_register (gp, $1);						 \ | |
| 35 | .set at;								 \ | |
| 36 | dla t9,__syscall_error;						 \ | |
| 37 | .cpreturn;								 \ | |
| 38 | cfi_restore (gp);							 \ | |
| 39 | jr t9;								 \ | |
| 40 | cfi_endproc;								 \ | |
| 41 | ENTRY(name)								 \ | |
| 42 | li v0, SYS_ify(syscall_name);						 \ | |
| 43 | syscall;								 \ | |
| 44 | bne a3, zero, 99b;							 \ | |
| 45 | L(syse1): | |
| 46 | #else | |
| 47 | #define PSEUDO(name, syscall_name, args) \ | |
| 48 | .set noreorder;							 \ | |
| 49 | .align 2;								 \ | |
| 50 | .set nomips16;							 \ | |
| 51 | cfi_startproc;							 \ | |
| 52 | 99: j __syscall_error;						 \ | |
| 53 | nop; \ | |
| 54 | cfi_endproc;								 \ | |
| 55 | ENTRY(name)								 \ | |
| 56 | .set noreorder;							 \ | |
| 57 | li v0, SYS_ify(syscall_name);						 \ | |
| 58 | syscall;								 \ | |
| 59 | .set reorder;								 \ | |
| 60 | bne a3, zero, 99b;							 \ | |
| 61 | L(syse1): | |
| 62 | #endif | |
| 63 | ||
| 64 | #endif |
lib/libc/glibc/sysdeps/unix/mips/sysdep.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1992-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | Contributed by Brendan Kehoe (brendan@zen.org). |
| 4 | 4 |
lib/libc/glibc/sysdeps/unix/powerpc/sysdep.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1991-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1991-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/unix/sh/sysdep.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1999-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1999-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/unix/sysdep.h+28-21| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1991-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1991-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -28,24 +28,24 @@ |
| 28 | 28 | #define __SYSCALL_CONCAT(a,b) __SYSCALL_CONCAT_X (a, b) |
| 29 | 29 | |
| 30 | 30 | |
| 31 | #define __INTERNAL_SYSCALL0(name, err) \ | |
| 32 | INTERNAL_SYSCALL (name, err, 0) | |
| 33 | #define __INTERNAL_SYSCALL1(name, err, a1) \ | |
| 34 | INTERNAL_SYSCALL (name, err, 1, a1) | |
| 35 | #define __INTERNAL_SYSCALL2(name, err, a1, a2) \ | |
| 36 | INTERNAL_SYSCALL (name, err, 2, a1, a2) | |
| 37 | #define __INTERNAL_SYSCALL3(name, err, a1, a2, a3) \ | |
| 38 | INTERNAL_SYSCALL (name, err, 3, a1, a2, a3) | |
| 39 | #define __INTERNAL_SYSCALL4(name, err, a1, a2, a3, a4) \ | |
| 40 | INTERNAL_SYSCALL (name, err, 4, a1, a2, a3, a4) | |
| 41 | #define __INTERNAL_SYSCALL5(name, err, a1, a2, a3, a4, a5) \ | |
| 42 | INTERNAL_SYSCALL (name, err, 5, a1, a2, a3, a4, a5) | |
| 43 | #define __INTERNAL_SYSCALL6(name, err, a1, a2, a3, a4, a5, a6) \ | |
| 44 | INTERNAL_SYSCALL (name, err, 6, a1, a2, a3, a4, a5, a6) | |
| 45 | #define __INTERNAL_SYSCALL7(name, err, a1, a2, a3, a4, a5, a6, a7) \ | |
| 46 | INTERNAL_SYSCALL (name, err, 7, a1, a2, a3, a4, a5, a6, a7) | |
| 47 | ||
| 48 | #define __INTERNAL_SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,o,...) o | |
| 31 | #define __INTERNAL_SYSCALL0(name) \ | |
| 32 | INTERNAL_SYSCALL (name, 0) | |
| 33 | #define __INTERNAL_SYSCALL1(name, a1) \ | |
| 34 | INTERNAL_SYSCALL (name, 1, a1) | |
| 35 | #define __INTERNAL_SYSCALL2(name, a1, a2) \ | |
| 36 | INTERNAL_SYSCALL (name, 2, a1, a2) | |
| 37 | #define __INTERNAL_SYSCALL3(name, a1, a2, a3) \ | |
| 38 | INTERNAL_SYSCALL (name, 3, a1, a2, a3) | |
| 39 | #define __INTERNAL_SYSCALL4(name, a1, a2, a3, a4) \ | |
| 40 | INTERNAL_SYSCALL (name, 4, a1, a2, a3, a4) | |
| 41 | #define __INTERNAL_SYSCALL5(name, a1, a2, a3, a4, a5) \ | |
| 42 | INTERNAL_SYSCALL (name, 5, a1, a2, a3, a4, a5) | |
| 43 | #define __INTERNAL_SYSCALL6(name, a1, a2, a3, a4, a5, a6) \ | |
| 44 | INTERNAL_SYSCALL (name, 6, a1, a2, a3, a4, a5, a6) | |
| 45 | #define __INTERNAL_SYSCALL7(name, a1, a2, a3, a4, a5, a6, a7) \ | |
| 46 | INTERNAL_SYSCALL (name, 7, a1, a2, a3, a4, a5, a6, a7) | |
| 47 | ||
| 48 | #define __INTERNAL_SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,...) n | |
| 49 | 49 | #define __INTERNAL_SYSCALL_NARGS(...) \ |
| 50 | 50 | __INTERNAL_SYSCALL_NARGS_X (__VA_ARGS__,7,6,5,4,3,2,1,0,) |
| 51 | 51 | #define __INTERNAL_SYSCALL_DISP(b,...) \ |
| ... | ... | @@ -88,10 +88,17 @@ |
| 88 | 88 | #define INLINE_SYSCALL_CALL(...) \ |
| 89 | 89 | __INLINE_SYSCALL_DISP (__INLINE_SYSCALL, __VA_ARGS__) |
| 90 | 90 | |
| 91 | #if IS_IN (rtld) | |
| 92 | /* All cancellation points are compiled out in the dynamic loader. */ | |
| 93 | # define NO_SYSCALL_CANCEL_CHECKING 1 | |
| 94 | #else | |
| 95 | # define NO_SYSCALL_CANCEL_CHECKING SINGLE_THREAD_P | |
| 96 | #endif | |
| 97 | ||
| 91 | 98 | #define SYSCALL_CANCEL(...) \ |
| 92 | 99 | ({									 \ |
| 93 | 100 | long int sc_ret;							 \ |
| 94 | if (SINGLE_THREAD_P) 						 \ | |
| 101 | if (NO_SYSCALL_CANCEL_CHECKING)					 \ | |
| 95 | 102 | sc_ret = INLINE_SYSCALL_CALL (__VA_ARGS__); 			 \ |
| 96 | 103 | else								 \ |
| 97 | 104 | {									 \ |
| ... | ... | @@ -107,7 +114,7 @@ |
| 107 | 114 | #define INTERNAL_SYSCALL_CANCEL(...) \ |
| 108 | 115 | ({									 \ |
| 109 | 116 | long int sc_ret;							 \ |
| 110 | if (SINGLE_THREAD_P) 						 \ | |
| 117 | if (NO_SYSCALL_CANCEL_CHECKING) 					 \ | |
| 111 | 118 | sc_ret = INTERNAL_SYSCALL_CALL (__VA_ARGS__); 			 \ |
| 112 | 119 | else								 \ |
| 113 | 120 | {									 \ |
lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/kernel-features.h+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | /* Set flags signalling availability of kernel features based on given |
| 2 | 2 | kernel version number. AArch64 version. |
| 3 | Copyright (C) 2018-2020 Free Software Foundation, Inc. | |
| 3 | Copyright (C) 2018-2021 Free Software Foundation, Inc. | |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 | |
| 6 | 6 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/sys/elf.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1996-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1996-2021 Free Software Foundation, Inc. | |
| 2 | 2 | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 |
lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/sysdep.h+11-34| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 2005-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 2005-2021 Free Software Foundation, Inc. | |
| 2 | 2 | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| ... | ... | @@ -164,29 +164,10 @@ |
| 164 | 164 | # define HAVE_CLOCK_GETTIME64_VSYSCALL	"__kernel_clock_gettime" |
| 165 | 165 | # define HAVE_GETTIMEOFDAY_VSYSCALL	"__kernel_gettimeofday" |
| 166 | 166 | |
| 167 | /* Previously AArch64 used the generic version without the libc_hidden_def | |
| 168 | which lead in a non existent __send symbol in libc.so. */ | |
| 169 | # undef HAVE_INTERNAL_SEND_SYMBOL | |
| 170 | ||
| 171 | 167 | # define SINGLE_THREAD_BY_GLOBAL		1 |
| 172 | 168 | |
| 173 | /* Define a macro which expands into the inline wrapper code for a system | |
| 174 | call. */ | |
| 175 | # undef INLINE_SYSCALL | |
| 176 | # define INLINE_SYSCALL(name, nr, args...)				\ | |
| 177 | ({ unsigned long _sys_result = INTERNAL_SYSCALL (name, , nr, args);	\ | |
| 178 | if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\ | |
| 179 | {								\ | |
| 180 | 	 __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, ));		\ | |
| 181 | 	 _sys_result = (unsigned long) -1;				\ | |
| 182 | }								\ | |
| 183 | (long) _sys_result; }) | |
| 184 | ||
| 185 | # undef INTERNAL_SYSCALL_DECL | |
| 186 | # define INTERNAL_SYSCALL_DECL(err) do { } while (0) | |
| 187 | ||
| 188 | 169 | # undef INTERNAL_SYSCALL_RAW |
| 189 | # define INTERNAL_SYSCALL_RAW(name, err, nr, args...)		\ | |
| 170 | # define INTERNAL_SYSCALL_RAW(name, nr, args...)		\ | |
| 190 | 171 | ({ long _sys_result;						\ |
| 191 | 172 | {								\ |
| 192 | 173 | LOAD_ARGS_##nr (args)					\ |
| ... | ... | @@ -198,19 +179,12 @@ |
| 198 | 179 | _sys_result; }) |
| 199 | 180 | |
| 200 | 181 | # undef INTERNAL_SYSCALL |
| 201 | # define INTERNAL_SYSCALL(name, err, nr, args...)		\ | |
| 202 | 	INTERNAL_SYSCALL_RAW(SYS_ify(name), err, nr, args) | |
| 182 | # define INTERNAL_SYSCALL(name, nr, args...)			\ | |
| 183 | 	INTERNAL_SYSCALL_RAW(SYS_ify(name), nr, args) | |
| 203 | 184 | |
| 204 | 185 | # undef INTERNAL_SYSCALL_AARCH64 |
| 205 | # define INTERNAL_SYSCALL_AARCH64(name, err, nr, args...)	\ | |
| 206 | 	INTERNAL_SYSCALL_RAW(__ARM_NR_##name, err, nr, args) | |
| 207 | ||
| 208 | # undef INTERNAL_SYSCALL_ERROR_P | |
| 209 | # define INTERNAL_SYSCALL_ERROR_P(val, err) \ | |
| 210 | ((unsigned long) (val) >= (unsigned long) -4095) | |
| 211 | ||
| 212 | # undef INTERNAL_SYSCALL_ERRNO | |
| 213 | # define INTERNAL_SYSCALL_ERRNO(val, err)	(-(val)) | |
| 186 | # define INTERNAL_SYSCALL_AARCH64(name, nr, args...)		\ | |
| 187 | 	INTERNAL_SYSCALL_RAW(__ARM_NR_##name, nr, args) | |
| 214 | 188 | |
| 215 | 189 | # define LOAD_ARGS_0()				\ |
| 216 | 190 | register long _x0 asm ("x0"); |
| ... | ... | @@ -253,8 +227,11 @@ |
| 253 | 227 | # define ASM_ARGS_7	ASM_ARGS_6, "r" (_x6) |
| 254 | 228 | |
| 255 | 229 | # undef INTERNAL_SYSCALL_NCS |
| 256 | # define INTERNAL_SYSCALL_NCS(number, err, nr, args...)	\ | |
| 257 | 	INTERNAL_SYSCALL_RAW (number, err, nr, args) | |
| 230 | # define INTERNAL_SYSCALL_NCS(number, nr, args...)	\ | |
| 231 | 	INTERNAL_SYSCALL_RAW (number, nr, args) | |
| 232 | ||
| 233 | #undef HAVE_INTERNAL_BRK_ADDR_SYMBOL | |
| 234 | #define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 | |
| 258 | 235 | |
| 259 | 236 | #endif	/* __ASSEMBLER__ */ |
| 260 | 237 |
lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/bits/stat.h deleted-160| ... | ... | @@ -1,160 +0,0 @@ |
| 1 | /* Copyright (C) 1996-2020 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library. If not, see | |
| 16 | <https://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | #if !defined _SYS_STAT_H && !defined _FCNTL_H | |
| 19 | # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." | |
| 20 | #endif | |
| 21 | ||
| 22 | #ifndef _BITS_STAT_H | |
| 23 | #define _BITS_STAT_H	1 | |
| 24 | ||
| 25 | /* Versions of the `struct stat' data structure. */ | |
| 26 | #define _STAT_VER_KERNEL	0 | |
| 27 | #define _STAT_VER_GLIBC2	1 | |
| 28 | #define _STAT_VER_GLIBC2_1	2 | |
| 29 | #define _STAT_VER_KERNEL64	3 | |
| 30 | #define _STAT_VER_GLIBC2_3_4	3 | |
| 31 | #define _STAT_VER_LINUX		3 | |
| 32 | #define _STAT_VER		_STAT_VER_LINUX | |
| 33 | ||
| 34 | /* Versions of the `xmknod' interface. */ | |
| 35 | #define _MKNOD_VER_LINUX	0 | |
| 36 | ||
| 37 | ||
| 38 | /* Nanosecond resolution timestamps are stored in a format equivalent to | |
| 39 | 'struct timespec'. This is the type used whenever possible but the | |
| 40 | Unix namespace rules do not allow the identifier 'timespec' to appear | |
| 41 | in the <sys/stat.h> header. Therefore we have to handle the use of | |
| 42 | this header in strictly standard-compliant sources special. | |
| 43 | ||
| 44 | Use neat tidy anonymous unions and structures when possible. */ | |
| 45 | ||
| 46 | #ifdef __USE_XOPEN2K8 | |
| 47 | # if __GNUC_PREREQ(3,3) | |
| 48 | # define __ST_TIME(X)				\ | |
| 49 | 	__extension__ union {			\ | |
| 50 | 	 struct timespec st_##X##tim;	\ | |
| 51 | 	 struct {				\ | |
| 52 | 		__time_t st_##X##time;		\ | |
| 53 | 		unsigned long st_##X##timensec;	\ | |
| 54 | 	 };					\ | |
| 55 | 	} | |
| 56 | # else | |
| 57 | # define __ST_TIME(X) struct timespec st_##X##tim | |
| 58 | # define st_atime st_atim.tv_sec | |
| 59 | # define st_mtime st_mtim.tv_sec | |
| 60 | # define st_ctime st_ctim.tv_sec | |
| 61 | # endif | |
| 62 | #else | |
| 63 | # define __ST_TIME(X)				\ | |
| 64 | 	__time_t st_##X##time;			\ | |
| 65 | 	unsigned long st_##X##timensec | |
| 66 | #endif | |
| 67 | ||
| 68 | ||
| 69 | struct stat | |
| 70 | { | |
| 71 | __dev_t st_dev;		/* Device. */ | |
| 72 | #ifdef __USE_FILE_OFFSET64 | |
| 73 | __ino64_t st_ino;		/* File serial number. */ | |
| 74 | #else | |
| 75 | __ino_t st_ino;		/* File serial number.	*/ | |
| 76 | int __pad0;			/* 64-bit st_ino. */ | |
| 77 | #endif | |
| 78 | __dev_t st_rdev;		/* Device number, if device. */ | |
| 79 | __off_t st_size;		/* Size of file, in bytes. */ | |
| 80 | #ifdef __USE_FILE_OFFSET64 | |
| 81 | __blkcnt64_t st_blocks;	/* Nr. 512-byte blocks allocated. */ | |
| 82 | #else | |
| 83 | __blkcnt_t st_blocks;	/* Nr. 512-byte blocks allocated. */ | |
| 84 | int __pad1;			/* 64-bit st_blocks. */ | |
| 85 | #endif | |
| 86 | __mode_t st_mode;		/* File mode. */ | |
| 87 | __uid_t st_uid;		/* User ID of the file's owner.	*/ | |
| 88 | __gid_t st_gid;		/* Group ID of the file's group.*/ | |
| 89 | __blksize_t st_blksize;	/* Optimal block size for I/O. */ | |
| 90 | __nlink_t st_nlink;		/* Link count. */ | |
| 91 | int __pad2;			/* Real padding. */ | |
| 92 | __ST_TIME(a);		/* Time of last access. */ | |
| 93 | __ST_TIME(m);		/* Time of last modification. */ | |
| 94 | __ST_TIME(c);		/* Time of last status change. */ | |
| 95 | long __glibc_reserved[3]; | |
| 96 | }; | |
| 97 | ||
| 98 | #ifdef __USE_LARGEFILE64 | |
| 99 | /* Note stat64 is the same shape as stat. */ | |
| 100 | struct stat64 | |
| 101 | { | |
| 102 | __dev_t st_dev;		/* Device. */ | |
| 103 | __ino64_t st_ino;		/* File serial number. */ | |
| 104 | __dev_t st_rdev;		/* Device number, if device. */ | |
| 105 | __off_t st_size;		/* Size of file, in bytes. */ | |
| 106 | __blkcnt64_t st_blocks;	/* Nr. 512-byte blocks allocated. */ | |
| 107 | __mode_t st_mode;		/* File mode. */ | |
| 108 | __uid_t st_uid;		/* User ID of the file's owner.	*/ | |
| 109 | __gid_t st_gid;		/* Group ID of the file's group.*/ | |
| 110 | __blksize_t st_blksize;	/* Optimal block size for I/O. */ | |
| 111 | __nlink_t st_nlink;		/* Link count. */ | |
| 112 | int __pad0;			/* Real padding. */ | |
| 113 | __ST_TIME(a);		/* Time of last access. */ | |
| 114 | __ST_TIME(m);		/* Time of last modification. */ | |
| 115 | __ST_TIME(c);		/* Time of last status change. */ | |
| 116 | long __glibc_reserved[3]; | |
| 117 | }; | |
| 118 | #endif | |
| 119 | ||
| 120 | #undef __ST_TIME | |
| 121 | ||
| 122 | /* Tell code we have these members. */ | |
| 123 | #define	_STATBUF_ST_BLKSIZE | |
| 124 | #define _STATBUF_ST_RDEV | |
| 125 | #define _STATBUF_ST_NSEC | |
| 126 | ||
| 127 | /* Encoding of the file mode. */ | |
| 128 | ||
| 129 | #define	__S_IFMT	0170000	/* These bits determine file type. */ | |
| 130 | ||
| 131 | /* File types. */ | |
| 132 | #define	__S_IFDIR	0040000	/* Directory. */ | |
| 133 | #define	__S_IFCHR	0020000	/* Character device. */ | |
| 134 | #define	__S_IFBLK	0060000	/* Block device. */ | |
| 135 | #define	__S_IFREG	0100000	/* Regular file. */ | |
| 136 | #define	__S_IFIFO	0010000	/* FIFO. */ | |
| 137 | #define	__S_IFLNK	0120000	/* Symbolic link. */ | |
| 138 | #define	__S_IFSOCK	0140000	/* Socket. */ | |
| 139 | ||
| 140 | /* POSIX.1b objects. Note that these macros always evaluate to zero. But | |
| 141 | they do it by enforcing the correct use of the macros. */ | |
| 142 | #define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 143 | #define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 144 | #define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 145 | ||
| 146 | /* Protection bits. */ | |
| 147 | ||
| 148 | #define	__S_ISUID	04000	/* Set user ID on execution. */ | |
| 149 | #define	__S_ISGID	02000	/* Set group ID on execution. */ | |
| 150 | #define	__S_ISVTX	01000	/* Save swapped text after use (sticky). */ | |
| 151 | #define	__S_IREAD	0400	/* Read by owner. */ | |
| 152 | #define	__S_IWRITE	0200	/* Write by owner. */ | |
| 153 | #define	__S_IEXEC	0100	/* Execute by owner. */ | |
| 154 | ||
| 155 | #ifdef __USE_ATFILE | |
| 156 | # define UTIME_NOW	((1l << 30) - 1l) | |
| 157 | # define UTIME_OMIT	((1l << 30) - 2l) | |
| 158 | #endif | |
| 159 | ||
| 160 | #endif /* bits/stat.h */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h+5-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* bits/typesizes.h -- underlying types for *_t. Linux/Alpha version. |
| 2 | Copyright (C) 2002-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2002-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -49,6 +49,7 @@ |
| 49 | 49 | #define __TIME_T_TYPE		__SLONGWORD_TYPE |
| 50 | 50 | #define __USECONDS_T_TYPE	__U32_TYPE |
| 51 | 51 | #define __SUSECONDS_T_TYPE	__S64_TYPE |
| 52 | #define __SUSECONDS64_T_TYPE	__S64_TYPE | |
| 52 | 53 | #define __DADDR_T_TYPE		__S32_TYPE |
| 53 | 54 | #define __KEY_T_TYPE		__S32_TYPE |
| 54 | 55 | #define __CLOCKID_T_TYPE	__S32_TYPE |
| ... | ... | @@ -72,6 +73,9 @@ |
| 72 | 73 | /* Not for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ |
| 73 | 74 | # define __STATFS_MATCHES_STATFS64 0 |
| 74 | 75 | |
| 76 | /* And for getitimer, setitimer and rusage */ | |
| 77 | #define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1 | |
| 78 | ||
| 75 | 79 | /* Number of descriptors that can fit in an `fd_set'. */ |
| 76 | 80 | #define	__FD_SETSIZE		1024 |
| 77 | 81 |
lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/kernel-features.h+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | /* Set flags signalling availability of kernel features based on given |
| 2 | 2 | kernel version number. |
| 3 | Copyright (C) 2010-2020 Free Software Foundation, Inc. | |
| 3 | Copyright (C) 2010-2021 Free Software Foundation, Inc. | |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 | |
| 6 | 6 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/sysdep.h+325-8| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1992-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995. |
| 4 | 4 | |
| ... | ... | @@ -19,14 +19,10 @@ |
| 19 | 19 | #ifndef _LINUX_ALPHA_SYSDEP_H |
| 20 | 20 | #define _LINUX_ALPHA_SYSDEP_H 1 |
| 21 | 21 | |
| 22 | #ifdef __ASSEMBLER__ | |
| 23 | #include <asm/pal.h> | |
| 24 | #include <alpha/regdef.h> | |
| 25 | #endif | |
| 26 | ||
| 27 | 22 | /* There is some commonality. */ |
| 28 | 23 | #include <sysdeps/unix/sysv/linux/sysdep.h> |
| 29 | #include <sysdeps/unix/alpha/sysdep.h> | |
| 24 | #include <sysdeps/unix/sysdep.h> | |
| 25 | #include <dl-sysdep.h> /* Defines RTLD_PRIVATE_ERRNO. */ | |
| 30 | 26 | |
| 31 | 27 | #include <tls.h> |
| 32 | 28 | |
| ... | ... | @@ -39,4 +35,325 @@ |
| 39 | 35 | |
| 40 | 36 | #define SINGLE_THREAD_BY_GLOBAL 1 |
| 41 | 37 | |
| 42 | #endif /* _LINUX_ALPHA_SYSDEP_H */ | |
| 38 | #ifdef __ASSEMBLER__ | |
| 39 | #include <asm/pal.h> | |
| 40 | #include <alpha/regdef.h> | |
| 41 | ||
| 42 | #define __LABEL(x)	x##: | |
| 43 | ||
| 44 | #define LEAF(name, framesize)			\ | |
| 45 | .globl name;					\ | |
| 46 | .align 4;					\ | |
| 47 | .ent name, 0;					\ | |
| 48 | __LABEL(name)					\ | |
| 49 | .frame sp, framesize, ra | |
| 50 | ||
| 51 | #define ENTRY(name)				\ | |
| 52 | .globl name;					\ | |
| 53 | .align 4;					\ | |
| 54 | .ent name, 0;					\ | |
| 55 | __LABEL(name)					\ | |
| 56 | .frame sp, 0, ra | |
| 57 | ||
| 58 | /* Mark the end of function SYM. */ | |
| 59 | #undef END | |
| 60 | #define END(sym)	.end sym | |
| 61 | ||
| 62 | #ifdef PROF | |
| 63 | # define PSEUDO_PROF				\ | |
| 64 | 	.set noat;				\ | |
| 65 | 	lda	AT, _mcount;			\ | |
| 66 | 	jsr	AT, (AT), _mcount;		\ | |
| 67 | 	.set at | |
| 68 | #else | |
| 69 | # define PSEUDO_PROF | |
| 70 | #endif | |
| 71 | ||
| 72 | #ifdef PROF | |
| 73 | # define PSEUDO_PROLOGUE			\ | |
| 74 | 	.frame sp, 0, ra;			\ | |
| 75 | 	ldgp	gp,0(pv);			\ | |
| 76 | 	PSEUDO_PROF;				\ | |
| 77 | 	.prologue 1 | |
| 78 | #elif defined PIC | |
| 79 | # define PSEUDO_PROLOGUE			\ | |
| 80 | 	.frame sp, 0, ra;			\ | |
| 81 | 	.prologue 0 | |
| 82 | #else | |
| 83 | # define PSEUDO_PROLOGUE			\ | |
| 84 | 	.frame sp, 0, ra;			\ | |
| 85 | 	ldgp	gp,0(pv);			\ | |
| 86 | 	.prologue 1 | |
| 87 | #endif /* PROF */ | |
| 88 | ||
| 89 | #ifdef PROF | |
| 90 | # define USEPV_PROF	std | |
| 91 | #else | |
| 92 | # define USEPV_PROF	no | |
| 93 | #endif | |
| 94 | ||
| 95 | #undef SYSCALL_ERROR_LABEL | |
| 96 | #if RTLD_PRIVATE_ERRNO | |
| 97 | # define SYSCALL_ERROR_LABEL	$syscall_error | |
| 98 | # define SYSCALL_ERROR_HANDLER			\ | |
| 99 | $syscall_error:					\ | |
| 100 | 	stl	v0, rtld_errno(gp)	!gprel;	\ | |
| 101 | 	lda	v0, -1;				\ | |
| 102 | 	ret | |
| 103 | # define SYSCALL_ERROR_FALLTHRU | |
| 104 | #elif defined(PIC) | |
| 105 | # define SYSCALL_ERROR_LABEL		__syscall_error !samegp | |
| 106 | # define SYSCALL_ERROR_HANDLER | |
| 107 | # define SYSCALL_ERROR_FALLTHRU		br SYSCALL_ERROR_LABEL | |
| 108 | #else | |
| 109 | # define SYSCALL_ERROR_LABEL		$syscall_error | |
| 110 | # define SYSCALL_ERROR_HANDLER			\ | |
| 111 | $syscall_error:					\ | |
| 112 | 	jmp $31, __syscall_error | |
| 113 | # define SYSCALL_ERROR_FALLTHRU | |
| 114 | #endif /* RTLD_PRIVATE_ERRNO */ | |
| 115 | ||
| 116 | /* Overridden by specific syscalls. */ | |
| 117 | #undef PSEUDO_PREPARE_ARGS | |
| 118 | #define PSEUDO_PREPARE_ARGS	/* Nothing. */ | |
| 119 | ||
| 120 | #define PSEUDO(name, syscall_name, args)	\ | |
| 121 | 	.globl name;				\ | |
| 122 | 	.align 4;				\ | |
| 123 | 	.ent name,0;				\ | |
| 124 | __LABEL(name)					\ | |
| 125 | 	PSEUDO_PROLOGUE;			\ | |
| 126 | 	PSEUDO_PREPARE_ARGS			\ | |
| 127 | 	lda	v0, SYS_ify(syscall_name);	\ | |
| 128 | 	call_pal PAL_callsys;			\ | |
| 129 | 	bne	a3, SYSCALL_ERROR_LABEL | |
| 130 | ||
| 131 | #undef PSEUDO_END | |
| 132 | #define PSEUDO_END(sym)				\ | |
| 133 | 	SYSCALL_ERROR_HANDLER;			\ | |
| 134 | 	END(sym) | |
| 135 | ||
| 136 | #define PSEUDO_NOERRNO(name, syscall_name, args)	\ | |
| 137 | 	.globl name;					\ | |
| 138 | 	.align 4;					\ | |
| 139 | 	.ent name,0;					\ | |
| 140 | __LABEL(name)						\ | |
| 141 | 	PSEUDO_PROLOGUE;				\ | |
| 142 | 	PSEUDO_PREPARE_ARGS				\ | |
| 143 | 	lda	v0, SYS_ify(syscall_name);		\ | |
| 144 | 	call_pal PAL_callsys; | |
| 145 | ||
| 146 | #undef PSEUDO_END_NOERRNO | |
| 147 | #define PSEUDO_END_NOERRNO(sym) END(sym) | |
| 148 | ||
| 149 | #define ret_NOERRNO ret | |
| 150 | ||
| 151 | #define PSEUDO_ERRVAL(name, syscall_name, args)	\ | |
| 152 | 	.globl name;					\ | |
| 153 | 	.align 4;					\ | |
| 154 | 	.ent name,0;					\ | |
| 155 | __LABEL(name)						\ | |
| 156 | 	PSEUDO_PROLOGUE;				\ | |
| 157 | 	PSEUDO_PREPARE_ARGS				\ | |
| 158 | 	lda	v0, SYS_ify(syscall_name);		\ | |
| 159 | 	call_pal PAL_callsys; | |
| 160 | ||
| 161 | #undef PSEUDO_END_ERRVAL | |
| 162 | #define PSEUDO_END_ERRVAL(sym) END(sym) | |
| 163 | ||
| 164 | #define ret_ERRVAL ret | |
| 165 | ||
| 166 | #define r0	v0 | |
| 167 | #define r1	a4 | |
| 168 | ||
| 169 | #define MOVE(x,y)	mov x,y | |
| 170 | ||
| 171 | #else /* !ASSEMBLER */ | |
| 172 | ||
| 173 | #define INTERNAL_SYSCALL(name, nr, args...) \ | |
| 174 | 	internal_syscall##nr(__NR_##name, args) | |
| 175 | ||
| 176 | #define INTERNAL_SYSCALL_NCS(name, nr, args...) \ | |
| 177 | 	internal_syscall##nr(name, args) | |
| 178 | ||
| 179 | /* The normal Alpha calling convention sign-extends 32-bit quantties | |
| 180 | no matter what the "real" sign of the 32-bit type. We want to | |
| 181 | preserve that when filling in values for the kernel. */ | |
| 182 | #define syscall_promote(arg) \ | |
| 183 | (sizeof (arg) == 4 ? (long int)(int)(long int)(arg) : (long int)(arg)) | |
| 184 | ||
| 185 | #define internal_syscall_clobbers				\ | |
| 186 | 	"$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8",	\ | |
| 187 | 	"$22", "$23", "$24", "$25", "$27", "$28", "memory" | |
| 188 | ||
| 189 | /* It is moderately important optimization-wise to limit the lifetime | |
| 190 | of the hard-register variables as much as possible. Thus we copy | |
| 191 | in/out as close to the asm as possible. */ | |
| 192 | ||
| 193 | #define internal_syscall0(name, args...)			\ | |
| 194 | ({								\ | |
| 195 | 	register long int _sc_19 __asm__("$19");		\ | |
| 196 | 	register long int _sc_0 = name;				\ | |
| 197 | 	__asm__ __volatile__					\ | |
| 198 | 	 ("callsys # %0 %1 <= %2"				\ | |
| 199 | 	 : "+v"(_sc_0), "=r"(_sc_19)				\ | |
| 200 | 	 : : internal_syscall_clobbers,			\ | |
| 201 | 	 "$16", "$17", "$18", "$20", "$21");		\ | |
| 202 | 	_sc_19 != 0 ? -_sc_0 : _sc_0;				\ | |
| 203 | }) | |
| 204 | ||
| 205 | #define internal_syscall1(name,arg1)				\ | |
| 206 | ({								\ | |
| 207 | 	register long int _tmp_16 = syscall_promote (arg1);	\ | |
| 208 | 	register long int _sc_0 = name;				\ | |
| 209 | 	register long int _sc_16 __asm__("$16") = _tmp_16;	\ | |
| 210 | 	register long int _sc_19 __asm__("$19");		\ | |
| 211 | 	__asm__ __volatile__					\ | |
| 212 | 	 ("callsys # %0 %1 <= %2 %3"				\ | |
| 213 | 	 : "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16)		\ | |
| 214 | 	 : : internal_syscall_clobbers,			\ | |
| 215 | 	 "$17", "$18", "$20", "$21");			\ | |
| 216 | 	_sc_19 != 0 ? -_sc_0 : _sc_0;				\ | |
| 217 | }) | |
| 218 | ||
| 219 | #define internal_syscall2(name,arg1,arg2)			\ | |
| 220 | ({								\ | |
| 221 | 	register long int _tmp_16 = syscall_promote (arg1);	\ | |
| 222 | 	register long int _tmp_17 = syscall_promote (arg2);	\ | |
| 223 | 	register long int _sc_0 = name;				\ | |
| 224 | 	register long int _sc_16 __asm__("$16") = _tmp_16;	\ | |
| 225 | 	register long int _sc_17 __asm__("$17") = _tmp_17;	\ | |
| 226 | 	register long int _sc_19 __asm__("$19");		\ | |
| 227 | 	__asm__ __volatile__					\ | |
| 228 | 	 ("callsys # %0 %1 <= %2 %3 %4"			\ | |
| 229 | 	 : "+v"(_sc_0), "=r"(_sc_19),				\ | |
| 230 | 	 "+r"(_sc_16), "+r"(_sc_17)				\ | |
| 231 | 	 : : internal_syscall_clobbers,			\ | |
| 232 | 	 "$18", "$20", "$21");				\ | |
| 233 | 	_sc_19 != 0 ? -_sc_0 : _sc_0;				\ | |
| 234 | }) | |
| 235 | ||
| 236 | #define internal_syscall3(name,arg1,arg2,arg3)			\ | |
| 237 | ({								\ | |
| 238 | 	register long int _tmp_16 = syscall_promote (arg1);	\ | |
| 239 | 	register long int _tmp_17 = syscall_promote (arg2);	\ | |
| 240 | 	register long int _tmp_18 = syscall_promote (arg3);	\ | |
| 241 | 	register long int _sc_0 = name;				\ | |
| 242 | 	register long int _sc_16 __asm__("$16") = _tmp_16;	\ | |
| 243 | 	register long int _sc_17 __asm__("$17") = _tmp_17;	\ | |
| 244 | 	register long int _sc_18 __asm__("$18") = _tmp_18;	\ | |
| 245 | 	register long int _sc_19 __asm__("$19");		\ | |
| 246 | 	__asm__ __volatile__					\ | |
| 247 | 	 ("callsys # %0 %1 <= %2 %3 %4 %5"			\ | |
| 248 | 	 : "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16),		\ | |
| 249 | 	 "+r"(_sc_17), "+r"(_sc_18)				\ | |
| 250 | 	 : : internal_syscall_clobbers, "$20", "$21");	\ | |
| 251 | 	_sc_19 != 0 ? -_sc_0 : _sc_0;				\ | |
| 252 | }) | |
| 253 | ||
| 254 | #define internal_syscall4(name,arg1,arg2,arg3,arg4)		\ | |
| 255 | ({								\ | |
| 256 | 	register long int _tmp_16 = syscall_promote (arg1);	\ | |
| 257 | 	register long int _tmp_17 = syscall_promote (arg2);	\ | |
| 258 | 	register long int _tmp_18 = syscall_promote (arg3);	\ | |
| 259 | 	register long int _tmp_19 = syscall_promote (arg4);	\ | |
| 260 | 	register long int _sc_0 = name;				\ | |
| 261 | 	register long int _sc_16 __asm__("$16") = _tmp_16;	\ | |
| 262 | 	register long int _sc_17 __asm__("$17") = _tmp_17;	\ | |
| 263 | 	register long int _sc_18 __asm__("$18") = _tmp_18;	\ | |
| 264 | 	register long int _sc_19 __asm__("$19") = _tmp_19;	\ | |
| 265 | 	__asm__ __volatile__					\ | |
| 266 | 	 ("callsys # %0 %1 <= %2 %3 %4 %5 %6"			\ | |
| 267 | 	 : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16),		\ | |
| 268 | 	 "+r"(_sc_17), "+r"(_sc_18)				\ | |
| 269 | 	 : : internal_syscall_clobbers, "$20", "$21");	\ | |
| 270 | 	_sc_19 != 0 ? -_sc_0 : _sc_0;				\ | |
| 271 | }) | |
| 272 | ||
| 273 | #define internal_syscall5(name,arg1,arg2,arg3,arg4,arg5)	\ | |
| 274 | ({								\ | |
| 275 | 	register long int _tmp_16 = syscall_promote (arg1);	\ | |
| 276 | 	register long int _tmp_17 = syscall_promote (arg2);	\ | |
| 277 | 	register long int _tmp_18 = syscall_promote (arg3);	\ | |
| 278 | 	register long int _tmp_19 = syscall_promote (arg4);	\ | |
| 279 | 	register long int _tmp_20 = syscall_promote (arg5);	\ | |
| 280 | 	register long int _sc_0 = name;				\ | |
| 281 | 	register long int _sc_16 __asm__("$16") = _tmp_16;	\ | |
| 282 | 	register long int _sc_17 __asm__("$17") = _tmp_17;	\ | |
| 283 | 	register long int _sc_18 __asm__("$18") = _tmp_18;	\ | |
| 284 | 	register long int _sc_19 __asm__("$19") = _tmp_19;	\ | |
| 285 | 	register long int _sc_20 __asm__("$20") = _tmp_20;	\ | |
| 286 | 	__asm__ __volatile__					\ | |
| 287 | 	 ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7"		\ | |
| 288 | 	 : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16),		\ | |
| 289 | 	 "+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20)		\ | |
| 290 | 	 : : internal_syscall_clobbers, "$21");		\ | |
| 291 | 	_sc_19 != 0 ? -_sc_0 : _sc_0;				\ | |
| 292 | }) | |
| 293 | ||
| 294 | #define internal_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6)	\ | |
| 295 | ({								\ | |
| 296 | 	register long int _tmp_16 = syscall_promote (arg1);	\ | |
| 297 | 	register long int _tmp_17 = syscall_promote (arg2);	\ | |
| 298 | 	register long int _tmp_18 = syscall_promote (arg3);	\ | |
| 299 | 	register long int _tmp_19 = syscall_promote (arg4);	\ | |
| 300 | 	register long int _tmp_20 = syscall_promote (arg5);	\ | |
| 301 | 	register long int _tmp_21 = syscall_promote (arg6);	\ | |
| 302 | 	register long int _sc_0 = name;				\ | |
| 303 | 	register long int _sc_16 __asm__("$16") = _tmp_16;	\ | |
| 304 | 	register long int _sc_17 __asm__("$17") = _tmp_17;	\ | |
| 305 | 	register long int _sc_18 __asm__("$18") = _tmp_18;	\ | |
| 306 | 	register long int _sc_19 __asm__("$19") = _tmp_19;	\ | |
| 307 | 	register long int _sc_20 __asm__("$20") = _tmp_20;	\ | |
| 308 | 	register long int _sc_21 __asm__("$21") = _tmp_21;	\ | |
| 309 | 	__asm__ __volatile__					\ | |
| 310 | 	 ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7 %8"		\ | |
| 311 | 	 : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16),		\ | |
| 312 | 	 "+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20),		\ | |
| 313 | 	 "+r"(_sc_21)					\ | |
| 314 | 	 : : internal_syscall_clobbers);			\ | |
| 315 | 	_sc_19 != 0 ? -_sc_0 : _sc_0;				\ | |
| 316 | }) | |
| 317 | #endif /* ASSEMBLER */ | |
| 318 | ||
| 319 | /* Pointer mangling support. Note that tls access is slow enough that | |
| 320 | we don't deoptimize things by placing the pointer check value there. */ | |
| 321 | ||
| 322 | #ifdef __ASSEMBLER__ | |
| 323 | # if IS_IN (rtld) | |
| 324 | # define PTR_MANGLE(dst, src, tmp)				\ | |
| 325 | 	ldah	tmp, __pointer_chk_guard_local($29) !gprelhigh;	\ | |
| 326 | 	ldq	tmp, __pointer_chk_guard_local(tmp) !gprellow;	\ | |
| 327 | 	xor	src, tmp, dst | |
| 328 | # define PTR_MANGLE2(dst, src, tmp)				\ | |
| 329 | 	xor	src, tmp, dst | |
| 330 | # elif defined SHARED | |
| 331 | # define PTR_MANGLE(dst, src, tmp)		\ | |
| 332 | 	ldq	tmp, __pointer_chk_guard;	\ | |
| 333 | 	xor	src, tmp, dst | |
| 334 | # else | |
| 335 | # define PTR_MANGLE(dst, src, tmp)		\ | |
| 336 | 	ldq	tmp, __pointer_chk_guard_local;	\ | |
| 337 | 	xor	src, tmp, dst | |
| 338 | # endif | |
| 339 | # define PTR_MANGLE2(dst, src, tmp)		\ | |
| 340 | 	xor	src, tmp, dst | |
| 341 | # define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp) | |
| 342 | # define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp) | |
| 343 | #else | |
| 344 | # include <stdint.h> | |
| 345 | # if (IS_IN (rtld) \ | |
| 346 | || (!defined SHARED && (IS_IN (libc) \ | |
| 347 | 			 || IS_IN (libpthread)))) | |
| 348 | extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; | |
| 349 | # define PTR_MANGLE(var) \ | |
| 350 | 	(var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local) | |
| 351 | # else | |
| 352 | extern uintptr_t __pointer_chk_guard attribute_relro; | |
| 353 | # define PTR_MANGLE(var) \ | |
| 354 | 	(var) = (__typeof(var)) ((uintptr_t) (var) ^ __pointer_chk_guard) | |
| 355 | # endif | |
| 356 | # define PTR_DEMANGLE(var) PTR_MANGLE(var) | |
| 357 | #endif /* ASSEMBLER */ | |
| 358 | ||
| 359 | #endif /* _LINUX_ALPHA_SYSDEP_H */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/arm/kernel-features.h+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | /* Set flags signalling availability of kernel features based on given |
| 2 | 2 | kernel version number. |
| 3 | Copyright (C) 2006-2020 Free Software Foundation, Inc. | |
| 3 | Copyright (C) 2006-2021 Free Software Foundation, Inc. | |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 | |
| 6 | 6 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/unix/sysv/linux/arm/sys/elf.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1996-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1996-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/unix/sysv/linux/arm/sysdep.h+7-34| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1992-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995. |
| 4 | 4 | ARM changes by Philip Blundell, <pjb27@cam.ac.uk>, May 1997. |
| ... | ... | @@ -29,11 +29,6 @@ |
| 29 | 29 | |
| 30 | 30 | #include <tls.h> |
| 31 | 31 | |
| 32 | /* In order to get __set_errno() definition in INLINE_SYSCALL. */ | |
| 33 | #ifndef __ASSEMBLER__ | |
| 34 | #include <errno.h> | |
| 35 | #endif | |
| 36 | ||
| 37 | 32 | /* For Linux we can use the system call table in the header file |
| 38 | 33 | 	/usr/include/asm/unistd.h |
| 39 | 34 | of the kernel. But these symbols do not follow the SYS_* syntax |
| ... | ... | @@ -317,21 +312,6 @@ __local_syscall_error:						\ |
| 317 | 312 | |
| 318 | 313 | #else /* not __ASSEMBLER__ */ |
| 319 | 314 | |
| 320 | /* Define a macro which expands into the inline wrapper code for a system | |
| 321 | call. */ | |
| 322 | #undef INLINE_SYSCALL | |
| 323 | #define INLINE_SYSCALL(name, nr, args...)				\ | |
| 324 | ({ unsigned int _sys_result = INTERNAL_SYSCALL (name, , nr, args);	\ | |
| 325 | if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))	\ | |
| 326 | {								\ | |
| 327 | 	 __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, ));		\ | |
| 328 | 	 _sys_result = (unsigned int) -1;				\ | |
| 329 | }								\ | |
| 330 | (int) _sys_result; }) | |
| 331 | ||
| 332 | #undef INTERNAL_SYSCALL_DECL | |
| 333 | #define INTERNAL_SYSCALL_DECL(err) do { } while (0) | |
| 334 | ||
| 335 | 315 | #if defined(__thumb__) |
| 336 | 316 | /* We can not expose the use of r7 to the compiler. GCC (as |
| 337 | 317 | of 4.5) uses r7 as the hard frame pointer for Thumb - although |
| ... | ... | @@ -348,7 +328,7 @@ __local_syscall_error:						\ |
| 348 | 328 | then unwinding will fail higher up the stack. So we move the |
| 349 | 329 | syscall out of line and provide its own unwind information. */ |
| 350 | 330 | # undef INTERNAL_SYSCALL_RAW |
| 351 | # define INTERNAL_SYSCALL_RAW(name, err, nr, args...)		\ | |
| 331 | # define INTERNAL_SYSCALL_RAW(name, nr, args...)		\ | |
| 352 | 332 | ({								\ |
| 353 | 333 | register int _a1 asm ("a1");				\ |
| 354 | 334 | int _nametmp = name;					\ |
| ... | ... | @@ -361,7 +341,7 @@ __local_syscall_error:						\ |
| 361 | 341 | _a1; }) |
| 362 | 342 | #else /* ARM */ |
| 363 | 343 | # undef INTERNAL_SYSCALL_RAW |
| 364 | # define INTERNAL_SYSCALL_RAW(name, err, nr, args...)		\ | |
| 344 | # define INTERNAL_SYSCALL_RAW(name, nr, args...)		\ | |
| 365 | 345 | ({								\ |
| 366 | 346 | register int _a1 asm ("r0"), _nr asm ("r7");		\ |
| 367 | 347 | LOAD_ARGS_##nr (args)					\ |
| ... | ... | @@ -374,15 +354,8 @@ __local_syscall_error:						\ |
| 374 | 354 | #endif |
| 375 | 355 | |
| 376 | 356 | #undef INTERNAL_SYSCALL |
| 377 | #define INTERNAL_SYSCALL(name, err, nr, args...)		\ | |
| 378 | 	INTERNAL_SYSCALL_RAW(SYS_ify(name), err, nr, args) | |
| 379 | ||
| 380 | #undef INTERNAL_SYSCALL_ERROR_P | |
| 381 | #define INTERNAL_SYSCALL_ERROR_P(val, err) \ | |
| 382 | ((unsigned int) (val) >= 0xfffff001u) | |
| 383 | ||
| 384 | #undef INTERNAL_SYSCALL_ERRNO | |
| 385 | #define INTERNAL_SYSCALL_ERRNO(val, err)	(-(val)) | |
| 357 | #define INTERNAL_SYSCALL(name, nr, args...)			\ | |
| 358 | 	INTERNAL_SYSCALL_RAW(SYS_ify(name), nr, args) | |
| 386 | 359 | |
| 387 | 360 | #define VDSO_NAME "LINUX_2.6" |
| 388 | 361 | #define VDSO_HASH 61765110 |
| ... | ... | @@ -434,8 +407,8 @@ __local_syscall_error:						\ |
| 434 | 407 | |
| 435 | 408 | /* For EABI, non-constant syscalls are actually pretty easy... */ |
| 436 | 409 | #undef INTERNAL_SYSCALL_NCS |
| 437 | #define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ | |
| 438 | INTERNAL_SYSCALL_RAW (number, err, nr, args) | |
| 410 | #define INTERNAL_SYSCALL_NCS(number, nr, args...) \ | |
| 411 | INTERNAL_SYSCALL_RAW (number, nr, args) | |
| 439 | 412 | |
| 440 | 413 | #define SINGLE_THREAD_BY_GLOBAL	1 |
| 441 | 414 |
lib/libc/glibc/sysdeps/unix/sysv/linux/bits/stat.h+2-114| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1992-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -22,119 +22,7 @@ |
| 22 | 22 | #ifndef _BITS_STAT_H |
| 23 | 23 | #define _BITS_STAT_H	1 |
| 24 | 24 | |
| 25 | /* Versions of the `struct stat' data structure. */ | |
| 26 | #define _STAT_VER_LINUX_OLD	1 | |
| 27 | #define _STAT_VER_KERNEL	1 | |
| 28 | #define _STAT_VER_SVR4		2 | |
| 29 | #define _STAT_VER_LINUX		3 | |
| 30 | #define _STAT_VER		_STAT_VER_LINUX	/* The one defined below. */ | |
| 31 | ||
| 32 | /* Versions of the `xmknod' interface. */ | |
| 33 | #define _MKNOD_VER_LINUX	1 | |
| 34 | #define _MKNOD_VER_SVR4		2 | |
| 35 | #define _MKNOD_VER		_MKNOD_VER_LINUX /* The bits defined below. */ | |
| 36 | ||
| 37 | ||
| 38 | struct stat | |
| 39 | { | |
| 40 | __dev_t st_dev;			/* Device. */ | |
| 41 | unsigned short int __pad1; | |
| 42 | #ifndef __USE_FILE_OFFSET64 | |
| 43 | __ino_t st_ino;			/* File serial number.	*/ | |
| 44 | #else | |
| 45 | __ino_t __st_ino;			/* 32bit file serial number.	*/ | |
| 46 | #endif | |
| 47 | __mode_t st_mode;			/* File mode. */ | |
| 48 | __nlink_t st_nlink;			/* Link count. */ | |
| 49 | __uid_t st_uid;			/* User ID of the file's owner.	*/ | |
| 50 | __gid_t st_gid;			/* Group ID of the file's group.*/ | |
| 51 | __dev_t st_rdev;			/* Device number, if device. */ | |
| 52 | unsigned short int __pad2; | |
| 53 | #ifndef __USE_FILE_OFFSET64 | |
| 54 | __off_t st_size;			/* Size of file, in bytes. */ | |
| 55 | #else | |
| 56 | __off64_t st_size;			/* Size of file, in bytes. */ | |
| 57 | #endif | |
| 58 | __blksize_t st_blksize;		/* Optimal block size for I/O. */ | |
| 59 | ||
| 60 | #ifndef __USE_FILE_OFFSET64 | |
| 61 | __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */ | |
| 62 | #else | |
| 63 | __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */ | |
| 64 | #endif | |
| 65 | #ifdef __USE_XOPEN2K8 | |
| 66 | /* Nanosecond resolution timestamps are stored in a format | |
| 67 | equivalent to 'struct timespec'. This is the type used | |
| 68 | whenever possible but the Unix namespace rules do not allow the | |
| 69 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 70 | Therefore we have to handle the use of this header in strictly | |
| 71 | standard-compliant sources special. */ | |
| 72 | struct timespec st_atim;		/* Time of last access. */ | |
| 73 | struct timespec st_mtim;		/* Time of last modification. */ | |
| 74 | struct timespec st_ctim;		/* Time of last status change. */ | |
| 75 | # define st_atime st_atim.tv_sec	/* Backward compatibility. */ | |
| 76 | # define st_mtime st_mtim.tv_sec | |
| 77 | # define st_ctime st_ctim.tv_sec | |
| 78 | #else | |
| 79 | __time_t st_atime;			/* Time of last access. */ | |
| 80 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 81 | __time_t st_mtime;			/* Time of last modification. */ | |
| 82 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 83 | __time_t st_ctime;			/* Time of last status change. */ | |
| 84 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 85 | #endif | |
| 86 | #ifndef __USE_FILE_OFFSET64 | |
| 87 | unsigned long int __glibc_reserved4; | |
| 88 | unsigned long int __glibc_reserved5; | |
| 89 | #else | |
| 90 | __ino64_t st_ino;			/* File serial number.	*/ | |
| 91 | #endif | |
| 92 | }; | |
| 93 | ||
| 94 | #ifdef __USE_LARGEFILE64 | |
| 95 | struct stat64 | |
| 96 | { | |
| 97 | __dev_t st_dev;			/* Device. */ | |
| 98 | unsigned int __pad1; | |
| 99 | ||
| 100 | __ino_t __st_ino;			/* 32bit file serial number.	*/ | |
| 101 | __mode_t st_mode;			/* File mode. */ | |
| 102 | __nlink_t st_nlink;			/* Link count. */ | |
| 103 | __uid_t st_uid;			/* User ID of the file's owner.	*/ | |
| 104 | __gid_t st_gid;			/* Group ID of the file's group.*/ | |
| 105 | __dev_t st_rdev;			/* Device number, if device. */ | |
| 106 | unsigned int __pad2; | |
| 107 | __off64_t st_size;			/* Size of file, in bytes. */ | |
| 108 | __blksize_t st_blksize;		/* Optimal block size for I/O. */ | |
| 109 | ||
| 110 | __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */ | |
| 111 | # ifdef __USE_XOPEN2K8 | |
| 112 | /* Nanosecond resolution timestamps are stored in a format | |
| 113 | equivalent to 'struct timespec'. This is the type used | |
| 114 | whenever possible but the Unix namespace rules do not allow the | |
| 115 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 116 | Therefore we have to handle the use of this header in strictly | |
| 117 | standard-compliant sources special. */ | |
| 118 | struct timespec st_atim;		/* Time of last access. */ | |
| 119 | struct timespec st_mtim;		/* Time of last modification. */ | |
| 120 | struct timespec st_ctim;		/* Time of last status change. */ | |
| 121 | # else | |
| 122 | __time_t st_atime;			/* Time of last access. */ | |
| 123 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 124 | __time_t st_mtime;			/* Time of last modification. */ | |
| 125 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 126 | __time_t st_ctime;			/* Time of last status change. */ | |
| 127 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 128 | # endif | |
| 129 | __ino64_t st_ino;			/* File serial number.		*/ | |
| 130 | }; | |
| 131 | #endif | |
| 132 | ||
| 133 | /* Tell code we have these members. */ | |
| 134 | #define	_STATBUF_ST_BLKSIZE | |
| 135 | #define _STATBUF_ST_RDEV | |
| 136 | /* Nanosecond resolution time values are supported. */ | |
| 137 | #define _STATBUF_ST_NSEC | |
| 25 | #include <bits/struct_stat.h> | |
| 138 | 26 | |
| 139 | 27 | /* Encoding of the file mode. */ |
| 140 | 28 |
lib/libc/glibc/sysdeps/unix/sysv/linux/bits/timex.h+32-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -25,6 +25,36 @@ |
| 25 | 25 | |
| 26 | 26 | struct timex |
| 27 | 27 | { |
| 28 | # ifdef __USE_TIME_BITS64 | |
| 29 | unsigned int modes; /* mode selector */ | |
| 30 | int :32; /* pad */ | |
| 31 | long long offset; /* time offset (usec) */ | |
| 32 | long long freq; /* frequency offset (scaled ppm) */ | |
| 33 | long long maxerror; /* maximum error (usec) */ | |
| 34 | long long esterror; /* estimated error (usec) */ | |
| 35 | int status; /* clock command/status */ | |
| 36 | int :32; /* pad */ | |
| 37 | long long constant; /* pll time constant */ | |
| 38 | long long precision; /* clock precision (usec) (read only) */ | |
| 39 | long long tolerance; /* clock frequency tolerance (ppm) (ro) */ | |
| 40 | struct timeval time; /* (read only, except for ADJ_SETOFFSET) */ | |
| 41 | long long tick; /* (modified) usecs between clock ticks */ | |
| 42 | long long ppsfreq; /* pps frequency (scaled ppm) (ro) */ | |
| 43 | long long jitter; /* pps jitter (us) (ro) */ | |
| 44 | int shift; /* interval duration (s) (shift) (ro) */ | |
| 45 | int :32; /* pad */ | |
| 46 | long long stabil; /* pps stability (scaled ppm) (ro) */ | |
| 47 | long long jitcnt; /* jitter limit exceeded (ro) */ | |
| 48 | long long calcnt; /* calibration intervals (ro) */ | |
| 49 | long long errcnt; /* calibration errors (ro) */ | |
| 50 | long long stbcnt; /* stability limit exceeded (ro) */ | |
| 51 | ||
| 52 | int tai; /* TAI offset (ro) */ | |
| 53 | ||
| 54 | int :32; int :32; int :32; int :32; | |
| 55 | int :32; int :32; int :32; int :32; | |
| 56 | int :32; int :32; int :32; | |
| 57 | # else | |
| 28 | 58 | unsigned int modes;		/* mode selector */ |
| 29 | 59 | __syscall_slong_t offset;	/* time offset (usec) */ |
| 30 | 60 | __syscall_slong_t freq;	/* frequency offset (scaled ppm) */ |
| ... | ... | @@ -51,6 +81,7 @@ struct timex |
| 51 | 81 | int :32; int :32; int :32; int :32; |
| 52 | 82 | int :32; int :32; int :32; int :32; |
| 53 | 83 | int :32; int :32; int :32; |
| 84 | # endif | |
| 54 | 85 | }; |
| 55 | 86 | |
| 56 | 87 | /* Mode codes (timex.mode) */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/dl-sysdep.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* System-specific settings for dynamic linker code. Linux version. |
| 2 | Copyright (C) 2005-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2005-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/unix/sysv/linux/generic/bits/stat.h deleted-174| ... | ... | @@ -1,174 +0,0 @@ |
| 1 | /* Copyright (C) 2011-2020 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library. If not, see | |
| 17 | <https://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #if !defined _SYS_STAT_H && !defined _FCNTL_H | |
| 20 | # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | #ifndef _BITS_STAT_H | |
| 24 | #define _BITS_STAT_H	1 | |
| 25 | ||
| 26 | #include <bits/endian.h> | |
| 27 | #include <bits/wordsize.h> | |
| 28 | ||
| 29 | /* 64-bit libc uses the kernel's 'struct stat', accessed via the | |
| 30 | stat() syscall; 32-bit libc uses the kernel's 'struct stat64' | |
| 31 | and accesses it via the stat64() syscall. All the various | |
| 32 | APIs offered by libc use the kernel shape for their struct stat | |
| 33 | structure; the only difference is that 32-bit programs not | |
| 34 | using __USE_FILE_OFFSET64 only see the low 32 bits of some | |
| 35 | of the fields (specifically st_ino, st_size, and st_blocks). */ | |
| 36 | #define _STAT_VER_KERNEL	0 | |
| 37 | #define _STAT_VER_LINUX		0 | |
| 38 | #define _STAT_VER		_STAT_VER_KERNEL | |
| 39 | ||
| 40 | /* Versions of the `xmknod' interface. */ | |
| 41 | #define _MKNOD_VER_LINUX	0 | |
| 42 | ||
| 43 | #if defined __USE_FILE_OFFSET64 | |
| 44 | # define __field64(type, type64, name) type64 name | |
| 45 | #elif __WORDSIZE == 64 || defined __INO_T_MATCHES_INO64_T | |
| 46 | # if defined __INO_T_MATCHES_INO64_T && !defined __OFF_T_MATCHES_OFF64_T | |
| 47 | # error "ino_t and off_t must both be the same type" | |
| 48 | # endif | |
| 49 | # define __field64(type, type64, name) type name | |
| 50 | #elif __BYTE_ORDER == __LITTLE_ENDIAN | |
| 51 | # define __field64(type, type64, name) \ | |
| 52 | type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad | |
| 53 | #else | |
| 54 | # define __field64(type, type64, name) \ | |
| 55 | int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name | |
| 56 | #endif | |
| 57 | ||
| 58 | struct stat | |
| 59 | { | |
| 60 | __dev_t st_dev;		/* Device. */ | |
| 61 | __field64(__ino_t, __ino64_t, st_ino); /* File serial number. */ | |
| 62 | __mode_t st_mode;		/* File mode. */ | |
| 63 | __nlink_t st_nlink;		/* Link count. */ | |
| 64 | __uid_t st_uid;		/* User ID of the file's owner.	*/ | |
| 65 | __gid_t st_gid;		/* Group ID of the file's group.*/ | |
| 66 | __dev_t st_rdev;		/* Device number, if device. */ | |
| 67 | __dev_t __pad1; | |
| 68 | __field64(__off_t, __off64_t, st_size); /* Size of file, in bytes. */ | |
| 69 | __blksize_t st_blksize;	/* Optimal block size for I/O. */ | |
| 70 | int __pad2; | |
| 71 | __field64(__blkcnt_t, __blkcnt64_t, st_blocks); /* 512-byte blocks */ | |
| 72 | #ifdef __USE_XOPEN2K8 | |
| 73 | /* Nanosecond resolution timestamps are stored in a format | |
| 74 | equivalent to 'struct timespec'. This is the type used | |
| 75 | whenever possible but the Unix namespace rules do not allow the | |
| 76 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 77 | Therefore we have to handle the use of this header in strictly | |
| 78 | standard-compliant sources special. */ | |
| 79 | struct timespec st_atim;		/* Time of last access. */ | |
| 80 | struct timespec st_mtim;		/* Time of last modification. */ | |
| 81 | struct timespec st_ctim;		/* Time of last status change. */ | |
| 82 | # define st_atime st_atim.tv_sec	/* Backward compatibility. */ | |
| 83 | # define st_mtime st_mtim.tv_sec | |
| 84 | # define st_ctime st_ctim.tv_sec | |
| 85 | #else | |
| 86 | __time_t st_atime;			/* Time of last access. */ | |
| 87 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 88 | __time_t st_mtime;			/* Time of last modification. */ | |
| 89 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 90 | __time_t st_ctime;			/* Time of last status change. */ | |
| 91 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 92 | #endif | |
| 93 | int __glibc_reserved[2]; | |
| 94 | }; | |
| 95 | ||
| 96 | #undef __field64 | |
| 97 | ||
| 98 | #ifdef __USE_LARGEFILE64 | |
| 99 | struct stat64 | |
| 100 | { | |
| 101 | __dev_t st_dev;		/* Device. */ | |
| 102 | __ino64_t st_ino;		/* File serial number.	*/ | |
| 103 | __mode_t st_mode;		/* File mode. */ | |
| 104 | __nlink_t st_nlink;		/* Link count. */ | |
| 105 | __uid_t st_uid;		/* User ID of the file's owner.	*/ | |
| 106 | __gid_t st_gid;		/* Group ID of the file's group.*/ | |
| 107 | __dev_t st_rdev;		/* Device number, if device. */ | |
| 108 | __dev_t __pad1; | |
| 109 | __off64_t st_size;		/* Size of file, in bytes. */ | |
| 110 | __blksize_t st_blksize;	/* Optimal block size for I/O. */ | |
| 111 | int __pad2; | |
| 112 | __blkcnt64_t st_blocks;	/* Nr. 512-byte blocks allocated. */ | |
| 113 | #ifdef __USE_XOPEN2K8 | |
| 114 | /* Nanosecond resolution timestamps are stored in a format | |
| 115 | equivalent to 'struct timespec'. This is the type used | |
| 116 | whenever possible but the Unix namespace rules do not allow the | |
| 117 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 118 | Therefore we have to handle the use of this header in strictly | |
| 119 | standard-compliant sources special. */ | |
| 120 | struct timespec st_atim;		/* Time of last access. */ | |
| 121 | struct timespec st_mtim;		/* Time of last modification. */ | |
| 122 | struct timespec st_ctim;		/* Time of last status change. */ | |
| 123 | #else | |
| 124 | __time_t st_atime;			/* Time of last access. */ | |
| 125 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 126 | __time_t st_mtime;			/* Time of last modification. */ | |
| 127 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 128 | __time_t st_ctime;			/* Time of last status change. */ | |
| 129 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 130 | #endif | |
| 131 | int __glibc_reserved[2]; | |
| 132 | }; | |
| 133 | #endif | |
| 134 | ||
| 135 | /* Tell code we have these members. */ | |
| 136 | #define	_STATBUF_ST_BLKSIZE | |
| 137 | #define _STATBUF_ST_RDEV | |
| 138 | /* Nanosecond resolution time values are supported. */ | |
| 139 | #define _STATBUF_ST_NSEC | |
| 140 | ||
| 141 | /* Encoding of the file mode. */ | |
| 142 | ||
| 143 | #define	__S_IFMT	0170000	/* These bits determine file type. */ | |
| 144 | ||
| 145 | /* File types. */ | |
| 146 | #define	__S_IFDIR	0040000	/* Directory. */ | |
| 147 | #define	__S_IFCHR	0020000	/* Character device. */ | |
| 148 | #define	__S_IFBLK	0060000	/* Block device. */ | |
| 149 | #define	__S_IFREG	0100000	/* Regular file. */ | |
| 150 | #define	__S_IFIFO	0010000	/* FIFO. */ | |
| 151 | #define	__S_IFLNK	0120000	/* Symbolic link. */ | |
| 152 | #define	__S_IFSOCK	0140000	/* Socket. */ | |
| 153 | ||
| 154 | /* POSIX.1b objects. Note that these macros always evaluate to zero. But | |
| 155 | they do it by enforcing the correct use of the macros. */ | |
| 156 | #define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 157 | #define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 158 | #define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 159 | ||
| 160 | /* Protection bits. */ | |
| 161 | ||
| 162 | #define	__S_ISUID	04000	/* Set user ID on execution. */ | |
| 163 | #define	__S_ISGID	02000	/* Set group ID on execution. */ | |
| 164 | #define	__S_ISVTX	01000	/* Save swapped text after use (sticky). */ | |
| 165 | #define	__S_IREAD	0400	/* Read by owner. */ | |
| 166 | #define	__S_IWRITE	0200	/* Write by owner. */ | |
| 167 | #define	__S_IEXEC	0100	/* Execute by owner. */ | |
| 168 | ||
| 169 | #ifdef __USE_ATFILE | |
| 170 | # define UTIME_NOW	((1l << 30) - 1l) | |
| 171 | # define UTIME_OMIT	((1l << 30) - 2l) | |
| 172 | #endif | |
| 173 | ||
| 174 | #endif /* bits/stat.h */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/generic/bits/typesizes.h+30-10| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* bits/typesizes.h -- underlying types for *_t. For the generic Linux ABI. |
| 2 | Copyright (C) 2011-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2011-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011. |
| 5 | 5 | |
| ... | ... | @@ -26,31 +26,45 @@ |
| 26 | 26 | |
| 27 | 27 | /* See <bits/types.h> for the meaning of these macros. This file exists so |
| 28 | 28 | that <bits/types.h> need not vary across different GNU platforms. */ |
| 29 | #if __TIMESIZE == 64 && __WORDSIZE == 32 | |
| 30 | /* These are the "new" y2038 types defined for architectures added after | |
| 31 | the 5.1 kernel. */ | |
| 32 | # define __INO_T_TYPE		__UQUAD_TYPE | |
| 33 | # define __OFF_T_TYPE		__SQUAD_TYPE | |
| 34 | # define __RLIM_T_TYPE		__UQUAD_TYPE | |
| 35 | # define __BLKCNT_T_TYPE	__SQUAD_TYPE | |
| 36 | # define __FSBLKCNT_T_TYPE	__UQUAD_TYPE | |
| 37 | # define __FSFILCNT_T_TYPE	__UQUAD_TYPE | |
| 38 | # define __TIME_T_TYPE		__SQUAD_TYPE | |
| 39 | # define __SUSECONDS_T_TYPE	__SQUAD_TYPE | |
| 40 | #else | |
| 41 | # define __INO_T_TYPE		__ULONGWORD_TYPE | |
| 42 | # define __OFF_T_TYPE		__SLONGWORD_TYPE | |
| 43 | # define __RLIM_T_TYPE		__ULONGWORD_TYPE | |
| 44 | # define __BLKCNT_T_TYPE	__SLONGWORD_TYPE | |
| 45 | # define __FSBLKCNT_T_TYPE	__ULONGWORD_TYPE | |
| 46 | # define __FSFILCNT_T_TYPE	__ULONGWORD_TYPE | |
| 47 | # define __TIME_T_TYPE		__SLONGWORD_TYPE | |
| 48 | # define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE | |
| 49 | #endif | |
| 29 | 50 | |
| 30 | 51 | #define __DEV_T_TYPE		__UQUAD_TYPE |
| 31 | 52 | #define __UID_T_TYPE		__U32_TYPE |
| 32 | 53 | #define __GID_T_TYPE		__U32_TYPE |
| 33 | #define __INO_T_TYPE		__ULONGWORD_TYPE | |
| 34 | 54 | #define __INO64_T_TYPE		__UQUAD_TYPE |
| 35 | 55 | #define __MODE_T_TYPE		__U32_TYPE |
| 36 | 56 | #define __NLINK_T_TYPE		__U32_TYPE |
| 37 | #define __OFF_T_TYPE		__SLONGWORD_TYPE | |
| 38 | 57 | #define __OFF64_T_TYPE		__SQUAD_TYPE |
| 39 | 58 | #define __PID_T_TYPE		__S32_TYPE |
| 40 | #define __RLIM_T_TYPE		__ULONGWORD_TYPE | |
| 41 | 59 | #define __RLIM64_T_TYPE		__UQUAD_TYPE |
| 42 | #define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE | |
| 43 | 60 | #define	__BLKCNT64_T_TYPE	__SQUAD_TYPE |
| 44 | #define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE | |
| 45 | 61 | #define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE |
| 46 | #define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE | |
| 47 | 62 | #define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE |
| 48 | 63 | #define	__FSWORD_T_TYPE		__SWORD_TYPE |
| 49 | 64 | #define	__ID_T_TYPE		__U32_TYPE |
| 50 | 65 | #define __CLOCK_T_TYPE		__SLONGWORD_TYPE |
| 51 | #define __TIME_T_TYPE		__SLONGWORD_TYPE | |
| 52 | 66 | #define __USECONDS_T_TYPE	__U32_TYPE |
| 53 | #define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE | |
| 67 | #define __SUSECONDS64_T_TYPE	__SQUAD_TYPE | |
| 54 | 68 | #define __DADDR_T_TYPE		__S32_TYPE |
| 55 | 69 | #define __KEY_T_TYPE		__S32_TYPE |
| 56 | 70 | #define __CLOCKID_T_TYPE	__S32_TYPE |
| ... | ... | @@ -62,7 +76,7 @@ |
| 62 | 76 | #define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE |
| 63 | 77 | #define __CPU_MASK_TYPE 	__ULONGWORD_TYPE |
| 64 | 78 | |
| 65 | #ifdef __LP64__ | |
| 79 | #if defined __LP64__ || (__TIMESIZE == 64 && __WORDSIZE == 32) | |
| 66 | 80 | /* Tell the libc code that off_t and off64_t are actually the same type |
| 67 | 81 | for all ABI purposes, even if possibly expressed as different base types |
| 68 | 82 | for C type-checking purposes. */ |
| ... | ... | @@ -76,11 +90,17 @@ |
| 76 | 90 | |
| 77 | 91 | /* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ |
| 78 | 92 | # define __STATFS_MATCHES_STATFS64 1 |
| 93 | ||
| 94 | /* And for getitimer, setitimer and rusage */ | |
| 95 | # define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 (__WORDSIZE == 64) | |
| 79 | 96 | #else |
| 80 | 97 | # define __RLIM_T_MATCHES_RLIM64_T	0 |
| 81 | 98 | |
| 82 | 99 | # define __STATFS_MATCHES_STATFS64 0 |
| 100 | ||
| 101 | # define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0 | |
| 83 | 102 | #endif |
| 103 | ||
| 84 | 104 | /* Number of descriptors that can fit in an `fd_set'. */ |
| 85 | 105 | #define	__FD_SETSIZE		1024 |
| 86 | 106 |
lib/libc/glibc/sysdeps/unix/sysv/linux/generic/sysdep.h+1-9| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 2011-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 2011-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011. |
| 4 | 4 | |
| ... | ... | @@ -25,11 +25,3 @@ |
| 25 | 25 | #ifdef __NR_llseek |
| 26 | 26 | # define __NR__llseek __NR_llseek |
| 27 | 27 | #endif |
| 28 | ||
| 29 | #if __WORDSIZE == 64 | |
| 30 | /* By defining the older names, glibc will build syscall wrappers for | |
| 31 | both pread and pread64; sysdeps/unix/sysv/linux/wordsize-64/pread64.c | |
| 32 | will suppress generating any separate code for pread64.c. */ | |
| 33 | #define __NR_pread __NR_pread64 | |
| 34 | #define __NR_pwrite __NR_pwrite64 | |
| 35 | #endif |
lib/libc/glibc/sysdeps/unix/sysv/linux/generic/xstatver.h created+10| ... | ... | @@ -0,0 +1,10 @@ |
| 1 | /* Versions of the 'struct stat' data structure used in compatibility xstat | |
| 2 | functions. */ | |
| 3 | #define _STAT_VER_KERNEL	0 | |
| 4 | #define _STAT_VER_LINUX		0 | |
| 5 | #define _STAT_VER		_STAT_VER_KERNEL | |
| 6 | ||
| 7 | /* Versions of the 'xmknod' interface used in compatibility xmknod | |
| 8 | functions. */ | |
| 9 | #define _MKNOD_VER_LINUX	0 | |
| 10 | #define _MKNOD_VER		_MKNOD_VER_LINUX |
lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/kernel-features.h+1-6| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | /* Set flags signalling availability of kernel features based on given |
| 2 | 2 | kernel version number. |
| 3 | Copyright (C) 2006-2020 Free Software Foundation, Inc. | |
| 3 | Copyright (C) 2006-2021 Free Software Foundation, Inc. | |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 | |
| 6 | 6 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -18,11 +18,6 @@ |
| 18 | 18 | <https://www.gnu.org/licenses/>. */ |
| 19 | 19 | |
| 20 | 20 | |
| 21 | /* Support for the utimes syscall was added in 3.14. */ | |
| 22 | #if __LINUX_KERNEL_VERSION >= 0x030e00 | |
| 23 | # define __ASSUME_UTIMES		1 | |
| 24 | #endif | |
| 25 | ||
| 26 | 21 | #include_next <kernel-features.h> |
| 27 | 22 | |
| 28 | 23 | #define __ASSUME_RECV_SYSCALL 1 |
lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/pthread.h deleted-1174| ... | ... | @@ -1,1174 +0,0 @@ |
| 1 | /* Copyright (C) 2002-2019 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library; if not, see | |
| 16 | <http://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | #ifndef _PTHREAD_H | |
| 19 | #define _PTHREAD_H	1 | |
| 20 | ||
| 21 | #include <features.h> | |
| 22 | #include <endian.h> | |
| 23 | #include <sched.h> | |
| 24 | #include <time.h> | |
| 25 | ||
| 26 | #include <bits/pthreadtypes.h> | |
| 27 | #include <bits/setjmp.h> | |
| 28 | #include <bits/wordsize.h> | |
| 29 | #include <bits/types/struct_timespec.h> | |
| 30 | ||
| 31 | ||
| 32 | /* Detach state. */ | |
| 33 | enum | |
| 34 | { | |
| 35 | PTHREAD_CREATE_JOINABLE, | |
| 36 | #define PTHREAD_CREATE_JOINABLE	PTHREAD_CREATE_JOINABLE | |
| 37 | PTHREAD_CREATE_DETACHED | |
| 38 | #define PTHREAD_CREATE_DETACHED	PTHREAD_CREATE_DETACHED | |
| 39 | }; | |
| 40 | ||
| 41 | ||
| 42 | /* Mutex types. */ | |
| 43 | enum | |
| 44 | { | |
| 45 | PTHREAD_MUTEX_TIMED_NP, | |
| 46 | PTHREAD_MUTEX_RECURSIVE_NP, | |
| 47 | PTHREAD_MUTEX_ERRORCHECK_NP, | |
| 48 | PTHREAD_MUTEX_ADAPTIVE_NP | |
| 49 | #if defined __USE_UNIX98 || defined __USE_XOPEN2K8 | |
| 50 | , | |
| 51 | PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP, | |
| 52 | PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP, | |
| 53 | PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP, | |
| 54 | PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL | |
| 55 | #endif | |
| 56 | #ifdef __USE_GNU | |
| 57 | /* For compatibility. */ | |
| 58 | , PTHREAD_MUTEX_FAST_NP = PTHREAD_MUTEX_TIMED_NP | |
| 59 | #endif | |
| 60 | }; | |
| 61 | ||
| 62 | ||
| 63 | #ifdef __USE_XOPEN2K | |
| 64 | /* Robust mutex or not flags. */ | |
| 65 | enum | |
| 66 | { | |
| 67 | PTHREAD_MUTEX_STALLED, | |
| 68 | PTHREAD_MUTEX_STALLED_NP = PTHREAD_MUTEX_STALLED, | |
| 69 | PTHREAD_MUTEX_ROBUST, | |
| 70 | PTHREAD_MUTEX_ROBUST_NP = PTHREAD_MUTEX_ROBUST | |
| 71 | }; | |
| 72 | #endif | |
| 73 | ||
| 74 | ||
| 75 | #if defined __USE_POSIX199506 || defined __USE_UNIX98 | |
| 76 | /* Mutex protocols. */ | |
| 77 | enum | |
| 78 | { | |
| 79 | PTHREAD_PRIO_NONE, | |
| 80 | PTHREAD_PRIO_INHERIT, | |
| 81 | PTHREAD_PRIO_PROTECT | |
| 82 | }; | |
| 83 | #endif | |
| 84 | ||
| 85 | ||
| 86 | #define PTHREAD_MUTEX_INITIALIZER \ | |
| 87 | { { 0, 0, 0, 0, { 0, 0, 0, 0 }, 0, { __PTHREAD_SPINS }, { 0, 0 } } } | |
| 88 | #ifdef __USE_GNU | |
| 89 | # define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \ | |
| 90 | { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, { 0, 0, 0, 0 }, 0, \ | |
| 91 | { __PTHREAD_SPINS }, { 0, 0 } } } | |
| 92 | # define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \ | |
| 93 | { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, { 0, 0, 0, 0 }, 0, \ | |
| 94 | { __PTHREAD_SPINS }, { 0, 0 } } } | |
| 95 | # define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \ | |
| 96 | { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, { 0, 0, 0, 0 }, 0, \ | |
| 97 | { __PTHREAD_SPINS }, { 0, 0 } } } | |
| 98 | #endif | |
| 99 | ||
| 100 | ||
| 101 | /* Read-write lock types. */ | |
| 102 | #if defined __USE_UNIX98 || defined __USE_XOPEN2K | |
| 103 | enum | |
| 104 | { | |
| 105 | PTHREAD_RWLOCK_PREFER_READER_NP, | |
| 106 | PTHREAD_RWLOCK_PREFER_WRITER_NP, | |
| 107 | PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, | |
| 108 | PTHREAD_RWLOCK_DEFAULT_NP = PTHREAD_RWLOCK_PREFER_READER_NP | |
| 109 | }; | |
| 110 | ||
| 111 | /* Define __PTHREAD_RWLOCK_INT_FLAGS_SHARED to 1 if pthread_rwlock_t | |
| 112 | has the shared field. All 64-bit architectures have the shared field | |
| 113 | in pthread_rwlock_t. */ | |
| 114 | #ifndef __PTHREAD_RWLOCK_INT_FLAGS_SHARED | |
| 115 | # if __WORDSIZE == 64 | |
| 116 | # define __PTHREAD_RWLOCK_INT_FLAGS_SHARED 1 | |
| 117 | # endif | |
| 118 | #endif | |
| 119 | ||
| 120 | ||
| 121 | /* Read-write lock initializers. */ | |
| 122 | # define PTHREAD_RWLOCK_INITIALIZER \ | |
| 123 | { { { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } | |
| 124 | # ifdef __USE_GNU | |
| 125 | # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \ | |
| 126 | { { { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ | |
| 127 | PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, 0, 0, 0 } } | |
| 128 | # endif | |
| 129 | #endif /* Unix98 or XOpen2K */ | |
| 130 | ||
| 131 | ||
| 132 | /* Scheduler inheritance. */ | |
| 133 | enum | |
| 134 | { | |
| 135 | PTHREAD_INHERIT_SCHED, | |
| 136 | #define PTHREAD_INHERIT_SCHED PTHREAD_INHERIT_SCHED | |
| 137 | PTHREAD_EXPLICIT_SCHED | |
| 138 | #define PTHREAD_EXPLICIT_SCHED PTHREAD_EXPLICIT_SCHED | |
| 139 | }; | |
| 140 | ||
| 141 | ||
| 142 | /* Scope handling. */ | |
| 143 | enum | |
| 144 | { | |
| 145 | PTHREAD_SCOPE_SYSTEM, | |
| 146 | #define PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_SYSTEM | |
| 147 | PTHREAD_SCOPE_PROCESS | |
| 148 | #define PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_PROCESS | |
| 149 | }; | |
| 150 | ||
| 151 | ||
| 152 | /* Process shared or private flag. */ | |
| 153 | enum | |
| 154 | { | |
| 155 | PTHREAD_PROCESS_PRIVATE, | |
| 156 | #define PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE | |
| 157 | PTHREAD_PROCESS_SHARED | |
| 158 | #define PTHREAD_PROCESS_SHARED PTHREAD_PROCESS_SHARED | |
| 159 | }; | |
| 160 | ||
| 161 | ||
| 162 | /* Conditional variable handling. */ | |
| 163 | #define PTHREAD_COND_INITIALIZER { { {0}, {0}, {0, 0}, {0, 0}, 0, 0, {0, 0} } } | |
| 164 | ||
| 165 | ||
| 166 | /* Cleanup buffers */ | |
| 167 | struct _pthread_cleanup_buffer | |
| 168 | { | |
| 169 | void (*__routine) (void *); /* Function to call. */ | |
| 170 | void *__arg; /* Its argument. */ | |
| 171 | int __canceltype; /* Saved cancellation type. */ | |
| 172 | struct _pthread_cleanup_buffer *__prev; /* Chaining of cleanup functions. */ | |
| 173 | }; | |
| 174 | ||
| 175 | /* Cancellation */ | |
| 176 | enum | |
| 177 | { | |
| 178 | PTHREAD_CANCEL_ENABLE, | |
| 179 | #define PTHREAD_CANCEL_ENABLE PTHREAD_CANCEL_ENABLE | |
| 180 | PTHREAD_CANCEL_DISABLE | |
| 181 | #define PTHREAD_CANCEL_DISABLE PTHREAD_CANCEL_DISABLE | |
| 182 | }; | |
| 183 | enum | |
| 184 | { | |
| 185 | PTHREAD_CANCEL_DEFERRED, | |
| 186 | #define PTHREAD_CANCEL_DEFERRED	PTHREAD_CANCEL_DEFERRED | |
| 187 | PTHREAD_CANCEL_ASYNCHRONOUS | |
| 188 | #define PTHREAD_CANCEL_ASYNCHRONOUS	PTHREAD_CANCEL_ASYNCHRONOUS | |
| 189 | }; | |
| 190 | #define PTHREAD_CANCELED ((void *) -1) | |
| 191 | ||
| 192 | ||
| 193 | /* Single execution handling. */ | |
| 194 | #define PTHREAD_ONCE_INIT 0 | |
| 195 | ||
| 196 | ||
| 197 | #ifdef __USE_XOPEN2K | |
| 198 | /* Value returned by 'pthread_barrier_wait' for one of the threads after | |
| 199 | the required number of threads have called this function. | |
| 200 | -1 is distinct from 0 and all errno constants */ | |
| 201 | # define PTHREAD_BARRIER_SERIAL_THREAD -1 | |
| 202 | #endif | |
| 203 | ||
| 204 | ||
| 205 | __BEGIN_DECLS | |
| 206 | ||
| 207 | /* Create a new thread, starting with execution of START-ROUTINE | |
| 208 | getting passed ARG. Creation attributed come from ATTR. The new | |
| 209 | handle is stored in *NEWTHREAD. */ | |
| 210 | extern int pthread_create (pthread_t *__restrict __newthread, | |
| 211 | 			 const pthread_attr_t *__restrict __attr, | |
| 212 | 			 void *(*__start_routine) (void *), | |
| 213 | 			 void *__restrict __arg) __THROWNL __nonnull ((1, 3)); | |
| 214 | ||
| 215 | /* Terminate calling thread. | |
| 216 | ||
| 217 | The registered cleanup handlers are called via exception handling | |
| 218 | so we cannot mark this function with __THROW.*/ | |
| 219 | extern void pthread_exit (void *__retval) __attribute__ ((__noreturn__)); | |
| 220 | ||
| 221 | /* Make calling thread wait for termination of the thread TH. The | |
| 222 | exit status of the thread is stored in *THREAD_RETURN, if THREAD_RETURN | |
| 223 | is not NULL. | |
| 224 | ||
| 225 | This function is a cancellation point and therefore not marked with | |
| 226 | __THROW. */ | |
| 227 | extern int pthread_join (pthread_t __th, void **__thread_return); | |
| 228 | ||
| 229 | #ifdef __USE_GNU | |
| 230 | /* Check whether thread TH has terminated. If yes return the status of | |
| 231 | the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL. */ | |
| 232 | extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW; | |
| 233 | ||
| 234 | /* Make calling thread wait for termination of the thread TH, but only | |
| 235 | until TIMEOUT. The exit status of the thread is stored in | |
| 236 | *THREAD_RETURN, if THREAD_RETURN is not NULL. | |
| 237 | ||
| 238 | This function is a cancellation point and therefore not marked with | |
| 239 | __THROW. */ | |
| 240 | extern int pthread_timedjoin_np (pthread_t __th, void **__thread_return, | |
| 241 | 				 const struct timespec *__abstime); | |
| 242 | #endif | |
| 243 | ||
| 244 | /* Indicate that the thread TH is never to be joined with PTHREAD_JOIN. | |
| 245 | The resources of TH will therefore be freed immediately when it | |
| 246 | terminates, instead of waiting for another thread to perform PTHREAD_JOIN | |
| 247 | on it. */ | |
| 248 | extern int pthread_detach (pthread_t __th) __THROW; | |
| 249 | ||
| 250 | ||
| 251 | /* Obtain the identifier of the current thread. */ | |
| 252 | extern pthread_t pthread_self (void) __THROW __attribute__ ((__const__)); | |
| 253 | ||
| 254 | /* Compare two thread identifiers. */ | |
| 255 | extern int pthread_equal (pthread_t __thread1, pthread_t __thread2) | |
| 256 | __THROW __attribute__ ((__const__)); | |
| 257 | ||
| 258 | ||
| 259 | /* Thread attribute handling. */ | |
| 260 | ||
| 261 | /* Initialize thread attribute *ATTR with default attributes | |
| 262 | (detachstate is PTHREAD_JOINABLE, scheduling policy is SCHED_OTHER, | |
| 263 | no user-provided stack). */ | |
| 264 | extern int pthread_attr_init (pthread_attr_t *__attr) __THROW __nonnull ((1)); | |
| 265 | ||
| 266 | /* Destroy thread attribute *ATTR. */ | |
| 267 | extern int pthread_attr_destroy (pthread_attr_t *__attr) | |
| 268 | __THROW __nonnull ((1)); | |
| 269 | ||
| 270 | /* Get detach state attribute. */ | |
| 271 | extern int pthread_attr_getdetachstate (const pthread_attr_t *__attr, | |
| 272 | 					int *__detachstate) | |
| 273 | __THROW __nonnull ((1, 2)); | |
| 274 | ||
| 275 | /* Set detach state attribute. */ | |
| 276 | extern int pthread_attr_setdetachstate (pthread_attr_t *__attr, | |
| 277 | 					int __detachstate) | |
| 278 | __THROW __nonnull ((1)); | |
| 279 | ||
| 280 | ||
| 281 | /* Get the size of the guard area created for stack overflow protection. */ | |
| 282 | extern int pthread_attr_getguardsize (const pthread_attr_t *__attr, | |
| 283 | 				 size_t *__guardsize) | |
| 284 | __THROW __nonnull ((1, 2)); | |
| 285 | ||
| 286 | /* Set the size of the guard area created for stack overflow protection. */ | |
| 287 | extern int pthread_attr_setguardsize (pthread_attr_t *__attr, | |
| 288 | 				 size_t __guardsize) | |
| 289 | __THROW __nonnull ((1)); | |
| 290 | ||
| 291 | ||
| 292 | /* Return in *PARAM the scheduling parameters of *ATTR. */ | |
| 293 | extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict __attr, | |
| 294 | 				 struct sched_param *__restrict __param) | |
| 295 | __THROW __nonnull ((1, 2)); | |
| 296 | ||
| 297 | /* Set scheduling parameters (priority, etc) in *ATTR according to PARAM. */ | |
| 298 | extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr, | |
| 299 | 				 const struct sched_param *__restrict | |
| 300 | 				 __param) __THROW __nonnull ((1, 2)); | |
| 301 | ||
| 302 | /* Return in *POLICY the scheduling policy of *ATTR. */ | |
| 303 | extern int pthread_attr_getschedpolicy (const pthread_attr_t *__restrict | |
| 304 | 					__attr, int *__restrict __policy) | |
| 305 | __THROW __nonnull ((1, 2)); | |
| 306 | ||
| 307 | /* Set scheduling policy in *ATTR according to POLICY. */ | |
| 308 | extern int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy) | |
| 309 | __THROW __nonnull ((1)); | |
| 310 | ||
| 311 | /* Return in *INHERIT the scheduling inheritance mode of *ATTR. */ | |
| 312 | extern int pthread_attr_getinheritsched (const pthread_attr_t *__restrict | |
| 313 | 					 __attr, int *__restrict __inherit) | |
| 314 | __THROW __nonnull ((1, 2)); | |
| 315 | ||
| 316 | /* Set scheduling inheritance mode in *ATTR according to INHERIT. */ | |
| 317 | extern int pthread_attr_setinheritsched (pthread_attr_t *__attr, | |
| 318 | 					 int __inherit) | |
| 319 | __THROW __nonnull ((1)); | |
| 320 | ||
| 321 | ||
| 322 | /* Return in *SCOPE the scheduling contention scope of *ATTR. */ | |
| 323 | extern int pthread_attr_getscope (const pthread_attr_t *__restrict __attr, | |
| 324 | 				 int *__restrict __scope) | |
| 325 | __THROW __nonnull ((1, 2)); | |
| 326 | ||
| 327 | /* Set scheduling contention scope in *ATTR according to SCOPE. */ | |
| 328 | extern int pthread_attr_setscope (pthread_attr_t *__attr, int __scope) | |
| 329 | __THROW __nonnull ((1)); | |
| 330 | ||
| 331 | /* Return the previously set address for the stack. */ | |
| 332 | extern int pthread_attr_getstackaddr (const pthread_attr_t *__restrict | |
| 333 | 				 __attr, void **__restrict __stackaddr) | |
| 334 | __THROW __nonnull ((1, 2)) __attribute_deprecated__; | |
| 335 | ||
| 336 | /* Set the starting address of the stack of the thread to be created. | |
| 337 | Depending on whether the stack grows up or down the value must either | |
| 338 | be higher or lower than all the address in the memory block. The | |
| 339 | minimal size of the block must be PTHREAD_STACK_MIN. */ | |
| 340 | extern int pthread_attr_setstackaddr (pthread_attr_t *__attr, | |
| 341 | 				 void *__stackaddr) | |
| 342 | __THROW __nonnull ((1)) __attribute_deprecated__; | |
| 343 | ||
| 344 | /* Return the currently used minimal stack size. */ | |
| 345 | extern int pthread_attr_getstacksize (const pthread_attr_t *__restrict | |
| 346 | 				 __attr, size_t *__restrict __stacksize) | |
| 347 | __THROW __nonnull ((1, 2)); | |
| 348 | ||
| 349 | /* Add information about the minimum stack size needed for the thread | |
| 350 | to be started. This size must never be less than PTHREAD_STACK_MIN | |
| 351 | and must also not exceed the system limits. */ | |
| 352 | extern int pthread_attr_setstacksize (pthread_attr_t *__attr, | |
| 353 | 				 size_t __stacksize) | |
| 354 | __THROW __nonnull ((1)); | |
| 355 | ||
| 356 | #ifdef __USE_XOPEN2K | |
| 357 | /* Return the previously set address for the stack. */ | |
| 358 | extern int pthread_attr_getstack (const pthread_attr_t *__restrict __attr, | |
| 359 | 				 void **__restrict __stackaddr, | |
| 360 | 				 size_t *__restrict __stacksize) | |
| 361 | __THROW __nonnull ((1, 2, 3)); | |
| 362 | ||
| 363 | /* The following two interfaces are intended to replace the last two. They | |
| 364 | require setting the address as well as the size since only setting the | |
| 365 | address will make the implementation on some architectures impossible. */ | |
| 366 | extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr, | |
| 367 | 				 size_t __stacksize) __THROW __nonnull ((1)); | |
| 368 | #endif | |
| 369 | ||
| 370 | #ifdef __USE_GNU | |
| 371 | /* Thread created with attribute ATTR will be limited to run only on | |
| 372 | the processors represented in CPUSET. */ | |
| 373 | extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr, | |
| 374 | 					size_t __cpusetsize, | |
| 375 | 					const cpu_set_t *__cpuset) | |
| 376 | __THROW __nonnull ((1, 3)); | |
| 377 | ||
| 378 | /* Get bit set in CPUSET representing the processors threads created with | |
| 379 | ATTR can run on. */ | |
| 380 | extern int pthread_attr_getaffinity_np (const pthread_attr_t *__attr, | |
| 381 | 					size_t __cpusetsize, | |
| 382 | 					cpu_set_t *__cpuset) | |
| 383 | __THROW __nonnull ((1, 3)); | |
| 384 | ||
| 385 | /* Get the default attributes used by pthread_create in this process. */ | |
| 386 | extern int pthread_getattr_default_np (pthread_attr_t *__attr) | |
| 387 | __THROW __nonnull ((1)); | |
| 388 | ||
| 389 | /* Set the default attributes to be used by pthread_create in this | |
| 390 | process. */ | |
| 391 | extern int pthread_setattr_default_np (const pthread_attr_t *__attr) | |
| 392 | __THROW __nonnull ((1)); | |
| 393 | ||
| 394 | /* Initialize thread attribute *ATTR with attributes corresponding to the | |
| 395 | already running thread TH. It shall be called on uninitialized ATTR | |
| 396 | and destroyed with pthread_attr_destroy when no longer needed. */ | |
| 397 | extern int pthread_getattr_np (pthread_t __th, pthread_attr_t *__attr) | |
| 398 | __THROW __nonnull ((2)); | |
| 399 | #endif | |
| 400 | ||
| 401 | ||
| 402 | /* Functions for scheduling control. */ | |
| 403 | ||
| 404 | /* Set the scheduling parameters for TARGET_THREAD according to POLICY | |
| 405 | and *PARAM. */ | |
| 406 | extern int pthread_setschedparam (pthread_t __target_thread, int __policy, | |
| 407 | 				 const struct sched_param *__param) | |
| 408 | __THROW __nonnull ((3)); | |
| 409 | ||
| 410 | /* Return in *POLICY and *PARAM the scheduling parameters for TARGET_THREAD. */ | |
| 411 | extern int pthread_getschedparam (pthread_t __target_thread, | |
| 412 | 				 int *__restrict __policy, | |
| 413 | 				 struct sched_param *__restrict __param) | |
| 414 | __THROW __nonnull ((2, 3)); | |
| 415 | ||
| 416 | /* Set the scheduling priority for TARGET_THREAD. */ | |
| 417 | extern int pthread_setschedprio (pthread_t __target_thread, int __prio) | |
| 418 | __THROW; | |
| 419 | ||
| 420 | ||
| 421 | #ifdef __USE_GNU | |
| 422 | /* Get thread name visible in the kernel and its interfaces. */ | |
| 423 | extern int pthread_getname_np (pthread_t __target_thread, char *__buf, | |
| 424 | 			 size_t __buflen) | |
| 425 | __THROW __nonnull ((2)); | |
| 426 | ||
| 427 | /* Set thread name visible in the kernel and its interfaces. */ | |
| 428 | extern int pthread_setname_np (pthread_t __target_thread, const char *__name) | |
| 429 | __THROW __nonnull ((2)); | |
| 430 | #endif | |
| 431 | ||
| 432 | ||
| 433 | #ifdef __USE_UNIX98 | |
| 434 | /* Determine level of concurrency. */ | |
| 435 | extern int pthread_getconcurrency (void) __THROW; | |
| 436 | ||
| 437 | /* Set new concurrency level to LEVEL. */ | |
| 438 | extern int pthread_setconcurrency (int __level) __THROW; | |
| 439 | #endif | |
| 440 | ||
| 441 | #ifdef __USE_GNU | |
| 442 | /* Yield the processor to another thread or process. | |
| 443 | This function is similar to the POSIX `sched_yield' function but | |
| 444 | might be differently implemented in the case of a m-on-n thread | |
| 445 | implementation. */ | |
| 446 | extern int pthread_yield (void) __THROW; | |
| 447 | ||
| 448 | ||
| 449 | /* Limit specified thread TH to run only on the processors represented | |
| 450 | in CPUSET. */ | |
| 451 | extern int pthread_setaffinity_np (pthread_t __th, size_t __cpusetsize, | |
| 452 | 				 const cpu_set_t *__cpuset) | |
| 453 | __THROW __nonnull ((3)); | |
| 454 | ||
| 455 | /* Get bit set in CPUSET representing the processors TH can run on. */ | |
| 456 | extern int pthread_getaffinity_np (pthread_t __th, size_t __cpusetsize, | |
| 457 | 				 cpu_set_t *__cpuset) | |
| 458 | __THROW __nonnull ((3)); | |
| 459 | #endif | |
| 460 | ||
| 461 | ||
| 462 | /* Functions for handling initialization. */ | |
| 463 | ||
| 464 | /* Guarantee that the initialization function INIT_ROUTINE will be called | |
| 465 | only once, even if pthread_once is executed several times with the | |
| 466 | same ONCE_CONTROL argument. ONCE_CONTROL must point to a static or | |
| 467 | extern variable initialized to PTHREAD_ONCE_INIT. | |
| 468 | ||
| 469 | The initialization functions might throw exception which is why | |
| 470 | this function is not marked with __THROW. */ | |
| 471 | extern int pthread_once (pthread_once_t *__once_control, | |
| 472 | 			 void (*__init_routine) (void)) __nonnull ((1, 2)); | |
| 473 | ||
| 474 | ||
| 475 | /* Functions for handling cancellation. | |
| 476 | ||
| 477 | Note that these functions are explicitly not marked to not throw an | |
| 478 | exception in C++ code. If cancellation is implemented by unwinding | |
| 479 | this is necessary to have the compiler generate the unwind information. */ | |
| 480 | ||
| 481 | /* Set cancelability state of current thread to STATE, returning old | |
| 482 | state in *OLDSTATE if OLDSTATE is not NULL. */ | |
| 483 | extern int pthread_setcancelstate (int __state, int *__oldstate); | |
| 484 | ||
| 485 | /* Set cancellation state of current thread to TYPE, returning the old | |
| 486 | type in *OLDTYPE if OLDTYPE is not NULL. */ | |
| 487 | extern int pthread_setcanceltype (int __type, int *__oldtype); | |
| 488 | ||
| 489 | /* Cancel THREAD immediately or at the next possibility. */ | |
| 490 | extern int pthread_cancel (pthread_t __th); | |
| 491 | ||
| 492 | /* Test for pending cancellation for the current thread and terminate | |
| 493 | the thread as per pthread_exit(PTHREAD_CANCELED) if it has been | |
| 494 | cancelled. */ | |
| 495 | extern void pthread_testcancel (void); | |
| 496 | ||
| 497 | ||
| 498 | /* Cancellation handling with integration into exception handling. */ | |
| 499 | ||
| 500 | typedef struct | |
| 501 | { | |
| 502 | struct | |
| 503 | { | |
| 504 | __jmp_buf __cancel_jmp_buf; | |
| 505 | int __mask_was_saved; | |
| 506 | } __cancel_jmp_buf[1]; | |
| 507 | void *__pad[4]; | |
| 508 | } __pthread_unwind_buf_t __attribute__ ((__aligned__)); | |
| 509 | ||
| 510 | /* No special attributes by default. */ | |
| 511 | #ifndef __cleanup_fct_attribute | |
| 512 | # define __cleanup_fct_attribute | |
| 513 | #endif | |
| 514 | ||
| 515 | ||
| 516 | /* Structure to hold the cleanup handler information. */ | |
| 517 | struct __pthread_cleanup_frame | |
| 518 | { | |
| 519 | void (*__cancel_routine) (void *); | |
| 520 | void *__cancel_arg; | |
| 521 | int __do_it; | |
| 522 | int __cancel_type; | |
| 523 | }; | |
| 524 | ||
| 525 | #if defined __GNUC__ && defined __EXCEPTIONS | |
| 526 | # ifdef __cplusplus | |
| 527 | /* Class to handle cancellation handler invocation. */ | |
| 528 | class __pthread_cleanup_class | |
| 529 | { | |
| 530 | void (*__cancel_routine) (void *); | |
| 531 | void *__cancel_arg; | |
| 532 | int __do_it; | |
| 533 | int __cancel_type; | |
| 534 | ||
| 535 | public: | |
| 536 | __pthread_cleanup_class (void (*__fct) (void *), void *__arg) | |
| 537 | : __cancel_routine (__fct), __cancel_arg (__arg), __do_it (1) { } | |
| 538 | ~__pthread_cleanup_class () { if (__do_it) __cancel_routine (__cancel_arg); } | |
| 539 | void __setdoit (int __newval) { __do_it = __newval; } | |
| 540 | void __defer () { pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, | |
| 541 | 					 &__cancel_type); } | |
| 542 | void __restore () const { pthread_setcanceltype (__cancel_type, 0); } | |
| 543 | }; | |
| 544 | ||
| 545 | /* Install a cleanup handler: ROUTINE will be called with arguments ARG | |
| 546 | when the thread is canceled or calls pthread_exit. ROUTINE will also | |
| 547 | be called with arguments ARG when the matching pthread_cleanup_pop | |
| 548 | is executed with non-zero EXECUTE argument. | |
| 549 | ||
| 550 | pthread_cleanup_push and pthread_cleanup_pop are macros and must always | |
| 551 | be used in matching pairs at the same nesting level of braces. */ | |
| 552 | # define pthread_cleanup_push(routine, arg) \ | |
| 553 | do {									 \ | |
| 554 | __pthread_cleanup_class __clframe (routine, arg) | |
| 555 | ||
| 556 | /* Remove a cleanup handler installed by the matching pthread_cleanup_push. | |
| 557 | If EXECUTE is non-zero, the handler function is called. */ | |
| 558 | # define pthread_cleanup_pop(execute) \ | |
| 559 | __clframe.__setdoit (execute);					 \ | |
| 560 | } while (0) | |
| 561 | ||
| 562 | # ifdef __USE_GNU | |
| 563 | /* Install a cleanup handler as pthread_cleanup_push does, but also | |
| 564 | saves the current cancellation type and sets it to deferred | |
| 565 | cancellation. */ | |
| 566 | # define pthread_cleanup_push_defer_np(routine, arg) \ | |
| 567 | do {									 \ | |
| 568 | __pthread_cleanup_class __clframe (routine, arg);			 \ | |
| 569 | __clframe.__defer () | |
| 570 | ||
| 571 | /* Remove a cleanup handler as pthread_cleanup_pop does, but also | |
| 572 | restores the cancellation type that was in effect when the matching | |
| 573 | pthread_cleanup_push_defer was called. */ | |
| 574 | # define pthread_cleanup_pop_restore_np(execute) \ | |
| 575 | __clframe.__restore ();						 \ | |
| 576 | __clframe.__setdoit (execute);					 \ | |
| 577 | } while (0) | |
| 578 | # endif | |
| 579 | # else | |
| 580 | /* Function called to call the cleanup handler. As an extern inline | |
| 581 | function the compiler is free to decide inlining the change when | |
| 582 | needed or fall back on the copy which must exist somewhere | |
| 583 | else. */ | |
| 584 | __extern_inline void | |
| 585 | __pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame) | |
| 586 | { | |
| 587 | if (__frame->__do_it) | |
| 588 | __frame->__cancel_routine (__frame->__cancel_arg); | |
| 589 | } | |
| 590 | ||
| 591 | /* Install a cleanup handler: ROUTINE will be called with arguments ARG | |
| 592 | when the thread is canceled or calls pthread_exit. ROUTINE will also | |
| 593 | be called with arguments ARG when the matching pthread_cleanup_pop | |
| 594 | is executed with non-zero EXECUTE argument. | |
| 595 | ||
| 596 | pthread_cleanup_push and pthread_cleanup_pop are macros and must always | |
| 597 | be used in matching pairs at the same nesting level of braces. */ | |
| 598 | # define pthread_cleanup_push(routine, arg) \ | |
| 599 | do {									 \ | |
| 600 | struct __pthread_cleanup_frame __clframe				 \ | |
| 601 | __attribute__ ((__cleanup__ (__pthread_cleanup_routine)))		 \ | |
| 602 | = { .__cancel_routine = (routine), .__cancel_arg = (arg),	 	 \ | |
| 603 | 	 .__do_it = 1 }; | |
| 604 | ||
| 605 | /* Remove a cleanup handler installed by the matching pthread_cleanup_push. | |
| 606 | If EXECUTE is non-zero, the handler function is called. */ | |
| 607 | # define pthread_cleanup_pop(execute) \ | |
| 608 | __clframe.__do_it = (execute);					 \ | |
| 609 | } while (0) | |
| 610 | ||
| 611 | # ifdef __USE_GNU | |
| 612 | /* Install a cleanup handler as pthread_cleanup_push does, but also | |
| 613 | saves the current cancellation type and sets it to deferred | |
| 614 | cancellation. */ | |
| 615 | # define pthread_cleanup_push_defer_np(routine, arg) \ | |
| 616 | do {									 \ | |
| 617 | struct __pthread_cleanup_frame __clframe				 \ | |
| 618 | __attribute__ ((__cleanup__ (__pthread_cleanup_routine)))		 \ | |
| 619 | = { .__cancel_routine = (routine), .__cancel_arg = (arg),		 \ | |
| 620 | 	 .__do_it = 1 };						 \ | |
| 621 | (void) pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED,		 \ | |
| 622 | 				 &__clframe.__cancel_type) | |
| 623 | ||
| 624 | /* Remove a cleanup handler as pthread_cleanup_pop does, but also | |
| 625 | restores the cancellation type that was in effect when the matching | |
| 626 | pthread_cleanup_push_defer was called. */ | |
| 627 | # define pthread_cleanup_pop_restore_np(execute) \ | |
| 628 | (void) pthread_setcanceltype (__clframe.__cancel_type, NULL);	 \ | |
| 629 | __clframe.__do_it = (execute);					 \ | |
| 630 | } while (0) | |
| 631 | # endif | |
| 632 | # endif | |
| 633 | #else | |
| 634 | /* Install a cleanup handler: ROUTINE will be called with arguments ARG | |
| 635 | when the thread is canceled or calls pthread_exit. ROUTINE will also | |
| 636 | be called with arguments ARG when the matching pthread_cleanup_pop | |
| 637 | is executed with non-zero EXECUTE argument. | |
| 638 | ||
| 639 | pthread_cleanup_push and pthread_cleanup_pop are macros and must always | |
| 640 | be used in matching pairs at the same nesting level of braces. */ | |
| 641 | # define pthread_cleanup_push(routine, arg) \ | |
| 642 | do {									 \ | |
| 643 | __pthread_unwind_buf_t __cancel_buf;				 \ | |
| 644 | void (*__cancel_routine) (void *) = (routine);			 \ | |
| 645 | void *__cancel_arg = (arg);						 \ | |
| 646 | int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \ | |
| 647 | 					__cancel_buf.__cancel_jmp_buf, 0); \ | |
| 648 | if (__glibc_unlikely (__not_first_call))				 \ | |
| 649 | {									 \ | |
| 650 | 	__cancel_routine (__cancel_arg);				 \ | |
| 651 | 	__pthread_unwind_next (&__cancel_buf);				 \ | |
| 652 | 	/* NOTREACHED */						 \ | |
| 653 | }									 \ | |
| 654 | 									 \ | |
| 655 | __pthread_register_cancel (&__cancel_buf);				 \ | |
| 656 | do { | |
| 657 | extern void __pthread_register_cancel (__pthread_unwind_buf_t *__buf) | |
| 658 | __cleanup_fct_attribute; | |
| 659 | ||
| 660 | /* Remove a cleanup handler installed by the matching pthread_cleanup_push. | |
| 661 | If EXECUTE is non-zero, the handler function is called. */ | |
| 662 | # define pthread_cleanup_pop(execute) \ | |
| 663 | do { } while (0);/* Empty to allow label before pthread_cleanup_pop. */\ | |
| 664 | } while (0);							 \ | |
| 665 | __pthread_unregister_cancel (&__cancel_buf);			 \ | |
| 666 | if (execute)							 \ | |
| 667 | __cancel_routine (__cancel_arg);					 \ | |
| 668 | } while (0) | |
| 669 | extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf) | |
| 670 | __cleanup_fct_attribute; | |
| 671 | ||
| 672 | # ifdef __USE_GNU | |
| 673 | /* Install a cleanup handler as pthread_cleanup_push does, but also | |
| 674 | saves the current cancellation type and sets it to deferred | |
| 675 | cancellation. */ | |
| 676 | # define pthread_cleanup_push_defer_np(routine, arg) \ | |
| 677 | do {									 \ | |
| 678 | __pthread_unwind_buf_t __cancel_buf;				 \ | |
| 679 | void (*__cancel_routine) (void *) = (routine);			 \ | |
| 680 | void *__cancel_arg = (arg);						 \ | |
| 681 | int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \ | |
| 682 | 					__cancel_buf.__cancel_jmp_buf, 0); \ | |
| 683 | if (__glibc_unlikely (__not_first_call))				 \ | |
| 684 | {									 \ | |
| 685 | 	__cancel_routine (__cancel_arg);				 \ | |
| 686 | 	__pthread_unwind_next (&__cancel_buf);				 \ | |
| 687 | 	/* NOTREACHED */						 \ | |
| 688 | }									 \ | |
| 689 | 									 \ | |
| 690 | __pthread_register_cancel_defer (&__cancel_buf);			 \ | |
| 691 | do { | |
| 692 | extern void __pthread_register_cancel_defer (__pthread_unwind_buf_t *__buf) | |
| 693 | __cleanup_fct_attribute; | |
| 694 | ||
| 695 | /* Remove a cleanup handler as pthread_cleanup_pop does, but also | |
| 696 | restores the cancellation type that was in effect when the matching | |
| 697 | pthread_cleanup_push_defer was called. */ | |
| 698 | # define pthread_cleanup_pop_restore_np(execute) \ | |
| 699 | do { } while (0);/* Empty to allow label before pthread_cleanup_pop. */\ | |
| 700 | } while (0);							 \ | |
| 701 | __pthread_unregister_cancel_restore (&__cancel_buf);		 \ | |
| 702 | if (execute)							 \ | |
| 703 | __cancel_routine (__cancel_arg);					 \ | |
| 704 | } while (0) | |
| 705 | extern void __pthread_unregister_cancel_restore (__pthread_unwind_buf_t *__buf) | |
| 706 | __cleanup_fct_attribute; | |
| 707 | # endif | |
| 708 | ||
| 709 | /* Internal interface to initiate cleanup. */ | |
| 710 | extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf) | |
| 711 | __cleanup_fct_attribute __attribute__ ((__noreturn__)) | |
| 712 | # ifndef SHARED | |
| 713 | __attribute__ ((__weak__)) | |
| 714 | # endif | |
| 715 | ; | |
| 716 | #endif | |
| 717 | ||
| 718 | /* Function used in the macros. */ | |
| 719 | struct __jmp_buf_tag; | |
| 720 | extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL; | |
| 721 | ||
| 722 | ||
| 723 | /* Mutex handling. */ | |
| 724 | ||
| 725 | /* Initialize a mutex. */ | |
| 726 | extern int pthread_mutex_init (pthread_mutex_t *__mutex, | |
| 727 | 			 const pthread_mutexattr_t *__mutexattr) | |
| 728 | __THROW __nonnull ((1)); | |
| 729 | ||
| 730 | /* Destroy a mutex. */ | |
| 731 | extern int pthread_mutex_destroy (pthread_mutex_t *__mutex) | |
| 732 | __THROW __nonnull ((1)); | |
| 733 | ||
| 734 | /* Try locking a mutex. */ | |
| 735 | extern int pthread_mutex_trylock (pthread_mutex_t *__mutex) | |
| 736 | __THROWNL __nonnull ((1)); | |
| 737 | ||
| 738 | /* Lock a mutex. */ | |
| 739 | extern int pthread_mutex_lock (pthread_mutex_t *__mutex) | |
| 740 | __THROWNL __nonnull ((1)); | |
| 741 | ||
| 742 | #ifdef __USE_XOPEN2K | |
| 743 | /* Wait until lock becomes available, or specified time passes. */ | |
| 744 | extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex, | |
| 745 | 				 const struct timespec *__restrict | |
| 746 | 				 __abstime) __THROWNL __nonnull ((1, 2)); | |
| 747 | #endif | |
| 748 | ||
| 749 | #ifdef __USE_GNU | |
| 750 | extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex, | |
| 751 | 				 clockid_t __clockid, | |
| 752 | 				 const struct timespec *__restrict | |
| 753 | 				 __abstime) __THROWNL __nonnull ((1, 3)); | |
| 754 | #endif | |
| 755 | ||
| 756 | /* Unlock a mutex. */ | |
| 757 | extern int pthread_mutex_unlock (pthread_mutex_t *__mutex) | |
| 758 | __THROWNL __nonnull ((1)); | |
| 759 | ||
| 760 | ||
| 761 | /* Get the priority ceiling of MUTEX. */ | |
| 762 | extern int pthread_mutex_getprioceiling (const pthread_mutex_t * | |
| 763 | 					 __restrict __mutex, | |
| 764 | 					 int *__restrict __prioceiling) | |
| 765 | __THROW __nonnull ((1, 2)); | |
| 766 | ||
| 767 | /* Set the priority ceiling of MUTEX to PRIOCEILING, return old | |
| 768 | priority ceiling value in *OLD_CEILING. */ | |
| 769 | extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex, | |
| 770 | 					 int __prioceiling, | |
| 771 | 					 int *__restrict __old_ceiling) | |
| 772 | __THROW __nonnull ((1, 3)); | |
| 773 | ||
| 774 | ||
| 775 | #ifdef __USE_XOPEN2K8 | |
| 776 | /* Declare the state protected by MUTEX as consistent. */ | |
| 777 | extern int pthread_mutex_consistent (pthread_mutex_t *__mutex) | |
| 778 | __THROW __nonnull ((1)); | |
| 779 | # ifdef __USE_GNU | |
| 780 | extern int pthread_mutex_consistent_np (pthread_mutex_t *__mutex) | |
| 781 | __THROW __nonnull ((1)); | |
| 782 | # endif | |
| 783 | #endif | |
| 784 | ||
| 785 | ||
| 786 | /* Functions for handling mutex attributes. */ | |
| 787 | ||
| 788 | /* Initialize mutex attribute object ATTR with default attributes | |
| 789 | (kind is PTHREAD_MUTEX_TIMED_NP). */ | |
| 790 | extern int pthread_mutexattr_init (pthread_mutexattr_t *__attr) | |
| 791 | __THROW __nonnull ((1)); | |
| 792 | ||
| 793 | /* Destroy mutex attribute object ATTR. */ | |
| 794 | extern int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr) | |
| 795 | __THROW __nonnull ((1)); | |
| 796 | ||
| 797 | /* Get the process-shared flag of the mutex attribute ATTR. */ | |
| 798 | extern int pthread_mutexattr_getpshared (const pthread_mutexattr_t * | |
| 799 | 					 __restrict __attr, | |
| 800 | 					 int *__restrict __pshared) | |
| 801 | __THROW __nonnull ((1, 2)); | |
| 802 | ||
| 803 | /* Set the process-shared flag of the mutex attribute ATTR. */ | |
| 804 | extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr, | |
| 805 | 					 int __pshared) | |
| 806 | __THROW __nonnull ((1)); | |
| 807 | ||
| 808 | #if defined __USE_UNIX98 || defined __USE_XOPEN2K8 | |
| 809 | /* Return in *KIND the mutex kind attribute in *ATTR. */ | |
| 810 | extern int pthread_mutexattr_gettype (const pthread_mutexattr_t *__restrict | |
| 811 | 				 __attr, int *__restrict __kind) | |
| 812 | __THROW __nonnull ((1, 2)); | |
| 813 | ||
| 814 | /* Set the mutex kind attribute in *ATTR to KIND (either PTHREAD_MUTEX_NORMAL, | |
| 815 | PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_ERRORCHECK, or | |
| 816 | PTHREAD_MUTEX_DEFAULT). */ | |
| 817 | extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind) | |
| 818 | __THROW __nonnull ((1)); | |
| 819 | #endif | |
| 820 | ||
| 821 | /* Return in *PROTOCOL the mutex protocol attribute in *ATTR. */ | |
| 822 | extern int pthread_mutexattr_getprotocol (const pthread_mutexattr_t * | |
| 823 | 					 __restrict __attr, | |
| 824 | 					 int *__restrict __protocol) | |
| 825 | __THROW __nonnull ((1, 2)); | |
| 826 | ||
| 827 | /* Set the mutex protocol attribute in *ATTR to PROTOCOL (either | |
| 828 | PTHREAD_PRIO_NONE, PTHREAD_PRIO_INHERIT, or PTHREAD_PRIO_PROTECT). */ | |
| 829 | extern int pthread_mutexattr_setprotocol (pthread_mutexattr_t *__attr, | |
| 830 | 					 int __protocol) | |
| 831 | __THROW __nonnull ((1)); | |
| 832 | ||
| 833 | /* Return in *PRIOCEILING the mutex prioceiling attribute in *ATTR. */ | |
| 834 | extern int pthread_mutexattr_getprioceiling (const pthread_mutexattr_t * | |
| 835 | 					 __restrict __attr, | |
| 836 | 					 int *__restrict __prioceiling) | |
| 837 | __THROW __nonnull ((1, 2)); | |
| 838 | ||
| 839 | /* Set the mutex prioceiling attribute in *ATTR to PRIOCEILING. */ | |
| 840 | extern int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *__attr, | |
| 841 | 					 int __prioceiling) | |
| 842 | __THROW __nonnull ((1)); | |
| 843 | ||
| 844 | #ifdef __USE_XOPEN2K | |
| 845 | /* Get the robustness flag of the mutex attribute ATTR. */ | |
| 846 | extern int pthread_mutexattr_getrobust (const pthread_mutexattr_t *__attr, | |
| 847 | 					int *__robustness) | |
| 848 | __THROW __nonnull ((1, 2)); | |
| 849 | # ifdef __USE_GNU | |
| 850 | extern int pthread_mutexattr_getrobust_np (const pthread_mutexattr_t *__attr, | |
| 851 | 					 int *__robustness) | |
| 852 | __THROW __nonnull ((1, 2)); | |
| 853 | # endif | |
| 854 | ||
| 855 | /* Set the robustness flag of the mutex attribute ATTR. */ | |
| 856 | extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr, | |
| 857 | 					int __robustness) | |
| 858 | __THROW __nonnull ((1)); | |
| 859 | # ifdef __USE_GNU | |
| 860 | extern int pthread_mutexattr_setrobust_np (pthread_mutexattr_t *__attr, | |
| 861 | 					 int __robustness) | |
| 862 | __THROW __nonnull ((1)); | |
| 863 | # endif | |
| 864 | #endif | |
| 865 | ||
| 866 | ||
| 867 | #if defined __USE_UNIX98 || defined __USE_XOPEN2K | |
| 868 | /* Functions for handling read-write locks. */ | |
| 869 | ||
| 870 | /* Initialize read-write lock RWLOCK using attributes ATTR, or use | |
| 871 | the default values if later is NULL. */ | |
| 872 | extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock, | |
| 873 | 				const pthread_rwlockattr_t *__restrict | |
| 874 | 				__attr) __THROW __nonnull ((1)); | |
| 875 | ||
| 876 | /* Destroy read-write lock RWLOCK. */ | |
| 877 | extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock) | |
| 878 | __THROW __nonnull ((1)); | |
| 879 | ||
| 880 | /* Acquire read lock for RWLOCK. */ | |
| 881 | extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock) | |
| 882 | __THROWNL __nonnull ((1)); | |
| 883 | ||
| 884 | /* Try to acquire read lock for RWLOCK. */ | |
| 885 | extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock) | |
| 886 | __THROWNL __nonnull ((1)); | |
| 887 | ||
| 888 | # ifdef __USE_XOPEN2K | |
| 889 | /* Try to acquire read lock for RWLOCK or return after specfied time. */ | |
| 890 | extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock, | |
| 891 | 				 const struct timespec *__restrict | |
| 892 | 				 __abstime) __THROWNL __nonnull ((1, 2)); | |
| 893 | # endif | |
| 894 | ||
| 895 | # ifdef __USE_GNU | |
| 896 | extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock, | |
| 897 | 				 clockid_t __clockid, | |
| 898 | 				 const struct timespec *__restrict | |
| 899 | 				 __abstime) __THROWNL __nonnull ((1, 3)); | |
| 900 | # endif | |
| 901 | ||
| 902 | /* Acquire write lock for RWLOCK. */ | |
| 903 | extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock) | |
| 904 | __THROWNL __nonnull ((1)); | |
| 905 | ||
| 906 | /* Try to acquire write lock for RWLOCK. */ | |
| 907 | extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock) | |
| 908 | __THROWNL __nonnull ((1)); | |
| 909 | ||
| 910 | # ifdef __USE_XOPEN2K | |
| 911 | /* Try to acquire write lock for RWLOCK or return after specfied time. */ | |
| 912 | extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock, | |
| 913 | 				 const struct timespec *__restrict | |
| 914 | 				 __abstime) __THROWNL __nonnull ((1, 2)); | |
| 915 | # endif | |
| 916 | ||
| 917 | # ifdef __USE_GNU | |
| 918 | extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock, | |
| 919 | 				 clockid_t __clockid, | |
| 920 | 				 const struct timespec *__restrict | |
| 921 | 				 __abstime) __THROWNL __nonnull ((1, 3)); | |
| 922 | # endif | |
| 923 | ||
| 924 | /* Unlock RWLOCK. */ | |
| 925 | extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock) | |
| 926 | __THROWNL __nonnull ((1)); | |
| 927 | ||
| 928 | ||
| 929 | /* Functions for handling read-write lock attributes. */ | |
| 930 | ||
| 931 | /* Initialize attribute object ATTR with default values. */ | |
| 932 | extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr) | |
| 933 | __THROW __nonnull ((1)); | |
| 934 | ||
| 935 | /* Destroy attribute object ATTR. */ | |
| 936 | extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr) | |
| 937 | __THROW __nonnull ((1)); | |
| 938 | ||
| 939 | /* Return current setting of process-shared attribute of ATTR in PSHARED. */ | |
| 940 | extern int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * | |
| 941 | 					 __restrict __attr, | |
| 942 | 					 int *__restrict __pshared) | |
| 943 | __THROW __nonnull ((1, 2)); | |
| 944 | ||
| 945 | /* Set process-shared attribute of ATTR to PSHARED. */ | |
| 946 | extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr, | |
| 947 | 					 int __pshared) | |
| 948 | __THROW __nonnull ((1)); | |
| 949 | ||
| 950 | /* Return current setting of reader/writer preference. */ | |
| 951 | extern int pthread_rwlockattr_getkind_np (const pthread_rwlockattr_t * | |
| 952 | 					 __restrict __attr, | |
| 953 | 					 int *__restrict __pref) | |
| 954 | __THROW __nonnull ((1, 2)); | |
| 955 | ||
| 956 | /* Set reader/write preference. */ | |
| 957 | extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr, | |
| 958 | 					 int __pref) __THROW __nonnull ((1)); | |
| 959 | #endif | |
| 960 | ||
| 961 | ||
| 962 | /* Functions for handling conditional variables. */ | |
| 963 | ||
| 964 | /* Initialize condition variable COND using attributes ATTR, or use | |
| 965 | the default values if later is NULL. */ | |
| 966 | extern int pthread_cond_init (pthread_cond_t *__restrict __cond, | |
| 967 | 			 const pthread_condattr_t *__restrict __cond_attr) | |
| 968 | __THROW __nonnull ((1)); | |
| 969 | ||
| 970 | /* Destroy condition variable COND. */ | |
| 971 | extern int pthread_cond_destroy (pthread_cond_t *__cond) | |
| 972 | __THROW __nonnull ((1)); | |
| 973 | ||
| 974 | /* Wake up one thread waiting for condition variable COND. */ | |
| 975 | extern int pthread_cond_signal (pthread_cond_t *__cond) | |
| 976 | __THROWNL __nonnull ((1)); | |
| 977 | ||
| 978 | /* Wake up all threads waiting for condition variables COND. */ | |
| 979 | extern int pthread_cond_broadcast (pthread_cond_t *__cond) | |
| 980 | __THROWNL __nonnull ((1)); | |
| 981 | ||
| 982 | /* Wait for condition variable COND to be signaled or broadcast. | |
| 983 | MUTEX is assumed to be locked before. | |
| 984 | ||
| 985 | This function is a cancellation point and therefore not marked with | |
| 986 | __THROW. */ | |
| 987 | extern int pthread_cond_wait (pthread_cond_t *__restrict __cond, | |
| 988 | 			 pthread_mutex_t *__restrict __mutex) | |
| 989 | __nonnull ((1, 2)); | |
| 990 | ||
| 991 | /* Wait for condition variable COND to be signaled or broadcast until | |
| 992 | ABSTIME. MUTEX is assumed to be locked before. ABSTIME is an | |
| 993 | absolute time specification; zero is the beginning of the epoch | |
| 994 | (00:00:00 GMT, January 1, 1970). | |
| 995 | ||
| 996 | This function is a cancellation point and therefore not marked with | |
| 997 | __THROW. */ | |
| 998 | extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, | |
| 999 | 				 pthread_mutex_t *__restrict __mutex, | |
| 1000 | 				 const struct timespec *__restrict __abstime) | |
| 1001 | __nonnull ((1, 2, 3)); | |
| 1002 | ||
| 1003 | # ifdef __USE_GNU | |
| 1004 | /* Wait for condition variable COND to be signaled or broadcast until | |
| 1005 | ABSTIME measured by the specified clock. MUTEX is assumed to be | |
| 1006 | locked before. CLOCK is the clock to use. ABSTIME is an absolute | |
| 1007 | time specification against CLOCK's epoch. | |
| 1008 | ||
| 1009 | This function is a cancellation point and therefore not marked with | |
| 1010 | __THROW. */ | |
| 1011 | extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond, | |
| 1012 | 				 pthread_mutex_t *__restrict __mutex, | |
| 1013 | 				 __clockid_t __clock_id, | |
| 1014 | 				 const struct timespec *__restrict __abstime) | |
| 1015 | __nonnull ((1, 2, 4)); | |
| 1016 | # endif | |
| 1017 | ||
| 1018 | /* Functions for handling condition variable attributes. */ | |
| 1019 | ||
| 1020 | /* Initialize condition variable attribute ATTR. */ | |
| 1021 | extern int pthread_condattr_init (pthread_condattr_t *__attr) | |
| 1022 | __THROW __nonnull ((1)); | |
| 1023 | ||
| 1024 | /* Destroy condition variable attribute ATTR. */ | |
| 1025 | extern int pthread_condattr_destroy (pthread_condattr_t *__attr) | |
| 1026 | __THROW __nonnull ((1)); | |
| 1027 | ||
| 1028 | /* Get the process-shared flag of the condition variable attribute ATTR. */ | |
| 1029 | extern int pthread_condattr_getpshared (const pthread_condattr_t * | |
| 1030 | 					__restrict __attr, | |
| 1031 | 					int *__restrict __pshared) | |
| 1032 | __THROW __nonnull ((1, 2)); | |
| 1033 | ||
| 1034 | /* Set the process-shared flag of the condition variable attribute ATTR. */ | |
| 1035 | extern int pthread_condattr_setpshared (pthread_condattr_t *__attr, | |
| 1036 | 					int __pshared) __THROW __nonnull ((1)); | |
| 1037 | ||
| 1038 | #ifdef __USE_XOPEN2K | |
| 1039 | /* Get the clock selected for the condition variable attribute ATTR. */ | |
| 1040 | extern int pthread_condattr_getclock (const pthread_condattr_t * | |
| 1041 | 				 __restrict __attr, | |
| 1042 | 				 __clockid_t *__restrict __clock_id) | |
| 1043 | __THROW __nonnull ((1, 2)); | |
| 1044 | ||
| 1045 | /* Set the clock selected for the condition variable attribute ATTR. */ | |
| 1046 | extern int pthread_condattr_setclock (pthread_condattr_t *__attr, | |
| 1047 | 				 __clockid_t __clock_id) | |
| 1048 | __THROW __nonnull ((1)); | |
| 1049 | #endif | |
| 1050 | ||
| 1051 | ||
| 1052 | #ifdef __USE_XOPEN2K | |
| 1053 | /* Functions to handle spinlocks. */ | |
| 1054 | ||
| 1055 | /* Initialize the spinlock LOCK. If PSHARED is nonzero the spinlock can | |
| 1056 | be shared between different processes. */ | |
| 1057 | extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared) | |
| 1058 | __THROW __nonnull ((1)); | |
| 1059 | ||
| 1060 | /* Destroy the spinlock LOCK. */ | |
| 1061 | extern int pthread_spin_destroy (pthread_spinlock_t *__lock) | |
| 1062 | __THROW __nonnull ((1)); | |
| 1063 | ||
| 1064 | /* Wait until spinlock LOCK is retrieved. */ | |
| 1065 | extern int pthread_spin_lock (pthread_spinlock_t *__lock) | |
| 1066 | __THROWNL __nonnull ((1)); | |
| 1067 | ||
| 1068 | /* Try to lock spinlock LOCK. */ | |
| 1069 | extern int pthread_spin_trylock (pthread_spinlock_t *__lock) | |
| 1070 | __THROWNL __nonnull ((1)); | |
| 1071 | ||
| 1072 | /* Release spinlock LOCK. */ | |
| 1073 | extern int pthread_spin_unlock (pthread_spinlock_t *__lock) | |
| 1074 | __THROWNL __nonnull ((1)); | |
| 1075 | ||
| 1076 | ||
| 1077 | /* Functions to handle barriers. */ | |
| 1078 | ||
| 1079 | /* Initialize BARRIER with the attributes in ATTR. The barrier is | |
| 1080 | opened when COUNT waiters arrived. */ | |
| 1081 | extern int pthread_barrier_init (pthread_barrier_t *__restrict __barrier, | |
| 1082 | 				 const pthread_barrierattr_t *__restrict | |
| 1083 | 				 __attr, unsigned int __count) | |
| 1084 | __THROW __nonnull ((1)); | |
| 1085 | ||
| 1086 | /* Destroy a previously dynamically initialized barrier BARRIER. */ | |
| 1087 | extern int pthread_barrier_destroy (pthread_barrier_t *__barrier) | |
| 1088 | __THROW __nonnull ((1)); | |
| 1089 | ||
| 1090 | /* Wait on barrier BARRIER. */ | |
| 1091 | extern int pthread_barrier_wait (pthread_barrier_t *__barrier) | |
| 1092 | __THROWNL __nonnull ((1)); | |
| 1093 | ||
| 1094 | ||
| 1095 | /* Initialize barrier attribute ATTR. */ | |
| 1096 | extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr) | |
| 1097 | __THROW __nonnull ((1)); | |
| 1098 | ||
| 1099 | /* Destroy previously dynamically initialized barrier attribute ATTR. */ | |
| 1100 | extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr) | |
| 1101 | __THROW __nonnull ((1)); | |
| 1102 | ||
| 1103 | /* Get the process-shared flag of the barrier attribute ATTR. */ | |
| 1104 | extern int pthread_barrierattr_getpshared (const pthread_barrierattr_t * | |
| 1105 | 					 __restrict __attr, | |
| 1106 | 					 int *__restrict __pshared) | |
| 1107 | __THROW __nonnull ((1, 2)); | |
| 1108 | ||
| 1109 | /* Set the process-shared flag of the barrier attribute ATTR. */ | |
| 1110 | extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr, | |
| 1111 | 					 int __pshared) | |
| 1112 | __THROW __nonnull ((1)); | |
| 1113 | #endif | |
| 1114 | ||
| 1115 | ||
| 1116 | /* Functions for handling thread-specific data. */ | |
| 1117 | ||
| 1118 | /* Create a key value identifying a location in the thread-specific | |
| 1119 | data area. Each thread maintains a distinct thread-specific data | |
| 1120 | area. DESTR_FUNCTION, if non-NULL, is called with the value | |
| 1121 | associated to that key when the key is destroyed. | |
| 1122 | DESTR_FUNCTION is not called if the value associated is NULL when | |
| 1123 | the key is destroyed. */ | |
| 1124 | extern int pthread_key_create (pthread_key_t *__key, | |
| 1125 | 			 void (*__destr_function) (void *)) | |
| 1126 | __THROW __nonnull ((1)); | |
| 1127 | ||
| 1128 | /* Destroy KEY. */ | |
| 1129 | extern int pthread_key_delete (pthread_key_t __key) __THROW; | |
| 1130 | ||
| 1131 | /* Return current value of the thread-specific data slot identified by KEY. */ | |
| 1132 | extern void *pthread_getspecific (pthread_key_t __key) __THROW; | |
| 1133 | ||
| 1134 | /* Store POINTER in the thread-specific data slot identified by KEY. */ | |
| 1135 | extern int pthread_setspecific (pthread_key_t __key, | |
| 1136 | 				const void *__pointer) __THROW ; | |
| 1137 | ||
| 1138 | ||
| 1139 | #ifdef __USE_XOPEN2K | |
| 1140 | /* Get ID of CPU-time clock for thread THREAD_ID. */ | |
| 1141 | extern int pthread_getcpuclockid (pthread_t __thread_id, | |
| 1142 | 				 __clockid_t *__clock_id) | |
| 1143 | __THROW __nonnull ((2)); | |
| 1144 | #endif | |
| 1145 | ||
| 1146 | ||
| 1147 | /* Install handlers to be called when a new process is created with FORK. | |
| 1148 | The PREPARE handler is called in the parent process just before performing | |
| 1149 | FORK. The PARENT handler is called in the parent process just after FORK. | |
| 1150 | The CHILD handler is called in the child process. Each of the three | |
| 1151 | handlers can be NULL, meaning that no handler needs to be called at that | |
| 1152 | point. | |
| 1153 | PTHREAD_ATFORK can be called several times, in which case the PREPARE | |
| 1154 | handlers are called in LIFO order (last added with PTHREAD_ATFORK, | |
| 1155 | first called before FORK), and the PARENT and CHILD handlers are called | |
| 1156 | in FIFO (first added, first called). */ | |
| 1157 | ||
| 1158 | extern int pthread_atfork (void (*__prepare) (void), | |
| 1159 | 			 void (*__parent) (void), | |
| 1160 | 			 void (*__child) (void)) __THROW; | |
| 1161 | ||
| 1162 | ||
| 1163 | #ifdef __USE_EXTERN_INLINES | |
| 1164 | /* Optimizations. */ | |
| 1165 | __extern_inline int | |
| 1166 | __NTH (pthread_equal (pthread_t __thread1, pthread_t __thread2)) | |
| 1167 | { | |
| 1168 | return __thread1 == __thread2; | |
| 1169 | } | |
| 1170 | #endif | |
| 1171 | ||
| 1172 | __END_DECLS | |
| 1173 | ||
| 1174 | #endif	/* pthread.h */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/sysdep.h+5-33| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Assembler macros for PA-RISC. |
| 2 | Copyright (C) 1999-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 1999-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | Contributed by Ulrich Drepper, <drepper@cygnus.com>, August 1999. |
| 5 | 5 | Linux/PA-RISC changes by Philipp Rumpf, <prumpf@tux.org>, March 2000. |
| ... | ... | @@ -28,6 +28,8 @@ |
| 28 | 28 | /* Defines RTLD_PRIVATE_ERRNO. */ |
| 29 | 29 | #include <dl-sysdep.h> |
| 30 | 30 | |
| 31 | #include <tls.h> | |
| 32 | ||
| 31 | 33 | /* In order to get __set_errno() definition in INLINE_SYSCALL. */ |
| 32 | 34 | #ifndef __ASSEMBLER__ |
| 33 | 35 | #include <errno.h> |
| ... | ... | @@ -360,39 +362,9 @@ L(pre_end):					ASM_LINE_SEP	\ |
| 360 | 362 | #define CALL_CLOB_REGS	"%r1", "%r2", CLOB_TREG \ |
| 361 | 363 | 			"%r20", "%r29", "%r31" |
| 362 | 364 | |
| 363 | #undef INLINE_SYSCALL | |
| 364 | #define INLINE_SYSCALL(name, nr, args...)				\ | |
| 365 | ({									\ | |
| 366 | long __sys_res = INTERNAL_SYSCALL (name, , nr, args);		\ | |
| 367 | if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (__sys_res, )))	\ | |
| 368 | {									\ | |
| 369 | 	__set_errno (INTERNAL_SYSCALL_ERRNO (__sys_res, ));		\ | |
| 370 | 	__sys_res = -1;							\ | |
| 371 | }									\ | |
| 372 | __sys_res;								\ | |
| 373 | }) | |
| 374 | ||
| 375 | /* INTERNAL_SYSCALL_DECL - Allows us to setup some function static | |
| 376 | value to use within the context of the syscall | |
| 377 | INTERNAL_SYSCALL_ERROR_P - Returns 0 if it wasn't an error, 1 otherwise | |
| 378 | You are allowed to use the syscall result (val) and the DECL error | |
| 379 | variable to determine what went wrong. | |
| 380 | INTERLAL_SYSCALL_ERRNO - Munges the val/err pair into the error number. | |
| 381 | In our case we just flip the sign. */ | |
| 382 | ||
| 383 | #undef INTERNAL_SYSCALL_DECL | |
| 384 | #define INTERNAL_SYSCALL_DECL(err) | |
| 385 | ||
| 386 | #undef INTERNAL_SYSCALL_ERROR_P | |
| 387 | #define INTERNAL_SYSCALL_ERROR_P(val, err) \ | |
| 388 | 	((val < 0) && (val > -4095)) | |
| 389 | ||
| 390 | #undef INTERNAL_SYSCALL_ERRNO | |
| 391 | #define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) | |
| 392 | ||
| 393 | 365 | /* Similar to INLINE_SYSCALL but we don't set errno */ |
| 394 | 366 | #undef INTERNAL_SYSCALL |
| 395 | #define INTERNAL_SYSCALL(name, err, nr, args...)			\ | |
| 367 | #define INTERNAL_SYSCALL(name, nr, args...)				\ | |
| 396 | 368 | ({									\ |
| 397 | 369 | 	long __sys_res;							\ |
| 398 | 370 | 	{								\ |
| ... | ... | @@ -418,7 +390,7 @@ L(pre_end):					ASM_LINE_SEP	\ |
| 418 | 390 | |
| 419 | 391 | /* The _NCS variant allows non-constant syscall numbers. */ |
| 420 | 392 | #undef INTERNAL_SYSCALL_NCS |
| 421 | #define INTERNAL_SYSCALL_NCS(name, err, nr, args...)			\ | |
| 393 | #define INTERNAL_SYSCALL_NCS(name, nr, args...)				\ | |
| 422 | 394 | ({									\ |
| 423 | 395 | 	long __sys_res;							\ |
| 424 | 396 | 	{								\ |
lib/libc/glibc/sysdeps/unix/sysv/linux/i386/dl-sysdep.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* System-specific settings for dynamic linker code. i386 version. |
| 2 | Copyright (C) 2002-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2002-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/unix/sysv/linux/i386/kernel-features.h+3-3| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | /* Set flags signalling availability of kernel features based on given |
| 2 | 2 | kernel version number. i386 version. |
| 3 | Copyright (C) 1999-2020 Free Software Foundation, Inc. | |
| 3 | Copyright (C) 1999-2021 Free Software Foundation, Inc. | |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 | |
| 6 | 6 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -23,8 +23,6 @@ |
| 23 | 23 | # define __ASSUME_SOCKETPAIR_SYSCALL 1 |
| 24 | 24 | # define __ASSUME_BIND_SYSCALL 1 |
| 25 | 25 | # define __ASSUME_LISTEN_SYSCALL 1 |
| 26 | # define __ASSUME_GETSOCKOPT_SYSCALL 1 | |
| 27 | # define __ASSUME_SETSOCKOPT_SYSCALL 1 | |
| 28 | 26 | # define __ASSUME_GETSOCKNAME_SYSCALL 1 |
| 29 | 27 | # define __ASSUME_GETPEERNAME_SYSCALL 1 |
| 30 | 28 | # define __ASSUME_SHUTDOWN_SYSCALL 1 |
| ... | ... | @@ -41,6 +39,8 @@ |
| 41 | 39 | # undef __ASSUME_CONNECT_SYSCALL |
| 42 | 40 | # undef __ASSUME_RECVFROM_SYSCALL |
| 43 | 41 | # undef __ASSUME_SENDTO_SYSCALL |
| 42 | # undef __ASSUME_GETSOCKOPT_SYSCALL | |
| 43 | # undef __ASSUME_SETSOCKOPT_SYSCALL | |
| 44 | 44 | #endif |
| 45 | 45 | |
| 46 | 46 | /* i686 only supports ipc syscall before 5.1. */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/i386/sysdep.h+85-108| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1992-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | Contributed by Ulrich Drepper, <drepper@gnu.org>, August 1995. |
| 4 | 4 | |
| ... | ... | @@ -48,7 +48,7 @@ |
| 48 | 48 | to compile glibc. Disable GCC 5 optimization when compiling for |
| 49 | 49 | profiling or when -fno-omit-frame-pointer is used since asm ("ebp") |
| 50 | 50 | can't be used to put the 6th argument in %ebp for syscall. */ |
| 51 | #if __GNUC_PREREQ (5,0) && !defined PROF && CAN_USE_REGISTER_ASM_EBP | |
| 51 | #if !defined PROF && CAN_USE_REGISTER_ASM_EBP | |
| 52 | 52 | # define OPTIMIZE_FOR_GCC_5 |
| 53 | 53 | #endif |
| 54 | 54 | |
| ... | ... | @@ -67,6 +67,7 @@ |
| 67 | 67 | |
| 68 | 68 | /* We don't want the label for the error handle to be global when we define |
| 69 | 69 | it here. */ |
| 70 | #undef SYSCALL_ERROR_LABEL | |
| 70 | 71 | #define SYSCALL_ERROR_LABEL __syscall_error |
| 71 | 72 | |
| 72 | 73 | #undef	PSEUDO |
| ... | ... | @@ -280,35 +281,6 @@ struct libc_do_syscall_args |
| 280 | 281 | }; |
| 281 | 282 | #endif |
| 282 | 283 | |
| 283 | /* Define a macro which expands inline into the wrapper code for a system | |
| 284 | call. */ | |
| 285 | #undef INLINE_SYSCALL | |
| 286 | #if IS_IN (libc) | |
| 287 | # define INLINE_SYSCALL(name, nr, args...) \ | |
| 288 | ({									 \ | |
| 289 | unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args);	 \ | |
| 290 | __glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, ))		 \ | |
| 291 | ? __syscall_error (-INTERNAL_SYSCALL_ERRNO (resultvar, ))		 \ | |
| 292 | : (int) resultvar; }) | |
| 293 | #else | |
| 294 | # define INLINE_SYSCALL(name, nr, args...) \ | |
| 295 | ({									 \ | |
| 296 | unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args);	 \ | |
| 297 | if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, )))	 \ | |
| 298 | {									 \ | |
| 299 | 	__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, ));		 \ | |
| 300 | 	resultvar = 0xffffffff;						 \ | |
| 301 | }									 \ | |
| 302 | (int) resultvar; }) | |
| 303 | #endif | |
| 304 | ||
| 305 | /* Set error number and return -1. Return the internal function, | |
| 306 | __syscall_error, which sets errno from the negative error number | |
| 307 | and returns -1, to avoid PIC. */ | |
| 308 | #undef INLINE_SYSCALL_ERROR_RETURN_VALUE | |
| 309 | #define INLINE_SYSCALL_ERROR_RETURN_VALUE(resultvar) \ | |
| 310 | __syscall_error (-(resultvar)) | |
| 311 | ||
| 312 | 284 | # define VDSO_NAME "LINUX_2.6" |
| 313 | 285 | # define VDSO_HASH 61765110 |
| 314 | 286 | |
| ... | ... | @@ -319,6 +291,11 @@ struct libc_do_syscall_args |
| 319 | 291 | # define HAVE_TIME_VSYSCALL "__vdso_time" |
| 320 | 292 | # define HAVE_CLOCK_GETRES_VSYSCALL "__vdso_clock_getres" |
| 321 | 293 | |
| 294 | # define HAVE_CLONE3_WRAPPER		1 | |
| 295 | ||
| 296 | # undef HAVE_INTERNAL_BRK_ADDR_SYMBOL | |
| 297 | # define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 | |
| 298 | ||
| 322 | 299 | /* Define a macro which expands inline into the wrapper code for a system |
| 323 | 300 | call. This use is for internal calls that do not need to handle errors |
| 324 | 301 | normally. It will never touch errno. This returns just what the kernel |
| ... | ... | @@ -327,25 +304,41 @@ struct libc_do_syscall_args |
| 327 | 304 | The _NCS variant allows non-constant syscall numbers but it is not |
| 328 | 305 | possible to use more than four parameters. */ |
| 329 | 306 | #undef INTERNAL_SYSCALL |
| 330 | #define INTERNAL_SYSCALL_MAIN_0(name, err, args...) \ | |
| 331 | INTERNAL_SYSCALL_MAIN_INLINE(name, err, 0, args) | |
| 332 | #define INTERNAL_SYSCALL_MAIN_1(name, err, args...) \ | |
| 333 | INTERNAL_SYSCALL_MAIN_INLINE(name, err, 1, args) | |
| 334 | #define INTERNAL_SYSCALL_MAIN_2(name, err, args...) \ | |
| 335 | INTERNAL_SYSCALL_MAIN_INLINE(name, err, 2, args) | |
| 336 | #define INTERNAL_SYSCALL_MAIN_3(name, err, args...) \ | |
| 337 | INTERNAL_SYSCALL_MAIN_INLINE(name, err, 3, args) | |
| 338 | #define INTERNAL_SYSCALL_MAIN_4(name, err, args...) \ | |
| 339 | INTERNAL_SYSCALL_MAIN_INLINE(name, err, 4, args) | |
| 340 | #define INTERNAL_SYSCALL_MAIN_5(name, err, args...) \ | |
| 341 | INTERNAL_SYSCALL_MAIN_INLINE(name, err, 5, args) | |
| 307 | #define INTERNAL_SYSCALL_MAIN_0(name, args...) \ | |
| 308 | INTERNAL_SYSCALL_MAIN_INLINE(name, 0, args) | |
| 309 | #define INTERNAL_SYSCALL_MAIN_1(name, args...) \ | |
| 310 | INTERNAL_SYSCALL_MAIN_INLINE(name, 1, args) | |
| 311 | #define INTERNAL_SYSCALL_MAIN_2(name, args...) \ | |
| 312 | INTERNAL_SYSCALL_MAIN_INLINE(name, 2, args) | |
| 313 | #define INTERNAL_SYSCALL_MAIN_3(name, args...) \ | |
| 314 | INTERNAL_SYSCALL_MAIN_INLINE(name, 3, args) | |
| 315 | #define INTERNAL_SYSCALL_MAIN_4(name, args...) \ | |
| 316 | INTERNAL_SYSCALL_MAIN_INLINE(name, 4, args) | |
| 317 | #define INTERNAL_SYSCALL_MAIN_5(name, args...) \ | |
| 318 | INTERNAL_SYSCALL_MAIN_INLINE(name, 5, args) | |
| 319 | ||
| 320 | #define INTERNAL_SYSCALL_MAIN_NCS_0(name, args...) \ | |
| 321 | INTERNAL_SYSCALL_MAIN_NCS(name, 0, args) | |
| 322 | #define INTERNAL_SYSCALL_MAIN_NCS_1(name, args...) \ | |
| 323 | INTERNAL_SYSCALL_MAIN_NCS(name, 1, args) | |
| 324 | #define INTERNAL_SYSCALL_MAIN_NCS_2(name, args...) \ | |
| 325 | INTERNAL_SYSCALL_MAIN_NCS(name, 2, args) | |
| 326 | #define INTERNAL_SYSCALL_MAIN_NCS_3(name, args...) \ | |
| 327 | INTERNAL_SYSCALL_MAIN_NCS(name, 3, args) | |
| 328 | #define INTERNAL_SYSCALL_MAIN_NCS_4(name, args...) \ | |
| 329 | INTERNAL_SYSCALL_MAIN_NCS(name, 4, args) | |
| 330 | #define INTERNAL_SYSCALL_MAIN_NCS_5(name, args...) \ | |
| 331 | INTERNAL_SYSCALL_MAIN_NCS(name, 5, args) | |
| 332 | ||
| 342 | 333 | /* Each object using 6-argument inline syscalls must include a |
| 343 | 334 | definition of __libc_do_syscall. */ |
| 344 | 335 | #ifdef OPTIMIZE_FOR_GCC_5 |
| 345 | # define INTERNAL_SYSCALL_MAIN_6(name, err, args...) \ | |
| 346 | INTERNAL_SYSCALL_MAIN_INLINE(name, err, 6, args) | |
| 336 | # define INTERNAL_SYSCALL_MAIN_6(name, args...) \ | |
| 337 | INTERNAL_SYSCALL_MAIN_INLINE(name, 6, args) | |
| 338 | # define INTERNAL_SYSCALL_MAIN_NCS_6(name, args...) \ | |
| 339 | INTERNAL_SYSCALL_MAIN_NCS(name, 6, args) | |
| 347 | 340 | #else /* GCC 5 */ |
| 348 | # define INTERNAL_SYSCALL_MAIN_6(name, err, arg1, arg2, arg3,		\ | |
| 341 | # define INTERNAL_SYSCALL_MAIN_6(name, arg1, arg2, arg3,		\ | |
| 349 | 342 | 				 arg4, arg5, arg6)			\ |
| 350 | 343 | struct libc_do_syscall_args _xv =					\ |
| 351 | 344 | {									\ |
| ... | ... | @@ -359,52 +352,67 @@ struct libc_do_syscall_args |
| 359 | 352 | : "=a" (resultvar)							\ |
| 360 | 353 | : "i" (__NR_##name), "c" (arg2), "d" (arg3), "S" (arg4), "D" (&_xv) \ |
| 361 | 354 | : "memory", "cc") |
| 355 | # define INTERNAL_SYSCALL_MAIN_NCS_6(name, arg1, arg2, arg3,		\ | |
| 356 | 				 arg4, arg5, arg6)			\ | |
| 357 | struct libc_do_syscall_args _xv =					\ | |
| 358 | {									\ | |
| 359 | (int) (arg1),							\ | |
| 360 | (int) (arg5),							\ | |
| 361 | (int) (arg6)							\ | |
| 362 | };									\ | |
| 363 | asm volatile (							\ | |
| 364 | "movl %1, %%eax\n\t"						\ | |
| 365 | "call __libc_do_syscall"						\ | |
| 366 | : "=a" (resultvar)							\ | |
| 367 | : "a" (name), "c" (arg2), "d" (arg3), "S" (arg4), "D" (&_xv)	\ | |
| 368 | : "memory", "cc") | |
| 362 | 369 | #endif /* GCC 5 */ |
| 363 | #define INTERNAL_SYSCALL(name, err, nr, args...) \ | |
| 370 | ||
| 371 | #define INTERNAL_SYSCALL(name, nr, args...) \ | |
| 364 | 372 | ({									 \ |
| 365 | 373 | register unsigned int resultvar;					 \ |
| 366 | INTERNAL_SYSCALL_MAIN_##nr (name, err, args);			 \ | |
| 374 | INTERNAL_SYSCALL_MAIN_##nr (name, args);			 	 \ | |
| 367 | 375 | (int) resultvar; }) |
| 376 | #define INTERNAL_SYSCALL_NCS(name, nr, args...) \ | |
| 377 | ({									 \ | |
| 378 | register unsigned int resultvar;					 \ | |
| 379 | INTERNAL_SYSCALL_MAIN_NCS_##nr (name, args);		 	 \ | |
| 380 | (int) resultvar; }) | |
| 381 | ||
| 368 | 382 | #if I386_USE_SYSENTER |
| 369 | 383 | # ifdef OPTIMIZE_FOR_GCC_5 |
| 370 | 384 | # ifdef PIC |
| 371 | # define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ | |
| 385 | # define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \ | |
| 372 | 386 | LOADREGS_##nr(args)							\ |
| 373 | 387 | asm volatile (							\ |
| 374 | 388 | "call *%%gs:%P2"							\ |
| 375 | 389 | : "=a" (resultvar)							\ |
| 376 | 390 | : "a" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo))		\ |
| 377 | 391 | ASMARGS_##nr(args) : "memory", "cc") |
| 378 | # define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ | |
| 379 | ({									\ | |
| 380 | register unsigned int resultvar;					\ | |
| 392 | # define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \ | |
| 381 | 393 | LOADREGS_##nr(args)							\ |
| 382 | 394 | asm volatile (							\ |
| 383 | 395 | "call *%%gs:%P2"							\ |
| 384 | 396 | : "=a" (resultvar)							\ |
| 385 | 397 | : "a" (name), "i" (offsetof (tcbhead_t, sysinfo))			\ |
| 386 | ASMARGS_##nr(args) : "memory", "cc");				\ | |
| 387 | (int) resultvar; }) | |
| 398 | ASMARGS_##nr(args) : "memory", "cc") | |
| 388 | 399 | # else |
| 389 | # define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ | |
| 400 | # define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \ | |
| 390 | 401 | LOADREGS_##nr(args)							\ |
| 391 | 402 | asm volatile (							\ |
| 392 | 403 | "call *_dl_sysinfo"							\ |
| 393 | 404 | : "=a" (resultvar)							\ |
| 394 | 405 | : "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc") |
| 395 | # define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ | |
| 396 | ({									\ | |
| 397 | register unsigned int resultvar;					\ | |
| 406 | # define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \ | |
| 398 | 407 | LOADREGS_##nr(args)							\ |
| 399 | 408 | asm volatile (							\ |
| 400 | 409 | "call *_dl_sysinfo"							\ |
| 401 | 410 | : "=a" (resultvar)							\ |
| 402 | : "a" (name) ASMARGS_##nr(args) : "memory", "cc");			\ | |
| 403 | (int) resultvar; }) | |
| 411 | : "a" (name) ASMARGS_##nr(args) : "memory", "cc") | |
| 404 | 412 | # endif |
| 405 | 413 | # else /* GCC 5 */ |
| 406 | 414 | # ifdef PIC |
| 407 | # define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ | |
| 415 | # define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \ | |
| 408 | 416 | EXTRAVAR_##nr							 \ |
| 409 | 417 | asm volatile (							 \ |
| 410 | 418 | LOADARGS_##nr							 \ |
| ... | ... | @@ -414,9 +422,7 @@ struct libc_do_syscall_args |
| 414 | 422 | : "=a" (resultvar)							 \ |
| 415 | 423 | : "i" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo))		 \ |
| 416 | 424 | ASMFMT_##nr(args) : "memory", "cc") |
| 417 | # define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ | |
| 418 | ({									 \ | |
| 419 | register unsigned int resultvar;					 \ | |
| 425 | # define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \ | |
| 420 | 426 | EXTRAVAR_##nr							 \ |
| 421 | 427 | asm volatile (							 \ |
| 422 | 428 | LOADARGS_##nr							 \ |
| ... | ... | @@ -424,10 +430,9 @@ struct libc_do_syscall_args |
| 424 | 430 | RESTOREARGS_##nr							 \ |
| 425 | 431 | : "=a" (resultvar)							 \ |
| 426 | 432 | : "0" (name), "i" (offsetof (tcbhead_t, sysinfo))			 \ |
| 427 | ASMFMT_##nr(args) : "memory", "cc");				 \ | |
| 428 | (int) resultvar; }) | |
| 433 | ASMFMT_##nr(args) : "memory", "cc") | |
| 429 | 434 | # else |
| 430 | # define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ | |
| 435 | # define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \ | |
| 431 | 436 | EXTRAVAR_##nr							 \ |
| 432 | 437 | asm volatile (							 \ |
| 433 | 438 | LOADARGS_##nr							 \ |
| ... | ... | @@ -436,38 +441,32 @@ struct libc_do_syscall_args |
| 436 | 441 | RESTOREARGS_##nr							 \ |
| 437 | 442 | : "=a" (resultvar)							 \ |
| 438 | 443 | : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc") |
| 439 | # define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ | |
| 440 | ({									 \ | |
| 441 | register unsigned int resultvar;					 \ | |
| 444 | # define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \ | |
| 442 | 445 | EXTRAVAR_##nr							 \ |
| 443 | 446 | asm volatile (							 \ |
| 444 | 447 | LOADARGS_##nr							 \ |
| 445 | 448 | "call *_dl_sysinfo\n\t"						 \ |
| 446 | 449 | RESTOREARGS_##nr							 \ |
| 447 | 450 | : "=a" (resultvar)							 \ |
| 448 | : "0" (name) ASMFMT_##nr(args) : "memory", "cc");			 \ | |
| 449 | (int) resultvar; }) | |
| 451 | : "0" (name) ASMFMT_##nr(args) : "memory", "cc") | |
| 450 | 452 | # endif |
| 451 | 453 | # endif /* GCC 5 */ |
| 452 | 454 | #else |
| 453 | 455 | # ifdef OPTIMIZE_FOR_GCC_5 |
| 454 | # define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ | |
| 456 | # define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \ | |
| 455 | 457 | LOADREGS_##nr(args)							\ |
| 456 | 458 | asm volatile (							\ |
| 457 | 459 | "int $0x80"								\ |
| 458 | 460 | : "=a" (resultvar)							\ |
| 459 | 461 | : "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc") |
| 460 | # define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ | |
| 461 | ({									\ | |
| 462 | register unsigned int resultvar;					\ | |
| 462 | # define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \ | |
| 463 | 463 | LOADREGS_##nr(args)							\ |
| 464 | 464 | asm volatile (							\ |
| 465 | 465 | "int $0x80"								\ |
| 466 | 466 | : "=a" (resultvar)							\ |
| 467 | : "a" (name) ASMARGS_##nr(args) : "memory", "cc");			\ | |
| 468 | (int) resultvar; }) | |
| 467 | : "a" (name) ASMARGS_##nr(args) : "memory", "cc") | |
| 469 | 468 | # else /* GCC 5 */ |
| 470 | # define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ | |
| 469 | # define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \ | |
| 471 | 470 | EXTRAVAR_##nr							 \ |
| 472 | 471 | asm volatile (							 \ |
| 473 | 472 | LOADARGS_##nr							 \ |
| ... | ... | @@ -476,30 +475,17 @@ struct libc_do_syscall_args |
| 476 | 475 | RESTOREARGS_##nr							 \ |
| 477 | 476 | : "=a" (resultvar)							 \ |
| 478 | 477 | : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc") |
| 479 | # define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ | |
| 480 | ({									 \ | |
| 481 | register unsigned int resultvar;					 \ | |
| 478 | # define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \ | |
| 482 | 479 | EXTRAVAR_##nr							 \ |
| 483 | 480 | asm volatile (							 \ |
| 484 | 481 | LOADARGS_##nr							 \ |
| 485 | 482 | "int $0x80\n\t"							 \ |
| 486 | 483 | RESTOREARGS_##nr							 \ |
| 487 | 484 | : "=a" (resultvar)							 \ |
| 488 | : "0" (name) ASMFMT_##nr(args) : "memory", "cc");			 \ | |
| 489 | (int) resultvar; }) | |
| 485 | : "0" (name) ASMFMT_##nr(args) : "memory", "cc") | |
| 490 | 486 | # endif /* GCC 5 */ |
| 491 | 487 | #endif |
| 492 | 488 | |
| 493 | #undef INTERNAL_SYSCALL_DECL | |
| 494 | #define INTERNAL_SYSCALL_DECL(err) do { } while (0) | |
| 495 | ||
| 496 | #undef INTERNAL_SYSCALL_ERROR_P | |
| 497 | #define INTERNAL_SYSCALL_ERROR_P(val, err) \ | |
| 498 | ((unsigned int) (val) >= 0xfffff001u) | |
| 499 | ||
| 500 | #undef INTERNAL_SYSCALL_ERRNO | |
| 501 | #define INTERNAL_SYSCALL_ERRNO(val, err)	(-(val)) | |
| 502 | ||
| 503 | 489 | #define LOADARGS_0 |
| 504 | 490 | #ifdef __PIC__ |
| 505 | 491 | # if I386_USE_SYSENTER && defined PIC |
| ... | ... | @@ -618,20 +604,6 @@ struct libc_do_syscall_args |
| 618 | 604 | # define EXTRAVAR_5 |
| 619 | 605 | #endif |
| 620 | 606 | |
| 621 | /* Consistency check for position-independent code. */ | |
| 622 | #if defined __PIC__ && !defined OPTIMIZE_FOR_GCC_5 | |
| 623 | # define check_consistency()						 \ | |
| 624 | ({ int __res;								 \ | |
| 625 | __asm__ __volatile__						 \ | |
| 626 | (LOAD_PIC_REG_STR (cx) ";"					 \ | |
| 627 | 	"subl %%ebx, %%ecx;"						 \ | |
| 628 | 	"je 1f;"							 \ | |
| 629 | 	"ud2;"								 \ | |
| 630 | 	"1:\n"								 \ | |
| 631 | 	: "=c" (__res));						 \ | |
| 632 | __res; }) | |
| 633 | #endif | |
| 634 | ||
| 635 | 607 | #endif	/* __ASSEMBLER__ */ |
| 636 | 608 | |
| 637 | 609 | |
| ... | ... | @@ -662,4 +634,9 @@ struct libc_do_syscall_args |
| 662 | 634 | # endif |
| 663 | 635 | #endif |
| 664 | 636 | |
| 637 | /* Each shadow stack slot takes 4 bytes. Assuming that each stack | |
| 638 | frame takes 128 bytes, this is used to compute shadow stack size | |
| 639 | from stack size. */ | |
| 640 | #define STACK_SIZE_TO_SHADOW_STACK_SIZE_SHIFT 5 | |
| 641 | ||
| 665 | 642 | #endif /* linux/i386/sysdep.h */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/ia64/bits/stat.h deleted-149| ... | ... | @@ -1,149 +0,0 @@ |
| 1 | /* Copyright (C) 1999-2020 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library; if not, see | |
| 16 | <https://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | #if !defined _SYS_STAT_H && !defined _FCNTL_H | |
| 19 | # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." | |
| 20 | #endif | |
| 21 | ||
| 22 | #ifndef _BITS_STAT_H | |
| 23 | #define _BITS_STAT_H	1 | |
| 24 | ||
| 25 | /* Versions of the `struct stat' data structure. */ | |
| 26 | #define _STAT_VER_KERNEL	0 | |
| 27 | #define _STAT_VER_LINUX		1 | |
| 28 | #define _STAT_VER		_STAT_VER_LINUX | |
| 29 | ||
| 30 | /* Versions of the `xmknod' interface. */ | |
| 31 | #define _MKNOD_VER_LINUX	0 | |
| 32 | ||
| 33 | struct stat | |
| 34 | { | |
| 35 | __dev_t st_dev;		/* Device. */ | |
| 36 | __ino_t st_ino;		/* File serial number.	*/ | |
| 37 | __nlink_t st_nlink;		/* Link count. */ | |
| 38 | __mode_t st_mode;		/* File mode. */ | |
| 39 | __uid_t st_uid;		/* User ID of the file's owner.	*/ | |
| 40 | __gid_t st_gid;		/* Group ID of the file's group.*/ | |
| 41 | int __glibc_reserved0; | |
| 42 | __dev_t st_rdev;		/* Device number, if device. */ | |
| 43 | __off_t st_size;		/* Size of file, in bytes. */ | |
| 44 | #ifdef __USE_XOPEN2K8 | |
| 45 | /* Nanosecond resolution timestamps are stored in a format | |
| 46 | equivalent to 'struct timespec'. This is the type used | |
| 47 | whenever possible but the Unix namespace rules do not allow the | |
| 48 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 49 | Therefore we have to handle the use of this header in strictly | |
| 50 | standard-compliant sources special. */ | |
| 51 | struct timespec st_atim;		/* Time of last access. */ | |
| 52 | struct timespec st_mtim;		/* Time of last modification. */ | |
| 53 | struct timespec st_ctim;		/* Time of last status change. */ | |
| 54 | # define st_atime st_atim.tv_sec	/* Backward compatibility. */ | |
| 55 | # define st_mtime st_mtim.tv_sec | |
| 56 | # define st_ctime st_ctim.tv_sec | |
| 57 | #else | |
| 58 | __time_t st_atime;			/* Time of last access. */ | |
| 59 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 60 | __time_t st_mtime;			/* Time of last modification. */ | |
| 61 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 62 | __time_t st_ctime;			/* Time of last status change. */ | |
| 63 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 64 | #endif | |
| 65 | __blksize_t st_blksize;	/* Optimal block size for I/O. */ | |
| 66 | __blkcnt_t st_blocks;	/* Nr. 512-byte blocks allocated. */ | |
| 67 | long int __glibc_reserved[3]; | |
| 68 | }; | |
| 69 | ||
| 70 | #ifdef __USE_LARGEFILE64 | |
| 71 | /* Note stat64 is the same shape as stat. */ | |
| 72 | struct stat64 | |
| 73 | { | |
| 74 | __dev_t st_dev;		/* Device. */ | |
| 75 | __ino64_t st_ino;		/* File serial number. */ | |
| 76 | __nlink_t st_nlink;		/* Link count. */ | |
| 77 | __mode_t st_mode;		/* File mode. */ | |
| 78 | __uid_t st_uid;		/* User ID of the file's owner.	*/ | |
| 79 | __gid_t st_gid;		/* Group ID of the file's group.*/ | |
| 80 | int __glibc_reserved0; | |
| 81 | __dev_t st_rdev;		/* Device number, if device. */ | |
| 82 | __off_t st_size;		/* Size of file, in bytes. */ | |
| 83 | #ifdef __USE_XOPEN2K8 | |
| 84 | /* Nanosecond resolution timestamps are stored in a format | |
| 85 | equivalent to 'struct timespec'. This is the type used | |
| 86 | whenever possible but the Unix namespace rules do not allow the | |
| 87 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 88 | Therefore we have to handle the use of this header in strictly | |
| 89 | standard-compliant sources special. */ | |
| 90 | struct timespec st_atim;		/* Time of last access. */ | |
| 91 | struct timespec st_mtim;		/* Time of last modification. */ | |
| 92 | struct timespec st_ctim;		/* Time of last status change. */ | |
| 93 | # define st_atime st_atim.tv_sec	/* Backward compatibility. */ | |
| 94 | # define st_mtime st_mtim.tv_sec | |
| 95 | # define st_ctime st_ctim.tv_sec | |
| 96 | #else | |
| 97 | __time_t st_atime;			/* Time of last access. */ | |
| 98 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 99 | __time_t st_mtime;			/* Time of last modification. */ | |
| 100 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 101 | __time_t st_ctime;			/* Time of last status change. */ | |
| 102 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 103 | #endif | |
| 104 | __blksize_t st_blksize;	/* Optimal block size for I/O. */ | |
| 105 | __blkcnt64_t st_blocks;	/* Nr. 512-byte blocks allocated. */ | |
| 106 | long int __glibc_reserved[3]; | |
| 107 | }; | |
| 108 | #endif | |
| 109 | ||
| 110 | /* Tell code we have these members. */ | |
| 111 | #define	_STATBUF_ST_BLKSIZE | |
| 112 | #define _STATBUF_ST_RDEV | |
| 113 | /* Nanosecond resolution time values are supported. */ | |
| 114 | #define _STATBUF_ST_NSEC | |
| 115 | ||
| 116 | /* Encoding of the file mode. */ | |
| 117 | ||
| 118 | #define	__S_IFMT	0170000	/* These bits determine file type. */ | |
| 119 | ||
| 120 | /* File types. */ | |
| 121 | #define	__S_IFDIR	0040000	/* Directory. */ | |
| 122 | #define	__S_IFCHR	0020000	/* Character device. */ | |
| 123 | #define	__S_IFBLK	0060000	/* Block device. */ | |
| 124 | #define	__S_IFREG	0100000	/* Regular file. */ | |
| 125 | #define	__S_IFIFO	0010000	/* FIFO. */ | |
| 126 | #define	__S_IFLNK	0120000	/* Symbolic link. */ | |
| 127 | #define	__S_IFSOCK	0140000	/* Socket. */ | |
| 128 | ||
| 129 | /* POSIX.1b objects. Note that these macros always evaluate to zero. But | |
| 130 | they do it by enforcing the correct use of the macros. */ | |
| 131 | #define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 132 | #define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 133 | #define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 134 | ||
| 135 | /* Protection bits. */ | |
| 136 | ||
| 137 | #define	__S_ISUID	04000	/* Set user ID on execution. */ | |
| 138 | #define	__S_ISGID	02000	/* Set group ID on execution. */ | |
| 139 | #define	__S_ISVTX	01000	/* Save swapped text after use (sticky). */ | |
| 140 | #define	__S_IREAD	0400	/* Read by owner. */ | |
| 141 | #define	__S_IWRITE	0200	/* Write by owner. */ | |
| 142 | #define	__S_IEXEC	0100	/* Execute by owner. */ | |
| 143 | ||
| 144 | #ifdef __USE_ATFILE | |
| 145 | # define UTIME_NOW	((1l << 30) - 1l) | |
| 146 | # define UTIME_OMIT	((1l << 30) - 2l) | |
| 147 | #endif | |
| 148 | ||
| 149 | #endif	/* bits//stat.h */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/ia64/dl-sysdep.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* System-specific settings for dynamic linker code. IA-64 version. |
| 2 | Copyright (C) 2003-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2003-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/unix/sysv/linux/ia64/kernel-features.h+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | /* Set flags signalling availability of kernel features based on given |
| 2 | 2 | kernel version number. |
| 3 | Copyright (C) 2010-2020 Free Software Foundation, Inc. | |
| 3 | Copyright (C) 2010-2021 Free Software Foundation, Inc. | |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 | |
| 6 | 6 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/unix/sysv/linux/ia64/sysdep.h+15-47| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1999-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1999-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999. |
| 4 | 4 | Based on code originally written by David Mosberger-Tang |
| ... | ... | @@ -46,12 +46,6 @@ |
| 46 | 46 | #undef SYS_ify |
| 47 | 47 | #define SYS_ify(syscall_name)	__NR_##syscall_name |
| 48 | 48 | |
| 49 | /* This is to help the old kernel headers where __NR_semtimedop is not | |
| 50 | available. */ | |
| 51 | #ifndef __NR_semtimedop | |
| 52 | # define __NR_semtimedop 1247 | |
| 53 | #endif | |
| 54 | ||
| 55 | 49 | #if defined USE_DL_SYSINFO \ |
| 56 | 50 | 	&& (IS_IN (libc) \ |
| 57 | 51 | 	 || IS_IN (libpthread) || IS_IN (librt)) |
| ... | ... | @@ -95,6 +89,7 @@ |
| 95 | 89 | |
| 96 | 90 | /* We don't want the label for the error handler to be visible in the symbol |
| 97 | 91 | table when we define it here. */ |
| 92 | #undef SYSCALL_ERROR_LABEL | |
| 98 | 93 | #define SYSCALL_ERROR_LABEL __syscall_error |
| 99 | 94 | |
| 100 | 95 | #undef PSEUDO |
| ... | ... | @@ -177,6 +172,9 @@ |
| 177 | 172 | |
| 178 | 173 | #else /* not __ASSEMBLER__ */ |
| 179 | 174 | |
| 175 | #undef HAVE_INTERNAL_BRK_ADDR_SYMBOL | |
| 176 | #define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 | |
| 177 | ||
| 180 | 178 | #define BREAK_INSN_1(num) "break " #num ";;\n\t" |
| 181 | 179 | #define BREAK_INSN(num) BREAK_INSN_1(num) |
| 182 | 180 | |
| ... | ... | @@ -191,13 +189,13 @@ |
| 191 | 189 | |
| 192 | 190 | #ifdef IA64_USE_NEW_STUB |
| 193 | 191 | |
| 194 | # define DO_INLINE_SYSCALL_NCS(name, nr, args...)			 \ | |
| 192 | # define INTERNAL_SYSCALL_NCS(name, nr, args...)			 \ | |
| 193 | ({									 \ | |
| 195 | 194 | LOAD_ARGS_##nr (args)						 \ |
| 196 | 195 | register long _r8 __asm ("r8");					 \ |
| 197 | 196 | register long _r10 __asm ("r10");					 \ |
| 198 | 197 | register long _r15 __asm ("r15") = name;				 \ |
| 199 | 198 | register void *_b7 __asm ("b7") = ((tcbhead_t *)__thread_self)->__private;\ |
| 200 | long _retval;							 \ | |
| 201 | 199 | LOAD_REGS_##nr							 \ |
| 202 | 200 | /*									 \ |
| 203 | 201 | * Don't specify any unwind info here. We mark ar.pfs as		 \ |
| ... | ... | @@ -209,60 +207,30 @@ |
| 209 | 207 | 			ASM_OUTARGS_##nr				 \ |
| 210 | 208 | 		 : "0" (_b7), "3" (_r15) ASM_ARGS_##nr		 \ |
| 211 | 209 | 		 : "memory", "ar.pfs" ASM_CLOBBERS_##nr);		 \ |
| 212 | _retval = _r8; | |
| 210 | _r10 == -1 ? -_r8 : _r8;						 \ | |
| 211 | }) | |
| 213 | 212 | |
| 214 | 213 | #else /* !IA64_USE_NEW_STUB */ |
| 215 | 214 | |
| 216 | # define DO_INLINE_SYSCALL_NCS(name, nr, args...)		\ | |
| 215 | # define INTERNAL_SYSCALL_NCS(name, nr, args...)		\ | |
| 216 | ({								\ | |
| 217 | 217 | LOAD_ARGS_##nr (args)					\ |
| 218 | 218 | register long _r8 asm ("r8");				\ |
| 219 | 219 | register long _r10 asm ("r10");				\ |
| 220 | 220 | register long _r15 asm ("r15") = name;			\ |
| 221 | long _retval;						\ | |
| 222 | 221 | LOAD_REGS_##nr						\ |
| 223 | 222 | __asm __volatile (BREAK_INSN (__IA64_BREAK_SYSCALL)		\ |
| 224 | 223 | 		 : "=r" (_r8), "=r" (_r10), "=r" (_r15)	\ |
| 225 | 224 | 			ASM_OUTARGS_##nr			\ |
| 226 | 225 | 		 : "2" (_r15) ASM_ARGS_##nr		\ |
| 227 | 226 | 		 : "memory" ASM_CLOBBERS_##nr);		\ |
| 228 | _retval = _r8; | |
| 227 | _r10 == -1 ? -_r8 : _r8;					\ | |
| 228 | }) | |
| 229 | 229 | |
| 230 | 230 | #endif /* !IA64_USE_NEW_STUB */ |
| 231 | 231 | |
| 232 | #define DO_INLINE_SYSCALL(name, nr, args...)	\ | |
| 233 | DO_INLINE_SYSCALL_NCS (__NR_##name, nr, ##args) | |
| 234 | ||
| 235 | #undef INLINE_SYSCALL | |
| 236 | #define INLINE_SYSCALL(name, nr, args...)		\ | |
| 237 | ({							\ | |
| 238 | DO_INLINE_SYSCALL_NCS (__NR_##name, nr, args)	\ | |
| 239 | if (_r10 == -1)					\ | |
| 240 | {							\ | |
| 241 | 	__set_errno (_retval);				\ | |
| 242 | 	_retval = -1;					\ | |
| 243 | }							\ | |
| 244 | _retval; }) | |
| 245 | ||
| 246 | #undef INTERNAL_SYSCALL_DECL | |
| 247 | #define INTERNAL_SYSCALL_DECL(err) long int err __attribute__ ((unused)) | |
| 248 | ||
| 249 | #undef INTERNAL_SYSCALL | |
| 250 | #define INTERNAL_SYSCALL_NCS(name, err, nr, args...)	\ | |
| 251 | ({							\ | |
| 252 | DO_INLINE_SYSCALL_NCS (name, nr, args)		\ | |
| 253 | err = _r10;						\ | |
| 254 | _retval; }) | |
| 255 | #define INTERNAL_SYSCALL(name, err, nr, args...)	\ | |
| 256 | INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) | |
| 257 | ||
| 258 | #undef INTERNAL_SYSCALL_ERROR_P | |
| 259 | #define INTERNAL_SYSCALL_ERROR_P(val, err)		\ | |
| 260 | ({ (void) (val);					\ | |
| 261 | (err == -1);					\ | |
| 262 | }) | |
| 263 | ||
| 264 | #undef INTERNAL_SYSCALL_ERRNO | |
| 265 | #define INTERNAL_SYSCALL_ERRNO(val, err)	(val) | |
| 232 | #define INTERNAL_SYSCALL(name, nr, args...)	\ | |
| 233 | INTERNAL_SYSCALL_NCS (__NR_##name, nr, ##args) | |
| 266 | 234 | |
| 267 | 235 | #define LOAD_ARGS_0() |
| 268 | 236 | #define LOAD_REGS_0 |
lib/libc/glibc/sysdeps/unix/sysv/linux/include/sys/timex.h+172-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Internal declarations for sys/timex.h. |
| 2 | Copyright (C) 2014-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2014-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -23,7 +23,178 @@ |
| 23 | 23 | |
| 24 | 24 | # ifndef _ISOMAC |
| 25 | 25 | |
| 26 | extern int __adjtimex (struct timex *__ntx); | |
| 26 | 27 | libc_hidden_proto (__adjtimex) |
| 27 | 28 | |
| 29 | # include <time.h> | |
| 30 | # include <struct___timeval64.h> | |
| 31 | /* Local definition of 64 bit time supporting timex struct */ | |
| 32 | # if __TIMESIZE == 64 | |
| 33 | # define __timex64 timex | |
| 34 | # define __clock_adjtime64 __clock_adjtime | |
| 35 | # define ___adjtimex64 ___adjtimex | |
| 36 | # define __ntptimeval64 ntptimeval | |
| 37 | # define __ntp_gettime64 __ntp_gettime | |
| 38 | # define __ntp_gettimex64 __ntp_gettimex | |
| 39 | # else | |
| 40 | ||
| 41 | struct __timex64 | |
| 42 | { | |
| 43 | unsigned int modes; /* mode selector */ | |
| 44 | int :32; /* pad */ | |
| 45 | long long int offset; /* time offset (usec) */ | |
| 46 | long long int freq; /* frequency offset (scaled ppm) */ | |
| 47 | long long int maxerror; /* maximum error (usec) */ | |
| 48 | long long int esterror; /* estimated error (usec) */ | |
| 49 | int status; /* clock command/status */ | |
| 50 | int :32; /* pad */ | |
| 51 | long long int constant; /* pll time constant */ | |
| 52 | long long int precision; /* clock precision (usec) (read only) */ | |
| 53 | long long int tolerance; /* clock frequency tolerance (ppm) (ro) */ | |
| 54 | struct __timeval64 time; /* (read only, except for ADJ_SETOFFSET) */ | |
| 55 | long long int tick; /* (modified) usecs between clock ticks */ | |
| 56 | long long int ppsfreq; /* pps frequency (scaled ppm) (ro) */ | |
| 57 | long long int jitter; /* pps jitter (us) (ro) */ | |
| 58 | int shift; /* interval duration (s) (shift) (ro) */ | |
| 59 | int :32; /* pad */ | |
| 60 | long long int stabil; /* pps stability (scaled ppm) (ro) */ | |
| 61 | long long int jitcnt; /* jitter limit exceeded (ro) */ | |
| 62 | long long int calcnt; /* calibration intervals (ro) */ | |
| 63 | long long int errcnt; /* calibration errors (ro) */ | |
| 64 | long long int stbcnt; /* stability limit exceeded (ro) */ | |
| 65 | ||
| 66 | int tai; /* TAI offset (ro) */ | |
| 67 | ||
| 68 | int :32; | |
| 69 | int :32; | |
| 70 | int :32; | |
| 71 | int :32; | |
| 72 | int :32; | |
| 73 | int :32; | |
| 74 | int :32; | |
| 75 | int :32; | |
| 76 | int :32; | |
| 77 | int :32; | |
| 78 | int :32; | |
| 79 | }; | |
| 80 | extern int __clock_adjtime64 (const clockid_t clock_id, struct __timex64 *tx64); | |
| 81 | libc_hidden_proto (__clock_adjtime64); | |
| 82 | extern int ___adjtimex64 (struct __timex64 *tx64); | |
| 83 | libc_hidden_proto (___adjtimex64) | |
| 84 | ||
| 85 | struct __ntptimeval64 | |
| 86 | { | |
| 87 | struct __timeval64 time;	/* current time (ro) */ | |
| 88 | long int maxerror;	/* maximum error (us) (ro) */ | |
| 89 | long int esterror;	/* estimated error (us) (ro) */ | |
| 90 | long int tai;		/* TAI offset (ro) */ | |
| 91 | ||
| 92 | long int __glibc_reserved1; | |
| 93 | long int __glibc_reserved2; | |
| 94 | long int __glibc_reserved3; | |
| 95 | long int __glibc_reserved4; | |
| 96 | }; | |
| 97 | extern int __ntp_gettime64 (struct __ntptimeval64 *ntv); | |
| 98 | libc_hidden_proto (__ntp_gettime64) | |
| 99 | extern int __ntp_gettimex64 (struct __ntptimeval64 *ntv); | |
| 100 | libc_hidden_proto (__ntp_gettimex64) | |
| 101 | ||
| 102 | # endif | |
| 103 | ||
| 104 | /* Convert a known valid struct timex into a struct __timex64. */ | |
| 105 | static inline struct __timex64 | |
| 106 | valid_timex_to_timex64 (const struct timex tx) | |
| 107 | { | |
| 108 | struct __timex64 tx64; | |
| 109 | ||
| 110 | tx64.modes = tx.modes; | |
| 111 | tx64.offset = tx.offset; | |
| 112 | tx64.freq = tx.freq; | |
| 113 | tx64.maxerror = tx.maxerror; | |
| 114 | tx64.esterror = tx.esterror; | |
| 115 | tx64.status = tx.status; | |
| 116 | tx64.constant = tx.constant; | |
| 117 | tx64.precision = tx.precision; | |
| 118 | tx64.tolerance = tx.tolerance; | |
| 119 | tx64.time = valid_timeval_to_timeval64 (tx.time); | |
| 120 | tx64.tick = tx.tick; | |
| 121 | tx64.ppsfreq = tx.ppsfreq; | |
| 122 | tx64.jitter = tx.jitter; | |
| 123 | tx64.shift = tx.shift; | |
| 124 | tx64.stabil = tx.stabil; | |
| 125 | tx64.jitcnt = tx.jitcnt; | |
| 126 | tx64.calcnt = tx.calcnt; | |
| 127 | tx64.errcnt = tx.errcnt; | |
| 128 | tx64.stbcnt = tx.stbcnt; | |
| 129 | tx64.tai = tx.tai; | |
| 130 | ||
| 131 | return tx64; | |
| 132 | } | |
| 133 | ||
| 134 | /* Convert a known valid struct __timex64 into a struct timex. */ | |
| 135 | static inline struct timex | |
| 136 | valid_timex64_to_timex (const struct __timex64 tx64) | |
| 137 | { | |
| 138 | struct timex tx; | |
| 139 | ||
| 140 | tx.modes = tx64.modes; | |
| 141 | tx.offset = tx64.offset; | |
| 142 | tx.freq = tx64.freq; | |
| 143 | tx.maxerror = tx64.maxerror; | |
| 144 | tx.esterror = tx64.esterror; | |
| 145 | tx.status = tx64.status; | |
| 146 | tx.constant = tx64.constant; | |
| 147 | tx.precision = tx64.precision; | |
| 148 | tx.tolerance = tx64.tolerance; | |
| 149 | tx.time = valid_timeval64_to_timeval (tx64.time); | |
| 150 | tx.tick = tx64.tick; | |
| 151 | tx.ppsfreq = tx64.ppsfreq; | |
| 152 | tx.jitter = tx64.jitter; | |
| 153 | tx.shift = tx64.shift; | |
| 154 | tx.stabil = tx64.stabil; | |
| 155 | tx.jitcnt = tx64.jitcnt; | |
| 156 | tx.calcnt = tx64.calcnt; | |
| 157 | tx.errcnt = tx64.errcnt; | |
| 158 | tx.stbcnt = tx64.stbcnt; | |
| 159 | tx.tai = tx64.tai; | |
| 160 | ||
| 161 | return tx; | |
| 162 | } | |
| 163 | ||
| 164 | /* Convert a known valid struct ntptimeval into a struct __ntptimeval64. */ | |
| 165 | static inline struct __ntptimeval64 | |
| 166 | valid_ntptimeval_to_ntptimeval64 (const struct ntptimeval ntv) | |
| 167 | { | |
| 168 | struct __ntptimeval64 ntv64; | |
| 169 | ||
| 170 | ntv64.time = valid_timeval_to_timeval64 (ntv.time); | |
| 171 | ntv64.maxerror = ntv.maxerror; | |
| 172 | ntv64.esterror = ntv.esterror; | |
| 173 | ntv64.tai = ntv.tai; | |
| 174 | ntv64.__glibc_reserved1 = 0; | |
| 175 | ntv64.__glibc_reserved2 = 0; | |
| 176 | ntv64.__glibc_reserved3 = 0; | |
| 177 | ntv64.__glibc_reserved4 = 0; | |
| 178 | ||
| 179 | return ntv64; | |
| 180 | } | |
| 181 | ||
| 182 | /* Convert a known valid struct __ntptimeval64 into a struct ntptimeval. */ | |
| 183 | static inline struct ntptimeval | |
| 184 | valid_ntptimeval64_to_ntptimeval (const struct __ntptimeval64 ntp64) | |
| 185 | { | |
| 186 | struct ntptimeval ntp; | |
| 187 | ||
| 188 | ntp.time = valid_timeval64_to_timeval (ntp64.time); | |
| 189 | ntp.maxerror = ntp64.maxerror; | |
| 190 | ntp.esterror = ntp64.esterror; | |
| 191 | ntp.tai = ntp64.tai; | |
| 192 | ntp.__glibc_reserved1 = 0; | |
| 193 | ntp.__glibc_reserved2 = 0; | |
| 194 | ntp.__glibc_reserved3 = 0; | |
| 195 | ntp.__glibc_reserved4 = 0; | |
| 196 | ||
| 197 | return ntp; | |
| 198 | } | |
| 28 | 199 | # endif /* _ISOMAC */ |
| 29 | 200 | #endif /* sys/timex.h */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/kernel-features.h+11-5| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | /* Set flags signalling availability of kernel features based on given |
| 2 | 2 | kernel version number. |
| 3 | Copyright (C) 1999-2020 Free Software Foundation, Inc. | |
| 3 | Copyright (C) 1999-2021 Free Software Foundation, Inc. | |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 | |
| 6 | 6 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -49,10 +49,6 @@ |
| 49 | 49 | SH this appeared first in 2.6.19-rc1, on ia64 in 2.6.22-rc1. */ |
| 50 | 50 | #define __ASSUME_PSELECT	1 |
| 51 | 51 | |
| 52 | /* The *at syscalls were introduced just after 2.6.16-rc1. On PPC | |
| 53 | they were introduced in 2.6.17-rc1, on SH in 2.6.19-rc1. */ | |
| 54 | #define __ASSUME_ATFCTS	1 | |
| 55 | ||
| 56 | 52 | /* Support for inter-process robust mutexes was added in 2.6.17 (but |
| 57 | 53 | some architectures lack futex_atomic_cmpxchg_inatomic in some |
| 58 | 54 | configurations). */ |
| ... | ... | @@ -81,6 +77,8 @@ |
| 81 | 77 | #define __ASSUME_ACCEPT4_SYSCALL	1 |
| 82 | 78 | #define __ASSUME_RECVMMSG_SYSCALL	1 |
| 83 | 79 | #define __ASSUME_SENDMMSG_SYSCALL	1 |
| 80 | #define __ASSUME_GETSOCKOPT_SYSCALL	1 | |
| 81 | #define __ASSUME_SETSOCKOPT_SYSCALL	1 | |
| 84 | 82 | |
| 85 | 83 | /* Support for SysV IPC through wired syscalls. All supported architectures |
| 86 | 84 | either support ipc syscall and/or all the ipc correspondent syscalls. */ |
| ... | ... | @@ -214,4 +212,12 @@ |
| 214 | 212 | # define __ASSUME_WAITID_PID0_P_PGID |
| 215 | 213 | #endif |
| 216 | 214 | |
| 215 | /* The faccessat2 system call was introduced across all architectures | |
| 216 | in Linux 5.8. */ | |
| 217 | #if __LINUX_KERNEL_VERSION >= 0x050800 | |
| 218 | # define __ASSUME_FACCESSAT2 1 | |
| 219 | #else | |
| 220 | # define __ASSUME_FACCESSAT2 0 | |
| 221 | #endif | |
| 222 | ||
| 217 | 223 | #endif /* kernel-features.h */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/bits/stat.h deleted-172| ... | ... | @@ -1,172 +0,0 @@ |
| 1 | /* Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library. If not, see | |
| 16 | <https://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | #if !defined _SYS_STAT_H && !defined _FCNTL_H | |
| 19 | # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." | |
| 20 | #endif | |
| 21 | ||
| 22 | #ifndef _BITS_STAT_H | |
| 23 | #define _BITS_STAT_H	1 | |
| 24 | ||
| 25 | /* Versions of the `struct stat' data structure. */ | |
| 26 | #define _STAT_VER_LINUX_OLD	1 | |
| 27 | #define _STAT_VER_KERNEL	1 | |
| 28 | #define _STAT_VER_SVR4		2 | |
| 29 | #define _STAT_VER_LINUX		3 | |
| 30 | #define _STAT_VER		_STAT_VER_LINUX	/* The one defined below. */ | |
| 31 | ||
| 32 | /* Versions of the `xmknod' interface. */ | |
| 33 | #define _MKNOD_VER_LINUX	1 | |
| 34 | #define _MKNOD_VER_SVR4		2 | |
| 35 | #define _MKNOD_VER		_MKNOD_VER_LINUX /* The bits defined below. */ | |
| 36 | ||
| 37 | ||
| 38 | struct stat | |
| 39 | { | |
| 40 | __dev_t st_dev;			/* Device. */ | |
| 41 | unsigned short int __pad1; | |
| 42 | #ifndef __USE_FILE_OFFSET64 | |
| 43 | __ino_t st_ino;			/* File serial number.	*/ | |
| 44 | #else | |
| 45 | __ino_t __st_ino;			/* 32bit file serial number.	*/ | |
| 46 | #endif | |
| 47 | __mode_t st_mode;			/* File mode. */ | |
| 48 | __nlink_t st_nlink;			/* Link count. */ | |
| 49 | __uid_t st_uid;			/* User ID of the file's owner.	*/ | |
| 50 | __gid_t st_gid;			/* Group ID of the file's group.*/ | |
| 51 | __dev_t st_rdev;			/* Device number, if device. */ | |
| 52 | unsigned short int __pad2; | |
| 53 | #ifndef __USE_FILE_OFFSET64 | |
| 54 | __off_t st_size;			/* Size of file, in bytes. */ | |
| 55 | #else | |
| 56 | __off64_t st_size;			/* Size of file, in bytes. */ | |
| 57 | #endif | |
| 58 | __blksize_t st_blksize;		/* Optimal block size for I/O. */ | |
| 59 | ||
| 60 | #ifndef __USE_FILE_OFFSET64 | |
| 61 | __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */ | |
| 62 | #else | |
| 63 | __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */ | |
| 64 | #endif | |
| 65 | #ifdef __USE_XOPEN2K8 | |
| 66 | /* Nanosecond resolution timestamps are stored in a format | |
| 67 | equivalent to 'struct timespec'. This is the type used | |
| 68 | whenever possible but the Unix namespace rules do not allow the | |
| 69 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 70 | Therefore we have to handle the use of this header in strictly | |
| 71 | standard-compliant sources special. */ | |
| 72 | struct timespec st_atim;		/* Time of last access. */ | |
| 73 | struct timespec st_mtim;		/* Time of last modification. */ | |
| 74 | struct timespec st_ctim;		/* Time of last status change. */ | |
| 75 | # define st_atime st_atim.tv_sec	/* Backward compatibility. */ | |
| 76 | # define st_mtime st_mtim.tv_sec | |
| 77 | # define st_ctime st_ctim.tv_sec | |
| 78 | #else | |
| 79 | __time_t st_atime;			/* Time of last access. */ | |
| 80 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 81 | __time_t st_mtime;			/* Time of last modification. */ | |
| 82 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 83 | __time_t st_ctime;			/* Time of last status change. */ | |
| 84 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 85 | #endif | |
| 86 | #ifndef __USE_FILE_OFFSET64 | |
| 87 | unsigned long int __glibc_reserved4; | |
| 88 | unsigned long int __glibc_reserved5; | |
| 89 | #else | |
| 90 | __ino64_t st_ino;			/* File serial number.	*/ | |
| 91 | #endif | |
| 92 | }; | |
| 93 | ||
| 94 | #ifdef __USE_LARGEFILE64 | |
| 95 | struct stat64 | |
| 96 | { | |
| 97 | __dev_t st_dev;			/* Device. */ | |
| 98 | unsigned short int __pad1; | |
| 99 | ||
| 100 | __ino_t __st_ino;			/* 32bit file serial number.	*/ | |
| 101 | __mode_t st_mode;			/* File mode. */ | |
| 102 | __nlink_t st_nlink;			/* Link count. */ | |
| 103 | __uid_t st_uid;			/* User ID of the file's owner.	*/ | |
| 104 | __gid_t st_gid;			/* Group ID of the file's group.*/ | |
| 105 | __dev_t st_rdev;			/* Device number, if device. */ | |
| 106 | unsigned short int __pad2; | |
| 107 | __off64_t st_size;			/* Size of file, in bytes. */ | |
| 108 | __blksize_t st_blksize;		/* Optimal block size for I/O. */ | |
| 109 | ||
| 110 | __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */ | |
| 111 | # ifdef __USE_XOPEN2K8 | |
| 112 | /* Nanosecond resolution timestamps are stored in a format | |
| 113 | equivalent to 'struct timespec'. This is the type used | |
| 114 | whenever possible but the Unix namespace rules do not allow the | |
| 115 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 116 | Therefore we have to handle the use of this header in strictly | |
| 117 | standard-compliant sources special. */ | |
| 118 | struct timespec st_atim;		/* Time of last access. */ | |
| 119 | struct timespec st_mtim;		/* Time of last modification. */ | |
| 120 | struct timespec st_ctim;		/* Time of last status change. */ | |
| 121 | # else | |
| 122 | __time_t st_atime;			/* Time of last access. */ | |
| 123 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 124 | __time_t st_mtime;			/* Time of last modification. */ | |
| 125 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 126 | __time_t st_ctime;			/* Time of last status change. */ | |
| 127 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 128 | # endif | |
| 129 | __ino64_t st_ino;			/* File serial number.		*/ | |
| 130 | }; | |
| 131 | #endif | |
| 132 | ||
| 133 | /* Tell code we have these members. */ | |
| 134 | #define	_STATBUF_ST_BLKSIZE | |
| 135 | #define _STATBUF_ST_RDEV | |
| 136 | /* Nanosecond resolution time values are supported. */ | |
| 137 | #define _STATBUF_ST_NSEC | |
| 138 | ||
| 139 | /* Encoding of the file mode. */ | |
| 140 | ||
| 141 | #define	__S_IFMT	0170000	/* These bits determine file type. */ | |
| 142 | ||
| 143 | /* File types. */ | |
| 144 | #define	__S_IFDIR	0040000	/* Directory. */ | |
| 145 | #define	__S_IFCHR	0020000	/* Character device. */ | |
| 146 | #define	__S_IFBLK	0060000	/* Block device. */ | |
| 147 | #define	__S_IFREG	0100000	/* Regular file. */ | |
| 148 | #define	__S_IFIFO	0010000	/* FIFO. */ | |
| 149 | #define	__S_IFLNK	0120000	/* Symbolic link. */ | |
| 150 | #define	__S_IFSOCK	0140000	/* Socket. */ | |
| 151 | ||
| 152 | /* POSIX.1b objects. Note that these macros always evaluate to zero. But | |
| 153 | they do it by enforcing the correct use of the macros. */ | |
| 154 | #define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 155 | #define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 156 | #define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 157 | ||
| 158 | /* Protection bits. */ | |
| 159 | ||
| 160 | #define	__S_ISUID	04000	/* Set user ID on execution. */ | |
| 161 | #define	__S_ISGID	02000	/* Set group ID on execution. */ | |
| 162 | #define	__S_ISVTX	01000	/* Save swapped text after use (sticky). */ | |
| 163 | #define	__S_IREAD	0400	/* Read by owner. */ | |
| 164 | #define	__S_IWRITE	0200	/* Write by owner. */ | |
| 165 | #define	__S_IEXEC	0100	/* Execute by owner. */ | |
| 166 | ||
| 167 | #ifdef __USE_ATFILE | |
| 168 | # define UTIME_NOW	((1l << 30) - 1l) | |
| 169 | # define UTIME_OMIT	((1l << 30) - 2l) | |
| 170 | #endif | |
| 171 | ||
| 172 | #endif	/* bits/stat.h */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/coldfire/sysdep.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 2010-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 2010-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/kernel-features.h+3-3| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | /* Set flags signalling availability of kernel features based on given |
| 2 | 2 | kernel version number. |
| 3 | Copyright (C) 2008-2020 Free Software Foundation, Inc. | |
| 3 | Copyright (C) 2008-2021 Free Software Foundation, Inc. | |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 | |
| 6 | 6 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -23,8 +23,6 @@ |
| 23 | 23 | # define __ASSUME_SOCKETPAIR_SYSCALL 1 |
| 24 | 24 | # define __ASSUME_BIND_SYSCALL 1 |
| 25 | 25 | # define __ASSUME_LISTEN_SYSCALL 1 |
| 26 | # define __ASSUME_GETSOCKOPT_SYSCALL 1 | |
| 27 | # define __ASSUME_SETSOCKOPT_SYSCALL 1 | |
| 28 | 26 | # define __ASSUME_GETSOCKNAME_SYSCALL 1 |
| 29 | 27 | # define __ASSUME_GETPEERNAME_SYSCALL 1 |
| 30 | 28 | # define __ASSUME_SHUTDOWN_SYSCALL 1 |
| ... | ... | @@ -43,6 +41,8 @@ |
| 43 | 41 | # undef __ASSUME_CONNECT_SYSCALL |
| 44 | 42 | # undef __ASSUME_RECVFROM_SYSCALL |
| 45 | 43 | # undef __ASSUME_SENDTO_SYSCALL |
| 44 | # undef __ASSUME_GETSOCKOPT_SYSCALL | |
| 45 | # undef __ASSUME_SETSOCKOPT_SYSCALL | |
| 46 | 46 | #endif |
| 47 | 47 | |
| 48 | 48 | /* No support for PI futexes or robust mutexes before 3.10 for m68k. */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/m680x0/sysdep.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 2010-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 2010-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/sysdep.h+8-26| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1996-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1996-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | Written by Andreas Schwab, <schwab@issan.informatik.uni-dortmund.de>, |
| 4 | 4 | December 1995. |
| ... | ... | @@ -44,6 +44,7 @@ |
| 44 | 44 | |
| 45 | 45 | /* We don't want the label for the error handler to be visible in the symbol |
| 46 | 46 | table when we define it here. */ |
| 47 | #undef SYSCALL_ERROR_LABEL | |
| 47 | 48 | #ifdef PIC |
| 48 | 49 | #define SYSCALL_ERROR_LABEL .Lsyscall_error |
| 49 | 50 | #else |
| ... | ... | @@ -221,27 +222,12 @@ SYSCALL_ERROR_LABEL:							 \ |
| 221 | 222 | |
| 222 | 223 | #else /* not __ASSEMBLER__ */ |
| 223 | 224 | |
| 224 | /* Define a macro which expands into the inline wrapper code for a system | |
| 225 | call. */ | |
| 226 | #undef INLINE_SYSCALL | |
| 227 | #define INLINE_SYSCALL(name, nr, args...)				\ | |
| 228 | ({ unsigned int _sys_result = INTERNAL_SYSCALL (name, , nr, args);	\ | |
| 229 | if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\ | |
| 230 | {								\ | |
| 231 | 	 __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, ));		\ | |
| 232 | 	 _sys_result = (unsigned int) -1;				\ | |
| 233 | }								\ | |
| 234 | (int) _sys_result; }) | |
| 235 | ||
| 236 | #undef INTERNAL_SYSCALL_DECL | |
| 237 | #define INTERNAL_SYSCALL_DECL(err) do { } while (0) | |
| 238 | ||
| 239 | 225 | /* Define a macro which expands inline into the wrapper code for a system |
| 240 | 226 | call. This use is for internal calls that do not need to handle errors |
| 241 | 227 | normally. It will never touch errno. This returns just what the kernel |
| 242 | 228 | gave back. */ |
| 243 | 229 | #undef INTERNAL_SYSCALL |
| 244 | #define INTERNAL_SYSCALL_NCS(name, err, nr, args...)	\ | |
| 230 | #define INTERNAL_SYSCALL_NCS(name, nr, args...)	\ | |
| 245 | 231 | ({ unsigned int _sys_result;				\ |
| 246 | 232 | {							\ |
| 247 | 233 | /* Load argument values in temporary variables |
| ... | ... | @@ -257,15 +243,8 @@ SYSCALL_ERROR_LABEL:							 \ |
| 257 | 243 | _sys_result = _d0;				\ |
| 258 | 244 | }							\ |
| 259 | 245 | (int) _sys_result; }) |
| 260 | #define INTERNAL_SYSCALL(name, err, nr, args...)	\ | |
| 261 | INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) | |
| 262 | ||
| 263 | #undef INTERNAL_SYSCALL_ERROR_P | |
| 264 | #define INTERNAL_SYSCALL_ERROR_P(val, err)		\ | |
| 265 | ((unsigned int) (val) >= -4095U) | |
| 266 | ||
| 267 | #undef INTERNAL_SYSCALL_ERRNO | |
| 268 | #define INTERNAL_SYSCALL_ERRNO(val, err)	(-(val)) | |
| 246 | #define INTERNAL_SYSCALL(name, nr, args...)	\ | |
| 247 | INTERNAL_SYSCALL_NCS (__NR_##name, nr, ##args) | |
| 269 | 248 | |
| 270 | 249 | #define LOAD_ARGS_0() |
| 271 | 250 | #define LOAD_REGS_0 |
| ... | ... | @@ -313,6 +292,9 @@ SYSCALL_ERROR_LABEL:							 \ |
| 313 | 292 | LOAD_REGS_5 |
| 314 | 293 | #define ASM_ARGS_6	ASM_ARGS_5, "a" (_a0) |
| 315 | 294 | |
| 295 | #undef HAVE_INTERNAL_BRK_ADDR_SYMBOL | |
| 296 | #define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 | |
| 297 | ||
| 316 | 298 | #endif /* not __ASSEMBLER__ */ |
| 317 | 299 | |
| 318 | 300 | /* Pointer mangling is not yet supported for M68K. */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/xstatver.h created+13| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | /* Versions of the 'struct stat' data structure used in compatibility xstat | |
| 2 | functions. */ | |
| 3 | #define _STAT_VER_LINUX_OLD	1 | |
| 4 | #define _STAT_VER_KERNEL	1 | |
| 5 | #define _STAT_VER_SVR4		2 | |
| 6 | #define _STAT_VER_LINUX		3 | |
| 7 | #define _STAT_VER		_STAT_VER_LINUX | |
| 8 | ||
| 9 | /* Versions of the 'xmknod' interface used in compatibility xmknod | |
| 10 | functions. */ | |
| 11 | #define _MKNOD_VER_LINUX	1 | |
| 12 | #define _MKNOD_VER_SVR4		2 | |
| 13 | #define _MKNOD_VER		_MKNOD_VER_LINUX |
lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/bits/stat.h deleted-203| ... | ... | @@ -1,203 +0,0 @@ |
| 1 | /* Copyright (C) 1997-2020 Free Software Foundation, Inc. | |
| 2 | ||
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public License as | |
| 7 | published by the Free Software Foundation; either version 2.1 of the | |
| 8 | License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <https://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #if !defined _SYS_STAT_H && !defined _FCNTL_H | |
| 20 | # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | #ifndef _BITS_STAT_H | |
| 24 | #define _BITS_STAT_H	1 | |
| 25 | ||
| 26 | /* Versions of the `struct stat' data structure. */ | |
| 27 | #define _STAT_VER_LINUX_OLD 1 | |
| 28 | #define _STAT_VER_KERNEL 1 | |
| 29 | #define _STAT_VER_SVR4 2 | |
| 30 | #define _STAT_VER_LINUX 3 | |
| 31 | #define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ | |
| 32 | ||
| 33 | /* Versions of the `xmknod' interface. */ | |
| 34 | #define _MKNOD_VER_LINUX 1 | |
| 35 | #define _MKNOD_VER_SVR4 2 | |
| 36 | #define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ | |
| 37 | ||
| 38 | #ifndef __USE_FILE_OFFSET64 | |
| 39 | struct stat | |
| 40 | { | |
| 41 | __dev_t st_dev; /* Device. */ | |
| 42 | __ino_t st_ino; /* File serial number. */ | |
| 43 | __mode_t st_mode; /* File mode. */ | |
| 44 | __nlink_t st_nlink; /* Link count. */ | |
| 45 | __uid_t st_uid; /* User ID of the file's owner. */ | |
| 46 | __gid_t st_gid; /* Group ID of the file's group. */ | |
| 47 | __dev_t st_rdev; /* Device number, if device. */ | |
| 48 | unsigned long __pad2; | |
| 49 | __off_t st_size; /* Size of file, in bytes. */ | |
| 50 | __blksize_t st_blksize; /* Optimal block size for I/O. */ | |
| 51 | int __pad3; | |
| 52 | __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ | |
| 53 | #ifdef __USE_XOPEN2K8 | |
| 54 | /* Nanosecond resolution timestamps are stored in a format | |
| 55 | * equivalent to 'struct timespec'. This is the type used | |
| 56 | * whenever possible but the Unix namespace rules do not allow the | |
| 57 | * identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 58 | * Therefore we have to handle the use of this header in strictly | |
| 59 | * standard-compliant sources special. */ | |
| 60 | struct timespec st_atim; /* Time of last access. */ | |
| 61 | struct timespec st_mtim; /* Time of last modification. */ | |
| 62 | struct timespec st_ctim; /* Time of last status change. */ | |
| 63 | # define st_atime st_atim.tv_sec /* Backward compatibility. */ | |
| 64 | # define st_mtime st_mtim.tv_sec | |
| 65 | # define st_ctime st_ctim.tv_sec | |
| 66 | #else | |
| 67 | __time_t st_atime; /* Time of last access. */ | |
| 68 | unsigned long int st_atimensec; /* Nscecs of last access. */ | |
| 69 | __time_t st_mtime; /* Time of last modification. */ | |
| 70 | unsigned long int st_mtimensec; /* Nsecs of last modification. */ | |
| 71 | __time_t st_ctime; /* Time of last status change. */ | |
| 72 | unsigned long int st_ctimensec; /* Nsecs of last status change. */ | |
| 73 | #endif | |
| 74 | unsigned int __glibc_reserved4; | |
| 75 | unsigned int __glibc_reserved5; | |
| 76 | }; | |
| 77 | #else /* __USE_FILE_OFFSET64 */ | |
| 78 | /* MS: If __USE_FILE_OFFSET64 is setup then struct stat should match stat64 | |
| 79 | * structure. Glibc has no type __dev64_t that's why I had to use standard | |
| 80 | * type for st_dev and st_rdev. Several architectures uses pads after st_dev | |
| 81 | * but this approach covers BIG and LITTLE endian. I think it is better to | |
| 82 | * create one ifdef to separate stats structures. */ | |
| 83 | struct stat | |
| 84 | { | |
| 85 | unsigned long long st_dev; /* Device. */ | |
| 86 | __ino64_t st_ino; /* 32bit file serial number. */ | |
| 87 | __mode_t st_mode; /* File mode. */ | |
| 88 | __nlink_t st_nlink; /* Link count. */ | |
| 89 | __uid_t st_uid; /* User ID of the file's owner. */ | |
| 90 | __gid_t st_gid; /* Group ID of the file's group. */ | |
| 91 | unsigned long long st_rdev; /* Device number, if device. */ | |
| 92 | unsigned long long __pad2; | |
| 93 | __off64_t st_size; /* Size of file, in bytes. */ | |
| 94 | __blksize_t st_blksize; /* Optimal block size for I/O. */ | |
| 95 | int __pad3; | |
| 96 | __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ | |
| 97 | #ifdef __USE_MISC | |
| 98 | /* Nanosecond resolution timestamps are stored in a format | |
| 99 | * equivalent to 'struct timespec'. This is the type used | |
| 100 | * whenever possible but the Unix namespace rules do not allow the | |
| 101 | * identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 102 | * Therefore we have to handle the use of this header in strictly | |
| 103 | * standard-compliant sources special. */ | |
| 104 | struct timespec st_atim; /* Time of last access. */ | |
| 105 | struct timespec st_mtim; /* Time of last modification. */ | |
| 106 | struct timespec st_ctim; /* Time of last status change. */ | |
| 107 | # define st_atime st_atim.tv_sec /* Backward compatibility. */ | |
| 108 | # define st_mtime st_mtim.tv_sec | |
| 109 | # define st_ctime st_ctim.tv_sec | |
| 110 | #else | |
| 111 | __time_t st_atime; /* Time of last access. */ | |
| 112 | unsigned long int st_atimensec; /* Nscecs of last access. */ | |
| 113 | __time_t st_mtime; /* Time of last modification. */ | |
| 114 | unsigned long int st_mtimensec; /* Nsecs of last modification. */ | |
| 115 | __time_t st_ctime; /* Time of last status change. */ | |
| 116 | unsigned long int st_ctimensec; /* Nsecs of last status change. */ | |
| 117 | #endif | |
| 118 | unsigned int __glibc_reserved4; | |
| 119 | unsigned int __glibc_reserved5; | |
| 120 | }; | |
| 121 | #endif /* __USE_FILE_OFFSET64 */ | |
| 122 | ||
| 123 | #ifdef __USE_LARGEFILE64 | |
| 124 | struct stat64 | |
| 125 | { | |
| 126 | unsigned long long st_dev; /* Device. */ | |
| 127 | __ino64_t st_ino; /* 32bit file serial number. */ | |
| 128 | __mode_t st_mode; /* File mode. */ | |
| 129 | __nlink_t st_nlink; /* Link count. */ | |
| 130 | __uid_t st_uid; /* User ID of the file's owner. */ | |
| 131 | __gid_t st_gid; /* Group ID of the file's group. */ | |
| 132 | unsigned long long st_rdev; /* Device number, if device. */ | |
| 133 | unsigned long long __pad2; | |
| 134 | __off64_t st_size; /* Size of file, in bytes. */ | |
| 135 | __blksize_t st_blksize; /* Optimal block size for I/O. */ | |
| 136 | int __pad3; | |
| 137 | __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ | |
| 138 | #ifdef __USE_XOPEN2K8 | |
| 139 | /* Nanosecond resolution timestamps are stored in a format | |
| 140 | * equivalent to 'struct timespec'. This is the type used | |
| 141 | * whenever possible but the Unix namespace rules do not allow the | |
| 142 | * identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 143 | * Therefore we have to handle the use of this header in strictly | |
| 144 | * standard-compliant sources special. */ | |
| 145 | struct timespec st_atim; /* Time of last access. */ | |
| 146 | struct timespec st_mtim; /* Time of last modification. */ | |
| 147 | struct timespec st_ctim; /* Time of last status change. */ | |
| 148 | # define st_atime st_atim.tv_sec /* Backward compatibility. */ | |
| 149 | # define st_mtime st_mtim.tv_sec | |
| 150 | # define st_ctime st_ctim.tv_sec | |
| 151 | #else | |
| 152 | __time_t st_atime; /* Time of last access. */ | |
| 153 | unsigned long int st_atimensec; /* Nscecs of last access. */ | |
| 154 | __time_t st_mtime; /* Time of last modification. */ | |
| 155 | unsigned long int st_mtimensec; /* Nsecs of last modification. */ | |
| 156 | __time_t st_ctime; /* Time of last status change. */ | |
| 157 | unsigned long int st_ctimensec; /* Nsecs of last status change. */ | |
| 158 | #endif | |
| 159 | unsigned int __glibc_reserved4; | |
| 160 | unsigned int __glibc_reserved5; | |
| 161 | }; | |
| 162 | #endif | |
| 163 | ||
| 164 | /* Tell code we have these members. */ | |
| 165 | #define _STATBUF_ST_BLKSIZE | |
| 166 | #define _STATBUF_ST_RDEV | |
| 167 | /* Nanosecond resolution time values are supported. */ | |
| 168 | #define _STATBUF_ST_NSEC | |
| 169 | ||
| 170 | /* Encoding of the file mode. */ | |
| 171 | ||
| 172 | #define __S_IFMT 0170000 /* These bits determine file type. */ | |
| 173 | ||
| 174 | /* File types. */ | |
| 175 | #define __S_IFDIR 0040000 /* Directory. */ | |
| 176 | #define __S_IFCHR 0020000 /* Character device. */ | |
| 177 | #define __S_IFBLK 0060000 /* Block device. */ | |
| 178 | #define __S_IFREG 0100000 /* Regular file. */ | |
| 179 | #define __S_IFIFO 0010000 /* FIFO. */ | |
| 180 | #define __S_IFLNK 0120000 /* Symbolic link. */ | |
| 181 | #define __S_IFSOCK 0140000 /* Socket. */ | |
| 182 | ||
| 183 | /* POSIX.1b objects. Note that these macros always evaluate to zero. But | |
| 184 | they do it by enforcing the correct use of the macros. */ | |
| 185 | #define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 186 | #define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 187 | #define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 188 | ||
| 189 | /* Protection bits. */ | |
| 190 | ||
| 191 | #define __S_ISUID 04000 /* Set user ID on execution. */ | |
| 192 | #define __S_ISGID 02000 /* Set group ID on execution. */ | |
| 193 | #define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ | |
| 194 | #define __S_IREAD 0400 /* Read by owner. */ | |
| 195 | #define __S_IWRITE 0200 /* Write by owner. */ | |
| 196 | #define __S_IEXEC 0100 /* Execute by owner. */ | |
| 197 | ||
| 198 | #ifdef __USE_ATFILE | |
| 199 | # define UTIME_NOW	((1l << 30) - 1l) | |
| 200 | # define UTIME_OMIT	((1l << 30) - 2l) | |
| 201 | #endif | |
| 202 | ||
| 203 | #endif	/* bits/stat.h. */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/kernel-features.h+1-3| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 2011-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 2011-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -28,8 +28,6 @@ |
| 28 | 28 | #define __ASSUME_SEND_SYSCALL		1 |
| 29 | 29 | #define __ASSUME_RECV_SYSCALL		1 |
| 30 | 30 | #define __ASSUME_SHUTDOWN_SYSCALL	1 |
| 31 | #define __ASSUME_GETSOCKOPT_SYSCALL	1 | |
| 32 | #define __ASSUME_SETSOCKOPT_SYSCALL	1 | |
| 33 | 31 | |
| 34 | 32 | #include_next <kernel-features.h> |
| 35 | 33 |
lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/sysdep.h+65-62| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 2000-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 2000-2021 Free Software Foundation, Inc. | |
| 2 | 2 | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| ... | ... | @@ -26,6 +26,8 @@ |
| 26 | 26 | /* Defines RTLD_PRIVATE_ERRNO. */ |
| 27 | 27 | #include <dl-sysdep.h> |
| 28 | 28 | |
| 29 | #include <tls.h> | |
| 30 | ||
| 29 | 31 | /* In order to get __set_errno() definition in INLINE_SYSCALL. */ |
| 30 | 32 | #ifndef __ASSEMBLER__ |
| 31 | 33 | # include <errno.h> |
| ... | ... | @@ -60,6 +62,7 @@ |
| 60 | 62 | |
| 61 | 63 | /* We don't want the label for the error handler to be visible in the symbol |
| 62 | 64 | table when we define it here. */ |
| 65 | # undef SYSCALL_ERROR_LABEL | |
| 63 | 66 | # ifdef PIC |
| 64 | 67 | # define SYSCALL_ERROR_LABEL 0f |
| 65 | 68 | # else |
| ... | ... | @@ -163,42 +166,18 @@ SYSCALL_ERROR_LABEL_DCL: \ |
| 163 | 166 | |
| 164 | 167 | #else /* not __ASSEMBLER__ */ |
| 165 | 168 | |
| 166 | /* Define a macro which expands into the inline wrapper code for a system | |
| 167 | call. */ | |
| 168 | # undef INLINE_SYSCALL | |
| 169 | # define INLINE_SYSCALL(name, nr, args...) \ | |
| 170 | ({ INTERNAL_SYSCALL_DECL(err); \ | |
| 171 | unsigned long resultvar = INTERNAL_SYSCALL(name, err, nr, args); \ | |
| 172 | if (INTERNAL_SYSCALL_ERROR_P (resultvar, err)) \ | |
| 173 | { \ | |
| 174 | __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, err)); \ | |
| 175 | resultvar = (unsigned long) -1; \ | |
| 176 | } \ | |
| 177 | (long) resultvar; \ | |
| 178 | }) | |
| 179 | ||
| 180 | # undef INTERNAL_SYSCALL_DECL | |
| 181 | # define INTERNAL_SYSCALL_DECL(err) do { } while (0) | |
| 182 | ||
| 183 | 169 | /* Define a macro which expands inline into the wrapper code for a system |
| 184 | 170 | call. This use is for internal calls that do not need to handle errors |
| 185 | 171 | normally. It will never touch errno. This returns just what the kernel |
| 186 | 172 | gave back. */ |
| 187 | 173 | # undef INTERNAL_SYSCALL |
| 188 | # define INTERNAL_SYSCALL(name, err, nr, args...) \ | |
| 174 | # define INTERNAL_SYSCALL(name, nr, args...) \ | |
| 189 | 175 | inline_syscall##nr(SYS_ify(name), args) |
| 190 | 176 | |
| 191 | 177 | # undef INTERNAL_SYSCALL_NCS |
| 192 | # define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ | |
| 178 | # define INTERNAL_SYSCALL_NCS(name, nr, args...) \ | |
| 193 | 179 | inline_syscall##nr(name, args) |
| 194 | 180 | |
| 195 | # undef INTERNAL_SYSCALL_ERROR_P | |
| 196 | # define INTERNAL_SYSCALL_ERROR_P(val, err) \ | |
| 197 | ((unsigned int) (val) >= -4095U) | |
| 198 | ||
| 199 | # undef INTERNAL_SYSCALL_ERRNO | |
| 200 | # define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) | |
| 201 | ||
| 202 | 181 | # define SYSCALL_CLOBBERS_6 "r11", "r4", "memory" |
| 203 | 182 | # define SYSCALL_CLOBBERS_5 "r10", SYSCALL_CLOBBERS_6 |
| 204 | 183 | # define SYSCALL_CLOBBERS_4 "r9", SYSCALL_CLOBBERS_5 |
| ... | ... | @@ -209,8 +188,8 @@ SYSCALL_ERROR_LABEL_DCL: \ |
| 209 | 188 | |
| 210 | 189 | # define inline_syscall0(name,dummy) \ |
| 211 | 190 | ({ \ |
| 212 | register long __ret __asm__("r3"); \ | |
| 213 | register long __r12 __asm__("r12") = name; \ | |
| 191 | register long int __ret __asm__("r3"); \ | |
| 192 | register long int __r12 __asm__("r12") = name; \ | |
| 214 | 193 | __asm__ __volatile__( "brki r14,8; nop;" \ |
| 215 | 194 | : "=r"(__ret) \ |
| 216 | 195 | : "r"(__r12) \ |
| ... | ... | @@ -219,9 +198,10 @@ SYSCALL_ERROR_LABEL_DCL: \ |
| 219 | 198 | |
| 220 | 199 | # define inline_syscall1(name,arg1) \ |
| 221 | 200 | ({ \ |
| 222 | register long __ret __asm__("r3"); \ | |
| 223 | register long __r12 __asm__("r12") = name; \ | |
| 224 | register long __r5 __asm__("r5") = (long)(arg1); \ | |
| 201 | long int __arg1 = (long int) (arg1); \ | |
| 202 | register long int __ret __asm__("r3"); \ | |
| 203 | register long int __r12 __asm__("r12") = name; \ | |
| 204 | register long int __r5 __asm__("r5") = __arg1; \ | |
| 225 | 205 | __asm__ __volatile__( "brki r14,8; nop;" \ |
| 226 | 206 | : "=r"(__ret) \ |
| 227 | 207 | : "r"(__r5), "r"(__r12) \ |
| ... | ... | @@ -230,10 +210,12 @@ SYSCALL_ERROR_LABEL_DCL: \ |
| 230 | 210 | |
| 231 | 211 | # define inline_syscall2(name,arg1,arg2) \ |
| 232 | 212 | ({ \ |
| 233 | register long __ret __asm__("r3"); \ | |
| 234 | register long __r12 __asm__("r12") = name; \ | |
| 235 | register long __r5 __asm__("r5") = (long)(arg1); \ | |
| 236 | register long __r6 __asm__("r6") = (long)(arg2); \ | |
| 213 | long int __arg1 = (long int) (arg1); \ | |
| 214 | long int __arg2 = (long int) (arg2); \ | |
| 215 | register long int __ret __asm__("r3"); \ | |
| 216 | register long int __r12 __asm__("r12") = name; \ | |
| 217 | register long int __r5 __asm__("r5") = __arg1; \ | |
| 218 | register long int __r6 __asm__("r6") = __arg2; \ | |
| 237 | 219 | __asm__ __volatile__( "brki r14,8; nop;" \ |
| 238 | 220 | : "=r"(__ret) \ |
| 239 | 221 | : "r"(__r5), "r"(__r6), "r"(__r12) \ |
| ... | ... | @@ -243,11 +225,14 @@ SYSCALL_ERROR_LABEL_DCL: \ |
| 243 | 225 | |
| 244 | 226 | # define inline_syscall3(name,arg1,arg2,arg3) \ |
| 245 | 227 | ({ \ |
| 246 | register long __ret __asm__("r3"); \ | |
| 247 | register long __r12 __asm__("r12") = name; \ | |
| 248 | register long __r5 __asm__("r5") = (long)(arg1); \ | |
| 249 | register long __r6 __asm__("r6") = (long)(arg2); \ | |
| 250 | register long __r7 __asm__("r7") = (long)(arg3); \ | |
| 228 | long int __arg1 = (long int) (arg1); \ | |
| 229 | long int __arg2 = (long int) (arg2); \ | |
| 230 | long int __arg3 = (long int) (arg3); \ | |
| 231 | register long int __ret __asm__("r3"); \ | |
| 232 | register long int __r12 __asm__("r12") = name; \ | |
| 233 | register long int __r5 __asm__("r5") = __arg1; \ | |
| 234 | register long int __r6 __asm__("r6") = __arg2; \ | |
| 235 | register long int __r7 __asm__("r7") = __arg3; \ | |
| 251 | 236 | __asm__ __volatile__( "brki r14,8; nop;" \ |
| 252 | 237 | : "=r"(__ret) \ |
| 253 | 238 | : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r12) \ |
| ... | ... | @@ -257,12 +242,16 @@ SYSCALL_ERROR_LABEL_DCL: \ |
| 257 | 242 | |
| 258 | 243 | # define inline_syscall4(name,arg1,arg2,arg3,arg4) \ |
| 259 | 244 | ({ \ |
| 260 | register long __ret __asm__("r3"); \ | |
| 261 | register long __r12 __asm__("r12") = name; \ | |
| 262 | register long __r5 __asm__("r5") = (long)(arg1); \ | |
| 263 | register long __r6 __asm__("r6") = (long)(arg2); \ | |
| 264 | register long __r7 __asm__("r7") = (long)(arg3); \ | |
| 265 | register long __r8 __asm__("r8") = (long)(arg4); \ | |
| 245 | long int __arg1 = (long int) (arg1); \ | |
| 246 | long int __arg2 = (long int) (arg2); \ | |
| 247 | long int __arg3 = (long int) (arg3); \ | |
| 248 | long int __arg4 = (long int) (arg4); \ | |
| 249 | register long int __ret __asm__("r3"); \ | |
| 250 | register long int __r12 __asm__("r12") = name; \ | |
| 251 | register long int __r5 __asm__("r5") = __arg1; \ | |
| 252 | register long int __r6 __asm__("r6") = __arg2; \ | |
| 253 | register long int __r7 __asm__("r7") = __arg3; \ | |
| 254 | register long int __r8 __asm__("r8") = __arg4; \ | |
| 266 | 255 | __asm__ __volatile__( "brki r14,8; nop;" \ |
| 267 | 256 | : "=r"(__ret) \ |
| 268 | 257 | : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r12) \ |
| ... | ... | @@ -272,13 +261,18 @@ SYSCALL_ERROR_LABEL_DCL: \ |
| 272 | 261 | |
| 273 | 262 | # define inline_syscall5(name,arg1,arg2,arg3,arg4,arg5) \ |
| 274 | 263 | ({ \ |
| 275 | register long __ret __asm__("r3"); \ | |
| 276 | register long __r12 __asm__("r12") = name; \ | |
| 277 | register long __r5 __asm__("r5") = (long)(arg1); \ | |
| 278 | register long __r6 __asm__("r6") = (long)(arg2); \ | |
| 279 | register long __r7 __asm__("r7") = (long)(arg3); \ | |
| 280 | register long __r8 __asm__("r8") = (long)(arg4); \ | |
| 281 | register long __r9 __asm__("r9") = (long)(arg5); \ | |
| 264 | long int __arg1 = (long int) (arg1); \ | |
| 265 | long int __arg2 = (long int) (arg2); \ | |
| 266 | long int __arg3 = (long int) (arg3); \ | |
| 267 | long int __arg4 = (long int) (arg4); \ | |
| 268 | long int __arg5 = (long int) (arg5); \ | |
| 269 | register long int __ret __asm__("r3"); \ | |
| 270 | register long int __r12 __asm__("r12") = name; \ | |
| 271 | register long int __r5 __asm__("r5") = __arg1; \ | |
| 272 | register long int __r6 __asm__("r6") = __arg2; \ | |
| 273 | register long int __r7 __asm__("r7") = __arg3; \ | |
| 274 | register long int __r8 __asm__("r8") = __arg4; \ | |
| 275 | register long int __r9 __asm__("r9") = __arg5; \ | |
| 282 | 276 | __asm__ __volatile__( "brki r14,8; nop;" \ |
| 283 | 277 | : "=r"(__ret) \ |
| 284 | 278 | : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r9), "r"(__r12) \ |
| ... | ... | @@ -288,14 +282,20 @@ SYSCALL_ERROR_LABEL_DCL: \ |
| 288 | 282 | |
| 289 | 283 | # define inline_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \ |
| 290 | 284 | ({ \ |
| 291 | register long __ret __asm__("r3"); \ | |
| 292 | register long __r12 __asm__("r12") = name; \ | |
| 293 | register long __r5 __asm__("r5") = (long)(arg1); \ | |
| 294 | register long __r6 __asm__("r6") = (long)(arg2); \ | |
| 295 | register long __r7 __asm__("r7") = (long)(arg3); \ | |
| 296 | register long __r8 __asm__("r8") = (long)(arg4); \ | |
| 297 | register long __r9 __asm__("r9") = (long)(arg5); \ | |
| 298 | register long __r10 __asm__("r10") = (long)(arg6); \ | |
| 285 | long int __arg1 = (long int) (arg1); \ | |
| 286 | long int __arg2 = (long int) (arg2); \ | |
| 287 | long int __arg3 = (long int) (arg3); \ | |
| 288 | long int __arg4 = (long int) (arg4); \ | |
| 289 | long int __arg5 = (long int) (arg5); \ | |
| 290 | long int __arg6 = (long int) (arg6); \ | |
| 291 | register long int __ret __asm__("r3"); \ | |
| 292 | register long int __r12 __asm__("r12") = name; \ | |
| 293 | register long int __r5 __asm__("r5") = __arg1; \ | |
| 294 | register long int __r6 __asm__("r6") = __arg2; \ | |
| 295 | register long int __r7 __asm__("r7") = __arg3; \ | |
| 296 | register long int __r8 __asm__("r8") = __arg4; \ | |
| 297 | register long int __r9 __asm__("r9") = __arg5; \ | |
| 298 | register long int __r10 __asm__("r10") = __arg6; \ | |
| 299 | 299 | __asm__ __volatile__( "brki r14,8; nop;" \ |
| 300 | 300 | : "=r"(__ret) \ |
| 301 | 301 | : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r9), "r"(__r10), \ |
| ... | ... | @@ -310,6 +310,9 @@ SYSCALL_ERROR_LABEL_DCL: \ |
| 310 | 310 | |
| 311 | 311 | # define SINGLE_THREAD_BY_GLOBAL	1 |
| 312 | 312 | |
| 313 | #undef HAVE_INTERNAL_BRK_ADDR_SYMBOL | |
| 314 | #define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 | |
| 315 | ||
| 313 | 316 | #endif /* not __ASSEMBLER__ */ |
| 314 | 317 | |
| 315 | 318 | #endif /* _LINUX_MICROBLAZE_SYSDEP_H */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/mips/bits/stat.h deleted-263| ... | ... | @@ -1,263 +0,0 @@ |
| 1 | /* Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library. If not, see | |
| 16 | <https://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | #if !defined _SYS_STAT_H && !defined _FCNTL_H | |
| 19 | # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." | |
| 20 | #endif | |
| 21 | ||
| 22 | #ifndef _BITS_STAT_H | |
| 23 | #define _BITS_STAT_H	1 | |
| 24 | ||
| 25 | #include <sgidefs.h> | |
| 26 | ||
| 27 | /* Versions of the `struct stat' data structure. */ | |
| 28 | #define _STAT_VER_LINUX_OLD	1 | |
| 29 | #define _STAT_VER_KERNEL	1 | |
| 30 | #define _STAT_VER_SVR4		2 | |
| 31 | #define _STAT_VER_LINUX		3 | |
| 32 | #define _STAT_VER		_STAT_VER_LINUX /* The one defined below. */ | |
| 33 | ||
| 34 | /* Versions of the `xmknod' interface. */ | |
| 35 | #define _MKNOD_VER_LINUX	1 | |
| 36 | #define _MKNOD_VER_SVR4		2 | |
| 37 | #define _MKNOD_VER		_MKNOD_VER_LINUX /* The bits defined below. */ | |
| 38 | ||
| 39 | ||
| 40 | #if _MIPS_SIM == _ABIO32 | |
| 41 | /* Structure describing file characteristics. */ | |
| 42 | struct stat | |
| 43 | { | |
| 44 | unsigned long int st_dev; | |
| 45 | long int st_pad1[3]; | |
| 46 | #ifndef __USE_FILE_OFFSET64 | |
| 47 | __ino_t st_ino;		/* File serial number.		*/ | |
| 48 | #else | |
| 49 | __ino64_t st_ino;		/* File serial number.		*/ | |
| 50 | #endif | |
| 51 | __mode_t st_mode;		/* File mode. */ | |
| 52 | __nlink_t st_nlink;		/* Link count. */ | |
| 53 | __uid_t st_uid;		/* User ID of the file's owner.	*/ | |
| 54 | __gid_t st_gid;		/* Group ID of the file's group.*/ | |
| 55 | unsigned long int st_rdev;	/* Device number, if device. */ | |
| 56 | #ifndef __USE_FILE_OFFSET64 | |
| 57 | long int st_pad2[2]; | |
| 58 | __off_t st_size;		/* Size of file, in bytes. */ | |
| 59 | /* SVR4 added this extra long to allow for expansion of off_t. */ | |
| 60 | long int st_pad3; | |
| 61 | #else | |
| 62 | long int st_pad2[3]; | |
| 63 | __off64_t st_size;		/* Size of file, in bytes. */ | |
| 64 | #endif | |
| 65 | #ifdef __USE_XOPEN2K8 | |
| 66 | /* Nanosecond resolution timestamps are stored in a format | |
| 67 | equivalent to 'struct timespec'. This is the type used | |
| 68 | whenever possible but the Unix namespace rules do not allow the | |
| 69 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 70 | Therefore we have to handle the use of this header in strictly | |
| 71 | standard-compliant sources special. */ | |
| 72 | struct timespec st_atim; /* Time of last access. */ | |
| 73 | struct timespec st_mtim; /* Time of last modification. */ | |
| 74 | struct timespec st_ctim; /* Time of last status change. */ | |
| 75 | # define st_atime st_atim.tv_sec /* Backward compatibility. */ | |
| 76 | # define st_mtime st_mtim.tv_sec | |
| 77 | # define st_ctime st_ctim.tv_sec | |
| 78 | #else | |
| 79 | __time_t st_atime;			/* Time of last access. */ | |
| 80 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 81 | __time_t st_mtime;			/* Time of last modification. */ | |
| 82 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 83 | __time_t st_ctime;			/* Time of last status change. */ | |
| 84 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 85 | #endif | |
| 86 | __blksize_t st_blksize;	/* Optimal block size for I/O. */ | |
| 87 | #ifndef __USE_FILE_OFFSET64 | |
| 88 | __blkcnt_t st_blocks;	/* Number of 512-byte blocks allocated. */ | |
| 89 | #else | |
| 90 | long int st_pad4; | |
| 91 | __blkcnt64_t st_blocks;	/* Number of 512-byte blocks allocated. */ | |
| 92 | #endif | |
| 93 | long int st_pad5[14]; | |
| 94 | }; | |
| 95 | ||
| 96 | #ifdef __USE_LARGEFILE64 | |
| 97 | struct stat64 | |
| 98 | { | |
| 99 | unsigned long int st_dev; | |
| 100 | long int st_pad1[3]; | |
| 101 | __ino64_t st_ino;		/* File serial number.		*/ | |
| 102 | __mode_t st_mode;		/* File mode. */ | |
| 103 | __nlink_t st_nlink;		/* Link count. */ | |
| 104 | __uid_t st_uid;		/* User ID of the file's owner.	*/ | |
| 105 | __gid_t st_gid;		/* Group ID of the file's group.*/ | |
| 106 | unsigned long int st_rdev;	/* Device number, if device. */ | |
| 107 | long int st_pad2[3]; | |
| 108 | __off64_t st_size;		/* Size of file, in bytes. */ | |
| 109 | # ifdef __USE_XOPEN2K8 | |
| 110 | /* Nanosecond resolution timestamps are stored in a format | |
| 111 | equivalent to 'struct timespec'. This is the type used | |
| 112 | whenever possible but the Unix namespace rules do not allow the | |
| 113 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 114 | Therefore we have to handle the use of this header in strictly | |
| 115 | standard-compliant sources special. */ | |
| 116 | struct timespec st_atim; /* Time of last access. */ | |
| 117 | struct timespec st_mtim; /* Time of last modification. */ | |
| 118 | struct timespec st_ctim; /* Time of last status change. */ | |
| 119 | # else | |
| 120 | __time_t st_atime;			/* Time of last access. */ | |
| 121 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 122 | __time_t st_mtime;			/* Time of last modification. */ | |
| 123 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 124 | __time_t st_ctime;			/* Time of last status change. */ | |
| 125 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 126 | # endif | |
| 127 | __blksize_t st_blksize;	/* Optimal block size for I/O. */ | |
| 128 | long int st_pad3; | |
| 129 | __blkcnt64_t st_blocks;	/* Number of 512-byte blocks allocated. */ | |
| 130 | long int st_pad4[14]; | |
| 131 | }; | |
| 132 | #endif | |
| 133 | #else | |
| 134 | struct stat | |
| 135 | { | |
| 136 | __dev_t st_dev; | |
| 137 | int	st_pad1[3];		/* Reserved for st_dev expansion */ | |
| 138 | #ifndef __USE_FILE_OFFSET64 | |
| 139 | __ino_t st_ino; | |
| 140 | #else | |
| 141 | __ino64_t st_ino; | |
| 142 | #endif | |
| 143 | __mode_t st_mode; | |
| 144 | __nlink_t st_nlink; | |
| 145 | __uid_t st_uid; | |
| 146 | __gid_t st_gid; | |
| 147 | __dev_t st_rdev; | |
| 148 | #if !defined __USE_FILE_OFFSET64 | |
| 149 | unsigned int st_pad2[2];	/* Reserved for st_rdev expansion */ | |
| 150 | __off_t st_size; | |
| 151 | int st_pad3; | |
| 152 | #else | |
| 153 | unsigned int st_pad2[3];	/* Reserved for st_rdev expansion */ | |
| 154 | __off64_t st_size; | |
| 155 | #endif | |
| 156 | #ifdef __USE_XOPEN2K8 | |
| 157 | /* Nanosecond resolution timestamps are stored in a format | |
| 158 | equivalent to 'struct timespec'. This is the type used | |
| 159 | whenever possible but the Unix namespace rules do not allow the | |
| 160 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 161 | Therefore we have to handle the use of this header in strictly | |
| 162 | standard-compliant sources special. */ | |
| 163 | struct timespec st_atim; /* Time of last access. */ | |
| 164 | struct timespec st_mtim; /* Time of last modification. */ | |
| 165 | struct timespec st_ctim; /* Time of last status change. */ | |
| 166 | # define st_atime st_atim.tv_sec /* Backward compatibility. */ | |
| 167 | # define st_mtime st_mtim.tv_sec | |
| 168 | # define st_ctime st_ctim.tv_sec | |
| 169 | #else | |
| 170 | __time_t st_atime;			/* Time of last access. */ | |
| 171 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 172 | __time_t st_mtime;			/* Time of last modification. */ | |
| 173 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 174 | __time_t st_ctime;			/* Time of last status change. */ | |
| 175 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 176 | #endif | |
| 177 | __blksize_t st_blksize; | |
| 178 | unsigned int st_pad4; | |
| 179 | #ifndef __USE_FILE_OFFSET64 | |
| 180 | __blkcnt_t st_blocks; | |
| 181 | #else | |
| 182 | __blkcnt64_t st_blocks; | |
| 183 | #endif | |
| 184 | int st_pad5[14]; | |
| 185 | }; | |
| 186 | ||
| 187 | #ifdef __USE_LARGEFILE64 | |
| 188 | struct stat64 | |
| 189 | { | |
| 190 | __dev_t st_dev; | |
| 191 | unsigned int st_pad1[3];	/* Reserved for st_dev expansion */ | |
| 192 | __ino64_t st_ino; | |
| 193 | __mode_t st_mode; | |
| 194 | __nlink_t st_nlink; | |
| 195 | __uid_t st_uid; | |
| 196 | __gid_t st_gid; | |
| 197 | __dev_t st_rdev; | |
| 198 | unsigned int st_pad2[3];	/* Reserved for st_rdev expansion */ | |
| 199 | __off64_t st_size; | |
| 200 | # ifdef __USE_XOPEN2K8 | |
| 201 | /* Nanosecond resolution timestamps are stored in a format | |
| 202 | equivalent to 'struct timespec'. This is the type used | |
| 203 | whenever possible but the Unix namespace rules do not allow the | |
| 204 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 205 | Therefore we have to handle the use of this header in strictly | |
| 206 | standard-compliant sources special. */ | |
| 207 | struct timespec st_atim; /* Time of last access. */ | |
| 208 | struct timespec st_mtim; /* Time of last modification. */ | |
| 209 | struct timespec st_ctim; /* Time of last status change. */ | |
| 210 | # else | |
| 211 | __time_t st_atime;			/* Time of last access. */ | |
| 212 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 213 | __time_t st_mtime;			/* Time of last modification. */ | |
| 214 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 215 | __time_t st_ctime;			/* Time of last status change. */ | |
| 216 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 217 | # endif | |
| 218 | __blksize_t st_blksize; | |
| 219 | unsigned int st_pad3; | |
| 220 | __blkcnt64_t st_blocks; | |
| 221 | int st_pad4[14]; | |
| 222 | }; | |
| 223 | #endif | |
| 224 | #endif | |
| 225 | ||
| 226 | /* Tell code we have these members. */ | |
| 227 | #define	_STATBUF_ST_BLKSIZE | |
| 228 | #define	_STATBUF_ST_RDEV | |
| 229 | ||
| 230 | /* Encoding of the file mode. */ | |
| 231 | ||
| 232 | #define	__S_IFMT	0170000	/* These bits determine file type. */ | |
| 233 | ||
| 234 | /* File types. */ | |
| 235 | #define	__S_IFDIR	0040000	/* Directory. */ | |
| 236 | #define	__S_IFCHR	0020000	/* Character device. */ | |
| 237 | #define	__S_IFBLK	0060000	/* Block device. */ | |
| 238 | #define	__S_IFREG	0100000	/* Regular file. */ | |
| 239 | #define	__S_IFIFO	0010000	/* FIFO. */ | |
| 240 | #define	__S_IFLNK	0120000	/* Symbolic link. */ | |
| 241 | #define	__S_IFSOCK	0140000	/* Socket. */ | |
| 242 | ||
| 243 | /* POSIX.1b objects. Note that these macros always evaluate to zero. But | |
| 244 | they do it by enforcing the correct use of the macros. */ | |
| 245 | #define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 246 | #define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 247 | #define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 248 | ||
| 249 | /* Protection bits. */ | |
| 250 | ||
| 251 | #define	__S_ISUID	04000	/* Set user ID on execution. */ | |
| 252 | #define	__S_ISGID	02000	/* Set group ID on execution. */ | |
| 253 | #define	__S_ISVTX	01000	/* Save swapped text after use (sticky). */ | |
| 254 | #define	__S_IREAD	0400	/* Read by owner. */ | |
| 255 | #define	__S_IWRITE	0200	/* Write by owner. */ | |
| 256 | #define	__S_IEXEC	0100	/* Execute by owner. */ | |
| 257 | ||
| 258 | #ifdef __USE_ATFILE | |
| 259 | # define UTIME_NOW	((1l << 30) - 1l) | |
| 260 | # define UTIME_OMIT	((1l << 30) - 2l) | |
| 261 | #endif | |
| 262 | ||
| 263 | #endif	/* bits/stat.h */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/mips/kernel-features.h+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | /* Set flags signalling availability of kernel features based on given |
| 2 | 2 | kernel version number. |
| 3 | Copyright (C) 1999-2020 Free Software Foundation, Inc. | |
| 3 | Copyright (C) 1999-2021 Free Software Foundation, Inc. | |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 | |
| 6 | 6 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h+93-112| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 2000-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 2000-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -25,11 +25,6 @@ |
| 25 | 25 | |
| 26 | 26 | #include <tls.h> |
| 27 | 27 | |
| 28 | /* In order to get __set_errno() definition in INLINE_SYSCALL. */ | |
| 29 | #ifndef __ASSEMBLER__ | |
| 30 | #include <errno.h> | |
| 31 | #endif | |
| 32 | ||
| 33 | 28 | /* For Linux we can use the system call table in the header file |
| 34 | 29 | 	/usr/include/asm/unistd.h |
| 35 | 30 | of the kernel. But these symbols do not follow the SYS_* syntax |
| ... | ... | @@ -42,32 +37,14 @@ |
| 42 | 37 | /* We don't want the label for the error handler to be visible in the symbol |
| 43 | 38 | table when we define it here. */ |
| 44 | 39 | #ifdef __PIC__ |
| 40 | # undef SYSCALL_ERROR_LABEL | |
| 45 | 41 | # define SYSCALL_ERROR_LABEL 99b |
| 46 | 42 | #endif |
| 47 | 43 | |
| 48 | 44 | #else /* ! __ASSEMBLER__ */ |
| 49 | 45 | |
| 50 | /* Define a macro which expands into the inline wrapper code for a system | |
| 51 | call. */ | |
| 52 | #undef INLINE_SYSCALL | |
| 53 | #define INLINE_SYSCALL(name, nr, args...) \ | |
| 54 | ({ INTERNAL_SYSCALL_DECL (_sc_err);					\ | |
| 55 | long result_var = INTERNAL_SYSCALL (name, _sc_err, nr, args);	\ | |
| 56 | if ( INTERNAL_SYSCALL_ERROR_P (result_var, _sc_err) )		\ | |
| 57 | {								\ | |
| 58 | 	 __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, _sc_err));	\ | |
| 59 | 	 result_var = -1L;						\ | |
| 60 | }								\ | |
| 61 | result_var; }) | |
| 62 | ||
| 63 | #undef INTERNAL_SYSCALL_DECL | |
| 64 | #define INTERNAL_SYSCALL_DECL(err) long err __attribute__ ((unused)) | |
| 65 | ||
| 66 | #undef INTERNAL_SYSCALL_ERROR_P | |
| 67 | #define INTERNAL_SYSCALL_ERROR_P(val, err) ((void) (val), (long) (err)) | |
| 68 | ||
| 69 | #undef INTERNAL_SYSCALL_ERRNO | |
| 70 | #define INTERNAL_SYSCALL_ERRNO(val, err) ((void) (err), val) | |
| 46 | #undef HAVE_INTERNAL_BRK_ADDR_SYMBOL | |
| 47 | #define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 | |
| 71 | 48 | |
| 72 | 49 | /* Note that the original Linux syscall restart convention required the |
| 73 | 50 | instruction immediately preceding SYSCALL to initialize $v0 with the |
| ... | ... | @@ -103,11 +80,11 @@ |
| 103 | 80 | |
| 104 | 81 | union __mips_syscall_return |
| 105 | 82 | { |
| 106 | long long val; | |
| 83 | long long int val; | |
| 107 | 84 | struct |
| 108 | 85 | { |
| 109 | 	long v0; | |
| 110 | 	long v1; | |
| 86 | 	long int v0; | |
| 87 | 	long int v1; | |
| 111 | 88 | } |
| 112 | 89 | reg; |
| 113 | 90 | }; |
| ... | ... | @@ -121,14 +98,13 @@ union __mips_syscall_return |
| 121 | 98 | |
| 122 | 99 | # include <mips16-syscall.h> |
| 123 | 100 | |
| 124 | # define INTERNAL_SYSCALL(name, err, nr, args...)			\ | |
| 125 | 	INTERNAL_SYSCALL_NCS (SYS_ify (name), err, nr, args) | |
| 101 | # define INTERNAL_SYSCALL(name, nr, args...)				\ | |
| 102 | 	INTERNAL_SYSCALL_NCS (SYS_ify (name), nr, args) | |
| 126 | 103 | |
| 127 | # define INTERNAL_SYSCALL_NCS(number, err, nr, args...)			\ | |
| 104 | # define INTERNAL_SYSCALL_NCS(number, nr, args...)			\ | |
| 128 | 105 | ({									\ |
| 129 | 106 | 	union __mips_syscall_return _sc_ret;				\ |
| 130 | 107 | 	_sc_ret.val = __mips16_syscall##nr (args, number);		\ |
| 131 | 	err = _sc_ret.reg.v1;						\ | |
| 132 | 108 | 	_sc_ret.reg.v0;							\ |
| 133 | 109 | }) |
| 134 | 110 | |
| ... | ... | @@ -138,12 +114,12 @@ union __mips_syscall_return |
| 138 | 114 | 			 number, err, args) |
| 139 | 115 | |
| 140 | 116 | #else /* !__mips16 */ |
| 141 | # define INTERNAL_SYSCALL(name, err, nr, args...)			\ | |
| 117 | # define INTERNAL_SYSCALL(name, nr, args...)				\ | |
| 142 | 118 | 	internal_syscall##nr ("li\t%0, %2\t\t\t# " #name "\n\t",	\ |
| 143 | 119 | 			 "IK" (SYS_ify (name)),			\ |
| 144 | 120 | 			 SYS_ify (name), err, args) |
| 145 | 121 | |
| 146 | # define INTERNAL_SYSCALL_NCS(number, err, nr, args...)			\ | |
| 122 | # define INTERNAL_SYSCALL_NCS(number, nr, args...)			\ | |
| 147 | 123 | 	internal_syscall##nr (MOVE32 "\t%0, %2\n\t",			\ |
| 148 | 124 | 			 "r" (__s0),				\ |
| 149 | 125 | 			 number, err, args) |
| ... | ... | @@ -152,13 +128,13 @@ union __mips_syscall_return |
| 152 | 128 | |
| 153 | 129 | #define internal_syscall0(v0_init, input, number, err, dummy...)	\ |
| 154 | 130 | ({									\ |
| 155 | 	long _sys_result;						\ | |
| 131 | 	long int _sys_result;						\ | |
| 156 | 132 | 									\ |
| 157 | 133 | 	{								\ |
| 158 | 	register long __s0 asm ("$16") __attribute__ ((unused))		\ | |
| 134 | 	register long int __s0 asm ("$16") __attribute__ ((unused))	\ | |
| 159 | 135 | 	 = (number);							\ |
| 160 | 	register long __v0 asm ("$2");					\ | |
| 161 | 	register long __a3 asm ("$7");					\ | |
| 136 | 	register long int __v0 asm ("$2");				\ | |
| 137 | 	register long int __a3 asm ("$7");				\ | |
| 162 | 138 | 	__asm__ volatile (						\ |
| 163 | 139 | 	".set\tnoreorder\n\t"						\ |
| 164 | 140 | 	v0_init								\ |
| ... | ... | @@ -167,22 +143,22 @@ union __mips_syscall_return |
| 167 | 143 | 	: "=r" (__v0), "=r" (__a3)					\ |
| 168 | 144 | 	: input								\ |
| 169 | 145 | 	: __SYSCALL_CLOBBERS);						\ |
| 170 | 	err = __a3;							\ | |
| 171 | 	_sys_result = __v0;						\ | |
| 146 | 	_sys_result = __a3 != 0 ? -__v0 : __v0;				\ | |
| 172 | 147 | 	}								\ |
| 173 | 148 | 	_sys_result;							\ |
| 174 | 149 | }) |
| 175 | 150 | |
| 176 | 151 | #define internal_syscall1(v0_init, input, number, err, arg1)		\ |
| 177 | 152 | ({									\ |
| 178 | 	long _sys_result;						\ | |
| 153 | 	long int _sys_result;						\ | |
| 179 | 154 | 									\ |
| 180 | 155 | 	{								\ |
| 181 | 	register long __s0 asm ("$16") __attribute__ ((unused))		\ | |
| 156 | 	long int _arg1 = (long int) (arg1);				\ | |
| 157 | 	register long int __s0 asm ("$16") __attribute__ ((unused))	\ | |
| 182 | 158 | 	 = (number);							\ |
| 183 | 	register long __v0 asm ("$2");					\ | |
| 184 | 	register long __a0 asm ("$4") = (long) (arg1);			\ | |
| 185 | 	register long __a3 asm ("$7");					\ | |
| 159 | 	register long int __v0 asm ("$2");				\ | |
| 160 | 	register long int __a0 asm ("$4") = _arg1;			\ | |
| 161 | 	register long int __a3 asm ("$7");				\ | |
| 186 | 162 | 	__asm__ volatile (						\ |
| 187 | 163 | 	".set\tnoreorder\n\t"						\ |
| 188 | 164 | 	v0_init								\ |
| ... | ... | @@ -191,23 +167,24 @@ union __mips_syscall_return |
| 191 | 167 | 	: "=r" (__v0), "=r" (__a3)					\ |
| 192 | 168 | 	: input, "r" (__a0)						\ |
| 193 | 169 | 	: __SYSCALL_CLOBBERS);						\ |
| 194 | 	err = __a3;							\ | |
| 195 | 	_sys_result = __v0;						\ | |
| 170 | 	_sys_result = __a3 != 0 ? -__v0 : __v0;				\ | |
| 196 | 171 | 	}								\ |
| 197 | 172 | 	_sys_result;							\ |
| 198 | 173 | }) |
| 199 | 174 | |
| 200 | 175 | #define internal_syscall2(v0_init, input, number, err, arg1, arg2)	\ |
| 201 | 176 | ({									\ |
| 202 | 	long _sys_result;						\ | |
| 177 | 	long int _sys_result;						\ | |
| 203 | 178 | 									\ |
| 204 | 179 | 	{								\ |
| 205 | 	register long __s0 asm ("$16") __attribute__ ((unused))		\ | |
| 180 | 	long int _arg1 = (long int) (arg1);				\ | |
| 181 | 	long int _arg2 = (long int) (arg2);				\ | |
| 182 | 	register long int __s0 asm ("$16") __attribute__ ((unused))	\ | |
| 206 | 183 | 	 = (number);							\ |
| 207 | 	register long __v0 asm ("$2");					\ | |
| 208 | 	register long __a0 asm ("$4") = (long) (arg1);			\ | |
| 209 | 	register long __a1 asm ("$5") = (long) (arg2);			\ | |
| 210 | 	register long __a3 asm ("$7");					\ | |
| 184 | 	register long int __v0 asm ("$2");				\ | |
| 185 | 	register long int __a0 asm ("$4") = _arg1;			\ | |
| 186 | 	register long int __a1 asm ("$5") = _arg2;			\ | |
| 187 | 	register long int __a3 asm ("$7");				\ | |
| 211 | 188 | 	__asm__ volatile (						\ |
| 212 | 189 | 	".set\tnoreorder\n\t"						\ |
| 213 | 190 | 	v0_init								\ |
| ... | ... | @@ -216,8 +193,7 @@ union __mips_syscall_return |
| 216 | 193 | 	: "=r" (__v0), "=r" (__a3)					\ |
| 217 | 194 | 	: input, "r" (__a0), "r" (__a1)					\ |
| 218 | 195 | 	: __SYSCALL_CLOBBERS);						\ |
| 219 | 	err = __a3;							\ | |
| 220 | 	_sys_result = __v0;						\ | |
| 196 | 	_sys_result = __a3 != 0 ? -__v0 : __v0;				\ | |
| 221 | 197 | 	}								\ |
| 222 | 198 | 	_sys_result;							\ |
| 223 | 199 | }) |
| ... | ... | @@ -225,16 +201,19 @@ union __mips_syscall_return |
| 225 | 201 | #define internal_syscall3(v0_init, input, number, err,			\ |
| 226 | 202 | 			 arg1, arg2, arg3)				\ |
| 227 | 203 | ({									\ |
| 228 | 	long _sys_result;						\ | |
| 204 | 	long int _sys_result;						\ | |
| 229 | 205 | 									\ |
| 230 | 206 | 	{								\ |
| 231 | 	register long __s0 asm ("$16") __attribute__ ((unused))		\ | |
| 207 | 	long int _arg1 = (long int) (arg1);				\ | |
| 208 | 	long int _arg2 = (long int) (arg2);				\ | |
| 209 | 	long int _arg3 = (long int) (arg3);				\ | |
| 210 | 	register long int __s0 asm ("$16") __attribute__ ((unused))	\ | |
| 232 | 211 | 	 = (number);							\ |
| 233 | 	register long __v0 asm ("$2");					\ | |
| 234 | 	register long __a0 asm ("$4") = (long) (arg1);			\ | |
| 235 | 	register long __a1 asm ("$5") = (long) (arg2);			\ | |
| 236 | 	register long __a2 asm ("$6") = (long) (arg3);			\ | |
| 237 | 	register long __a3 asm ("$7");					\ | |
| 212 | 	register long int __v0 asm ("$2");				\ | |
| 213 | 	register long int __a0 asm ("$4") = _arg1;			\ | |
| 214 | 	register long int __a1 asm ("$5") = _arg2;			\ | |
| 215 | 	register long int __a2 asm ("$6") = _arg3;			\ | |
| 216 | 	register long int __a3 asm ("$7");				\ | |
| 238 | 217 | 	__asm__ volatile (						\ |
| 239 | 218 | 	".set\tnoreorder\n\t"						\ |
| 240 | 219 | 	v0_init								\ |
| ... | ... | @@ -243,8 +222,7 @@ union __mips_syscall_return |
| 243 | 222 | 	: "=r" (__v0), "=r" (__a3)					\ |
| 244 | 223 | 	: input, "r" (__a0), "r" (__a1), "r" (__a2)			\ |
| 245 | 224 | 	: __SYSCALL_CLOBBERS);						\ |
| 246 | 	err = __a3;							\ | |
| 247 | 	_sys_result = __v0;						\ | |
| 225 | 	_sys_result = __a3 != 0 ? -__v0 : __v0;				\ | |
| 248 | 226 | 	}								\ |
| 249 | 227 | 	_sys_result;							\ |
| 250 | 228 | }) |
| ... | ... | @@ -252,16 +230,20 @@ union __mips_syscall_return |
| 252 | 230 | #define internal_syscall4(v0_init, input, number, err,			\ |
| 253 | 231 | 			 arg1, arg2, arg3, arg4)			\ |
| 254 | 232 | ({									\ |
| 255 | 	long _sys_result;						\ | |
| 233 | 	long int _sys_result;						\ | |
| 256 | 234 | 									\ |
| 257 | 235 | 	{								\ |
| 258 | 	register long __s0 asm ("$16") __attribute__ ((unused))		\ | |
| 236 | 	long int _arg1 = (long int) (arg1);				\ | |
| 237 | 	long int _arg2 = (long int) (arg2);				\ | |
| 238 | 	long int _arg3 = (long int) (arg3);				\ | |
| 239 | 	long int _arg4 = (long int) (arg4);				\ | |
| 240 | 	register long int __s0 asm ("$16") __attribute__ ((unused))	\ | |
| 259 | 241 | 	 = (number);							\ |
| 260 | 	register long __v0 asm ("$2");					\ | |
| 261 | 	register long __a0 asm ("$4") = (long) (arg1);			\ | |
| 262 | 	register long __a1 asm ("$5") = (long) (arg2);			\ | |
| 263 | 	register long __a2 asm ("$6") = (long) (arg3);			\ | |
| 264 | 	register long __a3 asm ("$7") = (long) (arg4);			\ | |
| 242 | 	register long int __v0 asm ("$2");				\ | |
| 243 | 	register long int __a0 asm ("$4") = _arg1;			\ | |
| 244 | 	register long int __a1 asm ("$5") = _arg2;			\ | |
| 245 | 	register long int __a2 asm ("$6") = _arg3;			\ | |
| 246 | 	register long int __a3 asm ("$7") = _arg4;			\ | |
| 265 | 247 | 	__asm__ volatile (						\ |
| 266 | 248 | 	".set\tnoreorder\n\t"						\ |
| 267 | 249 | 	v0_init								\ |
| ... | ... | @@ -270,8 +252,7 @@ union __mips_syscall_return |
| 270 | 252 | 	: "=r" (__v0), "+r" (__a3)					\ |
| 271 | 253 | 	: input, "r" (__a0), "r" (__a1), "r" (__a2)			\ |
| 272 | 254 | 	: __SYSCALL_CLOBBERS);						\ |
| 273 | 	err = __a3;							\ | |
| 274 | 	_sys_result = __v0;						\ | |
| 255 | 	_sys_result = __a3 != 0 ? -__v0 : __v0;				\ | |
| 275 | 256 | 	}								\ |
| 276 | 257 | 	_sys_result;							\ |
| 277 | 258 | }) |
| ... | ... | @@ -285,65 +266,65 @@ union __mips_syscall_return |
| 285 | 266 | compiler specifics required for the stack arguments to be pushed, |
| 286 | 267 | which would be the case if these syscalls were inlined. */ |
| 287 | 268 | |
| 288 | long long __nomips16 __mips_syscall5 (long arg1, long arg2, long arg3, | |
| 289 | 				 long arg4, long arg5, | |
| 290 | 				 long number); | |
| 269 | long long int __nomips16 __mips_syscall5 (long int arg1, long int arg2, | |
| 270 | 					 long int arg3, long int arg4, | |
| 271 | 					 long int arg5, | |
| 272 | 					 long int number); | |
| 291 | 273 | libc_hidden_proto (__mips_syscall5, nomips16) |
| 292 | 274 | |
| 293 | 275 | #define internal_syscall5(v0_init, input, number, err,			\ |
| 294 | 276 | 			 arg1, arg2, arg3, arg4, arg5)			\ |
| 295 | 277 | ({									\ |
| 296 | 278 | 	union __mips_syscall_return _sc_ret;				\ |
| 297 | 	_sc_ret.val = __mips_syscall5 ((long) (arg1),			\ | |
| 298 | 				 (long) (arg2),			\ | |
| 299 | 				 (long) (arg3),			\ | |
| 300 | 				 (long) (arg4),			\ | |
| 301 | 				 (long) (arg5),			\ | |
| 302 | 				 (long) (number));		\ | |
| 303 | 	err = _sc_ret.reg.v1;						\ | |
| 304 | 	_sc_ret.reg.v0;							\ | |
| 279 | 	_sc_ret.val = __mips_syscall5 ((long int) (arg1),		\ | |
| 280 | 				 (long int) (arg2),		\ | |
| 281 | 				 (long int) (arg3),		\ | |
| 282 | 				 (long int) (arg4),		\ | |
| 283 | 				 (long int) (arg5),		\ | |
| 284 | 				 (long int) (number));		\ | |
| 285 | 	_sc_ret.reg.v1 != 0 ? -_sc_ret.reg.v0 : _sc_ret.reg.v0;		\ | |
| 305 | 286 | }) |
| 306 | 287 | |
| 307 | long long __nomips16 __mips_syscall6 (long arg1, long arg2, long arg3, | |
| 308 | 				 long arg4, long arg5, long arg6, | |
| 309 | 				 long number); | |
| 288 | long long int __nomips16 __mips_syscall6 (long int arg1, long int arg2, | |
| 289 | 					 long int arg3, long int arg4, | |
| 290 | 					 long int arg5, long int arg6, | |
| 291 | 					 long int number); | |
| 310 | 292 | libc_hidden_proto (__mips_syscall6, nomips16) |
| 311 | 293 | |
| 312 | 294 | #define internal_syscall6(v0_init, input, number, err,			\ |
| 313 | 295 | 			 arg1, arg2, arg3, arg4, arg5, arg6)		\ |
| 314 | 296 | ({									\ |
| 315 | 297 | 	union __mips_syscall_return _sc_ret;				\ |
| 316 | 	_sc_ret.val = __mips_syscall6 ((long) (arg1),			\ | |
| 317 | 				 (long) (arg2),			\ | |
| 318 | 				 (long) (arg3),			\ | |
| 319 | 				 (long) (arg4),			\ | |
| 320 | 				 (long) (arg5),			\ | |
| 321 | 				 (long) (arg6),			\ | |
| 322 | 				 (long) (number));		\ | |
| 323 | 	err = _sc_ret.reg.v1;						\ | |
| 324 | 	_sc_ret.reg.v0;							\ | |
| 298 | 	_sc_ret.val = __mips_syscall6 ((long int) (arg1),		\ | |
| 299 | 				 (long int) (arg2),		\ | |
| 300 | 				 (long int) (arg3),		\ | |
| 301 | 				 (long int) (arg4),		\ | |
| 302 | 				 (long int) (arg5),		\ | |
| 303 | 				 (long int) (arg6),		\ | |
| 304 | 				 (long int) (number));		\ | |
| 305 | 	_sc_ret.reg.v1 != 0 ? -_sc_ret.reg.v0 : _sc_ret.reg.v0;		\ | |
| 325 | 306 | }) |
| 326 | 307 | |
| 327 | long long __nomips16 __mips_syscall7 (long arg1, long arg2, long arg3, | |
| 328 | 				 long arg4, long arg5, long arg6, | |
| 329 | 				 long arg7, | |
| 330 | 				 long number); | |
| 308 | long long int __nomips16 __mips_syscall7 (long int arg1, long int arg2, | |
| 309 | 					 long int arg3, long int arg4, | |
| 310 | 					 long int arg5, long int arg6, | |
| 311 | 					 long int arg7, | |
| 312 | 					 long int number); | |
| 331 | 313 | libc_hidden_proto (__mips_syscall7, nomips16) |
| 332 | 314 | |
| 333 | 315 | #define internal_syscall7(v0_init, input, number, err,			\ |
| 334 | 316 | 			 arg1, arg2, arg3, arg4, arg5, arg6, arg7)	\ |
| 335 | 317 | ({									\ |
| 336 | 318 | 	union __mips_syscall_return _sc_ret;				\ |
| 337 | 	_sc_ret.val = __mips_syscall7 ((long) (arg1),			\ | |
| 338 | 				 (long) (arg2),			\ | |
| 339 | 				 (long) (arg3),			\ | |
| 340 | 				 (long) (arg4),			\ | |
| 341 | 				 (long) (arg5),			\ | |
| 342 | 				 (long) (arg6),			\ | |
| 343 | 				 (long) (arg7),			\ | |
| 344 | 				 (long) (number));		\ | |
| 345 | 	err = _sc_ret.reg.v1;						\ | |
| 346 | 	_sc_ret.reg.v0;							\ | |
| 319 | 	_sc_ret.val = __mips_syscall7 ((long int) (arg1),		\ | |
| 320 | 				 (long int) (arg2),		\ | |
| 321 | 				 (long int) (arg3),		\ | |
| 322 | 				 (long int) (arg4),		\ | |
| 323 | 				 (long int) (arg5),		\ | |
| 324 | 				 (long int) (arg6),		\ | |
| 325 | 				 (long int) (arg7),		\ | |
| 326 | 				 (long int) (number));		\ | |
| 327 | 	_sc_ret.reg.v1 != 0 ? -_sc_ret.reg.v0 : _sc_ret.reg.v0;		\ | |
| 347 | 328 | }) |
| 348 | 329 | |
| 349 | 330 | #if __mips_isa_rev >= 6 |
lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h deleted-311| ... | ... | @@ -1,311 +0,0 @@ |
| 1 | /* Copyright (C) 2000-2020 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library. If not, see | |
| 16 | <https://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | #ifndef _LINUX_MIPS_SYSDEP_H | |
| 19 | #define _LINUX_MIPS_SYSDEP_H 1 | |
| 20 | ||
| 21 | /* There is some commonality. */ | |
| 22 | #include <sysdeps/unix/sysv/linux/mips/sysdep.h> | |
| 23 | #include <sysdeps/unix/sysv/linux/sysdep.h> | |
| 24 | #include <sysdeps/unix/mips/mips64/n32/sysdep.h> | |
| 25 | ||
| 26 | #include <tls.h> | |
| 27 | ||
| 28 | /* In order to get __set_errno() definition in INLINE_SYSCALL. */ | |
| 29 | #ifndef __ASSEMBLER__ | |
| 30 | #include <errno.h> | |
| 31 | #endif | |
| 32 | ||
| 33 | /* For Linux we can use the system call table in the header file | |
| 34 | 	/usr/include/asm/unistd.h | |
| 35 | of the kernel. But these symbols do not follow the SYS_* syntax | |
| 36 | so we have to redefine the `SYS_ify' macro here. */ | |
| 37 | #undef SYS_ify | |
| 38 | #define SYS_ify(syscall_name)	__NR_##syscall_name | |
| 39 | ||
| 40 | #ifdef __ASSEMBLER__ | |
| 41 | ||
| 42 | /* We don't want the label for the error handler to be visible in the symbol | |
| 43 | table when we define it here. */ | |
| 44 | # define SYSCALL_ERROR_LABEL 99b | |
| 45 | ||
| 46 | #else /* ! __ASSEMBLER__ */ | |
| 47 | ||
| 48 | /* Convert X to a long long, without losing any bits if it is one | |
| 49 | already or warning if it is a 32-bit pointer. */ | |
| 50 | #define ARGIFY(X) ((long long) (__typeof__ ((X) - (X))) (X)) | |
| 51 | ||
| 52 | /* Define a macro which expands into the inline wrapper code for a system | |
| 53 | call. */ | |
| 54 | #undef INLINE_SYSCALL | |
| 55 | #define INLINE_SYSCALL(name, nr, args...)				\ | |
| 56 | ({ INTERNAL_SYSCALL_DECL (_sc_err);					\ | |
| 57 | long result_var = INTERNAL_SYSCALL (name, _sc_err, nr, args);	\ | |
| 58 | if ( INTERNAL_SYSCALL_ERROR_P (result_var, _sc_err) )		\ | |
| 59 | {								\ | |
| 60 | 	 __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, _sc_err));	\ | |
| 61 | 	 result_var = -1L;						\ | |
| 62 | }								\ | |
| 63 | result_var; }) | |
| 64 | ||
| 65 | #undef INTERNAL_SYSCALL_DECL | |
| 66 | #define INTERNAL_SYSCALL_DECL(err) long err __attribute__ ((unused)) | |
| 67 | ||
| 68 | #undef INTERNAL_SYSCALL_ERROR_P | |
| 69 | #define INTERNAL_SYSCALL_ERROR_P(val, err) ((void) (val), (long) (err)) | |
| 70 | ||
| 71 | #undef INTERNAL_SYSCALL_ERRNO | |
| 72 | #define INTERNAL_SYSCALL_ERRNO(val, err) ((void) (err), val) | |
| 73 | ||
| 74 | /* Note that the original Linux syscall restart convention required the | |
| 75 | instruction immediately preceding SYSCALL to initialize $v0 with the | |
| 76 | syscall number. Then if a restart triggered, $v0 would have been | |
| 77 | clobbered by the syscall interrupted, and needed to be reinititalized. | |
| 78 | The kernel would decrement the PC by 4 before switching back to the | |
| 79 | user mode so that $v0 had been reloaded before SYSCALL was executed | |
| 80 | again. This implied the place $v0 was loaded from must have been | |
| 81 | preserved across a syscall, e.g. an immediate, static register, stack | |
| 82 | slot, etc. | |
| 83 | ||
| 84 | The convention was relaxed in Linux with a change applied to the kernel | |
| 85 | GIT repository as commit 96187fb0bc30cd7919759d371d810e928048249d, that | |
| 86 | first appeared in the 2.6.36 release. Since then the kernel has had | |
| 87 | code that reloads $v0 upon syscall restart and resumes right at the | |
| 88 | SYSCALL instruction, so no special arrangement is needed anymore. | |
| 89 | ||
| 90 | For backwards compatibility with existing kernel binaries we support | |
| 91 | the old convention by choosing the instruction preceding SYSCALL | |
| 92 | carefully. This also means we have to force a 32-bit encoding of the | |
| 93 | microMIPS MOVE instruction if one is used. */ | |
| 94 | ||
| 95 | #ifdef __mips_micromips | |
| 96 | # define MOVE32 "move32" | |
| 97 | #else | |
| 98 | # define MOVE32 "move" | |
| 99 | #endif | |
| 100 | ||
| 101 | #undef INTERNAL_SYSCALL | |
| 102 | #define INTERNAL_SYSCALL(name, err, nr, args...)			\ | |
| 103 | 	internal_syscall##nr ("li\t%0, %2\t\t\t# " #name "\n\t",	\ | |
| 104 | 			 "IK" (SYS_ify (name)),			\ | |
| 105 | 			 0, err, args) | |
| 106 | ||
| 107 | #undef INTERNAL_SYSCALL_NCS | |
| 108 | #define INTERNAL_SYSCALL_NCS(number, err, nr, args...)			\ | |
| 109 | 	internal_syscall##nr (MOVE32 "\t%0, %2\n\t",			\ | |
| 110 | 			 "r" (__s0),				\ | |
| 111 | 			 number, err, args) | |
| 112 | ||
| 113 | #define internal_syscall0(v0_init, input, number, err, dummy...)	\ | |
| 114 | ({									\ | |
| 115 | 	long _sys_result;						\ | |
| 116 | 									\ | |
| 117 | 	{								\ | |
| 118 | 	register long long __s0 asm ("$16") __attribute__ ((unused))	\ | |
| 119 | 	 = (number);							\ | |
| 120 | 	register long long __v0 asm ("$2");				\ | |
| 121 | 	register long long __a3 asm ("$7");				\ | |
| 122 | 	__asm__ volatile (						\ | |
| 123 | 	".set\tnoreorder\n\t"						\ | |
| 124 | 	v0_init								\ | |
| 125 | 	"syscall\n\t"							\ | |
| 126 | 	".set reorder"							\ | |
| 127 | 	: "=r" (__v0), "=r" (__a3)					\ | |
| 128 | 	: input								\ | |
| 129 | 	: __SYSCALL_CLOBBERS);						\ | |
| 130 | 	err = __a3;							\ | |
| 131 | 	_sys_result = __v0;						\ | |
| 132 | 	}								\ | |
| 133 | 	_sys_result;							\ | |
| 134 | }) | |
| 135 | ||
| 136 | #define internal_syscall1(v0_init, input, number, err, arg1)		\ | |
| 137 | ({									\ | |
| 138 | 	long _sys_result;						\ | |
| 139 | 									\ | |
| 140 | 	{								\ | |
| 141 | 	register long long __s0 asm ("$16") __attribute__ ((unused))	\ | |
| 142 | 	 = (number);							\ | |
| 143 | 	register long long __v0 asm ("$2");				\ | |
| 144 | 	register long long __a0 asm ("$4") = ARGIFY (arg1);		\ | |
| 145 | 	register long long __a3 asm ("$7");				\ | |
| 146 | 	__asm__ volatile (						\ | |
| 147 | 	".set\tnoreorder\n\t"						\ | |
| 148 | 	v0_init								\ | |
| 149 | 	"syscall\n\t"							\ | |
| 150 | 	".set reorder"							\ | |
| 151 | 	: "=r" (__v0), "=r" (__a3)					\ | |
| 152 | 	: input, "r" (__a0)						\ | |
| 153 | 	: __SYSCALL_CLOBBERS);						\ | |
| 154 | 	err = __a3;							\ | |
| 155 | 	_sys_result = __v0;						\ | |
| 156 | 	}								\ | |
| 157 | 	_sys_result;							\ | |
| 158 | }) | |
| 159 | ||
| 160 | #define internal_syscall2(v0_init, input, number, err, arg1, arg2)	\ | |
| 161 | ({									\ | |
| 162 | 	long _sys_result;						\ | |
| 163 | 									\ | |
| 164 | 	{								\ | |
| 165 | 	register long long __s0 asm ("$16") __attribute__ ((unused))	\ | |
| 166 | 	 = (number);							\ | |
| 167 | 	register long long __v0 asm ("$2");				\ | |
| 168 | 	register long long __a0 asm ("$4") = ARGIFY (arg1);		\ | |
| 169 | 	register long long __a1 asm ("$5") = ARGIFY (arg2);		\ | |
| 170 | 	register long long __a3 asm ("$7");				\ | |
| 171 | 	__asm__ volatile (						\ | |
| 172 | 	".set\tnoreorder\n\t"						\ | |
| 173 | 	v0_init								\ | |
| 174 | 	"syscall\n\t"							\ | |
| 175 | 	".set\treorder"							\ | |
| 176 | 	: "=r" (__v0), "=r" (__a3)					\ | |
| 177 | 	: input, "r" (__a0), "r" (__a1)					\ | |
| 178 | 	: __SYSCALL_CLOBBERS);						\ | |
| 179 | 	err = __a3;							\ | |
| 180 | 	_sys_result = __v0;						\ | |
| 181 | 	}								\ | |
| 182 | 	_sys_result;							\ | |
| 183 | }) | |
| 184 | ||
| 185 | #define internal_syscall3(v0_init, input, number, err,			\ | |
| 186 | 			 arg1, arg2, arg3)				\ | |
| 187 | ({									\ | |
| 188 | 	long _sys_result;						\ | |
| 189 | 									\ | |
| 190 | 	{								\ | |
| 191 | 	register long long __s0 asm ("$16") __attribute__ ((unused))	\ | |
| 192 | 	 = (number);							\ | |
| 193 | 	register long long __v0 asm ("$2");				\ | |
| 194 | 	register long long __a0 asm ("$4") = ARGIFY (arg1);		\ | |
| 195 | 	register long long __a1 asm ("$5") = ARGIFY (arg2);		\ | |
| 196 | 	register long long __a2 asm ("$6") = ARGIFY (arg3);		\ | |
| 197 | 	register long long __a3 asm ("$7");				\ | |
| 198 | 	__asm__ volatile (						\ | |
| 199 | 	".set\tnoreorder\n\t"						\ | |
| 200 | 	v0_init								\ | |
| 201 | 	"syscall\n\t"							\ | |
| 202 | 	".set\treorder"							\ | |
| 203 | 	: "=r" (__v0), "=r" (__a3)					\ | |
| 204 | 	: input, "r" (__a0), "r" (__a1), "r" (__a2)			\ | |
| 205 | 	: __SYSCALL_CLOBBERS);						\ | |
| 206 | 	err = __a3;							\ | |
| 207 | 	_sys_result = __v0;						\ | |
| 208 | 	}								\ | |
| 209 | 	_sys_result;							\ | |
| 210 | }) | |
| 211 | ||
| 212 | #define internal_syscall4(v0_init, input, number, err,			\ | |
| 213 | 			 arg1, arg2, arg3, arg4)			\ | |
| 214 | ({									\ | |
| 215 | 	long _sys_result;						\ | |
| 216 | 									\ | |
| 217 | 	{								\ | |
| 218 | 	register long long __s0 asm ("$16") __attribute__ ((unused))	\ | |
| 219 | 	 = (number);							\ | |
| 220 | 	register long long __v0 asm ("$2");				\ | |
| 221 | 	register long long __a0 asm ("$4") = ARGIFY (arg1);		\ | |
| 222 | 	register long long __a1 asm ("$5") = ARGIFY (arg2);		\ | |
| 223 | 	register long long __a2 asm ("$6") = ARGIFY (arg3);		\ | |
| 224 | 	register long long __a3 asm ("$7") = ARGIFY (arg4);		\ | |
| 225 | 	__asm__ volatile (						\ | |
| 226 | 	".set\tnoreorder\n\t"						\ | |
| 227 | 	v0_init								\ | |
| 228 | 	"syscall\n\t"							\ | |
| 229 | 	".set\treorder"							\ | |
| 230 | 	: "=r" (__v0), "+r" (__a3)					\ | |
| 231 | 	: input, "r" (__a0), "r" (__a1), "r" (__a2)			\ | |
| 232 | 	: __SYSCALL_CLOBBERS);						\ | |
| 233 | 	err = __a3;							\ | |
| 234 | 	_sys_result = __v0;						\ | |
| 235 | 	}								\ | |
| 236 | 	_sys_result;							\ | |
| 237 | }) | |
| 238 | ||
| 239 | #define internal_syscall5(v0_init, input, number, err,			\ | |
| 240 | 			 arg1, arg2, arg3, arg4, arg5)			\ | |
| 241 | ({									\ | |
| 242 | 	long _sys_result;						\ | |
| 243 | 									\ | |
| 244 | 	{								\ | |
| 245 | 	register long long __s0 asm ("$16") __attribute__ ((unused))	\ | |
| 246 | 	 = (number);							\ | |
| 247 | 	register long long __v0 asm ("$2");				\ | |
| 248 | 	register long long __a0 asm ("$4") = ARGIFY (arg1);		\ | |
| 249 | 	register long long __a1 asm ("$5") = ARGIFY (arg2);		\ | |
| 250 | 	register long long __a2 asm ("$6") = ARGIFY (arg3);		\ | |
| 251 | 	register long long __a3 asm ("$7") = ARGIFY (arg4);		\ | |
| 252 | 	register long long __a4 asm ("$8") = ARGIFY (arg5);		\ | |
| 253 | 	__asm__ volatile (						\ | |
| 254 | 	".set\tnoreorder\n\t"						\ | |
| 255 | 	v0_init								\ | |
| 256 | 	"syscall\n\t"							\ | |
| 257 | 	".set\treorder"							\ | |
| 258 | 	: "=r" (__v0), "+r" (__a3)					\ | |
| 259 | 	: input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4)		\ | |
| 260 | 	: __SYSCALL_CLOBBERS);						\ | |
| 261 | 	err = __a3;							\ | |
| 262 | 	_sys_result = __v0;						\ | |
| 263 | 	}								\ | |
| 264 | 	_sys_result;							\ | |
| 265 | }) | |
| 266 | ||
| 267 | #define internal_syscall6(v0_init, input, number, err,			\ | |
| 268 | 			 arg1, arg2, arg3, arg4, arg5, arg6)		\ | |
| 269 | ({									\ | |
| 270 | 	long _sys_result;						\ | |
| 271 | 									\ | |
| 272 | 	{								\ | |
| 273 | 	register long long __s0 asm ("$16") __attribute__ ((unused))	\ | |
| 274 | 	 = (number);							\ | |
| 275 | 	register long long __v0 asm ("$2");				\ | |
| 276 | 	register long long __a0 asm ("$4") = ARGIFY (arg1);		\ | |
| 277 | 	register long long __a1 asm ("$5") = ARGIFY (arg2);		\ | |
| 278 | 	register long long __a2 asm ("$6") = ARGIFY (arg3);		\ | |
| 279 | 	register long long __a3 asm ("$7") = ARGIFY (arg4);		\ | |
| 280 | 	register long long __a4 asm ("$8") = ARGIFY (arg5);		\ | |
| 281 | 	register long long __a5 asm ("$9") = ARGIFY (arg6);		\ | |
| 282 | 	__asm__ volatile (						\ | |
| 283 | 	".set\tnoreorder\n\t"						\ | |
| 284 | 	v0_init								\ | |
| 285 | 	"syscall\n\t"							\ | |
| 286 | 	".set\treorder"							\ | |
| 287 | 	: "=r" (__v0), "+r" (__a3)					\ | |
| 288 | 	: input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4),	\ | |
| 289 | 	 "r" (__a5)							\ | |
| 290 | 	: __SYSCALL_CLOBBERS);						\ | |
| 291 | 	err = __a3;							\ | |
| 292 | 	_sys_result = __v0;						\ | |
| 293 | 	}								\ | |
| 294 | 	_sys_result;							\ | |
| 295 | }) | |
| 296 | ||
| 297 | #if __mips_isa_rev >= 6 | |
| 298 | # define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \ | |
| 299 | 	 "$14", "$15", "$24", "$25", "memory" | |
| 300 | #else | |
| 301 | # define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \ | |
| 302 | 	 "$14", "$15", "$24", "$25", "hi", "lo", "memory" | |
| 303 | #endif | |
| 304 | ||
| 305 | #endif /* __ASSEMBLER__ */ | |
| 306 | ||
| 307 | /* Pointer mangling is not yet supported for MIPS. */ | |
| 308 | #define PTR_MANGLE(var) (void) (var) | |
| 309 | #define PTR_DEMANGLE(var) (void) (var) | |
| 310 | ||
| 311 | #endif /* linux/mips/sysdep.h */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h deleted-307| ... | ... | @@ -1,307 +0,0 @@ |
| 1 | /* Copyright (C) 2000-2020 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library. If not, see | |
| 16 | <https://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | #ifndef _LINUX_MIPS_SYSDEP_H | |
| 19 | #define _LINUX_MIPS_SYSDEP_H 1 | |
| 20 | ||
| 21 | /* There is some commonality. */ | |
| 22 | #include <sysdeps/unix/sysv/linux/mips/sysdep.h> | |
| 23 | #include <sysdeps/unix/sysv/linux/sysdep.h> | |
| 24 | #include <sysdeps/unix/mips/mips64/n64/sysdep.h> | |
| 25 | ||
| 26 | #include <tls.h> | |
| 27 | ||
| 28 | /* In order to get __set_errno() definition in INLINE_SYSCALL. */ | |
| 29 | #ifndef __ASSEMBLER__ | |
| 30 | #include <errno.h> | |
| 31 | #endif | |
| 32 | ||
| 33 | /* For Linux we can use the system call table in the header file | |
| 34 | 	/usr/include/asm/unistd.h | |
| 35 | of the kernel. But these symbols do not follow the SYS_* syntax | |
| 36 | so we have to redefine the `SYS_ify' macro here. */ | |
| 37 | #undef SYS_ify | |
| 38 | #define SYS_ify(syscall_name)	__NR_##syscall_name | |
| 39 | ||
| 40 | #ifdef __ASSEMBLER__ | |
| 41 | ||
| 42 | /* We don't want the label for the error handler to be visible in the symbol | |
| 43 | table when we define it here. */ | |
| 44 | # define SYSCALL_ERROR_LABEL 99b | |
| 45 | ||
| 46 | #else /* ! __ASSEMBLER__ */ | |
| 47 | ||
| 48 | /* Define a macro which expands into the inline wrapper code for a system | |
| 49 | call. */ | |
| 50 | #undef INLINE_SYSCALL | |
| 51 | #define INLINE_SYSCALL(name, nr, args...)				\ | |
| 52 | ({ INTERNAL_SYSCALL_DECL (_sc_err);					\ | |
| 53 | long result_var = INTERNAL_SYSCALL (name, _sc_err, nr, args);	\ | |
| 54 | if ( INTERNAL_SYSCALL_ERROR_P (result_var, _sc_err) )		\ | |
| 55 | {								\ | |
| 56 | 	 __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, _sc_err));	\ | |
| 57 | 	 result_var = -1L;						\ | |
| 58 | }								\ | |
| 59 | result_var; }) | |
| 60 | ||
| 61 | #undef INTERNAL_SYSCALL_DECL | |
| 62 | #define INTERNAL_SYSCALL_DECL(err) long err __attribute__ ((unused)) | |
| 63 | ||
| 64 | #undef INTERNAL_SYSCALL_ERROR_P | |
| 65 | #define INTERNAL_SYSCALL_ERROR_P(val, err) ((void) (val), (long) (err)) | |
| 66 | ||
| 67 | #undef INTERNAL_SYSCALL_ERRNO | |
| 68 | #define INTERNAL_SYSCALL_ERRNO(val, err) ((void) (err), val) | |
| 69 | ||
| 70 | /* Note that the original Linux syscall restart convention required the | |
| 71 | instruction immediately preceding SYSCALL to initialize $v0 with the | |
| 72 | syscall number. Then if a restart triggered, $v0 would have been | |
| 73 | clobbered by the syscall interrupted, and needed to be reinititalized. | |
| 74 | The kernel would decrement the PC by 4 before switching back to the | |
| 75 | user mode so that $v0 had been reloaded before SYSCALL was executed | |
| 76 | again. This implied the place $v0 was loaded from must have been | |
| 77 | preserved across a syscall, e.g. an immediate, static register, stack | |
| 78 | slot, etc. | |
| 79 | ||
| 80 | The convention was relaxed in Linux with a change applied to the kernel | |
| 81 | GIT repository as commit 96187fb0bc30cd7919759d371d810e928048249d, that | |
| 82 | first appeared in the 2.6.36 release. Since then the kernel has had | |
| 83 | code that reloads $v0 upon syscall restart and resumes right at the | |
| 84 | SYSCALL instruction, so no special arrangement is needed anymore. | |
| 85 | ||
| 86 | For backwards compatibility with existing kernel binaries we support | |
| 87 | the old convention by choosing the instruction preceding SYSCALL | |
| 88 | carefully. This also means we have to force a 32-bit encoding of the | |
| 89 | microMIPS MOVE instruction if one is used. */ | |
| 90 | ||
| 91 | #ifdef __mips_micromips | |
| 92 | # define MOVE32 "move32" | |
| 93 | #else | |
| 94 | # define MOVE32 "move" | |
| 95 | #endif | |
| 96 | ||
| 97 | #undef INTERNAL_SYSCALL | |
| 98 | #define INTERNAL_SYSCALL(name, err, nr, args...)			\ | |
| 99 | 	internal_syscall##nr ("li\t%0, %2\t\t\t# " #name "\n\t",	\ | |
| 100 | 			 "IK" (SYS_ify (name)),			\ | |
| 101 | 			 0, err, args) | |
| 102 | ||
| 103 | #undef INTERNAL_SYSCALL_NCS | |
| 104 | #define INTERNAL_SYSCALL_NCS(number, err, nr, args...)			\ | |
| 105 | 	internal_syscall##nr (MOVE32 "\t%0, %2\n\t",			\ | |
| 106 | 			 "r" (__s0),				\ | |
| 107 | 			 number, err, args) | |
| 108 | ||
| 109 | #define internal_syscall0(v0_init, input, number, err, dummy...)	\ | |
| 110 | ({									\ | |
| 111 | 	long _sys_result;						\ | |
| 112 | 									\ | |
| 113 | 	{								\ | |
| 114 | 	register long __s0 asm ("$16") __attribute__ ((unused))		\ | |
| 115 | 	 = (number);							\ | |
| 116 | 	register long __v0 asm ("$2");					\ | |
| 117 | 	register long __a3 asm ("$7");					\ | |
| 118 | 	__asm__ volatile (						\ | |
| 119 | 	".set\tnoreorder\n\t"						\ | |
| 120 | 	v0_init								\ | |
| 121 | 	"syscall\n\t"							\ | |
| 122 | 	".set reorder"							\ | |
| 123 | 	: "=r" (__v0), "=r" (__a3)					\ | |
| 124 | 	: input								\ | |
| 125 | 	: __SYSCALL_CLOBBERS);						\ | |
| 126 | 	err = __a3;							\ | |
| 127 | 	_sys_result = __v0;						\ | |
| 128 | 	}								\ | |
| 129 | 	_sys_result;							\ | |
| 130 | }) | |
| 131 | ||
| 132 | #define internal_syscall1(v0_init, input, number, err, arg1)		\ | |
| 133 | ({									\ | |
| 134 | 	long _sys_result;						\ | |
| 135 | 									\ | |
| 136 | 	{								\ | |
| 137 | 	register long __s0 asm ("$16") __attribute__ ((unused))		\ | |
| 138 | 	 = (number);							\ | |
| 139 | 	register long __v0 asm ("$2");					\ | |
| 140 | 	register long __a0 asm ("$4") = (long) (arg1);			\ | |
| 141 | 	register long __a3 asm ("$7");					\ | |
| 142 | 	__asm__ volatile (						\ | |
| 143 | 	".set\tnoreorder\n\t"						\ | |
| 144 | 	v0_init								\ | |
| 145 | 	"syscall\n\t"							\ | |
| 146 | 	".set reorder"							\ | |
| 147 | 	: "=r" (__v0), "=r" (__a3)					\ | |
| 148 | 	: input, "r" (__a0)						\ | |
| 149 | 	: __SYSCALL_CLOBBERS);						\ | |
| 150 | 	err = __a3;							\ | |
| 151 | 	_sys_result = __v0;						\ | |
| 152 | 	}								\ | |
| 153 | 	_sys_result;							\ | |
| 154 | }) | |
| 155 | ||
| 156 | #define internal_syscall2(v0_init, input, number, err, arg1, arg2)	\ | |
| 157 | ({									\ | |
| 158 | 	long _sys_result;						\ | |
| 159 | 									\ | |
| 160 | 	{								\ | |
| 161 | 	register long __s0 asm ("$16") __attribute__ ((unused))		\ | |
| 162 | 	 = (number);							\ | |
| 163 | 	register long __v0 asm ("$2");					\ | |
| 164 | 	register long __a0 asm ("$4") = (long) (arg1);			\ | |
| 165 | 	register long __a1 asm ("$5") = (long) (arg2);			\ | |
| 166 | 	register long __a3 asm ("$7");					\ | |
| 167 | 	__asm__ volatile (						\ | |
| 168 | 	".set\tnoreorder\n\t"						\ | |
| 169 | 	v0_init								\ | |
| 170 | 	"syscall\n\t"							\ | |
| 171 | 	".set\treorder"							\ | |
| 172 | 	: "=r" (__v0), "=r" (__a3)					\ | |
| 173 | 	: input, "r" (__a0), "r" (__a1)					\ | |
| 174 | 	: __SYSCALL_CLOBBERS);						\ | |
| 175 | 	err = __a3;							\ | |
| 176 | 	_sys_result = __v0;						\ | |
| 177 | 	}								\ | |
| 178 | 	_sys_result;							\ | |
| 179 | }) | |
| 180 | ||
| 181 | #define internal_syscall3(v0_init, input, number, err,			\ | |
| 182 | 			 arg1, arg2, arg3)				\ | |
| 183 | ({									\ | |
| 184 | 	long _sys_result;						\ | |
| 185 | 									\ | |
| 186 | 	{								\ | |
| 187 | 	register long __s0 asm ("$16") __attribute__ ((unused))		\ | |
| 188 | 	 = (number);							\ | |
| 189 | 	register long __v0 asm ("$2");					\ | |
| 190 | 	register long __a0 asm ("$4") = (long) (arg1);			\ | |
| 191 | 	register long __a1 asm ("$5") = (long) (arg2);			\ | |
| 192 | 	register long __a2 asm ("$6") = (long) (arg3);			\ | |
| 193 | 	register long __a3 asm ("$7");					\ | |
| 194 | 	__asm__ volatile (						\ | |
| 195 | 	".set\tnoreorder\n\t"						\ | |
| 196 | 	v0_init								\ | |
| 197 | 	"syscall\n\t"							\ | |
| 198 | 	".set\treorder"							\ | |
| 199 | 	: "=r" (__v0), "=r" (__a3)					\ | |
| 200 | 	: input, "r" (__a0), "r" (__a1), "r" (__a2)			\ | |
| 201 | 	: __SYSCALL_CLOBBERS);						\ | |
| 202 | 	err = __a3;							\ | |
| 203 | 	_sys_result = __v0;						\ | |
| 204 | 	}								\ | |
| 205 | 	_sys_result;							\ | |
| 206 | }) | |
| 207 | ||
| 208 | #define internal_syscall4(v0_init, input, number, err,			\ | |
| 209 | 			 arg1, arg2, arg3, arg4)			\ | |
| 210 | ({									\ | |
| 211 | 	long _sys_result;						\ | |
| 212 | 									\ | |
| 213 | 	{								\ | |
| 214 | 	register long __s0 asm ("$16") __attribute__ ((unused))		\ | |
| 215 | 	 = (number);							\ | |
| 216 | 	register long __v0 asm ("$2");					\ | |
| 217 | 	register long __a0 asm ("$4") = (long) (arg1);			\ | |
| 218 | 	register long __a1 asm ("$5") = (long) (arg2);			\ | |
| 219 | 	register long __a2 asm ("$6") = (long) (arg3);			\ | |
| 220 | 	register long __a3 asm ("$7") = (long) (arg4);			\ | |
| 221 | 	__asm__ volatile (						\ | |
| 222 | 	".set\tnoreorder\n\t"						\ | |
| 223 | 	v0_init								\ | |
| 224 | 	"syscall\n\t"							\ | |
| 225 | 	".set\treorder"							\ | |
| 226 | 	: "=r" (__v0), "+r" (__a3)					\ | |
| 227 | 	: input, "r" (__a0), "r" (__a1), "r" (__a2)			\ | |
| 228 | 	: __SYSCALL_CLOBBERS);						\ | |
| 229 | 	err = __a3;							\ | |
| 230 | 	_sys_result = __v0;						\ | |
| 231 | 	}								\ | |
| 232 | 	_sys_result;							\ | |
| 233 | }) | |
| 234 | ||
| 235 | #define internal_syscall5(v0_init, input, number, err,			\ | |
| 236 | 			 arg1, arg2, arg3, arg4, arg5)			\ | |
| 237 | ({									\ | |
| 238 | 	long _sys_result;						\ | |
| 239 | 									\ | |
| 240 | 	{								\ | |
| 241 | 	register long __s0 asm ("$16") __attribute__ ((unused))		\ | |
| 242 | 	 = (number);							\ | |
| 243 | 	register long __v0 asm ("$2");					\ | |
| 244 | 	register long __a0 asm ("$4") = (long) (arg1);			\ | |
| 245 | 	register long __a1 asm ("$5") = (long) (arg2);			\ | |
| 246 | 	register long __a2 asm ("$6") = (long) (arg3);			\ | |
| 247 | 	register long __a3 asm ("$7") = (long) (arg4);			\ | |
| 248 | 	register long __a4 asm ("$8") = (long) (arg5);			\ | |
| 249 | 	__asm__ volatile (						\ | |
| 250 | 	".set\tnoreorder\n\t"						\ | |
| 251 | 	v0_init								\ | |
| 252 | 	"syscall\n\t"							\ | |
| 253 | 	".set\treorder"							\ | |
| 254 | 	: "=r" (__v0), "+r" (__a3)					\ | |
| 255 | 	: input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4)		\ | |
| 256 | 	: __SYSCALL_CLOBBERS);						\ | |
| 257 | 	err = __a3;							\ | |
| 258 | 	_sys_result = __v0;						\ | |
| 259 | 	}								\ | |
| 260 | 	_sys_result;							\ | |
| 261 | }) | |
| 262 | ||
| 263 | #define internal_syscall6(v0_init, input, number, err,			\ | |
| 264 | 			 arg1, arg2, arg3, arg4, arg5, arg6)		\ | |
| 265 | ({									\ | |
| 266 | 	long _sys_result;						\ | |
| 267 | 									\ | |
| 268 | 	{								\ | |
| 269 | 	register long __s0 asm ("$16") __attribute__ ((unused))		\ | |
| 270 | 	 = (number);							\ | |
| 271 | 	register long __v0 asm ("$2");					\ | |
| 272 | 	register long __a0 asm ("$4") = (long) (arg1);			\ | |
| 273 | 	register long __a1 asm ("$5") = (long) (arg2);			\ | |
| 274 | 	register long __a2 asm ("$6") = (long) (arg3);			\ | |
| 275 | 	register long __a3 asm ("$7") = (long) (arg4);			\ | |
| 276 | 	register long __a4 asm ("$8") = (long) (arg5);			\ | |
| 277 | 	register long __a5 asm ("$9") = (long) (arg6);			\ | |
| 278 | 	__asm__ volatile (						\ | |
| 279 | 	".set\tnoreorder\n\t"						\ | |
| 280 | 	v0_init								\ | |
| 281 | 	"syscall\n\t"							\ | |
| 282 | 	".set\treorder"							\ | |
| 283 | 	: "=r" (__v0), "+r" (__a3)					\ | |
| 284 | 	: input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4),	\ | |
| 285 | 	 "r" (__a5)							\ | |
| 286 | 	: __SYSCALL_CLOBBERS);						\ | |
| 287 | 	err = __a3;							\ | |
| 288 | 	_sys_result = __v0;						\ | |
| 289 | 	}								\ | |
| 290 | 	_sys_result;							\ | |
| 291 | }) | |
| 292 | ||
| 293 | #if __mips_isa_rev >= 6 | |
| 294 | # define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \ | |
| 295 | 	 "$14", "$15", "$24", "$25", "memory" | |
| 296 | #else | |
| 297 | # define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \ | |
| 298 | 	 "$14", "$15", "$24", "$25", "hi", "lo", "memory" | |
| 299 | #endif | |
| 300 | ||
| 301 | #endif /* __ASSEMBLER__ */ | |
| 302 | ||
| 303 | /* Pointer mangling is not yet supported for MIPS. */ | |
| 304 | #define PTR_MANGLE(var) (void) (var) | |
| 305 | #define PTR_DEMANGLE(var) (void) (var) | |
| 306 | ||
| 307 | #endif /* linux/mips/sysdep.h */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/mips/xstatver.h created+13| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | /* Versions of the 'struct stat' data structure used in compatibility xstat | |
| 2 | functions. */ | |
| 3 | #define _STAT_VER_LINUX_OLD	1 | |
| 4 | #define _STAT_VER_KERNEL	1 | |
| 5 | #define _STAT_VER_SVR4		2 | |
| 6 | #define _STAT_VER_LINUX		3 | |
| 7 | #define _STAT_VER		_STAT_VER_LINUX | |
| 8 | ||
| 9 | /* Versions of the 'xmknod' interface used in compatibility xmknod | |
| 10 | functions. */ | |
| 11 | #define _MKNOD_VER_LINUX	1 | |
| 12 | #define _MKNOD_VER_SVR4		2 | |
| 13 | #define _MKNOD_VER		_MKNOD_VER_LINUX |
lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/bits/stat.h deleted-275| ... | ... | @@ -1,275 +0,0 @@ |
| 1 | /* Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library; if not, see | |
| 16 | <https://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | #if !defined _SYS_STAT_H && !defined _FCNTL_H | |
| 19 | # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." | |
| 20 | #endif | |
| 21 | ||
| 22 | #ifndef _BITS_STAT_H | |
| 23 | #define _BITS_STAT_H	1 | |
| 24 | ||
| 25 | #include <bits/wordsize.h> | |
| 26 | ||
| 27 | /* Versions of the `struct stat' data structure. */ | |
| 28 | #define _STAT_VER_LINUX_OLD	1 | |
| 29 | #define _STAT_VER_KERNEL	1 | |
| 30 | #define _STAT_VER_SVR4		2 | |
| 31 | #define _STAT_VER_LINUX	 3 | |
| 32 | #if __WORDSIZE == 32 | |
| 33 | # define _STAT_VER		_STAT_VER_LINUX | |
| 34 | #else | |
| 35 | # define _STAT_VER		_STAT_VER_KERNEL | |
| 36 | #endif | |
| 37 | ||
| 38 | /* Versions of the `xmknod' interface. */ | |
| 39 | #define _MKNOD_VER_LINUX	1 | |
| 40 | #define _MKNOD_VER_SVR4		2 | |
| 41 | #define _MKNOD_VER		_MKNOD_VER_LINUX /* The bits defined below. */ | |
| 42 | ||
| 43 | ||
| 44 | #if __WORDSIZE == 32 | |
| 45 | ||
| 46 | struct stat | |
| 47 | { | |
| 48 | __dev_t st_dev;			/* Device. */ | |
| 49 | # ifndef __USE_FILE_OFFSET64 | |
| 50 | unsigned short int __pad1; | |
| 51 | __ino_t st_ino;			/* File serial number.	*/ | |
| 52 | # else | |
| 53 | __ino64_t st_ino;			/* File serial number.	*/ | |
| 54 | # endif | |
| 55 | __mode_t st_mode;			/* File mode. */ | |
| 56 | __nlink_t st_nlink;			/* Link count. */ | |
| 57 | __uid_t st_uid;			/* User ID of the file's owner.	*/ | |
| 58 | __gid_t st_gid;			/* Group ID of the file's group.*/ | |
| 59 | __dev_t st_rdev;			/* Device number, if device. */ | |
| 60 | unsigned short int __pad2; | |
| 61 | # ifndef __USE_FILE_OFFSET64 | |
| 62 | __off_t st_size;			/* Size of file, in bytes. */ | |
| 63 | # else | |
| 64 | __off64_t st_size;			/* Size of file, in bytes. */ | |
| 65 | # endif | |
| 66 | __blksize_t st_blksize;		/* Optimal block size for I/O. */ | |
| 67 | ||
| 68 | # ifndef __USE_FILE_OFFSET64 | |
| 69 | __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */ | |
| 70 | # else | |
| 71 | __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */ | |
| 72 | # endif | |
| 73 | # ifdef __USE_XOPEN2K8 | |
| 74 | /* Nanosecond resolution timestamps are stored in a format | |
| 75 | equivalent to 'struct timespec'. This is the type used | |
| 76 | whenever possible but the Unix namespace rules do not allow the | |
| 77 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 78 | Therefore we have to handle the use of this header in strictly | |
| 79 | standard-compliant sources special. */ | |
| 80 | struct timespec st_atim;		/* Time of last access. */ | |
| 81 | struct timespec st_mtim;		/* Time of last modification. */ | |
| 82 | struct timespec st_ctim;		/* Time of last status change. */ | |
| 83 | # define st_atime st_atim.tv_sec	/* Backward compatibility. */ | |
| 84 | # define st_mtime st_mtim.tv_sec | |
| 85 | # define st_ctime st_ctim.tv_sec | |
| 86 | # else | |
| 87 | __time_t st_atime;			/* Time of last access. */ | |
| 88 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 89 | __time_t st_mtime;			/* Time of last modification. */ | |
| 90 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 91 | __time_t st_ctime;			/* Time of last status change. */ | |
| 92 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 93 | # endif | |
| 94 | unsigned long int __glibc_reserved4; | |
| 95 | unsigned long int __glibc_reserved5; | |
| 96 | }; | |
| 97 | ||
| 98 | ||
| 99 | # ifdef __USE_LARGEFILE64 | |
| 100 | struct stat64 | |
| 101 | { | |
| 102 | __dev_t st_dev;			/* Device. */ | |
| 103 | __ino64_t st_ino;			/* File serial number.	*/ | |
| 104 | __mode_t st_mode;			/* File mode. */ | |
| 105 | __nlink_t st_nlink;			/* Link count. */ | |
| 106 | __uid_t st_uid;			/* User ID of the file's owner.	*/ | |
| 107 | __gid_t st_gid;			/* Group ID of the file's group.*/ | |
| 108 | __dev_t st_rdev;			/* Device number, if device. */ | |
| 109 | unsigned short int __pad2; | |
| 110 | __off64_t st_size;			/* Size of file, in bytes. */ | |
| 111 | __blksize_t st_blksize;		/* Optimal block size for I/O. */ | |
| 112 | __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */ | |
| 113 | # ifdef __USE_XOPEN2K8 | |
| 114 | /* Nanosecond resolution timestamps are stored in a format | |
| 115 | equivalent to 'struct timespec'. This is the type used | |
| 116 | whenever possible but the Unix namespace rules do not allow the | |
| 117 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 118 | Therefore we have to handle the use of this header in strictly | |
| 119 | standard-compliant sources special. */ | |
| 120 | struct timespec st_atim;		/* Time of last access. */ | |
| 121 | struct timespec st_mtim;		/* Time of last modification. */ | |
| 122 | struct timespec st_ctim;		/* Time of last status change. */ | |
| 123 | # define st_atime st_atim.tv_sec	/* Backward compatibility. */ | |
| 124 | # define st_mtime st_mtim.tv_sec | |
| 125 | # define st_ctime st_ctim.tv_sec | |
| 126 | # else | |
| 127 | __time_t st_atime;			/* Time of last access. */ | |
| 128 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 129 | __time_t st_mtime;			/* Time of last modification. */ | |
| 130 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 131 | __time_t st_ctime;			/* Time of last status change. */ | |
| 132 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 133 | # endif | |
| 134 | unsigned long int __glibc_reserved4; | |
| 135 | unsigned long int __glibc_reserved5; | |
| 136 | }; | |
| 137 | # endif /* __USE_LARGEFILE64 */ | |
| 138 | ||
| 139 | #else /* __WORDSIZE == 32 */ | |
| 140 | ||
| 141 | struct stat | |
| 142 | { | |
| 143 | __dev_t st_dev;			/* Device. */ | |
| 144 | # ifndef __USE_FILE_OFFSET64 | |
| 145 | __ino_t st_ino;			/* File serial number.	*/ | |
| 146 | # else | |
| 147 | __ino64_t st_ino;			/* File serial number.	*/ | |
| 148 | # endif | |
| 149 | __nlink_t st_nlink;			/* Link count. */ | |
| 150 | __mode_t st_mode;			/* File mode. */ | |
| 151 | __uid_t st_uid;			/* User ID of the file's owner.	*/ | |
| 152 | __gid_t st_gid;			/* Group ID of the file's group.*/ | |
| 153 | int __pad2; | |
| 154 | __dev_t st_rdev;			/* Device number, if device. */ | |
| 155 | # ifndef __USE_FILE_OFFSET64 | |
| 156 | __off_t st_size;			/* Size of file, in bytes. */ | |
| 157 | # else | |
| 158 | __off64_t st_size;			/* Size of file, in bytes. */ | |
| 159 | # endif | |
| 160 | __blksize_t st_blksize;		/* Optimal block size for I/O. */ | |
| 161 | ||
| 162 | # ifndef __USE_FILE_OFFSET64 | |
| 163 | __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */ | |
| 164 | # else | |
| 165 | __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */ | |
| 166 | # endif | |
| 167 | # ifdef __USE_XOPEN2K8 | |
| 168 | /* Nanosecond resolution timestamps are stored in a format | |
| 169 | equivalent to 'struct timespec'. This is the type used | |
| 170 | whenever possible but the Unix namespace rules do not allow the | |
| 171 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 172 | Therefore we have to handle the use of this header in strictly | |
| 173 | standard-compliant sources special. */ | |
| 174 | struct timespec st_atim;		/* Time of last access. */ | |
| 175 | struct timespec st_mtim;		/* Time of last modification. */ | |
| 176 | struct timespec st_ctim;		/* Time of last status change. */ | |
| 177 | # define st_atime st_atim.tv_sec	/* Backward compatibility. */ | |
| 178 | # define st_mtime st_mtim.tv_sec | |
| 179 | # define st_ctime st_ctim.tv_sec | |
| 180 | # else | |
| 181 | __time_t st_atime;			/* Time of last access. */ | |
| 182 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 183 | __time_t st_mtime;			/* Time of last modification. */ | |
| 184 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 185 | __time_t st_ctime;			/* Time of last status change. */ | |
| 186 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 187 | # endif | |
| 188 | unsigned long int __glibc_reserved4; | |
| 189 | unsigned long int __glibc_reserved5; | |
| 190 | unsigned long int __glibc_reserved6; | |
| 191 | }; | |
| 192 | ||
| 193 | # ifdef __USE_LARGEFILE64 | |
| 194 | struct stat64 | |
| 195 | { | |
| 196 | __dev_t st_dev;			/* Device. */ | |
| 197 | __ino64_t st_ino;			/* File serial number.	*/ | |
| 198 | __nlink_t st_nlink;			/* Link count. */ | |
| 199 | __mode_t st_mode;			/* File mode. */ | |
| 200 | __uid_t st_uid;			/* User ID of the file's owner.	*/ | |
| 201 | __gid_t st_gid;			/* Group ID of the file's group.*/ | |
| 202 | int __pad2; | |
| 203 | __dev_t st_rdev;			/* Device number, if device. */ | |
| 204 | __off64_t st_size;			/* Size of file, in bytes. */ | |
| 205 | __blksize_t st_blksize;		/* Optimal block size for I/O. */ | |
| 206 | __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */ | |
| 207 | # ifdef __USE_XOPEN2K8 | |
| 208 | /* Nanosecond resolution timestamps are stored in a format | |
| 209 | equivalent to 'struct timespec'. This is the type used | |
| 210 | whenever possible but the Unix namespace rules do not allow the | |
| 211 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 212 | Therefore we have to handle the use of this header in strictly | |
| 213 | standard-compliant sources special. */ | |
| 214 | struct timespec st_atim;		/* Time of last access. */ | |
| 215 | struct timespec st_mtim;		/* Time of last modification. */ | |
| 216 | struct timespec st_ctim;		/* Time of last status change. */ | |
| 217 | # define st_atime st_atim.tv_sec	/* Backward compatibility. */ | |
| 218 | # define st_mtime st_mtim.tv_sec | |
| 219 | # define st_ctime st_ctim.tv_sec | |
| 220 | # else | |
| 221 | __time_t st_atime;			/* Time of last access. */ | |
| 222 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 223 | __time_t st_mtime;			/* Time of last modification. */ | |
| 224 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 225 | __time_t st_ctime;			/* Time of last status change. */ | |
| 226 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 227 | # endif | |
| 228 | unsigned long int __glibc_reserved4; | |
| 229 | unsigned long int __glibc_reserved5; | |
| 230 | unsigned long int __glibc_reserved6; | |
| 231 | }; | |
| 232 | # endif /* __USE_LARGEFILE64 */ | |
| 233 | #endif | |
| 234 | ||
| 235 | ||
| 236 | /* Tell code we have these members. */ | |
| 237 | #define	_STATBUF_ST_BLKSIZE | |
| 238 | #define _STATBUF_ST_RDEV | |
| 239 | /* Nanosecond resolution time values are supported. */ | |
| 240 | #define _STATBUF_ST_NSEC | |
| 241 | ||
| 242 | /* Encoding of the file mode. */ | |
| 243 | ||
| 244 | #define	__S_IFMT	0170000	/* These bits determine file type. */ | |
| 245 | ||
| 246 | /* File types. */ | |
| 247 | #define	__S_IFDIR	0040000	/* Directory. */ | |
| 248 | #define	__S_IFCHR	0020000	/* Character device. */ | |
| 249 | #define	__S_IFBLK	0060000	/* Block device. */ | |
| 250 | #define	__S_IFREG	0100000	/* Regular file. */ | |
| 251 | #define	__S_IFIFO	0010000	/* FIFO. */ | |
| 252 | #define	__S_IFLNK	0120000	/* Symbolic link. */ | |
| 253 | #define	__S_IFSOCK	0140000	/* Socket. */ | |
| 254 | ||
| 255 | /* POSIX.1b objects. Note that these macros always evaluate to zero. But | |
| 256 | they do it by enforcing the correct use of the macros. */ | |
| 257 | #define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 258 | #define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 259 | #define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 260 | ||
| 261 | /* Protection bits. */ | |
| 262 | ||
| 263 | #define	__S_ISUID	04000	/* Set user ID on execution. */ | |
| 264 | #define	__S_ISGID	02000	/* Set group ID on execution. */ | |
| 265 | #define	__S_ISVTX	01000	/* Save swapped text after use (sticky). */ | |
| 266 | #define	__S_IREAD	0400	/* Read by owner. */ | |
| 267 | #define	__S_IWRITE	0200	/* Write by owner. */ | |
| 268 | #define	__S_IEXEC	0100	/* Execute by owner. */ | |
| 269 | ||
| 270 | #ifdef __USE_ATFILE | |
| 271 | # define UTIME_NOW	((1l << 30) - 1l) | |
| 272 | # define UTIME_OMIT	((1l << 30) - 2l) | |
| 273 | #endif | |
| 274 | ||
| 275 | #endif	/* bits/stat.h */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/kernel-features.h+1-3| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | /* Set flags signalling availability of kernel features based on given |
| 2 | 2 | kernel version number. PowerPC version. |
| 3 | Copyright (C) 1999-2020 Free Software Foundation, Inc. | |
| 3 | Copyright (C) 1999-2021 Free Software Foundation, Inc. | |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 | |
| 6 | 6 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -28,8 +28,6 @@ |
| 28 | 28 | #define __ASSUME_SEND_SYSCALL		1 |
| 29 | 29 | #define __ASSUME_RECV_SYSCALL		1 |
| 30 | 30 | #define __ASSUME_SHUTDOWN_SYSCALL	1 |
| 31 | #define __ASSUME_GETSOCKOPT_SYSCALL	1 | |
| 32 | #define __ASSUME_SETSOCKOPT_SYSCALL	1 | |
| 33 | 31 | |
| 34 | 32 | /* Define this if your 32-bit syscall API requires 64-bit register |
| 35 | 33 | pairs to start with an even-number register. */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h deleted-214| ... | ... | @@ -1,214 +0,0 @@ |
| 1 | /* Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library; if not, see | |
| 16 | <https://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | #ifndef _LINUX_POWERPC_SYSDEP_H | |
| 19 | #define _LINUX_POWERPC_SYSDEP_H 1 | |
| 20 | ||
| 21 | #include <sysdeps/unix/sysv/linux/powerpc/sysdep.h> | |
| 22 | #include <sysdeps/unix/sysv/linux/sysdep.h> | |
| 23 | #include <sysdeps/unix/powerpc/sysdep.h> | |
| 24 | #include <tls.h> | |
| 25 | ||
| 26 | /* For Linux we can use the system call table in the header file | |
| 27 | 	/usr/include/asm/unistd.h | |
| 28 | of the kernel. But these symbols do not follow the SYS_* syntax | |
| 29 | so we have to redefine the `SYS_ify' macro here. */ | |
| 30 | #undef SYS_ify | |
| 31 | #define SYS_ify(syscall_name)	__NR_##syscall_name | |
| 32 | ||
| 33 | #ifndef __ASSEMBLER__ | |
| 34 | ||
| 35 | # include <errno.h> | |
| 36 | ||
| 37 | /* Define a macro which expands inline into the wrapper code for a VDSO | |
| 38 | call. This use is for internal calls that do not need to handle errors | |
| 39 | normally. It will never touch errno. | |
| 40 | On powerpc a system call basically clobbers the same registers like a | |
| 41 | function call, with the exception of LR (which is needed for the | |
| 42 | "sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal | |
| 43 | an error return status). */ | |
| 44 | # define INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, type, nr, args...)	 \ | |
| 45 | ({									 \ | |
| 46 | register void *r0 __asm__ ("r0");					 \ | |
| 47 | register long int r3 __asm__ ("r3");				 \ | |
| 48 | register long int r4 __asm__ ("r4");				 \ | |
| 49 | register long int r5 __asm__ ("r5");				 \ | |
| 50 | register long int r6 __asm__ ("r6");				 \ | |
| 51 | register long int r7 __asm__ ("r7");				 \ | |
| 52 | register long int r8 __asm__ ("r8");				 \ | |
| 53 | register long int r9 __asm__ ("r9");				 \ | |
| 54 | register long int r10 __asm__ ("r10");				 \ | |
| 55 | register long int r11 __asm__ ("r11");				 \ | |
| 56 | register long int r12 __asm__ ("r12");				 \ | |
| 57 | register type rval __asm__ ("r3");					 \ | |
| 58 | LOADARGS_##nr (funcptr, args);					 \ | |
| 59 | __asm__ __volatile__						 \ | |
| 60 | ("mtctr %0\n\t"							 \ | |
| 61 | "bctrl\n\t"							 \ | |
| 62 | "mfcr %0"							 \ | |
| 63 | : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7), \ | |
| 64 | 	 "+r" (r8), "+r" (r9), "+r" (r10), "+r" (r11), "+r" (r12)	 \ | |
| 65 | : : "cr0", "ctr", "lr", "memory");				 \ | |
| 66 | err = (long int) r0;						 \ | |
| 67 | __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3), "r" (r4));	 \ | |
| 68 | rval;								 \ | |
| 69 | }) | |
| 70 | ||
| 71 | #define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ | |
| 72 | INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, long int, nr, args) | |
| 73 | ||
| 74 | # undef INLINE_SYSCALL | |
| 75 | # define INLINE_SYSCALL(name, nr, args...)				\ | |
| 76 | ({									\ | |
| 77 | INTERNAL_SYSCALL_DECL (sc_err);					\ | |
| 78 | long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args);	\ | |
| 79 | if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err))			\ | |
| 80 | {									\ | |
| 81 | 	__set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err));		\ | |
| 82 | 	sc_ret = -1L;							\ | |
| 83 | }									\ | |
| 84 | sc_ret;								\ | |
| 85 | }) | |
| 86 | ||
| 87 | /* Define a macro which expands inline into the wrapper code for a system | |
| 88 | call. This use is for internal calls that do not need to handle errors | |
| 89 | normally. It will never touch errno. | |
| 90 | On powerpc a system call basically clobbers the same registers like a | |
| 91 | function call, with the exception of LR (which is needed for the | |
| 92 | "sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal | |
| 93 | an error return status). */ | |
| 94 | ||
| 95 | # undef INTERNAL_SYSCALL_DECL | |
| 96 | # define INTERNAL_SYSCALL_DECL(err) long int err __attribute__ ((unused)) | |
| 97 | ||
| 98 | # undef INTERNAL_SYSCALL | |
| 99 | # define INTERNAL_SYSCALL_NCS(name, err, nr, args...)			\ | |
| 100 | ({									\ | |
| 101 | register long int r0 __asm__ ("r0");				\ | |
| 102 | register long int r3 __asm__ ("r3");				\ | |
| 103 | register long int r4 __asm__ ("r4");				\ | |
| 104 | register long int r5 __asm__ ("r5");				\ | |
| 105 | register long int r6 __asm__ ("r6");				\ | |
| 106 | register long int r7 __asm__ ("r7");				\ | |
| 107 | register long int r8 __asm__ ("r8");				\ | |
| 108 | register long int r9 __asm__ ("r9");				\ | |
| 109 | register long int r10 __asm__ ("r10");				\ | |
| 110 | register long int r11 __asm__ ("r11");				\ | |
| 111 | register long int r12 __asm__ ("r12");				\ | |
| 112 | LOADARGS_##nr(name, args);						\ | |
| 113 | __asm__ __volatile__						\ | |
| 114 | ("sc \n\t"							\ | |
| 115 | "mfcr %0"							\ | |
| 116 | : "=&r" (r0),							\ | |
| 117 | 	 "=&r" (r3), "=&r" (r4), "=&r" (r5), "=&r" (r6), "=&r" (r7),	\ | |
| 118 | 	 "=&r" (r8), "=&r" (r9), "=&r" (r10), "=&r" (r11), "=&r" (r12)	\ | |
| 119 | : ASM_INPUT_##nr							\ | |
| 120 | : "cr0", "ctr", "memory");					\ | |
| 121 | err = r0;								\ | |
| 122 | (int) r3;								\ | |
| 123 | }) | |
| 124 | # define INTERNAL_SYSCALL(name, err, nr, args...) \ | |
| 125 | INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) | |
| 126 | ||
| 127 | # undef INTERNAL_SYSCALL_ERROR_P | |
| 128 | # define INTERNAL_SYSCALL_ERROR_P(val, err) \ | |
| 129 | ((void) (val), __builtin_expect ((err) & (1 << 28), 0)) | |
| 130 | ||
| 131 | # undef INTERNAL_SYSCALL_ERRNO | |
| 132 | # define INTERNAL_SYSCALL_ERRNO(val, err) (val) | |
| 133 | ||
| 134 | # define LOADARGS_0(name, dummy)					 \ | |
| 135 | 	r0 = name | |
| 136 | # define LOADARGS_1(name, __arg1) \ | |
| 137 | 	long int arg1 = (long int) (__arg1);	\ | |
| 138 | LOADARGS_0(name, 0);					 \ | |
| 139 | 	extern void __illegally_sized_syscall_arg1 (void); \ | |
| 140 | 	if (__builtin_classify_type (__arg1) != 5 && sizeof (__arg1) > 4) \ | |
| 141 | 	 __illegally_sized_syscall_arg1 (); \ | |
| 142 | 	r3 = arg1 | |
| 143 | # define LOADARGS_2(name, __arg1, __arg2) \ | |
| 144 | 	long int arg2 = (long int) (__arg2); \ | |
| 145 | 	LOADARGS_1(name, __arg1); \ | |
| 146 | 	extern void __illegally_sized_syscall_arg2 (void); \ | |
| 147 | 	if (__builtin_classify_type (__arg2) != 5 && sizeof (__arg2) > 4) \ | |
| 148 | 	 __illegally_sized_syscall_arg2 (); \ | |
| 149 | 	r4 = arg2 | |
| 150 | # define LOADARGS_3(name, __arg1, __arg2, __arg3) \ | |
| 151 | 	long int arg3 = (long int) (__arg3); \ | |
| 152 | 	LOADARGS_2(name, __arg1, __arg2); \ | |
| 153 | 	extern void __illegally_sized_syscall_arg3 (void); \ | |
| 154 | 	if (__builtin_classify_type (__arg3) != 5 && sizeof (__arg3) > 4) \ | |
| 155 | 	 __illegally_sized_syscall_arg3 (); \ | |
| 156 | 	r5 = arg3 | |
| 157 | # define LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4) \ | |
| 158 | 	long int arg4 = (long int) (__arg4); \ | |
| 159 | 	LOADARGS_3(name, __arg1, __arg2, __arg3); \ | |
| 160 | 	extern void __illegally_sized_syscall_arg4 (void); \ | |
| 161 | 	if (__builtin_classify_type (__arg4) != 5 && sizeof (__arg4) > 4) \ | |
| 162 | 	 __illegally_sized_syscall_arg4 (); \ | |
| 163 | 	r6 = arg4 | |
| 164 | # define LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5) \ | |
| 165 | 	long int arg5 = (long int) (__arg5); \ | |
| 166 | 	LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4); \ | |
| 167 | 	extern void __illegally_sized_syscall_arg5 (void); \ | |
| 168 | 	if (__builtin_classify_type (__arg5) != 5 && sizeof (__arg5) > 4) \ | |
| 169 | 	 __illegally_sized_syscall_arg5 (); \ | |
| 170 | 	r7 = arg5 | |
| 171 | # define LOADARGS_6(name, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6) \ | |
| 172 | 	long int arg6 = (long int) (__arg6); \ | |
| 173 | 	LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5); \ | |
| 174 | 	extern void __illegally_sized_syscall_arg6 (void); \ | |
| 175 | 	if (__builtin_classify_type (__arg6) != 5 && sizeof (__arg6) > 4) \ | |
| 176 | 	 __illegally_sized_syscall_arg6 (); \ | |
| 177 | 	r8 = arg6 | |
| 178 | ||
| 179 | # define ASM_INPUT_0 "0" (r0) | |
| 180 | # define ASM_INPUT_1 ASM_INPUT_0, "1" (r3) | |
| 181 | # define ASM_INPUT_2 ASM_INPUT_1, "2" (r4) | |
| 182 | # define ASM_INPUT_3 ASM_INPUT_2, "3" (r5) | |
| 183 | # define ASM_INPUT_4 ASM_INPUT_3, "4" (r6) | |
| 184 | # define ASM_INPUT_5 ASM_INPUT_4, "5" (r7) | |
| 185 | # define ASM_INPUT_6 ASM_INPUT_5, "6" (r8) | |
| 186 | ||
| 187 | #endif /* __ASSEMBLER__ */ | |
| 188 | ||
| 189 | ||
| 190 | /* Pointer mangling support. */ | |
| 191 | #if IS_IN (rtld) | |
| 192 | /* We cannot use the thread descriptor because in ld.so we use setjmp | |
| 193 | earlier than the descriptor is initialized. */ | |
| 194 | #else | |
| 195 | # ifdef __ASSEMBLER__ | |
| 196 | # define PTR_MANGLE(reg, tmpreg) \ | |
| 197 | 	lwz	tmpreg,POINTER_GUARD(r2); \ | |
| 198 | 	xor	reg,tmpreg,reg | |
| 199 | # define PTR_MANGLE2(reg, tmpreg) \ | |
| 200 | 	xor	reg,tmpreg,reg | |
| 201 | # define PTR_MANGLE3(destreg, reg, tmpreg) \ | |
| 202 | 	lwz	tmpreg,POINTER_GUARD(r2); \ | |
| 203 | 	xor	destreg,tmpreg,reg | |
| 204 | # define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg) | |
| 205 | # define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg) | |
| 206 | # define PTR_DEMANGLE3(destreg, reg, tmpreg) PTR_MANGLE3 (destreg, reg, tmpreg) | |
| 207 | # else | |
| 208 | # define PTR_MANGLE(var) \ | |
| 209 | (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ()) | |
| 210 | # define PTR_DEMANGLE(var)	PTR_MANGLE (var) | |
| 211 | # endif | |
| 212 | #endif | |
| 213 | ||
| 214 | #endif /* linux/powerpc/powerpc32/sysdep.h */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h+3-195| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1992-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -17,202 +17,10 @@ |
| 17 | 17 | |
| 18 | 18 | /* Alan Modra <amodra@bigpond.net.au> rewrote the INLINE_SYSCALL macro */ |
| 19 | 19 | |
| 20 | #ifndef _LINUX_POWERPC_SYSDEP_H | |
| 21 | #define _LINUX_POWERPC_SYSDEP_H 1 | |
| 20 | #ifndef _LINUX_POWERPC64_SYSDEP_H | |
| 21 | #define _LINUX_POWERPC64_SYSDEP_H 1 | |
| 22 | 22 | |
| 23 | 23 | #include <sysdeps/unix/sysv/linux/powerpc/sysdep.h> |
| 24 | #include <sysdeps/unix/sysv/linux/sysdep.h> | |
| 25 | #include <sysdeps/unix/powerpc/sysdep.h> | |
| 26 | #include <tls.h> | |
| 27 | ||
| 28 | /* Define __set_errno() for INLINE_SYSCALL macro below. */ | |
| 29 | #ifndef __ASSEMBLER__ | |
| 30 | #include <errno.h> | |
| 31 | #endif | |
| 32 | ||
| 33 | /* For Linux we can use the system call table in the header file | |
| 34 | 	/usr/include/asm/unistd.h | |
| 35 | of the kernel. But these symbols do not follow the SYS_* syntax | |
| 36 | so we have to redefine the `SYS_ify' macro here. */ | |
| 37 | #undef SYS_ify | |
| 38 | #define SYS_ify(syscall_name)	__NR_##syscall_name | |
| 39 | ||
| 40 | #ifdef __ASSEMBLER__ | |
| 41 | ||
| 42 | /* This seems to always be the case on PPC. */ | |
| 43 | # define ALIGNARG(log2) log2 | |
| 44 | # define ASM_SIZE_DIRECTIVE(name) .size name,.-name | |
| 45 | ||
| 46 | #endif /* __ASSEMBLER__ */ | |
| 47 | ||
| 48 | /* Define a macro which expands inline into the wrapper code for a system | |
| 49 | call. This use is for internal calls that do not need to handle errors | |
| 50 | normally. It will never touch errno. This returns just what the kernel | |
| 51 | gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set) | |
| 52 | the negation of the return value in the kernel gets reverted. */ | |
| 53 | ||
| 54 | #define INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, type, nr, args...) \ | |
| 55 | ({									\ | |
| 56 | register void *r0 __asm__ ("r0");					\ | |
| 57 | register long int r3 __asm__ ("r3");				\ | |
| 58 | register long int r4 __asm__ ("r4");				\ | |
| 59 | register long int r5 __asm__ ("r5");				\ | |
| 60 | register long int r6 __asm__ ("r6");				\ | |
| 61 | register long int r7 __asm__ ("r7");				\ | |
| 62 | register long int r8 __asm__ ("r8");				\ | |
| 63 | register type rval __asm__ ("r3");				 \ | |
| 64 | LOADARGS_##nr (funcptr, args);					\ | |
| 65 | __asm__ __volatile__						\ | |
| 66 | ("mtctr %0\n\t"							\ | |
| 67 | "bctrl\n\t"							\ | |
| 68 | "mfcr %0\n\t"							\ | |
| 69 | "0:"								\ | |
| 70 | : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), \ | |
| 71 | "+r" (r7), "+r" (r8)						\ | |
| 72 | : : "r9", "r10", "r11", "r12", "cr0", "ctr", "lr", "memory");	\ | |
| 73 | err = (long int) r0;						\ | |
| 74 | __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3));		 \ | |
| 75 | rval;								\ | |
| 76 | }) | |
| 77 | ||
| 78 | #define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...)		\ | |
| 79 | INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, long int, nr, args) | |
| 80 | ||
| 81 | /* This version is for kernels that implement system calls that | |
| 82 | behave like function calls as far as register saving. */ | |
| 83 | #undef INLINE_SYSCALL | |
| 84 | #define INLINE_SYSCALL(name, nr, args...)				\ | |
| 85 | ({									\ | |
| 86 | INTERNAL_SYSCALL_DECL (sc_err);					\ | |
| 87 | long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args);	\ | |
| 88 | if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err))			\ | |
| 89 | {									\ | |
| 90 | __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err));		\ | |
| 91 | sc_ret = -1L;							\ | |
| 92 | }									\ | |
| 93 | sc_ret;								\ | |
| 94 | }) | |
| 95 | ||
| 96 | /* Define a macro which expands inline into the wrapper code for a system | |
| 97 | call. This use is for internal calls that do not need to handle errors | |
| 98 | normally. It will never touch errno. This returns just what the kernel | |
| 99 | gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set) | |
| 100 | the negation of the return value in the kernel gets reverted. */ | |
| 101 | ||
| 102 | #undef INTERNAL_SYSCALL | |
| 103 | #define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ | |
| 104 | ({									\ | |
| 105 | register long int r0 __asm__ ("r0");				\ | |
| 106 | register long int r3 __asm__ ("r3");				\ | |
| 107 | register long int r4 __asm__ ("r4");				\ | |
| 108 | register long int r5 __asm__ ("r5");				\ | |
| 109 | register long int r6 __asm__ ("r6");				\ | |
| 110 | register long int r7 __asm__ ("r7");				\ | |
| 111 | register long int r8 __asm__ ("r8");				\ | |
| 112 | LOADARGS_##nr (name, ##args);					\ | |
| 113 | __asm__ __volatile__						\ | |
| 114 | ("sc\n\t"								\ | |
| 115 | "mfcr %0\n\t"							\ | |
| 116 | "0:"								\ | |
| 117 | : "=&r" (r0),							\ | |
| 118 | "=&r" (r3), "=&r" (r4), "=&r" (r5),				\ | |
| 119 | "=&r" (r6), "=&r" (r7), "=&r" (r8)				\ | |
| 120 | : ASM_INPUT_##nr							\ | |
| 121 | : "r9", "r10", "r11", "r12",					\ | |
| 122 | "cr0", "ctr", "memory");					\ | |
| 123 | 	 err = r0; \ | |
| 124 | r3; \ | |
| 125 | }) | |
| 126 | #define INTERNAL_SYSCALL(name, err, nr, args...)			\ | |
| 127 | INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, args) | |
| 128 | ||
| 129 | #undef INTERNAL_SYSCALL_DECL | |
| 130 | #define INTERNAL_SYSCALL_DECL(err) long int err __attribute__ ((unused)) | |
| 131 | ||
| 132 | #undef INTERNAL_SYSCALL_ERROR_P | |
| 133 | #define INTERNAL_SYSCALL_ERROR_P(val, err) \ | |
| 134 | ((void) (val), __builtin_expect ((err) & (1 << 28), 0)) | |
| 135 | ||
| 136 | #undef INTERNAL_SYSCALL_ERRNO | |
| 137 | #define INTERNAL_SYSCALL_ERRNO(val, err) (val) | |
| 138 | ||
| 139 | #define LOADARGS_0(name, dummy) \ | |
| 140 | 	r0 = name | |
| 141 | #define LOADARGS_1(name, __arg1) \ | |
| 142 | 	long int arg1 = (long int) (__arg1); \ | |
| 143 | 	LOADARGS_0(name, 0); \ | |
| 144 | 	extern void __illegally_sized_syscall_arg1 (void); \ | |
| 145 | 	if (__builtin_classify_type (__arg1) != 5 && sizeof (__arg1) > 8) \ | |
| 146 | 	 __illegally_sized_syscall_arg1 (); \ | |
| 147 | 	r3 = arg1 | |
| 148 | #define LOADARGS_2(name, __arg1, __arg2) \ | |
| 149 | 	long int arg2 = (long int) (__arg2); \ | |
| 150 | 	LOADARGS_1(name, __arg1); \ | |
| 151 | 	extern void __illegally_sized_syscall_arg2 (void); \ | |
| 152 | 	if (__builtin_classify_type (__arg2) != 5 && sizeof (__arg2) > 8) \ | |
| 153 | 	 __illegally_sized_syscall_arg2 (); \ | |
| 154 | 	r4 = arg2 | |
| 155 | #define LOADARGS_3(name, __arg1, __arg2, __arg3) \ | |
| 156 | 	long int arg3 = (long int) (__arg3); \ | |
| 157 | 	LOADARGS_2(name, __arg1, __arg2); \ | |
| 158 | 	extern void __illegally_sized_syscall_arg3 (void); \ | |
| 159 | 	if (__builtin_classify_type (__arg3) != 5 && sizeof (__arg3) > 8) \ | |
| 160 | 	 __illegally_sized_syscall_arg3 (); \ | |
| 161 | 	r5 = arg3 | |
| 162 | #define LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4) \ | |
| 163 | 	long int arg4 = (long int) (__arg4); \ | |
| 164 | 	LOADARGS_3(name, __arg1, __arg2, __arg3); \ | |
| 165 | 	extern void __illegally_sized_syscall_arg4 (void); \ | |
| 166 | 	if (__builtin_classify_type (__arg4) != 5 && sizeof (__arg4) > 8) \ | |
| 167 | 	 __illegally_sized_syscall_arg4 (); \ | |
| 168 | 	r6 = arg4 | |
| 169 | #define LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5) \ | |
| 170 | 	long int arg5 = (long int) (__arg5); \ | |
| 171 | 	LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4); \ | |
| 172 | 	extern void __illegally_sized_syscall_arg5 (void); \ | |
| 173 | 	if (__builtin_classify_type (__arg5) != 5 && sizeof (__arg5) > 8) \ | |
| 174 | 	 __illegally_sized_syscall_arg5 (); \ | |
| 175 | 	r7 = arg5 | |
| 176 | #define LOADARGS_6(name, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6) \ | |
| 177 | 	long int arg6 = (long int) (__arg6); \ | |
| 178 | 	LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5); \ | |
| 179 | 	extern void __illegally_sized_syscall_arg6 (void); \ | |
| 180 | 	if (__builtin_classify_type (__arg6) != 5 && sizeof (__arg6) > 8) \ | |
| 181 | 	 __illegally_sized_syscall_arg6 (); \ | |
| 182 | 	r8 = arg6 | |
| 183 | ||
| 184 | #define ASM_INPUT_0 "0" (r0) | |
| 185 | #define ASM_INPUT_1 ASM_INPUT_0, "1" (r3) | |
| 186 | #define ASM_INPUT_2 ASM_INPUT_1, "2" (r4) | |
| 187 | #define ASM_INPUT_3 ASM_INPUT_2, "3" (r5) | |
| 188 | #define ASM_INPUT_4 ASM_INPUT_3, "4" (r6) | |
| 189 | #define ASM_INPUT_5 ASM_INPUT_4, "5" (r7) | |
| 190 | #define ASM_INPUT_6 ASM_INPUT_5, "6" (r8) | |
| 191 | ||
| 192 | ||
| 193 | /* Pointer mangling support. */ | |
| 194 | #if IS_IN (rtld) | |
| 195 | /* We cannot use the thread descriptor because in ld.so we use setjmp | |
| 196 | earlier than the descriptor is initialized. */ | |
| 197 | #else | |
| 198 | # ifdef __ASSEMBLER__ | |
| 199 | # define PTR_MANGLE(reg, tmpreg) \ | |
| 200 | 	ld	tmpreg,POINTER_GUARD(r13); \ | |
| 201 | 	xor	reg,tmpreg,reg | |
| 202 | # define PTR_MANGLE2(reg, tmpreg) \ | |
| 203 | 	xor	reg,tmpreg,reg | |
| 204 | # define PTR_MANGLE3(destreg, reg, tmpreg) \ | |
| 205 | 	ld	tmpreg,POINTER_GUARD(r13); \ | |
| 206 | 	xor	destreg,tmpreg,reg | |
| 207 | # define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg) | |
| 208 | # define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg) | |
| 209 | # define PTR_DEMANGLE3(destreg, reg, tmpreg) PTR_MANGLE3 (destreg, reg, tmpreg) | |
| 210 | # else | |
| 211 | # define PTR_MANGLE(var) \ | |
| 212 | (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ()) | |
| 213 | # define PTR_DEMANGLE(var)	PTR_MANGLE (var) | |
| 214 | # endif | |
| 215 | #endif | |
| 216 | 24 | |
| 217 | 25 | /* In the PowerPC64 ABI, the unadorned F_GETLK* opcodes should be used |
| 218 | 26 | even by largefile64 code. */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/xstatver.h created+17| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | /* Versions of the 'struct stat' data structure used in compatibility xstat | |
| 2 | functions. */ | |
| 3 | #define _STAT_VER_LINUX_OLD	1 | |
| 4 | #define _STAT_VER_KERNEL	1 | |
| 5 | #define _STAT_VER_SVR4		2 | |
| 6 | #define _STAT_VER_LINUX	 3 | |
| 7 | #if __WORDSIZE == 32 | |
| 8 | # define _STAT_VER		_STAT_VER_LINUX | |
| 9 | #else | |
| 10 | # define _STAT_VER		_STAT_VER_KERNEL | |
| 11 | #endif | |
| 12 | ||
| 13 | /* Versions of the 'xmknod' interface used in compatibility xmknod | |
| 14 | functions. */ | |
| 15 | #define _MKNOD_VER_LINUX	1 | |
| 16 | #define _MKNOD_VER_SVR4		2 | |
| 17 | #define _MKNOD_VER		_MKNOD_VER_LINUX |
lib/libc/glibc/sysdeps/unix/sysv/linux/riscv/kernel-features.h+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | /* Set flags signalling availability of kernel features based on given |
| 2 | 2 | kernel version number. RISC-V version. |
| 3 | Copyright (C) 2018-2020 Free Software Foundation, Inc. | |
| 3 | Copyright (C) 2018-2021 Free Software Foundation, Inc. | |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 | |
| 6 | 6 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/unix/sysv/linux/riscv/sysdep.h+112-76| ... | ... | @@ -22,6 +22,32 @@ |
| 22 | 22 | #include <sysdeps/unix/sysv/linux/generic/sysdep.h> |
| 23 | 23 | #include <tls.h> |
| 24 | 24 | |
| 25 | #undef SYS_ify | |
| 26 | #define SYS_ify(syscall_name)	__NR_##syscall_name | |
| 27 | ||
| 28 | #if __WORDSIZE == 32 | |
| 29 | ||
| 30 | /* Workarounds for generic code needing to handle 64-bit time_t. */ | |
| 31 | ||
| 32 | /* Fix sysdeps/unix/sysv/linux/clock_getcpuclockid.c. */ | |
| 33 | #define __NR_clock_getres	__NR_clock_getres_time64 | |
| 34 | /* Fix sysdeps/nptl/lowlevellock-futex.h. */ | |
| 35 | #define __NR_futex		__NR_futex_time64 | |
| 36 | /* Fix sysdeps/unix/sysv/linux/pause.c. */ | |
| 37 | #define __NR_ppoll		__NR_ppoll_time64 | |
| 38 | /* Fix sysdeps/unix/sysv/linux/select.c. */ | |
| 39 | #define __NR_pselect6		__NR_pselect6_time64 | |
| 40 | /* Fix sysdeps/unix/sysv/linux/recvmmsg.c. */ | |
| 41 | #define __NR_recvmmsg		__NR_recvmmsg_time64 | |
| 42 | /* Fix sysdeps/unix/sysv/linux/sigtimedwait.c. */ | |
| 43 | #define __NR_rt_sigtimedwait	__NR_rt_sigtimedwait_time64 | |
| 44 | /* Fix sysdeps/unix/sysv/linux/semtimedop.c. */ | |
| 45 | #define __NR_semtimedop		__NR_semtimedop_time64 | |
| 46 | /* Hack sysdeps/unix/sysv/linux/generic/utimes.c. */ | |
| 47 | #define __NR_utimensat		__NR_utimensat_time64 | |
| 48 | ||
| 49 | #endif /* __WORDSIZE == 32 */ | |
| 50 | ||
| 25 | 51 | #ifdef __ASSEMBLER__ |
| 26 | 52 | |
| 27 | 53 | # include <sys/asm.h> |
| ... | ... | @@ -107,56 +133,38 @@ |
| 107 | 133 | # undef ret_ERRVAL |
| 108 | 134 | # define ret_ERRVAL ret |
| 109 | 135 | |
| 110 | #endif /* __ASSEMBLER__ */ | |
| 136 | #else /* !__ASSEMBLER__ */ | |
| 111 | 137 | |
| 112 | /* In order to get __set_errno() definition in INLINE_SYSCALL. */ | |
| 113 | #ifndef __ASSEMBLER__ | |
| 114 | # include <errno.h> | |
| 115 | #endif | |
| 138 | # if __WORDSIZE == 64 | |
| 139 | # define VDSO_NAME	"LINUX_4.15" | |
| 140 | # define VDSO_HASH	182943605 | |
| 116 | 141 | |
| 117 | #include <sysdeps/unix/sysdep.h> | |
| 118 | ||
| 119 | #undef SYS_ify | |
| 120 | #define SYS_ify(syscall_name)	__NR_##syscall_name | |
| 121 | ||
| 122 | #ifndef __ASSEMBLER__ | |
| 142 | /* List of system calls which are supported as vsyscalls only | |
| 143 | for RV64. */ | |
| 144 | # define HAVE_CLOCK_GETRES64_VSYSCALL	"__vdso_clock_getres" | |
| 145 | # define HAVE_CLOCK_GETTIME64_VSYSCALL	"__vdso_clock_gettime" | |
| 146 | # define HAVE_GETTIMEOFDAY_VSYSCALL	"__vdso_gettimeofday" | |
| 147 | # else | |
| 148 | # define VDSO_NAME	"LINUX_5.4" | |
| 149 | # define VDSO_HASH	61765876 | |
| 123 | 150 | |
| 124 | # define VDSO_NAME "LINUX_4.15" | |
| 125 | # define VDSO_HASH 182943605 | |
| 151 | /* RV32 does not support the gettime VDSO syscalls. */ | |
| 152 | # endif | |
| 126 | 153 | |
| 127 | /* List of system calls which are supported as vsyscalls. */ | |
| 128 | # define HAVE_CLOCK_GETRES64_VSYSCALL	"__vdso_clock_getres" | |
| 129 | # define HAVE_CLOCK_GETTIME64_VSYSCALL	"__vdso_clock_gettime" | |
| 130 | # define HAVE_GETTIMEOFDAY_VSYSCALL	"__vdso_gettimeofday" | |
| 154 | /* List of system calls which are supported as vsyscalls (for RV32 and | |
| 155 | RV64). */ | |
| 131 | 156 | # define HAVE_GETCPU_VSYSCALL		"__vdso_getcpu" |
| 132 | 157 | |
| 133 | /* Define a macro which expands into the inline wrapper code for a system | |
| 134 | call. */ | |
| 135 | # undef INLINE_SYSCALL | |
| 136 | # define INLINE_SYSCALL(name, nr, args...)				\ | |
| 137 | ({ INTERNAL_SYSCALL_DECL (err);					\ | |
| 138 | long int __sys_result = INTERNAL_SYSCALL (name, err, nr, args);	\ | |
| 139 | if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (__sys_result, ))) \ | |
| 140 | {								\ | |
| 141 | __set_errno (INTERNAL_SYSCALL_ERRNO (__sys_result, ));		\ | |
| 142 | 	 __sys_result = (unsigned long) -1;				\ | |
| 143 | }								\ | |
| 144 | __sys_result; }) | |
| 145 | ||
| 146 | # define INTERNAL_SYSCALL_DECL(err) do { } while (0) | |
| 147 | ||
| 148 | # define INTERNAL_SYSCALL_ERROR_P(val, err) \ | |
| 149 | ((unsigned long int) (val) > -4096UL) | |
| 150 | ||
| 151 | # define INTERNAL_SYSCALL_ERRNO(val, err) (-val) | |
| 158 | # undef HAVE_INTERNAL_BRK_ADDR_SYMBOL | |
| 159 | # define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 | |
| 152 | 160 | |
| 153 | # define INTERNAL_SYSCALL(name, err, nr, args...) \ | |
| 154 | 	internal_syscall##nr (SYS_ify (name), err, args) | |
| 161 | # define INTERNAL_SYSCALL(name, nr, args...) \ | |
| 162 | 	internal_syscall##nr (SYS_ify (name), args) | |
| 155 | 163 | |
| 156 | # define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ | |
| 157 | 	internal_syscall##nr (number, err, args) | |
| 164 | # define INTERNAL_SYSCALL_NCS(number, nr, args...) \ | |
| 165 | 	internal_syscall##nr (number, args) | |
| 158 | 166 | |
| 159 | # define internal_syscall0(number, err, dummy...)			\ | |
| 167 | # define internal_syscall0(number, dummy...)			\ | |
| 160 | 168 | ({ 									\ |
| 161 | 169 | 	long int _sys_result;						\ |
| 162 | 170 | 									\ |
| ... | ... | @@ -173,13 +181,14 @@ |
| 173 | 181 | 	_sys_result;							\ |
| 174 | 182 | }) |
| 175 | 183 | |
| 176 | # define internal_syscall1(number, err, arg0)				\ | |
| 184 | # define internal_syscall1(number, arg0)				\ | |
| 177 | 185 | ({ 									\ |
| 178 | 186 | 	long int _sys_result;						\ |
| 187 | 	long int _arg0 = (long int) (arg0);				\ | |
| 179 | 188 | 									\ |
| 180 | 189 | 	{								\ |
| 181 | 190 | 	register long int __a7 asm ("a7") = number;			\ |
| 182 | 	register long int __a0 asm ("a0") = (long int) (arg0);		\ | |
| 191 | 	register long int __a0 asm ("a0") = _arg0;			\ | |
| 183 | 192 | 	__asm__ volatile ( 						\ |
| 184 | 193 | 	"scall\n\t" 							\ |
| 185 | 194 | 	: "+r" (__a0)							\ |
| ... | ... | @@ -190,14 +199,16 @@ |
| 190 | 199 | 	_sys_result;							\ |
| 191 | 200 | }) |
| 192 | 201 | |
| 193 | # define internal_syscall2(number, err, arg0, arg1)	 		\ | |
| 202 | # define internal_syscall2(number, arg0, arg1)	 		\ | |
| 194 | 203 | ({ 									\ |
| 195 | 204 | 	long int _sys_result;						\ |
| 205 | 	long int _arg0 = (long int) (arg0);				\ | |
| 206 | 	long int _arg1 = (long int) (arg1);				\ | |
| 196 | 207 | 									\ |
| 197 | 208 | 	{								\ |
| 198 | 209 | 	register long int __a7 asm ("a7") = number;			\ |
| 199 | 	register long int __a0 asm ("a0") = (long int) (arg0);		\ | |
| 200 | 	register long int __a1 asm ("a1") = (long int) (arg1);		\ | |
| 210 | 	register long int __a0 asm ("a0") = _arg0;			\ | |
| 211 | 	register long int __a1 asm ("a1") = _arg1;			\ | |
| 201 | 212 | 	__asm__ volatile ( 						\ |
| 202 | 213 | 	"scall\n\t" 							\ |
| 203 | 214 | 	: "+r" (__a0)							\ |
| ... | ... | @@ -208,15 +219,18 @@ |
| 208 | 219 | 	_sys_result;							\ |
| 209 | 220 | }) |
| 210 | 221 | |
| 211 | # define internal_syscall3(number, err, arg0, arg1, arg2) 		\ | |
| 222 | # define internal_syscall3(number, arg0, arg1, arg2) 		\ | |
| 212 | 223 | ({ 									\ |
| 213 | 224 | 	long int _sys_result;						\ |
| 225 | 	long int _arg0 = (long int) (arg0);				\ | |
| 226 | 	long int _arg1 = (long int) (arg1);				\ | |
| 227 | 	long int _arg2 = (long int) (arg2);				\ | |
| 214 | 228 | 									\ |
| 215 | 229 | 	{								\ |
| 216 | 230 | 	register long int __a7 asm ("a7") = number;			\ |
| 217 | 	register long int __a0 asm ("a0") = (long int) (arg0);		\ | |
| 218 | 	register long int __a1 asm ("a1") = (long int) (arg1);		\ | |
| 219 | 	register long int __a2 asm ("a2") = (long int) (arg2);		\ | |
| 231 | 	register long int __a0 asm ("a0") = _arg0;			\ | |
| 232 | 	register long int __a1 asm ("a1") = _arg1;			\ | |
| 233 | 	register long int __a2 asm ("a2") = _arg2;			\ | |
| 220 | 234 | 	__asm__ volatile ( 						\ |
| 221 | 235 | 	"scall\n\t" 							\ |
| 222 | 236 | 	: "+r" (__a0)							\ |
| ... | ... | @@ -227,16 +241,20 @@ |
| 227 | 241 | 	_sys_result;							\ |
| 228 | 242 | }) |
| 229 | 243 | |
| 230 | # define internal_syscall4(number, err, arg0, arg1, arg2, arg3)	 \ | |
| 244 | # define internal_syscall4(number, arg0, arg1, arg2, arg3)	 \ | |
| 231 | 245 | ({ 									\ |
| 232 | 246 | 	long int _sys_result;						\ |
| 247 | 	long int _arg0 = (long int) (arg0);				\ | |
| 248 | 	long int _arg1 = (long int) (arg1);				\ | |
| 249 | 	long int _arg2 = (long int) (arg2);				\ | |
| 250 | 	long int _arg3 = (long int) (arg3);				\ | |
| 233 | 251 | 									\ |
| 234 | 252 | 	{								\ |
| 235 | 253 | 	register long int __a7 asm ("a7") = number;			\ |
| 236 | 	register long int __a0 asm ("a0") = (long int) (arg0);		\ | |
| 237 | 	register long int __a1 asm ("a1") = (long int) (arg1);		\ | |
| 238 | 	register long int __a2 asm ("a2") = (long int) (arg2);		\ | |
| 239 | 	register long int __a3 asm ("a3") = (long int) (arg3);		\ | |
| 254 | 	register long int __a0 asm ("a0") = _arg0;			\ | |
| 255 | 	register long int __a1 asm ("a1") = _arg1;			\ | |
| 256 | 	register long int __a2 asm ("a2") = _arg2;			\ | |
| 257 | 	register long int __a3 asm ("a3") = _arg3;			\ | |
| 240 | 258 | 	__asm__ volatile ( 						\ |
| 241 | 259 | 	"scall\n\t" 							\ |
| 242 | 260 | 	: "+r" (__a0)							\ |
| ... | ... | @@ -247,17 +265,22 @@ |
| 247 | 265 | 	_sys_result;							\ |
| 248 | 266 | }) |
| 249 | 267 | |
| 250 | # define internal_syscall5(number, err, arg0, arg1, arg2, arg3, arg4) \ | |
| 268 | # define internal_syscall5(number, arg0, arg1, arg2, arg3, arg4) \ | |
| 251 | 269 | ({ 									\ |
| 252 | 270 | 	long int _sys_result;						\ |
| 271 | 	long int _arg0 = (long int) (arg0);				\ | |
| 272 | 	long int _arg1 = (long int) (arg1);				\ | |
| 273 | 	long int _arg2 = (long int) (arg2);				\ | |
| 274 | 	long int _arg3 = (long int) (arg3);				\ | |
| 275 | 	long int _arg4 = (long int) (arg4);				\ | |
| 253 | 276 | 									\ |
| 254 | 277 | 	{								\ |
| 255 | 278 | 	register long int __a7 asm ("a7") = number;			\ |
| 256 | 	register long int __a0 asm ("a0") = (long int) (arg0);		\ | |
| 257 | 	register long int __a1 asm ("a1") = (long int) (arg1);		\ | |
| 258 | 	register long int __a2 asm ("a2") = (long int) (arg2);		\ | |
| 259 | 	register long int __a3 asm ("a3") = (long int) (arg3);		\ | |
| 260 | 	register long int __a4 asm ("a4") = (long int) (arg4);		\ | |
| 279 | 	register long int __a0 asm ("a0") = _arg0;			\ | |
| 280 | 	register long int __a1 asm ("a1") = _arg1;			\ | |
| 281 | 	register long int __a2 asm ("a2") = _arg2;			\ | |
| 282 | 	register long int __a3 asm ("a3") = _arg3;			\ | |
| 283 | 	register long int __a4 asm ("a4") = _arg4;			\ | |
| 261 | 284 | 	__asm__ volatile ( 						\ |
| 262 | 285 | 	"scall\n\t" 							\ |
| 263 | 286 | 	: "+r" (__a0)							\ |
| ... | ... | @@ -268,18 +291,24 @@ |
| 268 | 291 | 	_sys_result;							\ |
| 269 | 292 | }) |
| 270 | 293 | |
| 271 | # define internal_syscall6(number, err, arg0, arg1, arg2, arg3, arg4, arg5) \ | |
| 294 | # define internal_syscall6(number, arg0, arg1, arg2, arg3, arg4, arg5) \ | |
| 272 | 295 | ({ 									\ |
| 273 | 296 | 	long int _sys_result;						\ |
| 297 | 	long int _arg0 = (long int) (arg0);				\ | |
| 298 | 	long int _arg1 = (long int) (arg1);				\ | |
| 299 | 	long int _arg2 = (long int) (arg2);				\ | |
| 300 | 	long int _arg3 = (long int) (arg3);				\ | |
| 301 | 	long int _arg4 = (long int) (arg4);				\ | |
| 302 | 	long int _arg5 = (long int) (arg5);				\ | |
| 274 | 303 | 									\ |
| 275 | 304 | 	{								\ |
| 276 | 305 | 	register long int __a7 asm ("a7") = number;			\ |
| 277 | 	register long int __a0 asm ("a0") = (long int) (arg0);		\ | |
| 278 | 	register long int __a1 asm ("a1") = (long int) (arg1);		\ | |
| 279 | 	register long int __a2 asm ("a2") = (long int) (arg2);		\ | |
| 280 | 	register long int __a3 asm ("a3") = (long int) (arg3);		\ | |
| 281 | 	register long int __a4 asm ("a4") = (long int) (arg4);		\ | |
| 282 | 	register long int __a5 asm ("a5") = (long int) (arg5);		\ | |
| 306 | 	register long int __a0 asm ("a0") = _arg0;			\ | |
| 307 | 	register long int __a1 asm ("a1") = _arg1;			\ | |
| 308 | 	register long int __a2 asm ("a2") = _arg2;			\ | |
| 309 | 	register long int __a3 asm ("a3") = _arg3;			\ | |
| 310 | 	register long int __a4 asm ("a4") = _arg4;			\ | |
| 311 | 	register long int __a5 asm ("a5") = _arg5;			\ | |
| 283 | 312 | 	__asm__ volatile ( 						\ |
| 284 | 313 | 	"scall\n\t" 							\ |
| 285 | 314 | 	: "+r" (__a0)							\ |
| ... | ... | @@ -291,19 +320,26 @@ |
| 291 | 320 | 	_sys_result;							\ |
| 292 | 321 | }) |
| 293 | 322 | |
| 294 | # define internal_syscall7(number, err, arg0, arg1, arg2, arg3, arg4, arg5, arg6) \ | |
| 323 | # define internal_syscall7(number, arg0, arg1, arg2, arg3, arg4, arg5, arg6) \ | |
| 295 | 324 | ({ 									\ |
| 296 | 325 | 	long int _sys_result;						\ |
| 326 | 	long int _arg0 = (long int) (arg0);				\ | |
| 327 | 	long int _arg1 = (long int) (arg1);				\ | |
| 328 | 	long int _arg2 = (long int) (arg2);				\ | |
| 329 | 	long int _arg3 = (long int) (arg3);				\ | |
| 330 | 	long int _arg4 = (long int) (arg4);				\ | |
| 331 | 	long int _arg5 = (long int) (arg5);				\ | |
| 332 | 	long int _arg6 = (long int) (arg6);				\ | |
| 297 | 333 | 									\ |
| 298 | 334 | 	{								\ |
| 299 | 335 | 	register long int __a7 asm ("a7") = number;			\ |
| 300 | 	register long int __a0 asm ("a0") = (long int) (arg0);		\ | |
| 301 | 	register long int __a1 asm ("a1") = (long int) (arg1);		\ | |
| 302 | 	register long int __a2 asm ("a2") = (long int) (arg2);		\ | |
| 303 | 	register long int __a3 asm ("a3") = (long int) (arg3);		\ | |
| 304 | 	register long int __a4 asm ("a4") = (long int) (arg4);		\ | |
| 305 | 	register long int __a5 asm ("a5") = (long int) (arg5);		\ | |
| 306 | 	register long int __a6 asm ("a6") = (long int) (arg6);		\ | |
| 336 | 	register long int __a0 asm ("a0") = _arg0;			\ | |
| 337 | 	register long int __a1 asm ("a1") = _arg1;			\ | |
| 338 | 	register long int __a2 asm ("a2") = _arg2;			\ | |
| 339 | 	register long int __a3 asm ("a3") = _arg3;			\ | |
| 340 | 	register long int __a4 asm ("a4") = _arg4;			\ | |
| 341 | 	register long int __a5 asm ("a5") = _arg5;			\ | |
| 342 | 	register long int __a6 asm ("a6") = _arg6;			\ | |
| 307 | 343 | 	__asm__ volatile ( 						\ |
| 308 | 344 | 	"scall\n\t" 							\ |
| 309 | 345 | 	: "+r" (__a0)							\ |
lib/libc/glibc/sysdeps/unix/sysv/linux/s390/bits/stat.h deleted-265| ... | ... | @@ -1,265 +0,0 @@ |
| 1 | /* Copyright (C) 2000-2020 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library; if not, see | |
| 16 | <https://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | #if !defined _SYS_STAT_H && !defined _FCNTL_H | |
| 19 | # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." | |
| 20 | #endif | |
| 21 | ||
| 22 | #ifndef _BITS_STAT_H | |
| 23 | #define _BITS_STAT_H	1 | |
| 24 | ||
| 25 | #include <bits/wordsize.h> | |
| 26 | ||
| 27 | #if __WORDSIZE == 64 | |
| 28 | /* Versions of the `struct stat' data structure. */ | |
| 29 | # define _STAT_VER_KERNEL	0 | |
| 30 | # define _STAT_VER_LINUX	1 | |
| 31 | # define _STAT_VER		_STAT_VER_LINUX | |
| 32 | ||
| 33 | /* Versions of the `xmknod' interface.	*/ | |
| 34 | #define _MKNOD_VER_LINUX	0 | |
| 35 | #else | |
| 36 | /* Versions of the `struct stat' data structure. */ | |
| 37 | # define _STAT_VER_LINUX_OLD	1 | |
| 38 | # define _STAT_VER_KERNEL	1 | |
| 39 | # define _STAT_VER_SVR4		2 | |
| 40 | # define _STAT_VER_LINUX	3 | |
| 41 | # define _STAT_VER		_STAT_VER_LINUX | |
| 42 | ||
| 43 | /* Versions of the `xmknod' interface. */ | |
| 44 | # define _MKNOD_VER_LINUX	1 | |
| 45 | # define _MKNOD_VER_SVR4	2 | |
| 46 | # define _MKNOD_VER		_MKNOD_VER_LINUX | |
| 47 | #endif | |
| 48 | ||
| 49 | #if __WORDSIZE == 64 | |
| 50 | struct stat | |
| 51 | { | |
| 52 | __dev_t st_dev;		/* Device. */ | |
| 53 | __ino_t st_ino;		/* File serial number.	*/ | |
| 54 | __nlink_t st_nlink;		/* Link count.	*/ | |
| 55 | __mode_t st_mode;		/* File mode. */ | |
| 56 | __uid_t st_uid;		/* User ID of the file's owner.	*/ | |
| 57 | __gid_t st_gid;		/* Group ID of the file's group.*/ | |
| 58 | int __glibc_reserved0; | |
| 59 | __dev_t st_rdev;		/* Device number, if device. */ | |
| 60 | __off_t st_size;		/* Size of file, in bytes. */ | |
| 61 | #ifdef __USE_XOPEN2K8 | |
| 62 | /* Nanosecond resolution timestamps are stored in a format | |
| 63 | equivalent to 'struct timespec'. This is the type used | |
| 64 | whenever possible but the Unix namespace rules do not allow the | |
| 65 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 66 | Therefore we have to handle the use of this header in strictly | |
| 67 | standard-compliant sources special. */ | |
| 68 | struct timespec st_atim;		/* Time of last access. */ | |
| 69 | struct timespec st_mtim;		/* Time of last modification. */ | |
| 70 | struct timespec st_ctim;		/* Time of last status change. */ | |
| 71 | # define st_atime st_atim.tv_sec	/* Backward compatibility. */ | |
| 72 | # define st_mtime st_mtim.tv_sec | |
| 73 | # define st_ctime st_ctim.tv_sec | |
| 74 | #else | |
| 75 | __time_t st_atime;			/* Time of last access. */ | |
| 76 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 77 | __time_t st_mtime;			/* Time of last modification. */ | |
| 78 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 79 | __time_t st_ctime;			/* Time of last status change. */ | |
| 80 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 81 | #endif | |
| 82 | __blksize_t st_blksize;	/* Optimal block size for I/O.	*/ | |
| 83 | __blkcnt_t st_blocks;	/* Nr. 512-byte blocks allocated. */ | |
| 84 | long int __glibc_reserved[3]; | |
| 85 | }; | |
| 86 | #else | |
| 87 | struct stat | |
| 88 | { | |
| 89 | __dev_t st_dev;			/* Device. */ | |
| 90 | unsigned int __pad1; | |
| 91 | # ifndef __USE_FILE_OFFSET64 | |
| 92 | __ino_t st_ino;			/* File serial number.	*/ | |
| 93 | # else | |
| 94 | __ino_t __st_ino;			/* 32bit file serial number.	*/ | |
| 95 | # endif | |
| 96 | __mode_t st_mode;			/* File mode. */ | |
| 97 | __nlink_t st_nlink;			/* Link count. */ | |
| 98 | __uid_t st_uid;			/* User ID of the file's owner.	*/ | |
| 99 | __gid_t st_gid;			/* Group ID of the file's group.*/ | |
| 100 | __dev_t st_rdev;			/* Device number, if device. */ | |
| 101 | unsigned int __pad2; | |
| 102 | # ifndef __USE_FILE_OFFSET64 | |
| 103 | __off_t st_size;			/* Size of file, in bytes. */ | |
| 104 | # else | |
| 105 | __off64_t st_size;			/* Size of file, in bytes. */ | |
| 106 | # endif | |
| 107 | __blksize_t st_blksize;		/* Optimal block size for I/O. */ | |
| 108 | ||
| 109 | # ifndef __USE_FILE_OFFSET64 | |
| 110 | __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */ | |
| 111 | # else | |
| 112 | __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */ | |
| 113 | # endif | |
| 114 | # ifdef __USE_XOPEN2K8 | |
| 115 | /* Nanosecond resolution timestamps are stored in a format | |
| 116 | equivalent to 'struct timespec'. This is the type used | |
| 117 | whenever possible but the Unix namespace rules do not allow the | |
| 118 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 119 | Therefore we have to handle the use of this header in strictly | |
| 120 | standard-compliant sources special. */ | |
| 121 | struct timespec st_atim;		/* Time of last access. */ | |
| 122 | struct timespec st_mtim;		/* Time of last modification. */ | |
| 123 | struct timespec st_ctim;		/* Time of last status change. */ | |
| 124 | # define st_atime st_atim.tv_sec	/* Backward compatibility. */ | |
| 125 | # define st_mtime st_mtim.tv_sec | |
| 126 | # define st_ctime st_ctim.tv_sec | |
| 127 | # else | |
| 128 | __time_t st_atime;			/* Time of last access. */ | |
| 129 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 130 | __time_t st_mtime;			/* Time of last modification. */ | |
| 131 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 132 | __time_t st_ctime;			/* Time of last status change. */ | |
| 133 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 134 | # endif | |
| 135 | # ifndef __USE_FILE_OFFSET64 | |
| 136 | unsigned long int __glibc_reserved4; | |
| 137 | unsigned long int __glibc_reserved5; | |
| 138 | # else | |
| 139 | __ino64_t st_ino;			/* File serial number.	*/ | |
| 140 | # endif | |
| 141 | }; | |
| 142 | #endif | |
| 143 | ||
| 144 | #ifdef __USE_LARGEFILE64 | |
| 145 | # if __WORDSIZE == 64 | |
| 146 | /* Note stat64 is the same shape as stat. */ | |
| 147 | struct stat64 | |
| 148 | { | |
| 149 | __dev_t st_dev;		/* Device. */ | |
| 150 | __ino64_t st_ino;		/* File serial number.	*/ | |
| 151 | __nlink_t st_nlink;		/* Link count.	*/ | |
| 152 | __mode_t st_mode;		/* File mode. */ | |
| 153 | __uid_t st_uid;		/* User ID of the file's owner.	*/ | |
| 154 | __gid_t st_gid;		/* Group ID of the file's group.*/ | |
| 155 | int __glibc_reserved0; | |
| 156 | __dev_t st_rdev;		/* Device number, if device. */ | |
| 157 | __off_t st_size;		/* Size of file, in bytes. */ | |
| 158 | # ifdef __USE_XOPEN2K8 | |
| 159 | /* Nanosecond resolution timestamps are stored in a format | |
| 160 | equivalent to 'struct timespec'. This is the type used | |
| 161 | whenever possible but the Unix namespace rules do not allow the | |
| 162 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 163 | Therefore we have to handle the use of this header in strictly | |
| 164 | standard-compliant sources special. */ | |
| 165 | struct timespec st_atim;		/* Time of last access. */ | |
| 166 | struct timespec st_mtim;		/* Time of last modification. */ | |
| 167 | struct timespec st_ctim;		/* Time of last status change. */ | |
| 168 | # define st_atime st_atim.tv_sec	/* Backward compatibility. */ | |
| 169 | # define st_mtime st_mtim.tv_sec | |
| 170 | # define st_ctime st_ctim.tv_sec | |
| 171 | # else | |
| 172 | __time_t st_atime;			/* Time of last access. */ | |
| 173 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 174 | __time_t st_mtime;			/* Time of last modification. */ | |
| 175 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 176 | __time_t st_ctime;			/* Time of last status change. */ | |
| 177 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 178 | # endif | |
| 179 | __blksize_t st_blksize;	/* Optimal block size for I/O.	*/ | |
| 180 | __blkcnt64_t st_blocks;	/* Nr. 512-byte blocks allocated. */ | |
| 181 | long int __glibc_reserved[3]; | |
| 182 | }; | |
| 183 | # else | |
| 184 | struct stat64 | |
| 185 | { | |
| 186 | __dev_t st_dev;			/* Device. */ | |
| 187 | unsigned int __pad1; | |
| 188 | ||
| 189 | __ino_t __st_ino;			/* 32bit file serial number.	*/ | |
| 190 | __mode_t st_mode;			/* File mode. */ | |
| 191 | __nlink_t st_nlink;			/* Link count. */ | |
| 192 | __uid_t st_uid;			/* User ID of the file's owner.	*/ | |
| 193 | __gid_t st_gid;			/* Group ID of the file's group.*/ | |
| 194 | __dev_t st_rdev;			/* Device number, if device. */ | |
| 195 | unsigned int __pad2; | |
| 196 | __off64_t st_size;			/* Size of file, in bytes. */ | |
| 197 | __blksize_t st_blksize;		/* Optimal block size for I/O. */ | |
| 198 | ||
| 199 | __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */ | |
| 200 | # ifdef __USE_XOPEN2K8 | |
| 201 | /* Nanosecond resolution timestamps are stored in a format | |
| 202 | equivalent to 'struct timespec'. This is the type used | |
| 203 | whenever possible but the Unix namespace rules do not allow the | |
| 204 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 205 | Therefore we have to handle the use of this header in strictly | |
| 206 | standard-compliant sources special. */ | |
| 207 | struct timespec st_atim;		/* Time of last access. */ | |
| 208 | struct timespec st_mtim;		/* Time of last modification. */ | |
| 209 | struct timespec st_ctim;		/* Time of last status change. */ | |
| 210 | # define st_atime st_atim.tv_sec	/* Backward compatibility. */ | |
| 211 | # define st_mtime st_mtim.tv_sec | |
| 212 | # define st_ctime st_ctim.tv_sec | |
| 213 | # else | |
| 214 | __time_t st_atime;			/* Time of last access. */ | |
| 215 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 216 | __time_t st_mtime;			/* Time of last modification. */ | |
| 217 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 218 | __time_t st_ctime;			/* Time of last status change. */ | |
| 219 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 220 | # endif | |
| 221 | __ino64_t st_ino;			/* File serial number.		*/ | |
| 222 | }; | |
| 223 | # endif | |
| 224 | #endif | |
| 225 | ||
| 226 | /* Tell code we have these members. */ | |
| 227 | #define	_STATBUF_ST_BLKSIZE | |
| 228 | #define _STATBUF_ST_RDEV | |
| 229 | /* Nanosecond resolution time values are supported. */ | |
| 230 | #define _STATBUF_ST_NSEC | |
| 231 | ||
| 232 | /* Encoding of the file mode. */ | |
| 233 | ||
| 234 | #define	__S_IFMT	0170000	/* These bits determine file type. */ | |
| 235 | ||
| 236 | /* File types. */ | |
| 237 | #define	__S_IFDIR	0040000	/* Directory. */ | |
| 238 | #define	__S_IFCHR	0020000	/* Character device. */ | |
| 239 | #define	__S_IFBLK	0060000	/* Block device. */ | |
| 240 | #define	__S_IFREG	0100000	/* Regular file. */ | |
| 241 | #define	__S_IFIFO	0010000	/* FIFO. */ | |
| 242 | #define	__S_IFLNK	0120000	/* Symbolic link. */ | |
| 243 | #define	__S_IFSOCK	0140000	/* Socket. */ | |
| 244 | ||
| 245 | /* POSIX.1b objects. Note that these macros always evaluate to zero. But | |
| 246 | they do it by enforcing the correct use of the macros. */ | |
| 247 | #define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 248 | #define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 249 | #define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 250 | ||
| 251 | /* Protection bits. */ | |
| 252 | ||
| 253 | #define	__S_ISUID	04000	/* Set user ID on execution. */ | |
| 254 | #define	__S_ISGID	02000	/* Set group ID on execution. */ | |
| 255 | #define	__S_ISVTX	01000	/* Save swapped text after use (sticky). */ | |
| 256 | #define	__S_IREAD	0400	/* Read by owner. */ | |
| 257 | #define	__S_IWRITE	0200	/* Write by owner. */ | |
| 258 | #define	__S_IEXEC	0100	/* Execute by owner. */ | |
| 259 | ||
| 260 | #ifdef __USE_ATFILE | |
| 261 | # define UTIME_NOW	((1l << 30) - 1l) | |
| 262 | # define UTIME_OMIT	((1l << 30) - 2l) | |
| 263 | #endif | |
| 264 | ||
| 265 | #endif	/* bits/stat.h */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/s390/bits/typesizes.h+8-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* bits/typesizes.h -- underlying types for *_t. Linux/s390 version. |
| 2 | Copyright (C) 2003-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2003-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -50,6 +50,7 @@ |
| 50 | 50 | #define __TIME_T_TYPE		__SLONGWORD_TYPE |
| 51 | 51 | #define __USECONDS_T_TYPE	__U32_TYPE |
| 52 | 52 | #define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE |
| 53 | #define __SUSECONDS64_T_TYPE	__SQUAD_TYPE | |
| 53 | 54 | #define __DADDR_T_TYPE		__S32_TYPE |
| 54 | 55 | #define __KEY_T_TYPE		__S32_TYPE |
| 55 | 56 | #define __CLOCKID_T_TYPE	__S32_TYPE |
| ... | ... | @@ -81,10 +82,16 @@ |
| 81 | 82 | |
| 82 | 83 | /* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ |
| 83 | 84 | # define __STATFS_MATCHES_STATFS64 1 |
| 85 | ||
| 86 | /* And for getitimer, setitimer and rusage */ | |
| 87 | # define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1 | |
| 84 | 88 | #else |
| 85 | 89 | # define __RLIM_T_MATCHES_RLIM64_T	0 |
| 86 | 90 | |
| 87 | 91 | # define __STATFS_MATCHES_STATFS64 0 |
| 92 | ||
| 93 | /* And for getitimer, setitimer and rusage */ | |
| 94 | # define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0 | |
| 88 | 95 | #endif |
| 89 | 96 | |
| 90 | 97 | /* Number of descriptors that can fit in an `fd_set'. */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/s390/kernel-features.h+3-3| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | /* Set flags signalling availability of kernel features based on given |
| 2 | 2 | kernel version number. S/390 version. |
| 3 | Copyright (C) 1999-2020 Free Software Foundation, Inc. | |
| 3 | Copyright (C) 1999-2021 Free Software Foundation, Inc. | |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 | |
| 6 | 6 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -23,8 +23,6 @@ |
| 23 | 23 | # define __ASSUME_SOCKETPAIR_SYSCALL 1 |
| 24 | 24 | # define __ASSUME_BIND_SYSCALL 1 |
| 25 | 25 | # define __ASSUME_LISTEN_SYSCALL 1 |
| 26 | # define __ASSUME_GETSOCKOPT_SYSCALL 1 | |
| 27 | # define __ASSUME_SETSOCKOPT_SYSCALL 1 | |
| 28 | 26 | # define __ASSUME_GETSOCKNAME_SYSCALL 1 |
| 29 | 27 | # define __ASSUME_GETPEERNAME_SYSCALL 1 |
| 30 | 28 | # define __ASSUME_SHUTDOWN_SYSCALL 1 |
| ... | ... | @@ -43,6 +41,8 @@ |
| 43 | 41 | # undef __ASSUME_CONNECT_SYSCALL |
| 44 | 42 | # undef __ASSUME_RECVFROM_SYSCALL |
| 45 | 43 | # undef __ASSUME_SENDTO_SYSCALL |
| 44 | # undef __ASSUME_GETSOCKOPT_SYSCALL | |
| 45 | # undef __ASSUME_SETSOCKOPT_SYSCALL | |
| 46 | 46 | #endif |
| 47 | 47 | |
| 48 | 48 | /* s390 only supports ipc syscall before 5.1. */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h+10-100| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 2000-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 2000-2021 Free Software Foundation, Inc. | |
| 2 | 2 | Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| ... | ... | @@ -26,11 +26,6 @@ |
| 26 | 26 | #include <dl-sysdep.h>	/* For RTLD_PRIVATE_ERRNO. */ |
| 27 | 27 | #include <tls.h> |
| 28 | 28 | |
| 29 | /* Define __set_errno() for INLINE_SYSCALL macro below. */ | |
| 30 | #ifndef __ASSEMBLER__ | |
| 31 | #include <errno.h> | |
| 32 | #endif | |
| 33 | ||
| 34 | 29 | /* For Linux we can use the system call table in the header file |
| 35 | 30 | 	/usr/include/asm/unistd.h |
| 36 | 31 | of the kernel. But these symbols do not follow the SYS_* syntax |
| ... | ... | @@ -38,9 +33,6 @@ |
| 38 | 33 | /* in newer 2.1 kernels __NR_syscall is missing so we define it here */ |
| 39 | 34 | #define __NR_syscall 0 |
| 40 | 35 | |
| 41 | #undef SYS_ify | |
| 42 | #define SYS_ify(syscall_name)	__NR_##syscall_name | |
| 43 | ||
| 44 | 36 | #ifdef __ASSEMBLER__ |
| 45 | 37 | |
| 46 | 38 | /* Linux uses a negative return value to indicate syscall errors, unlike |
| ... | ... | @@ -88,7 +80,9 @@ |
| 88 | 80 | #define PSEUDO_END_ERRVAL(name)						 \ |
| 89 | 81 | END (name) |
| 90 | 82 | |
| 83 | #undef SYSCALL_ERROR_LABEL | |
| 91 | 84 | #ifndef PIC |
| 85 | # undef SYSCALL_ERROR_LABEL | |
| 92 | 86 | # define SYSCALL_ERROR_LABEL 0f |
| 93 | 87 | # define SYSCALL_ERROR_HANDLER \ |
| 94 | 88 | 0: basr %r1,0;							 \ |
| ... | ... | @@ -97,6 +91,7 @@ |
| 97 | 91 | 2: .long syscall_error |
| 98 | 92 | #else |
| 99 | 93 | # if RTLD_PRIVATE_ERRNO |
| 94 | # undef SYSCALL_ERROR_LABEL | |
| 100 | 95 | # define SYSCALL_ERROR_LABEL 0f |
| 101 | 96 | # define SYSCALL_ERROR_HANDLER \ |
| 102 | 97 | 0: basr %r1,0;							 \ |
| ... | ... | @@ -112,6 +107,7 @@ |
| 112 | 107 | # else |
| 113 | 108 | # define SYSCALL_ERROR_ERRNO errno |
| 114 | 109 | # endif |
| 110 | # undef SYSCALL_ERROR_LABEL | |
| 115 | 111 | # define SYSCALL_ERROR_LABEL 0f |
| 116 | 112 | # define SYSCALL_ERROR_HANDLER \ |
| 117 | 113 | 0: lcr %r0,%r2;							 \ |
| ... | ... | @@ -124,6 +120,7 @@ |
| 124 | 120 | br %r14;								 \ |
| 125 | 121 | 2: .long _GLOBAL_OFFSET_TABLE_-1b |
| 126 | 122 | # else |
| 123 | # undef SYSCALL_ERROR_LABEL | |
| 127 | 124 | # define SYSCALL_ERROR_LABEL 0f |
| 128 | 125 | # define SYSCALL_ERROR_HANDLER \ |
| 129 | 126 | 0: basr %r1,0;							 \ |
| ... | ... | @@ -178,99 +175,12 @@ |
| 178 | 175 | #define ret_ERRVAL							 \ |
| 179 | 176 | br 14 |
| 180 | 177 | |
| 181 | #endif /* __ASSEMBLER__ */ | |
| 182 | ||
| 183 | #undef INLINE_SYSCALL | |
| 184 | #define INLINE_SYSCALL(name, nr, args...)				 \ | |
| 185 | ({									 \ | |
| 186 | unsigned int _ret = INTERNAL_SYSCALL (name, , nr, args);		 \ | |
| 187 | if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (_ret, )))		 \ | |
| 188 | {									 \ | |
| 189 | __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, ));			 \ | |
| 190 | _ret = 0xffffffff;						 \ | |
| 191 | }									 \ | |
| 192 | (int) _ret; }) | |
| 193 | ||
| 194 | #undef INTERNAL_SYSCALL_DECL | |
| 195 | #define INTERNAL_SYSCALL_DECL(err) do { } while (0) | |
| 196 | ||
| 197 | #undef INTERNAL_SYSCALL_DIRECT | |
| 198 | #define INTERNAL_SYSCALL_DIRECT(name, err, nr, args...)			 \ | |
| 199 | ({									 \ | |
| 200 | DECLARGS_##nr(args)							 \ | |
| 201 | register int _ret __asm__("2");					 \ | |
| 202 | __asm__ __volatile__ (						 \ | |
| 203 | 			 "svc %b1\n\t"				 \ | |
| 204 | 			 : "=d" (_ret)					 \ | |
| 205 | 			 : "i" (__NR_##name) ASMFMT_##nr		 \ | |
| 206 | 			 : "memory" );					 \ | |
| 207 | _ret; }) | |
| 208 | ||
| 209 | #undef INTERNAL_SYSCALL_SVC0 | |
| 210 | #define INTERNAL_SYSCALL_SVC0(name, err, nr, args...)			 \ | |
| 211 | ({									 \ | |
| 212 | DECLARGS_##nr(args)							 \ | |
| 213 | register unsigned long _nr __asm__("1") = (unsigned long)(__NR_##name); \ | |
| 214 | register int _ret __asm__("2");					 \ | |
| 215 | __asm__ __volatile__ (						 \ | |
| 216 | 			 "svc 0\n\t"				 \ | |
| 217 | 			 : "=d" (_ret)					 \ | |
| 218 | 			 : "d" (_nr) ASMFMT_##nr			 \ | |
| 219 | 			 : "memory" );					 \ | |
| 220 | _ret; }) | |
| 221 | ||
| 222 | #undef INTERNAL_SYSCALL_NCS | |
| 223 | #define INTERNAL_SYSCALL_NCS(no, err, nr, args...)			 \ | |
| 224 | ({									 \ | |
| 225 | DECLARGS_##nr(args)							 \ | |
| 226 | register unsigned long _nr __asm__("1") = (unsigned long)(no);	 \ | |
| 227 | register int _ret __asm__("2");					 \ | |
| 228 | __asm__ __volatile__ (						 \ | |
| 229 | 			 "svc 0\n\t"				 \ | |
| 230 | 			 : "=d" (_ret)					 \ | |
| 231 | 			 : "d" (_nr) ASMFMT_##nr			 \ | |
| 232 | 			 : "memory" );					 \ | |
| 233 | _ret; }) | |
| 234 | ||
| 235 | #undef INTERNAL_SYSCALL | |
| 236 | #define INTERNAL_SYSCALL(name, err, nr, args...)			 \ | |
| 237 | (((__NR_##name) < 256)						 \ | |
| 238 | ? INTERNAL_SYSCALL_DIRECT(name, err, nr, args)			 \ | |
| 239 | : INTERNAL_SYSCALL_SVC0(name, err,nr, args)) | |
| 240 | ||
| 241 | #undef INTERNAL_SYSCALL_ERROR_P | |
| 242 | #define INTERNAL_SYSCALL_ERROR_P(val, err)				 \ | |
| 243 | ((unsigned int) (val) >= 0xfffff001u) | |
| 244 | ||
| 245 | #undef INTERNAL_SYSCALL_ERRNO | |
| 246 | #define INTERNAL_SYSCALL_ERRNO(val, err)	(-(val)) | |
| 178 | #else | |
| 247 | 179 | |
| 248 | #define DECLARGS_0() | |
| 249 | #define DECLARGS_1(arg1) \ | |
| 250 | 	register unsigned long gpr2 __asm__ ("2") = (unsigned long)(arg1); | |
| 251 | #define DECLARGS_2(arg1, arg2) \ | |
| 252 | 	DECLARGS_1(arg1) \ | |
| 253 | 	register unsigned long gpr3 __asm__ ("3") = (unsigned long)(arg2); | |
| 254 | #define DECLARGS_3(arg1, arg2, arg3) \ | |
| 255 | 	DECLARGS_2(arg1, arg2) \ | |
| 256 | 	register unsigned long gpr4 __asm__ ("4") = (unsigned long)(arg3); | |
| 257 | #define DECLARGS_4(arg1, arg2, arg3, arg4) \ | |
| 258 | 	DECLARGS_3(arg1, arg2, arg3) \ | |
| 259 | 	register unsigned long gpr5 __asm__ ("5") = (unsigned long)(arg4); | |
| 260 | #define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \ | |
| 261 | 	DECLARGS_4(arg1, arg2, arg3, arg4) \ | |
| 262 | 	register unsigned long gpr6 __asm__ ("6") = (unsigned long)(arg5); | |
| 263 | #define DECLARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \ | |
| 264 | 	DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \ | |
| 265 | 	register unsigned long gpr7 __asm__ ("7") = (unsigned long)(arg6); | |
| 180 | # undef HAVE_INTERNAL_BRK_ADDR_SYMBOL | |
| 181 | # define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 | |
| 266 | 182 | |
| 267 | #define ASMFMT_0 | |
| 268 | #define ASMFMT_1 , "0" (gpr2) | |
| 269 | #define ASMFMT_2 , "0" (gpr2), "d" (gpr3) | |
| 270 | #define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4) | |
| 271 | #define ASMFMT_4 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5) | |
| 272 | #define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6) | |
| 273 | #define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7) | |
| 183 | #endif /* __ASSEMBLER__ */ | |
| 274 | 184 | |
| 275 | 185 | /* Pointer mangling support. */ |
| 276 | 186 | #if IS_IN (rtld) |
lib/libc/glibc/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h+10-110| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Assembler macros for 64 bit S/390. |
| 2 | Copyright (C) 2001-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2001-2021 Free Software Foundation, Inc. | |
| 3 | 3 | Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 | |
| ... | ... | @@ -27,11 +27,6 @@ |
| 27 | 27 | #include <dl-sysdep.h>	/* For RTLD_PRIVATE_ERRNO. */ |
| 28 | 28 | #include <tls.h> |
| 29 | 29 | |
| 30 | /* Define __set_errno() for INLINE_SYSCALL macro below. */ | |
| 31 | #ifndef __ASSEMBLER__ | |
| 32 | #include <errno.h> | |
| 33 | #endif | |
| 34 | ||
| 35 | 30 | /* For Linux we can use the system call table in the header file |
| 36 | 31 | 	/usr/include/asm/unistd.h |
| 37 | 32 | of the kernel. But these symbols do not follow the SYS_* syntax |
| ... | ... | @@ -39,17 +34,6 @@ |
| 39 | 34 | /* In newer 2.1 kernels __NR_syscall is missing so we define it here. */ |
| 40 | 35 | #define __NR_syscall 0 |
| 41 | 36 | |
| 42 | /* | |
| 43 | * Newer kernel versions redefined __NR_pread and __NR_pwrite to | |
| 44 | * __NR_pread64 and __NR_pwrite64. | |
| 45 | */ | |
| 46 | #ifndef __NR_pread | |
| 47 | # define __NR_pread __NR_pread64 | |
| 48 | #endif | |
| 49 | #ifndef __NR_pwrite | |
| 50 | # define __NR_pwrite __NR_pwrite64 | |
| 51 | #endif | |
| 52 | ||
| 53 | 37 | #undef SYS_ify |
| 54 | 38 | #define SYS_ify(syscall_name)	__NR_##syscall_name |
| 55 | 39 | |
| ... | ... | @@ -102,11 +86,14 @@ |
| 102 | 86 | SYSCALL_ERROR_HANDLER;						 \ |
| 103 | 87 | END (name) |
| 104 | 88 | |
| 89 | #undef SYSCALL_ERROR_LABEL | |
| 105 | 90 | #ifndef PIC |
| 91 | # undef SYSCALL_ERROR_LABEL | |
| 106 | 92 | # define SYSCALL_ERROR_LABEL syscall_error |
| 107 | 93 | # define SYSCALL_ERROR_HANDLER |
| 108 | 94 | #else |
| 109 | 95 | # if RTLD_PRIVATE_ERRNO |
| 96 | # undef SYSCALL_ERROR_LABEL | |
| 110 | 97 | # define SYSCALL_ERROR_LABEL 0f |
| 111 | 98 | # define SYSCALL_ERROR_HANDLER \ |
| 112 | 99 | 0: larl %r1,rtld_errno;						 \ |
| ... | ... | @@ -120,6 +107,7 @@ |
| 120 | 107 | # else |
| 121 | 108 | # define SYSCALL_ERROR_ERRNO errno |
| 122 | 109 | # endif |
| 110 | # undef SYSCALL_ERROR_LABEL | |
| 123 | 111 | # define SYSCALL_ERROR_LABEL 0f |
| 124 | 112 | # define SYSCALL_ERROR_HANDLER \ |
| 125 | 113 | 0: lcr %r0,%r2;							 \ |
| ... | ... | @@ -132,6 +120,7 @@ |
| 132 | 120 | lghi %r2,-1;							 \ |
| 133 | 121 | br %r14 |
| 134 | 122 | # else |
| 123 | # undef SYSCALL_ERROR_LABEL | |
| 135 | 124 | # define SYSCALL_ERROR_LABEL 0f |
| 136 | 125 | # define SYSCALL_ERROR_HANDLER \ |
| 137 | 126 | 0: larl %r1,_GLOBAL_OFFSET_TABLE_;					 \ |
| ... | ... | @@ -184,101 +173,12 @@ |
| 184 | 173 | #define ret_ERRVAL							 \ |
| 185 | 174 | br	 14 |
| 186 | 175 | |
| 187 | #endif /* __ASSEMBLER__ */ | |
| 188 | ||
| 189 | #undef INLINE_SYSCALL | |
| 190 | #define INLINE_SYSCALL(name, nr, args...)				 \ | |
| 191 | ({									 \ | |
| 192 | long _ret = INTERNAL_SYSCALL (name, , nr, args);			 \ | |
| 193 | if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (_ret, )))		 \ | |
| 194 | {									 \ | |
| 195 | __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, ));			 \ | |
| 196 | _ret = -1;							 \ | |
| 197 | }									 \ | |
| 198 | _ret; }) | |
| 199 | ||
| 200 | #undef INTERNAL_SYSCALL_DECL | |
| 201 | #define INTERNAL_SYSCALL_DECL(err) do { } while (0) | |
| 202 | ||
| 203 | #undef INTERNAL_SYSCALL_DIRECT | |
| 204 | #define INTERNAL_SYSCALL_DIRECT(name, err, nr, args...)			 \ | |
| 205 | ({									 \ | |
| 206 | DECLARGS_##nr(args)							 \ | |
| 207 | register long _ret __asm__("2");					 \ | |
| 208 | __asm__ __volatile__ (						 \ | |
| 209 | 			 "svc %b1\n\t"				 \ | |
| 210 | 			 : "=d" (_ret)					 \ | |
| 211 | 			 : "i" (__NR_##name) ASMFMT_##nr		 \ | |
| 212 | 			 : "memory" );					 \ | |
| 213 | _ret; }) | |
| 214 | ||
| 215 | #undef INTERNAL_SYSCALL_SVC0 | |
| 216 | #define INTERNAL_SYSCALL_SVC0(name, err, nr, args...)			 \ | |
| 217 | ({									 \ | |
| 218 | DECLARGS_##nr(args)							 \ | |
| 219 | register unsigned long _nr __asm__("1") = (unsigned long)(__NR_##name); \ | |
| 220 | register long _ret __asm__("2");					 \ | |
| 221 | __asm__ __volatile__ (						 \ | |
| 222 | 			 "svc 0\n\t"				 \ | |
| 223 | 			 : "=d" (_ret)					 \ | |
| 224 | 			 : "d" (_nr) ASMFMT_##nr			 \ | |
| 225 | 			 : "memory" );					 \ | |
| 226 | _ret; }) | |
| 227 | ||
| 228 | #undef INTERNAL_SYSCALL_NCS | |
| 229 | #define INTERNAL_SYSCALL_NCS(no, err, nr, args...)			 \ | |
| 230 | ({									 \ | |
| 231 | DECLARGS_##nr(args)							 \ | |
| 232 | register unsigned long _nr __asm__("1") = (unsigned long)(no);	 \ | |
| 233 | register long _ret __asm__("2");					 \ | |
| 234 | __asm__ __volatile__ (						 \ | |
| 235 | 			 "svc 0\n\t"				 \ | |
| 236 | 			 : "=d" (_ret)					 \ | |
| 237 | 			 : "d" (_nr) ASMFMT_##nr			 \ | |
| 238 | 			 : "memory" );					 \ | |
| 239 | _ret; }) | |
| 240 | ||
| 241 | #undef INTERNAL_SYSCALL | |
| 242 | #define INTERNAL_SYSCALL(name, err, nr, args...)			 \ | |
| 243 | (((__NR_##name) < 256)						 \ | |
| 244 | ? INTERNAL_SYSCALL_DIRECT(name, err, nr, args)			 \ | |
| 245 | : INTERNAL_SYSCALL_SVC0(name, err,nr, args)) | |
| 246 | ||
| 247 | #undef INTERNAL_SYSCALL_ERROR_P | |
| 248 | #define INTERNAL_SYSCALL_ERROR_P(val, err)				 \ | |
| 249 | ((unsigned long) (val) >= -4095UL) | |
| 250 | ||
| 251 | #undef INTERNAL_SYSCALL_ERRNO | |
| 252 | #define INTERNAL_SYSCALL_ERRNO(val, err)	(-(val)) | |
| 253 | ||
| 254 | #define DECLARGS_0() | |
| 255 | #define DECLARGS_1(arg1) \ | |
| 256 | 	register unsigned long gpr2 __asm__ ("2") = (unsigned long)(arg1); | |
| 257 | #define DECLARGS_2(arg1, arg2) \ | |
| 258 | 	DECLARGS_1(arg1) \ | |
| 259 | 	register unsigned long gpr3 __asm__ ("3") = (unsigned long)(arg2); | |
| 260 | #define DECLARGS_3(arg1, arg2, arg3) \ | |
| 261 | 	DECLARGS_2(arg1, arg2) \ | |
| 262 | 	register unsigned long gpr4 __asm__ ("4") = (unsigned long)(arg3); | |
| 263 | #define DECLARGS_4(arg1, arg2, arg3, arg4) \ | |
| 264 | 	DECLARGS_3(arg1, arg2, arg3) \ | |
| 265 | 	register unsigned long gpr5 __asm__ ("5") = (unsigned long)(arg4); | |
| 266 | #define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \ | |
| 267 | 	DECLARGS_4(arg1, arg2, arg3, arg4) \ | |
| 268 | 	register unsigned long gpr6 __asm__ ("6") = (unsigned long)(arg5); | |
| 269 | #define DECLARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \ | |
| 270 | 	DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \ | |
| 271 | 	register unsigned long gpr7 __asm__ ("7") = (unsigned long)(arg6); | |
| 176 | #else | |
| 272 | 177 | |
| 273 | #define ASMFMT_0 | |
| 274 | #define ASMFMT_1 , "0" (gpr2) | |
| 275 | #define ASMFMT_2 , "0" (gpr2), "d" (gpr3) | |
| 276 | #define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4) | |
| 277 | #define ASMFMT_4 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5) | |
| 278 | #define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6) | |
| 279 | #define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7) | |
| 178 | # undef HAVE_INTERNAL_BRK_ADDR_SYMBOL | |
| 179 | # define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 | |
| 280 | 180 | |
| 281 | #define SINGLE_THREAD_BY_GLOBAL		1 | |
| 181 | #endif /* __ASSEMBLER__ */ | |
| 282 | 182 | |
| 283 | 183 | /* Pointer mangling support. */ |
| 284 | 184 | #if IS_IN (rtld) |
lib/libc/glibc/sysdeps/unix/sysv/linux/s390/sys/elf.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 2000-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 2000-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/unix/sysv/linux/s390/xstatver.h created+19| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | /* Versions of the 'struct stat' data structure used in compatibility xstat | |
| 2 | functions. */ | |
| 3 | ||
| 4 | #include <bits/wordsize.h> | |
| 5 | ||
| 6 | #if __WORDSIZE == 64 | |
| 7 | # define _STAT_VER_KERNEL	0 | |
| 8 | # define _STAT_VER_LINUX	1 | |
| 9 | # define _MKNOD_VER_LINUX	0 | |
| 10 | #else | |
| 11 | # define _STAT_VER_LINUX_OLD	1 | |
| 12 | # define _STAT_VER_KERNEL	1 | |
| 13 | # define _STAT_VER_SVR4		2 | |
| 14 | # define _STAT_VER_LINUX	3 | |
| 15 | # define _MKNOD_VER_LINUX	1 | |
| 16 | # define _MKNOD_VER_SVR4	2 | |
| 17 | #endif | |
| 18 | #define _STAT_VER		_STAT_VER_LINUX | |
| 19 | #define _MKNOD_VER		_MKNOD_VER_LINUX |
lib/libc/glibc/sysdeps/unix/sysv/linux/sh/kernel-features.h+1-3| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | /* Set flags signalling availability of kernel features based on given |
| 2 | 2 | kernel version number. SH version. |
| 3 | Copyright (C) 1999-2020 Free Software Foundation, Inc. | |
| 3 | Copyright (C) 1999-2021 Free Software Foundation, Inc. | |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 | |
| 6 | 6 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -33,8 +33,6 @@ |
| 33 | 33 | #define __ASSUME_SEND_SYSCALL		1 |
| 34 | 34 | #define __ASSUME_RECV_SYSCALL		1 |
| 35 | 35 | #define __ASSUME_SHUTDOWN_SYSCALL	1 |
| 36 | #define __ASSUME_GETSOCKOPT_SYSCALL	1 | |
| 37 | #define __ASSUME_SETSOCKOPT_SYSCALL	1 | |
| 38 | 36 | |
| 39 | 37 | #include_next <kernel-features.h> |
| 40 | 38 |
lib/libc/glibc/sysdeps/unix/sysv/linux/sh/sysdep.h+3-24| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1992-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995. |
| 4 | 4 | Changed by Kaz Kojima, <kkojima@rr.iij4u.or.jp>. |
| ... | ... | @@ -287,19 +287,8 @@ |
| 287 | 287 | 	register long int r1 asm ("%r1") = (long int) (_arg6);		 \ |
| 288 | 288 | 	register long int r2 asm ("%r2") = (long int) (_arg7) |
| 289 | 289 | |
| 290 | #undef INLINE_SYSCALL | |
| 291 | #define INLINE_SYSCALL(name, nr, args...) \ | |
| 292 | ({ \ | |
| 293 | unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \ | |
| 294 | if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0)) \ | |
| 295 | { \ | |
| 296 | 	__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \ | |
| 297 | 	resultvar = 0xffffffff; \ | |
| 298 | } \ | |
| 299 | (int) resultvar; }) | |
| 300 | ||
| 301 | 290 | #undef INTERNAL_SYSCALL |
| 302 | #define INTERNAL_SYSCALL(name, err, nr, args...) \ | |
| 291 | #define INTERNAL_SYSCALL(name, nr, args...) \ | |
| 303 | 292 | ({									 \ |
| 304 | 293 | unsigned long int resultvar;					 \ |
| 305 | 294 | register long int r3 asm ("%r3") = SYS_ify (name);			 \ |
| ... | ... | @@ -313,7 +302,7 @@ |
| 313 | 302 | (int) resultvar; }) |
| 314 | 303 | |
| 315 | 304 | /* The _NCS variant allows non-constant syscall numbers. */ |
| 316 | #define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ | |
| 305 | #define INTERNAL_SYSCALL_NCS(name, nr, args...) \ | |
| 317 | 306 | ({									 \ |
| 318 | 307 | unsigned long int resultvar;					 \ |
| 319 | 308 | register long int r3 asm ("%r3") = (name);				 \ |
| ... | ... | @@ -326,16 +315,6 @@ |
| 326 | 315 | 									 \ |
| 327 | 316 | (int) resultvar; }) |
| 328 | 317 | |
| 329 | #undef INTERNAL_SYSCALL_DECL | |
| 330 | #define INTERNAL_SYSCALL_DECL(err) do { } while (0) | |
| 331 | ||
| 332 | #undef INTERNAL_SYSCALL_ERROR_P | |
| 333 | #define INTERNAL_SYSCALL_ERROR_P(val, err) \ | |
| 334 | ((unsigned int) (val) >= 0xfffff001u) | |
| 335 | ||
| 336 | #undef INTERNAL_SYSCALL_ERRNO | |
| 337 | #define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) | |
| 338 | ||
| 339 | 318 | #endif	/* __ASSEMBLER__ */ |
| 340 | 319 | |
| 341 | 320 | /* Pointer mangling support. */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/single-thread.h+13-31| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Single thread optimization, Linux version. |
| 2 | Copyright (C) 2019-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2019-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -27,36 +27,18 @@ |
| 27 | 27 | The ABI might define SINGLE_THREAD_BY_GLOBAL to enable the single thread |
| 28 | 28 | check to use global variables instead of the pthread_t field. */ |
| 29 | 29 | |
| 30 | #ifdef SINGLE_THREAD_BY_GLOBAL | |
| 31 | # if IS_IN (libc) | |
| 30 | #ifndef __ASSEMBLER__ | |
| 32 | 31 | extern int __libc_multiple_threads; |
| 33 | # define SINGLE_THREAD_P \ | |
| 34 | __glibc_likely (__libc_multiple_threads == 0) | |
| 35 | # elif IS_IN (libpthread) | |
| 36 | extern int __pthread_multiple_threads; | |
| 37 | # define SINGLE_THREAD_P \ | |
| 38 | __glibc_likely (__pthread_multiple_threads == 0) | |
| 39 | # elif IS_IN (librt) | |
| 40 | # define SINGLE_THREAD_P					\ | |
| 41 | __glibc_likely (THREAD_GETMEM (THREAD_SELF,			\ | |
| 42 | 				 header.multiple_threads) == 0) | |
| 43 | # else | |
| 44 | /* For rtld, et cetera. */ | |
| 45 | # define SINGLE_THREAD_P (1) | |
| 46 | # endif | |
| 47 | #else /* SINGLE_THREAD_BY_GLOBAL */ | |
| 48 | # if IS_IN (libc) || IS_IN (libpthread) || IS_IN (librt) | |
| 49 | # define SINGLE_THREAD_P					\ | |
| 50 | __glibc_likely (THREAD_GETMEM (THREAD_SELF,			\ | |
| 51 | 				 header.multiple_threads) == 0) | |
| 52 | # else | |
| 53 | /* For rtld, et cetera. */ | |
| 54 | # define SINGLE_THREAD_P (1) | |
| 55 | # endif | |
| 56 | #endif /* SINGLE_THREAD_BY_GLOBAL */ | |
| 57 | ||
| 58 | #define RTLD_SINGLE_THREAD_P \ | |
| 59 | __glibc_likely (THREAD_GETMEM (THREAD_SELF, \ | |
| 60 | 				 header.multiple_threads) == 0) | |
| 32 | libc_hidden_proto (__libc_multiple_threads) | |
| 33 | #endif | |
| 34 | ||
| 35 | #if !defined SINGLE_THREAD_BY_GLOBAL || IS_IN (rtld) | |
| 36 | # define SINGLE_THREAD_P \ | |
| 37 | (THREAD_GETMEM (THREAD_SELF, header.multiple_threads) == 0) | |
| 38 | #else | |
| 39 | # define SINGLE_THREAD_P (__libc_multiple_threads == 0) | |
| 40 | #endif | |
| 41 | ||
| 42 | #define RTLD_SINGLE_THREAD_P SINGLE_THREAD_P | |
| 61 | 43 | |
| 62 | 44 | #endif /* _SINGLE_THREAD_H */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/bits/stat.h deleted-173| ... | ... | @@ -1,173 +0,0 @@ |
| 1 | /* Copyright (C) 1992-2020 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library; if not, see | |
| 16 | <https://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | #if !defined _SYS_STAT_H && !defined _FCNTL_H | |
| 19 | # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." | |
| 20 | #endif | |
| 21 | ||
| 22 | #ifndef _BITS_STAT_H | |
| 23 | #define _BITS_STAT_H	1 | |
| 24 | ||
| 25 | /* Versions of the `struct stat' data structure. */ | |
| 26 | #define _STAT_VER_LINUX_OLD	1 | |
| 27 | #define _STAT_VER_KERNEL	1 | |
| 28 | #define _STAT_VER_SVR4		2 | |
| 29 | #define _STAT_VER_LINUX		3 | |
| 30 | #define _STAT_VER		_STAT_VER_LINUX	/* The one defined below. */ | |
| 31 | ||
| 32 | /* Versions of the `xmknod' interface. */ | |
| 33 | #define _MKNOD_VER_LINUX	1 | |
| 34 | #define _MKNOD_VER_SVR4		2 | |
| 35 | #define _MKNOD_VER		_MKNOD_VER_LINUX /* The bits defined below. */ | |
| 36 | ||
| 37 | ||
| 38 | struct stat | |
| 39 | { | |
| 40 | __dev_t st_dev;			/* Device. */ | |
| 41 | #if __WORDSIZE == 64 || !defined __USE_FILE_OFFSET64 | |
| 42 | unsigned short int __pad1; | |
| 43 | __ino_t st_ino;			/* File serial number.	*/ | |
| 44 | #else | |
| 45 | __ino64_t st_ino;			/* File serial number.	*/ | |
| 46 | #endif | |
| 47 | __mode_t st_mode;			/* File mode. */ | |
| 48 | __nlink_t st_nlink;			/* Link count. */ | |
| 49 | __uid_t st_uid;			/* User ID of the file's owner.	*/ | |
| 50 | __gid_t st_gid;			/* Group ID of the file's group.*/ | |
| 51 | __dev_t st_rdev;			/* Device number, if device. */ | |
| 52 | unsigned short int __pad2; | |
| 53 | #ifndef __USE_FILE_OFFSET64 | |
| 54 | __off_t st_size;			/* Size of file, in bytes. */ | |
| 55 | #else | |
| 56 | __off64_t st_size;			/* Size of file, in bytes. */ | |
| 57 | #endif | |
| 58 | __blksize_t st_blksize;		/* Optimal block size for I/O. */ | |
| 59 | ||
| 60 | #ifndef __USE_FILE_OFFSET64 | |
| 61 | __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */ | |
| 62 | #else | |
| 63 | __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */ | |
| 64 | #endif | |
| 65 | #ifdef __USE_XOPEN2K8 | |
| 66 | /* Nanosecond resolution timestamps are stored in a format | |
| 67 | equivalent to 'struct timespec'. This is the type used | |
| 68 | whenever possible but the Unix namespace rules do not allow the | |
| 69 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 70 | Therefore we have to handle the use of this header in strictly | |
| 71 | standard-compliant sources special. */ | |
| 72 | struct timespec st_atim;		/* Time of last access. */ | |
| 73 | struct timespec st_mtim;		/* Time of last modification. */ | |
| 74 | struct timespec st_ctim;		/* Time of last status change. */ | |
| 75 | # define st_atime st_atim.tv_sec	/* Backward compatibility. */ | |
| 76 | # define st_mtime st_mtim.tv_sec | |
| 77 | # define st_ctime st_ctim.tv_sec | |
| 78 | #else | |
| 79 | __time_t st_atime;			/* Time of last access. */ | |
| 80 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 81 | __time_t st_mtime;			/* Time of last modification. */ | |
| 82 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 83 | __time_t st_ctime;			/* Time of last status change. */ | |
| 84 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 85 | #endif | |
| 86 | unsigned long int __glibc_reserved4; | |
| 87 | unsigned long int __glibc_reserved5; | |
| 88 | }; | |
| 89 | ||
| 90 | #ifdef __USE_LARGEFILE64 | |
| 91 | struct stat64 | |
| 92 | { | |
| 93 | __dev_t st_dev;			/* Device. */ | |
| 94 | # if __WORDSIZE == 64 | |
| 95 | unsigned short int __pad1; | |
| 96 | # endif | |
| 97 | __ino64_t st_ino;			/* File serial number.	*/ | |
| 98 | __mode_t st_mode;			/* File mode. */ | |
| 99 | __nlink_t st_nlink;			/* Link count. */ | |
| 100 | __uid_t st_uid;			/* User ID of the file's owner.	*/ | |
| 101 | __gid_t st_gid;			/* Group ID of the file's group.*/ | |
| 102 | __dev_t st_rdev;			/* Device number, if device. */ | |
| 103 | unsigned short int __pad2; | |
| 104 | __off64_t st_size;			/* Size of file, in bytes. */ | |
| 105 | __blksize_t st_blksize;		/* Optimal block size for I/O. */ | |
| 106 | ||
| 107 | __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */ | |
| 108 | # ifdef __USE_XOPEN2K8 | |
| 109 | /* Nanosecond resolution timestamps are stored in a format | |
| 110 | equivalent to 'struct timespec'. This is the type used | |
| 111 | whenever possible but the Unix namespace rules do not allow the | |
| 112 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 113 | Therefore we have to handle the use of this header in strictly | |
| 114 | standard-compliant sources special. */ | |
| 115 | struct timespec st_atim;		/* Time of last access. */ | |
| 116 | struct timespec st_mtim;		/* Time of last modification. */ | |
| 117 | struct timespec st_ctim;		/* Time of last status change. */ | |
| 118 | # define st_atime st_atim.tv_sec	/* Backward compatibility. */ | |
| 119 | # define st_mtime st_mtim.tv_sec | |
| 120 | # define st_ctime st_ctim.tv_sec | |
| 121 | # else | |
| 122 | __time_t st_atime;			/* Time of last access. */ | |
| 123 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 124 | __time_t st_mtime;			/* Time of last modification. */ | |
| 125 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 126 | __time_t st_ctime;			/* Time of last status change. */ | |
| 127 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 128 | # endif | |
| 129 | unsigned long int __glibc_reserved4; | |
| 130 | unsigned long int __glibc_reserved5; | |
| 131 | }; | |
| 132 | #endif | |
| 133 | ||
| 134 | /* Tell code we have these members. */ | |
| 135 | #define	_STATBUF_ST_BLKSIZE | |
| 136 | #define _STATBUF_ST_RDEV | |
| 137 | /* Nanosecond resolution time values are supported. */ | |
| 138 | #define _STATBUF_ST_NSEC | |
| 139 | ||
| 140 | /* Encoding of the file mode. */ | |
| 141 | ||
| 142 | #define	__S_IFMT	0170000	/* These bits determine file type. */ | |
| 143 | ||
| 144 | /* File types. */ | |
| 145 | #define	__S_IFDIR	0040000	/* Directory. */ | |
| 146 | #define	__S_IFCHR	0020000	/* Character device. */ | |
| 147 | #define	__S_IFBLK	0060000	/* Block device. */ | |
| 148 | #define	__S_IFREG	0100000	/* Regular file. */ | |
| 149 | #define	__S_IFIFO	0010000	/* FIFO. */ | |
| 150 | #define	__S_IFLNK	0120000	/* Symbolic link. */ | |
| 151 | #define	__S_IFSOCK	0140000	/* Socket. */ | |
| 152 | ||
| 153 | /* POSIX.1b objects. Note that these macros always evaluate to zero. But | |
| 154 | they do it by enforcing the correct use of the macros. */ | |
| 155 | #define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 156 | #define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 157 | #define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 158 | ||
| 159 | /* Protection bits. */ | |
| 160 | ||
| 161 | #define	__S_ISUID	04000	/* Set user ID on execution. */ | |
| 162 | #define	__S_ISGID	02000	/* Set group ID on execution. */ | |
| 163 | #define	__S_ISVTX	01000	/* Save swapped text after use (sticky). */ | |
| 164 | #define	__S_IREAD	0400	/* Read by owner. */ | |
| 165 | #define	__S_IWRITE	0200	/* Write by owner. */ | |
| 166 | #define	__S_IEXEC	0100	/* Execute by owner. */ | |
| 167 | ||
| 168 | #ifdef __USE_ATFILE | |
| 169 | # define UTIME_NOW	((1l << 30) - 1l) | |
| 170 | # define UTIME_OMIT	((1l << 30) - 2l) | |
| 171 | #endif | |
| 172 | ||
| 173 | #endif	/* bits/stat.h */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h+8-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* bits/typesizes.h -- underlying types for *_t. Linux/SPARC version. |
| 2 | Copyright (C) 2002-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2002-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -50,6 +50,7 @@ |
| 50 | 50 | #define __TIME_T_TYPE		__SLONGWORD_TYPE |
| 51 | 51 | #define __USECONDS_T_TYPE	__U32_TYPE |
| 52 | 52 | #define __SUSECONDS_T_TYPE	__S32_TYPE |
| 53 | #define __SUSECONDS64_T_TYPE	__SQUAD_TYPE | |
| 53 | 54 | #define __DADDR_T_TYPE		__S32_TYPE |
| 54 | 55 | #define __KEY_T_TYPE		__S32_TYPE |
| 55 | 56 | #define __CLOCKID_T_TYPE	__S32_TYPE |
| ... | ... | @@ -75,10 +76,16 @@ |
| 75 | 76 | |
| 76 | 77 | /* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ |
| 77 | 78 | # define __STATFS_MATCHES_STATFS64 1 |
| 79 | ||
| 80 | /* And for getitimer, setitimer and rusage */ | |
| 81 | # define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1 | |
| 78 | 82 | #else |
| 79 | 83 | # define __RLIM_T_MATCHES_RLIM64_T	0 |
| 80 | 84 | |
| 81 | 85 | # define __STATFS_MATCHES_STATFS64 0 |
| 86 | ||
| 87 | /* And for getitimer, setitimer and rusage */ | |
| 88 | # define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0 | |
| 82 | 89 | #endif |
| 83 | 90 | |
| 84 | 91 | /* Number of descriptors that can fit in an `fd_set'. */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/kernel-features.h+3-3| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | /* Set flags signalling availability of kernel features based on given |
| 2 | 2 | kernel version number. SPARC version. |
| 3 | Copyright (C) 1999-2020 Free Software Foundation, Inc. | |
| 3 | Copyright (C) 1999-2021 Free Software Foundation, Inc. | |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 | |
| 6 | 6 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -38,10 +38,11 @@ |
| 38 | 38 | # undef __ASSUME_CONNECT_SYSCALL |
| 39 | 39 | # undef __ASSUME_RECVFROM_SYSCALL |
| 40 | 40 | # undef __ASSUME_SENDTO_SYSCALL |
| 41 | # undef __ASSUME_GETSOCKOPT_SYSCALL | |
| 42 | # undef __ASSUME_SETSOCKOPT_SYSCALL | |
| 41 | 43 | #else |
| 42 | 44 | # define __ASSUME_SOCKET_SYSCALL 1 |
| 43 | 45 | # define __ASSUME_SOCKETPAIR_SYSCALL 1 |
| 44 | # define __ASSUME_GETSOCKOPT_SYSCALL 1 | |
| 45 | 46 | # define __ASSUME_SHUTDOWN_SYSCALL 1 |
| 46 | 47 | #endif |
| 47 | 48 | |
| ... | ... | @@ -49,7 +50,6 @@ |
| 49 | 50 | #if __LINUX_KERNEL_VERSION >= 0x040400 |
| 50 | 51 | # define __ASSUME_BIND_SYSCALL 1 |
| 51 | 52 | # define __ASSUME_LISTEN_SYSCALL 1 |
| 52 | # define __ASSUME_SETSOCKOPT_SYSCALL 1 | |
| 53 | 53 | #endif |
| 54 | 54 | |
| 55 | 55 | #ifdef __arch64__ |
lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h+5-3| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1997-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1997-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | Contributed by Miguel de Icaza <miguel@gnu.ai.mit.edu>, January 1997. |
| 4 | 4 | |
| ... | ... | @@ -110,9 +110,8 @@ ENTRY(name);					\ |
| 110 | 110 | #define __SYSCALL_STRING						\ |
| 111 | 111 | 	"ta	0x10;"							\ |
| 112 | 112 | 	"bcc	1f;"							\ |
| 113 | 	" mov	0, %%g1;"						\ | |
| 113 | 	" nop;"								\ | |
| 114 | 114 | 	"sub	%%g0, %%o0, %%o0;"					\ |
| 115 | 	"mov	1, %%g1;"						\ | |
| 116 | 115 | 	"1:" |
| 117 | 116 | |
| 118 | 117 | #define __SYSCALL_CLOBBERS						\ |
| ... | ... | @@ -122,6 +121,9 @@ ENTRY(name);					\ |
| 122 | 121 | 	"f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",		\ |
| 123 | 122 | 	"cc", "memory" |
| 124 | 123 | |
| 124 | #undef HAVE_INTERNAL_BRK_ADDR_SYMBOL | |
| 125 | #define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 | |
| 126 | ||
| 125 | 127 | #endif	/* __ASSEMBLER__ */ |
| 126 | 128 | |
| 127 | 129 | /* Pointer mangling support. */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h+2-3| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1997-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1997-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997. |
| 4 | 4 | |
| ... | ... | @@ -109,9 +109,8 @@ ENTRY(name);					\ |
| 109 | 109 | #define __SYSCALL_STRING						\ |
| 110 | 110 | 	"ta	0x6d;"							\ |
| 111 | 111 | 	"bcc,pt	%%xcc, 1f;"						\ |
| 112 | 	" mov	0, %%g1;"						\ | |
| 112 | 	" nop;"								\ | |
| 113 | 113 | 	"sub	%%g0, %%o0, %%o0;"					\ |
| 114 | 	"mov	1, %%g1;"						\ | |
| 115 | 114 | 	"1:" |
| 116 | 115 | |
| 117 | 116 | #define __SYSCALL_CLOBBERS						\ |
lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sysdep.h+90-94| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 2000-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 2000-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | Contributed by Jakub Jelinek <jakub@redhat.com>, 2000. |
| 4 | 4 | |
| ... | ... | @@ -34,13 +34,6 @@ |
| 34 | 34 | |
| 35 | 35 | #else	/* __ASSEMBLER__ */ |
| 36 | 36 | |
| 37 | #define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...)		\ | |
| 38 | ({									\ | |
| 39 | long _ret = funcptr (args);						\ | |
| 40 | err = ((unsigned long) (_ret) >= (unsigned long) -4095L);		\ | |
| 41 | _ret;								\ | |
| 42 | }) | |
| 43 | ||
| 44 | 37 | # define VDSO_NAME "LINUX_2.6" |
| 45 | 38 | # define VDSO_HASH 61765110 |
| 46 | 39 | |
| ... | ... | @@ -52,121 +45,119 @@ |
| 52 | 45 | # endif |
| 53 | 46 | # define HAVE_GETTIMEOFDAY_VSYSCALL	"__vdso_gettimeofday" |
| 54 | 47 | |
| 55 | #undef INLINE_SYSCALL | |
| 56 | #define INLINE_SYSCALL(name, nr, args...) 				\ | |
| 57 | ({	INTERNAL_SYSCALL_DECL(err); 					\ | |
| 58 | 	unsigned long resultvar = INTERNAL_SYSCALL(name, err, nr, args);\ | |
| 59 | 	if (INTERNAL_SYSCALL_ERROR_P (resultvar, err))			\ | |
| 60 | 	 {		 			 		 	\ | |
| 61 | 	 __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, err));	\ | |
| 62 | 	 resultvar = (unsigned long) -1;				\ | |
| 63 | 	 } 	 							\ | |
| 64 | 	(long) resultvar;						\ | |
| 65 | }) | |
| 66 | ||
| 67 | #undef INTERNAL_SYSCALL_DECL | |
| 68 | #define INTERNAL_SYSCALL_DECL(err) \ | |
| 69 | 	register long err __asm__("g1"); | |
| 70 | ||
| 71 | 48 | #undef INTERNAL_SYSCALL |
| 72 | #define INTERNAL_SYSCALL(name, err, nr, args...) \ | |
| 73 | inline_syscall##nr(__SYSCALL_STRING, err, __NR_##name, args) | |
| 49 | #define INTERNAL_SYSCALL(name, nr, args...) \ | |
| 50 | internal_syscall##nr(__SYSCALL_STRING, __NR_##name, args) | |
| 74 | 51 | |
| 75 | 52 | #undef INTERNAL_SYSCALL_NCS |
| 76 | #define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ | |
| 77 | inline_syscall##nr(__SYSCALL_STRING, err, name, args) | |
| 78 | ||
| 79 | #undef INTERNAL_SYSCALL_ERROR_P | |
| 80 | #define INTERNAL_SYSCALL_ERROR_P(val, err) \ | |
| 81 | ((void) (val), __builtin_expect((err) != 0, 0)) | |
| 82 | ||
| 83 | #undef INTERNAL_SYSCALL_ERRNO | |
| 84 | #define INTERNAL_SYSCALL_ERRNO(val, err)	(-(val)) | |
| 53 | #define INTERNAL_SYSCALL_NCS(name, nr, args...) \ | |
| 54 | internal_syscall##nr(__SYSCALL_STRING, name, args) | |
| 85 | 55 | |
| 86 | #define inline_syscall0(string,err,name,dummy...)			\ | |
| 56 | #define internal_syscall0(string,name,dummy...)			\ | |
| 87 | 57 | ({									\ |
| 58 | 	register long int __g1 __asm__ ("g1") = (name);			\ | |
| 88 | 59 | 	register long __o0 __asm__ ("o0");				\ |
| 89 | 	err = name;							\ | |
| 90 | 	__asm __volatile (string : "=r" (err), "=r" (__o0) :		\ | |
| 91 | 			 "0" (err) :					\ | |
| 60 | 	__asm __volatile (string : "=r" (__o0) :			\ | |
| 61 | 			 "r" (__g1) :					\ | |
| 92 | 62 | 			 __SYSCALL_CLOBBERS);				\ |
| 93 | 63 | 	__o0;								\ |
| 94 | 64 | }) |
| 95 | 65 | |
| 96 | #define inline_syscall1(string,err,name,arg1)				\ | |
| 66 | #define internal_syscall1(string,name,arg1)				\ | |
| 97 | 67 | ({									\ |
| 98 | 	register long __o0 __asm__ ("o0") = (long)(arg1);		\ | |
| 99 | 	err = name;							\ | |
| 100 | 	__asm __volatile (string : "=r" (err), "=r" (__o0) :		\ | |
| 101 | 			 "0" (err), "1" (__o0) :			\ | |
| 68 | 	long int _arg1 = (long int) (arg1);				\ | |
| 69 | 	register long int __g1 __asm__("g1") = (name);			\ | |
| 70 | 	register long int __o0 __asm__ ("o0") = _arg1;			\ | |
| 71 | 	__asm __volatile (string : "=r" (__o0) :			\ | |
| 72 | 			 "r" (__g1), "0" (__o0) :			\ | |
| 102 | 73 | 			 __SYSCALL_CLOBBERS);				\ |
| 103 | 74 | 	__o0;								\ |
| 104 | 75 | }) |
| 105 | 76 | |
| 106 | #define inline_syscall2(string,err,name,arg1,arg2)			\ | |
| 77 | #define internal_syscall2(string,name,arg1,arg2)			\ | |
| 107 | 78 | ({									\ |
| 108 | 	register long __o0 __asm__ ("o0") = (long)(arg1);		\ | |
| 109 | 	register long __o1 __asm__ ("o1") = (long)(arg2);		\ | |
| 110 | 	err = name;							\ | |
| 111 | 	__asm __volatile (string : "=r" (err), "=r" (__o0) :		\ | |
| 112 | 			 "0" (err), "1" (__o0), "r" (__o1) :		\ | |
| 79 | 	long int _arg1 = (long int) (arg1);				\ | |
| 80 | 	long int _arg2 = (long int) (arg2);				\ | |
| 81 | 	register long int __g1 __asm__("g1") = (name);			\ | |
| 82 | 	register long int __o0 __asm__ ("o0") = _arg1;			\ | |
| 83 | 	register long int __o1 __asm__ ("o1") = _arg2;			\ | |
| 84 | 	__asm __volatile (string : "=r" (__o0) :			\ | |
| 85 | 			 "r" (__g1), "0" (__o0), "r" (__o1) :		\ | |
| 113 | 86 | 			 __SYSCALL_CLOBBERS);				\ |
| 114 | 87 | 	__o0;								\ |
| 115 | 88 | }) |
| 116 | 89 | |
| 117 | #define inline_syscall3(string,err,name,arg1,arg2,arg3)			\ | |
| 90 | #define internal_syscall3(string,name,arg1,arg2,arg3)			\ | |
| 118 | 91 | ({									\ |
| 119 | 	register long __o0 __asm__ ("o0") = (long)(arg1);		\ | |
| 120 | 	register long __o1 __asm__ ("o1") = (long)(arg2);		\ | |
| 121 | 	register long __o2 __asm__ ("o2") = (long)(arg3);		\ | |
| 122 | 	err = name;							\ | |
| 123 | 	__asm __volatile (string : "=r" (err), "=r" (__o0) :		\ | |
| 124 | 			 "0" (err), "1" (__o0), "r" (__o1),		\ | |
| 92 | 	long int _arg1 = (long int) (arg1);				\ | |
| 93 | 	long int _arg2 = (long int) (arg2);				\ | |
| 94 | 	long int _arg3 = (long int) (arg3);				\ | |
| 95 | 	register long int __g1 __asm__("g1") = (name);			\ | |
| 96 | 	register long int __o0 __asm__ ("o0") = _arg1;			\ | |
| 97 | 	register long int __o1 __asm__ ("o1") = _arg2;			\ | |
| 98 | 	register long int __o2 __asm__ ("o2") = _arg3;			\ | |
| 99 | 	__asm __volatile (string : "=r" (__o0) :			\ | |
| 100 | 			 "r" (__g1), "0" (__o0), "r" (__o1),		\ | |
| 125 | 101 | 			 "r" (__o2) :					\ |
| 126 | 102 | 			 __SYSCALL_CLOBBERS);				\ |
| 127 | 103 | 	__o0;								\ |
| 128 | 104 | }) |
| 129 | 105 | |
| 130 | #define inline_syscall4(string,err,name,arg1,arg2,arg3,arg4)		\ | |
| 106 | #define internal_syscall4(string,name,arg1,arg2,arg3,arg4)		\ | |
| 131 | 107 | ({									\ |
| 132 | 	register long __o0 __asm__ ("o0") = (long)(arg1);		\ | |
| 133 | 	register long __o1 __asm__ ("o1") = (long)(arg2);		\ | |
| 134 | 	register long __o2 __asm__ ("o2") = (long)(arg3);		\ | |
| 135 | 	register long __o3 __asm__ ("o3") = (long)(arg4);		\ | |
| 136 | 	err = name;							\ | |
| 137 | 	__asm __volatile (string : "=r" (err), "=r" (__o0) :		\ | |
| 138 | 			 "0" (err), "1" (__o0), "r" (__o1),		\ | |
| 108 | 	long int _arg1 = (long int) (arg1);				\ | |
| 109 | 	long int _arg2 = (long int) (arg2);				\ | |
| 110 | 	long int _arg3 = (long int) (arg3);				\ | |
| 111 | 	long int _arg4 = (long int) (arg4);				\ | |
| 112 | 	register long int __g1 __asm__("g1") = (name);			\ | |
| 113 | 	register long int __o0 __asm__ ("o0") = _arg1;			\ | |
| 114 | 	register long int __o1 __asm__ ("o1") = _arg2;			\ | |
| 115 | 	register long int __o2 __asm__ ("o2") = _arg3;			\ | |
| 116 | 	register long int __o3 __asm__ ("o3") = _arg4;			\ | |
| 117 | 	__asm __volatile (string : "=r" (__o0) :			\ | |
| 118 | 			 "r" (__g1), "0" (__o0), "r" (__o1),		\ | |
| 139 | 119 | 			 "r" (__o2), "r" (__o3) :			\ |
| 140 | 120 | 			 __SYSCALL_CLOBBERS);				\ |
| 141 | 121 | 	__o0;								\ |
| 142 | 122 | }) |
| 143 | 123 | |
| 144 | #define inline_syscall5(string,err,name,arg1,arg2,arg3,arg4,arg5)	\ | |
| 124 | #define internal_syscall5(string,name,arg1,arg2,arg3,arg4,arg5)		\ | |
| 145 | 125 | ({									\ |
| 146 | 	register long __o0 __asm__ ("o0") = (long)(arg1);		\ | |
| 147 | 	register long __o1 __asm__ ("o1") = (long)(arg2);		\ | |
| 148 | 	register long __o2 __asm__ ("o2") = (long)(arg3);		\ | |
| 149 | 	register long __o3 __asm__ ("o3") = (long)(arg4);		\ | |
| 150 | 	register long __o4 __asm__ ("o4") = (long)(arg5);		\ | |
| 151 | 	err = name;							\ | |
| 152 | 	__asm __volatile (string : "=r" (err), "=r" (__o0) :		\ | |
| 153 | 			 "0" (err), "1" (__o0), "r" (__o1),		\ | |
| 126 | 	long int _arg1 = (long int) (arg1);				\ | |
| 127 | 	long int _arg2 = (long int) (arg2);				\ | |
| 128 | 	long int _arg3 = (long int) (arg3);				\ | |
| 129 | 	long int _arg4 = (long int) (arg4);				\ | |
| 130 | 	long int _arg5 = (long int) (arg5);				\ | |
| 131 | 	register long int __g1 __asm__("g1") = (name);			\ | |
| 132 | 	register long int __o0 __asm__ ("o0") = _arg1;			\ | |
| 133 | 	register long int __o1 __asm__ ("o1") = _arg2;			\ | |
| 134 | 	register long int __o2 __asm__ ("o2") = _arg3;			\ | |
| 135 | 	register long int __o3 __asm__ ("o3") = _arg4;			\ | |
| 136 | 	register long int __o4 __asm__ ("o4") = _arg5;			\ | |
| 137 | 	__asm __volatile (string : "=r" (__o0) :			\ | |
| 138 | 			 "r" (__g1), "0" (__o0), "r" (__o1),		\ | |
| 154 | 139 | 			 "r" (__o2), "r" (__o3), "r" (__o4) :		\ |
| 155 | 140 | 			 __SYSCALL_CLOBBERS);				\ |
| 156 | 141 | 	__o0;								\ |
| 157 | 142 | }) |
| 158 | 143 | |
| 159 | #define inline_syscall6(string,err,name,arg1,arg2,arg3,arg4,arg5,arg6)	\ | |
| 144 | #define internal_syscall6(string,name,arg1,arg2,arg3,arg4,arg5,arg6)	\ | |
| 160 | 145 | ({									\ |
| 161 | 	register long __o0 __asm__ ("o0") = (long)(arg1);		\ | |
| 162 | 	register long __o1 __asm__ ("o1") = (long)(arg2);		\ | |
| 163 | 	register long __o2 __asm__ ("o2") = (long)(arg3);		\ | |
| 164 | 	register long __o3 __asm__ ("o3") = (long)(arg4);		\ | |
| 165 | 	register long __o4 __asm__ ("o4") = (long)(arg5);		\ | |
| 166 | 	register long __o5 __asm__ ("o5") = (long)(arg6);		\ | |
| 167 | 	err = name;							\ | |
| 168 | 	__asm __volatile (string : "=r" (err), "=r" (__o0) :		\ | |
| 169 | 			 "0" (err), "1" (__o0), "r" (__o1),		\ | |
| 146 | 	long int _arg1 = (long int) (arg1);				\ | |
| 147 | 	long int _arg2 = (long int) (arg2);				\ | |
| 148 | 	long int _arg3 = (long int) (arg3);				\ | |
| 149 | 	long int _arg4 = (long int) (arg4);				\ | |
| 150 | 	long int _arg5 = (long int) (arg5);				\ | |
| 151 | 	long int _arg6 = (long int) (arg6);				\ | |
| 152 | 	register long int __g1 __asm__("g1") = (name);			\ | |
| 153 | 	register long int __o0 __asm__ ("o0") = _arg1;			\ | |
| 154 | 	register long int __o1 __asm__ ("o1") = _arg2;			\ | |
| 155 | 	register long int __o2 __asm__ ("o2") = _arg3;			\ | |
| 156 | 	register long int __o3 __asm__ ("o3") = _arg4;			\ | |
| 157 | 	register long int __o4 __asm__ ("o4") = _arg5;			\ | |
| 158 | 	register long int __o5 __asm__ ("o5") = _arg6;			\ | |
| 159 | 	__asm __volatile (string : "=r" (__o0) :			\ | |
| 160 | 			 "r" (__g1), "0" (__o0), "r" (__o1),		\ | |
| 170 | 161 | 			 "r" (__o2), "r" (__o3), "r" (__o4),		\ |
| 171 | 162 | 			 "r" (__o5) :					\ |
| 172 | 163 | 			 __SYSCALL_CLOBBERS);				\ |
| ... | ... | @@ -175,20 +166,25 @@ |
| 175 | 166 | |
| 176 | 167 | #define INLINE_CLONE_SYSCALL(arg1,arg2,arg3,arg4,arg5)			\ |
| 177 | 168 | ({									\ |
| 178 | 	register long __o0 __asm__ ("o0") = (long)(arg1);		\ | |
| 179 | 	register long __o1 __asm__ ("o1") = (long)(arg2);		\ | |
| 180 | 	register long __o2 __asm__ ("o2") = (long)(arg3);		\ | |
| 181 | 	register long __o3 __asm__ ("o3") = (long)(arg4);		\ | |
| 182 | 	register long __o4 __asm__ ("o4") = (long)(arg5);		\ | |
| 183 | 	register long __g1 __asm__ ("g1") = __NR_clone;			\ | |
| 169 | 	long int _arg1 = (long int) (arg1);				\ | |
| 170 | 	long int _arg2 = (long int) (arg2);				\ | |
| 171 | 	long int _arg3 = (long int) (arg3);				\ | |
| 172 | 	long int _arg4 = (long int) (arg4);				\ | |
| 173 | 	long int _arg5 = (long int) (arg5);				\ | |
| 174 | 	register long int __o0 __asm__ ("o0") = _arg1;			\ | |
| 175 | 	register long int __o1 __asm__ ("o1") = _arg2;			\ | |
| 176 | 	register long int __o2 __asm__ ("o2") = _arg3;			\ | |
| 177 | 	register long int __o3 __asm__ ("o3") = _arg4;			\ | |
| 178 | 	register long int __o4 __asm__ ("o4") = _arg5;			\ | |
| 179 | 	register long int __g1 __asm__ ("g1") = __NR_clone;		\ | |
| 184 | 180 | 	__asm __volatile (__SYSCALL_STRING :				\ |
| 185 | 			 "=r" (__g1), "=r" (__o0), "=r" (__o1)	:	\ | |
| 186 | 			 "0" (__g1), "1" (__o0), "2" (__o1),		\ | |
| 181 | 			 "=r" (__o0), "=r" (__o1) :			\ | |
| 182 | 			 "r" (__g1), "0" (__o0), "1" (__o1),		\ | |
| 187 | 183 | 			 "r" (__o2), "r" (__o3), "r" (__o4) :		\ |
| 188 | 184 | 			 __SYSCALL_CLOBBERS);				\ |
| 189 | 	if (INTERNAL_SYSCALL_ERROR_P (__o0, __g1))			\ | |
| 185 | 	if (__glibc_unlikely ((unsigned long int) (__o0) > -4096UL))	\ | |
| 190 | 186 | 	 {		 			 		 	\ |
| 191 | 	 __set_errno (INTERNAL_SYSCALL_ERRNO (__o0, __g1));		\ | |
| 187 | 	 __set_errno (-__o0);					\ | |
| 192 | 188 | 	 __o0 = -1L;			 				\ |
| 193 | 189 | 	 } 	 							\ |
| 194 | 190 | 	else								\ |
lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/xstatver.h created+13| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | /* Versions of the 'struct stat' data structure used in compatibility xstat | |
| 2 | functions. */ | |
| 3 | #define _STAT_VER_LINUX_OLD	1 | |
| 4 | #define _STAT_VER_KERNEL	1 | |
| 5 | #define _STAT_VER_SVR4		2 | |
| 6 | #define _STAT_VER_LINUX		3 | |
| 7 | #define _STAT_VER		_STAT_VER_LINUX	/* The one defined below. */ | |
| 8 | ||
| 9 | /* Versions of the 'xmknod' interface used in compatibility xmknod | |
| 10 | functions. */ | |
| 11 | #define _MKNOD_VER_LINUX	1 | |
| 12 | #define _MKNOD_VER_SVR4		2 | |
| 13 | #define _MKNOD_VER		_MKNOD_VER_LINUX |
lib/libc/glibc/sysdeps/unix/sysv/linux/struct_stat_time64.h created+34| ... | ... | @@ -0,0 +1,34 @@ |
| 1 | /* Struct stat with 64-bit time support. | |
| 2 | Copyright (C) 2020-2021 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <https://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _BITS_STRUCT_STAT_TIME64_H | |
| 20 | #define _BITS_STRUCT_STAT_TIME64_H 1 | |
| 21 | ||
| 22 | #if __TIMESIZE == 64 | |
| 23 | # define __stat64_t64 stat64 | |
| 24 | #else | |
| 25 | # include <struct___timespec64.h> | |
| 26 | ||
| 27 | struct __stat64_t64 | |
| 28 | { | |
| 29 | # define __struct_timespec struct __timespec64 | |
| 30 | # include <bits/struct_stat_time64_helper.h> | |
| 31 | }; | |
| 32 | #endif /* __TIMESIZE == 64 */ | |
| 33 | ||
| 34 | #endif /* _BITS_STRUCT_STAT_TIME64_H */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/sys/syscall.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/unix/sysv/linux/sys/timex.h+24-7| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1995-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1995-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -54,17 +54,34 @@ struct ntptimeval |
| 54 | 54 | |
| 55 | 55 | __BEGIN_DECLS |
| 56 | 56 | |
| 57 | extern int __adjtimex (struct timex *__ntx) __THROW; | |
| 57 | #ifndef __USE_TIME_BITS64 | |
| 58 | 58 | extern int adjtimex (struct timex *__ntx) __THROW; |
| 59 | extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW; | |
| 59 | 60 | |
| 60 | #ifdef __REDIRECT_NTH | |
| 61 | # ifdef __REDIRECT_NTH | |
| 61 | 62 | extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv), |
| 62 | 			 ntp_gettimex); | |
| 63 | ntp_gettimex); | |
| 64 | # else | |
| 65 | # define ntp_gettime ntp_gettimex | |
| 66 | # endif | |
| 67 | extern int ntp_adjtime (struct timex *__tntx) __THROW; | |
| 63 | 68 | #else |
| 64 | extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW; | |
| 65 | # define ntp_gettime ntp_gettimex | |
| 69 | # ifdef __REDIRECT_NTH | |
| 70 | extern int __REDIRECT_NTH (adjtimex, (struct timex *__ntx), | |
| 71 | ___adjtimex64); | |
| 72 | extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv), | |
| 73 | __ntp_gettime64); | |
| 74 | extern int __REDIRECT_NTH (ntp_gettimex, (struct ntptimeval *__ntv), | |
| 75 | __ntp_gettimex64); | |
| 76 | extern int __REDIRECT_NTH (ntp_adjtime, (struct timex *__ntx), | |
| 77 | ___adjtimex64); | |
| 78 | # else | |
| 79 | # define adjtimex ___adjtimex64 | |
| 80 | # define ntp_adjtime ___adjtimex64 | |
| 81 | # define ntp_gettime __ntp_gettime64 | |
| 82 | # define ntp_gettimex __ntp_gettimex64 | |
| 83 | # endif | |
| 66 | 84 | #endif |
| 67 | extern int ntp_adjtime (struct timex *__tntx) __THROW; | |
| 68 | 85 | |
| 69 | 86 | __END_DECLS |
| 70 | 87 |
lib/libc/glibc/sysdeps/unix/sysv/linux/sysdep.h+38-4| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 2015-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 2015-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -15,8 +15,40 @@ |
| 15 | 15 | License along with the GNU C Library; if not, see |
| 16 | 16 | <https://www.gnu.org/licenses/>. */ |
| 17 | 17 | |
| 18 | #ifndef _SYSDEP_LINUX_H | |
| 19 | #define _SYSDEP_LINUX_H | |
| 20 | ||
| 18 | 21 | #include <bits/wordsize.h> |
| 19 | 22 | #include <kernel-features.h> |
| 23 | #include <endian.h> | |
| 24 | #include <errno.h> | |
| 25 | ||
| 26 | #undef INTERNAL_SYSCALL_ERROR_P | |
| 27 | #define INTERNAL_SYSCALL_ERROR_P(val) \ | |
| 28 | ((unsigned long int) (val) > -4096UL) | |
| 29 | ||
| 30 | #ifndef SYSCALL_ERROR_LABEL | |
| 31 | # define SYSCALL_ERROR_LABEL(sc_err)					\ | |
| 32 | ({									\ | |
| 33 | __set_errno (sc_err);						\ | |
| 34 | -1L;								\ | |
| 35 | }) | |
| 36 | #endif | |
| 37 | ||
| 38 | /* Define a macro which expands into the inline wrapper code for a system | |
| 39 | call. It sets the errno and returns -1 on a failure, or the syscall | |
| 40 | return value otherwise. */ | |
| 41 | #undef INLINE_SYSCALL | |
| 42 | #define INLINE_SYSCALL(name, nr, args...)				\ | |
| 43 | ({									\ | |
| 44 | long int sc_ret = INTERNAL_SYSCALL (name, nr, args);		\ | |
| 45 | __glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (sc_ret))		\ | |
| 46 | ? SYSCALL_ERROR_LABEL (INTERNAL_SYSCALL_ERRNO (sc_ret))		\ | |
| 47 | : sc_ret;								\ | |
| 48 | }) | |
| 49 | ||
| 50 | #undef INTERNAL_SYSCALL_ERRNO | |
| 51 | #define INTERNAL_SYSCALL_ERRNO(val) (-(val)) | |
| 20 | 52 | |
| 21 | 53 | /* Set error number and return -1. A target may choose to return the |
| 22 | 54 | internal function, __syscall_error, which sets errno and returns -1. |
| ... | ... | @@ -63,6 +95,8 @@ |
| 63 | 95 | (long) (val), \ |
| 64 | 96 | (long) (((uint64_t) (val)) >> 32) |
| 65 | 97 | |
| 66 | /* Exports the __send symbol on send.c linux implementation (some ABI have | |
| 67 | it missing due the usage of a old generic version without it). */ | |
| 68 | #define HAVE_INTERNAL_SEND_SYMBOL	1 | |
| 98 | /* Export the ___brk_addr symbol on brk.c implementation (some ABIs export | |
| 99 | it due and old crtstuff.c code). */ | |
| 100 | #define HAVE_INTERNAL_BRK_ADDR_SYMBOL 0 | |
| 101 | ||
| 102 | #endif /* _SYSDEP_LINUX_H */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/x86/bits/stat.h deleted-210| ... | ... | @@ -1,210 +0,0 @@ |
| 1 | /* Copyright (C) 1999-2020 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library; if not, see | |
| 16 | <https://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | #if !defined _SYS_STAT_H && !defined _FCNTL_H | |
| 19 | # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." | |
| 20 | #endif | |
| 21 | ||
| 22 | #ifndef _BITS_STAT_H | |
| 23 | #define _BITS_STAT_H	1 | |
| 24 | ||
| 25 | /* Versions of the `struct stat' data structure. */ | |
| 26 | #ifndef __x86_64__ | |
| 27 | # define _STAT_VER_LINUX_OLD	1 | |
| 28 | # define _STAT_VER_KERNEL	1 | |
| 29 | # define _STAT_VER_SVR4		2 | |
| 30 | # define _STAT_VER_LINUX	3 | |
| 31 | ||
| 32 | /* i386 versions of the `xmknod' interface. */ | |
| 33 | # define _MKNOD_VER_LINUX	1 | |
| 34 | # define _MKNOD_VER_SVR4	2 | |
| 35 | # define _MKNOD_VER		_MKNOD_VER_LINUX /* The bits defined below. */ | |
| 36 | #else | |
| 37 | # define _STAT_VER_KERNEL	0 | |
| 38 | # define _STAT_VER_LINUX	1 | |
| 39 | ||
| 40 | /* x86-64 versions of the `xmknod' interface. */ | |
| 41 | # define _MKNOD_VER_LINUX	0 | |
| 42 | #endif | |
| 43 | ||
| 44 | #define _STAT_VER		_STAT_VER_LINUX | |
| 45 | ||
| 46 | struct stat | |
| 47 | { | |
| 48 | __dev_t st_dev;		/* Device. */ | |
| 49 | #ifndef __x86_64__ | |
| 50 | unsigned short int __pad1; | |
| 51 | #endif | |
| 52 | #if defined __x86_64__ || !defined __USE_FILE_OFFSET64 | |
| 53 | __ino_t st_ino;		/* File serial number.	*/ | |
| 54 | #else | |
| 55 | __ino_t __st_ino;			/* 32bit file serial number.	*/ | |
| 56 | #endif | |
| 57 | #ifndef __x86_64__ | |
| 58 | __mode_t st_mode;			/* File mode. */ | |
| 59 | __nlink_t st_nlink;			/* Link count. */ | |
| 60 | #else | |
| 61 | __nlink_t st_nlink;		/* Link count. */ | |
| 62 | __mode_t st_mode;		/* File mode. */ | |
| 63 | #endif | |
| 64 | __uid_t st_uid;		/* User ID of the file's owner.	*/ | |
| 65 | __gid_t st_gid;		/* Group ID of the file's group.*/ | |
| 66 | #ifdef __x86_64__ | |
| 67 | int __pad0; | |
| 68 | #endif | |
| 69 | __dev_t st_rdev;		/* Device number, if device. */ | |
| 70 | #ifndef __x86_64__ | |
| 71 | unsigned short int __pad2; | |
| 72 | #endif | |
| 73 | #if defined __x86_64__ || !defined __USE_FILE_OFFSET64 | |
| 74 | __off_t st_size;			/* Size of file, in bytes. */ | |
| 75 | #else | |
| 76 | __off64_t st_size;			/* Size of file, in bytes. */ | |
| 77 | #endif | |
| 78 | __blksize_t st_blksize;	/* Optimal block size for I/O. */ | |
| 79 | #if defined __x86_64__ || !defined __USE_FILE_OFFSET64 | |
| 80 | __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */ | |
| 81 | #else | |
| 82 | __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */ | |
| 83 | #endif | |
| 84 | #ifdef __USE_XOPEN2K8 | |
| 85 | /* Nanosecond resolution timestamps are stored in a format | |
| 86 | equivalent to 'struct timespec'. This is the type used | |
| 87 | whenever possible but the Unix namespace rules do not allow the | |
| 88 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 89 | Therefore we have to handle the use of this header in strictly | |
| 90 | standard-compliant sources special. */ | |
| 91 | struct timespec st_atim;		/* Time of last access. */ | |
| 92 | struct timespec st_mtim;		/* Time of last modification. */ | |
| 93 | struct timespec st_ctim;		/* Time of last status change. */ | |
| 94 | # define st_atime st_atim.tv_sec	/* Backward compatibility. */ | |
| 95 | # define st_mtime st_mtim.tv_sec | |
| 96 | # define st_ctime st_ctim.tv_sec | |
| 97 | #else | |
| 98 | __time_t st_atime;			/* Time of last access. */ | |
| 99 | __syscall_ulong_t st_atimensec;	/* Nscecs of last access. */ | |
| 100 | __time_t st_mtime;			/* Time of last modification. */ | |
| 101 | __syscall_ulong_t st_mtimensec;	/* Nsecs of last modification. */ | |
| 102 | __time_t st_ctime;			/* Time of last status change. */ | |
| 103 | __syscall_ulong_t st_ctimensec;	/* Nsecs of last status change. */ | |
| 104 | #endif | |
| 105 | #ifdef __x86_64__ | |
| 106 | __syscall_slong_t __glibc_reserved[3]; | |
| 107 | #else | |
| 108 | # ifndef __USE_FILE_OFFSET64 | |
| 109 | unsigned long int __glibc_reserved4; | |
| 110 | unsigned long int __glibc_reserved5; | |
| 111 | # else | |
| 112 | __ino64_t st_ino;			/* File serial number.	*/ | |
| 113 | # endif | |
| 114 | #endif | |
| 115 | }; | |
| 116 | ||
| 117 | #ifdef __USE_LARGEFILE64 | |
| 118 | /* Note stat64 has the same shape as stat for x86-64. */ | |
| 119 | struct stat64 | |
| 120 | { | |
| 121 | __dev_t st_dev;		/* Device. */ | |
| 122 | # ifdef __x86_64__ | |
| 123 | __ino64_t st_ino;		/* File serial number. */ | |
| 124 | __nlink_t st_nlink;		/* Link count. */ | |
| 125 | __mode_t st_mode;		/* File mode. */ | |
| 126 | # else | |
| 127 | unsigned int __pad1; | |
| 128 | __ino_t __st_ino;			/* 32bit file serial number.	*/ | |
| 129 | __mode_t st_mode;			/* File mode. */ | |
| 130 | __nlink_t st_nlink;			/* Link count. */ | |
| 131 | # endif | |
| 132 | __uid_t st_uid;		/* User ID of the file's owner.	*/ | |
| 133 | __gid_t st_gid;		/* Group ID of the file's group.*/ | |
| 134 | # ifdef __x86_64__ | |
| 135 | int __pad0; | |
| 136 | __dev_t st_rdev;		/* Device number, if device. */ | |
| 137 | __off_t st_size;		/* Size of file, in bytes. */ | |
| 138 | # else | |
| 139 | __dev_t st_rdev;			/* Device number, if device. */ | |
| 140 | unsigned int __pad2; | |
| 141 | __off64_t st_size;			/* Size of file, in bytes. */ | |
| 142 | # endif | |
| 143 | __blksize_t st_blksize;	/* Optimal block size for I/O. */ | |
| 144 | __blkcnt64_t st_blocks;	/* Nr. 512-byte blocks allocated. */ | |
| 145 | # ifdef __USE_XOPEN2K8 | |
| 146 | /* Nanosecond resolution timestamps are stored in a format | |
| 147 | equivalent to 'struct timespec'. This is the type used | |
| 148 | whenever possible but the Unix namespace rules do not allow the | |
| 149 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 150 | Therefore we have to handle the use of this header in strictly | |
| 151 | standard-compliant sources special. */ | |
| 152 | struct timespec st_atim;		/* Time of last access. */ | |
| 153 | struct timespec st_mtim;		/* Time of last modification. */ | |
| 154 | struct timespec st_ctim;		/* Time of last status change. */ | |
| 155 | # else | |
| 156 | __time_t st_atime;			/* Time of last access. */ | |
| 157 | __syscall_ulong_t st_atimensec;	/* Nscecs of last access. */ | |
| 158 | __time_t st_mtime;			/* Time of last modification. */ | |
| 159 | __syscall_ulong_t st_mtimensec;	/* Nsecs of last modification. */ | |
| 160 | __time_t st_ctime;			/* Time of last status change. */ | |
| 161 | __syscall_ulong_t st_ctimensec;	/* Nsecs of last status change. */ | |
| 162 | # endif | |
| 163 | # ifdef __x86_64__ | |
| 164 | __syscall_slong_t __glibc_reserved[3]; | |
| 165 | # else | |
| 166 | __ino64_t st_ino;			/* File serial number.		*/ | |
| 167 | # endif | |
| 168 | }; | |
| 169 | #endif | |
| 170 | ||
| 171 | /* Tell code we have these members. */ | |
| 172 | #define	_STATBUF_ST_BLKSIZE | |
| 173 | #define _STATBUF_ST_RDEV | |
| 174 | /* Nanosecond resolution time values are supported. */ | |
| 175 | #define _STATBUF_ST_NSEC | |
| 176 | ||
| 177 | /* Encoding of the file mode. */ | |
| 178 | ||
| 179 | #define	__S_IFMT	0170000	/* These bits determine file type. */ | |
| 180 | ||
| 181 | /* File types. */ | |
| 182 | #define	__S_IFDIR	0040000	/* Directory. */ | |
| 183 | #define	__S_IFCHR	0020000	/* Character device. */ | |
| 184 | #define	__S_IFBLK	0060000	/* Block device. */ | |
| 185 | #define	__S_IFREG	0100000	/* Regular file. */ | |
| 186 | #define	__S_IFIFO	0010000	/* FIFO. */ | |
| 187 | #define	__S_IFLNK	0120000	/* Symbolic link. */ | |
| 188 | #define	__S_IFSOCK	0140000	/* Socket. */ | |
| 189 | ||
| 190 | /* POSIX.1b objects. Note that these macros always evaluate to zero. But | |
| 191 | they do it by enforcing the correct use of the macros. */ | |
| 192 | #define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 193 | #define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 194 | #define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) | |
| 195 | ||
| 196 | /* Protection bits. */ | |
| 197 | ||
| 198 | #define	__S_ISUID	04000	/* Set user ID on execution. */ | |
| 199 | #define	__S_ISGID	02000	/* Set group ID on execution. */ | |
| 200 | #define	__S_ISVTX	01000	/* Save swapped text after use (sticky). */ | |
| 201 | #define	__S_IREAD	0400	/* Read by owner. */ | |
| 202 | #define	__S_IWRITE	0200	/* Write by owner. */ | |
| 203 | #define	__S_IEXEC	0100	/* Execute by owner. */ | |
| 204 | ||
| 205 | #ifdef __USE_ATFILE | |
| 206 | # define UTIME_NOW	((1l << 30) - 1l) | |
| 207 | # define UTIME_OMIT	((1l << 30) - 2l) | |
| 208 | #endif | |
| 209 | ||
| 210 | #endif	/* bits/stat.h */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/x86/bits/typesizes.h+7-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* bits/typesizes.h -- underlying types for *_t. Linux/x86-64 version. |
| 2 | Copyright (C) 2012-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2012-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -64,6 +64,7 @@ |
| 64 | 64 | #define __TIME_T_TYPE		__SYSCALL_SLONG_TYPE |
| 65 | 65 | #define __USECONDS_T_TYPE	__U32_TYPE |
| 66 | 66 | #define __SUSECONDS_T_TYPE	__SYSCALL_SLONG_TYPE |
| 67 | #define __SUSECONDS64_T_TYPE	__SQUAD_TYPE | |
| 67 | 68 | #define __DADDR_T_TYPE		__S32_TYPE |
| 68 | 69 | #define __KEY_T_TYPE		__S32_TYPE |
| 69 | 70 | #define __CLOCKID_T_TYPE	__S32_TYPE |
| ... | ... | @@ -87,10 +88,15 @@ |
| 87 | 88 | |
| 88 | 89 | /* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ |
| 89 | 90 | # define __STATFS_MATCHES_STATFS64 1 |
| 91 | ||
| 92 | /* And for getitimer, setitimer and rusage */ | |
| 93 | # define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1 | |
| 90 | 94 | #else |
| 91 | 95 | # define __RLIM_T_MATCHES_RLIM64_T	0 |
| 92 | 96 | |
| 93 | 97 | # define __STATFS_MATCHES_STATFS64 0 |
| 98 | ||
| 99 | # define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0 | |
| 94 | 100 | #endif |
| 95 | 101 | |
| 96 | 102 | /* Number of descriptors that can fit in an `fd_set'. */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/x86/sys/elf.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1998-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1998-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/unix/sysv/linux/x86/xstatver.h created+16| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | /* Versions of the 'struct stat' data structure used in compatibility xstat | |
| 2 | functions. */ | |
| 3 | #ifndef __x86_64__ | |
| 4 | # define _STAT_VER_LINUX_OLD	1 | |
| 5 | # define _STAT_VER_KERNEL	1 | |
| 6 | # define _STAT_VER_SVR4		2 | |
| 7 | # define _STAT_VER_LINUX	3 | |
| 8 | # define _MKNOD_VER_LINUX	1 | |
| 9 | # define _MKNOD_VER_SVR4	2 | |
| 10 | #else | |
| 11 | # define _STAT_VER_KERNEL	0 | |
| 12 | # define _STAT_VER_LINUX	1 | |
| 13 | # define _MKNOD_VER_LINUX	0 | |
| 14 | #endif | |
| 15 | #define _STAT_VER		_STAT_VER_LINUX | |
| 16 | #define _MKNOD_VER		_MKNOD_VER_LINUX |
lib/libc/glibc/sysdeps/unix/sysv/linux/x86_64/kernel-features.h+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | /* Set flags signalling availability of kernel features based on given |
| 2 | 2 | kernel version number. x86-64 version. |
| 3 | Copyright (C) 1999-2020 Free Software Foundation, Inc. | |
| 3 | Copyright (C) 1999-2021 Free Software Foundation, Inc. | |
| 4 | 4 | This file is part of the GNU C Library. |
| 5 | 5 | |
| 6 | 6 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/unix/sysv/linux/x86_64/sysdep.h+83-74| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 2001-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 2001-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -33,13 +33,6 @@ |
| 33 | 33 | #undef SYS_ify |
| 34 | 34 | #define SYS_ify(syscall_name)	__NR_##syscall_name |
| 35 | 35 | |
| 36 | /* This is to help the old kernel headers where __NR_semtimedop is not | |
| 37 | available. */ | |
| 38 | #ifndef __NR_semtimedop | |
| 39 | # define __NR_semtimedop 220 | |
| 40 | #endif | |
| 41 | ||
| 42 | ||
| 43 | 36 | #ifdef __ASSEMBLER__ |
| 44 | 37 | |
| 45 | 38 | /* Linux uses a negative return value to indicate syscall errors, |
| ... | ... | @@ -55,19 +48,40 @@ |
| 55 | 48 | |
| 56 | 49 | /* We don't want the label for the error handle to be global when we define |
| 57 | 50 | it here. */ |
| 51 | # undef SYSCALL_ERROR_LABEL | |
| 58 | 52 | # ifdef PIC |
| 53 | # undef SYSCALL_ERROR_LABEL | |
| 59 | 54 | # define SYSCALL_ERROR_LABEL 0f |
| 60 | 55 | # else |
| 56 | # undef SYSCALL_ERROR_LABEL | |
| 61 | 57 | # define SYSCALL_ERROR_LABEL syscall_error |
| 62 | 58 | # endif |
| 63 | 59 | |
| 60 | /* PSEUDO and T_PSEUDO macros have 2 extra arguments for unsigned long | |
| 61 | int arguments. */ | |
| 62 | # define PSEUDOS_HAVE_ULONG_INDICES 1 | |
| 63 | ||
| 64 | # ifndef SYSCALL_ULONG_ARG_1 | |
| 65 | # define SYSCALL_ULONG_ARG_1 0 | |
| 66 | # define SYSCALL_ULONG_ARG_2 0 | |
| 67 | # endif | |
| 68 | ||
| 64 | 69 | # undef	PSEUDO |
| 65 | # define PSEUDO(name, syscall_name, args)				 \ | |
| 66 | .text;								 \ | |
| 67 | ENTRY (name)								 \ | |
| 68 | DO_CALL (syscall_name, args);					 \ | |
| 69 | cmpq $-4095, %rax;							 \ | |
| 70 | # if SYSCALL_ULONG_ARG_1 | |
| 71 | # define PSEUDO(name, syscall_name, args, ulong_arg_1, ulong_arg_2) \ | |
| 72 | .text;							 \ | |
| 73 | ENTRY (name)							 \ | |
| 74 | DO_CALL (syscall_name, args, ulong_arg_1, ulong_arg_2);	 \ | |
| 75 | cmpq $-4095, %rax;						 \ | |
| 76 | jae SYSCALL_ERROR_LABEL | |
| 77 | # else | |
| 78 | # define PSEUDO(name, syscall_name, args) \ | |
| 79 | .text;							 \ | |
| 80 | ENTRY (name)							 \ | |
| 81 | DO_CALL (syscall_name, args, 0, 0);				 \ | |
| 82 | cmpq $-4095, %rax;						 \ | |
| 70 | 83 | jae SYSCALL_ERROR_LABEL |
| 84 | # endif | |
| 71 | 85 | |
| 72 | 86 | # undef	PSEUDO_END |
| 73 | 87 | # define PSEUDO_END(name)						 \ |
| ... | ... | @@ -75,10 +89,17 @@ |
| 75 | 89 | END (name) |
| 76 | 90 | |
| 77 | 91 | # undef	PSEUDO_NOERRNO |
| 78 | # define PSEUDO_NOERRNO(name, syscall_name, args) \ | |
| 79 | .text;								 \ | |
| 80 | ENTRY (name)								 \ | |
| 81 | DO_CALL (syscall_name, args) | |
| 92 | # if SYSCALL_ULONG_ARG_1 | |
| 93 | # define PSEUDO_NOERRNO(name, syscall_name, args, ulong_arg_1, ulong_arg_2) \ | |
| 94 | .text;							 \ | |
| 95 | ENTRY (name)							 \ | |
| 96 | DO_CALL (syscall_name, args, ulong_arg_1, ulong_arg_2) | |
| 97 | # else | |
| 98 | # define PSEUDO_NOERRNO(name, syscall_name, args) \ | |
| 99 | .text;							 \ | |
| 100 | ENTRY (name)							 \ | |
| 101 | DO_CALL (syscall_name, args, 0, 0) | |
| 102 | # endif | |
| 82 | 103 | |
| 83 | 104 | # undef	PSEUDO_END_NOERRNO |
| 84 | 105 | # define PSEUDO_END_NOERRNO(name) \ |
| ... | ... | @@ -87,11 +108,19 @@ |
| 87 | 108 | # define ret_NOERRNO ret |
| 88 | 109 | |
| 89 | 110 | # undef	PSEUDO_ERRVAL |
| 90 | # define PSEUDO_ERRVAL(name, syscall_name, args) \ | |
| 91 | .text;								 \ | |
| 92 | ENTRY (name)								 \ | |
| 93 | DO_CALL (syscall_name, args);					 \ | |
| 111 | # if SYSCALL_ULONG_ARG_1 | |
| 112 | # define PSEUDO_ERRVAL(name, syscall_name, args, ulong_arg_1, ulong_arg_2) \ | |
| 113 | .text;							\ | |
| 114 | ENTRY (name)							\ | |
| 115 | DO_CALL (syscall_name, args, ulong_arg_1, ulong_arg_2);	\ | |
| 116 | negq %rax | |
| 117 | # else | |
| 118 | # define PSEUDO_ERRVAL(name, syscall_name, args) \ | |
| 119 | .text;							\ | |
| 120 | ENTRY (name)							\ | |
| 121 | DO_CALL (syscall_name, args, 0, 0);				\ | |
| 94 | 122 | negq %rax |
| 123 | # endif | |
| 95 | 124 | |
| 96 | 125 | # undef	PSEUDO_END_ERRVAL |
| 97 | 126 | # define PSEUDO_END_ERRVAL(name) \ |
| ... | ... | @@ -163,8 +192,10 @@ |
| 163 | 192 | Syscalls of more than 6 arguments are not supported. */ |
| 164 | 193 | |
| 165 | 194 | # undef	DO_CALL |
| 166 | # define DO_CALL(syscall_name, args)		\ | |
| 195 | # define DO_CALL(syscall_name, args, ulong_arg_1, ulong_arg_2) \ | |
| 167 | 196 | DOARGS_##args				\ |
| 197 | ZERO_EXTEND_##ulong_arg_1			\ | |
| 198 | ZERO_EXTEND_##ulong_arg_2			\ | |
| 168 | 199 | movl $SYS_ify (syscall_name), %eax;		\ |
| 169 | 200 | syscall; |
| 170 | 201 | |
| ... | ... | @@ -176,57 +207,39 @@ |
| 176 | 207 | # define DOARGS_5 DOARGS_4 |
| 177 | 208 | # define DOARGS_6 DOARGS_5 |
| 178 | 209 | |
| 210 | # define ZERO_EXTEND_0 /* nothing */ | |
| 211 | # define ZERO_EXTEND_1 /* nothing */ | |
| 212 | # define ZERO_EXTEND_2 /* nothing */ | |
| 213 | # define ZERO_EXTEND_3 /* nothing */ | |
| 214 | # define ZERO_EXTEND_4 /* nothing */ | |
| 215 | # define ZERO_EXTEND_5 /* nothing */ | |
| 216 | # define ZERO_EXTEND_6 /* nothing */ | |
| 217 | ||
| 179 | 218 | #else	/* !__ASSEMBLER__ */ |
| 180 | /* Define a macro which expands inline into the wrapper code for a system | |
| 181 | call. */ | |
| 182 | # undef INLINE_SYSCALL | |
| 183 | # define INLINE_SYSCALL(name, nr, args...) \ | |
| 184 | ({									 \ | |
| 185 | unsigned long int resultvar = INTERNAL_SYSCALL (name, , nr, args);	 \ | |
| 186 | if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, )))	 \ | |
| 187 | {									 \ | |
| 188 | 	__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, ));		 \ | |
| 189 | 	resultvar = (unsigned long int) -1;				 \ | |
| 190 | }									 \ | |
| 191 | (long int) resultvar; }) | |
| 192 | ||
| 193 | /* Define a macro with explicit types for arguments, which expands inline | |
| 194 | into the wrapper code for a system call. It should be used when size | |
| 195 | of any argument > size of long int. */ | |
| 196 | # undef INLINE_SYSCALL_TYPES | |
| 197 | # define INLINE_SYSCALL_TYPES(name, nr, args...) \ | |
| 198 | ({									 \ | |
| 199 | unsigned long int resultvar = INTERNAL_SYSCALL_TYPES (name, , nr, args); \ | |
| 200 | if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, )))	 \ | |
| 201 | {									 \ | |
| 202 | 	__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, ));		 \ | |
| 203 | 	resultvar = (unsigned long int) -1;				 \ | |
| 204 | }									 \ | |
| 205 | (long int) resultvar; }) | |
| 206 | ||
| 207 | # undef INTERNAL_SYSCALL_DECL | |
| 208 | # define INTERNAL_SYSCALL_DECL(err) do { } while (0) | |
| 209 | 219 | |
| 210 | 220 | /* Registers clobbered by syscall. */ |
| 211 | 221 | # define REGISTERS_CLOBBERED_BY_SYSCALL "cc", "r11", "cx" |
| 212 | 222 | |
| 213 | /* Create a variable 'name' based on type 'X' to avoid explicit types. | |
| 214 | This is mainly used set use 64-bits arguments in x32. */ | |
| 215 | #define TYPEFY(X, name) __typeof__ ((X) - (X)) name | |
| 216 | /* Explicit cast the argument to avoid integer from pointer warning on | |
| 217 | x32. */ | |
| 218 | #define ARGIFY(X) ((__typeof__ ((X) - (X))) (X)) | |
| 223 | /* NB: This also works when X is an array. For an array X, type of | |
| 224 | (X) - (X) is ptrdiff_t, which is signed, since size of ptrdiff_t | |
| 225 | == size of pointer, cast is a NOP. */ | |
| 226 | #define TYPEFY1(X) __typeof__ ((X) - (X)) | |
| 227 | /* Explicit cast the argument. */ | |
| 228 | #define ARGIFY(X) ((TYPEFY1 (X)) (X)) | |
| 229 | /* Create a variable 'name' based on type of variable 'X' to avoid | |
| 230 | explicit types. */ | |
| 231 | #define TYPEFY(X, name) __typeof__ (ARGIFY (X)) name | |
| 219 | 232 | |
| 220 | 233 | #undef INTERNAL_SYSCALL |
| 221 | #define INTERNAL_SYSCALL(name, err, nr, args...)			\ | |
| 222 | 	internal_syscall##nr (SYS_ify (name), err, args) | |
| 234 | #define INTERNAL_SYSCALL(name, nr, args...)				\ | |
| 235 | 	internal_syscall##nr (SYS_ify (name), args) | |
| 223 | 236 | |
| 224 | 237 | #undef INTERNAL_SYSCALL_NCS |
| 225 | #define INTERNAL_SYSCALL_NCS(number, err, nr, args...)			\ | |
| 226 | 	internal_syscall##nr (number, err, args) | |
| 238 | #define INTERNAL_SYSCALL_NCS(number, nr, args...)			\ | |
| 239 | 	internal_syscall##nr (number, args) | |
| 227 | 240 | |
| 228 | 241 | #undef internal_syscall0 |
| 229 | #define internal_syscall0(number, err, dummy...)			\ | |
| 242 | #define internal_syscall0(number, dummy...)				\ | |
| 230 | 243 | ({									\ |
| 231 | 244 | unsigned long int resultvar;					\ |
| 232 | 245 | asm volatile (							\ |
| ... | ... | @@ -238,7 +251,7 @@ |
| 238 | 251 | }) |
| 239 | 252 | |
| 240 | 253 | #undef internal_syscall1 |
| 241 | #define internal_syscall1(number, err, arg1)				\ | |
| 254 | #define internal_syscall1(number, arg1)					\ | |
| 242 | 255 | ({									\ |
| 243 | 256 | unsigned long int resultvar;					\ |
| 244 | 257 | TYPEFY (arg1, __arg1) = ARGIFY (arg1);			 	\ |
| ... | ... | @@ -252,7 +265,7 @@ |
| 252 | 265 | }) |
| 253 | 266 | |
| 254 | 267 | #undef internal_syscall2 |
| 255 | #define internal_syscall2(number, err, arg1, arg2)			\ | |
| 268 | #define internal_syscall2(number, arg1, arg2)				\ | |
| 256 | 269 | ({									\ |
| 257 | 270 | unsigned long int resultvar;					\ |
| 258 | 271 | TYPEFY (arg2, __arg2) = ARGIFY (arg2);			 	\ |
| ... | ... | @@ -268,7 +281,7 @@ |
| 268 | 281 | }) |
| 269 | 282 | |
| 270 | 283 | #undef internal_syscall3 |
| 271 | #define internal_syscall3(number, err, arg1, arg2, arg3)		\ | |
| 284 | #define internal_syscall3(number, arg1, arg2, arg3)			\ | |
| 272 | 285 | ({									\ |
| 273 | 286 | unsigned long int resultvar;					\ |
| 274 | 287 | TYPEFY (arg3, __arg3) = ARGIFY (arg3);			 	\ |
| ... | ... | @@ -286,7 +299,7 @@ |
| 286 | 299 | }) |
| 287 | 300 | |
| 288 | 301 | #undef internal_syscall4 |
| 289 | #define internal_syscall4(number, err, arg1, arg2, arg3, arg4)		\ | |
| 302 | #define internal_syscall4(number, arg1, arg2, arg3, arg4)		\ | |
| 290 | 303 | ({									\ |
| 291 | 304 | unsigned long int resultvar;					\ |
| 292 | 305 | TYPEFY (arg4, __arg4) = ARGIFY (arg4);			 	\ |
| ... | ... | @@ -306,7 +319,7 @@ |
| 306 | 319 | }) |
| 307 | 320 | |
| 308 | 321 | #undef internal_syscall5 |
| 309 | #define internal_syscall5(number, err, arg1, arg2, arg3, arg4, arg5)	\ | |
| 322 | #define internal_syscall5(number, arg1, arg2, arg3, arg4, arg5)	\ | |
| 310 | 323 | ({									\ |
| 311 | 324 | unsigned long int resultvar;					\ |
| 312 | 325 | TYPEFY (arg5, __arg5) = ARGIFY (arg5);			 	\ |
| ... | ... | @@ -329,7 +342,7 @@ |
| 329 | 342 | }) |
| 330 | 343 | |
| 331 | 344 | #undef internal_syscall6 |
| 332 | #define internal_syscall6(number, err, arg1, arg2, arg3, arg4, arg5, arg6) \ | |
| 345 | #define internal_syscall6(number, arg1, arg2, arg3, arg4, arg5, arg6) \ | |
| 333 | 346 | ({									\ |
| 334 | 347 | unsigned long int resultvar;					\ |
| 335 | 348 | TYPEFY (arg6, __arg6) = ARGIFY (arg6);			 	\ |
| ... | ... | @@ -353,12 +366,6 @@ |
| 353 | 366 | (long int) resultvar;						\ |
| 354 | 367 | }) |
| 355 | 368 | |
| 356 | # undef INTERNAL_SYSCALL_ERROR_P | |
| 357 | # define INTERNAL_SYSCALL_ERROR_P(val, err) \ | |
| 358 | ((unsigned long int) (long int) (val) >= -4095L) | |
| 359 | ||
| 360 | # undef INTERNAL_SYSCALL_ERRNO | |
| 361 | # define INTERNAL_SYSCALL_ERRNO(val, err)	(-(val)) | |
| 362 | 369 | |
| 363 | 370 | # define VDSO_NAME "LINUX_2.6" |
| 364 | 371 | # define VDSO_HASH 61765110 |
| ... | ... | @@ -370,6 +377,8 @@ |
| 370 | 377 | # define HAVE_GETCPU_VSYSCALL		"__vdso_getcpu" |
| 371 | 378 | # define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres" |
| 372 | 379 | |
| 380 | # define HAVE_CLONE3_WRAPPER			1 | |
| 381 | ||
| 373 | 382 | # define SINGLE_THREAD_BY_GLOBAL		1 |
| 374 | 383 | |
| 375 | 384 | #endif	/* __ASSEMBLER__ */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h+36-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 2012-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 2012-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -26,4 +26,39 @@ |
| 26 | 26 | #undef LO_HI_LONG |
| 27 | 27 | #define LO_HI_LONG(val) (val) |
| 28 | 28 | |
| 29 | #ifdef __ASSEMBLER__ | |
| 30 | /* Zero-extend 32-bit unsigned long int arguments to 64 bits. */ | |
| 31 | # undef ZERO_EXTEND_1 | |
| 32 | # define ZERO_EXTEND_1 movl %edi, %edi; | |
| 33 | # undef ZERO_EXTEND_2 | |
| 34 | # define ZERO_EXTEND_2 movl %esi, %esi; | |
| 35 | # undef ZERO_EXTEND_3 | |
| 36 | # define ZERO_EXTEND_3 movl %edx, %edx; | |
| 37 | # if SYSCALL_ULONG_ARG_1 == 4 || SYSCALL_ULONG_ARG_2 == 4 | |
| 38 | # undef DOARGS_4 | |
| 39 | # define DOARGS_4 movl %ecx, %r10d; | |
| 40 | # else | |
| 41 | # undef ZERO_EXTEND_4 | |
| 42 | # define ZERO_EXTEND_4 movl %r10d, %r10d; | |
| 43 | # endif | |
| 44 | # undef ZERO_EXTEND_5 | |
| 45 | # define ZERO_EXTEND_5 movl %r8d, %r8d; | |
| 46 | # undef ZERO_EXTEND_6 | |
| 47 | # define ZERO_EXTEND_6 movl %r9d, %r9d; | |
| 48 | #else /* !__ASSEMBLER__ */ | |
| 49 | # undef ARGIFY | |
| 50 | /* Enforce zero-extension for pointers and array system call arguments. | |
| 51 | For integer types, extend to int64_t (the full register) using a | |
| 52 | regular cast, resulting in zero or sign extension based on the | |
| 53 | signedness of the original type. */ | |
| 54 | # define ARGIFY(X) \ | |
| 55 | ({									\ | |
| 56 | _Pragma ("GCC diagnostic push");					\ | |
| 57 | _Pragma ("GCC diagnostic ignored \"-Wpointer-to-int-cast\"");	\ | |
| 58 | (__builtin_classify_type (X) == 5					\ | |
| 59 | ? (uintptr_t) (X) : (int64_t) (X));				\ | |
| 60 | _Pragma ("GCC diagnostic pop");					\ | |
| 61 | }) | |
| 62 | #endif	/* __ASSEMBLER__ */ | |
| 63 | ||
| 29 | 64 | #endif /* linux/x86_64/x32/sysdep.h */ |
lib/libc/glibc/sysdeps/unix/sysv/linux/xstatver.h created+13| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | /* Versions of the 'struct stat' data structure used in compatibility xstat | |
| 2 | functions. */ | |
| 3 | #define _STAT_VER_LINUX_OLD	1 | |
| 4 | #define _STAT_VER_KERNEL	1 | |
| 5 | #define _STAT_VER_SVR4		2 | |
| 6 | #define _STAT_VER_LINUX		3 | |
| 7 | #define _STAT_VER		_STAT_VER_LINUX | |
| 8 | ||
| 9 | /* Versions of the 'xmknod' interface used in compatibility xmknod | |
| 10 | functions. */ | |
| 11 | #define _MKNOD_VER_LINUX	1 | |
| 12 | #define _MKNOD_VER_SVR4		2 | |
| 13 | #define _MKNOD_VER		_MKNOD_VER_LINUX |
lib/libc/glibc/sysdeps/unix/x86_64/sysdep.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 1991-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 1991-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/wordsize-32/divdi3-symbol-hacks.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Hacks needed for divdi3 symbol manipulation. |
| 2 | Copyright (C) 2004-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2004-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/x86/bits/select.h deleted-63| ... | ... | @@ -1,63 +0,0 @@ |
| 1 | /* Copyright (C) 1997-2020 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library; if not, see | |
| 16 | <https://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | #ifndef _SYS_SELECT_H | |
| 19 | # error "Never use <bits/select.h> directly; include <sys/select.h> instead." | |
| 20 | #endif | |
| 21 | ||
| 22 | #include <bits/wordsize.h> | |
| 23 | ||
| 24 | ||
| 25 | #if defined __GNUC__ && __GNUC__ >= 2 | |
| 26 | ||
| 27 | # if __WORDSIZE == 64 | |
| 28 | # define __FD_ZERO_STOS "stosq" | |
| 29 | # else | |
| 30 | # define __FD_ZERO_STOS "stosl" | |
| 31 | # endif | |
| 32 | ||
| 33 | # define __FD_ZERO(fdsp) \ | |
| 34 | do {									 \ | |
| 35 | int __d0, __d1;							 \ | |
| 36 | __asm__ __volatile__ ("cld; rep; " __FD_ZERO_STOS			 \ | |
| 37 | 			 : "=c" (__d0), "=D" (__d1)			 \ | |
| 38 | 			 : "a" (0), "0" (sizeof (fd_set)		 \ | |
| 39 | 					 / sizeof (__fd_mask)),	 \ | |
| 40 | 			 "1" (&__FDS_BITS (fdsp)[0])			 \ | |
| 41 | 			 : "memory");					 \ | |
| 42 | } while (0) | |
| 43 | ||
| 44 | #else	/* ! GNU CC */ | |
| 45 | ||
| 46 | /* We don't use `memset' because this would require a prototype and | |
| 47 | the array isn't too big. */ | |
| 48 | # define __FD_ZERO(set) \ | |
| 49 | do {									 \ | |
| 50 | unsigned int __i;							 \ | |
| 51 | fd_set *__arr = (set);						 \ | |
| 52 | for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i)	 \ | |
| 53 | __FDS_BITS (__arr)[__i] = 0;					 \ | |
| 54 | } while (0) | |
| 55 | ||
| 56 | #endif	/* GNU CC */ | |
| 57 | ||
| 58 | #define __FD_SET(d, set) \ | |
| 59 | ((void) (__FDS_BITS (set)[__FD_ELT (d)] |= __FD_MASK (d))) | |
| 60 | #define __FD_CLR(d, set) \ | |
| 61 | ((void) (__FDS_BITS (set)[__FD_ELT (d)] &= ~__FD_MASK (d))) | |
| 62 | #define __FD_ISSET(d, set) \ | |
| 63 | ((__FDS_BITS (set)[__FD_ELT (d)] & __FD_MASK (d)) != 0) |
lib/libc/glibc/sysdeps/x86/nptl/bits/pthreadtypes-arch.h+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* Copyright (C) 2002-2020 Free Software Foundation, Inc. | |
| 1 | /* Copyright (C) 2002-2021 Free Software Foundation, Inc. | |
| 2 | 2 | This file is part of the GNU C Library. |
| 3 | 3 | |
| 4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/x86/sysdep.h+6-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Assembler macros for x86. |
| 2 | Copyright (C) 2017-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2017-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -57,6 +57,11 @@ enum cf_protection_level |
| 57 | 57 | #define STATE_SAVE_MASK \ |
| 58 | 58 | ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 5) | (1 << 6) | (1 << 7)) |
| 59 | 59 | |
| 60 | /* Constants for bits in __x86_string_control: */ | |
| 61 | ||
| 62 | /* Avoid short distance REP MOVSB. */ | |
| 63 | #define X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB	(1 << 0) | |
| 64 | ||
| 60 | 65 | #ifdef	__ASSEMBLER__ |
| 61 | 66 | |
| 62 | 67 | /* Syntactic details of assembler. */ |
lib/libc/glibc/sysdeps/x86_64/crti.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for x86-64. |
| 2 | Copyright (C) 2012-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2012-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/x86_64/crtn.S+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Special .init and .fini section support for x86-64. |
| 2 | Copyright (C) 2012-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2012-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/sysdeps/x86_64/start.S+5-9| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Startup code compliant to the ELF x86-64 ABI. |
| 2 | Copyright (C) 2001-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2001-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | Contributed by Andreas Jaeger <aj@suse.de>, 2001. |
| 5 | 5 | |
| ... | ... | @@ -96,17 +96,13 @@ ENTRY (_start) |
| 96 | 96 | 	 which grow downwards). */ |
| 97 | 97 | 	pushq %rsp |
| 98 | 98 | |
| 99 | #ifdef PIC | |
| 100 | 	/* Pass address of our own entry points to .fini and .init. */ | |
| 101 | 	mov __libc_csu_fini@GOTPCREL(%rip), %R8_LP | |
| 102 | 	mov __libc_csu_init@GOTPCREL(%rip), %RCX_LP | |
| 99 | 	/* These used to be the addresses of .fini and .init. */ | |
| 100 | 	xorl %r8d, %r8d | |
| 101 | 	xorl %ecx, %ecx | |
| 103 | 102 | |
| 103 | #ifdef PIC | |
| 104 | 104 | 	mov main@GOTPCREL(%rip), %RDI_LP |
| 105 | 105 | #else |
| 106 | 	/* Pass address of our own entry points to .fini and .init. */ | |
| 107 | 	mov $__libc_csu_fini, %R8_LP | |
| 108 | 	mov $__libc_csu_init, %RCX_LP | |
| 109 | ||
| 110 | 106 | 	mov $main, %RDI_LP |
| 111 | 107 | #endif |
| 112 | 108 |
lib/libc/glibc/sysdeps/x86_64/sysdep.h+23-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Assembler macros for x86-64. |
| 2 | Copyright (C) 2001-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2001-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
| ... | ... | @@ -95,6 +95,28 @@ lose:									 \ |
| 95 | 95 | #define R14_LP	r14 |
| 96 | 96 | #define R15_LP	r15 |
| 97 | 97 | |
| 98 | /* Zero upper vector registers and return with xtest. NB: Use VZEROALL | |
| 99 | to avoid RTM abort triggered by VZEROUPPER inside transactionally. */ | |
| 100 | #define ZERO_UPPER_VEC_REGISTERS_RETURN_XTEST \ | |
| 101 | 	xtest;							\ | |
| 102 | 	jz	1f;						\ | |
| 103 | 	vzeroall;						\ | |
| 104 | 	ret;							\ | |
| 105 | 1:								\ | |
| 106 | 	vzeroupper;						\ | |
| 107 | 	ret | |
| 108 | ||
| 109 | /* Zero upper vector registers and return. */ | |
| 110 | #ifndef ZERO_UPPER_VEC_REGISTERS_RETURN | |
| 111 | # define ZERO_UPPER_VEC_REGISTERS_RETURN \ | |
| 112 | 	VZEROUPPER;						\ | |
| 113 | 	ret | |
| 114 | #endif | |
| 115 | ||
| 116 | #ifndef VZEROUPPER_RETURN | |
| 117 | # define VZEROUPPER_RETURN	VZEROUPPER; ret | |
| 118 | #endif | |
| 119 | ||
| 98 | 120 | #else	/* __ASSEMBLER__ */ |
| 99 | 121 | |
| 100 | 122 | /* Long and pointer size in bytes. */ |
lib/libc/glibc/sysdeps/x86_64/x32/sysdep.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* Assembler macros for x32. |
| 2 | Copyright (C) 2012-2020 Free Software Foundation, Inc. | |
| 2 | Copyright (C) 2012-2021 Free Software Foundation, Inc. | |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| 5 | 5 | The GNU C Library is free software; you can redistribute it and/or |
lib/libc/glibc/time/bits/types/struct_timespec.h+6-1| ... | ... | @@ -4,15 +4,20 @@ |
| 4 | 4 | |
| 5 | 5 | #include <bits/types.h> |
| 6 | 6 | #include <bits/endian.h> |
| 7 | #include <bits/types/time_t.h> | |
| 7 | 8 | |
| 8 | 9 | /* POSIX.1b structure for a time value. This is like a `struct timeval' but |
| 9 | 10 | has nanoseconds instead of microseconds. */ |
| 10 | 11 | struct timespec |
| 11 | 12 | { |
| 13 | #ifdef __USE_TIME_BITS64 | |
| 14 | __time64_t tv_sec;		/* Seconds. */ | |
| 15 | #else | |
| 12 | 16 | __time_t tv_sec;		/* Seconds. */ |
| 17 | #endif | |
| 13 | 18 | #if __WORDSIZE == 64 \ |
| 14 | 19 | || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) \ |
| 15 | || __TIMESIZE == 32 | |
| 20 | || (__TIMESIZE == 32 && !defined __USE_TIME_BITS64) | |
| 16 | 21 | __syscall_slong_t tv_nsec;	/* Nanoseconds. */ |
| 17 | 22 | #else |
| 18 | 23 | # if __BYTE_ORDER == __BIG_ENDIAN |
lib/libc/glibc/time/bits/types/struct_timeval.h+5| ... | ... | @@ -7,7 +7,12 @@ |
| 7 | 7 | microsecond but also has a range of years. */ |
| 8 | 8 | struct timeval |
| 9 | 9 | { |
| 10 | #ifdef __USE_TIME_BITS64 | |
| 11 | __time64_t tv_sec;		/* Seconds. */ | |
| 12 | __suseconds64_t tv_usec;	/* Microseconds. */ | |
| 13 | #else | |
| 10 | 14 | __time_t tv_sec;		/* Seconds. */ |
| 11 | 15 | __suseconds_t tv_usec;	/* Microseconds. */ |
| 16 | #endif | |
| 12 | 17 | }; |
| 13 | 18 | #endif |
lib/libc/glibc/time/bits/types/time_t.h+4| ... | ... | @@ -4,6 +4,10 @@ |
| 4 | 4 | #include <bits/types.h> |
| 5 | 5 | |
| 6 | 6 | /* Returned by `time'. */ |
| 7 | #ifdef __USE_TIME_BITS64 | |
| 8 | typedef __time64_t time_t; | |
| 9 | #else | |
| 7 | 10 | typedef __time_t time_t; |
| 11 | #endif | |
| 8 | 12 | |
| 9 | 13 | #endif |
src/glibc.zig+5-38| ... | ... | @@ -282,46 +282,13 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void { |
| 282 | 282 | lib_libc_glibc ++ "io" ++ path.sep_str ++ "fstatat64.c", |
| 283 | 283 | lib_libc_glibc ++ "io" ++ path.sep_str ++ "mknod.c", |
| 284 | 284 | lib_libc_glibc ++ "io" ++ path.sep_str ++ "mknodat.c", |
| 285 | lib_libc_glibc ++ "nptl" ++ path.sep_str ++ "pthread_atfork.c", | |
| 285 | lib_libc_glibc ++ "sysdeps" ++ path.sep_str ++ "pthread" ++ path.sep_str ++ | |
| 286 | "pthread_atfork.c", | |
| 286 | 287 | lib_libc_glibc ++ "debug" ++ path.sep_str ++ "stack_chk_fail_local.c", |
| 288 | lib_libc_glibc ++ "csu" ++ path.sep_str ++ "errno.c", | |
| 287 | 289 | }; |
| 288 | 290 | |
| 289 | var c_source_files: [deps.len + 1]Compilation.CSourceFile = undefined; | |
| 290 | ||
| 291 | c_source_files[0] = blk: { | |
| 292 | var args = std.ArrayList([]const u8).init(arena); | |
| 293 | try args.appendSlice(&[_][]const u8{ | |
| 294 | "-std=gnu11", | |
| 295 | "-fgnu89-inline", | |
| 296 | "-fmerge-all-constants", | |
| 297 | "-fno-stack-protector", | |
| 298 | "-fmath-errno", | |
| 299 | "-fno-stack-protector", | |
| 300 | "-I", | |
| 301 | try lib_path(comp, arena, lib_libc_glibc ++ "csu"), | |
| 302 | }); | |
| 303 | try add_include_dirs(comp, arena, &args); | |
| 304 | try args.appendSlice(&[_][]const u8{ | |
| 305 | "-DSTACK_PROTECTOR_LEVEL=0", | |
| 306 | "-fPIC", | |
| 307 | "-fno-stack-protector", | |
| 308 | "-ftls-model=initial-exec", | |
| 309 | "-D_LIBC_REENTRANT", | |
| 310 | "-include", | |
| 311 | try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-modules.h"), | |
| 312 | "-DMODULE_NAME=libc", | |
| 313 | "-Wno-nonportable-include-path", | |
| 314 | "-include", | |
| 315 | try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-symbols.h"), | |
| 316 | "-DPIC", | |
| 317 | "-DLIBC_NONSHARED=1", | |
| 318 | "-DTOP_NAMESPACE=glibc", | |
| 319 | }); | |
| 320 | break :blk .{ | |
| 321 | .src_path = try lib_path(comp, arena, lib_libc_glibc ++ "csu" ++ path.sep_str ++ "elf-init.c"), | |
| 322 | .extra_flags = args.items, | |
| 323 | }; | |
| 324 | }; | |
| 291 | var c_source_files: [deps.len]Compilation.CSourceFile = undefined; | |
| 325 | 292 | |
| 326 | 293 | for (deps) |dep, i| { |
| 327 | 294 | var args = std.ArrayList([]const u8).init(arena); |
| ... | ... | @@ -347,7 +314,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void { |
| 347 | 314 | "-DLIBC_NONSHARED=1", |
| 348 | 315 | "-DTOP_NAMESPACE=glibc", |
| 349 | 316 | }); |
| 350 | c_source_files[i + 1] = .{ | |
| 317 | c_source_files[i] = .{ | |
| 351 | 318 | .src_path = try lib_path(comp, arena, dep), |
| 352 | 319 | .extra_flags = args.items, |
| 353 | 320 | }; |
test/standalone.zig+1| ... | ... | @@ -84,5 +84,6 @@ pub fn addCases(cases: *tests.StandaloneContext) void { |
| 84 | 84 | cases.add("tools/gen_stubs.zig"); |
| 85 | 85 | cases.add("tools/update_clang_options.zig"); |
| 86 | 86 | cases.add("tools/update_cpu_features.zig"); |
| 87 | cases.add("tools/update_glibc.zig"); | |
| 87 | 88 | cases.add("tools/update_spirv_features.zig"); |
| 88 | 89 | } |
tools/update_glibc.zig created+71| ... | ... | @@ -0,0 +1,71 @@ |
| 1 | //! This script updates the .c, .h, .s, and .S files that make up the start | |
| 2 | //! files such as crt1.o. Not to be confused with | |
| 3 | //! https://github.com/ziglang/glibc-abi-tool/ which updates the `abilists` | |
| 4 | //! file. | |
| 5 | //! | |
| 6 | //! Example usage: | |
| 7 | //! `zig run ../tools/update_glibc.zig -- ~/Downloads/glibc ..` | |
| 8 | ||
| 9 | const std = @import("std"); | |
| 10 | const mem = std.mem; | |
| 11 | const log = std.log; | |
| 12 | const fs = std.fs; | |
| 13 | ||
| 14 | const exempt_files = [_][]const u8{ | |
| 15 | "abilists", | |
| 16 | "include/libc-modules.h", | |
| 17 | "include/config.h", | |
| 18 | // These are easier to maintain like this, without updating to the abi-note.c | |
| 19 | // that glibc did upstream. | |
| 20 | "csu/abi-tag.h", | |
| 21 | "csu/abi-note.S", | |
| 22 | }; | |
| 23 | ||
| 24 | pub fn main() !void { | |
| 25 | var arena_instance = std.heap.ArenaAllocator.init(std.heap.page_allocator); | |
| 26 | defer arena_instance.deinit(); | |
| 27 | const arena = arena_instance.allocator(); | |
| 28 | ||
| 29 | const args = try std.process.argsAlloc(arena); | |
| 30 | const glibc_src_path = args[1]; | |
| 31 | const zig_src_path = args[2]; | |
| 32 | ||
| 33 | const dest_dir_path = try std.fmt.allocPrint(arena, "{s}/lib/libc/glibc", .{zig_src_path}); | |
| 34 | ||
| 35 | var dest_dir = fs.cwd().openDir(dest_dir_path, .{ .iterate = true }) catch |err| { | |
| 36 | fatal("unable to open destination directory '{s}': {s}", .{ | |
| 37 | dest_dir_path, @errorName(err), | |
| 38 | }); | |
| 39 | }; | |
| 40 | defer dest_dir.close(); | |
| 41 | ||
| 42 | var glibc_src_dir = try fs.cwd().openDir(glibc_src_path, .{}); | |
| 43 | defer glibc_src_dir.close(); | |
| 44 | ||
| 45 | var walker = try dest_dir.walk(arena); | |
| 46 | defer walker.deinit(); | |
| 47 | ||
| 48 | walk: while (try walker.next()) |entry| { | |
| 49 | if (entry.kind != .File) continue; | |
| 50 | if (mem.startsWith(u8, entry.basename, ".")) continue; | |
| 51 | for (exempt_files) |p| { | |
| 52 | if (mem.eql(u8, entry.path, p)) continue :walk; | |
| 53 | } | |
| 54 | ||
| 55 | glibc_src_dir.copyFile(entry.path, dest_dir, entry.path, .{}) catch |err| { | |
| 56 | log.warn("unable to copy '{s}/{s}' to '{s}/{s}': {s}", .{ | |
| 57 | glibc_src_path, entry.path, | |
| 58 | dest_dir_path, entry.path, | |
| 59 | @errorName(err), | |
| 60 | }); | |
| 61 | if (err == error.FileNotFound) { | |
| 62 | try dest_dir.deleteFile(entry.path); | |
| 63 | } | |
| 64 | }; | |
| 65 | } | |
| 66 | } | |
| 67 | ||
| 68 | fn fatal(comptime format: []const u8, args: anytype) noreturn { | |
| 69 | log.err(format, args); | |
| 70 | std.process.exit(1); | |
| 71 | } |