authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-12-15 00:22:38-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-12-15 14:30:03-07:00
log19ca2415f26b07b399a60fd17a4cf85f290da0fd
treedbbd6affde21ad2a59b2b2e1f4d7948e21133a13
parent1edf8efa4243eb1715ace35b1a99f7eaa0863fdd

update glibc start files to 2.34

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 #4926

295 files changed, 4070 insertions(+), 8630 deletions(-)

lib/libc/glibc/bits/byteswap.h+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Macros and inline functions to swap the order of bytes in integer values.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,6 +1,6 @@
1/* Macros to control TS 18661-3 glibc features where the same1/* Macros to control TS 18661-3 glibc features where the same
2 definitions are appropriate for all platforms.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 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
6 The GNU C Library is free software; you can redistribute it and/or6 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,5 +1,5 @@
1/* Handle feature test macros at the start of a header.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -44,8 +44,26 @@...@@ -44,8 +44,26 @@
4444
45/* ISO/IEC TS 18661-1:2014 defines the __STDC_WANT_IEC_60559_BFP_EXT__45/* ISO/IEC TS 18661-1:2014 defines the __STDC_WANT_IEC_60559_BFP_EXT__
46 macro. Most but not all symbols enabled by that macro in TS46 macro. Most but not all symbols enabled by that macro in TS
47 18661-1 are enabled unconditionally in C2X; the symbols in Annex F47 18661-1 are enabled unconditionally in C2X. In C2X, the symbols in
48 still require that macro in C2X. */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#undef __GLIBC_USE_IEC_60559_BFP_EXT67#undef __GLIBC_USE_IEC_60559_BFP_EXT
50#if defined __USE_GNU || defined __STDC_WANT_IEC_60559_BFP_EXT__68#if defined __USE_GNU || defined __STDC_WANT_IEC_60559_BFP_EXT__
51# define __GLIBC_USE_IEC_60559_BFP_EXT 169# define __GLIBC_USE_IEC_60559_BFP_EXT 1
...@@ -58,6 +76,12 @@...@@ -58,6 +76,12 @@
58#else76#else
59# define __GLIBC_USE_IEC_60559_BFP_EXT_C2X 077# define __GLIBC_USE_IEC_60559_BFP_EXT_C2X 0
60#endif78#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
6185
62/* ISO/IEC TS 18661-4:2015 defines the86/* ISO/IEC TS 18661-4:2015 defines the
63 __STDC_WANT_IEC_60559_FUNCS_EXT__ macro. Other than the reduction87 __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,5 +1,5 @@
1/* Properties of long double type.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -37,4 +37,17 @@...@@ -37,4 +37,17 @@
37#ifndef __NO_LONG_DOUBLE_MATH37#ifndef __NO_LONG_DOUBLE_MATH
38# define __NO_LONG_DOUBLE_MATH 138# define __NO_LONG_DOUBLE_MATH 1
39#endif39#endif
40#define __LONG_DOUBLE_USES_FLOAT128 040
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,4 +1,4 @@
1/* Copyright (C) 1997-2020 Free Software Foundation, Inc.1/* Copyright (C) 1997-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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,5 +1,5 @@
1/* Signal number constants. Generic template.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -57,31 +57,9 @@...@@ -57,31 +57,9 @@
57#define SIGQUIT 3 /* Quit. */57#define SIGQUIT 3 /* Quit. */
58#define SIGTRAP 5 /* Trace/breakpoint trap. */58#define SIGTRAP 5 /* Trace/breakpoint trap. */
59#define SIGKILL 9 /* Killed. */59#define SIGKILL 9 /* Killed. */
60#define SIGBUS 10 /* Bus error. */
61#define SIGSYS 12 /* Bad system call. */
62#define SIGPIPE 13 /* Broken pipe. */60#define SIGPIPE 13 /* Broken pipe. */
63#define SIGALRM 14 /* Alarm clock. */61#define SIGALRM 14 /* Alarm clock. */
6462
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/* Archaic names for compatibility. */63/* Archaic names for compatibility. */
86#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD). */64#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD). */
87#define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11. */65#define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11. */
...@@ -93,8 +71,9 @@...@@ -93,8 +71,9 @@
93 but some real-time signals may be used internally by glibc. Do not71 but some real-time signals may be used internally by glibc. Do not
94 use these constants in application code; use SIGRTMIN and SIGRTMAX72 use these constants in application code; use SIGRTMIN and SIGRTMAX
95 (defined in signal.h) instead. */73 (defined in signal.h) instead. */
96#define __SIGRTMIN 3274
97#define __SIGRTMAX __SIGRTMIN75/* Include system specific bits. */
76#include <bits/signum-arch.h>
9877
99/* Biggest signal number + 1 (including real-time signals). */78/* Biggest signal number + 1 (including real-time signals). */
100#define _NSIG (__SIGRTMAX + 1)79#define _NSIG (__SIGRTMAX + 1)
lib/libc/glibc/bits/stat.h+1-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 1992-2020 Free Software Foundation, Inc.1/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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,5 +1,5 @@
1/* Define intN_t types.1/* Define intN_t types.
2 Copyright (C) 2017-2020 Free Software Foundation, Inc.2 Copyright (C) 2017-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Perform binary search - inline version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* bits/time64.h -- underlying types for __time64_t. Generic version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Bit size of the time_t type at glibc build time, general case.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Sched parameter structure. Generic version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* bits/typesizes.h -- underlying types for *_t. Generic version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -50,6 +50,7 @@...@@ -50,6 +50,7 @@
50#define __TIME_T_TYPE __SLONGWORD_TYPE50#define __TIME_T_TYPE __SLONGWORD_TYPE
51#define __USECONDS_T_TYPE __U32_TYPE51#define __USECONDS_T_TYPE __U32_TYPE
52#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE52#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE
53#define __SUSECONDS64_T_TYPE __SQUAD_TYPE
53#define __DADDR_T_TYPE __S32_TYPE54#define __DADDR_T_TYPE __S32_TYPE
54#define __KEY_T_TYPE __S32_TYPE55#define __KEY_T_TYPE __S32_TYPE
55#define __CLOCKID_T_TYPE __S32_TYPE56#define __CLOCKID_T_TYPE __S32_TYPE
...@@ -75,10 +76,16 @@...@@ -75,10 +76,16 @@
7576
76/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */77/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */
77# define __STATFS_MATCHES_STATFS64 178# define __STATFS_MATCHES_STATFS64 1
79
80/* And for getitimer, setitimer and rusage */
81# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1
78#else82#else
79# define __RLIM_T_MATCHES_RLIM64_T 083# define __RLIM_T_MATCHES_RLIM64_T 0
8084
81# define __STATFS_MATCHES_STATFS64 085# define __STATFS_MATCHES_STATFS64 0
86
87/* And for getitimer, setitimer and rusage */
88# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0
82#endif89#endif
8390
84/* Number of descriptors that can fit in an `fd_set'. */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,5 +1,5 @@
1/* Inline functions to return unsigned integer values unchanged.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Definitions of flag bits for `waitpid' et al.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -24,3 +24,11 @@...@@ -24,3 +24,11 @@
24/* Bits in the third argument to `waitpid'. */24/* Bits in the third argument to `waitpid'. */
25#define WNOHANG 1 /* Don't block waiting. */25#define WNOHANG 1 /* Don't block waiting. */
26#define WUNTRACED 2 /* Report status of stopped children. */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,5 +1,5 @@
1/* Definitions of status bits for `wait' et al.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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. */
40extern void (*__preinit_array_start []) (int, char **, char **)
41 attribute_hidden;
42extern void (*__preinit_array_end []) (int, char **, char **)
43 attribute_hidden;
44extern void (*__init_array_start []) (int, char **, char **)
45 attribute_hidden;
46extern void (*__init_array_end []) (int, char **, char **)
47 attribute_hidden;
48extern void (*__fini_array_start []) (void) attribute_hidden;
49extern 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. */
55extern void _init (void);
56extern 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
66void
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. */
94void
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. */
27int rtld_errno attribute_hidden;
28
29#else
30
31__thread int errno;
32extern __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,4 +1,4 @@
1/* Copyright (C) 2005-2020 Free Software Foundation, Inc.1/* Copyright (C) 2005-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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,5 +1,5 @@
1/* This file defines standard ELF types, structures, and macros.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -19,10 +19,6 @@...@@ -19,10 +19,6 @@
19#ifndef _ELF_H19#ifndef _ELF_H
20#define _ELF_H 120#define _ELF_H 1
2121
22#include <features.h>
23
24__BEGIN_DECLS
25
26/* Standard ELF types. */22/* Standard ELF types. */
2723
28#include <stdint.h>24#include <stdint.h>
...@@ -322,7 +318,7 @@ typedef struct...@@ -322,7 +318,7 @@ typedef struct
322 /* reserved 184 */318 /* reserved 184 */
323#define EM_AVR32 185 /* Amtel 32-bit microprocessor */319#define EM_AVR32 185 /* Amtel 32-bit microprocessor */
324#define EM_STM8 186 /* STMicroelectronics STM8 */320#define EM_STM8 186 /* STMicroelectronics STM8 */
325#define EM_TILE64 187 /* Tileta TILE64 */321#define EM_TILE64 187 /* Tilera TILE64 */
326#define EM_TILEPRO 188 /* Tilera TILEPro */322#define EM_TILEPRO 188 /* Tilera TILEPro */
327#define EM_MICROBLAZE 189 /* Xilinx MicroBlaze */323#define EM_MICROBLAZE 189 /* Xilinx MicroBlaze */
328#define EM_CUDA 190 /* NVIDIA CUDA */324#define EM_CUDA 190 /* NVIDIA CUDA */
...@@ -330,7 +326,7 @@ typedef struct...@@ -330,7 +326,7 @@ typedef struct
330#define EM_CLOUDSHIELD 192 /* CloudShield */326#define EM_CLOUDSHIELD 192 /* CloudShield */
331#define EM_COREA_1ST 193 /* KIPO-KAIST Core-A 1st gen. */327#define EM_COREA_1ST 193 /* KIPO-KAIST Core-A 1st gen. */
332#define EM_COREA_2ND 194 /* KIPO-KAIST Core-A 2nd gen. */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#define EM_OPEN8 196 /* Open8 RISC */330#define EM_OPEN8 196 /* Open8 RISC */
335#define EM_RL78 197 /* Renesas RL78 */331#define EM_RL78 197 /* Renesas RL78 */
336#define EM_VIDEOCORE5 198 /* Broadcom VideoCore V */332#define EM_VIDEOCORE5 198 /* Broadcom VideoCore V */
...@@ -340,7 +336,8 @@ typedef struct...@@ -340,7 +336,8 @@ typedef struct
340#define EM_BA2 202 /* Beyond BA2 */336#define EM_BA2 202 /* Beyond BA2 */
341#define EM_XCORE 203 /* XMOS xCORE */337#define EM_XCORE 203 /* XMOS xCORE */
342#define EM_MCHP_PIC 204 /* Microchip 8-bit PIC(r) */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#define EM_KM32 210 /* KM211 KM32 */341#define EM_KM32 210 /* KM211 KM32 */
345#define EM_KMX32 211 /* KM211 KMX32 */342#define EM_KMX32 211 /* KM211 KMX32 */
346#define EM_EMX16 212 /* KM211 KMX16 */343#define EM_EMX16 212 /* KM211 KMX16 */
...@@ -445,7 +442,7 @@ typedef struct...@@ -445,7 +442,7 @@ typedef struct
445#define SHT_FINI_ARRAY 15 /* Array of destructors */442#define SHT_FINI_ARRAY 15 /* Array of destructors */
446#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */443#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */
447#define SHT_GROUP 17 /* Section group */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#define SHT_NUM 19 /* Number of defined types. */446#define SHT_NUM 19 /* Number of defined types. */
450#define SHT_LOOS 0x60000000 /* Start OS-specific. */447#define SHT_LOOS 0x60000000 /* Start OS-specific. */
451#define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes. */448#define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes. */
...@@ -482,6 +479,7 @@ typedef struct...@@ -482,6 +479,7 @@ typedef struct
482#define SHF_COMPRESSED (1 << 11) /* Section with compressed data. */479#define SHF_COMPRESSED (1 << 11) /* Section with compressed data. */
483#define SHF_MASKOS 0x0ff00000 /* OS-specific. */480#define SHF_MASKOS 0x0ff00000 /* OS-specific. */
484#define SHF_MASKPROC 0xf0000000 /* Processor-specific */481#define SHF_MASKPROC 0xf0000000 /* Processor-specific */
482#define SHF_GNU_RETAIN (1 << 21) /* Not to be GCed by linker. */
485#define SHF_ORDERED (1 << 30) /* Special ordering requirement483#define SHF_ORDERED (1 << 30) /* Special ordering requirement
486 (Solaris). */484 (Solaris). */
487#define SHF_EXCLUDE (1U << 31) /* Section is excluded unless485#define SHF_EXCLUDE (1U << 31) /* Section is excluded unless
...@@ -721,6 +719,7 @@ typedef struct...@@ -721,6 +719,7 @@ typedef struct
721#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */719#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
722#define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */720#define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */
723#define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */721#define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */
722#define PT_GNU_PROPERTY 0x6474e553 /* GNU property */
724#define PT_LOSUNW 0x6ffffffa723#define PT_LOSUNW 0x6ffffffa
725#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */724#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
726#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */725#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */
...@@ -815,6 +814,10 @@ typedef struct...@@ -815,6 +814,10 @@ typedef struct
815 address keys. */814 address keys. */
816#define NT_ARM_PACG_KEYS 0x408 /* ARM pointer authentication815#define NT_ARM_PACG_KEYS 0x408 /* ARM pointer authentication
817 generic key. */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#define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note. */821#define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note. */
819#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers. */822#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers. */
820#define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode. */823#define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode. */
...@@ -1049,7 +1052,7 @@ typedef struct...@@ -1049,7 +1052,7 @@ typedef struct
1049#define VER_NDX_LORESERVE 0xff00 /* Beginning of reserved entries. */1052#define VER_NDX_LORESERVE 0xff00 /* Beginning of reserved entries. */
1050#define VER_NDX_ELIMINATE 0xff01 /* Symbol is to be eliminated. */1053#define VER_NDX_ELIMINATE 0xff01 /* Symbol is to be eliminated. */
10511054
1052/* Auxialiary version information. */1055/* Auxiliary version information. */
10531056
1054typedef struct1057typedef struct
1055{1058{
...@@ -1318,33 +1321,34 @@ typedef struct...@@ -1318,33 +1321,34 @@ typedef struct
1318/* Application-specific semantics, hi */1321/* Application-specific semantics, hi */
1319#define GNU_PROPERTY_HIUSER 0xffffffff1322#define GNU_PROPERTY_HIUSER 0xffffffff
13201323
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/* The x86 instruction sets indicated by the corresponding bits are1330/* The x86 instruction sets indicated by the corresponding bits are
1322 used in program. Their support in the hardware is optional. */1331 used in program. Their support in the hardware is optional. */
1323#define GNU_PROPERTY_X86_ISA_1_USED 0xc00000001332#define GNU_PROPERTY_X86_ISA_1_USED 0xc0010002
1324/* The x86 instruction sets indicated by the corresponding bits are1333/* The x86 instruction sets indicated by the corresponding bits are
1325 used in program and they must be supported by the hardware. */1334 used in program and they must be supported by the hardware. */
1326#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc00000011335#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0008002
1327/* X86 processor-specific features used in program. */1336/* X86 processor-specific features used in program. */
1328#define GNU_PROPERTY_X86_FEATURE_1_AND 0xc00000021337#define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002
13291338
1330#define GNU_PROPERTY_X86_ISA_1_486 (1U << 0)1339/* GNU_PROPERTY_X86_ISA_1_BASELINE: CMOV, CX8 (cmpxchg8b), FPU (fld),
1331#define GNU_PROPERTY_X86_ISA_1_586 (1U << 1)1340 MMX, OSFXSR (fxsave), SCE (syscall), SSE and SSE2. */
1332#define GNU_PROPERTY_X86_ISA_1_686 (1U << 2)1341#define GNU_PROPERTY_X86_ISA_1_BASELINE (1U << 0)
1333#define GNU_PROPERTY_X86_ISA_1_SSE (1U << 3)1342/* GNU_PROPERTY_X86_ISA_1_V2: GNU_PROPERTY_X86_ISA_1_BASELINE,
1334#define GNU_PROPERTY_X86_ISA_1_SSE2 (1U << 4)1343 CMPXCHG16B (cmpxchg16b), LAHF-SAHF (lahf), POPCNT (popcnt), SSE3,
1335#define GNU_PROPERTY_X86_ISA_1_SSE3 (1U << 5)1344 SSSE3, SSE4.1 and SSE4.2. */
1336#define GNU_PROPERTY_X86_ISA_1_SSSE3 (1U << 6)1345#define GNU_PROPERTY_X86_ISA_1_V2 (1U << 1)
1337#define GNU_PROPERTY_X86_ISA_1_SSE4_1 (1U << 7)1346/* GNU_PROPERTY_X86_ISA_1_V3: GNU_PROPERTY_X86_ISA_1_V2, AVX, AVX2, BMI1,
1338#define GNU_PROPERTY_X86_ISA_1_SSE4_2 (1U << 8)1347 BMI2, F16C, FMA, LZCNT, MOVBE, XSAVE. */
1339#define GNU_PROPERTY_X86_ISA_1_AVX (1U << 9)1348#define GNU_PROPERTY_X86_ISA_1_V3 (1U << 2)
1340#define GNU_PROPERTY_X86_ISA_1_AVX2 (1U << 10)1349/* GNU_PROPERTY_X86_ISA_1_V4: GNU_PROPERTY_X86_ISA_1_V3, AVX512F,
1341#define GNU_PROPERTY_X86_ISA_1_AVX512F (1U << 11)1350 AVX512BW, AVX512CD, AVX512DQ and AVX512VL. */
1342#define GNU_PROPERTY_X86_ISA_1_AVX512CD (1U << 12)1351#define GNU_PROPERTY_X86_ISA_1_V4 (1U << 3)
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)
13481352
1349/* This indicates that all executable sections are compatible with1353/* This indicates that all executable sections are compatible with
1350 IBT. */1354 IBT. */
...@@ -2136,9 +2140,9 @@ enum...@@ -2136,9 +2140,9 @@ enum
2136#define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */2140#define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */
2137#define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */2141#define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */
21382142
2139/* Additional section indeces. */2143/* Additional section indices. */
21402144
2141#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared2145#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tentatively declared
2142 symbols in ANSI C. */2146 symbols in ANSI C. */
2143#define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */2147#define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */
21442148
...@@ -2868,6 +2872,8 @@ enum...@@ -2868,6 +2872,8 @@ enum
2868#define R_AARCH64_IRELATIVE 1032 /* STT_GNU_IFUNC relocation. */2872#define R_AARCH64_IRELATIVE 1032 /* STT_GNU_IFUNC relocation. */
28692873
2870/* AArch64 specific values for the Dyn d_tag field. */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#define DT_AARCH64_VARIANT_PCS (DT_LOPROC + 5)2877#define DT_AARCH64_VARIANT_PCS (DT_LOPROC + 5)
2872#define DT_AARCH64_NUM 62878#define DT_AARCH64_NUM 6
28732879
...@@ -3946,8 +3952,9 @@ enum...@@ -3946,8 +3952,9 @@ enum
3946#define R_RISCV_SET16 553952#define R_RISCV_SET16 55
3947#define R_RISCV_SET32 563953#define R_RISCV_SET32 56
3948#define R_RISCV_32_PCREL 573954#define R_RISCV_32_PCREL 57
3955#define R_RISCV_IRELATIVE 58
39493956
3950#define R_RISCV_NUM 583957#define R_RISCV_NUM 59
39513958
3952/* BPF specific declarations. */3959/* BPF specific declarations. */
39533960
...@@ -3964,7 +3971,7 @@ enum...@@ -3964,7 +3971,7 @@ enum
3964#define R_METAG_RELBRANCH 43971#define R_METAG_RELBRANCH 4
3965#define R_METAG_GETSETOFF 53972#define R_METAG_GETSETOFF 5
39663973
3967/* Backward compatability */3974/* Backward compatibility */
3968#define R_METAG_REG32OP1 63975#define R_METAG_REG32OP1 6
3969#define R_METAG_REG32OP2 73976#define R_METAG_REG32OP2 7
3970#define R_METAG_REG32OP3 83977#define R_METAG_REG32OP3 8
...@@ -4027,6 +4034,72 @@ enum...@@ -4027,6 +4034,72 @@ enum
4027#define R_NDS32_TLS_TPOFF 1024034#define R_NDS32_TLS_TPOFF 102
4028#define R_NDS32_TLS_DESC 1194035#define R_NDS32_TLS_DESC 119
40294036
4030__END_DECLS4037/* 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
40314104
4032#endif /* elf.h */4105#endif /* elf.h */
lib/libc/glibc/include/bits/cpu-set.h+8
...@@ -1 +1,9 @@...@@ -1 +1,9 @@
1#ifndef _BITS_CPU_SET_H
1#include <posix/bits/cpu-set.h>2#include <posix/bits/cpu-set.h>
3
4#ifndef _ISOMAC
5int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp);
6libc_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
21extern 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
31extern __thread int errno attribute_tls_model_ie;
32
33# endif /* IS_IN_LIB */
34
35# define __set_errno(val) (errno = (val))
36
37extern int *__errno_location (void) __THROW __attribute_const__
38# if RTLD_PRIVATE_ERRNO
39 attribute_hidden
40# endif
41;
42libc_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,4 +1,4 @@
1/* Copyright (C) 1991-2020 Free Software Foundation, Inc.1/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -33,6 +33,8 @@...@@ -33,6 +33,8 @@
33 Extensions to ISO C11 from TS 18661-4:2015.33 Extensions to ISO C11 from TS 18661-4:2015.
34 __STDC_WANT_IEC_60559_TYPES_EXT__34 __STDC_WANT_IEC_60559_TYPES_EXT__
35 Extensions to ISO C11 from TS 18661-3:2015.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.
3638
37 _POSIX_SOURCE IEEE Std 1003.1.39 _POSIX_SOURCE IEEE Std 1003.1.
38 _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2;40 _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2;
...@@ -48,6 +50,8 @@...@@ -48,6 +50,8 @@
48 _LARGEFILE64_SOURCE Additional functionality from LFS for large files.50 _LARGEFILE64_SOURCE Additional functionality from LFS for large files.
49 _FILE_OFFSET_BITS=N Select default filesystem interface.51 _FILE_OFFSET_BITS=N Select default filesystem interface.
50 _ATFILE_SOURCE Additional *at interfaces.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 _GNU_SOURCE All of the above, plus GNU extensions.55 _GNU_SOURCE All of the above, plus GNU extensions.
52 _DEFAULT_SOURCE The default set of features (taking precedence over56 _DEFAULT_SOURCE The default set of features (taking precedence over
53 __STRICT_ANSI__).57 __STRICT_ANSI__).
...@@ -94,6 +98,8 @@...@@ -94,6 +98,8 @@
94 __USE_FILE_OFFSET64 Define 64bit interface as default.98 __USE_FILE_OFFSET64 Define 64bit interface as default.
95 __USE_MISC Define things from 4.3BSD or System V Unix.99 __USE_MISC Define things from 4.3BSD or System V Unix.
96 __USE_ATFILE Define *at interfaces and AT_* constants for them.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 __USE_GNU Define GNU extensions.103 __USE_GNU Define GNU extensions.
98 __USE_FORTIFY_LEVEL Additional security measures used, according to level.104 __USE_FORTIFY_LEVEL Additional security measures used, according to level.
99105
...@@ -137,6 +143,7 @@...@@ -137,6 +143,7 @@
137#undef __USE_FILE_OFFSET64143#undef __USE_FILE_OFFSET64
138#undef __USE_MISC144#undef __USE_MISC
139#undef __USE_ATFILE145#undef __USE_ATFILE
146#undef __USE_DYNAMIC_STACK_SIZE
140#undef __USE_GNU147#undef __USE_GNU
141#undef __USE_FORTIFY_LEVEL148#undef __USE_FORTIFY_LEVEL
142#undef __KERNEL_STRICT_NAMES149#undef __KERNEL_STRICT_NAMES
...@@ -213,6 +220,8 @@...@@ -213,6 +220,8 @@
213# define _DEFAULT_SOURCE 1220# define _DEFAULT_SOURCE 1
214# undef _ATFILE_SOURCE221# undef _ATFILE_SOURCE
215# define _ATFILE_SOURCE 1222# define _ATFILE_SOURCE 1
223# undef _DYNAMIC_STACK_SIZE_SOURCE
224# define _DYNAMIC_STACK_SIZE_SOURCE 1
216#endif225#endif
217226
218/* If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined,227/* If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined,
...@@ -380,6 +389,8 @@...@@ -380,6 +389,8 @@
380# define __USE_FILE_OFFSET64 1389# define __USE_FILE_OFFSET64 1
381#endif390#endif
382391
392#include <features-time64.h>
393
383#if defined _DEFAULT_SOURCE394#if defined _DEFAULT_SOURCE
384# define __USE_MISC 1395# define __USE_MISC 1
385#endif396#endif
...@@ -388,6 +399,10 @@...@@ -388,6 +399,10 @@
388# define __USE_ATFILE 1399# define __USE_ATFILE 1
389#endif400#endif
390401
402#ifdef _DYNAMIC_STACK_SIZE_SOURCE
403# define __USE_DYNAMIC_STACK_SIZE 1
404#endif
405
391#ifdef _GNU_SOURCE406#ifdef _GNU_SOURCE
392# define __USE_GNU 1407# define __USE_GNU 1
393#endif408#endif
...@@ -397,7 +412,15 @@...@@ -397,7 +412,15 @@
397# warning _FORTIFY_SOURCE requires compiling with optimization (-O)412# warning _FORTIFY_SOURCE requires compiling with optimization (-O)
398# elif !__GNUC_PREREQ (4, 1)413# elif !__GNUC_PREREQ (4, 1)
399# warning _FORTIFY_SOURCE requires GCC 4.1 or later414# 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# elif _FORTIFY_SOURCE > 1420# elif _FORTIFY_SOURCE > 1
421# if _FORTIFY_SOURCE > 2
422# warning _FORTIFY_SOURCE > 2 is treated like 2 on this platform
423# endif
401# define __USE_FORTIFY_LEVEL 2424# define __USE_FORTIFY_LEVEL 2
402# else425# else
403# define __USE_FORTIFY_LEVEL 1426# define __USE_FORTIFY_LEVEL 1
...@@ -454,7 +477,7 @@...@@ -454,7 +477,7 @@
454/* Major and minor version number of the GNU C library package. Use477/* Major and minor version number of the GNU C library package. Use
455 these macros to test for features in specific releases. */478 these macros to test for features in specific releases. */
456#define __GLIBC__ 2479#define __GLIBC__ 2
457#define __GLIBC_MINOR__ 31480#define __GLIBC_MINOR__ 34
458481
459#define __GLIBC_PREREQ(maj, min) \482#define __GLIBC_PREREQ(maj, min) \
460 ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))483 ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))
lib/libc/glibc/include/libc-pointer-arith.h+4-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Helper macros for pointer arithmetic.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -37,6 +37,9 @@...@@ -37,6 +37,9 @@
37/* Cast an integer or a pointer VAL to integer with proper type. */37/* Cast an integer or a pointer VAL to integer with proper type. */
38# define cast_to_integer(val) ((__integer_if_pointer_type (val)) (val))38# define cast_to_integer(val) ((__integer_if_pointer_type (val)) (val))
3939
40/* Cast an integer VAL to void * pointer. */
41# define cast_to_pointer(val) ((void *) (uintptr_t) (val))
42
40/* Align a value by rounding down to closest size.43/* Align a value by rounding down to closest size.
41 e.g. Using size of 4096, we get this behavior:44 e.g. Using size of 4096, we get this behavior:
42 {4095, 4096, 4097} = {0, 4096, 4096}. */45 {4095, 4096, 4097} = {0, 4096, 4096}. */
lib/libc/glibc/include/libc-symbols.h+62-83
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1/* Support macros for making weak and strong aliases for symbols,1/* Support macros for making weak and strong aliases for symbols,
2 and for using symbol sets and linker warnings with GNU ld.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 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
6 The GNU C Library is free software; you can redistribute it and/or6 The GNU C Library is free software; you can redistribute it and/or
...@@ -84,6 +84,9 @@...@@ -84,6 +84,9 @@
8484
85#include <config.h>85#include <config.h>
8686
87/* Obtain the definition of symbol_version_reference. */
88#include <libc-symver.h>
89
87/* When PIC is defined and SHARED isn't defined, we are building PIE90/* When PIC is defined and SHARED isn't defined, we are building PIE
88 by default. */91 by default. */
89#if defined PIC && !defined SHARED92#if defined PIC && !defined SHARED
...@@ -307,7 +310,7 @@ for linking")...@@ -307,7 +310,7 @@ for linking")
307310
308/* Resource freeing functions from libc.so go in this section. */311/* Resource freeing functions from libc.so go in this section. */
309#define __libc_freeres_fn_section \312#define __libc_freeres_fn_section \
310 __attribute__ ((section ("__libc_freeres_fn")))313 __attribute__ ((__used__, section ("__libc_freeres_fn")))
311314
312/* Resource freeing functions for libc.so. */315/* Resource freeing functions for libc.so. */
313#define libc_freeres_fn(name) \316#define libc_freeres_fn(name) \
...@@ -349,6 +352,12 @@ for linking")...@@ -349,6 +352,12 @@ for linking")
349 352
350*/353*/
351354
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/* Symbol set support macros. */361/* Symbol set support macros. */
353362
354/* Make SYMBOL, which is in the text segment, an element of SET. */363/* Make SYMBOL, which is in the text segment, an element of SET. */
...@@ -364,12 +373,12 @@ for linking")...@@ -364,12 +373,12 @@ for linking")
364/* When building a shared library, make the set section writable,373/* When building a shared library, make the set section writable,
365 because it will need to be relocated at run time anyway. */374 because it will need to be relocated at run time anyway. */
366# define _elf_set_element(set, symbol) \375# define _elf_set_element(set, symbol) \
367 static const void *__elf_set_##set##_element_##symbol##__ \376 static const void *__elf_set_##set##_element_##symbol##__ \
368 __attribute__ ((used, section (#set))) = &(symbol)377 attribute_used_retain __attribute__ ((section (#set))) = &(symbol)
369#else378#else
370# define _elf_set_element(set, symbol) \379# define _elf_set_element(set, symbol) \
371 static const void *const __elf_set_##set##_element_##symbol##__ \380 static const void *const __elf_set_##set##_element_##symbol##__ \
372 __attribute__ ((used, section (#set))) = &(symbol)381 attribute_used_retain __attribute__ ((section (#set))) = &(symbol)
373#endif382#endif
374383
375/* Define SET as a symbol set. This may be required (it is in a.out) to384/* Define SET as a symbol set. This may be required (it is in a.out) to
...@@ -396,32 +405,27 @@ for linking")...@@ -396,32 +405,27 @@ for linking")
396 past the last element in SET. */405 past the last element in SET. */
397#define symbol_set_end_p(set, ptr) ((ptr) >= (void *const *) &__stop_##set)406#define symbol_set_end_p(set, ptr) ((ptr) >= (void *const *) &__stop_##set)
398407
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#ifdef SHARED408#ifdef SHARED
413# define symbol_version(real, name, version) \409# define symbol_version(real, name, version) \
414 symbol_version_reference(real, name, version)410 symbol_version_reference(real, name, version)
415# define default_symbol_version(real, name, version) \411# define default_symbol_version(real, name, version) \
416 _default_symbol_version(real, name, version)412 _default_symbol_version(real, name, version)
413/* See <libc-symver.h>. */
417# ifdef __ASSEMBLER__414# ifdef __ASSEMBLER__
418# define _default_symbol_version(real, name, version) \415# define _default_symbol_version(real, name, version) \
419 .symver real, name##@##@##version416 _set_symbol_version (real, name@@version)
420# else417# else
421# define _default_symbol_version(real, name, version) \418# define _default_symbol_version(real, name, version) \
422 __asm__ (".symver " #real "," #name "@@" #version)419 _set_symbol_version (real, #name "@@" #version)
423# endif420# endif
424#else421
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# define symbol_version(real, name, version)429# define symbol_version(real, name, version)
426# define default_symbol_version(real, name, version) \430# define default_symbol_version(real, name, version) \
427 strong_alias(real, name)431 strong_alias(real, name)
...@@ -618,12 +622,7 @@ for linking")...@@ -618,12 +622,7 @@ for linking")
618# define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)622# define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
619# define libc_hidden_def(name) hidden_def (name)623# define libc_hidden_def(name) hidden_def (name)
620# define libc_hidden_weak(name) hidden_weak (name)624# define libc_hidden_weak(name) hidden_weak (name)
621# ifdef LINK_OBSOLETE_RPC625# define libc_hidden_nolink_sunrpc(name, version) hidden_nolink (name, libc, version)
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
627# define libc_hidden_ver(local, name) hidden_ver (local, name)626# define libc_hidden_ver(local, name) hidden_ver (local, name)
628# define libc_hidden_data_def(name) hidden_data_def (name)627# define libc_hidden_data_def(name) hidden_data_def (name)
629# define libc_hidden_tls_def(name) hidden_tls_def (name)628# define libc_hidden_tls_def(name) hidden_tls_def (name)
...@@ -641,7 +640,7 @@ for linking")...@@ -641,7 +640,7 @@ for linking")
641# define libc_hidden_data_ver(local, name)640# define libc_hidden_data_ver(local, name)
642#endif641#endif
643642
644#if IS_IN (rtld) && !defined NO_RTLD_HIDDEN643#if IS_IN (rtld)
645# define rtld_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)644# define rtld_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
646# define rtld_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)645# define rtld_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
647# define rtld_hidden_def(name) hidden_def (name)646# define rtld_hidden_def(name) hidden_def (name)
...@@ -730,6 +729,29 @@ for linking")...@@ -730,6 +729,29 @@ for linking")
730# define libresolv_hidden_data_ver(local, name)729# define libresolv_hidden_data_ver(local, name)
731#endif730#endif
732731
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#if IS_IN (librt)755#if IS_IN (librt)
734# define librt_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)756# define librt_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
735# define librt_hidden_tls_proto(name, attrs...) \757# define librt_hidden_tls_proto(name, attrs...) \
...@@ -776,40 +798,11 @@ for linking")...@@ -776,40 +798,11 @@ for linking")
776# define libdl_hidden_data_ver(local, name)798# define libdl_hidden_data_ver(local, name)
777#endif799#endif
778800
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#if IS_IN (libnsl)801#if IS_IN (libnsl)
803# define libnsl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)802# define libnsl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
804# define libnsl_hidden_tls_proto(name, attrs...) \803# define libnsl_hidden_tls_proto(name, attrs...) \
805 hidden_tls_proto (name, ##attrs)804 hidden_tls_proto (name, ##attrs)
806# ifdef LINK_OBSOLETE_NSL805# define libnsl_hidden_nolink_def(name, version) hidden_nolink (name, libnsl, version)
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)
813# define libnsl_hidden_weak(name) hidden_weak (name)806# define libnsl_hidden_weak(name) hidden_weak (name)
814# define libnsl_hidden_ver(local, name) hidden_ver (local, name)807# define libnsl_hidden_ver(local, name) hidden_ver (local, name)
815# define libnsl_hidden_data_def(name) hidden_data_def (name)808# define libnsl_hidden_data_def(name) hidden_data_def (name)
...@@ -819,7 +812,6 @@ for linking")...@@ -819,7 +812,6 @@ for linking")
819#else812#else
820# define libnsl_hidden_proto(name, attrs...)813# define libnsl_hidden_proto(name, attrs...)
821# define libnsl_hidden_tls_proto(name, attrs...)814# define libnsl_hidden_tls_proto(name, attrs...)
822# define libnsl_hidden_def(name)
823# define libnsl_hidden_weak(name)815# define libnsl_hidden_weak(name)
824# define libnsl_hidden_ver(local, name)816# define libnsl_hidden_ver(local, name)
825# define libnsl_hidden_data_def(name)817# define libnsl_hidden_data_def(name)
...@@ -828,33 +820,12 @@ for linking")...@@ -828,33 +820,12 @@ for linking")
828# define libnsl_hidden_data_ver(local, name)820# define libnsl_hidden_data_ver(local, name)
829#endif821#endif
830822
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#define libc_hidden_builtin_proto(name, attrs...) libc_hidden_proto (name, ##attrs)823#define libc_hidden_builtin_proto(name, attrs...) libc_hidden_proto (name, ##attrs)
855#define libc_hidden_builtin_def(name) libc_hidden_def (name)824#define libc_hidden_builtin_def(name) libc_hidden_def (name)
856#define libc_hidden_builtin_weak(name) libc_hidden_weak (name)825#define libc_hidden_builtin_weak(name) libc_hidden_weak (name)
857#define libc_hidden_builtin_ver(local, name) libc_hidden_ver (local, name)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#ifdef __ASSEMBLER__829#ifdef __ASSEMBLER__
859# define HIDDEN_BUILTIN_JUMPTARGET(name) HIDDEN_JUMPTARGET(name)830# define HIDDEN_BUILTIN_JUMPTARGET(name) HIDDEN_JUMPTARGET(name)
860#endif831#endif
...@@ -882,6 +853,14 @@ for linking")...@@ -882,6 +853,14 @@ for linking")
882# define libutil_hidden_data_ver(local, name)853# define libutil_hidden_data_ver(local, name)
883#endif854#endif
884855
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/* Get some dirty hacks. */864/* Get some dirty hacks. */
886#include <symbol-hacks.h>865#include <symbol-hacks.h>
887866
lib/libc/glibc/include/pthread.h+11
...@@ -8,9 +8,20 @@ extern int __pthread_barrier_init (pthread_barrier_t *__restrict __barrier,...@@ -8,9 +8,20 @@ extern int __pthread_barrier_init (pthread_barrier_t *__restrict __barrier,
8 const pthread_barrierattr_t *__restrict8 const pthread_barrierattr_t *__restrict
9 __attr, unsigned int __count)9 __attr, unsigned int __count)
10 __THROW __nonnull ((1));10 __THROW __nonnull ((1));
11#if PTHREAD_IN_LIBC
12libc_hidden_proto (__pthread_barrier_init)
13#endif
11extern int __pthread_barrier_wait (pthread_barrier_t *__barrier)14extern int __pthread_barrier_wait (pthread_barrier_t *__barrier)
12 __THROWNL __nonnull ((1));15 __THROWNL __nonnull ((1));
16#if PTHREAD_IN_LIBC
17libc_hidden_proto (__pthread_barrier_wait)
18#endif
1319
14/* This function is called to initialize the pthread library. */20/* This function is called to initialize the pthread library. */
15extern void __pthread_initialize (void) __attribute__ ((weak));21extern void __pthread_initialize (void) __attribute__ ((weak));
22
23extern int __pthread_kill (pthread_t threadid, int signo);
24
25extern pthread_t __pthread_self (void);
26
16#endif27#endif
lib/libc/glibc/include/signal.h+15-2
...@@ -2,6 +2,8 @@...@@ -2,6 +2,8 @@
2# include <signal/signal.h>2# include <signal/signal.h>
33
4# ifndef _ISOMAC4# ifndef _ISOMAC
5# include <sigsetops.h>
6
5libc_hidden_proto (sigemptyset)7libc_hidden_proto (sigemptyset)
6libc_hidden_proto (sigfillset)8libc_hidden_proto (sigfillset)
7libc_hidden_proto (sigaddset)9libc_hidden_proto (sigaddset)
...@@ -12,7 +14,10 @@ libc_hidden_proto (__sigpause)...@@ -12,7 +14,10 @@ libc_hidden_proto (__sigpause)
12libc_hidden_proto (raise)14libc_hidden_proto (raise)
13libc_hidden_proto (__libc_current_sigrtmin)15libc_hidden_proto (__libc_current_sigrtmin)
14libc_hidden_proto (__libc_current_sigrtmax)16libc_hidden_proto (__libc_current_sigrtmax)
15libc_hidden_proto (_sys_siglist)17extern const char * const __sys_siglist[_NSIG];
18libc_hidden_proto (__sys_siglist)
19extern const char * const __sys_sigabbrev[_NSIG];
20libc_hidden_proto (__sys_sigabbrev)
1621
17/* Now define the internal interfaces. */22/* Now define the internal interfaces. */
18extern __sighandler_t __bsd_signal (int __sig, __sighandler_t __handler);23extern __sighandler_t __bsd_signal (int __sig, __sighandler_t __handler);
...@@ -33,6 +38,14 @@ extern int __sigwait (const sigset_t *__set, int *__sig);...@@ -33,6 +38,14 @@ extern int __sigwait (const sigset_t *__set, int *__sig);
33libc_hidden_proto (__sigwait)38libc_hidden_proto (__sigwait)
34extern int __sigwaitinfo (const sigset_t *__set, siginfo_t *__info);39extern int __sigwaitinfo (const sigset_t *__set, siginfo_t *__info);
35libc_hidden_proto (__sigwaitinfo)40libc_hidden_proto (__sigwaitinfo)
41#if __TIMESIZE == 64
42# define __sigtimedwait64 __sigtimedwait
43#else
44# include <struct___timespec64.h>
45extern int __sigtimedwait64 (const sigset_t *__set, siginfo_t *__info,
46 const struct __timespec64 *__timeout);
47libc_hidden_proto (__sigtimedwait64)
48#endif
36extern int __sigtimedwait (const sigset_t *__set, siginfo_t *__info,49extern int __sigtimedwait (const sigset_t *__set, siginfo_t *__info,
37 const struct timespec *__timeout);50 const struct timespec *__timeout);
38libc_hidden_proto (__sigtimedwait)51libc_hidden_proto (__sigtimedwait)
...@@ -54,7 +67,7 @@ extern int __xpg_sigpause (int sig);...@@ -54,7 +67,7 @@ extern int __xpg_sigpause (int sig);
54/* Allocate real-time signal with highest/lowest available priority. */67/* Allocate real-time signal with highest/lowest available priority. */
55extern int __libc_allocate_rtsig (int __high);68extern int __libc_allocate_rtsig (int __high);
5669
57# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN70# if IS_IN (rtld)
58extern __typeof (__sigaction) __sigaction attribute_hidden;71extern __typeof (__sigaction) __sigaction attribute_hidden;
59extern __typeof (__libc_sigaction) __libc_sigaction attribute_hidden;72extern __typeof (__libc_sigaction) __libc_sigaction attribute_hidden;
60# endif73# endif
lib/libc/glibc/include/stap-probe.h+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Macros for defining Systemtap <sys/sdt.h> static probe points.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,4 +1,4 @@
1/* Copyright (C) 1991-2020 Free Software Foundation, Inc.1/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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,12 +3,23 @@
3#ifndef _ISOMAC3#ifndef _ISOMAC
4# include <stddef.h>4# include <stddef.h>
5#endif5#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#include <stdlib/stdlib.h>15#include <stdlib/stdlib.h>
716
8/* Now define the internal interfaces. */17/* Now define the internal interfaces. */
9#if !defined _ISOMAC18#if !defined _ISOMAC
10# include <sys/stat.h>19# include <sys/stat.h>
1120
21# include <rtld-malloc.h>
22
12extern __typeof (strtol_l) __strtol_l;23extern __typeof (strtol_l) __strtol_l;
13extern __typeof (strtoul_l) __strtoul_l;24extern __typeof (strtoul_l) __strtoul_l;
14extern __typeof (strtoll_l) __strtoll_l;25extern __typeof (strtoll_l) __strtoll_l;
...@@ -80,6 +91,7 @@ extern int __setenv (const char *__name, const char *__value, int __replace)...@@ -80,6 +91,7 @@ extern int __setenv (const char *__name, const char *__value, int __replace)
80extern int __unsetenv (const char *__name) attribute_hidden;91extern int __unsetenv (const char *__name) attribute_hidden;
81extern int __clearenv (void) attribute_hidden;92extern int __clearenv (void) attribute_hidden;
82extern char *__mktemp (char *__template) __THROW __nonnull ((1));93extern char *__mktemp (char *__template) __THROW __nonnull ((1));
94libc_hidden_proto (__mktemp)
83extern char *__canonicalize_file_name (const char *__name);95extern char *__canonicalize_file_name (const char *__name);
84extern char *__realpath (const char *__name, char *__resolved);96extern char *__realpath (const char *__name, char *__resolved);
85libc_hidden_proto (__realpath)97libc_hidden_proto (__realpath)
...@@ -125,6 +137,12 @@ libc_hidden_proto (__libc_reallocarray)...@@ -125,6 +137,12 @@ libc_hidden_proto (__libc_reallocarray)
125137
126extern int __libc_system (const char *line);138extern int __libc_system (const char *line);
127139
140extern __typeof (getpt) __getpt;
141extern __typeof (ptsname_r) __ptsname_r;
142libc_hidden_proto (__getpt)
143libc_hidden_proto (__ptsname_r)
144libc_hidden_proto (grantpt)
145libc_hidden_proto (unlockpt)
128146
129extern double __strtod_internal (const char *__restrict __nptr,147extern double __strtod_internal (const char *__restrict __nptr,
130 char **__restrict __endptr, int __group)148 char **__restrict __endptr, int __group)
...@@ -205,7 +223,7 @@ libc_hidden_proto (____strtoull_l_internal)...@@ -205,7 +223,7 @@ libc_hidden_proto (____strtoull_l_internal)
205#include <bits/floatn.h>223#include <bits/floatn.h>
206libc_hidden_proto (strtof)224libc_hidden_proto (strtof)
207libc_hidden_proto (strtod)225libc_hidden_proto (strtod)
208#if __LONG_DOUBLE_USES_FLOAT128 == 0226#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
209libc_hidden_proto (strtold)227libc_hidden_proto (strtold)
210#endif228#endif
211libc_hidden_proto (strtol)229libc_hidden_proto (strtol)
...@@ -288,9 +306,6 @@ libc_hidden_proto (__qfcvt_r)...@@ -288,9 +306,6 @@ libc_hidden_proto (__qfcvt_r)
288# define MB_CUR_MAX (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MB_CUR_MAX))306# define MB_CUR_MAX (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MB_CUR_MAX))
289# endif307# endif
290308
291extern void *__default_morecore (ptrdiff_t) __THROW;
292libc_hidden_proto (__default_morecore)
293
294struct abort_msg_s309struct abort_msg_s
295{310{
296 unsigned int size;311 unsigned int size;
...@@ -299,7 +314,7 @@ struct abort_msg_s...@@ -299,7 +314,7 @@ struct abort_msg_s
299extern struct abort_msg_s *__abort_msg;314extern struct abort_msg_s *__abort_msg;
300libc_hidden_proto (__abort_msg)315libc_hidden_proto (__abort_msg)
301316
302# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN317# if IS_IN (rtld)
303extern __typeof (unsetenv) unsetenv attribute_hidden;318extern __typeof (unsetenv) unsetenv attribute_hidden;
304extern __typeof (__strtoul_internal) __strtoul_internal attribute_hidden;319extern __typeof (__strtoul_internal) __strtoul_internal attribute_hidden;
305# endif320# 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. */
15struct __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). */
11struct __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,6 +13,26 @@ extern void __chk_fail (void) __attribute__ ((__noreturn__));
13libc_hidden_proto (__chk_fail)13libc_hidden_proto (__chk_fail)
14rtld_hidden_proto (__chk_fail)14rtld_hidden_proto (__chk_fail)
1515
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#endif34#endif
1735
36#endif /* !defined _ISOMAC */
37
18#endif38#endif
lib/libc/glibc/include/sys/select.h+29
...@@ -3,6 +3,35 @@...@@ -3,6 +3,35 @@
33
4#ifndef _ISOMAC4#ifndef _ISOMAC
5/* Now define the internal interfaces. */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
13extern int __pselect64 (int __nfds, fd_set *__readfds,
14 fd_set *__writefds, fd_set *__exceptfds,
15 const struct __timespec64 *__timeout,
16 const __sigset_t *__sigmask);
17libc_hidden_proto (__pselect64)
18
19extern 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;
24extern 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
30extern int __select64 (int __nfds, fd_set *__readfds,
31 fd_set *__writefds, fd_set *__exceptfds,
32 struct __timeval64 *__timeout);
33libc_hidden_proto (__select64)
34#endif
6extern int __pselect (int __nfds, fd_set *__readfds,35extern int __pselect (int __nfds, fd_set *__readfds,
7 fd_set *__writefds, fd_set *__exceptfds,36 fd_set *__writefds, fd_set *__exceptfds,
8 const struct timespec *__timeout,37 const struct timespec *__timeout,
lib/libc/glibc/include/sys/stat.h+77-43
...@@ -2,63 +2,97 @@...@@ -2,63 +2,97 @@
2#include <io/sys/stat.h>2#include <io/sys/stat.h>
33
4#ifndef _ISOMAC4#ifndef _ISOMAC
5# include <xstatver.h>
6# include <struct___timespec64.h>
7# include <struct_stat_time64.h>
8# include <stdbool.h>
9
10static inline bool
11in_ino_t_range (__ino64_t v)
12{
13 __ino_t s = v;
14 return s == v;
15}
16
17static inline bool
18in_off_t_range (__off64_t v)
19{
20 __off_t s = v;
21 return s == v;
22}
23
24static inline bool
25in_blkcnt_t_range (__blkcnt64_t v)
26{
27 __blkcnt_t s = v;
28 return s == v;
29}
30
5/* Now define the internal interfaces. */31/* Now define the internal interfaces. */
6extern int __stat (const char *__file, struct stat *__buf);32extern int __stat (const char *__file, struct stat *__buf);
33extern int __stat64 (const char *__file, struct stat64 *__buf);
7extern int __fstat (int __fd, struct stat *__buf);34extern int __fstat (int __fd, struct stat *__buf);
35extern int __fstat64 (int __fd, struct stat64 *__buf);
8extern int __lstat (const char *__file, struct stat *__buf);36extern int __lstat (const char *__file, struct stat *__buf);
37extern int __lstat64 (const char *__file, struct stat64 *__buf);
38extern int __fstatat (int dirfd, const char *pathname, struct stat *buf,
39 int flags);
40extern 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)
43hidden_proto (__stat64)
44hidden_proto (__fstat64)
45hidden_proto (__lstat64)
46hidden_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
55extern int __stat64_time64 (const char *file, struct __stat64_t64 *buf);
56hidden_proto (__stat64_time64);
57extern int __lstat64_time64 (const char *file, struct __stat64_t64 *buf);
58hidden_proto (__lstat64_time64);
59extern int __fstat64_time64 (int fd, struct __stat64_t64 *buf);
60hidden_proto (__fstat64_time64);
61extern int __fstatat64_time64 (int dirfd, const char *pathname,
62 struct __stat64_t64 *buf, int flags);
63hidden_proto (__fstatat64_time64);
64# endif
65
9extern int __chmod (const char *__file, __mode_t __mode);66extern int __chmod (const char *__file, __mode_t __mode);
10libc_hidden_proto (__chmod)67libc_hidden_proto (__chmod)
11extern int __fchmod (int __fd, __mode_t __mode);68extern int __fchmod (int __fd, __mode_t __mode);
69libc_hidden_proto (fchmodat)
12extern __mode_t __umask (__mode_t __mask);70extern __mode_t __umask (__mode_t __mask);
13extern int __mkdir (const char *__path, __mode_t __mode);71extern int __mkdir (const char *__path, __mode_t __mode);
14libc_hidden_proto (__mkdir)72libc_hidden_proto (__mkdir)
73
74extern int __mknodat (int fd, const char *path, mode_t mode, dev_t dev);
75libc_hidden_proto (__mknodat);
15extern int __mknod (const char *__path,76extern int __mknod (const char *__path,
16 __mode_t __mode, __dev_t __dev);77 __mode_t __mode, __dev_t __dev);
17#if IS_IN (libc) || (IS_IN (rtld) && !defined NO_RTLD_HIDDEN)78libc_hidden_proto (__mknod);
18hidden_proto (__fxstat)
19hidden_proto (__fxstat64)
20hidden_proto (__lxstat)
21hidden_proto (__lxstat64)
22hidden_proto (__xstat)
23hidden_proto (__xstat64)
24#endif
25extern __inline__ int __stat (const char *__path, struct stat *__statbuf)
26{
27 return __xstat (_STAT_VER, __path, __statbuf);
28}
29libc_hidden_proto (__xmknod)
30extern __inline__ int __mknod (const char *__path, __mode_t __mode,
31 __dev_t __dev)
32{
33 return __xmknod (_MKNOD_VER, __path, __mode, &__dev);
34}
35libc_hidden_proto (__xmknodat)
3679
37libc_hidden_proto (__fxstatat)80extern int __xmknod (int __ver, const char *__path, __mode_t __mode,
38libc_hidden_proto (__fxstatat64)81 __dev_t *__dev);
82extern int __xmknodat (int __ver, int __fd, const char *__path,
83 __mode_t __mode, __dev_t *__dev);
3984
40# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN85int __fxstat (int __ver, int __fildes, struct stat *__stat_buf);
41extern __typeof (__fxstatat64) __fxstatat64 attribute_hidden;86int __xstat (int __ver, const char *__filename,
42# endif87 struct stat *__stat_buf);
88int __lxstat (int __ver, const char *__filename, struct stat *__stat_buf);
89int __fxstatat (int __ver, int __fildes, const char *__filename,
90 struct stat *__stat_buf, int __flag);
91int __fxstat64 (int ver, int __fildes, struct stat64 *__stat_buf);
92int __xstat64 (int ver, const char *__filename, struct stat64 *__stat_buf);
93int __lxstat64 (int ver, const char *__filename, struct stat64 *__stat_buf);
94int __fxstatat64 (int ver, int __fildes, const char *__filename,
95 struct stat64 *__stat_buf, int __flag);
4396
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#endif97#endif
64#endif98#endif
lib/libc/glibc/io/bits/statx.h+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* statx-related definitions and declarations. Generic version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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
50typedef __mode_t mode_t;
51# define __mode_t_defined
52#endif
53
54#ifndef __off_t_defined
55# ifndef __USE_FILE_OFFSET64
56typedef __off_t off_t;
57# else
58typedef __off64_t off_t;
59# endif
60# define __off_t_defined
61#endif
62
63#if defined __USE_LARGEFILE64 && !defined __off64_t_defined
64typedef __off64_t off64_t;
65# define __off64_t_defined
66#endif
67
68#ifndef __pid_t_defined
69typedef __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
177extern int fcntl (int __fd, int __cmd, ...);
178# else
179# ifdef __REDIRECT
180extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64);
181# else
182# define fcntl fcntl64
183# endif
184# endif
185# ifdef __USE_LARGEFILE64
186extern int fcntl64 (int __fd, int __cmd, ...);
187# endif
188#else /* __USE_TIME_BITS64 */
189# ifdef __REDIRECT
190extern int __REDIRECT (fcntl, (int __fd, int __request, ...),
191 __fcntl_time64) __THROW;
192extern int __REDIRECT (fcntl64, (int __fd, int __request, ...),
193 __fcntl_time64) __THROW;
194# else
195extern 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
209extern int open (const char *__file, int __oflag, ...) __nonnull ((1));
210#else
211# ifdef __REDIRECT
212extern 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
219extern 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
233extern int openat (int __fd, const char *__file, int __oflag, ...)
234 __nonnull ((2));
235# else
236# ifdef __REDIRECT
237extern 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
244extern 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
255extern int creat (const char *__file, mode_t __mode) __nonnull ((1));
256#else
257# ifdef __REDIRECT
258extern 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
265extern 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
284extern int lockf (int __fd, int __cmd, off_t __len);
285# else
286# ifdef __REDIRECT
287extern 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
293extern 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
301extern int posix_fadvise (int __fd, off_t __offset, off_t __len,
302 int __advise) __THROW;
303# else
304 # ifdef __REDIRECT_NTH
305extern 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
313extern 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
323extern int posix_fallocate (int __fd, off_t __offset, off_t __len);
324# else
325 # ifdef __REDIRECT
326extern 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
334extern 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,4 +1,4 @@
1/* Copyright (C) 1996-2020 Free Software Foundation, Inc.1/* Copyright (C) 1996-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -6,23 +6,6 @@...@@ -6,23 +6,6 @@
6 License as published by the Free Software Foundation; either6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.7 version 2.1 of the License, or (at your option) any later version.
88
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 The GNU C Library is distributed in the hope that it will be useful,9 The GNU C Library is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of10 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
...@@ -33,23 +16,18 @@...@@ -33,23 +16,18 @@
33 <https://www.gnu.org/licenses/>. */16 <https://www.gnu.org/licenses/>. */
3417
35#include <sys/stat.h>18#include <sys/stat.h>
19#include <errno.h>
20#include <fcntl.h>
3621
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
48int22int
49attribute_hidden
50__fstat (int fd, struct stat *buf)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}
5432
55weak_hidden_alias (__fstat, fstat)33weak_alias (__fstat, fstat)
lib/libc/glibc/io/fstat64.c+12-31
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 1996-2020 Free Software Foundation, Inc.1/* Copyright (C) 1996-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -6,23 +6,6 @@...@@ -6,23 +6,6 @@
6 License as published by the Free Software Foundation; either6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.7 version 2.1 of the License, or (at your option) any later version.
88
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 The GNU C Library is distributed in the hope that it will be useful,9 The GNU C Library is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of10 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
...@@ -33,20 +16,18 @@...@@ -33,20 +16,18 @@
33 <https://www.gnu.org/licenses/>. */16 <https://www.gnu.org/licenses/>. */
3417
35#include <sys/stat.h>18#include <sys/stat.h>
19#include <errno.h>
20#include <fcntl.h>
3621
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
47int22int
48attribute_hidden23__fstat64 (int fd, struct stat64 *buf)
49fstat64 (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}
32hidden_def (__fstat64)
33weak_alias (__fstat64, fstat64)
lib/libc/glibc/io/fstatat.c+21-31
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 2005-2020 Free Software Foundation, Inc.1/* Copyright (C) 2005-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -6,23 +6,6 @@...@@ -6,23 +6,6 @@
6 License as published by the Free Software Foundation; either6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.7 version 2.1 of the License, or (at your option) any later version.
88
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 The GNU C Library is distributed in the hope that it will be useful,9 The GNU C Library is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of10 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
...@@ -33,20 +16,27 @@...@@ -33,20 +16,27 @@
33 <https://www.gnu.org/licenses/>. */16 <https://www.gnu.org/licenses/>. */
3417
35#include <sys/stat.h>18#include <sys/stat.h>
19#include <errno.h>
20#include <fcntl.h>
3621
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
47int22int
48attribute_hidden23__fstatat (int fd, const char *file, struct stat *buf, int flag)
49fstatat (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
40weak_alias (__fstatat, fstatat)
41
42stub_warning (fstatat)
lib/libc/glibc/io/fstatat64.c+21-31
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 2005-2020 Free Software Foundation, Inc.1/* Copyright (C) 2005-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -6,23 +6,6 @@...@@ -6,23 +6,6 @@
6 License as published by the Free Software Foundation; either6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.7 version 2.1 of the License, or (at your option) any later version.
88
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 The GNU C Library is distributed in the hope that it will be useful,9 The GNU C Library is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of10 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
...@@ -33,20 +16,27 @@...@@ -33,20 +16,27 @@
33 <https://www.gnu.org/licenses/>. */16 <https://www.gnu.org/licenses/>. */
3417
35#include <sys/stat.h>18#include <sys/stat.h>
19#include <errno.h>
20#include <fcntl.h>
3621
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
47int22int
48attribute_hidden23__fstatat64 (int fd, const char *file, struct stat64 *buf, int flag)
49fstatat64 (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}
39hidden_def (__fstatat64)
40weak_alias (__fstatat64, fstatat64)
41
42stub_warning (fstatat64)
lib/libc/glibc/io/lstat.c+4-32
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 1996-2020 Free Software Foundation, Inc.1/* Copyright (C) 1996-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -6,23 +6,6 @@...@@ -6,23 +6,6 @@
6 License as published by the Free Software Foundation; either6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.7 version 2.1 of the License, or (at your option) any later version.
88
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 The GNU C Library is distributed in the hope that it will be useful,9 The GNU C Library is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of10 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
...@@ -33,23 +16,12 @@...@@ -33,23 +16,12 @@
33 <https://www.gnu.org/licenses/>. */16 <https://www.gnu.org/licenses/>. */
3417
35#include <sys/stat.h>18#include <sys/stat.h>
19#include <fcntl.h>
3620
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
48int21int
49attribute_hidden
50__lstat (const char *file, struct stat *buf)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}
5426
55weak_hidden_alias (__lstat, lstat)27weak_alias (__lstat, lstat)
lib/libc/glibc/io/lstat64.c+6-31
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 1996-2020 Free Software Foundation, Inc.1/* Copyright (C) 1996-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -6,23 +6,6 @@...@@ -6,23 +6,6 @@
6 License as published by the Free Software Foundation; either6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.7 version 2.1 of the License, or (at your option) any later version.
88
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 The GNU C Library is distributed in the hope that it will be useful,9 The GNU C Library is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of10 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
...@@ -33,20 +16,12 @@...@@ -33,20 +16,12 @@
33 <https://www.gnu.org/licenses/>. */16 <https://www.gnu.org/licenses/>. */
3417
35#include <sys/stat.h>18#include <sys/stat.h>
19#include <fcntl.h>
3620
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
47int21int
48attribute_hidden22__lstat64 (const char *file, struct stat64 *buf)
49lstat64 (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}
26hidden_def (__lstat64)
27weak_alias (__lstat64, lstat64)
lib/libc/glibc/io/mknod.c+5-33
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 1995-2020 Free Software Foundation, Inc.1/* Copyright (C) 1995-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -6,23 +6,6 @@...@@ -6,23 +6,6 @@
6 License as published by the Free Software Foundation; either6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.7 version 2.1 of the License, or (at your option) any later version.
88
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 The GNU C Library is distributed in the hope that it will be useful,9 The GNU C Library is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of10 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
...@@ -32,24 +15,13 @@...@@ -32,24 +15,13 @@
32 License along with the GNU C Library; if not, see15 License along with the GNU C Library; if not, see
33 <https://www.gnu.org/licenses/>. */16 <https://www.gnu.org/licenses/>. */
3417
35
36#include <sys/types.h>
37#include <sys/stat.h>18#include <sys/stat.h>
3819#include <fcntl.h>
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. */
4720
48int21int
49attribute_hidden
50__mknod (const char *path, mode_t mode, dev_t dev)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}
5426libc_hidden_def (__mknod)
55weak_hidden_alias (__mknod, mknod)27weak_alias (__mknod, mknod)
lib/libc/glibc/io/mknodat.c+9-31
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 1995-2020 Free Software Foundation, Inc.1/* Copyright (C) 1995-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -6,23 +6,6 @@...@@ -6,23 +6,6 @@
6 License as published by the Free Software Foundation; either6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.7 version 2.1 of the License, or (at your option) any later version.
88
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 The GNU C Library is distributed in the hope that it will be useful,9 The GNU C Library is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of10 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
...@@ -32,22 +15,17 @@...@@ -32,22 +15,17 @@
32 License along with the GNU C Library; if not, see15 License along with the GNU C Library; if not, see
33 <https://www.gnu.org/licenses/>. */16 <https://www.gnu.org/licenses/>. */
3417
35
36#include <sys/types.h>18#include <sys/types.h>
37#include <sys/stat.h>19#include <sys/stat.h>
3820#include <errno.h>
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. */
4721
48int22int
49attribute_hidden23__mknodat (int fd, const char *path, mode_t mode, dev_t dev)
50mknodat (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}
28libc_hidden_def (__mknodat)
29weak_alias (__mknodat, mknodat)
30
31stub_warning (mknodat)
lib/libc/glibc/io/stat.c+4-31
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 1996-2020 Free Software Foundation, Inc.1/* Copyright (C) 1996-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -6,23 +6,6 @@...@@ -6,23 +6,6 @@
6 License as published by the Free Software Foundation; either6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.7 version 2.1 of the License, or (at your option) any later version.
88
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 The GNU C Library is distributed in the hope that it will be useful,9 The GNU C Library is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of10 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
...@@ -33,22 +16,12 @@...@@ -33,22 +16,12 @@
33 <https://www.gnu.org/licenses/>. */16 <https://www.gnu.org/licenses/>. */
3417
35#include <sys/stat.h>18#include <sys/stat.h>
19#include <fcntl.h>
3620
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
47int21int
48attribute_hidden
49__stat (const char *file, struct stat *buf)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}
5326
54weak_hidden_alias (__stat, stat)27weak_alias (__stat, stat)
lib/libc/glibc/io/stat64.c+6-31
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 1996-2020 Free Software Foundation, Inc.1/* Copyright (C) 1996-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -6,23 +6,6 @@...@@ -6,23 +6,6 @@
6 License as published by the Free Software Foundation; either6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.7 version 2.1 of the License, or (at your option) any later version.
88
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 The GNU C Library is distributed in the hope that it will be useful,9 The GNU C Library is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of10 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
...@@ -33,20 +16,12 @@...@@ -33,20 +16,12 @@
33 <https://www.gnu.org/licenses/>. */16 <https://www.gnu.org/licenses/>. */
3417
35#include <sys/stat.h>18#include <sys/stat.h>
19#include <fcntl.h>
3620
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
47int21int
48attribute_hidden22__stat64 (const char *file, struct stat64 *buf)
49stat64 (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}
26hidden_def (__stat64)
27weak_alias (__stat64, stat64)
lib/libc/glibc/io/sys/stat.h+101-167
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 1991-2020 Free Software Foundation, Inc.1/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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,21 +209,51 @@ extern int stat (const char *__restrict __file,
209 that file descriptor FD is open on and put them in BUF. */209 that file descriptor FD is open on and put them in BUF. */
210extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2));210extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2));
211#else211#else
212# ifdef __REDIRECT_NTH212# ifdef __USE_TIME_BITS64
213# ifdef __REDIRECT_NTH
214extern int __REDIRECT_NTH (stat, (const char *__restrict __file,
215 struct stat *__restrict __buf),
216 __stat64_time64)
217 __nonnull ((1, 2));
218extern 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
213extern int __REDIRECT_NTH (stat, (const char *__restrict __file,227extern int __REDIRECT_NTH (stat, (const char *__restrict __file,
214 struct stat *__restrict __buf), stat64)228 struct stat *__restrict __buf), stat64)
215 __nonnull ((1, 2));229 __nonnull ((1, 2));
216extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64)230extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64)
217 __nonnull ((2));231 __nonnull ((2));
218# else232# else
219# define stat stat64233# define stat stat64
220# define fstat fstat64234# define fstat fstat64
235# endif
221# endif236# endif
222#endif237#endif
223#ifdef __USE_LARGEFILE64238#ifdef __USE_LARGEFILE64
239# ifndef __USE_TIME_BITS64
224extern int stat64 (const char *__restrict __file,240extern int stat64 (const char *__restrict __file,
225 struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2));241 struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2));
226extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2));242extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2));
243# else
244# ifdef __REDIRECT_NTH
245extern int __REDIRECT_NTH (stat64, (const char *__restrict __file,
246 struct stat64 *__restrict __buf),
247 __stat64_time64)
248 __nonnull ((1, 2));
249extern 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#endif257#endif
228258
229#ifdef __USE_ATFILE259#ifdef __USE_ATFILE
...@@ -235,20 +265,44 @@ extern int fstatat (int __fd, const char *__restrict __file,...@@ -235,20 +265,44 @@ extern int fstatat (int __fd, const char *__restrict __file,
235 struct stat *__restrict __buf, int __flag)265 struct stat *__restrict __buf, int __flag)
236 __THROW __nonnull ((2, 3));266 __THROW __nonnull ((2, 3));
237# else267# else
238# ifdef __REDIRECT_NTH268# ifdef __USE_TIME_BITS64
269# ifdef __REDIRECT_NTH
239extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,270extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
240 struct stat *__restrict __buf,271 struct stat *__restrict __buf,
241 int __flag),272 int __flag),
242 fstatat64) __nonnull ((2, 3));273 __fstatat64_time64) __nonnull ((2, 3));
274# else
275# define fstatat __fstatat64_time64
276# endif
243# else277# else
244# define fstatat fstatat64278# ifdef __REDIRECT_NTH
279extern 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# endif286# endif
246# endif287# endif
247288
248# ifdef __USE_LARGEFILE64289# ifdef __USE_LARGEFILE64
290# ifndef __USE_TIME_BITS64
249extern int fstatat64 (int __fd, const char *__restrict __file,291extern int fstatat64 (int __fd, const char *__restrict __file,
250 struct stat64 *__restrict __buf, int __flag)292 struct stat64 *__restrict __buf, int __flag)
251 __THROW __nonnull ((2, 3));293 __THROW __nonnull ((2, 3));
294# else
295# ifdef __REDIRECT_NTH
296extern 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# endif306# endif
253#endif307#endif
254308
...@@ -259,19 +313,37 @@ extern int fstatat64 (int __fd, const char *__restrict __file,...@@ -259,19 +313,37 @@ extern int fstatat64 (int __fd, const char *__restrict __file,
259extern int lstat (const char *__restrict __file,313extern int lstat (const char *__restrict __file,
260 struct stat *__restrict __buf) __THROW __nonnull ((1, 2));314 struct stat *__restrict __buf) __THROW __nonnull ((1, 2));
261# else315# else
262# ifdef __REDIRECT_NTH316# ifdef __USE_TIME_BITS64
317# ifdef __REDIRECT_NTH
263extern int __REDIRECT_NTH (lstat,318extern int __REDIRECT_NTH (lstat,
264 (const char *__restrict __file,319 (const char *__restrict __file,
265 struct stat *__restrict __buf), lstat64)320 struct stat *__restrict __buf), __lstat64_time64)
266 __nonnull ((1, 2));321 __nonnull ((1, 2));
322# else
323# define lstat __lstat64_time64
324# endif
267# else325# else
268# define lstat lstat64326# ifdef __REDIRECT_NTH
327extern 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# endif334# endif
270# endif335# endif
271# ifdef __USE_LARGEFILE64336# ifdef __USE_LARGEFILE64
337# ifndef __USE_TIME_BITS64
272extern int lstat64 (const char *__restrict __file,338extern int lstat64 (const char *__restrict __file,
273 struct stat64 *__restrict __buf)339 struct stat64 *__restrict __buf)
274 __THROW __nonnull ((1, 2));340 __THROW __nonnull ((1, 2));
341# else
342extern int __REDIRECT_NTH (lstat64, (const char *__restrict __file,
343 struct stat64 *__restrict __buf),
344 __lstat64_time64)
345 __nonnull ((1, 2));
346# endif
275# endif347# endif
276#endif348#endif
277349
...@@ -355,182 +427,44 @@ extern int mkfifoat (int __fd, const char *__path, __mode_t __mode)...@@ -355,182 +427,44 @@ extern int mkfifoat (int __fd, const char *__path, __mode_t __mode)
355#endif427#endif
356 428
357#ifdef __USE_ATFILE429#ifdef __USE_ATFILE
430# ifndef __USE_TIME_BITS64
358/* Set file access and modification times relative to directory file431/* Set file access and modification times relative to directory file
359 descriptor. */432 descriptor. */
360extern int utimensat (int __fd, const char *__path,433extern int utimensat (int __fd, const char *__path,
361 const struct timespec __times[2],434 const struct timespec __times[2],
362 int __flags)435 int __flags)
363 __THROW __nonnull ((2));436 __THROW __nonnull ((2));
437# else
438# ifdef __REDIRECT_NTH
439extern 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#endif447#endif
365448
366#ifdef __USE_XOPEN2K8449#ifdef __USE_XOPEN2K8
450# ifndef __USE_TIME_BITS64
367/* Set file access and modification times of the file associated with FD. */451/* Set file access and modification times of the file associated with FD. */
368extern int futimens (int __fd, const struct timespec __times[2]) __THROW;452extern 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
395extern int __fxstat (int __ver, int __fildes, struct stat *__stat_buf)
396 __THROW __nonnull ((3));
397extern int __xstat (int __ver, const char *__filename,
398 struct stat *__stat_buf) __THROW __nonnull ((2, 3));
399extern int __lxstat (int __ver, const char *__filename,
400 struct stat *__stat_buf) __THROW __nonnull ((2, 3));
401extern 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
406extern int __REDIRECT_NTH (__fxstat, (int __ver, int __fildes,
407 struct stat *__stat_buf), __fxstat64)
408 __nonnull ((3));
409extern int __REDIRECT_NTH (__xstat, (int __ver, const char *__filename,
410 struct stat *__stat_buf), __xstat64)
411 __nonnull ((2, 3));
412extern int __REDIRECT_NTH (__lxstat, (int __ver, const char *__filename,
413 struct stat *__stat_buf), __lxstat64)
414 __nonnull ((2, 3));
415extern int __REDIRECT_NTH (__fxstatat, (int __ver, int __fildes,
416 const char *__filename,
417 struct stat *__stat_buf, int __flag),
418 __fxstatat64) __nonnull ((3, 4));
419453
420# else454# else
421# define __fxstat __fxstat64455# ifdef __REDIRECT_NTH
422# define __xstat __xstat64456extern int __REDIRECT_NTH (futimens, (int fd, const struct timespec __times[2]),
423# define __lxstat __lxstat64457 __futimens64);
458# else
459# define futimens __futimens64
460# endif
424# endif461# endif
425#endif462#endif
426463
427#ifdef __USE_LARGEFILE64
428extern int __fxstat64 (int __ver, int __fildes, struct stat64 *__stat_buf)
429 __THROW __nonnull ((3));
430extern int __xstat64 (int __ver, const char *__filename,
431 struct stat64 *__stat_buf) __THROW __nonnull ((2, 3));
432extern int __lxstat64 (int __ver, const char *__filename,
433 struct stat64 *__stat_buf) __THROW __nonnull ((2, 3));
434extern int __fxstatat64 (int __ver, int __fildes, const char *__filename,
435 struct stat64 *__stat_buf, int __flag)
436 __THROW __nonnull ((3, 4));
437#endif
438extern int __xmknod (int __ver, const char *__path, __mode_t __mode,
439 __dev_t *__dev) __THROW __nonnull ((2, 4));
440
441extern int __xmknodat (int __ver, int __fd, const char *__path,
442 __mode_t __mode, __dev_t *__dev)
443 __THROW __nonnull ((3, 5));
444
445#ifdef __USE_GNU464#ifdef __USE_GNU
446# include <bits/statx.h>465# include <bits/statx.h>
447#endif466#endif
448467
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__END_DECLS468__END_DECLS
535469
536470
lib/libc/glibc/locale/bits/types/__locale_t.h+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Definition of struct __locale_struct and __locale_t.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
4 Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.4 Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
55
lib/libc/glibc/locale/bits/types/locale_t.h+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Definition of locale_t.1/* Definition of locale_t.
2 Copyright (C) 2017-2020 Free Software Foundation, Inc.2 Copyright (C) 2017-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,4 +1,4 @@
1/* Copyright (C) 1992-2020 Free Software Foundation, Inc.1/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -25,7 +25,7 @@...@@ -25,7 +25,7 @@
2525
26/* The GNU libc does not support any K&R compilers or the traditional mode26/* The GNU libc does not support any K&R compilers or the traditional mode
27 of ISO C compilers anymore. Check for some of the combinations not27 of ISO C compilers anymore. Check for some of the combinations not
28 anymore supported. */28 supported anymore. */
29#if defined __GNUC__ && !defined __STDC__29#if defined __GNUC__ && !defined __STDC__
30# error "You need a ISO C conforming compiler to use the glibc headers"30# error "You need a ISO C conforming compiler to use the glibc headers"
31#endif31#endif
...@@ -34,7 +34,29 @@...@@ -34,7 +34,29 @@
34#undef __P34#undef __P
35#undef __PMT35#undef __PMT
3636
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__
3860
39/* All functions, except those with callbacks or those that61/* All functions, except those with callbacks or those that
40 synchronize memory, are leaf functions. */62 synchronize memory, are leaf functions. */
...@@ -47,21 +69,26 @@...@@ -47,21 +69,26 @@
47# endif69# endif
4870
49/* GCC can always grok prototypes. For C++ programs we add throw()71/* GCC can always grok prototypes. For C++ programs we add throw()
50 to help it optimize the function calls. But this works only with72 to help it optimize the function calls. But this only works with
51 gcc 2.8.x and egcs. For gcc 3.2 and up we even mark C functions73 gcc 2.8.x and egcs. For gcc 3.4 and up we even mark C functions
52 as non-throwing using a function attribute since programs can use74 as non-throwing using a function attribute since programs can use
53 the -fexceptions options for C code as well. */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# define __THROW __attribute__ ((__nothrow__ __LEAF))78# define __THROW __attribute__ ((__nothrow__ __LEAF))
56# define __THROWNL __attribute__ ((__nothrow__))79# define __THROWNL __attribute__ ((__nothrow__))
57# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct80# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct
58# define __NTHNL(fct) __attribute__ ((__nothrow__)) fct81# define __NTHNL(fct) __attribute__ ((__nothrow__)) fct
59# else82# else
60# if defined __cplusplus && __GNUC_PREREQ (2,8)83# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major >= 4)
61# define __THROW throw ()84# if __cplusplus >= 201103L
62# define __THROWNL throw ()85# define __THROW noexcept (true)
63# define __NTH(fct) __LEAF_ATTR fct throw ()86# else
64# define __NTHNL(fct) fct throw ()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# else92# else
66# define __THROW93# define __THROW
67# define __THROWNL94# define __THROWNL
...@@ -70,7 +97,7 @@...@@ -70,7 +97,7 @@
70# endif97# endif
71# endif98# endif
7299
73#else /* Not GCC. */100#else /* Not GCC or clang. */
74101
75# if (defined __cplusplus \102# if (defined __cplusplus \
76 || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L))103 || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L))
...@@ -83,16 +110,7 @@...@@ -83,16 +110,7 @@
83# define __THROWNL110# define __THROWNL
84# define __NTH(fct) fct111# define __NTH(fct) fct
85112
86#endif /* GCC. */113#endif /* GCC || clang. */
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
96114
97/* These two macros are not used in glibc anymore. They are kept here115/* These two macros are not used in glibc anymore. They are kept here
98 only because some other projects expect the macros to be defined. */116 only because some other projects expect the macros to be defined. */
...@@ -123,14 +141,20 @@...@@ -123,14 +141,20 @@
123#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)141#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
124#define __bos0(ptr) __builtin_object_size (ptr, 0)142#define __bos0(ptr) __builtin_object_size (ptr, 0)
125143
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#if __GNUC_PREREQ (4,3)153#if __GNUC_PREREQ (4,3)
127# define __warndecl(name, msg) \
128 extern void name (void) __attribute__((__warning__ (msg)))
129# define __warnattr(msg) __attribute__((__warning__ (msg)))154# define __warnattr(msg) __attribute__((__warning__ (msg)))
130# define __errordecl(name, msg) \155# define __errordecl(name, msg) \
131 extern void name (void) __attribute__((__error__ (msg)))156 extern void name (void) __attribute__((__error__ (msg)))
132#else157#else
133# define __warndecl(name, msg) extern void name (void)
134# define __warnattr(msg)158# define __warnattr(msg)
135# define __errordecl(name, msg) extern void name (void)159# define __errordecl(name, msg) extern void name (void)
136#endif160#endif
...@@ -139,11 +163,11 @@...@@ -139,11 +163,11 @@
139 Headers that should use flexible arrays only if they're "real"163 Headers that should use flexible arrays only if they're "real"
140 (e.g. only if they won't affect sizeof()) should test164 (e.g. only if they won't affect sizeof()) should test
141 #if __glibc_c99_flexarr_available. */165 #if __glibc_c99_flexarr_available. */
142#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L166#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L && !defined __HP_cc
143# define __flexarr []167# define __flexarr []
144# define __glibc_c99_flexarr_available 1168# define __glibc_c99_flexarr_available 1
145#elif __GNUC_PREREQ (2,97)169#elif __GNUC_PREREQ (2,97) || defined __clang__
146/* GCC 2.97 supports C99 flexible array members as an extension,170/* GCC 2.97 and clang support C99 flexible array members as an extension,
147 even when in C89 mode or compiling C++ (any version). */171 even when in C89 mode or compiling C++ (any version). */
148# define __flexarr []172# define __flexarr []
149# define __glibc_c99_flexarr_available 1173# define __glibc_c99_flexarr_available 1
...@@ -169,7 +193,7 @@...@@ -169,7 +193,7 @@
169 Example:193 Example:
170 int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */194 int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */
171195
172#if defined __GNUC__ && __GNUC__ >= 2196#if (defined __GNUC__ && __GNUC__ >= 2) || (__clang_major__ >= 4)
173197
174# define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))198# define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))
175# ifdef __cplusplus199# ifdef __cplusplus
...@@ -194,17 +218,17 @@...@@ -194,17 +218,17 @@
194*/218*/
195#endif219#endif
196220
197/* GCC has various useful declarations that can be made with the221/* GCC and clang have various useful declarations that can be made with
198 `__attribute__' syntax. All of the ways we use this do fine if222 the '__attribute__' syntax. All of the ways we use this do fine if
199 they are omitted for compilers that don't understand it. */223 they are omitted for compilers that don't understand it. */
200#if !defined __GNUC__ || __GNUC__ < 2224#if !(defined __GNUC__ || defined __clang__)
201# define __attribute__(xyz) /* Ignore */225# define __attribute__(xyz) /* Ignore */
202#endif226#endif
203227
204/* At some point during the gcc 2.96 development the `malloc' attribute228/* At some point during the gcc 2.96 development the `malloc' attribute
205 for functions was introduced. We don't want to use it unconditionally229 for functions was introduced. We don't want to use it unconditionally
206 (although this would be possible) since it generates warnings. */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# define __attribute_malloc__ __attribute__ ((__malloc__))232# define __attribute_malloc__ __attribute__ ((__malloc__))
209#else233#else
210# define __attribute_malloc__ /* Ignore */234# define __attribute_malloc__ /* Ignore */
...@@ -222,23 +246,29 @@...@@ -222,23 +246,29 @@
222/* At some point during the gcc 2.96 development the `pure' attribute246/* At some point during the gcc 2.96 development the `pure' attribute
223 for functions was introduced. We don't want to use it unconditionally247 for functions was introduced. We don't want to use it unconditionally
224 (although this would be possible) since it generates warnings. */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# define __attribute_pure__ __attribute__ ((__pure__))250# define __attribute_pure__ __attribute__ ((__pure__))
227#else251#else
228# define __attribute_pure__ /* Ignore */252# define __attribute_pure__ /* Ignore */
229#endif253#endif
230254
231/* This declaration tells the compiler that the value is constant. */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# define __attribute_const__ __attribute__ ((__const__))257# define __attribute_const__ __attribute__ ((__const__))
234#else258#else
235# define __attribute_const__ /* Ignore */259# define __attribute_const__ /* Ignore */
236#endif260#endif
237261
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/* At some point during the gcc 3.1 development the `used' attribute268/* At some point during the gcc 3.1 development the `used' attribute
239 for functions was introduced. We don't want to use it unconditionally269 for functions was introduced. We don't want to use it unconditionally
240 (although this would be possible) since it generates warnings. */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# define __attribute_used__ __attribute__ ((__used__))272# define __attribute_used__ __attribute__ ((__used__))
243# define __attribute_noinline__ __attribute__ ((__noinline__))273# define __attribute_noinline__ __attribute__ ((__noinline__))
244#else274#else
...@@ -247,7 +277,7 @@...@@ -247,7 +277,7 @@
247#endif277#endif
248278
249/* Since version 3.2, gcc allows marking deprecated functions. */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# define __attribute_deprecated__ __attribute__ ((__deprecated__))281# define __attribute_deprecated__ __attribute__ ((__deprecated__))
252#else282#else
253# define __attribute_deprecated__ /* Ignore */283# define __attribute_deprecated__ /* Ignore */
...@@ -257,7 +287,7 @@...@@ -257,7 +287,7 @@
257 when a deprecated function is used. clang claims to be gcc 4.2, but287 when a deprecated function is used. clang claims to be gcc 4.2, but
258 may also support this feature. */288 may also support this feature. */
259#if __GNUC_PREREQ (4,5) \289#if __GNUC_PREREQ (4,5) \
260 || __glibc_clang_has_extension (__attribute_deprecated_with_message__)290 || __glibc_has_extension (__attribute_deprecated_with_message__)
261# define __attribute_deprecated_msg__(msg) \291# define __attribute_deprecated_msg__(msg) \
262 __attribute__ ((__deprecated__ (msg)))292 __attribute__ ((__deprecated__ (msg)))
263#else293#else
...@@ -270,7 +300,7 @@...@@ -270,7 +300,7 @@
270 If several `format_arg' attributes are given for the same function, in300 If several `format_arg' attributes are given for the same function, in
271 gcc-3.0 and older, all but the last one are ignored. In newer gccs,301 gcc-3.0 and older, all but the last one are ignored. In newer gccs,
272 all designated arguments are considered. */302 all designated arguments are considered. */
273#if __GNUC_PREREQ (2,8)303#if __GNUC_PREREQ (2,8) || __glibc_has_attribute (__format_arg__)
274# define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x)))304# define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x)))
275#else305#else
276# define __attribute_format_arg__(x) /* Ignore */306# define __attribute_format_arg__(x) /* Ignore */
...@@ -280,27 +310,42 @@...@@ -280,27 +310,42 @@
280 attribute for functions was introduced. We don't want to use it310 attribute for functions was introduced. We don't want to use it
281 unconditionally (although this would be possible) since it311 unconditionally (although this would be possible) since it
282 generates warnings. */312 generates warnings. */
283#if __GNUC_PREREQ (2,97)313#if __GNUC_PREREQ (2,97) || __glibc_has_attribute (__format__)
284# define __attribute_format_strfmon__(a,b) \314# define __attribute_format_strfmon__(a,b) \
285 __attribute__ ((__format__ (__strfmon__, a, b)))315 __attribute__ ((__format__ (__strfmon__, a, b)))
286#else316#else
287# define __attribute_format_strfmon__(a,b) /* Ignore */317# define __attribute_format_strfmon__(a,b) /* Ignore */
288#endif318#endif
289319
290/* The nonull function attribute allows to mark pointer parameters which320/* The nonnull function attribute marks pointer parameters that
291 must not be NULL. */321 must not be NULL. */
292#if __GNUC_PREREQ (3,3)322#ifndef __nonnull
293# define __nonnull(params) __attribute__ ((__nonnull__ params))323# if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__)
294#else324# define __nonnull(params) __attribute__ ((__nonnull__ params))
295# define __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#endif341#endif
297342
298/* If fortification mode, we warn about unused results of certain343/* If fortification mode, we warn about unused results of certain
299 function calls which can lead to problems. */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# define __attribute_warn_unused_result__ \346# define __attribute_warn_unused_result__ \
302 __attribute__ ((__warn_unused_result__))347 __attribute__ ((__warn_unused_result__))
303# if __USE_FORTIFY_LEVEL > 0348# if defined __USE_FORTIFY_LEVEL && __USE_FORTIFY_LEVEL > 0
304# define __wur __attribute_warn_unused_result__349# define __wur __attribute_warn_unused_result__
305# endif350# endif
306#else351#else
...@@ -311,7 +356,7 @@...@@ -311,7 +356,7 @@
311#endif356#endif
312357
313/* Forces a function to be always inlined. */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/* The Linux kernel defines __always_inline in stddef.h (283d7573), and360/* The Linux kernel defines __always_inline in stddef.h (283d7573), and
316 it conflicts with this definition. Therefore undefine it first to361 it conflicts with this definition. Therefore undefine it first to
317 allow either header to be included first. */362 allow either header to be included first. */
...@@ -324,7 +369,7 @@...@@ -324,7 +369,7 @@
324369
325/* Associate error messages with the source location of the call site rather370/* Associate error messages with the source location of the call site rather
326 than with the source location inside the function. */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# define __attribute_artificial__ __attribute__ ((__artificial__))373# define __attribute_artificial__ __attribute__ ((__artificial__))
329#else374#else
330# define __attribute_artificial__ /* Ignore */375# define __attribute_artificial__ /* Ignore */
...@@ -367,12 +412,14 @@...@@ -367,12 +412,14 @@
367 run in pedantic mode if the uses are carefully marked using the412 run in pedantic mode if the uses are carefully marked using the
368 `__extension__' keyword. But this is not generally available before413 `__extension__' keyword. But this is not generally available before
369 version 2.8. */414 version 2.8. */
370#if !__GNUC_PREREQ (2,8)415#if !(__GNUC_PREREQ (2,8) || defined __clang__)
371# define __extension__ /* Ignore */416# define __extension__ /* Ignore */
372#endif417#endif
373418
374/* __restrict is known in EGCS 1.2 and above. */419/* __restrict is known in EGCS 1.2 and above, and in clang.
375#if !__GNUC_PREREQ (2,92)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# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L423# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
377# define __restrict restrict424# define __restrict restrict
378# else425# else
...@@ -382,8 +429,9 @@...@@ -382,8 +429,9 @@
382429
383/* ISO C99 also allows to declare arrays as non-overlapping. The syntax is430/* ISO C99 also allows to declare arrays as non-overlapping. The syntax is
384 array_name[restrict]431 array_name[restrict]
385 GCC 3.1 supports this. */432 GCC 3.1 and clang support this.
386#if __GNUC_PREREQ (3,1) && !defined __GNUG__433 This syntax is not usable in C++ mode. */
434#if (__GNUC_PREREQ (3,1) || __clang_major__ >= 3) && !defined __cplusplus
387# define __restrict_arr __restrict435# define __restrict_arr __restrict
388#else436#else
389# ifdef __GNUC__437# ifdef __GNUC__
...@@ -398,7 +446,7 @@...@@ -398,7 +446,7 @@
398# endif446# endif
399#endif447#endif
400448
401#if __GNUC__ >= 3449#if (__GNUC__ >= 3) || __glibc_has_builtin (__builtin_expect)
402# define __glibc_unlikely(cond) __builtin_expect ((cond), 0)450# define __glibc_unlikely(cond) __builtin_expect ((cond), 0)
403# define __glibc_likely(cond) __builtin_expect ((cond), 1)451# define __glibc_likely(cond) __builtin_expect ((cond), 1)
404#else452#else
...@@ -406,15 +454,10 @@...@@ -406,15 +454,10 @@
406# define __glibc_likely(cond) (cond)454# define __glibc_likely(cond) (cond)
407#endif455#endif
408456
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#if (!defined _Noreturn \457#if (!defined _Noreturn \
416 && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \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# if __GNUC_PREREQ (2,8)461# if __GNUC_PREREQ (2,8)
419# define _Noreturn __attribute__ ((__noreturn__))462# define _Noreturn __attribute__ ((__noreturn__))
420# else463# else
...@@ -443,16 +486,51 @@...@@ -443,16 +486,51 @@
443486
444#if (!defined _Static_assert && !defined __cplusplus \487#if (!defined _Static_assert && !defined __cplusplus \
445 && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \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# define _Static_assert(expr, diagnostic) \491# define _Static_assert(expr, diagnostic) \
448 extern int (*__Static_assert_function (void)) \492 extern int (*__Static_assert_function (void)) \
449 [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })]493 [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })]
450#endif494#endif
451495
452#include <bits/wordsize.h>496/* The #ifndef lets Gnulib avoid including these on non-glibc
453#include <bits/long-double.h>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
454529
455#if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH530# 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# define __LDBL_COMPAT 1534# define __LDBL_COMPAT 1
457# ifdef __REDIRECT535# ifdef __REDIRECT
458# define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias)536# define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias)
...@@ -461,6 +539,8 @@...@@ -461,6 +539,8 @@
461# define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias)539# define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias)
462# define __LDBL_REDIR_NTH(name, proto) \540# define __LDBL_REDIR_NTH(name, proto) \
463 __LDBL_REDIR1_NTH (name, proto, __nldbl_##name)541 __LDBL_REDIR1_NTH (name, proto, __nldbl_##name)
542# define __LDBL_REDIR2_DECL(name) \
543 extern __typeof (__##name) __##name __asm (__ASMNAME ("__nldbl___" #name));
464# define __LDBL_REDIR1_DECL(name, alias) \544# define __LDBL_REDIR1_DECL(name, alias) \
465 extern __typeof (name) name __asm (__ASMNAME (#alias));545 extern __typeof (name) name __asm (__ASMNAME (#alias));
466# define __LDBL_REDIR_DECL(name) \546# define __LDBL_REDIR_DECL(name) \
...@@ -471,11 +551,13 @@...@@ -471,11 +551,13 @@
471 __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)551 __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)
472# endif552# endif
473#endif553#endif
474#if !defined __LDBL_COMPAT || !defined __REDIRECT554#if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \
555 || !defined __REDIRECT
475# define __LDBL_REDIR1(name, proto, alias) name proto556# define __LDBL_REDIR1(name, proto, alias) name proto
476# define __LDBL_REDIR(name, proto) name proto557# define __LDBL_REDIR(name, proto) name proto
477# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW558# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW
478# define __LDBL_REDIR_NTH(name, proto) name proto __THROW559# define __LDBL_REDIR_NTH(name, proto) name proto __THROW
560# define __LDBL_REDIR2_DECL(name)
479# define __LDBL_REDIR_DECL(name)561# define __LDBL_REDIR_DECL(name)
480# ifdef __REDIRECT562# ifdef __REDIRECT
481# define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias)563# define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias)
...@@ -506,7 +588,7 @@...@@ -506,7 +588,7 @@
506 check is required to enable the use of generic selection. */588 check is required to enable the use of generic selection. */
507#if !defined __cplusplus \589#if !defined __cplusplus \
508 && (__GNUC_PREREQ (4, 9) \590 && (__GNUC_PREREQ (4, 9) \
509 || __glibc_clang_has_extension (c_generic_selections) \591 || __glibc_has_extension (c_generic_selections) \
510 || (!defined __GNUC__ && defined __STDC_VERSION__ \592 || (!defined __GNUC__ && defined __STDC_VERSION__ \
511 && __STDC_VERSION__ >= 201112L))593 && __STDC_VERSION__ >= 201112L))
512# define __HAVE_GENERIC_SELECTION 1594# define __HAVE_GENERIC_SELECTION 1
...@@ -514,4 +596,40 @@...@@ -514,4 +596,40 @@
514# define __HAVE_GENERIC_SELECTION 0596# define __HAVE_GENERIC_SELECTION 0
515#endif597#endif
516598
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#endif /* sys/cdefs.h */635#endif /* sys/cdefs.h */
lib/libc/glibc/misc/sys/select.h+28-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* `fd_set' type and related macros, and `select'/`pselect' declarations.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -98,10 +98,23 @@ __BEGIN_DECLS...@@ -98,10 +98,23 @@ __BEGIN_DECLS
9898
99 This function is a cancellation point and therefore not marked with99 This function is a cancellation point and therefore not marked with
100 __THROW. */100 __THROW. */
101#ifndef __USE_TIME_BITS64
101extern int select (int __nfds, fd_set *__restrict __readfds,102extern int select (int __nfds, fd_set *__restrict __readfds,
102 fd_set *__restrict __writefds,103 fd_set *__restrict __writefds,
103 fd_set *__restrict __exceptfds,104 fd_set *__restrict __exceptfds,
104 struct timeval *__restrict __timeout);105 struct timeval *__restrict __timeout);
106#else
107# ifdef __REDIRECT
108extern 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
105118
106#ifdef __USE_XOPEN2K119#ifdef __USE_XOPEN2K
107/* Same as above only that the TIMEOUT value is given with higher120/* 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,11 +123,25 @@ extern int select (int __nfds, fd_set *__restrict __readfds,
110123
111 This function is a cancellation point and therefore not marked with124 This function is a cancellation point and therefore not marked with
112 __THROW. */125 __THROW. */
126# ifndef __USE_TIME_BITS64
113extern int pselect (int __nfds, fd_set *__restrict __readfds,127extern int pselect (int __nfds, fd_set *__restrict __readfds,
114 fd_set *__restrict __writefds,128 fd_set *__restrict __writefds,
115 fd_set *__restrict __exceptfds,129 fd_set *__restrict __exceptfds,
116 const struct timespec *__restrict __timeout,130 const struct timespec *__restrict __timeout,
117 const __sigset_t *__restrict __sigmask);131 const __sigset_t *__restrict __sigmask);
132# else
133# ifdef __REDIRECT
134extern 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#endif145#endif
119146
120147
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
36extern int __pthread_atfork (void (*prepare) (void), void (*parent) (void),
37 void (*child) (void));
38extern int __register_atfork (void (*__prepare) (void),
39 void (*__parent) (void),
40 void (*__child) (void),
41 void *dso_handle);
42libc_hidden_proto (__register_atfork)
43extern 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. */
47int
48#ifndef __pthread_atfork
49/* Don't mark the compatibility function as hidden. */
50attribute_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
58extern int pthread_atfork (void (*prepare) (void), void (*parent) (void),
59 void (*child) (void)) attribute_hidden;
60weak_alias (__pthread_atfork, pthread_atfork)
61#endif
lib/libc/glibc/posix/bits/cpu-set.h+1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1/* Definition of the cpu_set_t structure used by the POSIX 1003.1b-19931/* Definition of the cpu_set_t structure used by the POSIX 1003.1b-1993
2 scheduling interface.2 scheduling interface.
3 Copyright (C) 1996-2020 Free Software Foundation, Inc.3 Copyright (C) 1996-2021 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
6 The GNU C Library is free software; you can redistribute it and/or6 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,5 +1,5 @@
1/* bits/types.h -- definitions of __*_t types underlying *_t types.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,6 +160,7 @@ __STD_TYPE __ID_T_TYPE __id_t; /* General type for IDs. */
160__STD_TYPE __TIME_T_TYPE __time_t; /* Seconds since the Epoch. */160__STD_TYPE __TIME_T_TYPE __time_t; /* Seconds since the Epoch. */
161__STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds. */161__STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds. */
162__STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds. */162__STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds. */
163__STD_TYPE __SUSECONDS64_T_TYPE __suseconds64_t;
163164
164__STD_TYPE __DADDR_T_TYPE __daddr_t; /* The type of a disk address. */165__STD_TYPE __DADDR_T_TYPE __daddr_t; /* The type of a disk address. */
165__STD_TYPE __KEY_T_TYPE __key_t; /* Type of an IPC key. */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,4 +1,4 @@
1/* Copyright (C) 1991-2020 Free Software Foundation, Inc.1/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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,4 +1,4 @@
1/* Copyright (C) 1991-2020 Free Software Foundation, Inc.1/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -27,7 +27,7 @@...@@ -27,7 +27,7 @@
27__BEGIN_DECLS27__BEGIN_DECLS
2828
29#include <bits/types.h>29#include <bits/types.h>
30#include <bits/signum.h>30#include <bits/signum-generic.h>
3131
32#include <bits/types/sig_atomic_t.h>32#include <bits/types/sig_atomic_t.h>
3333
...@@ -148,7 +148,8 @@ extern void psiginfo (const siginfo_t *__pinfo, const char *__s);...@@ -148,7 +148,8 @@ extern void psiginfo (const siginfo_t *__pinfo, const char *__s);
148148
149#ifdef __USE_XOPEN_EXTENDED149#ifdef __USE_XOPEN_EXTENDED
150# ifdef __GNUC__150# ifdef __GNUC__
151extern int sigpause (int __sig) __asm__ ("__xpg_sigpause");151extern int sigpause (int __sig) __asm__ ("__xpg_sigpause")
152 __attribute_deprecated_msg__ ("Use the sigsuspend function instead");
152# else153# else
153extern int __sigpause (int __sig_or_mask, int __is_sig);154extern int __sigpause (int __sig_or_mask, int __is_sig);
154/* Remove a signal from the signal mask and suspend the process. */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,7 +165,9 @@ extern int __sigpause (int __sig_or_mask, int __is_sig);
164 simply do not work in many situations. Use `sigprocmask' instead. */165 simply do not work in many situations. Use `sigprocmask' instead. */
165166
166/* Compute mask for signal SIG. */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)))
168171
169/* Block signals in MASK, returning the old mask. */172/* Block signals in MASK, returning the old mask. */
170extern int sigblock (int __mask) __THROW __attribute_deprecated__;173extern int sigblock (int __mask) __THROW __attribute_deprecated__;
...@@ -266,10 +269,23 @@ extern int sigwaitinfo (const sigset_t *__restrict __set,...@@ -266,10 +269,23 @@ extern int sigwaitinfo (const sigset_t *__restrict __set,
266269
267 This function is a cancellation point and therefore not marked with270 This function is a cancellation point and therefore not marked with
268 __THROW. */271 __THROW. */
272# ifndef __USE_TIME_BITS64
269extern int sigtimedwait (const sigset_t *__restrict __set,273extern int sigtimedwait (const sigset_t *__restrict __set,
270 siginfo_t *__restrict __info,274 siginfo_t *__restrict __info,
271 const struct timespec *__restrict __timeout)275 const struct timespec *__restrict __timeout)
272 __nonnull ((1));276 __nonnull ((1));
277# else
278# ifdef __REDIRECT
279extern 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
273289
274/* Send signal SIG to the process PID. Associate data in VAL with the290/* Send signal SIG to the process PID. Associate data in VAL with the
275 signal. */291 signal. */
...@@ -281,12 +297,6 @@ extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val)...@@ -281,12 +297,6 @@ extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val)
281297
282#ifdef __USE_MISC298#ifdef __USE_MISC
283299
284/* Names of the signals. This variable exists only for compatibility.
285 Use `strsignal' instead (see <string.h>). */
286extern const char *const _sys_siglist[_NSIG];
287extern const char *const sys_siglist[_NSIG];
288
289
290/* Get machine-dependent `struct sigcontext' and signal subcodes. */300/* Get machine-dependent `struct sigcontext' and signal subcodes. */
291# include <bits/sigcontext.h>301# include <bits/sigcontext.h>
292302
...@@ -311,9 +321,11 @@ extern int sigreturn (struct sigcontext *__scp) __THROW;...@@ -311,9 +321,11 @@ extern int sigreturn (struct sigcontext *__scp) __THROW;
311/* If INTERRUPT is nonzero, make signal SIG interrupt system calls321/* If INTERRUPT is nonzero, make signal SIG interrupt system calls
312 (causing them to fail with EINTR); if INTERRUPT is zero, make system322 (causing them to fail with EINTR); if INTERRUPT is zero, make system
313 calls be restarted after signal SIG. */323 calls be restarted after signal SIG. */
314extern int siginterrupt (int __sig, int __interrupt) __THROW;324extern int siginterrupt (int __sig, int __interrupt) __THROW
325 __attribute_deprecated_msg__ ("Use sigaction with SA_RESTART instead");
315326
316# include <bits/sigstack.h>327# include <bits/sigstack.h>
328# include <bits/sigstksz.h>
317# include <bits/ss_flags.h>329# include <bits/ss_flags.h>
318330
319/* Alternate signal handler stack interface.331/* Alternate signal handler stack interface.
...@@ -340,16 +352,21 @@ extern int sigstack (struct sigstack *__ss, struct sigstack *__oss)...@@ -340,16 +352,21 @@ extern int sigstack (struct sigstack *__ss, struct sigstack *__oss)
340/* Simplified interface for signal management. */352/* Simplified interface for signal management. */
341353
342/* Add SIG to the calling process' signal mask. */354/* Add SIG to the calling process' signal mask. */
343extern int sighold (int __sig) __THROW;355extern int sighold (int __sig) __THROW
356 __attribute_deprecated_msg__ ("Use the sigprocmask function instead");
344357
345/* Remove SIG from the calling process' signal mask. */358/* Remove SIG from the calling process' signal mask. */
346extern int sigrelse (int __sig) __THROW;359extern int sigrelse (int __sig) __THROW
360 __attribute_deprecated_msg__ ("Use the sigprocmask function instead");
347361
348/* Set the disposition of SIG to SIG_IGN. */362/* Set the disposition of SIG to SIG_IGN. */
349extern int sigignore (int __sig) __THROW;363extern int sigignore (int __sig) __THROW
364 __attribute_deprecated_msg__ ("Use the signal function instead");
350365
351/* Set the disposition of SIG. */366/* Set the disposition of SIG. */
352extern __sighandler_t sigset (int __sig, __sighandler_t __disp) __THROW;367extern __sighandler_t sigset (int __sig, __sighandler_t __disp) __THROW
368 __attribute_deprecated_msg__
369 ("Use the signal and sigprocmask functions instead");
353#endif370#endif
354371
355#if defined __USE_POSIX199506 || defined __USE_UNIX98372#if defined __USE_POSIX199506 || defined __USE_UNIX98
lib/libc/glibc/stdlib/alloca.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 1992-2020 Free Software Foundation, Inc.1/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -25,7 +25,7 @@...@@ -25,7 +25,7 @@
2525
26__BEGIN_DECLS26__BEGIN_DECLS
2727
28/* Remove any previous definitions. */28/* Remove any previous definition. */
29#undef alloca29#undef alloca
3030
31/* Allocate a block that will be freed when the calling function exits. */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,4 +1,4 @@
1/* Copyright (C) 1991-2020 Free Software Foundation, Inc.1/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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,4 +1,4 @@
1/* Copyright (C) 1991-2020 Free Software Foundation, Inc.1/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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,5 +1,5 @@
1/* Floating-point inline functions for stdlib.h.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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. */
37extern 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]. */
45extern char *program_invocation_name;
46extern 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,4 +1,4 @@
1/* Copyright (C) 1991-2020 Free Software Foundation, Inc.1/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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,4 +1,4 @@
1/* Copyright (C) 1991-2020 Free Software Foundation, Inc.1/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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,7 +397,7 @@ extern long int a64l (const char *__s)
397 `initstate' and `setstate' functions are those from BSD Unices.397 `initstate' and `setstate' functions are those from BSD Unices.
398 The `rand' and `srand' functions are required by the ANSI standard.398 The `rand' and `srand' functions are required by the ANSI standard.
399 We provide both interfaces to the same random number generator. */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. */
401extern long int random (void) __THROW;401extern long int random (void) __THROW;
402402
403/* Seed the random number generator with the given number. */403/* Seed the random number generator with the given number. */
...@@ -550,6 +550,9 @@ extern void *calloc (size_t __nmemb, size_t __size)...@@ -550,6 +550,9 @@ extern void *calloc (size_t __nmemb, size_t __size)
550extern void *realloc (void *__ptr, size_t __size)550extern void *realloc (void *__ptr, size_t __size)
551 __THROW __attribute_warn_unused_result__ __attribute_alloc_size__ ((2));551 __THROW __attribute_warn_unused_result__ __attribute_alloc_size__ ((2));
552552
553/* Free a block allocated by `malloc', `realloc' or `calloc'. */
554extern void free (void *__ptr) __THROW;
555
553#ifdef __USE_MISC556#ifdef __USE_MISC
554/* Re-allocate the previously allocated block in PTR, making the new557/* Re-allocate the previously allocated block in PTR, making the new
555 block large enough for NMEMB elements of SIZE bytes each. */558 block large enough for NMEMB elements of SIZE bytes each. */
...@@ -558,11 +561,13 @@ extern void *realloc (void *__ptr, size_t __size)...@@ -558,11 +561,13 @@ extern void *realloc (void *__ptr, size_t __size)
558 between objects pointed by the old and new pointers. */561 between objects pointed by the old and new pointers. */
559extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)562extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
560 __THROW __attribute_warn_unused_result__563 __THROW __attribute_warn_unused_result__
561 __attribute_alloc_size__ ((2, 3));564 __attribute_alloc_size__ ((2, 3))
562#endif565 __attr_dealloc_free;
563566
564/* Free a block allocated by `malloc', `realloc' or `calloc'. */567/* Add reallocarray as its own deallocator. */
565extern void free (void *__ptr) __THROW;568extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
569 __THROW __attr_dealloc (reallocarray, 1);
570#endif
566571
567#ifdef __USE_MISC572#ifdef __USE_MISC
568# include <alloca.h>573# include <alloca.h>
...@@ -788,7 +793,8 @@ extern int system (const char *__command) __wur;...@@ -788,7 +793,8 @@ extern int system (const char *__command) __wur;
788/* Return a malloc'd string containing the canonical absolute name of the793/* Return a malloc'd string containing the canonical absolute name of the
789 existing named file. */794 existing named file. */
790extern char *canonicalize_file_name (const char *__name)795extern char *canonicalize_file_name (const char *__name)
791 __THROW __nonnull ((1)) __wur;796 __THROW __nonnull ((1)) __attribute_malloc__
797 __attr_dealloc_free __wur;
792#endif798#endif
793799
794#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED800#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
...@@ -931,12 +937,13 @@ extern int wctomb (char *__s, wchar_t __wchar) __THROW;...@@ -931,12 +937,13 @@ extern int wctomb (char *__s, wchar_t __wchar) __THROW;
931937
932/* Convert a multibyte string to a wide char string. */938/* Convert a multibyte string to a wide char string. */
933extern size_t mbstowcs (wchar_t *__restrict __pwcs,939extern 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/* Convert a wide char string to multibyte string. */942/* Convert a wide char string to multibyte string. */
936extern size_t wcstombs (char *__restrict __s,943extern size_t wcstombs (char *__restrict __s,
937 const wchar_t *__restrict __pwcs, size_t __n)944 const wchar_t *__restrict __pwcs, size_t __n)
938 __THROW;945 __THROW
939946 __attr_access ((__write_only__, 1, 3)) __attr_access ((__read_only__, 2));
940947
941#ifdef __USE_MISC948#ifdef __USE_MISC
942/* Determine whether the string value of RESPONSE matches the affirmation949/* Determine whether the string value of RESPONSE matches the affirmation
...@@ -990,7 +997,7 @@ extern char *ptsname (int __fd) __THROW __wur;...@@ -990,7 +997,7 @@ extern char *ptsname (int __fd) __THROW __wur;
990 terminal associated with the master FD is open on in BUF.997 terminal associated with the master FD is open on in BUF.
991 Return 0 on success, otherwise an error number. */998 Return 0 on success, otherwise an error number. */
992extern int ptsname_r (int __fd, char *__buf, size_t __buflen)999extern int ptsname_r (int __fd, char *__buf, size_t __buflen)
993 __THROW __nonnull ((2));1000 __THROW __nonnull ((2)) __attr_access ((__write_only__, 2, 3));
9941001
995/* Open a master pseudo terminal and return its file descriptor. */1002/* Open a master pseudo terminal and return its file descriptor. */
996extern int getpt (void);1003extern int getpt (void);
...@@ -1016,7 +1023,9 @@ extern int ttyslot (void) __THROW;...@@ -1016,7 +1023,9 @@ extern int ttyslot (void) __THROW;
1016#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function1023#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
1017# include <bits/stdlib.h>1024# include <bits/stdlib.h>
1018#endif1025#endif
1019#ifdef __LDBL_COMPAT1026
1027#include <bits/floatn.h>
1028#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
1020# include <bits/stdlib-ldbl.h>1029# include <bits/stdlib-ldbl.h>
1021#endif1030#endif
10221031
lib/libc/glibc/string/bits/endian.h+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Endian macros for string.h functions1/* 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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,4 +1,4 @@
1/* Copyright (C) 1992-2020 Free Software Foundation, Inc.1/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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,5 +1,5 @@
1/* Special .init and .fini section support for AArch64.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.
33
4 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
...@@ -75,6 +75,11 @@ call_weak_fn:...@@ -75,6 +75,11 @@ call_weak_fn:
75 .hidden _init75 .hidden _init
76 .type _init, %function76 .type _init, %function
77_init:77_init:
78#if HAVE_AARCH64_PAC_RET
79 PACIASP
80#else
81 BTI_C
82#endif
78 stp x29, x30, [sp, -16]!83 stp x29, x30, [sp, -16]!
79 mov x29, sp84 mov x29, sp
80#if PREINIT_FUNCTION_WEAK85#if PREINIT_FUNCTION_WEAK
...@@ -89,5 +94,10 @@ _init:...@@ -89,5 +94,10 @@ _init:
89 .hidden _fini94 .hidden _fini
90 .type _fini, %function95 .type _fini, %function
91_fini:96_fini:
97#if HAVE_AARCH64_PAC_RET
98 PACIASP
99#else
100 BTI_C
101#endif
92 stp x29, x30, [sp, -16]!102 stp x29, x30, [sp, -16]!
93 mov x29, sp103 mov x29, sp
lib/libc/glibc/sysdeps/aarch64/crtn.S+9-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Special .init and .fini section support for AArch64.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.
33
4 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
...@@ -37,10 +37,18 @@...@@ -37,10 +37,18 @@
37/* crtn.S puts function epilogues in the .init and .fini sections37/* crtn.S puts function epilogues in the .init and .fini sections
38 corresponding to the prologues in crti.S. */38 corresponding to the prologues in crti.S. */
3939
40#include <sysdep.h>
41
40 .section .init,"ax",%progbits42 .section .init,"ax",%progbits
41 ldp x29, x30, [sp], 1643 ldp x29, x30, [sp], 16
44#if HAVE_AARCH64_PAC_RET
45 AUTIASP
46#endif
42 RET47 RET
4348
44 .section .fini,"ax",%progbits49 .section .fini,"ax",%progbits
45 ldp x29, x30, [sp], 1650 ldp x29, x30, [sp], 16
51#if HAVE_AARCH64_PAC_RET
52 AUTIASP
53#endif
46 RET54 RET
lib/libc/glibc/sysdeps/aarch64/dl-sysdep.h+1-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 2002-2020 Free Software Foundation, Inc.1/* Copyright (C) 2002-2021 Free Software Foundation, Inc.
22
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
lib/libc/glibc/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h+1-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 2002-2020 Free Software Foundation, Inc.1/* Copyright (C) 2002-2021 Free Software Foundation, Inc.
22
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
lib/libc/glibc/sysdeps/aarch64/start.S+7-16
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 1995-2020 Free Software Foundation, Inc.1/* Copyright (C) 1995-2021 Free Software Foundation, Inc.
22
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
...@@ -43,10 +43,9 @@...@@ -43,10 +43,9 @@
43 */43 */
4444
45 .text45 .text
46 .globl _start46ENTRY(_start)
47 .type _start,#function
48_start:
49 /* Create an initial frame with 0 LR and FP */47 /* Create an initial frame with 0 LR and FP */
48 cfi_undefined (x30)
50 mov x29, #049 mov x29, #0
51 mov x30, #050 mov x30, #0
5251
...@@ -64,26 +63,16 @@ _start:...@@ -64,26 +63,16 @@ _start:
64# ifdef SHARED63# ifdef SHARED
65 adrp x0, :got:main64 adrp x0, :got:main
66 ldr PTR_REG (0), [x0, #:got_lo12:main]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# else66# else
74 adrp x0, __wrap_main67 adrp x0, __wrap_main
75 add x0, x0, :lo12:__wrap_main68 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# endif69# endif
81#else70#else
82 /* Set up the other arguments in registers */71 /* Set up the other arguments in registers */
83 MOVL (0, main)72 MOVL (0, main)
84 MOVL (3, __libc_csu_init)
85 MOVL (4, __libc_csu_fini)
86#endif73#endif
74 mov x3, #0 /* Used to be init. */
75 mov x4, #0 /* Used to be fini. */
8776
88 /* __libc_start_main (main, argc, argv, init, fini, rtld_fini,77 /* __libc_start_main (main, argc, argv, init, fini, rtld_fini,
89 stack_end) */78 stack_end) */
...@@ -100,8 +89,10 @@ _start:...@@ -100,8 +89,10 @@ _start:
100 because crt1.o and rcrt1.o share code and the later must avoid the89 because crt1.o and rcrt1.o share code and the later must avoid the
101 use of GOT relocations before __libc_start_main is called. */90 use of GOT relocations before __libc_start_main is called. */
102__wrap_main:91__wrap_main:
92 BTI_C
103 b main93 b main
104#endif94#endif
95END(_start)
10596
106 /* Define a symbol for the first piece of initialized data. */97 /* Define a symbol for the first piece of initialized data. */
107 .data98 .data
lib/libc/glibc/sysdeps/aarch64/sysdep.h+68-5
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 1997-2020 Free Software Foundation, Inc.1/* Copyright (C) 1997-2021 Free Software Foundation, Inc.
22
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
...@@ -25,29 +25,90 @@...@@ -25,29 +25,90 @@
25# define AARCH64_R(NAME) R_AARCH64_ ## NAME25# define AARCH64_R(NAME) R_AARCH64_ ## NAME
26# define PTR_REG(n) x##n26# define PTR_REG(n) x##n
27# define PTR_LOG_SIZE 327# define PTR_LOG_SIZE 3
28# define DELOUSE(n)28# define PTR_ARG(n)
29# define SIZE_ARG(n)
29#else30#else
30# define AARCH64_R(NAME) R_AARCH64_P32_ ## NAME31# define AARCH64_R(NAME) R_AARCH64_P32_ ## NAME
31# define PTR_REG(n) w##n32# define PTR_REG(n) w##n
32# define PTR_LOG_SIZE 233# define PTR_LOG_SIZE 2
33# define DELOUSE(n) mov w##n, w##n34# define PTR_ARG(n) mov w##n, w##n
35# define SIZE_ARG(n) mov w##n, w##n
34#endif36#endif
3537
36#define PTR_SIZE (1<<PTR_LOG_SIZE)38#define PTR_SIZE (1<<PTR_LOG_SIZE)
3739
40#ifndef __ASSEMBLER__
41/* Strip pointer authentication code from pointer p. */
42static inline void *
43strip_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#ifdef __ASSEMBLER__58#ifdef __ASSEMBLER__
3959
40/* Syntactic details of assembler. */60/* Syntactic details of assembler. */
4161
42#define ASM_SIZE_DIRECTIVE(name) .size name,.-name62#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
4363
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
99GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_PAC)
100#elif HAVE_AARCH64_BTI
101GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI)
102#endif
103
44/* Define an entry point visible from C. */104/* Define an entry point visible from C. */
45#define ENTRY(name) \105#define ENTRY(name) \
46 .globl C_SYMBOL_NAME(name); \106 .globl C_SYMBOL_NAME(name); \
47 .type C_SYMBOL_NAME(name),%function; \107 .type C_SYMBOL_NAME(name),%function; \
48 .align 4; \108 .p2align 6; \
49 C_LABEL(name) \109 C_LABEL(name) \
50 cfi_startproc; \110 cfi_startproc; \
111 BTI_C; \
51 CALL_MCOUNT112 CALL_MCOUNT
52113
53/* Define an entry point visible from C. */114/* Define an entry point visible from C. */
...@@ -57,6 +118,7 @@...@@ -57,6 +118,7 @@
57 .p2align align; \118 .p2align align; \
58 C_LABEL(name) \119 C_LABEL(name) \
59 cfi_startproc; \120 cfi_startproc; \
121 BTI_C; \
60 CALL_MCOUNT122 CALL_MCOUNT
61123
62/* Define an entry point visible from C with a specified alignment and124/* Define an entry point visible from C with a specified alignment and
...@@ -68,11 +130,12 @@...@@ -68,11 +130,12 @@
68 .globl C_SYMBOL_NAME(name); \130 .globl C_SYMBOL_NAME(name); \
69 .type C_SYMBOL_NAME(name),%function; \131 .type C_SYMBOL_NAME(name),%function; \
70 .p2align align; \132 .p2align align; \
71 .rep padding; \133 .rep padding - 1; /* -1 for bti c. */ \
72 nop; \134 nop; \
73 .endr; \135 .endr; \
74 C_LABEL(name) \136 C_LABEL(name) \
75 cfi_startproc; \137 cfi_startproc; \
138 BTI_C; \
76 CALL_MCOUNT139 CALL_MCOUNT
77140
78#undef END141#undef END
lib/libc/glibc/sysdeps/alpha/crti.S+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Special .init and .fini section support for Alpha.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Special .init and .fini section support for Alpha.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* System-specific settings for dynamic linker code. Alpha version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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
42struct __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,5 +1,5 @@
1/* Startup code for Alpha/ELF.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
4 Contributed by Richard Henderson <rth@tamu.edu>4 Contributed by Richard Henderson <rth@tamu.edu>
55
...@@ -55,9 +55,8 @@ _start:...@@ -55,9 +55,8 @@ _start:
55 ldl a1, 16(sp) /* get argc */55 ldl a1, 16(sp) /* get argc */
56 lda a2, 24(sp) /* get argv */56 lda a2, 24(sp) /* get argv */
5757
58 /* Load address of our own entry points to .fini and .init. */58 mov $r31, a3 /* Used to be init. */
59 lda a3, __libc_csu_init59 mov $r31, a4 /* Used to be fini. */
60 lda a4, __libc_csu_fini
6160
62 /* Store address of the shared library termination function. */61 /* Store address of the shared library termination function. */
63 mov v0, a562 mov v0, a5
lib/libc/glibc/sysdeps/arm/crti.S+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Special .init and .fini section support for ARM.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Special .init and .fini section support for ARM.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* System-specific settings for dynamic linker code. Alpha version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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
43struct __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,5 +1,5 @@
1/* Startup code for ARM & ELF1/* Startup code for ARM & ELF
2 Copyright (C) 1995-2020 Free Software Foundation, Inc.2 Copyright (C) 1995-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -94,30 +94,20 @@ _start:...@@ -94,30 +94,20 @@ _start:
94 adr a4, .L_GOT94 adr a4, .L_GOT
95 add sl, sl, a495 add sl, sl, a4
9696
97 ldr ip, .L_GOT+4 /* __libc_csu_fini */97 mov a4, #0 /* Used to be init. */
98 ldr ip, [sl, ip]98 push { a4 } /* Used to be fini. */
9999
100 push { ip } /* Push __libc_csu_fini */100 ldr a1, .L_GOT+4 /* main */
101
102 ldr a4, .L_GOT+8 /* __libc_csu_init */
103 ldr a4, [sl, a4]
104
105 ldr a1, .L_GOT+12 /* main */
106 ldr a1, [sl, a1]101 ldr a1, [sl, a1]
107102
108 /* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */103 /* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
109 /* Let the libc call main and exit with its return code. */104 /* Let the libc call main and exit with its return code. */
110 bl __libc_start_main(PLT)105 bl __libc_start_main(PLT)
111#else106#else
112 /* Fetch address of __libc_csu_fini */
113 ldr ip, =__libc_csu_fini
114
115 /* Push __libc_csu_fini */
116 push { ip }
117107
118 /* Set up the other arguments in registers */108 mov a4, #0 /* Used to init. */
109 push { a4 } /* Used to fini. */
119 ldr a1, =main110 ldr a1, =main
120 ldr a4, =__libc_csu_init
121111
122 /* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */112 /* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
123 /* Let the libc call main and exit with its return code. */113 /* Let the libc call main and exit with its return code. */
...@@ -131,8 +121,6 @@ _start:...@@ -131,8 +121,6 @@ _start:
131 .align 2121 .align 2
132.L_GOT:122.L_GOT:
133 .word _GLOBAL_OFFSET_TABLE_ - .L_GOT123 .word _GLOBAL_OFFSET_TABLE_ - .L_GOT
134 .word __libc_csu_fini(GOT)
135 .word __libc_csu_init(GOT)
136 .word main(GOT)124 .word main(GOT)
137#endif125#endif
138126
lib/libc/glibc/sysdeps/arm/sysdep.h+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Assembler macros for ARM.1/* Assembler macros for ARM.
2 Copyright (C) 1997-2020 Free Software Foundation, Inc.2 Copyright (C) 1997-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Configuration of lookup functions.1/* Configuration of lookup functions.
2 Copyright (C) 2000-2020 Free Software Foundation, Inc.2 Copyright (C) 2000-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* System-specific settings for dynamic linker code. Generic version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,6 +1,6 @@
1/* Declarations and definitions of codes relating to the DWARF2 symbolic1/* Declarations and definitions of codes relating to the DWARF2 symbolic
2 debugging information format.2 debugging information format.
3 Copyright (C) 1992-2020 Free Software Foundation, Inc.3 Copyright (C) 1992-2021 Free Software Foundation, Inc.
4 Contributed by Gary Funck (gary@intrepid.com). Derived from the4 Contributed by Gary Funck (gary@intrepid.com). Derived from the
5 DWARF 1 implementation written by Ron Guilmette (rfg@monkeys.com).5 DWARF 1 implementation written by Ron Guilmette (rfg@monkeys.com).
66
lib/libc/glibc/sysdeps/generic/libc-lock.h+1-13
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* libc-internal interface for mutex locks. Stub version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -125,16 +125,4 @@...@@ -125,16 +125,4 @@
125/* We need portable names for some of the functions. */125/* We need portable names for some of the functions. */
126#define __libc_mutex_unlock126#define __libc_mutex_unlock
127127
128/* Type for key of thread specific data. */
129typedef 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#endif /* libc-lock.h */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,5 +1,5 @@
1/* Single thread optimization, generic version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Generic asm macros used on many machines.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Definition for thread-local data handling. Generic version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Special .init and .fini section support for HPPA1/* 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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Special .init and .fini section support for HPPA1/* 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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,4 +1,4 @@
1/* Copyright (C) 2005-2020 Free Software Foundation, Inc.1/* Copyright (C) 2005-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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,5 +1,5 @@
1/* ELF startup code for HPPA.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -36,8 +36,6 @@...@@ -36,8 +36,6 @@
36 .import main, code36 .import main, code
37 .import $global$, data37 .import $global$, data
38 .import __libc_start_main, code38 .import __libc_start_main, code
39 .import __libc_csu_fini, code
40 .import __libc_csu_init, code
4139
42 /* Have the linker create plabel words so we get PLABEL3240 /* Have the linker create plabel words so we get PLABEL32
43 relocs and not 21/14. The use of 21/14 relocs is only41 relocs and not 21/14. The use of 21/14 relocs is only
...@@ -52,10 +50,6 @@...@@ -52,10 +50,6 @@
52 .word P%main50 .word P%main
53.Lp__libc_start_main:51.Lp__libc_start_main:
54 .word P%__libc_start_main52 .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
5953
60 .text54 .text
61 .align 455 .align 4
...@@ -77,8 +71,8 @@ _start:...@@ -77,8 +71,8 @@ _start:
77 1. r26 - Application main71 1. r26 - Application main
78 2. r25 - argc72 2. r25 - argc
79 3. r24 - argv73 3. r24 - argv
80 4. r23 - __libc_csu_init74 4. r23 - init (unused)
81 5. sp-52 - __libc_csu_fini75 5. sp-52 - fini (unused)
82 6. sp-56 - rtld_fini76 6. sp-56 - rtld_fini
83 7. sp-60 - stackend */77 7. sp-60 - stackend */
8478
...@@ -108,14 +102,6 @@ _start:...@@ -108,14 +102,6 @@ _start:
108 addil LT'.Lpmain, %r19102 addil LT'.Lpmain, %r19
109 ldw RT'.Lpmain(%r1), %r26103 ldw RT'.Lpmain(%r1), %r26
110 ldw 0(%r26),%r26104 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#else105#else
120 /* Load $global$ address into %dp */106 /* Load $global$ address into %dp */
121 ldil L%$global$, %dp107 ldil L%$global$, %dp
...@@ -124,13 +110,9 @@ _start:...@@ -124,13 +110,9 @@ _start:
124 /* load main (1st argument) */110 /* load main (1st argument) */
125 ldil LR'.Lpmain, %r26111 ldil LR'.Lpmain, %r26
126 ldw RR'.Lpmain(%r26), %r26112 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#endif113#endif
114 ldi 0,%r23 /* Used to be init. */
115 ldi 0,%r22 /* Used to be fini. */
134 /* Store 5th argument */116 /* Store 5th argument */
135 stw %r22, -52(%sp)117 stw %r22, -52(%sp)
136 /* void *stack_end (7th argument) */118 /* void *stack_end (7th argument) */
lib/libc/glibc/sysdeps/hppa/sysdep.h+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Assembler macros for HP/PA.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
4 Contributed by Ulrich Drepper, <drepper@cygnus.com>, August 1999.4 Contributed by Ulrich Drepper, <drepper@cygnus.com>, August 1999.
55
lib/libc/glibc/sysdeps/htl/bits/pthread.h+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Pthread data structures. Generic version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Common threading primitives definitions for both POSIX and C11.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -20,5 +20,18 @@...@@ -20,5 +20,18 @@
20#define _THREAD_SHARED_TYPES_H 120#define _THREAD_SHARED_TYPES_H 1
2121
22#include <bits/pthreadtypes-arch.h>22#include <bits/pthreadtypes-arch.h>
23#include <bits/types/struct___pthread_once.h>
24
25typedef int __tss_t;
26typedef int __thrd_t;
27
28typedef 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 } }
2336
24#endif /* _THREAD_SHARED_TYPES_H */37#endif /* _THREAD_SHARED_TYPES_H */
lib/libc/glibc/sysdeps/htl/libc-lockP.h+1-14
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Private libc-internal interface for mutex locks.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -22,9 +22,6 @@...@@ -22,9 +22,6 @@
22#include <pthread.h>22#include <pthread.h>
23#include <pthread-functions.h>23#include <pthread-functions.h>
2424
25/* Type for key to thread-specific data. */
26typedef pthread_key_t __libc_key_t;
27
28/* If we check for a weakly referenced symbol and then perform a25/* If we check for a weakly referenced symbol and then perform a
29 normal jump to it te code generated for some platforms in case of26 normal jump to it te code generated for some platforms in case of
30 PIC is unnecessarily slow. What would happen is that the function27 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,16 +106,6 @@ extern int __pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock);
109106
110extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock);107extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock);
111108
112extern int __pthread_key_create (pthread_key_t *__key,
113 void (*__destr_function) (void *));
114
115extern int __pthread_key_delete (pthread_key_t __key);
116
117extern int __pthread_setspecific (pthread_key_t __key,
118 const void *__pointer);
119
120extern void *__pthread_getspecific (pthread_key_t __key);
121
122extern int __pthread_once (pthread_once_t *__once_control,109extern int __pthread_once (pthread_once_t *__once_control,
123 void (*__init_routine) (void));110 void (*__init_routine) (void));
124111
lib/libc/glibc/sysdeps/htl/pthread.h+66-39
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Posix threads. Hurd version.1/* Posix threads. Hurd version.
2 Copyright (C) 2000-2020 Free Software Foundation, Inc.2 Copyright (C) 2000-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,6 +222,32 @@ extern void pthread_exit (void *__status) __attribute__ ((__noreturn__));
222 the exit status of the thread in *STATUS. */222 the exit status of the thread in *STATUS. */
223extern int pthread_join (pthread_t __threadp, void **__status);223extern int pthread_join (pthread_t __threadp, void **__status);
224224
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. */
228extern 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. */
236extern 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. */
246extern int pthread_clockjoin_np (pthread_t __th, void **__thread_return,
247 clockid_t __clockid,
248 const struct timespec *__abstime);
249#endif
250
225/* Indicate that the storage for THREAD can be reclaimed when it251/* Indicate that the storage for THREAD can be reclaimed when it
226 terminates. */252 terminates. */
227extern int pthread_detach (pthread_t __threadp);253extern int pthread_detach (pthread_t __threadp);
...@@ -273,6 +299,7 @@ extern pthread_t pthread_self (void) __THROW;...@@ -273,6 +299,7 @@ extern pthread_t pthread_self (void) __THROW;
273#ifdef __USE_XOPEN2K299#ifdef __USE_XOPEN2K
274# define PTHREAD_MUTEX_STALLED __PTHREAD_MUTEX_STALLED300# define PTHREAD_MUTEX_STALLED __PTHREAD_MUTEX_STALLED
275# define PTHREAD_MUTEX_ROBUST __PTHREAD_MUTEX_ROBUST301# define PTHREAD_MUTEX_ROBUST __PTHREAD_MUTEX_ROBUST
302# define PTHREAD_MUTEX_ROBUST_NP __PTHREAD_MUTEX_ROBUST
276#endif303#endif
277304
278#include <bits/types/struct___pthread_mutexattr.h>305#include <bits/types/struct___pthread_mutexattr.h>
...@@ -400,6 +427,13 @@ extern int pthread_mutex_timedlock (struct __pthread_mutex *__restrict __mutex,...@@ -400,6 +427,13 @@ extern int pthread_mutex_timedlock (struct __pthread_mutex *__restrict __mutex,
400 __THROWNL __nonnull ((1, 2));427 __THROWNL __nonnull ((1, 2));
401#endif428#endif
402429
430#ifdef __USE_GNU
431extern 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/* Unlock MUTEX. */437/* Unlock MUTEX. */
404extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)438extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
405 __THROWNL __nonnull ((1));439 __THROWNL __nonnull ((1));
...@@ -516,6 +550,21 @@ extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,...@@ -516,6 +550,21 @@ extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
516 pthread_mutex_t *__restrict __mutex,550 pthread_mutex_t *__restrict __mutex,
517 __const struct timespec *__restrict __abstime)551 __const struct timespec *__restrict __abstime)
518 __nonnull ((1, 2, 3));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. */
562extern 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
520569
521/* Spin locks. */570/* Spin locks. */
...@@ -549,42 +598,6 @@ extern int pthread_spin_trylock (pthread_spinlock_t *__lock)...@@ -549,42 +598,6 @@ extern int pthread_spin_trylock (pthread_spinlock_t *__lock)
549extern int pthread_spin_unlock (pthread_spinlock_t *__lock)598extern int pthread_spin_unlock (pthread_spinlock_t *__lock)
550 __nonnull ((1));599 __nonnull ((1));
551600
552# if defined __USE_EXTERN_INLINES && defined _LIBC
553
554# include <bits/spin-lock-inline.h>
555
556__extern_inline int
557pthread_spin_destroy (pthread_spinlock_t *__lock)
558{
559 return __pthread_spin_destroy (__lock);
560}
561
562__extern_inline int
563pthread_spin_init (pthread_spinlock_t *__lock, int __pshared)
564{
565 return __pthread_spin_init (__lock, __pshared);
566}
567
568__extern_inline int
569pthread_spin_lock (pthread_spinlock_t *__lock)
570{
571 return __pthread_spin_lock (__lock);
572}
573
574__extern_inline int
575pthread_spin_trylock (pthread_spinlock_t *__lock)
576{
577 return __pthread_spin_trylock (__lock);
578}
579
580__extern_inline int
581pthread_spin_unlock (pthread_spinlock_t *__lock)
582{
583 return __pthread_spin_unlock (__lock);
584}
585
586# endif /* Use extern inlines. */
587
588#endif /* XPG6. */601#endif /* XPG6. */
589 602
590603
...@@ -658,6 +671,13 @@ extern int pthread_rwlock_timedrdlock (struct __pthread_rwlock *__restrict __rwl...@@ -658,6 +671,13 @@ extern int pthread_rwlock_timedrdlock (struct __pthread_rwlock *__restrict __rwl
658 __THROWNL __nonnull ((1, 2));671 __THROWNL __nonnull ((1, 2));
659# endif672# endif
660673
674# ifdef __USE_GNU
675extern 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/* Acquire the rwlock *RWLOCK for writing. */681/* Acquire the rwlock *RWLOCK for writing. */
662extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock)682extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock)
663 __THROWNL __nonnull ((1));683 __THROWNL __nonnull ((1));
...@@ -674,6 +694,13 @@ extern int pthread_rwlock_timedwrlock (struct __pthread_rwlock *__restrict __rwl...@@ -674,6 +694,13 @@ extern int pthread_rwlock_timedwrlock (struct __pthread_rwlock *__restrict __rwl
674 __THROWNL __nonnull ((1, 2));694 __THROWNL __nonnull ((1, 2));
675# endif695# endif
676696
697# ifdef __USE_GNU
698extern 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/* Release the lock held by the current thread on *RWLOCK. */704/* Release the lock held by the current thread on *RWLOCK. */
678extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock)705extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock)
679 __THROWNL __nonnull ((1));706 __THROWNL __nonnull ((1));
...@@ -795,14 +822,14 @@ extern void *pthread_getspecific (pthread_key_t __key) __THROW;...@@ -795,14 +822,14 @@ extern void *pthread_getspecific (pthread_key_t __key) __THROW;
795822
796/* Set the caller thread's thread specific value of KEY to VALUE. */823/* Set the caller thread's thread specific value of KEY to VALUE. */
797extern int pthread_setspecific (pthread_key_t __key, const void *__value)824extern int pthread_setspecific (pthread_key_t __key, const void *__value)
798 __THROW;825 __THROW __attr_access_none (2);
799 826
800827
801/* Dynamic package initialization. */828/* Dynamic package initialization. */
802829
803#include <bits/types/struct___pthread_once.h>830#include <bits/types/struct___pthread_once.h>
804831
805#define PTHREAD_ONCE_INIT __PTHREAD_ONCE_INIT832#define PTHREAD_ONCE_INIT (struct __pthread_once) { __PTHREAD_ONCE_INIT }
806833
807/* Call INIT_ROUTINE if this function has never been called with834/* Call INIT_ROUTINE if this function has never been called with
808 *ONCE_CONTROL, otherwise do nothing. */835 *ONCE_CONTROL, otherwise do nothing. */
lib/libc/glibc/sysdeps/i386/crti.S+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Special .init and .fini section support for x86.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Special .init and .fini section support for x86.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Machine-specific pthread type layouts. Hurd i386 version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Startup code compliant to the ELF i386 ABI.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -87,11 +87,9 @@ ENTRY (_start)...@@ -87,11 +87,9 @@ ENTRY (_start)
87 call 1f87 call 1f
88 addl $_GLOBAL_OFFSET_TABLE_, %ebx88 addl $_GLOBAL_OFFSET_TABLE_, %ebx
8989
90 /* Push address of our own entry points to .fini and .init. */90 /* This used to be the addresses of .fini and .init. */
91 leal __libc_csu_fini@GOTOFF(%ebx), %eax91 pushl $0
92 pushl %eax92 pushl $0
93 leal __libc_csu_init@GOTOFF(%ebx), %eax
94 pushl %eax
9593
96 pushl %ecx /* Push second argument: argv. */94 pushl %ecx /* Push second argument: argv. */
97 pushl %esi /* Push first argument: argc. */95 pushl %esi /* Push first argument: argc. */
...@@ -112,9 +110,9 @@ ENTRY (_start)...@@ -112,9 +110,9 @@ ENTRY (_start)
112 But let the libc call main. */110 But let the libc call main. */
113 call __libc_start_main@PLT111 call __libc_start_main@PLT
114#else112#else
115 /* Push address of our own entry points to .fini and .init. */113 /* This used to be the addresses of .fini and .init. */
116 pushl $__libc_csu_fini114 pushl $0
117 pushl $__libc_csu_init115 pushl $0
118116
119 pushl %ecx /* Push second argument: argv. */117 pushl %ecx /* Push second argument: argv. */
120 pushl %esi /* Push first argument: argc. */118 pushl %esi /* Push first argument: argc. */
lib/libc/glibc/sysdeps/i386/symbol-hacks.h+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Hacks needed for symbol manipulation. i386 version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Assembler macros for i386.1/* Assembler macros for i386.
2 Copyright (C) 1991-2020 Free Software Foundation, Inc.2 Copyright (C) 1991-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -18,8 +18,6 @@...@@ -18,8 +18,6 @@
1818
19#include <sysdeps/x86/sysdep.h>19#include <sysdeps/x86/sysdep.h>
2020
21#include <features.h> /* For __GNUC_PREREQ. */
22
23/* It is desirable that the names of PIC thunks match those used by21/* It is desirable that the names of PIC thunks match those used by
24 GCC so that multiple copies are eliminated by the linker. Because22 GCC so that multiple copies are eliminated by the linker. Because
25 GCC 4.6 and earlier use __i686 in the names, it is necessary to23 GCC 4.6 and earlier use __i686 in the names, it is necessary to
...@@ -97,9 +95,9 @@ GET_PC_THUNK(reg): \...@@ -97,9 +95,9 @@ GET_PC_THUNK(reg): \
9795
98# define SETUP_PIC_REG_STR(reg) \96# define SETUP_PIC_REG_STR(reg) \
99 ".ifndef " GET_PC_THUNK_STR (reg) "\n" \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 ".globl " GET_PC_THUNK_STR (reg) "\n" \100 ".globl " GET_PC_THUNK_STR (reg) "\n" \
102 GET_PC_THUNK_STR (reg) ",comdat\n" \
103 ".hidden " GET_PC_THUNK_STR (reg) "\n" \101 ".hidden " GET_PC_THUNK_STR (reg) "\n" \
104 ".p2align 4\n" \102 ".p2align 4\n" \
105 ".type " GET_PC_THUNK_STR (reg) ",@function\n" \103 ".type " GET_PC_THUNK_STR (reg) ",@function\n" \
lib/libc/glibc/sysdeps/ia64/crti.S+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Special .init and .fini section support for IA64.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Special .init and .fini section support for ARM.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Configuration of lookup functions. IA-64 version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* System-specific settings for dynamic linker code. IA-64 version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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. */
44struct __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,4 +1,4 @@
1/* Copyright (C) 1999-2020 Free Software Foundation, Inc.1/* Copyright (C) 1999-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
3 Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999.3 Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999.
44
...@@ -82,20 +82,15 @@ _start:...@@ -82,20 +82,15 @@ _start:
82 {82 {
83 addl r11 = @ltoff(__libc_ia64_register_backing_store_base), gp83 addl r11 = @ltoff(__libc_ia64_register_backing_store_base), gp
84 addl out0 = @ltoff(@fptr(main)), gp84 addl out0 = @ltoff(@fptr(main)), gp
85 addl out3 = @ltoff(@fptr(__libc_csu_init)), gp85 mov out3 = r0 /* Used to be init. */
86 ;;86 ;;
87 }87 }
88 { .mmi88 { .mmi
89 ld8 r3 = [r11] /* pointer to __libc_ia64_register_backing_store_base */89 ld8 r3 = [r11] /* pointer to __libc_ia64_register_backing_store_base */
90 ld8 out0 = [out0] /* pointer to `main' function descriptor */90 ld8 out0 = [out0] /* pointer to `main' function descriptor */
91 addl out4 = @ltoff(@fptr(__libc_csu_fini)), gp91 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 .body94 .body
100 { .mib95 { .mib
101 st8 [r3] = r1096 st8 [r3] = r10
lib/libc/glibc/sysdeps/ia64/sysdep.h+1-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 2000-2020 Free Software Foundation, Inc.1/* Copyright (C) 2000-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
3 Contributed by David Mosberger-Tang <davidm@hpl.hp.com>3 Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
44
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,5 +1,5 @@
1/* Assembler macros for Coldfire.1/* Assembler macros for Coldfire.
2 Copyright (C) 1998-2020 Free Software Foundation, Inc.2 Copyright (C) 1998-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Special .init and .fini section support for m68k.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Special .init and .fini section support for m68k.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Assembler macros for m680x0.1/* Assembler macros for m680x0.
2 Copyright (C) 2010-2020 Free Software Foundation, Inc.2 Copyright (C) 2010-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,4 +1,4 @@
1/* Copyright (C) 2010-2020 Free Software Foundation, Inc.1/* Copyright (C) 2010-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
3 Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.3 Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
44
lib/libc/glibc/sysdeps/m68k/start.S+5-10
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Startup code compliant to the ELF m68k ABI.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -76,15 +76,14 @@ _start:...@@ -76,15 +76,14 @@ _start:
76 pea (%a1) /* Push address of the shared library76 pea (%a1) /* Push address of the shared library
77 termination function. */77 termination function. */
7878
79 /* These used to be addresses of the .fini and .init entry points. */
80 clr.l -(%sp)
81 clr.l -(%sp)
82
79#ifdef PIC83#ifdef PIC
80 /* Load PIC register. */84 /* Load PIC register. */
81 LOAD_GOT (%a5)85 LOAD_GOT (%a5)
8286
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 pea (%a0) /* Push second argument: argv. */87 pea (%a0) /* Push second argument: argv. */
89 move.l %d0, -(%sp) /* Push first argument: argc. */88 move.l %d0, -(%sp) /* Push first argument: argc. */
9089
...@@ -94,10 +93,6 @@ _start:...@@ -94,10 +93,6 @@ _start:
94 let the libc call main. */93 let the libc call main. */
95 jbsr __libc_start_main@PLTPC94 jbsr __libc_start_main@PLTPC
96#else95#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
10196
102 pea (%a0) /* Push second argument: argv. */97 pea (%a0) /* Push second argument: argv. */
103 move.l %d0, -(%sp) /* Push first argument: argc. */98 move.l %d0, -(%sp) /* Push first argument: argc. */
lib/libc/glibc/sysdeps/m68k/symbol-hacks.h+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Hacks needed for symbol manipulation. m68k version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Assembler macros for m68k.1/* Assembler macros for m68k.
2 Copyright (C) 1998-2020 Free Software Foundation, Inc.2 Copyright (C) 1998-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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
35struct 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
107struct 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. */
250extern int chflags (__const char *__file, unsigned long int __flags) __THROW;
251
252/* Set file flags of the file referred to by FD to FLAGS. */
253extern 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,4 +1,4 @@
1/* Copyright (C) 1991-2020 Free Software Foundation, Inc.1/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
22
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
...@@ -39,16 +39,6 @@...@@ -39,16 +39,6 @@
39 envp = p; \39 envp = p; \
40 } while (0)40 } while (0)
4141
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#define RETURN_TO(sp, pc, retval) \42#define RETURN_TO(sp, pc, retval) \
53 asm volatile ("movl %0, %%esp; jmp %*%1 # %2" \43 asm volatile ("movl %0, %%esp; jmp %*%1 # %2" \
54 : : "g" (sp), "r" (pc), "a" (retval))44 : : "g" (sp), "r" (pc), "a" (retval))
lib/libc/glibc/sysdeps/mach/libc-lock.h+11-14
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* libc-internal interface for mutex locks. Mach cthreads version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -24,9 +24,6 @@...@@ -24,9 +24,6 @@
24#include <tls.h>24#include <tls.h>
25#include <lowlevellock.h>25#include <lowlevellock.h>
2626
27/* The locking here is very inexpensive, even for inlining. */
28#define _IO_lock_inexpensive 1
29
30typedef unsigned int __libc_lock_t;27typedef unsigned int __libc_lock_t;
31typedef struct28typedef struct
32{29{
...@@ -57,13 +54,13 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;...@@ -57,13 +54,13 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
57 CLASS __libc_lock_t NAME;54 CLASS __libc_lock_t NAME;
5855
59/* Define an initialized lock variable NAME with storage class CLASS. */56/* Define an initialized lock variable NAME with storage class CLASS. */
60#define _LIBC_LOCK_INITIALIZER LLL_INITIALIZER57#define _LIBC_LOCK_INITIALIZER LLL_LOCK_INITIALIZER
61#define __libc_lock_define_initialized(CLASS,NAME) \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;
6360
64/* Initialize the named lock variable, leaving it in a consistent, unlocked61/* Initialize the named lock variable, leaving it in a consistent, unlocked
65 state. */62 state. */
66#define __libc_lock_init(NAME) (NAME) = LLL_INITIALIZER63#define __libc_lock_init(NAME) (NAME) = LLL_LOCK_INITIALIZER
6764
68/* Finalize the named lock variable, which must be locked. It cannot be65/* Finalize the named lock variable, which must be locked. It cannot be
69 used again until __libc_lock_init is called again on it. This must be66 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,19 +71,19 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
7471
75/* Lock the named lock variable. */72/* Lock the named lock variable. */
76#define __libc_lock_lock(NAME) \73#define __libc_lock_lock(NAME) \
77 ({ lll_lock (&(NAME), 0); 0; })74 ({ lll_lock ((NAME), 0); 0; })
7875
79/* Lock the named lock variable. */76/* Lock the named lock variable. */
80#define __libc_lock_trylock(NAME) lll_trylock (&(NAME))77#define __libc_lock_trylock(NAME) lll_trylock (NAME)
8178
82/* Unlock the named lock variable. */79/* Unlock the named lock variable. */
83#define __libc_lock_unlock(NAME) \80#define __libc_lock_unlock(NAME) \
84 ({ lll_unlock (&(NAME), 0); 0; })81 ({ lll_unlock ((NAME), 0); 0; })
8582
86#define __libc_lock_define_recursive(CLASS,NAME) \83#define __libc_lock_define_recursive(CLASS,NAME) \
87 CLASS __libc_lock_recursive_t NAME;84 CLASS __libc_lock_recursive_t NAME;
8885
89#define _LIBC_LOCK_RECURSIVE_INITIALIZER { LLL_INITIALIZER, 0, 0 }86#define _LIBC_LOCK_RECURSIVE_INITIALIZER { LLL_LOCK_INITIALIZER, 0, 0 }
9087
91#define __libc_lock_define_initialized_recursive(CLASS,NAME) \88#define __libc_lock_define_initialized_recursive(CLASS,NAME) \
92 CLASS __libc_lock_recursive_t NAME = _LIBC_LOCK_RECURSIVE_INITIALIZER;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,7 +108,7 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
111 int __r = 0; \108 int __r = 0; \
112 if (__self == __lock->owner) \109 if (__self == __lock->owner) \
113 ++__lock->cnt; \110 ++__lock->cnt; \
114 else if ((__r = lll_trylock (&__lock->lock)) == 0) \111 else if ((__r = lll_trylock (__lock->lock)) == 0) \
115 __lock->owner = __self, __lock->cnt = 1; \112 __lock->owner = __self, __lock->cnt = 1; \
116 __r; \113 __r; \
117 })114 })
...@@ -122,7 +119,7 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;...@@ -122,7 +119,7 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
122 void *__self = __libc_lock_owner_self (); \119 void *__self = __libc_lock_owner_self (); \
123 if (__self != __lock->owner) \120 if (__self != __lock->owner) \
124 { \121 { \
125 lll_lock (&__lock->lock, 0); \122 lll_lock (__lock->lock, 0); \
126 __lock->owner = __self; \123 __lock->owner = __self; \
127 } \124 } \
128 ++__lock->cnt; \125 ++__lock->cnt; \
...@@ -135,7 +132,7 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;...@@ -135,7 +132,7 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
135 if (--__lock->cnt == 0) \132 if (--__lock->cnt == 0) \
136 { \133 { \
137 __lock->owner = 0; \134 __lock->owner = 0; \
138 lll_unlock (&__lock->lock, 0); \135 lll_unlock (__lock->lock, 0); \
139 } \136 } \
140 })137 })
141138
lib/libc/glibc/sysdeps/mach/sysdep.h+1-9
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 1994-2020 Free Software Foundation, Inc.1/* Copyright (C) 1994-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -62,14 +62,6 @@...@@ -62,14 +62,6 @@
62#error SNARF_ARGS not defined by sysdeps/mach/MACHINE/sysdep.h62#error SNARF_ARGS not defined by sysdeps/mach/MACHINE/sysdep.h
63#endif63#endif
6464
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/* LOSE can be defined as the `halt' instruction or something65/* LOSE can be defined as the `halt' instruction or something
74 similar which will cause the process to die in a characteristic66 similar which will cause the process to die in a characteristic
75 way suggesting a bug. */67 way suggesting a bug. */
lib/libc/glibc/sysdeps/microblaze/crti.S+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Special .init and .fini section support for MicroBlaze.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Special .init and .fini section support for MicroBlaze.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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
44struct __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,4 +1,4 @@
1/* Copyright (C) 1995-2020 Free Software Foundation, Inc.1/* Copyright (C) 1995-2021 Free Software Foundation, Inc.
22
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
...@@ -63,14 +63,14 @@ _start:...@@ -63,14 +63,14 @@ _start:
63 mfs r20,rpc63 mfs r20,rpc
64 addik r20,r20,_GLOBAL_OFFSET_TABLE_+864 addik r20,r20,_GLOBAL_OFFSET_TABLE_+8
65 lwi r5,r20,main@GOT65 lwi r5,r20,main@GOT
66 lwi r8,r20,__libc_csu_init@GOT66 addk r8,r0,r0 /* Used to be init. */
67 lwi r9,r20,__libc_csu_fini@GOT67 addk r9,r0,r0 /* Used to be fini. */
68 brid __libc_start_main@PLT68 brid __libc_start_main@PLT
69 addk r10,r0,r069 addk r10,r0,r0
70#else70#else
71 addik r5,r0,main71 addik r5,r0,main
72 addik r8,r0,__libc_csu_init72 addk r8,r0,r0 /* Used to be init. */
73 addik r9,r0,__libc_csu_fini73 addk r9,r0,r0 /* Used to be fini. */
74 brid __libc_start_main74 brid __libc_start_main
75 addk r10,r0,r075 addk r10,r0,r0
76#endif76#endif
lib/libc/glibc/sysdeps/microblaze/sysdep.h+1-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 1997-2020 Free Software Foundation, Inc.1/* Copyright (C) 1997-2021 Free Software Foundation, Inc.
22
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
lib/libc/glibc/sysdeps/mips/dl-dtprocnum.h+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Configuration of lookup functions. MIPS version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Special .init and .fini section support for MIPS (o32).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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Special .init and .fini section support for MIPS (o32).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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Special .init and .fini section support for MIPS (n32).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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Special .init and .fini section support for MIPS (n32).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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Special .init and .fini section support for MIPS (n64).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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Special .init and .fini section support for MIPS (n64).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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Machine-specific pthread type layouts. MIPS version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Startup code compliant to the ELF Mips ABI.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -96,13 +96,13 @@ ENTRY_POINT:...@@ -96,13 +96,13 @@ ENTRY_POINT:
96# if _MIPS_SIM == _ABIO3296# if _MIPS_SIM == _ABIO32
97 PTR_SUBIU $29, 3297 PTR_SUBIU $29, 32
98# endif98# endif
99 PTR_LA $7, __libc_csu_init /* init */99 move $7, $0 /* Used to be init. */
100 PTR_LA $8, __libc_csu_fini
101# if _MIPS_SIM == _ABIO32100# if _MIPS_SIM == _ABIO32
102 PTR_S $8, 16($29) /* fini */101 PTR_S $0, 16($29) /* Used to be fini. */
103 PTR_S $2, 20($29) /* rtld_fini */102 PTR_S $2, 20($29) /* rtld_fini */
104 PTR_S $29, 24($29) /* stack_end */103 PTR_S $29, 24($29) /* stack_end */
105# else104# else
105 move $8, $0 /* Used to be fini. */
106 move $9, $2 /* rtld_fini */106 move $9, $2 /* rtld_fini */
107 move $10, $29 /* stack_end */107 move $10, $29 /* stack_end */
108# endif108# endif
...@@ -143,19 +143,17 @@ ENTRY_POINT:...@@ -143,19 +143,17 @@ ENTRY_POINT:
143 /* Lay out last arguments, and call __libc_start_main(). */143 /* Lay out last arguments, and call __libc_start_main(). */
144# ifdef __PIC__144# ifdef __PIC__
145 sw $7, 24($sp) /* stack_end */145 sw $7, 24($sp) /* stack_end */
146 lw $4, %got(__libc_csu_fini)($3)146 move $4, $0 /* Used to be ini. */
147 lw $7, %got(__libc_csu_init)($3) /* init */147 sw $0, 16($sp) /* Used to be fini. */
148 sw $4, 16($sp) /* fini */
149 lw $4, %got(main)($3) /* main */148 lw $4, %got(main)($3) /* main */
150 lw $3, %call16(__libc_start_main)($3)149 lw $3, %call16(__libc_start_main)($3)
151 sw $2, 20($sp) /* rtld_fini */150 sw $2, 20($sp) /* rtld_fini */
152 move $25, $3151 move $25, $3
153 jalr $3152 jalr $3
154# else153# else
155 lw $4, 1f
156 sw $7, 24($sp) /* stack_end */154 sw $7, 24($sp) /* stack_end */
157 lw $7, 2f /* init */155 move $7, $0 /* Used to be init. */
158 sw $4, 16($sp) /* fini */156 sw $0, 16($sp) /* Used to be fini. */
159 lw $4, 3f /* main */157 lw $4, 3f /* main */
160 sw $2, 20($sp) /* rtld_fini */158 sw $2, 20($sp) /* rtld_fini */
161 /* Load and call __libc_start_main(). */159 /* Load and call __libc_start_main(). */
...@@ -165,8 +163,6 @@ ENTRY_POINT:...@@ -165,8 +163,6 @@ ENTRY_POINT:
165hlt: b hlt /* Crash if somehow it does return. */163hlt: b hlt /* Crash if somehow it does return. */
166# ifndef __PIC__164# ifndef __PIC__
167 .align 2165 .align 2
1681: .word __libc_csu_fini
1692: .word __libc_csu_init
1703: .word main1663: .word main
1714: .word __libc_start_main1674: .word __libc_start_main
172# endif168# endif
lib/libc/glibc/sysdeps/nptl/bits/pthreadtypes.h+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Declaration of common pthread types for all architectures.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Common threading primitives definitions for both POSIX and C11.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -116,4 +116,14 @@ struct __pthread_cond_s...@@ -116,4 +116,14 @@ struct __pthread_cond_s
116 unsigned int __g_signals[2];116 unsigned int __g_signals[2];
117};117};
118118
119typedef unsigned int __tss_t;
120typedef unsigned long int __thrd_t;
121
122typedef struct
123{
124 int __data __ONCE_ALIGNMENT;
125} __once_flag;
126
127#define __ONCE_FLAG_INIT { 0 }
128
119#endif /* _THREAD_SHARED_TYPES_H */129#endif /* _THREAD_SHARED_TYPES_H */
lib/libc/glibc/sysdeps/nptl/libc-lock.h+31-30
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* libc-internal interface for mutex locks. NPTL version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,39 +143,40 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
143 __libc_maybe_call (__pthread_mutex_unlock, (&(NAME).mutex), 0)143 __libc_maybe_call (__pthread_mutex_unlock, (&(NAME).mutex), 0)
144#endif144#endif
145145
146/* Note that for I/O cleanup handling we are using the old-style146/* Put the unwind buffer BUFFER on the per-thread callback stack. The
147 cancel handling. It does not have to be integrated with C++ since147 caller must fill BUFFER->__routine and BUFFER->__arg before calling
148 no C++ code is called in the middle. The old-style handling is148 this function. */
149 faster and the support is not going away. */149void __libc_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer);
150extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer,150libc_hidden_proto (__libc_cleanup_push_defer)
151 void (*routine) (void *), void *arg);151/* Remove BUFFER from the unwind callback stack. The caller must invoke
152extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer,152 the callback if desired. */
153 int execute);153void __libc_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer);
154libc_hidden_proto (__libc_cleanup_pop_restore)
154155
155/* Start critical region with cleanup. */156/* Start critical region with cleanup. */
156#define __libc_cleanup_region_start(DOIT, FCT, ARG) \157#define __libc_cleanup_region_start(DOIT, FCT, ARG) \
157 { struct _pthread_cleanup_buffer _buffer; \158 { bool _cleanup_start_doit; \
158 int _avail; \159 struct _pthread_cleanup_buffer _buffer; \
159 if (DOIT) { \160 /* Non-addressable copy of FCT, so that we avoid indirect calls on \
160 _avail = PTFAVAIL (_pthread_cleanup_push_defer); \161 the non-unwinding path. */ \
161 if (_avail) { \162 void (*_cleanup_routine) (void *) = (FCT); \
162 __libc_ptf_call_always (_pthread_cleanup_push_defer, (&_buffer, FCT, \163 _buffer.__arg = (ARG); \
163 ARG)); \164 if (DOIT) \
164 } else { \165 { \
165 _buffer.__routine = (FCT); \166 _cleanup_start_doit = true; \
166 _buffer.__arg = (ARG); \167 _buffer.__routine = _cleanup_routine; \
167 } \168 __libc_cleanup_push_defer (&_buffer); \
168 } else { \169 } \
169 _avail = 0; \170 else \
170 }171 _cleanup_start_doit = false;
171172
172/* End critical region with cleanup. */173/* End critical region with cleanup. */
173#define __libc_cleanup_region_end(DOIT) \174#define __libc_cleanup_region_end(DOIT) \
174 if (_avail) { \175 if (_cleanup_start_doit) \
175 __libc_ptf_call_always (_pthread_cleanup_pop_restore, (&_buffer, DOIT));\176 __libc_cleanup_pop_restore (&_buffer); \
176 } else if (DOIT) \177 if (DOIT) \
177 _buffer.__routine (_buffer.__arg); \178 _cleanup_routine (_buffer.__arg); \
178 }179 } /* matches __libc_cleanup_region_start */
179180
180181
181/* Hide the definitions which are only supposed to be used inside libc in182/* 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,5 +1,5 @@
1/* Private libc-internal interface for mutex locks. NPTL version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -32,26 +32,12 @@...@@ -32,26 +32,12 @@
32 ld.so might be used on old kernels with a different libc.so. */32 ld.so might be used on old kernels with a different libc.so. */
33#include <lowlevellock.h>33#include <lowlevellock.h>
34#include <tls.h>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
4235
43/* Mutex type. */36/* Mutex type. */
44#if !IS_IN (libc) && !IS_IN (libpthread)
45typedef pthread_mutex_t __libc_lock_t;
46#else
47typedef int __libc_lock_t;37typedef int __libc_lock_t;
48#endif
49typedef struct { pthread_mutex_t mutex; } __rtld_lock_recursive_t;38typedef struct { pthread_mutex_t mutex; } __rtld_lock_recursive_t;
50typedef pthread_rwlock_t __libc_rwlock_t;39typedef pthread_rwlock_t __libc_rwlock_t;
5140
52/* Type for key to thread-specific data. */
53typedef pthread_key_t __libc_key_t;
54
55/* Define a lock variable NAME with storage class CLASS. The lock must be41/* Define a lock variable NAME with storage class CLASS. The lock must be
56 initialized with __libc_lock_init before it can be used (or define it42 initialized with __libc_lock_init before it can be used (or define it
57 with __libc_lock_define_initialized, below). Use `extern' for CLASS to43 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,126 +89,48 @@ _Static_assert (LLL_LOCK_INITIALIZER == 0, "LLL_LOCK_INITIALIZER != 0");
103 (FUNC != NULL ? FUNC ARGS : ELSE)89 (FUNC != NULL ? FUNC ARGS : ELSE)
104#endif90#endif
10591
106/* Call thread functions through the function pointer table. */92/* All previously forwarded functions are now called directly (either
107#if defined SHARED && IS_IN (libc)93 via local call in libc, or through a __export), but __libc_ptf_call
108# define PTFAVAIL(NAME) __libc_pthread_functions_init94 is still used in generic code shared with Hurd. */
109# define __libc_ptf_call(FUNC, ARGS, ELSE) \95#define PTFAVAIL(NAME) 1
110 (__libc_pthread_functions_init ? PTHFCT_CALL (ptr_##FUNC, ARGS) : ELSE)96#define __libc_ptf_call(FUNC, ARGS, ELSE) FUNC ARGS
111# define __libc_ptf_call_always(FUNC, ARGS) \97#define __libc_ptf_call_always(FUNC, ARGS) 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
12798
128/* Initialize the named lock variable, leaving it in a consistent, unlocked99/* Initialize the named lock variable, leaving it in a consistent, unlocked
129 state. */100 state. */
130#if IS_IN (libc) || IS_IN (libpthread)101#define __libc_lock_init(NAME) ((void) ((NAME) = LLL_LOCK_INITIALIZER))
131# define __libc_lock_init(NAME) \102#define __libc_rwlock_init(NAME) __pthread_rwlock_init (&(NAME), NULL)
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
145103
146/* Finalize the named lock variable, which must be locked. It cannot be104/* Finalize the named lock variable, which must be locked. It cannot be
147 used again until __libc_lock_init is called again on it. This must be105 used again until __libc_lock_init is called again on it. This must be
148 called on a lock variable before the containing storage is reused. */106 called on a lock variable before the containing storage is reused. */
149#if IS_IN (libc) || IS_IN (libpthread)107#define __libc_lock_fini(NAME) ((void) 0)
150# define __libc_lock_fini(NAME) ((void) 0)108#define __libc_rwlock_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
161109
162/* Lock the named lock variable. */110/* Lock the named lock variable. */
163#if IS_IN (libc) || IS_IN (libpthread)111#define __libc_lock_lock(NAME) ({ lll_lock (NAME, LLL_PRIVATE); 0; })
164# ifndef __libc_lock_lock112#define __libc_rwlock_rdlock(NAME) __pthread_rwlock_rdlock (&(NAME))
165# define __libc_lock_lock(NAME) \113#define __libc_rwlock_wrlock(NAME) __pthread_rwlock_wrlock (&(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)
177114
178/* Try to lock the named lock variable. */115/* Try to lock the named lock variable. */
179#if IS_IN (libc) || IS_IN (libpthread)116#define __libc_lock_trylock(NAME) lll_trylock (NAME)
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)
196117
197/* Unlock the named lock variable. */118/* Unlock the named lock variable. */
198#if IS_IN (libc) || IS_IN (libpthread)119#define __libc_lock_unlock(NAME) lll_unlock (NAME, LLL_PRIVATE)
199# define __libc_lock_unlock(NAME) \120#define __libc_rwlock_unlock(NAME) __pthread_rwlock_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;
214121
122#if IS_IN (rtld)
215# define __rtld_lock_lock_recursive(NAME) \123# define __rtld_lock_lock_recursive(NAME) \
216 GL(dl_rtld_lock_recursive) (&(NAME).mutex)124 ___rtld_mutex_lock (&(NAME).mutex)
217125
218# define __rtld_lock_unlock_recursive(NAME) \126# define __rtld_lock_unlock_recursive(NAME) \
219 GL(dl_rtld_unlock_recursive) (&(NAME).mutex)127 ___rtld_mutex_unlock (&(NAME).mutex)
220#else128#else /* Not in the dynamic loader. */
221# define __rtld_lock_lock_recursive(NAME) \129# define __rtld_lock_lock_recursive(NAME) \
222 __libc_maybe_call (__pthread_mutex_lock, (&(NAME).mutex), 0)130 __pthread_mutex_lock (&(NAME).mutex)
223131
224# define __rtld_lock_unlock_recursive(NAME) \132# define __rtld_lock_unlock_recursive(NAME) \
225 __libc_maybe_call (__pthread_mutex_unlock, (&(NAME).mutex), 0)133 __pthread_mutex_unlock (&(NAME).mutex)
226#endif134#endif
227135
228/* Define once control variable. */136/* Define once control variable. */
...@@ -236,74 +144,42 @@ _Static_assert (LLL_LOCK_INITIALIZER == 0, "LLL_LOCK_INITIALIZER != 0");...@@ -236,74 +144,42 @@ _Static_assert (LLL_LOCK_INITIALIZER == 0, "LLL_LOCK_INITIALIZER != 0");
236 CLASS pthread_once_t NAME = PTHREAD_ONCE_INIT144 CLASS pthread_once_t NAME = PTHREAD_ONCE_INIT
237#endif145#endif
238146
239/* Call handler iff the first call. */147/* Call handler iff the first call. Use a local call in libc, but the
240#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \148 global pthread_once symbol elsewhere. */
241 do { \149#if IS_IN (libc)
242 if (PTFAVAIL (__pthread_once)) \150# define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
243 __libc_ptf_call_always (__pthread_once, (&(ONCE_CONTROL), \151 __pthread_once (&(ONCE_CONTROL), INIT_FUNCTION)
244 INIT_FUNCTION)); \152#else
245 else if ((ONCE_CONTROL) == PTHREAD_ONCE_INIT) { \153# define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
246 INIT_FUNCTION (); \154 pthread_once (&(ONCE_CONTROL), INIT_FUNCTION)
247 (ONCE_CONTROL) |= 2; \155#endif
248 } \
249 } while (0)
250156
251/* Get once control variable. */157/* Get once control variable. */
252#define __libc_once_get(ONCE_CONTROL) ((ONCE_CONTROL) != PTHREAD_ONCE_INIT)158#define __libc_once_get(ONCE_CONTROL) ((ONCE_CONTROL) != PTHREAD_ONCE_INIT)
253159
254/* Note that for I/O cleanup handling we are using the old-style160/* __libc_cleanup_push and __libc_cleanup_pop depend on exception
255 cancel handling. It does not have to be integrated with C++ snce161 handling and stack unwinding. */
256 no C++ code is called in the middle. The old-style handling is162#ifdef __EXCEPTIONS
257 faster and the support is not going away. */
258extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *buffer,
259 void (*routine) (void *), void *arg);
260extern void _pthread_cleanup_pop (struct _pthread_cleanup_buffer *buffer,
261 int execute);
262extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer,
263 void (*routine) (void *), void *arg);
264extern 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
274163
275/* Normal cleanup handling, based on C cleanup attribute. */164/* Normal cleanup handling, based on C cleanup attribute. */
276__extern_inline void165static __always_inline void
277__libc_cleanup_routine (struct __pthread_cleanup_frame *f)166__libc_cleanup_routine (struct __pthread_cleanup_frame *f)
278{167{
279 if (f->__do_it)168 if (f->__do_it)
280 f->__cancel_routine (f->__cancel_arg);169 f->__cancel_routine (f->__cancel_arg);
281}170}
282171
283#define __libc_cleanup_push(fct, arg) \172# define __libc_cleanup_push(fct, arg) \
284 do { \173 do { \
285 struct __pthread_cleanup_frame __clframe \174 struct __pthread_cleanup_frame __clframe \
286 __attribute__ ((__cleanup__ (__libc_cleanup_routine))) \175 __attribute__ ((__cleanup__ (__libc_cleanup_routine))) \
287 = { .__cancel_routine = (fct), .__cancel_arg = (arg), \176 = { .__cancel_routine = (fct), .__cancel_arg = (arg), \
288 .__do_it = 1 };177 .__do_it = 1 };
289178
290#define __libc_cleanup_pop(execute) \179# define __libc_cleanup_pop(execute) \
291 __clframe.__do_it = (execute); \180 __clframe.__do_it = (execute); \
292 } while (0)181 } while (0)
293182#endif /* __EXCEPTIONS */
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
307183
308/* Register handlers to execute before and after `fork'. Note that the184/* Register handlers to execute before and after `fork'. Note that the
309 last parameter is NULL. The handlers registered by the libc are185 last parameter is NULL. The handlers registered by the libc are
...@@ -318,107 +194,56 @@ extern int __register_atfork (void (*__prepare) (void),...@@ -318,107 +194,56 @@ extern int __register_atfork (void (*__prepare) (void),
318194
319extern int __pthread_mutex_init (pthread_mutex_t *__mutex,195extern int __pthread_mutex_init (pthread_mutex_t *__mutex,
320 const pthread_mutexattr_t *__mutex_attr);196 const pthread_mutexattr_t *__mutex_attr);
321197libc_hidden_proto (__pthread_mutex_init)
322extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex);198extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex);
323199libc_hidden_proto (__pthread_mutex_destroy)
324extern int __pthread_mutex_trylock (pthread_mutex_t *__mutex);200extern int __pthread_mutex_trylock (pthread_mutex_t *__mutex);
325201
326extern int __pthread_mutex_lock (pthread_mutex_t *__mutex);202extern int __pthread_mutex_lock (pthread_mutex_t *__mutex);
327203libc_hidden_proto (__pthread_mutex_lock)
328extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex);204extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex);
329205libc_hidden_proto (__pthread_mutex_unlock)
330extern int __pthread_mutexattr_init (pthread_mutexattr_t *__attr);
331206
332extern int __pthread_mutexattr_destroy (pthread_mutexattr_t *__attr);207extern int __pthread_mutexattr_destroy (pthread_mutexattr_t *__attr);
333208
334extern int __pthread_mutexattr_settype (pthread_mutexattr_t *__attr,
335 int __kind);
336
337extern int __pthread_rwlock_init (pthread_rwlock_t *__rwlock,209extern int __pthread_rwlock_init (pthread_rwlock_t *__rwlock,
338 const pthread_rwlockattr_t *__attr);210 const pthread_rwlockattr_t *__attr);
211libc_hidden_proto (__pthread_rwlock_init)
339212
340extern int __pthread_rwlock_destroy (pthread_rwlock_t *__rwlock);213extern int __pthread_rwlock_destroy (pthread_rwlock_t *__rwlock);
341214
342extern int __pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock);215extern int __pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock);
343216libc_hidden_proto (__pthread_rwlock_rdlock)
344extern int __pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock);
345217
346extern int __pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock);218extern int __pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock);
347219libc_hidden_proto (__pthread_rwlock_wrlock)
348extern int __pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock);
349220
350extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock);221extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock);
351222libc_hidden_proto (__pthread_rwlock_unlock)
352extern int __pthread_key_create (pthread_key_t *__key,
353 void (*__destr_function) (void *));
354
355extern int __pthread_setspecific (pthread_key_t __key,
356 const void *__pointer);
357
358extern void *__pthread_getspecific (pthread_key_t __key);
359
360extern int __pthread_once (pthread_once_t *__once_control,223extern int __pthread_once (pthread_once_t *__once_control,
361 void (*__init_routine) (void));224 void (*__init_routine) (void));
225libc_hidden_proto (__pthread_once)
362226
363extern int __pthread_atfork (void (*__prepare) (void),227extern int __pthread_atfork (void (*__prepare) (void),
364 void (*__parent) (void),228 void (*__parent) (void),
365 void (*__child) (void));229 void (*__child) (void));
366230
367extern int __pthread_setcancelstate (int state, int *oldstate);231extern int __pthread_setcancelstate (int state, int *oldstate);
368232libc_hidden_proto (__pthread_setcancelstate)
369233
370/* Make the pthread functions weak so that we can elide them from234/* Make the pthread functions weak so that we can elide them from
371 single-threaded processes. */235 single-threaded processes. */
372#ifndef __NO_WEAK_PTHREAD_ALIASES236#ifndef __NO_WEAK_PTHREAD_ALIASES
373# ifdef weak_extern237# ifdef weak_extern
374weak_extern (__pthread_mutex_init)
375weak_extern (__pthread_mutex_destroy)
376weak_extern (__pthread_mutex_lock)
377weak_extern (__pthread_mutex_trylock)238weak_extern (__pthread_mutex_trylock)
378weak_extern (__pthread_mutex_unlock)
379weak_extern (__pthread_mutexattr_init)
380weak_extern (__pthread_mutexattr_destroy)239weak_extern (__pthread_mutexattr_destroy)
381weak_extern (__pthread_mutexattr_settype)
382weak_extern (__pthread_rwlock_init)
383weak_extern (__pthread_rwlock_destroy)
384weak_extern (__pthread_rwlock_rdlock)
385weak_extern (__pthread_rwlock_tryrdlock)
386weak_extern (__pthread_rwlock_wrlock)
387weak_extern (__pthread_rwlock_trywrlock)
388weak_extern (__pthread_rwlock_unlock)
389weak_extern (__pthread_key_create)
390weak_extern (__pthread_setspecific)
391weak_extern (__pthread_getspecific)
392weak_extern (__pthread_once)
393weak_extern (__pthread_initialize)240weak_extern (__pthread_initialize)
394weak_extern (__pthread_atfork)241weak_extern (__pthread_atfork)
395weak_extern (__pthread_setcancelstate)
396weak_extern (_pthread_cleanup_push_defer)
397weak_extern (_pthread_cleanup_pop_restore)
398# else242# else
399# pragma weak __pthread_mutex_init
400# pragma weak __pthread_mutex_destroy
401# pragma weak __pthread_mutex_lock
402# pragma weak __pthread_mutex_trylock243# pragma weak __pthread_mutex_trylock
403# pragma weak __pthread_mutex_unlock
404# pragma weak __pthread_mutexattr_init
405# pragma weak __pthread_mutexattr_destroy244# 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# pragma weak __pthread_initialize245# pragma weak __pthread_initialize
418# pragma weak __pthread_atfork246# pragma weak __pthread_atfork
419# pragma weak __pthread_setcancelstate
420# pragma weak _pthread_cleanup_push_defer
421# pragma weak _pthread_cleanup_pop_restore
422# endif247# endif
423#endif248#endif
424249
lib/libc/glibc/sysdeps/nptl/pthread.h+203-28
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 2002-2020 Free Software Foundation, Inc.1/* Copyright (C) 2002-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -27,7 +27,11 @@...@@ -27,7 +27,11 @@
27#include <bits/setjmp.h>27#include <bits/setjmp.h>
28#include <bits/wordsize.h>28#include <bits/wordsize.h>
29#include <bits/types/struct_timespec.h>29#include <bits/types/struct_timespec.h>
3030#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
3135
32/* Detach state. */36/* Detach state. */
33enum37enum
...@@ -219,6 +223,7 @@ extern int pthread_join (pthread_t __th, void **__thread_return);...@@ -219,6 +223,7 @@ extern int pthread_join (pthread_t __th, void **__thread_return);
219 the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL. */223 the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL. */
220extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW;224extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW;
221225
226# ifndef __USE_TIME_BITS64
222/* Make calling thread wait for termination of the thread TH, but only227/* Make calling thread wait for termination of the thread TH, but only
223 until TIMEOUT. The exit status of the thread is stored in228 until TIMEOUT. The exit status of the thread is stored in
224 *THREAD_RETURN, if THREAD_RETURN is not NULL.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,6 +243,23 @@ extern int pthread_timedjoin_np (pthread_t __th, void **__thread_return,
238extern int pthread_clockjoin_np (pthread_t __th, void **__thread_return,243extern int pthread_clockjoin_np (pthread_t __th, void **__thread_return,
239 clockid_t __clockid,244 clockid_t __clockid,
240 const struct timespec *__abstime);245 const struct timespec *__abstime);
246# else
247# ifdef __REDIRECT
248extern int __REDIRECT (pthread_timedjoin_np,
249 (pthread_t __th, void **__thread_return,
250 const struct timespec *__abstime),
251 __pthread_timedjoin_np64);
252
253extern 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#endif263#endif
242264
243/* Indicate that the thread TH is never to be joined with PTHREAD_JOIN.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,6 +407,20 @@ extern int pthread_attr_getaffinity_np (const pthread_attr_t *__attr,
385extern int pthread_getattr_default_np (pthread_attr_t *__attr)407extern int pthread_getattr_default_np (pthread_attr_t *__attr)
386 __THROW __nonnull ((1));408 __THROW __nonnull ((1));
387409
410/* Store *SIGMASK as the signal mask for the new thread in *ATTR. */
411extern 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. */
417extern 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/* Set the default attributes to be used by pthread_create in this424/* Set the default attributes to be used by pthread_create in this
389 process. */425 process. */
390extern int pthread_setattr_default_np (const pthread_attr_t *__attr)426extern int pthread_setattr_default_np (const pthread_attr_t *__attr)
...@@ -438,11 +474,14 @@ extern int pthread_setconcurrency (int __level) __THROW;...@@ -438,11 +474,14 @@ extern int pthread_setconcurrency (int __level) __THROW;
438#endif474#endif
439475
440#ifdef __USE_GNU476#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. */
445extern int pthread_yield (void) __THROW;477extern int pthread_yield (void) __THROW;
478# ifdef __REDIRECT_NTH
479extern int __REDIRECT_NTH (pthread_yield, (void), sched_yield)
480 __attribute_deprecated_msg__ ("\
481pthread_yield is deprecated, use sched_yield instead");
482# else
483# define pthread_yield sched_yield
484# endif
446485
447486
448/* Limit specified thread TH to run only on the processors represented487/* Limit specified thread TH to run only on the processors represented
...@@ -496,13 +535,15 @@ extern void pthread_testcancel (void);...@@ -496,13 +535,15 @@ extern void pthread_testcancel (void);
496535
497/* Cancellation handling with integration into exception handling. */536/* Cancellation handling with integration into exception handling. */
498537
538struct __cancel_jmp_buf_tag
539{
540 __jmp_buf __cancel_jmp_buf;
541 int __mask_was_saved;
542};
543
499typedef struct544typedef struct
500{545{
501 struct546 struct __cancel_jmp_buf_tag __cancel_jmp_buf[1];
502 {
503 __jmp_buf __cancel_jmp_buf;
504 int __mask_was_saved;
505 } __cancel_jmp_buf[1];
506 void *__pad[4];547 void *__pad[4];
507} __pthread_unwind_buf_t __attribute__ ((__aligned__));548} __pthread_unwind_buf_t __attribute__ ((__aligned__));
508549
...@@ -642,8 +683,8 @@ __pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame)...@@ -642,8 +683,8 @@ __pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame)
642 __pthread_unwind_buf_t __cancel_buf; \683 __pthread_unwind_buf_t __cancel_buf; \
643 void (*__cancel_routine) (void *) = (routine); \684 void (*__cancel_routine) (void *) = (routine); \
644 void *__cancel_arg = (arg); \685 void *__cancel_arg = (arg); \
645 int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \686 int __not_first_call = __sigsetjmp_cancel (__cancel_buf.__cancel_jmp_buf, \
646 __cancel_buf.__cancel_jmp_buf, 0); \687 0); \
647 if (__glibc_unlikely (__not_first_call)) \688 if (__glibc_unlikely (__not_first_call)) \
648 { \689 { \
649 __cancel_routine (__cancel_arg); \690 __cancel_routine (__cancel_arg); \
...@@ -677,8 +718,8 @@ extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf)...@@ -677,8 +718,8 @@ extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf)
677 __pthread_unwind_buf_t __cancel_buf; \718 __pthread_unwind_buf_t __cancel_buf; \
678 void (*__cancel_routine) (void *) = (routine); \719 void (*__cancel_routine) (void *) = (routine); \
679 void *__cancel_arg = (arg); \720 void *__cancel_arg = (arg); \
680 int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \721 int __not_first_call = __sigsetjmp_cancel (__cancel_buf.__cancel_jmp_buf, \
681 __cancel_buf.__cancel_jmp_buf, 0); \722 0); \
682 if (__glibc_unlikely (__not_first_call)) \723 if (__glibc_unlikely (__not_first_call)) \
683 { \724 { \
684 __cancel_routine (__cancel_arg); \725 __cancel_routine (__cancel_arg); \
...@@ -714,9 +755,24 @@ extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf)...@@ -714,9 +755,24 @@ extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf)
714 ;755 ;
715#endif756#endif
716757
717/* Function used in the macros. */758/* Function used in the macros. Calling __sigsetjmp, with its first
718struct __jmp_buf_tag;759 argument declared as an array, results in a -Wstringop-overflow
719extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL;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)
766extern 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))
773extern int __sigsetjmp (struct __jmp_buf_tag __env[1],
774 int __savemask) __THROWNL;
775#endif
720776
721777
722/* Mutex handling. */778/* Mutex handling. */
...@@ -740,16 +796,39 @@ extern int pthread_mutex_lock (pthread_mutex_t *__mutex)...@@ -740,16 +796,39 @@ extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
740796
741#ifdef __USE_XOPEN2K797#ifdef __USE_XOPEN2K
742/* Wait until lock becomes available, or specified time passes. */798/* Wait until lock becomes available, or specified time passes. */
799# ifndef __USE_TIME_BITS64
743extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,800extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
744 const struct timespec *__restrict801 const struct timespec *__restrict
745 __abstime) __THROWNL __nonnull ((1, 2));802 __abstime) __THROWNL __nonnull ((1, 2));
803# else
804# ifdef __REDIRECT_NTHNL
805extern 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#endif813#endif
747814
748#ifdef __USE_GNU815#ifdef __USE_GNU
816# ifndef __USE_TIME_BITS64
749extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex,817extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex,
750 clockid_t __clockid,818 clockid_t __clockid,
751 const struct timespec *__restrict819 const struct timespec *__restrict
752 __abstime) __THROWNL __nonnull ((1, 3));820 __abstime) __THROWNL __nonnull ((1, 3));
821# else
822# ifdef __REDIRECT_NTHNL
823extern 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#endif832#endif
754833
755/* Unlock a mutex. */834/* Unlock a mutex. */
...@@ -776,8 +855,14 @@ extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex,...@@ -776,8 +855,14 @@ extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex,
776extern int pthread_mutex_consistent (pthread_mutex_t *__mutex)855extern int pthread_mutex_consistent (pthread_mutex_t *__mutex)
777 __THROW __nonnull ((1));856 __THROW __nonnull ((1));
778# ifdef __USE_GNU857# ifdef __USE_GNU
779extern int pthread_mutex_consistent_np (pthread_mutex_t *__mutex)858# ifdef __REDIRECT_NTH
780 __THROW __nonnull ((1));859extern int __REDIRECT_NTH (pthread_mutex_consistent_np, (pthread_mutex_t *),
860 pthread_mutex_consistent) __nonnull ((1))
861 __attribute_deprecated_msg__ ("\
862pthread_mutex_consistent_np is deprecated, use pthread_mutex_consistent");
863# else
864# define pthread_mutex_consistent_np pthread_mutex_consistent
865# endif
781# endif866# endif
782#endif867#endif
783868
...@@ -846,9 +931,15 @@ extern int pthread_mutexattr_getrobust (const pthread_mutexattr_t *__attr,...@@ -846,9 +931,15 @@ extern int pthread_mutexattr_getrobust (const pthread_mutexattr_t *__attr,
846 int *__robustness)931 int *__robustness)
847 __THROW __nonnull ((1, 2));932 __THROW __nonnull ((1, 2));
848# ifdef __USE_GNU933# ifdef __USE_GNU
849extern int pthread_mutexattr_getrobust_np (const pthread_mutexattr_t *__attr,934# ifdef __REDIRECT_NTH
850 int *__robustness)935extern int __REDIRECT_NTH (pthread_mutexattr_getrobust_np,
851 __THROW __nonnull ((1, 2));936 (pthread_mutex_t *, int *),
937 pthread_mutexattr_getrobust) __nonnull ((1))
938 __attribute_deprecated_msg__ ("\
939pthread_mutexattr_getrobust_np is deprecated, use pthread_mutexattr_getrobust");
940# else
941# define pthread_mutexattr_getrobust_np pthread_mutexattr_getrobust
942# endif
852# endif943# endif
853944
854/* Set the robustness flag of the mutex attribute ATTR. */945/* Set the robustness flag of the mutex attribute ATTR. */
...@@ -856,13 +947,18 @@ extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,...@@ -856,13 +947,18 @@ extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
856 int __robustness)947 int __robustness)
857 __THROW __nonnull ((1));948 __THROW __nonnull ((1));
858# ifdef __USE_GNU949# ifdef __USE_GNU
859extern int pthread_mutexattr_setrobust_np (pthread_mutexattr_t *__attr,950# ifdef __REDIRECT_NTH
860 int __robustness)951extern int __REDIRECT_NTH (pthread_mutexattr_setrobust_np,
861 __THROW __nonnull ((1));952 (pthread_mutex_t *, int),
953 pthread_mutexattr_setrobust) __nonnull ((1))
954 __attribute_deprecated_msg__ ("\
955pthread_mutexattr_setrobust_np is deprecated, use pthread_mutexattr_setrobust");
956# else
957# define pthread_mutexattr_setrobust_np pthread_mutexattr_setrobust
958# endif
862# endif959# endif
863#endif960#endif
864961
865
866#if defined __USE_UNIX98 || defined __USE_XOPEN2K962#if defined __USE_UNIX98 || defined __USE_XOPEN2K
867/* Functions for handling read-write locks. */963/* Functions for handling read-write locks. */
868964
...@@ -886,16 +982,41 @@ extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock)...@@ -886,16 +982,41 @@ extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock)
886982
887# ifdef __USE_XOPEN2K983# ifdef __USE_XOPEN2K
888/* Try to acquire read lock for RWLOCK or return after specfied time. */984/* Try to acquire read lock for RWLOCK or return after specfied time. */
985# ifndef __USE_TIME_BITS64
889extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,986extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
890 const struct timespec *__restrict987 const struct timespec *__restrict
891 __abstime) __THROWNL __nonnull ((1, 2));988 __abstime) __THROWNL __nonnull ((1, 2));
989# else
990# ifdef __REDIRECT_NTHNL
991extern 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# endif1000# endif
8931001
894# ifdef __USE_GNU1002# ifdef __USE_GNU
1003# ifndef __USE_TIME_BITS64
895extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock,1004extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock,
896 clockid_t __clockid,1005 clockid_t __clockid,
897 const struct timespec *__restrict1006 const struct timespec *__restrict
898 __abstime) __THROWNL __nonnull ((1, 3));1007 __abstime) __THROWNL __nonnull ((1, 3));
1008# else
1009# ifdef __REDIRECT_NTHNL
1010extern 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# endif1020# endif
9001021
901/* Acquire write lock for RWLOCK. */1022/* Acquire write lock for RWLOCK. */
...@@ -908,16 +1029,42 @@ extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)...@@ -908,16 +1029,42 @@ extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)
9081029
909# ifdef __USE_XOPEN2K1030# ifdef __USE_XOPEN2K
910/* Try to acquire write lock for RWLOCK or return after specfied time. */1031/* Try to acquire write lock for RWLOCK or return after specfied time. */
1032# ifndef __USE_TIME_BITS64
911extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,1033extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
912 const struct timespec *__restrict1034 const struct timespec *__restrict
913 __abstime) __THROWNL __nonnull ((1, 2));1035 __abstime) __THROWNL __nonnull ((1, 2));
1036# else
1037# ifdef __REDIRECT_NTHNL
1038extern 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# endif1047# endif
9151048
916# ifdef __USE_GNU1049# ifdef __USE_GNU
1050# ifndef __USE_TIME_BITS64
917extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock,1051extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock,
918 clockid_t __clockid,1052 clockid_t __clockid,
919 const struct timespec *__restrict1053 const struct timespec *__restrict
920 __abstime) __THROWNL __nonnull ((1, 3));1054 __abstime) __THROWNL __nonnull ((1, 3));
1055
1056# else
1057# ifdef __REDIRECT_NTHNL
1058extern 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# endif1068# endif
9221069
923/* Unlock RWLOCK. */1070/* Unlock RWLOCK. */
...@@ -994,10 +1141,23 @@ extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,...@@ -994,10 +1141,23 @@ extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,
9941141
995 This function is a cancellation point and therefore not marked with1142 This function is a cancellation point and therefore not marked with
996 __THROW. */1143 __THROW. */
1144# ifndef __USE_TIME_BITS64
997extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,1145extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
998 pthread_mutex_t *__restrict __mutex,1146 pthread_mutex_t *__restrict __mutex,
999 const struct timespec *__restrict __abstime)1147 const struct timespec *__restrict __abstime)
1000 __nonnull ((1, 2, 3));1148 __nonnull ((1, 2, 3));
1149# else
1150# ifdef __REDIRECT
1151extern 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
10011161
1002# ifdef __USE_GNU1162# ifdef __USE_GNU
1003/* Wait for condition variable COND to be signaled or broadcast until1163/* 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,11 +1167,25 @@ extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
10071167
1008 This function is a cancellation point and therefore not marked with1168 This function is a cancellation point and therefore not marked with
1009 __THROW. */1169 __THROW. */
1170# ifndef __USE_TIME_BITS64
1010extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond,1171extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond,
1011 pthread_mutex_t *__restrict __mutex,1172 pthread_mutex_t *__restrict __mutex,
1012 __clockid_t __clock_id,1173 __clockid_t __clock_id,
1013 const struct timespec *__restrict __abstime)1174 const struct timespec *__restrict __abstime)
1014 __nonnull ((1, 2, 4));1175 __nonnull ((1, 2, 4));
1176# else
1177# ifdef __REDIRECT
1178extern 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# endif1189# endif
10161190
1017/* Functions for handling condition variable attributes. */1191/* Functions for handling condition variable attributes. */
...@@ -1132,7 +1306,8 @@ extern void *pthread_getspecific (pthread_key_t __key) __THROW;...@@ -1132,7 +1306,8 @@ extern void *pthread_getspecific (pthread_key_t __key) __THROW;
11321306
1133/* Store POINTER in the thread-specific data slot identified by KEY. */1307/* Store POINTER in the thread-specific data slot identified by KEY. */
1134extern int pthread_setspecific (pthread_key_t __key,1308extern int pthread_setspecific (pthread_key_t __key,
1135 const void *__pointer) __THROW ;1309 const void *__pointer)
1310 __THROW __attr_access_none (2);
11361311
11371312
1138#ifdef __USE_XOPEN2K1313#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
51struct __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,5 +1,5 @@
1/* Special .init and .fini section support for PowerPC.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Special .init and .fini section support for PowerPC.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Startup code for programs linked with GNU libc.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -52,8 +52,8 @@...@@ -52,8 +52,8 @@
52L(start_addresses):52L(start_addresses):
53 .long _SDA_BASE_53 .long _SDA_BASE_
54 .long main54 .long main
55 .long __libc_csu_init55 .long 0 /* Used to be init. */
56 .long __libc_csu_fini56 .long 0 /* Used to be fini. */
57 ASM_SIZE_DIRECTIVE(L(start_addresses))57 ASM_SIZE_DIRECTIVE(L(start_addresses))
5858
59 .section ".text"59 .section ".text"
lib/libc/glibc/sysdeps/powerpc/powerpc32/symbol-hacks.h+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Hacks needed for symbol manipulation. powerpc version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Assembly macros for 32-bit PowerPC.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -92,7 +92,10 @@ GOT_LABEL: ; \...@@ -92,7 +92,10 @@ GOT_LABEL: ; \
9292
93#define DO_CALL(syscall) \93#define DO_CALL(syscall) \
94 li 0,syscall; \94 li 0,syscall; \
95 sc95 DO_CALL_SC
96
97#define DO_CALL_SC \
98 sc
9699
97#undef JUMPTARGET100#undef JUMPTARGET
98#ifdef PIC101#ifdef PIC
...@@ -106,14 +109,20 @@ GOT_LABEL: ; \...@@ -106,14 +109,20 @@ GOT_LABEL: ; \
106# define HIDDEN_JUMPTARGET(name) __GI_##name##@local109# define HIDDEN_JUMPTARGET(name) __GI_##name##@local
107#endif110#endif
108111
112#define TAIL_CALL_SYSCALL_ERROR \
113 b __syscall_error@local
114
109#define PSEUDO(name, syscall_name, args) \115#define PSEUDO(name, syscall_name, args) \
110 .section ".text"; \116 .section ".text"; \
111 ENTRY (name) \117 ENTRY (name) \
112 DO_CALL (SYS_ify (syscall_name));118 DO_CALL (SYS_ify (syscall_name));
113119
120#define RET_SC \
121 bnslr+;
122
114#define PSEUDO_RET \123#define PSEUDO_RET \
115 bnslr+; \124 RET_SC; \
116 b __syscall_error@local125 TAIL_CALL_SYSCALL_ERROR
117#define ret PSEUDO_RET126#define ret PSEUDO_RET
118127
119#undef PSEUDO_END128#undef PSEUDO_END
...@@ -179,8 +188,8 @@ GOT_LABEL: ; \...@@ -179,8 +188,8 @@ GOT_LABEL: ; \
179#else188#else
180/* Position-dependent code does not require access to the GOT. */189/* Position-dependent code does not require access to the GOT. */
181# define __GLRO(rOUT, rGOT, member, offset) \190# define __GLRO(rOUT, rGOT, member, offset) \
182 lis rOUT,(member+LOWORD)@ha; \191 lis rOUT,(member)@ha; \
183 lwz rOUT,(member+LOWORD)@l(rOUT)192 lwz rOUT,(member)@l(rOUT)
184#endif /* PIC */193#endif /* PIC */
185194
186#endif /* __ASSEMBLER__ */195#endif /* __ASSEMBLER__ */
lib/libc/glibc/sysdeps/powerpc/powerpc64/crti.S+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Special .init and .fini section support for PowerPC64.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Special .init and .fini section support for PowerPC64.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Configuration of lookup functions. PowerPC64 version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Startup code for programs linked with GNU libc. PowerPC64 version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -53,8 +53,8 @@ L(start_addresses):...@@ -53,8 +53,8 @@ L(start_addresses):
53 .quad 0 /* was _SDA_BASE_ but not in 64-bit ABI*/53 .quad 0 /* was _SDA_BASE_ but not in 64-bit ABI*/
54/* function descriptors so don't need JUMPTARGET */54/* function descriptors so don't need JUMPTARGET */
55 .quad main55 .quad main
56 .quad __libc_csu_init56 .quad 0 /* Used to be init. */
57 .quad __libc_csu_fini57 .quad 0 /* Used to be fini. */
5858
59 ASM_SIZE_DIRECTIVE(L(start_addresses))59 ASM_SIZE_DIRECTIVE(L(start_addresses))
6060
lib/libc/glibc/sysdeps/powerpc/powerpc64/sysdep.h+126-8
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Assembly macros for 64-bit PowerPC.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -17,6 +17,7 @@...@@ -17,6 +17,7 @@
17 <https://www.gnu.org/licenses/>. */17 <https://www.gnu.org/licenses/>. */
1818
19#include <sysdeps/powerpc/sysdep.h>19#include <sysdeps/powerpc/sysdep.h>
20#include <tls.h>
2021
21#ifdef __ASSEMBLER__22#ifdef __ASSEMBLER__
2223
...@@ -263,10 +264,83 @@ LT_LABELSUFFIX(name,_name_end): ; \...@@ -263,10 +264,83 @@ LT_LABELSUFFIX(name,_name_end): ; \
263 TRACEBACK_MASK(name,mask); \264 TRACEBACK_MASK(name,mask); \
264 END_2(name)265 END_2(name)
265266
266#define DO_CALL(syscall) \267/* We will allocate a new frame to save LR and the non-volatile register used to
267 li 0,syscall; \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; \
3240: DO_CALL_SC; \
3251:
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 sc330 sc
269331
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/* ppc64 is always PIC */344/* ppc64 is always PIC */
271#undef JUMPTARGET345#undef JUMPTARGET
272#define JUMPTARGET(name) FUNC_LABEL(name)346#define JUMPTARGET(name) FUNC_LABEL(name)
...@@ -278,7 +352,7 @@ LT_LABELSUFFIX(name,_name_end): ; \...@@ -278,7 +352,7 @@ LT_LABELSUFFIX(name,_name_end): ; \
278352
279#ifdef SHARED353#ifdef SHARED
280#define TAIL_CALL_SYSCALL_ERROR \354#define TAIL_CALL_SYSCALL_ERROR \
281 b JUMPTARGET(__syscall_error)355 b JUMPTARGET (NOTOC (__syscall_error))
282#else356#else
283/* Static version might be linked into a large app with a toc exceeding357/* Static version might be linked into a large app with a toc exceeding
284 64k. We can't put a toc adjusting stub on a plain branch, so can't358 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,9 +378,33 @@ LT_LABELSUFFIX(name,_name_end): ; \
304 .endif378 .endif
305#endif379#endif
306380
307#define PSEUDO_RET \381#if !defined(USE_PPC_SCV) || IS_IN(rtld)
308 bnslr+; \382# define PSEUDO_RET \
383 RET_SC; \
309 TAIL_CALL_SYSCALL_ERROR384 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; \
3960: RET_SC; \
3971: 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+;
310408
311#define ret PSEUDO_RET409#define ret PSEUDO_RET
312410
...@@ -319,8 +417,15 @@ LT_LABELSUFFIX(name,_name_end): ; \...@@ -319,8 +417,15 @@ LT_LABELSUFFIX(name,_name_end): ; \
319 ENTRY (name); \417 ENTRY (name); \
320 DO_CALL (SYS_ify (syscall_name))418 DO_CALL (SYS_ify (syscall_name))
321419
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 blr427 blr
428#endif /* !defined(USE_PPC_SCV) || IS_IN(rtld) */
324429
325#define ret_NOERRNO PSEUDO_RET_NOERRNO430#define ret_NOERRNO PSEUDO_RET_NOERRNO
326431
...@@ -333,8 +438,15 @@ LT_LABELSUFFIX(name,_name_end): ; \...@@ -333,8 +438,15 @@ LT_LABELSUFFIX(name,_name_end): ; \
333 ENTRY (name); \438 ENTRY (name); \
334 DO_CALL (SYS_ify (syscall_name))439 DO_CALL (SYS_ify (syscall_name))
335440
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 blr448 blr
449#endif /* !defined(USE_PPC_SCV) || IS_IN(rtld) */
338450
339#define ret_ERRVAL PSEUDO_RET_ERRVAL451#define ret_ERRVAL PSEUDO_RET_ERRVAL
340452
...@@ -366,6 +478,12 @@ LT_LABELSUFFIX(name,_name_end): ; \...@@ -366,6 +478,12 @@ LT_LABELSUFFIX(name,_name_end): ; \
366 lwz rOUT,0(rOUT)478 lwz rOUT,0(rOUT)
367#endif479#endif
368480
481#ifdef USE_PPC64_NOTOC
482# define NOTOC(l) l@notoc
483#else
484# define NOTOC(l) l
485#endif
486
369#else /* !__ASSEMBLER__ */487#else /* !__ASSEMBLER__ */
370488
371#if _CALL_ELF != 2489#if _CALL_ELF != 2
lib/libc/glibc/sysdeps/powerpc/sysdep.h+1-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 1999-2020 Free Software Foundation, Inc.1/* Copyright (C) 1999-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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
36extern int __pthread_atfork (void (*prepare) (void), void (*parent) (void),
37 void (*child) (void));
38extern int __register_atfork (void (*__prepare) (void),
39 void (*__parent) (void),
40 void (*__child) (void),
41 void *dso_handle);
42libc_hidden_proto (__register_atfork)
43extern 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. */
47int
48#ifndef __pthread_atfork
49/* Don't mark the compatibility function as hidden. */
50attribute_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
58extern int pthread_atfork (void (*prepare) (void), void (*parent) (void),
59 void (*child) (void)) attribute_hidden;
60weak_alias (__pthread_atfork, pthread_atfork)
61#endif
lib/libc/glibc/sysdeps/riscv/nptl/bits/pthreadtypes-arch.h+16-12
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Machine-specific pthread type layouts. RISC-V version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -21,18 +21,22 @@...@@ -21,18 +21,22 @@
2121
22#include <bits/endian.h>22#include <bits/endian.h>
2323
24#if __riscv_xlen == 6424#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
25# define __SIZEOF_PTHREAD_ATTR_T 5625#define __SIZEOF_PTHREAD_COND_T 48
26# define __SIZEOF_PTHREAD_MUTEX_T 4026#define __SIZEOF_PTHREAD_CONDATTR_T 4
27# define __SIZEOF_PTHREAD_MUTEXATTR_T 427#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
28# define __SIZEOF_PTHREAD_COND_T 4828#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
29# define __SIZEOF_PTHREAD_CONDATTR_T 429
30# define __SIZEOF_PTHREAD_RWLOCK_T 5630#if __WORDSIZE == 64
31# define __SIZEOF_PTHREAD_RWLOCKATTR_T 831# define __SIZEOF_PTHREAD_ATTR_T 56
32# define __SIZEOF_PTHREAD_BARRIER_T 3232# define __SIZEOF_PTHREAD_MUTEX_T 40
33# define __SIZEOF_PTHREAD_BARRIERATTR_T 433# define __SIZEOF_PTHREAD_RWLOCK_T 56
34# define __SIZEOF_PTHREAD_BARRIER_T 32
34#else35#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#endif40#endif
3741
38#define __LOCK_ALIGNMENT42#define __LOCK_ALIGNMENT
lib/libc/glibc/sysdeps/riscv/start.S+3-3
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Startup code compliant to the ELF RISC-V ABI.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -54,8 +54,8 @@ ENTRY (ENTRY_POINT)...@@ -54,8 +54,8 @@ ENTRY (ENTRY_POINT)
54 REG_L a1, 0(sp) /* argc. */54 REG_L a1, 0(sp) /* argc. */
55 addi a2, sp, SZREG /* argv. */55 addi a2, sp, SZREG /* argv. */
56 andi sp, sp, ALMASK /* Align stack. */56 andi sp, sp, ALMASK /* Align stack. */
57 lla a3, __libc_csu_init57 li a3, 0 /* Used to be init. */
58 lla a4, __libc_csu_fini58 li a4, 0 /* Used to be fini. */
59 mv a6, sp /* stack_end. */59 mv a6, sp /* stack_end. */
6060
61 call __libc_start_main@plt61 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
50struct __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,5 +1,5 @@
1/* Special .init and .fini section support for S/390.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Special .init and .fini section support for S/390.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* System-specific settings for dynamic linker code. S/390 version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Startup code compliant to the ELF s390 ABI.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 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).3 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
4 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
...@@ -175,18 +175,16 @@ _start:...@@ -175,18 +175,16 @@ _start:
175 */175 */
176 stm %r14,%r15,96(%r15) # store rtld_fini/stack_end to parameter area176 stm %r14,%r15,96(%r15) # store rtld_fini/stack_end to parameter area
177 la %r7,96(%r15)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 l %r2,.L3-.Llit(%r13) # load pointer to main178 l %r2,.L3-.Llit(%r13) # load pointer to main
181 l %r1,.L4-.Llit(%r13) # load pointer to __libc_start_main179 l %r1,.L4-.Llit(%r13) # load pointer to __libc_start_main
182#ifdef PIC180#ifdef PIC
183 l %r12,.L5-.Llit(%r13) # load .got pointer181 l %r12,.L5-.Llit(%r13) # load .got pointer
184 la %r6,0(%r13,%r6)
185 la %r5,0(%r13,%r5)
186 la %r12,0(%r13,%r12)182 la %r12,0(%r13,%r12)
187 l %r2,0(%r12,%r2)183 l %r2,0(%r12,%r2)
188 la %r1,0(%r13,%r1)184 la %r1,0(%r13,%r1)
189#endif185#endif
186 lhi %r6, 0 # Used to fini.
187 lhi %r5, 0 # Used to init.
190188
191 /* ok, now branch to the libc main routine */189 /* ok, now branch to the libc main routine */
192 basr %r14,%r1190 basr %r14,%r1
...@@ -197,13 +195,9 @@ _start:...@@ -197,13 +195,9 @@ _start:
197 cfi_endproc195 cfi_endproc
198.Llit:196.Llit:
199#ifndef PIC197#ifndef PIC
200.L1: .long __libc_csu_init
201.L2: .long __libc_csu_fini
202.L3: .long main198.L3: .long main
203.L4: .long __libc_start_main199.L4: .long __libc_start_main
204#else200#else
205.L1: .long __libc_csu_init-.Llit
206.L2: .long __libc_csu_fini-.Llit
207.L3: .long main@GOT201.L3: .long main@GOT
208.L4: .long __libc_start_main@plt-.Llit202.L4: .long __libc_start_main@plt-.Llit
209.L5: .long _GLOBAL_OFFSET_TABLE_-.Llit203.L5: .long _GLOBAL_OFFSET_TABLE_-.Llit
lib/libc/glibc/sysdeps/s390/s390-32/symbol-hacks.h+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Hacks needed for symbol manipulation. s390 version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Assembler macros for s390.1/* Assembler macros for s390.
2 Copyright (C) 2000-2020 Free Software Foundation, Inc.2 Copyright (C) 2000-2021 Free Software Foundation, Inc.
3 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).3 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
4 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
lib/libc/glibc/sysdeps/s390/s390-64/crti.S+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Special .init and .fini section support for 64 bit S/390.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 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).3 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
4 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
lib/libc/glibc/sysdeps/s390/s390-64/crtn.S+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Special .init and .fini section support for 64 bit S/390.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 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).3 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
4 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
lib/libc/glibc/sysdeps/s390/s390-64/start.S+3-3
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Startup code compliant to the 64 bit S/390 ELF ABI.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 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).3 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
4 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
...@@ -80,8 +80,8 @@ _start:...@@ -80,8 +80,8 @@ _start:
80 */80 */
81 stmg %r14,%r15,160(%r15) # store rtld_fini/stack_end to parameter area81 stmg %r14,%r15,160(%r15) # store rtld_fini/stack_end to parameter area
82 la %r7,160(%r15)82 la %r7,160(%r15)
83 larl %r6,__libc_csu_fini # load pointer to __libc_csu_fini83 lghi %r6,0 # Used to be fini.
84 larl %r5,__libc_csu_init # load pointer to __libc_csu_init84 lghi %r5,0 # Used to be init.
8585
86 /* Ok, now branch to the libc main routine. */86 /* Ok, now branch to the libc main routine. */
87#ifdef PIC87#ifdef PIC
lib/libc/glibc/sysdeps/s390/s390-64/sysdep.h+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Assembler macros for 64 bit S/390.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 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).3 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
4 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
lib/libc/glibc/sysdeps/sh/crti.S+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Special .init and .fini section support for SH.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Special .init and .fini section support for SH.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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
43struct __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,5 +1,5 @@
1/* Startup code for SH & ELF.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -70,12 +70,11 @@ _start:...@@ -70,12 +70,11 @@ _start:
7070
71 /* Push the last arguments to main() onto the stack */71 /* Push the last arguments to main() onto the stack */
72 mov.l r4,@-r1572 mov.l r4,@-r15
73 mov.l L_fini,r073 mov.l r14,@-r15 /* Used to be fini. */
74 mov.l r0,@-r15
7574
76 /* Set up the other arguments for main() that go in registers */75 /* Set up the other arguments for main() that go in registers */
77 mov.l L_main,r476 mov.l L_main,r4
78 mov.l L_init,r777 mov #0,r7 /* Used to be init. */
7978
80 /* __libc_start_main (main, argc, argv, init, fini, rtld_fini) */79 /* __libc_start_main (main, argc, argv, init, fini, rtld_fini) */
8180
...@@ -90,10 +89,6 @@ _start:...@@ -90,10 +89,6 @@ _start:
90 .align 289 .align 2
91L_main:90L_main:
92 .long main91 .long main
93L_init:
94 .long __libc_csu_init
95L_fini:
96 .long __libc_csu_fini
97L_libc_start_main:92L_libc_start_main:
98 .long __libc_start_main93 .long __libc_start_main
99L_abort:94L_abort:
lib/libc/glibc/sysdeps/sh/sysdep.h+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Assembler macros for SH.1/* Assembler macros for SH.
2 Copyright (C) 1999-2020 Free Software Foundation, Inc.2 Copyright (C) 1999-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Special .init and .fini section support for sparc.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Special .init and .fini section support for sparc.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Configuration of lookup functions. SPARC version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* System-specific settings for dynamic linker code. SPARC version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Startup code for elf32-sparc1/* Startup code for elf32-sparc
2 Copyright (C) 1997-2020 Free Software Foundation, Inc.2 Copyright (C) 1997-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
4 Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.4 Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
55
...@@ -59,22 +59,14 @@ _start:...@@ -59,22 +59,14 @@ _start:
59 /* Load the addresses of the user entry points. */59 /* Load the addresses of the user entry points. */
60#ifndef PIC60#ifndef PIC
61 sethi %hi(main), %o061 sethi %hi(main), %o0
62 sethi %hi(__libc_csu_init), %o3
63 sethi %hi(__libc_csu_fini), %o4
64 or %o0, %lo(main), %o062 or %o0, %lo(main), %o0
65 or %o3, %lo(__libc_csu_init), %o3
66 or %o4, %lo(__libc_csu_fini), %o4
67#else63#else
68 sethi %gdop_hix22(main), %o064 sethi %gdop_hix22(main), %o0
69 sethi %gdop_hix22(__libc_csu_init), %o3
70 sethi %gdop_hix22(__libc_csu_fini), %o4
71 xor %o0, %gdop_lox10(main), %o065 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 ld [%l7 + %o0], %o0, %gdop(main)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#endif67#endif
68 mov 0, %o3 /* Used to be init. */
69 mov 0, %o4 /* Used to be fini. */
7870
79 /* When starting a binary via the dynamic linker, %g1 contains the71 /* When starting a binary via the dynamic linker, %g1 contains the
80 address of the shared library termination function, which will be72 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,5 +1,5 @@
1/* Startup code for elf64-sparc1/* Startup code for elf64-sparc
2 Copyright (C) 1997-2020 Free Software Foundation, Inc.2 Copyright (C) 1997-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
4 Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.4 Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
55
...@@ -60,22 +60,14 @@ _start:...@@ -60,22 +60,14 @@ _start:
60 /* Load the addresses of the user entry points. */60 /* Load the addresses of the user entry points. */
61#ifndef PIC61#ifndef PIC
62 sethi %hi(main), %o062 sethi %hi(main), %o0
63 sethi %hi(__libc_csu_init), %o3
64 sethi %hi(__libc_csu_fini), %o4
65 or %o0, %lo(main), %o063 or %o0, %lo(main), %o0
66 or %o3, %lo(__libc_csu_init), %o3
67 or %o4, %lo(__libc_csu_fini), %o4
68#else64#else
69 sethi %gdop_hix22(main), %o065 sethi %gdop_hix22(main), %o0
70 sethi %gdop_hix22(__libc_csu_init), %o3
71 sethi %gdop_hix22(__libc_csu_fini), %o4
72 xor %o0, %gdop_lox10(main), %o066 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 ldx [%l7 + %o0], %o0, %gdop(main)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#endif68#endif
69 mov 0, %o3 /* Used to be init. */
70 mov 0, %o4 /* Used to be fini. */
7971
80 /* When starting a binary via the dynamic linker, %g1 contains the72 /* When starting a binary via the dynamic linker, %g1 contains the
81 address of the shared library termination function, which will be73 address of the shared library termination function, which will be
lib/libc/glibc/sysdeps/sparc/sysdep.h+1-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 2011-2020 Free Software Foundation, Inc.1/* Copyright (C) 2011-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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))))
373extern 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
377extern 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,4 +1,4 @@
1/* Copyright (C) 1997-2020 Free Software Foundation, Inc.1/* Copyright (C) 1997-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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,4 +1,4 @@
1/* Copyright (C) 1991-2020 Free Software Foundation, Inc.1/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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,4 +1,4 @@
1/* Copyright (C) 1992-2020 Free Software Foundation, Inc.1/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
3 Contributed by Brendan Kehoe (brendan@zen.org).3 Contributed by Brendan Kehoe (brendan@zen.org).
44
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; \
45L(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; \
61L(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; \
45L(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; \
61L(syse1):
62#endif
63
64#endif
lib/libc/glibc/sysdeps/unix/mips/sysdep.h+1-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 1992-2020 Free Software Foundation, Inc.1/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
3 Contributed by Brendan Kehoe (brendan@zen.org).3 Contributed by Brendan Kehoe (brendan@zen.org).
44
lib/libc/glibc/sysdeps/unix/powerpc/sysdep.h+1-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 1991-2020 Free Software Foundation, Inc.1/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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,4 +1,4 @@
1/* Copyright (C) 1999-2020 Free Software Foundation, Inc.1/* Copyright (C) 1999-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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,4 +1,4 @@
1/* Copyright (C) 1991-2020 Free Software Foundation, Inc.1/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -28,24 +28,24 @@...@@ -28,24 +28,24 @@
28#define __SYSCALL_CONCAT(a,b) __SYSCALL_CONCAT_X (a, b)28#define __SYSCALL_CONCAT(a,b) __SYSCALL_CONCAT_X (a, b)
2929
3030
31#define __INTERNAL_SYSCALL0(name, err) \31#define __INTERNAL_SYSCALL0(name) \
32 INTERNAL_SYSCALL (name, err, 0)32 INTERNAL_SYSCALL (name, 0)
33#define __INTERNAL_SYSCALL1(name, err, a1) \33#define __INTERNAL_SYSCALL1(name, a1) \
34 INTERNAL_SYSCALL (name, err, 1, a1)34 INTERNAL_SYSCALL (name, 1, a1)
35#define __INTERNAL_SYSCALL2(name, err, a1, a2) \35#define __INTERNAL_SYSCALL2(name, a1, a2) \
36 INTERNAL_SYSCALL (name, err, 2, a1, a2)36 INTERNAL_SYSCALL (name, 2, a1, a2)
37#define __INTERNAL_SYSCALL3(name, err, a1, a2, a3) \37#define __INTERNAL_SYSCALL3(name, a1, a2, a3) \
38 INTERNAL_SYSCALL (name, err, 3, a1, a2, a3)38 INTERNAL_SYSCALL (name, 3, a1, a2, a3)
39#define __INTERNAL_SYSCALL4(name, err, a1, a2, a3, a4) \39#define __INTERNAL_SYSCALL4(name, a1, a2, a3, a4) \
40 INTERNAL_SYSCALL (name, err, 4, a1, a2, a3, a4)40 INTERNAL_SYSCALL (name, 4, a1, a2, a3, a4)
41#define __INTERNAL_SYSCALL5(name, err, a1, a2, a3, a4, a5) \41#define __INTERNAL_SYSCALL5(name, a1, a2, a3, a4, a5) \
42 INTERNAL_SYSCALL (name, err, 5, a1, a2, a3, a4, a5)42 INTERNAL_SYSCALL (name, 5, a1, a2, a3, a4, a5)
43#define __INTERNAL_SYSCALL6(name, err, a1, a2, a3, a4, a5, a6) \43#define __INTERNAL_SYSCALL6(name, a1, a2, a3, a4, a5, a6) \
44 INTERNAL_SYSCALL (name, err, 6, a1, a2, a3, a4, a5, a6)44 INTERNAL_SYSCALL (name, 6, a1, a2, a3, a4, a5, a6)
45#define __INTERNAL_SYSCALL7(name, err, a1, a2, a3, a4, a5, a6, a7) \45#define __INTERNAL_SYSCALL7(name, a1, a2, a3, a4, a5, a6, a7) \
46 INTERNAL_SYSCALL (name, err, 7, a1, a2, a3, a4, a5, a6, a7)46 INTERNAL_SYSCALL (name, 7, a1, a2, a3, a4, a5, a6, a7)
4747
48#define __INTERNAL_SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,o,...) o48#define __INTERNAL_SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,...) n
49#define __INTERNAL_SYSCALL_NARGS(...) \49#define __INTERNAL_SYSCALL_NARGS(...) \
50 __INTERNAL_SYSCALL_NARGS_X (__VA_ARGS__,7,6,5,4,3,2,1,0,)50 __INTERNAL_SYSCALL_NARGS_X (__VA_ARGS__,7,6,5,4,3,2,1,0,)
51#define __INTERNAL_SYSCALL_DISP(b,...) \51#define __INTERNAL_SYSCALL_DISP(b,...) \
...@@ -88,10 +88,17 @@...@@ -88,10 +88,17 @@
88#define INLINE_SYSCALL_CALL(...) \88#define INLINE_SYSCALL_CALL(...) \
89 __INLINE_SYSCALL_DISP (__INLINE_SYSCALL, __VA_ARGS__)89 __INLINE_SYSCALL_DISP (__INLINE_SYSCALL, __VA_ARGS__)
9090
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#define SYSCALL_CANCEL(...) \98#define SYSCALL_CANCEL(...) \
92 ({ \99 ({ \
93 long int sc_ret; \100 long int sc_ret; \
94 if (SINGLE_THREAD_P) \101 if (NO_SYSCALL_CANCEL_CHECKING) \
95 sc_ret = INLINE_SYSCALL_CALL (__VA_ARGS__); \102 sc_ret = INLINE_SYSCALL_CALL (__VA_ARGS__); \
96 else \103 else \
97 { \104 { \
...@@ -107,7 +114,7 @@...@@ -107,7 +114,7 @@
107#define INTERNAL_SYSCALL_CANCEL(...) \114#define INTERNAL_SYSCALL_CANCEL(...) \
108 ({ \115 ({ \
109 long int sc_ret; \116 long int sc_ret; \
110 if (SINGLE_THREAD_P) \117 if (NO_SYSCALL_CANCEL_CHECKING) \
111 sc_ret = INTERNAL_SYSCALL_CALL (__VA_ARGS__); \118 sc_ret = INTERNAL_SYSCALL_CALL (__VA_ARGS__); \
112 else \119 else \
113 { \120 { \
lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/kernel-features.h+1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1/* Set flags signalling availability of kernel features based on given1/* Set flags signalling availability of kernel features based on given
2 kernel version number. AArch64 version.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 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
6 The GNU C Library is free software; you can redistribute it and/or6 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,4 +1,4 @@
1/* Copyright (C) 1996-2020 Free Software Foundation, Inc.1/* Copyright (C) 1996-2021 Free Software Foundation, Inc.
22
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/sysdep.h+11-34
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 2005-2020 Free Software Foundation, Inc.1/* Copyright (C) 2005-2021 Free Software Foundation, Inc.
22
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
...@@ -164,29 +164,10 @@...@@ -164,29 +164,10 @@
164# define HAVE_CLOCK_GETTIME64_VSYSCALL "__kernel_clock_gettime"164# define HAVE_CLOCK_GETTIME64_VSYSCALL "__kernel_clock_gettime"
165# define HAVE_GETTIMEOFDAY_VSYSCALL "__kernel_gettimeofday"165# define HAVE_GETTIMEOFDAY_VSYSCALL "__kernel_gettimeofday"
166166
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# define SINGLE_THREAD_BY_GLOBAL 1167# define SINGLE_THREAD_BY_GLOBAL 1
172168
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# undef INTERNAL_SYSCALL_RAW169# undef INTERNAL_SYSCALL_RAW
189# define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \170# define INTERNAL_SYSCALL_RAW(name, nr, args...) \
190 ({ long _sys_result; \171 ({ long _sys_result; \
191 { \172 { \
192 LOAD_ARGS_##nr (args) \173 LOAD_ARGS_##nr (args) \
...@@ -198,19 +179,12 @@...@@ -198,19 +179,12 @@
198 _sys_result; })179 _sys_result; })
199180
200# undef INTERNAL_SYSCALL181# undef INTERNAL_SYSCALL
201# define INTERNAL_SYSCALL(name, err, nr, args...) \182# define INTERNAL_SYSCALL(name, nr, args...) \
202 INTERNAL_SYSCALL_RAW(SYS_ify(name), err, nr, args)183 INTERNAL_SYSCALL_RAW(SYS_ify(name), nr, args)
203184
204# undef INTERNAL_SYSCALL_AARCH64185# undef INTERNAL_SYSCALL_AARCH64
205# define INTERNAL_SYSCALL_AARCH64(name, err, nr, args...) \186# define INTERNAL_SYSCALL_AARCH64(name, nr, args...) \
206 INTERNAL_SYSCALL_RAW(__ARM_NR_##name, err, nr, args)187 INTERNAL_SYSCALL_RAW(__ARM_NR_##name, 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))
214188
215# define LOAD_ARGS_0() \189# define LOAD_ARGS_0() \
216 register long _x0 asm ("x0");190 register long _x0 asm ("x0");
...@@ -253,8 +227,11 @@...@@ -253,8 +227,11 @@
253# define ASM_ARGS_7 ASM_ARGS_6, "r" (_x6)227# define ASM_ARGS_7 ASM_ARGS_6, "r" (_x6)
254228
255# undef INTERNAL_SYSCALL_NCS229# undef INTERNAL_SYSCALL_NCS
256# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \230# define INTERNAL_SYSCALL_NCS(number, nr, args...) \
257 INTERNAL_SYSCALL_RAW (number, err, 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
258235
259#endif /* __ASSEMBLER__ */236#endif /* __ASSEMBLER__ */
260237
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
69struct 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. */
100struct 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,5 +1,5 @@
1/* bits/typesizes.h -- underlying types for *_t. Linux/Alpha version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -49,6 +49,7 @@...@@ -49,6 +49,7 @@
49#define __TIME_T_TYPE __SLONGWORD_TYPE49#define __TIME_T_TYPE __SLONGWORD_TYPE
50#define __USECONDS_T_TYPE __U32_TYPE50#define __USECONDS_T_TYPE __U32_TYPE
51#define __SUSECONDS_T_TYPE __S64_TYPE51#define __SUSECONDS_T_TYPE __S64_TYPE
52#define __SUSECONDS64_T_TYPE __S64_TYPE
52#define __DADDR_T_TYPE __S32_TYPE53#define __DADDR_T_TYPE __S32_TYPE
53#define __KEY_T_TYPE __S32_TYPE54#define __KEY_T_TYPE __S32_TYPE
54#define __CLOCKID_T_TYPE __S32_TYPE55#define __CLOCKID_T_TYPE __S32_TYPE
...@@ -72,6 +73,9 @@...@@ -72,6 +73,9 @@
72/* Not for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */73/* Not for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */
73# define __STATFS_MATCHES_STATFS64 074# define __STATFS_MATCHES_STATFS64 0
7475
76/* And for getitimer, setitimer and rusage */
77#define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1
78
75/* Number of descriptors that can fit in an `fd_set'. */79/* Number of descriptors that can fit in an `fd_set'. */
76#define __FD_SETSIZE 102480#define __FD_SETSIZE 1024
7781
lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/kernel-features.h+1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1/* Set flags signalling availability of kernel features based on given1/* Set flags signalling availability of kernel features based on given
2 kernel version number.2 kernel version number.
3 Copyright (C) 2010-2020 Free Software Foundation, Inc.3 Copyright (C) 2010-2021 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
6 The GNU C Library is free software; you can redistribute it and/or6 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,4 +1,4 @@
1/* Copyright (C) 1992-2020 Free Software Foundation, Inc.1/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.3 Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.
44
...@@ -19,14 +19,10 @@...@@ -19,14 +19,10 @@
19#ifndef _LINUX_ALPHA_SYSDEP_H19#ifndef _LINUX_ALPHA_SYSDEP_H
20#define _LINUX_ALPHA_SYSDEP_H 120#define _LINUX_ALPHA_SYSDEP_H 1
2121
22#ifdef __ASSEMBLER__
23#include <asm/pal.h>
24#include <alpha/regdef.h>
25#endif
26
27/* There is some commonality. */22/* There is some commonality. */
28#include <sysdeps/unix/sysv/linux/sysdep.h>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. */
3026
31#include <tls.h>27#include <tls.h>
3228
...@@ -39,4 +35,325 @@...@@ -39,4 +35,325 @@
3935
40#define SINGLE_THREAD_BY_GLOBAL 136#define SINGLE_THREAD_BY_GLOBAL 1
4137
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))))
348extern 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
352extern 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,6 +1,6 @@
1/* Set flags signalling availability of kernel features based on given1/* Set flags signalling availability of kernel features based on given
2 kernel version number.2 kernel version number.
3 Copyright (C) 2006-2020 Free Software Foundation, Inc.3 Copyright (C) 2006-2021 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
6 The GNU C Library is free software; you can redistribute it and/or6 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,4 +1,4 @@
1/* Copyright (C) 1996-2020 Free Software Foundation, Inc.1/* Copyright (C) 1996-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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,4 +1,4 @@
1/* Copyright (C) 1992-2020 Free Software Foundation, Inc.1/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.3 Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.
4 ARM changes by Philip Blundell, <pjb27@cam.ac.uk>, May 1997.4 ARM changes by Philip Blundell, <pjb27@cam.ac.uk>, May 1997.
...@@ -29,11 +29,6 @@...@@ -29,11 +29,6 @@
2929
30#include <tls.h>30#include <tls.h>
3131
32/* In order to get __set_errno() definition in INLINE_SYSCALL. */
33#ifndef __ASSEMBLER__
34#include <errno.h>
35#endif
36
37/* For Linux we can use the system call table in the header file32/* For Linux we can use the system call table in the header file
38 /usr/include/asm/unistd.h33 /usr/include/asm/unistd.h
39 of the kernel. But these symbols do not follow the SYS_* syntax34 of the kernel. But these symbols do not follow the SYS_* syntax
...@@ -317,21 +312,6 @@ __local_syscall_error: \...@@ -317,21 +312,6 @@ __local_syscall_error: \
317312
318#else /* not __ASSEMBLER__ */313#else /* not __ASSEMBLER__ */
319314
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#if defined(__thumb__)315#if defined(__thumb__)
336/* We can not expose the use of r7 to the compiler. GCC (as316/* We can not expose the use of r7 to the compiler. GCC (as
337 of 4.5) uses r7 as the hard frame pointer for Thumb - although317 of 4.5) uses r7 as the hard frame pointer for Thumb - although
...@@ -348,7 +328,7 @@ __local_syscall_error: \...@@ -348,7 +328,7 @@ __local_syscall_error: \
348 then unwinding will fail higher up the stack. So we move the328 then unwinding will fail higher up the stack. So we move the
349 syscall out of line and provide its own unwind information. */329 syscall out of line and provide its own unwind information. */
350# undef INTERNAL_SYSCALL_RAW330# undef INTERNAL_SYSCALL_RAW
351# define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \331# define INTERNAL_SYSCALL_RAW(name, nr, args...) \
352 ({ \332 ({ \
353 register int _a1 asm ("a1"); \333 register int _a1 asm ("a1"); \
354 int _nametmp = name; \334 int _nametmp = name; \
...@@ -361,7 +341,7 @@ __local_syscall_error: \...@@ -361,7 +341,7 @@ __local_syscall_error: \
361 _a1; })341 _a1; })
362#else /* ARM */342#else /* ARM */
363# undef INTERNAL_SYSCALL_RAW343# undef INTERNAL_SYSCALL_RAW
364# define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \344# define INTERNAL_SYSCALL_RAW(name, nr, args...) \
365 ({ \345 ({ \
366 register int _a1 asm ("r0"), _nr asm ("r7"); \346 register int _a1 asm ("r0"), _nr asm ("r7"); \
367 LOAD_ARGS_##nr (args) \347 LOAD_ARGS_##nr (args) \
...@@ -374,15 +354,8 @@ __local_syscall_error: \...@@ -374,15 +354,8 @@ __local_syscall_error: \
374#endif354#endif
375355
376#undef INTERNAL_SYSCALL356#undef INTERNAL_SYSCALL
377#define INTERNAL_SYSCALL(name, err, nr, args...) \357#define INTERNAL_SYSCALL(name, nr, args...) \
378 INTERNAL_SYSCALL_RAW(SYS_ify(name), err, nr, args)358 INTERNAL_SYSCALL_RAW(SYS_ify(name), 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))
386359
387#define VDSO_NAME "LINUX_2.6"360#define VDSO_NAME "LINUX_2.6"
388#define VDSO_HASH 61765110361#define VDSO_HASH 61765110
...@@ -434,8 +407,8 @@ __local_syscall_error: \...@@ -434,8 +407,8 @@ __local_syscall_error: \
434407
435/* For EABI, non-constant syscalls are actually pretty easy... */408/* For EABI, non-constant syscalls are actually pretty easy... */
436#undef INTERNAL_SYSCALL_NCS409#undef INTERNAL_SYSCALL_NCS
437#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \410#define INTERNAL_SYSCALL_NCS(number, nr, args...) \
438 INTERNAL_SYSCALL_RAW (number, err, nr, args)411 INTERNAL_SYSCALL_RAW (number, nr, args)
439412
440#define SINGLE_THREAD_BY_GLOBAL 1413#define SINGLE_THREAD_BY_GLOBAL 1
441414
lib/libc/glibc/sysdeps/unix/sysv/linux/bits/stat.h+2-114
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 1992-2020 Free Software Foundation, Inc.1/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -22,119 +22,7 @@...@@ -22,119 +22,7 @@
22#ifndef _BITS_STAT_H22#ifndef _BITS_STAT_H
23#define _BITS_STAT_H 123#define _BITS_STAT_H 1
2424
25/* Versions of the `struct stat' data structure. */25#include <bits/struct_stat.h>
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
38struct 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
95struct 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
13826
139/* Encoding of the file mode. */27/* Encoding of the file mode. */
14028
lib/libc/glibc/sysdeps/unix/sysv/linux/bits/timex.h+32-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 1995-2020 Free Software Foundation, Inc.1/* Copyright (C) 1995-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -25,6 +25,36 @@...@@ -25,6 +25,36 @@
2525
26struct timex26struct 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 unsigned int modes; /* mode selector */58 unsigned int modes; /* mode selector */
29 __syscall_slong_t offset; /* time offset (usec) */59 __syscall_slong_t offset; /* time offset (usec) */
30 __syscall_slong_t freq; /* frequency offset (scaled ppm) */60 __syscall_slong_t freq; /* frequency offset (scaled ppm) */
...@@ -51,6 +81,7 @@ struct timex...@@ -51,6 +81,7 @@ struct timex
51 int :32; int :32; int :32; int :32;81 int :32; int :32; int :32; int :32;
52 int :32; int :32; int :32; int :32;82 int :32; int :32; int :32; int :32;
53 int :32; int :32; int :32;83 int :32; int :32; int :32;
84# endif
54};85};
5586
56/* Mode codes (timex.mode) */87/* Mode codes (timex.mode) */
lib/libc/glibc/sysdeps/unix/sysv/linux/dl-sysdep.h+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* System-specific settings for dynamic linker code. Linux version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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
58struct 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
99struct 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,5 +1,5 @@
1/* bits/typesizes.h -- underlying types for *_t. For the generic Linux ABI.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
4 Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.4 Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
55
...@@ -26,31 +26,45 @@...@@ -26,31 +26,45 @@
2626
27/* See <bits/types.h> for the meaning of these macros. This file exists so27/* See <bits/types.h> for the meaning of these macros. This file exists so
28 that <bits/types.h> need not vary across different GNU platforms. */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
2950
30#define __DEV_T_TYPE __UQUAD_TYPE51#define __DEV_T_TYPE __UQUAD_TYPE
31#define __UID_T_TYPE __U32_TYPE52#define __UID_T_TYPE __U32_TYPE
32#define __GID_T_TYPE __U32_TYPE53#define __GID_T_TYPE __U32_TYPE
33#define __INO_T_TYPE __ULONGWORD_TYPE
34#define __INO64_T_TYPE __UQUAD_TYPE54#define __INO64_T_TYPE __UQUAD_TYPE
35#define __MODE_T_TYPE __U32_TYPE55#define __MODE_T_TYPE __U32_TYPE
36#define __NLINK_T_TYPE __U32_TYPE56#define __NLINK_T_TYPE __U32_TYPE
37#define __OFF_T_TYPE __SLONGWORD_TYPE
38#define __OFF64_T_TYPE __SQUAD_TYPE57#define __OFF64_T_TYPE __SQUAD_TYPE
39#define __PID_T_TYPE __S32_TYPE58#define __PID_T_TYPE __S32_TYPE
40#define __RLIM_T_TYPE __ULONGWORD_TYPE
41#define __RLIM64_T_TYPE __UQUAD_TYPE59#define __RLIM64_T_TYPE __UQUAD_TYPE
42#define __BLKCNT_T_TYPE __SLONGWORD_TYPE
43#define __BLKCNT64_T_TYPE __SQUAD_TYPE60#define __BLKCNT64_T_TYPE __SQUAD_TYPE
44#define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE
45#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE61#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE
46#define __FSFILCNT_T_TYPE __ULONGWORD_TYPE
47#define __FSFILCNT64_T_TYPE __UQUAD_TYPE62#define __FSFILCNT64_T_TYPE __UQUAD_TYPE
48#define __FSWORD_T_TYPE __SWORD_TYPE63#define __FSWORD_T_TYPE __SWORD_TYPE
49#define __ID_T_TYPE __U32_TYPE64#define __ID_T_TYPE __U32_TYPE
50#define __CLOCK_T_TYPE __SLONGWORD_TYPE65#define __CLOCK_T_TYPE __SLONGWORD_TYPE
51#define __TIME_T_TYPE __SLONGWORD_TYPE
52#define __USECONDS_T_TYPE __U32_TYPE66#define __USECONDS_T_TYPE __U32_TYPE
53#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE67#define __SUSECONDS64_T_TYPE __SQUAD_TYPE
54#define __DADDR_T_TYPE __S32_TYPE68#define __DADDR_T_TYPE __S32_TYPE
55#define __KEY_T_TYPE __S32_TYPE69#define __KEY_T_TYPE __S32_TYPE
56#define __CLOCKID_T_TYPE __S32_TYPE70#define __CLOCKID_T_TYPE __S32_TYPE
...@@ -62,7 +76,7 @@...@@ -62,7 +76,7 @@
62#define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE76#define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE
63#define __CPU_MASK_TYPE __ULONGWORD_TYPE77#define __CPU_MASK_TYPE __ULONGWORD_TYPE
6478
65#ifdef __LP64__79#if defined __LP64__ || (__TIMESIZE == 64 && __WORDSIZE == 32)
66/* Tell the libc code that off_t and off64_t are actually the same type80/* Tell the libc code that off_t and off64_t are actually the same type
67 for all ABI purposes, even if possibly expressed as different base types81 for all ABI purposes, even if possibly expressed as different base types
68 for C type-checking purposes. */82 for C type-checking purposes. */
...@@ -76,11 +90,17 @@...@@ -76,11 +90,17 @@
7690
77/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */91/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */
78# define __STATFS_MATCHES_STATFS64 192# define __STATFS_MATCHES_STATFS64 1
93
94/* And for getitimer, setitimer and rusage */
95# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 (__WORDSIZE == 64)
79#else96#else
80# define __RLIM_T_MATCHES_RLIM64_T 097# define __RLIM_T_MATCHES_RLIM64_T 0
8198
82# define __STATFS_MATCHES_STATFS64 099# define __STATFS_MATCHES_STATFS64 0
100
101# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0
83#endif102#endif
103
84/* Number of descriptors that can fit in an `fd_set'. */104/* Number of descriptors that can fit in an `fd_set'. */
85#define __FD_SETSIZE 1024105#define __FD_SETSIZE 1024
86106
lib/libc/glibc/sysdeps/unix/sysv/linux/generic/sysdep.h+1-9
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 2011-2020 Free Software Foundation, Inc.1/* Copyright (C) 2011-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
3 Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.3 Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
44
...@@ -25,11 +25,3 @@...@@ -25,11 +25,3 @@
25#ifdef __NR_llseek25#ifdef __NR_llseek
26# define __NR__llseek __NR_llseek26# define __NR__llseek __NR_llseek
27#endif27#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,6 +1,6 @@
1/* Set flags signalling availability of kernel features based on given1/* Set flags signalling availability of kernel features based on given
2 kernel version number.2 kernel version number.
3 Copyright (C) 2006-2020 Free Software Foundation, Inc.3 Copyright (C) 2006-2021 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
6 The GNU C Library is free software; you can redistribute it and/or6 The GNU C Library is free software; you can redistribute it and/or
...@@ -18,11 +18,6 @@...@@ -18,11 +18,6 @@
18 <https://www.gnu.org/licenses/>. */18 <https://www.gnu.org/licenses/>. */
1919
2020
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#include_next <kernel-features.h>21#include_next <kernel-features.h>
2722
28#define __ASSUME_RECV_SYSCALL 123#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. */
33enum
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. */
43enum
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. */
65enum
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. */
77enum
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
103enum
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. */
133enum
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. */
143enum
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. */
153enum
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 */
167struct _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 */
176enum
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};
183enum
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. */
210extern 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.*/
219extern 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. */
227extern 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. */
232extern 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. */
240extern 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. */
248extern int pthread_detach (pthread_t __th) __THROW;
249
250
251/* Obtain the identifier of the current thread. */
252extern pthread_t pthread_self (void) __THROW __attribute__ ((__const__));
253
254/* Compare two thread identifiers. */
255extern 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). */
264extern int pthread_attr_init (pthread_attr_t *__attr) __THROW __nonnull ((1));
265
266/* Destroy thread attribute *ATTR. */
267extern int pthread_attr_destroy (pthread_attr_t *__attr)
268 __THROW __nonnull ((1));
269
270/* Get detach state attribute. */
271extern int pthread_attr_getdetachstate (const pthread_attr_t *__attr,
272 int *__detachstate)
273 __THROW __nonnull ((1, 2));
274
275/* Set detach state attribute. */
276extern 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. */
282extern 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. */
287extern 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. */
293extern 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. */
298extern 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. */
303extern 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. */
308extern 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. */
312extern 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. */
317extern 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. */
323extern 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. */
328extern int pthread_attr_setscope (pthread_attr_t *__attr, int __scope)
329 __THROW __nonnull ((1));
330
331/* Return the previously set address for the stack. */
332extern 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. */
340extern 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. */
345extern 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. */
352extern 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. */
358extern 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. */
366extern 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. */
373extern 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. */
380extern 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. */
386extern 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. */
391extern 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. */
397extern 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. */
406extern 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. */
411extern 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. */
417extern 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. */
423extern 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. */
428extern 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. */
435extern int pthread_getconcurrency (void) __THROW;
436
437/* Set new concurrency level to LEVEL. */
438extern 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. */
446extern int pthread_yield (void) __THROW;
447
448
449/* Limit specified thread TH to run only on the processors represented
450 in CPUSET. */
451extern 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. */
456extern 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. */
471extern 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. */
483extern 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. */
487extern int pthread_setcanceltype (int __type, int *__oldtype);
488
489/* Cancel THREAD immediately or at the next possibility. */
490extern 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. */
495extern void pthread_testcancel (void);
496
497
498/* Cancellation handling with integration into exception handling. */
499
500typedef 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. */
517struct __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. */
528class __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 {
657extern 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)
669extern 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 {
692extern 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)
705extern void __pthread_unregister_cancel_restore (__pthread_unwind_buf_t *__buf)
706 __cleanup_fct_attribute;
707# endif
708
709/* Internal interface to initiate cleanup. */
710extern 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. */
719struct __jmp_buf_tag;
720extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL;
721
722
723/* Mutex handling. */
724
725/* Initialize a mutex. */
726extern int pthread_mutex_init (pthread_mutex_t *__mutex,
727 const pthread_mutexattr_t *__mutexattr)
728 __THROW __nonnull ((1));
729
730/* Destroy a mutex. */
731extern int pthread_mutex_destroy (pthread_mutex_t *__mutex)
732 __THROW __nonnull ((1));
733
734/* Try locking a mutex. */
735extern int pthread_mutex_trylock (pthread_mutex_t *__mutex)
736 __THROWNL __nonnull ((1));
737
738/* Lock a mutex. */
739extern 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. */
744extern 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
750extern 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. */
757extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
758 __THROWNL __nonnull ((1));
759
760
761/* Get the priority ceiling of MUTEX. */
762extern 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. */
769extern 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. */
777extern int pthread_mutex_consistent (pthread_mutex_t *__mutex)
778 __THROW __nonnull ((1));
779# ifdef __USE_GNU
780extern 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). */
790extern int pthread_mutexattr_init (pthread_mutexattr_t *__attr)
791 __THROW __nonnull ((1));
792
793/* Destroy mutex attribute object ATTR. */
794extern int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr)
795 __THROW __nonnull ((1));
796
797/* Get the process-shared flag of the mutex attribute ATTR. */
798extern 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. */
804extern 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. */
810extern 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). */
817extern 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. */
822extern 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). */
829extern 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. */
834extern 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. */
840extern 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. */
846extern int pthread_mutexattr_getrobust (const pthread_mutexattr_t *__attr,
847 int *__robustness)
848 __THROW __nonnull ((1, 2));
849# ifdef __USE_GNU
850extern 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. */
856extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
857 int __robustness)
858 __THROW __nonnull ((1));
859# ifdef __USE_GNU
860extern 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. */
872extern 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. */
877extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock)
878 __THROW __nonnull ((1));
879
880/* Acquire read lock for RWLOCK. */
881extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock)
882 __THROWNL __nonnull ((1));
883
884/* Try to acquire read lock for RWLOCK. */
885extern 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. */
890extern 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
896extern 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. */
903extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock)
904 __THROWNL __nonnull ((1));
905
906/* Try to acquire write lock for RWLOCK. */
907extern 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. */
912extern 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
918extern 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. */
925extern 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. */
932extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr)
933 __THROW __nonnull ((1));
934
935/* Destroy attribute object ATTR. */
936extern 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. */
940extern 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. */
946extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr,
947 int __pshared)
948 __THROW __nonnull ((1));
949
950/* Return current setting of reader/writer preference. */
951extern 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. */
957extern 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. */
966extern 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. */
971extern int pthread_cond_destroy (pthread_cond_t *__cond)
972 __THROW __nonnull ((1));
973
974/* Wake up one thread waiting for condition variable COND. */
975extern int pthread_cond_signal (pthread_cond_t *__cond)
976 __THROWNL __nonnull ((1));
977
978/* Wake up all threads waiting for condition variables COND. */
979extern 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. */
987extern 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. */
998extern 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. */
1011extern 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. */
1021extern int pthread_condattr_init (pthread_condattr_t *__attr)
1022 __THROW __nonnull ((1));
1023
1024/* Destroy condition variable attribute ATTR. */
1025extern 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. */
1029extern 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. */
1035extern 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. */
1040extern 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. */
1046extern 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. */
1057extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared)
1058 __THROW __nonnull ((1));
1059
1060/* Destroy the spinlock LOCK. */
1061extern int pthread_spin_destroy (pthread_spinlock_t *__lock)
1062 __THROW __nonnull ((1));
1063
1064/* Wait until spinlock LOCK is retrieved. */
1065extern int pthread_spin_lock (pthread_spinlock_t *__lock)
1066 __THROWNL __nonnull ((1));
1067
1068/* Try to lock spinlock LOCK. */
1069extern int pthread_spin_trylock (pthread_spinlock_t *__lock)
1070 __THROWNL __nonnull ((1));
1071
1072/* Release spinlock LOCK. */
1073extern 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. */
1081extern 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. */
1087extern int pthread_barrier_destroy (pthread_barrier_t *__barrier)
1088 __THROW __nonnull ((1));
1089
1090/* Wait on barrier BARRIER. */
1091extern int pthread_barrier_wait (pthread_barrier_t *__barrier)
1092 __THROWNL __nonnull ((1));
1093
1094
1095/* Initialize barrier attribute ATTR. */
1096extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr)
1097 __THROW __nonnull ((1));
1098
1099/* Destroy previously dynamically initialized barrier attribute ATTR. */
1100extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr)
1101 __THROW __nonnull ((1));
1102
1103/* Get the process-shared flag of the barrier attribute ATTR. */
1104extern 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. */
1110extern 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. */
1124extern int pthread_key_create (pthread_key_t *__key,
1125 void (*__destr_function) (void *))
1126 __THROW __nonnull ((1));
1127
1128/* Destroy KEY. */
1129extern int pthread_key_delete (pthread_key_t __key) __THROW;
1130
1131/* Return current value of the thread-specific data slot identified by KEY. */
1132extern void *pthread_getspecific (pthread_key_t __key) __THROW;
1133
1134/* Store POINTER in the thread-specific data slot identified by KEY. */
1135extern 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. */
1141extern 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
1158extern 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,5 +1,5 @@
1/* Assembler macros for PA-RISC.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
4 Contributed by Ulrich Drepper, <drepper@cygnus.com>, August 1999.4 Contributed by Ulrich Drepper, <drepper@cygnus.com>, August 1999.
5 Linux/PA-RISC changes by Philipp Rumpf, <prumpf@tux.org>, March 2000.5 Linux/PA-RISC changes by Philipp Rumpf, <prumpf@tux.org>, March 2000.
...@@ -28,6 +28,8 @@...@@ -28,6 +28,8 @@
28/* Defines RTLD_PRIVATE_ERRNO. */28/* Defines RTLD_PRIVATE_ERRNO. */
29#include <dl-sysdep.h>29#include <dl-sysdep.h>
3030
31#include <tls.h>
32
31/* In order to get __set_errno() definition in INLINE_SYSCALL. */33/* In order to get __set_errno() definition in INLINE_SYSCALL. */
32#ifndef __ASSEMBLER__34#ifndef __ASSEMBLER__
33#include <errno.h>35#include <errno.h>
...@@ -360,39 +362,9 @@ L(pre_end): ASM_LINE_SEP \...@@ -360,39 +362,9 @@ L(pre_end): ASM_LINE_SEP \
360#define CALL_CLOB_REGS "%r1", "%r2", CLOB_TREG \362#define CALL_CLOB_REGS "%r1", "%r2", CLOB_TREG \
361 "%r20", "%r29", "%r31"363 "%r20", "%r29", "%r31"
362364
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/* Similar to INLINE_SYSCALL but we don't set errno */365/* Similar to INLINE_SYSCALL but we don't set errno */
394#undef INTERNAL_SYSCALL366#undef INTERNAL_SYSCALL
395#define INTERNAL_SYSCALL(name, err, nr, args...) \367#define INTERNAL_SYSCALL(name, nr, args...) \
396({ \368({ \
397 long __sys_res; \369 long __sys_res; \
398 { \370 { \
...@@ -418,7 +390,7 @@ L(pre_end): ASM_LINE_SEP \...@@ -418,7 +390,7 @@ L(pre_end): ASM_LINE_SEP \
418390
419/* The _NCS variant allows non-constant syscall numbers. */391/* The _NCS variant allows non-constant syscall numbers. */
420#undef INTERNAL_SYSCALL_NCS392#undef INTERNAL_SYSCALL_NCS
421#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \393#define INTERNAL_SYSCALL_NCS(name, nr, args...) \
422({ \394({ \
423 long __sys_res; \395 long __sys_res; \
424 { \396 { \
lib/libc/glibc/sysdeps/unix/sysv/linux/i386/dl-sysdep.h+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* System-specific settings for dynamic linker code. i386 version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,6 +1,6 @@
1/* Set flags signalling availability of kernel features based on given1/* Set flags signalling availability of kernel features based on given
2 kernel version number. i386 version.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 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
6 The GNU C Library is free software; you can redistribute it and/or6 The GNU C Library is free software; you can redistribute it and/or
...@@ -23,8 +23,6 @@...@@ -23,8 +23,6 @@
23# define __ASSUME_SOCKETPAIR_SYSCALL 123# define __ASSUME_SOCKETPAIR_SYSCALL 1
24# define __ASSUME_BIND_SYSCALL 124# define __ASSUME_BIND_SYSCALL 1
25# define __ASSUME_LISTEN_SYSCALL 125# define __ASSUME_LISTEN_SYSCALL 1
26# define __ASSUME_GETSOCKOPT_SYSCALL 1
27# define __ASSUME_SETSOCKOPT_SYSCALL 1
28# define __ASSUME_GETSOCKNAME_SYSCALL 126# define __ASSUME_GETSOCKNAME_SYSCALL 1
29# define __ASSUME_GETPEERNAME_SYSCALL 127# define __ASSUME_GETPEERNAME_SYSCALL 1
30# define __ASSUME_SHUTDOWN_SYSCALL 128# define __ASSUME_SHUTDOWN_SYSCALL 1
...@@ -41,6 +39,8 @@...@@ -41,6 +39,8 @@
41# undef __ASSUME_CONNECT_SYSCALL39# undef __ASSUME_CONNECT_SYSCALL
42# undef __ASSUME_RECVFROM_SYSCALL40# undef __ASSUME_RECVFROM_SYSCALL
43# undef __ASSUME_SENDTO_SYSCALL41# undef __ASSUME_SENDTO_SYSCALL
42# undef __ASSUME_GETSOCKOPT_SYSCALL
43# undef __ASSUME_SETSOCKOPT_SYSCALL
44#endif44#endif
4545
46/* i686 only supports ipc syscall before 5.1. */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,4 +1,4 @@
1/* Copyright (C) 1992-2020 Free Software Foundation, Inc.1/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper, <drepper@gnu.org>, August 1995.3 Contributed by Ulrich Drepper, <drepper@gnu.org>, August 1995.
44
...@@ -48,7 +48,7 @@...@@ -48,7 +48,7 @@
48 to compile glibc. Disable GCC 5 optimization when compiling for48 to compile glibc. Disable GCC 5 optimization when compiling for
49 profiling or when -fno-omit-frame-pointer is used since asm ("ebp")49 profiling or when -fno-omit-frame-pointer is used since asm ("ebp")
50 can't be used to put the 6th argument in %ebp for syscall. */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_EBP51#if !defined PROF && CAN_USE_REGISTER_ASM_EBP
52# define OPTIMIZE_FOR_GCC_552# define OPTIMIZE_FOR_GCC_5
53#endif53#endif
5454
...@@ -67,6 +67,7 @@...@@ -67,6 +67,7 @@
6767
68/* We don't want the label for the error handle to be global when we define68/* We don't want the label for the error handle to be global when we define
69 it here. */69 it here. */
70#undef SYSCALL_ERROR_LABEL
70#define SYSCALL_ERROR_LABEL __syscall_error71#define SYSCALL_ERROR_LABEL __syscall_error
7172
72#undef PSEUDO73#undef PSEUDO
...@@ -280,35 +281,6 @@ struct libc_do_syscall_args...@@ -280,35 +281,6 @@ struct libc_do_syscall_args
280};281};
281#endif282#endif
282283
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# define VDSO_NAME "LINUX_2.6"284# define VDSO_NAME "LINUX_2.6"
313# define VDSO_HASH 61765110285# define VDSO_HASH 61765110
314286
...@@ -319,6 +291,11 @@ struct libc_do_syscall_args...@@ -319,6 +291,11 @@ struct libc_do_syscall_args
319# define HAVE_TIME_VSYSCALL "__vdso_time"291# define HAVE_TIME_VSYSCALL "__vdso_time"
320# define HAVE_CLOCK_GETRES_VSYSCALL "__vdso_clock_getres"292# define HAVE_CLOCK_GETRES_VSYSCALL "__vdso_clock_getres"
321293
294# define HAVE_CLONE3_WRAPPER 1
295
296# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
297# define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
298
322/* Define a macro which expands inline into the wrapper code for a system299/* Define a macro which expands inline into the wrapper code for a system
323 call. This use is for internal calls that do not need to handle errors300 call. This use is for internal calls that do not need to handle errors
324 normally. It will never touch errno. This returns just what the kernel301 normally. It will never touch errno. This returns just what the kernel
...@@ -327,25 +304,41 @@ struct libc_do_syscall_args...@@ -327,25 +304,41 @@ struct libc_do_syscall_args
327 The _NCS variant allows non-constant syscall numbers but it is not304 The _NCS variant allows non-constant syscall numbers but it is not
328 possible to use more than four parameters. */305 possible to use more than four parameters. */
329#undef INTERNAL_SYSCALL306#undef INTERNAL_SYSCALL
330#define INTERNAL_SYSCALL_MAIN_0(name, err, args...) \307#define INTERNAL_SYSCALL_MAIN_0(name, args...) \
331 INTERNAL_SYSCALL_MAIN_INLINE(name, err, 0, args)308 INTERNAL_SYSCALL_MAIN_INLINE(name, 0, args)
332#define INTERNAL_SYSCALL_MAIN_1(name, err, args...) \309#define INTERNAL_SYSCALL_MAIN_1(name, args...) \
333 INTERNAL_SYSCALL_MAIN_INLINE(name, err, 1, args)310 INTERNAL_SYSCALL_MAIN_INLINE(name, 1, args)
334#define INTERNAL_SYSCALL_MAIN_2(name, err, args...) \311#define INTERNAL_SYSCALL_MAIN_2(name, args...) \
335 INTERNAL_SYSCALL_MAIN_INLINE(name, err, 2, args)312 INTERNAL_SYSCALL_MAIN_INLINE(name, 2, args)
336#define INTERNAL_SYSCALL_MAIN_3(name, err, args...) \313#define INTERNAL_SYSCALL_MAIN_3(name, args...) \
337 INTERNAL_SYSCALL_MAIN_INLINE(name, err, 3, args)314 INTERNAL_SYSCALL_MAIN_INLINE(name, 3, args)
338#define INTERNAL_SYSCALL_MAIN_4(name, err, args...) \315#define INTERNAL_SYSCALL_MAIN_4(name, args...) \
339 INTERNAL_SYSCALL_MAIN_INLINE(name, err, 4, args)316 INTERNAL_SYSCALL_MAIN_INLINE(name, 4, args)
340#define INTERNAL_SYSCALL_MAIN_5(name, err, args...) \317#define INTERNAL_SYSCALL_MAIN_5(name, args...) \
341 INTERNAL_SYSCALL_MAIN_INLINE(name, err, 5, 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/* Each object using 6-argument inline syscalls must include a333/* Each object using 6-argument inline syscalls must include a
343 definition of __libc_do_syscall. */334 definition of __libc_do_syscall. */
344#ifdef OPTIMIZE_FOR_GCC_5335#ifdef OPTIMIZE_FOR_GCC_5
345# define INTERNAL_SYSCALL_MAIN_6(name, err, args...) \336# define INTERNAL_SYSCALL_MAIN_6(name, args...) \
346 INTERNAL_SYSCALL_MAIN_INLINE(name, err, 6, 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#else /* GCC 5 */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 arg4, arg5, arg6) \342 arg4, arg5, arg6) \
350 struct libc_do_syscall_args _xv = \343 struct libc_do_syscall_args _xv = \
351 { \344 { \
...@@ -359,52 +352,67 @@ struct libc_do_syscall_args...@@ -359,52 +352,67 @@ struct libc_do_syscall_args
359 : "=a" (resultvar) \352 : "=a" (resultvar) \
360 : "i" (__NR_##name), "c" (arg2), "d" (arg3), "S" (arg4), "D" (&_xv) \353 : "i" (__NR_##name), "c" (arg2), "d" (arg3), "S" (arg4), "D" (&_xv) \
361 : "memory", "cc")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#endif /* GCC 5 */369#endif /* GCC 5 */
363#define INTERNAL_SYSCALL(name, err, nr, args...) \370
371#define INTERNAL_SYSCALL(name, nr, args...) \
364 ({ \372 ({ \
365 register unsigned int resultvar; \373 register unsigned int resultvar; \
366 INTERNAL_SYSCALL_MAIN_##nr (name, err, args); \374 INTERNAL_SYSCALL_MAIN_##nr (name, args); \
367 (int) resultvar; })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#if I386_USE_SYSENTER382#if I386_USE_SYSENTER
369# ifdef OPTIMIZE_FOR_GCC_5383# ifdef OPTIMIZE_FOR_GCC_5
370# ifdef PIC384# ifdef PIC
371# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \385# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
372 LOADREGS_##nr(args) \386 LOADREGS_##nr(args) \
373 asm volatile ( \387 asm volatile ( \
374 "call *%%gs:%P2" \388 "call *%%gs:%P2" \
375 : "=a" (resultvar) \389 : "=a" (resultvar) \
376 : "a" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo)) \390 : "a" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo)) \
377 ASMARGS_##nr(args) : "memory", "cc")391 ASMARGS_##nr(args) : "memory", "cc")
378# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \392# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
379 ({ \
380 register unsigned int resultvar; \
381 LOADREGS_##nr(args) \393 LOADREGS_##nr(args) \
382 asm volatile ( \394 asm volatile ( \
383 "call *%%gs:%P2" \395 "call *%%gs:%P2" \
384 : "=a" (resultvar) \396 : "=a" (resultvar) \
385 : "a" (name), "i" (offsetof (tcbhead_t, sysinfo)) \397 : "a" (name), "i" (offsetof (tcbhead_t, sysinfo)) \
386 ASMARGS_##nr(args) : "memory", "cc"); \398 ASMARGS_##nr(args) : "memory", "cc")
387 (int) resultvar; })
388# else399# else
389# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \400# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
390 LOADREGS_##nr(args) \401 LOADREGS_##nr(args) \
391 asm volatile ( \402 asm volatile ( \
392 "call *_dl_sysinfo" \403 "call *_dl_sysinfo" \
393 : "=a" (resultvar) \404 : "=a" (resultvar) \
394 : "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc")405 : "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc")
395# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \406# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
396 ({ \
397 register unsigned int resultvar; \
398 LOADREGS_##nr(args) \407 LOADREGS_##nr(args) \
399 asm volatile ( \408 asm volatile ( \
400 "call *_dl_sysinfo" \409 "call *_dl_sysinfo" \
401 : "=a" (resultvar) \410 : "=a" (resultvar) \
402 : "a" (name) ASMARGS_##nr(args) : "memory", "cc"); \411 : "a" (name) ASMARGS_##nr(args) : "memory", "cc")
403 (int) resultvar; })
404# endif412# endif
405# else /* GCC 5 */413# else /* GCC 5 */
406# ifdef PIC414# ifdef PIC
407# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \415# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
408 EXTRAVAR_##nr \416 EXTRAVAR_##nr \
409 asm volatile ( \417 asm volatile ( \
410 LOADARGS_##nr \418 LOADARGS_##nr \
...@@ -414,9 +422,7 @@ struct libc_do_syscall_args...@@ -414,9 +422,7 @@ struct libc_do_syscall_args
414 : "=a" (resultvar) \422 : "=a" (resultvar) \
415 : "i" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo)) \423 : "i" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo)) \
416 ASMFMT_##nr(args) : "memory", "cc")424 ASMFMT_##nr(args) : "memory", "cc")
417# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \425# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
418 ({ \
419 register unsigned int resultvar; \
420 EXTRAVAR_##nr \426 EXTRAVAR_##nr \
421 asm volatile ( \427 asm volatile ( \
422 LOADARGS_##nr \428 LOADARGS_##nr \
...@@ -424,10 +430,9 @@ struct libc_do_syscall_args...@@ -424,10 +430,9 @@ struct libc_do_syscall_args
424 RESTOREARGS_##nr \430 RESTOREARGS_##nr \
425 : "=a" (resultvar) \431 : "=a" (resultvar) \
426 : "0" (name), "i" (offsetof (tcbhead_t, sysinfo)) \432 : "0" (name), "i" (offsetof (tcbhead_t, sysinfo)) \
427 ASMFMT_##nr(args) : "memory", "cc"); \433 ASMFMT_##nr(args) : "memory", "cc")
428 (int) resultvar; })
429# else434# else
430# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \435# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
431 EXTRAVAR_##nr \436 EXTRAVAR_##nr \
432 asm volatile ( \437 asm volatile ( \
433 LOADARGS_##nr \438 LOADARGS_##nr \
...@@ -436,38 +441,32 @@ struct libc_do_syscall_args...@@ -436,38 +441,32 @@ struct libc_do_syscall_args
436 RESTOREARGS_##nr \441 RESTOREARGS_##nr \
437 : "=a" (resultvar) \442 : "=a" (resultvar) \
438 : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc")443 : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc")
439# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \444# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
440 ({ \
441 register unsigned int resultvar; \
442 EXTRAVAR_##nr \445 EXTRAVAR_##nr \
443 asm volatile ( \446 asm volatile ( \
444 LOADARGS_##nr \447 LOADARGS_##nr \
445 "call *_dl_sysinfo\n\t" \448 "call *_dl_sysinfo\n\t" \
446 RESTOREARGS_##nr \449 RESTOREARGS_##nr \
447 : "=a" (resultvar) \450 : "=a" (resultvar) \
448 : "0" (name) ASMFMT_##nr(args) : "memory", "cc"); \451 : "0" (name) ASMFMT_##nr(args) : "memory", "cc")
449 (int) resultvar; })
450# endif452# endif
451# endif /* GCC 5 */453# endif /* GCC 5 */
452#else454#else
453# ifdef OPTIMIZE_FOR_GCC_5455# 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 LOADREGS_##nr(args) \457 LOADREGS_##nr(args) \
456 asm volatile ( \458 asm volatile ( \
457 "int $0x80" \459 "int $0x80" \
458 : "=a" (resultvar) \460 : "=a" (resultvar) \
459 : "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc")461 : "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc")
460# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \462# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
461 ({ \
462 register unsigned int resultvar; \
463 LOADREGS_##nr(args) \463 LOADREGS_##nr(args) \
464 asm volatile ( \464 asm volatile ( \
465 "int $0x80" \465 "int $0x80" \
466 : "=a" (resultvar) \466 : "=a" (resultvar) \
467 : "a" (name) ASMARGS_##nr(args) : "memory", "cc"); \467 : "a" (name) ASMARGS_##nr(args) : "memory", "cc")
468 (int) resultvar; })
469# else /* GCC 5 */468# else /* GCC 5 */
470# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \469# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
471 EXTRAVAR_##nr \470 EXTRAVAR_##nr \
472 asm volatile ( \471 asm volatile ( \
473 LOADARGS_##nr \472 LOADARGS_##nr \
...@@ -476,30 +475,17 @@ struct libc_do_syscall_args...@@ -476,30 +475,17 @@ struct libc_do_syscall_args
476 RESTOREARGS_##nr \475 RESTOREARGS_##nr \
477 : "=a" (resultvar) \476 : "=a" (resultvar) \
478 : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc")477 : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc")
479# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \478# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
480 ({ \
481 register unsigned int resultvar; \
482 EXTRAVAR_##nr \479 EXTRAVAR_##nr \
483 asm volatile ( \480 asm volatile ( \
484 LOADARGS_##nr \481 LOADARGS_##nr \
485 "int $0x80\n\t" \482 "int $0x80\n\t" \
486 RESTOREARGS_##nr \483 RESTOREARGS_##nr \
487 : "=a" (resultvar) \484 : "=a" (resultvar) \
488 : "0" (name) ASMFMT_##nr(args) : "memory", "cc"); \485 : "0" (name) ASMFMT_##nr(args) : "memory", "cc")
489 (int) resultvar; })
490# endif /* GCC 5 */486# endif /* GCC 5 */
491#endif487#endif
492488
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#define LOADARGS_0489#define LOADARGS_0
504#ifdef __PIC__490#ifdef __PIC__
505# if I386_USE_SYSENTER && defined PIC491# if I386_USE_SYSENTER && defined PIC
...@@ -618,20 +604,6 @@ struct libc_do_syscall_args...@@ -618,20 +604,6 @@ struct libc_do_syscall_args
618# define EXTRAVAR_5604# define EXTRAVAR_5
619#endif605#endif
620606
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#endif /* __ASSEMBLER__ */607#endif /* __ASSEMBLER__ */
636608
637609
...@@ -662,4 +634,9 @@ struct libc_do_syscall_args...@@ -662,4 +634,9 @@ struct libc_do_syscall_args
662# endif634# endif
663#endif635#endif
664636
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#endif /* linux/i386/sysdep.h */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
33struct 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. */
72struct 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,5 +1,5 @@
1/* System-specific settings for dynamic linker code. IA-64 version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,6 +1,6 @@
1/* Set flags signalling availability of kernel features based on given1/* Set flags signalling availability of kernel features based on given
2 kernel version number.2 kernel version number.
3 Copyright (C) 2010-2020 Free Software Foundation, Inc.3 Copyright (C) 2010-2021 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
6 The GNU C Library is free software; you can redistribute it and/or6 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,4 +1,4 @@
1/* Copyright (C) 1999-2020 Free Software Foundation, Inc.1/* Copyright (C) 1999-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
3 Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999.3 Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999.
4 Based on code originally written by David Mosberger-Tang4 Based on code originally written by David Mosberger-Tang
...@@ -46,12 +46,6 @@...@@ -46,12 +46,6 @@
46#undef SYS_ify46#undef SYS_ify
47#define SYS_ify(syscall_name) __NR_##syscall_name47#define SYS_ify(syscall_name) __NR_##syscall_name
4848
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#if defined USE_DL_SYSINFO \49#if defined USE_DL_SYSINFO \
56 && (IS_IN (libc) \50 && (IS_IN (libc) \
57 || IS_IN (libpthread) || IS_IN (librt))51 || IS_IN (libpthread) || IS_IN (librt))
...@@ -95,6 +89,7 @@...@@ -95,6 +89,7 @@
9589
96/* We don't want the label for the error handler to be visible in the symbol90/* We don't want the label for the error handler to be visible in the symbol
97 table when we define it here. */91 table when we define it here. */
92#undef SYSCALL_ERROR_LABEL
98#define SYSCALL_ERROR_LABEL __syscall_error93#define SYSCALL_ERROR_LABEL __syscall_error
9994
100#undef PSEUDO95#undef PSEUDO
...@@ -177,6 +172,9 @@...@@ -177,6 +172,9 @@
177172
178#else /* not __ASSEMBLER__ */173#else /* not __ASSEMBLER__ */
179174
175#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
176#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
177
180#define BREAK_INSN_1(num) "break " #num ";;\n\t"178#define BREAK_INSN_1(num) "break " #num ";;\n\t"
181#define BREAK_INSN(num) BREAK_INSN_1(num)179#define BREAK_INSN(num) BREAK_INSN_1(num)
182180
...@@ -191,13 +189,13 @@...@@ -191,13 +189,13 @@
191189
192#ifdef IA64_USE_NEW_STUB190#ifdef IA64_USE_NEW_STUB
193191
194# define DO_INLINE_SYSCALL_NCS(name, nr, args...) \192# define INTERNAL_SYSCALL_NCS(name, nr, args...) \
193({ \
195 LOAD_ARGS_##nr (args) \194 LOAD_ARGS_##nr (args) \
196 register long _r8 __asm ("r8"); \195 register long _r8 __asm ("r8"); \
197 register long _r10 __asm ("r10"); \196 register long _r10 __asm ("r10"); \
198 register long _r15 __asm ("r15") = name; \197 register long _r15 __asm ("r15") = name; \
199 register void *_b7 __asm ("b7") = ((tcbhead_t *)__thread_self)->__private;\198 register void *_b7 __asm ("b7") = ((tcbhead_t *)__thread_self)->__private;\
200 long _retval; \
201 LOAD_REGS_##nr \199 LOAD_REGS_##nr \
202 /* \200 /* \
203 * Don't specify any unwind info here. We mark ar.pfs as \201 * Don't specify any unwind info here. We mark ar.pfs as \
...@@ -209,60 +207,30 @@...@@ -209,60 +207,30 @@
209 ASM_OUTARGS_##nr \207 ASM_OUTARGS_##nr \
210 : "0" (_b7), "3" (_r15) ASM_ARGS_##nr \208 : "0" (_b7), "3" (_r15) ASM_ARGS_##nr \
211 : "memory", "ar.pfs" ASM_CLOBBERS_##nr); \209 : "memory", "ar.pfs" ASM_CLOBBERS_##nr); \
212 _retval = _r8;210 _r10 == -1 ? -_r8 : _r8; \
211})
213212
214#else /* !IA64_USE_NEW_STUB */213#else /* !IA64_USE_NEW_STUB */
215214
216# define DO_INLINE_SYSCALL_NCS(name, nr, args...) \215# define INTERNAL_SYSCALL_NCS(name, nr, args...) \
216({ \
217 LOAD_ARGS_##nr (args) \217 LOAD_ARGS_##nr (args) \
218 register long _r8 asm ("r8"); \218 register long _r8 asm ("r8"); \
219 register long _r10 asm ("r10"); \219 register long _r10 asm ("r10"); \
220 register long _r15 asm ("r15") = name; \220 register long _r15 asm ("r15") = name; \
221 long _retval; \
222 LOAD_REGS_##nr \221 LOAD_REGS_##nr \
223 __asm __volatile (BREAK_INSN (__IA64_BREAK_SYSCALL) \222 __asm __volatile (BREAK_INSN (__IA64_BREAK_SYSCALL) \
224 : "=r" (_r8), "=r" (_r10), "=r" (_r15) \223 : "=r" (_r8), "=r" (_r10), "=r" (_r15) \
225 ASM_OUTARGS_##nr \224 ASM_OUTARGS_##nr \
226 : "2" (_r15) ASM_ARGS_##nr \225 : "2" (_r15) ASM_ARGS_##nr \
227 : "memory" ASM_CLOBBERS_##nr); \226 : "memory" ASM_CLOBBERS_##nr); \
228 _retval = _r8;227 _r10 == -1 ? -_r8 : _r8; \
228})
229229
230#endif /* !IA64_USE_NEW_STUB */230#endif /* !IA64_USE_NEW_STUB */
231231
232#define DO_INLINE_SYSCALL(name, nr, args...) \232#define INTERNAL_SYSCALL(name, nr, args...) \
233 DO_INLINE_SYSCALL_NCS (__NR_##name, nr, ##args)233 INTERNAL_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)
266234
267#define LOAD_ARGS_0()235#define LOAD_ARGS_0()
268#define LOAD_REGS_0236#define LOAD_REGS_0
lib/libc/glibc/sysdeps/unix/sysv/linux/include/sys/timex.h+172-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Internal declarations for sys/timex.h.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -23,7 +23,178 @@...@@ -23,7 +23,178 @@
2323
24# ifndef _ISOMAC24# ifndef _ISOMAC
2525
26extern int __adjtimex (struct timex *__ntx);
26libc_hidden_proto (__adjtimex)27libc_hidden_proto (__adjtimex)
2728
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
41struct __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};
80extern int __clock_adjtime64 (const clockid_t clock_id, struct __timex64 *tx64);
81libc_hidden_proto (__clock_adjtime64);
82extern int ___adjtimex64 (struct __timex64 *tx64);
83libc_hidden_proto (___adjtimex64)
84
85struct __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};
97extern int __ntp_gettime64 (struct __ntptimeval64 *ntv);
98libc_hidden_proto (__ntp_gettime64)
99extern int __ntp_gettimex64 (struct __ntptimeval64 *ntv);
100libc_hidden_proto (__ntp_gettimex64)
101
102# endif
103
104/* Convert a known valid struct timex into a struct __timex64. */
105static inline struct __timex64
106valid_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. */
135static inline struct timex
136valid_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. */
165static inline struct __ntptimeval64
166valid_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. */
183static inline struct ntptimeval
184valid_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# endif /* _ISOMAC */199# endif /* _ISOMAC */
29#endif /* sys/timex.h */200#endif /* sys/timex.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/kernel-features.h+11-5
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1/* Set flags signalling availability of kernel features based on given1/* Set flags signalling availability of kernel features based on given
2 kernel version number.2 kernel version number.
3 Copyright (C) 1999-2020 Free Software Foundation, Inc.3 Copyright (C) 1999-2021 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
6 The GNU C Library is free software; you can redistribute it and/or6 The GNU C Library is free software; you can redistribute it and/or
...@@ -49,10 +49,6 @@...@@ -49,10 +49,6 @@
49 SH this appeared first in 2.6.19-rc1, on ia64 in 2.6.22-rc1. */49 SH this appeared first in 2.6.19-rc1, on ia64 in 2.6.22-rc1. */
50#define __ASSUME_PSELECT 150#define __ASSUME_PSELECT 1
5151
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/* Support for inter-process robust mutexes was added in 2.6.17 (but52/* Support for inter-process robust mutexes was added in 2.6.17 (but
57 some architectures lack futex_atomic_cmpxchg_inatomic in some53 some architectures lack futex_atomic_cmpxchg_inatomic in some
58 configurations). */54 configurations). */
...@@ -81,6 +77,8 @@...@@ -81,6 +77,8 @@
81#define __ASSUME_ACCEPT4_SYSCALL 177#define __ASSUME_ACCEPT4_SYSCALL 1
82#define __ASSUME_RECVMMSG_SYSCALL 178#define __ASSUME_RECVMMSG_SYSCALL 1
83#define __ASSUME_SENDMMSG_SYSCALL 179#define __ASSUME_SENDMMSG_SYSCALL 1
80#define __ASSUME_GETSOCKOPT_SYSCALL 1
81#define __ASSUME_SETSOCKOPT_SYSCALL 1
8482
85/* Support for SysV IPC through wired syscalls. All supported architectures83/* Support for SysV IPC through wired syscalls. All supported architectures
86 either support ipc syscall and/or all the ipc correspondent syscalls. */84 either support ipc syscall and/or all the ipc correspondent syscalls. */
...@@ -214,4 +212,12 @@...@@ -214,4 +212,12 @@
214# define __ASSUME_WAITID_PID0_P_PGID212# define __ASSUME_WAITID_PID0_P_PGID
215#endif213#endif
216214
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#endif /* kernel-features.h */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
38struct 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
95struct 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,4 +1,4 @@
1/* Copyright (C) 2010-2020 Free Software Foundation, Inc.1/* Copyright (C) 2010-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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,6 +1,6 @@
1/* Set flags signalling availability of kernel features based on given1/* Set flags signalling availability of kernel features based on given
2 kernel version number.2 kernel version number.
3 Copyright (C) 2008-2020 Free Software Foundation, Inc.3 Copyright (C) 2008-2021 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
6 The GNU C Library is free software; you can redistribute it and/or6 The GNU C Library is free software; you can redistribute it and/or
...@@ -23,8 +23,6 @@...@@ -23,8 +23,6 @@
23# define __ASSUME_SOCKETPAIR_SYSCALL 123# define __ASSUME_SOCKETPAIR_SYSCALL 1
24# define __ASSUME_BIND_SYSCALL 124# define __ASSUME_BIND_SYSCALL 1
25# define __ASSUME_LISTEN_SYSCALL 125# define __ASSUME_LISTEN_SYSCALL 1
26# define __ASSUME_GETSOCKOPT_SYSCALL 1
27# define __ASSUME_SETSOCKOPT_SYSCALL 1
28# define __ASSUME_GETSOCKNAME_SYSCALL 126# define __ASSUME_GETSOCKNAME_SYSCALL 1
29# define __ASSUME_GETPEERNAME_SYSCALL 127# define __ASSUME_GETPEERNAME_SYSCALL 1
30# define __ASSUME_SHUTDOWN_SYSCALL 128# define __ASSUME_SHUTDOWN_SYSCALL 1
...@@ -43,6 +41,8 @@...@@ -43,6 +41,8 @@
43# undef __ASSUME_CONNECT_SYSCALL41# undef __ASSUME_CONNECT_SYSCALL
44# undef __ASSUME_RECVFROM_SYSCALL42# undef __ASSUME_RECVFROM_SYSCALL
45# undef __ASSUME_SENDTO_SYSCALL43# undef __ASSUME_SENDTO_SYSCALL
44# undef __ASSUME_GETSOCKOPT_SYSCALL
45# undef __ASSUME_SETSOCKOPT_SYSCALL
46#endif46#endif
4747
48/* No support for PI futexes or robust mutexes before 3.10 for m68k. */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,4 +1,4 @@
1/* Copyright (C) 2010-2020 Free Software Foundation, Inc.1/* Copyright (C) 2010-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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,4 +1,4 @@
1/* Copyright (C) 1996-2020 Free Software Foundation, Inc.1/* Copyright (C) 1996-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
3 Written by Andreas Schwab, <schwab@issan.informatik.uni-dortmund.de>,3 Written by Andreas Schwab, <schwab@issan.informatik.uni-dortmund.de>,
4 December 1995.4 December 1995.
...@@ -44,6 +44,7 @@...@@ -44,6 +44,7 @@
4444
45/* We don't want the label for the error handler to be visible in the symbol45/* We don't want the label for the error handler to be visible in the symbol
46 table when we define it here. */46 table when we define it here. */
47#undef SYSCALL_ERROR_LABEL
47#ifdef PIC48#ifdef PIC
48#define SYSCALL_ERROR_LABEL .Lsyscall_error49#define SYSCALL_ERROR_LABEL .Lsyscall_error
49#else50#else
...@@ -221,27 +222,12 @@ SYSCALL_ERROR_LABEL: \...@@ -221,27 +222,12 @@ SYSCALL_ERROR_LABEL: \
221222
222#else /* not __ASSEMBLER__ */223#else /* not __ASSEMBLER__ */
223224
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/* Define a macro which expands inline into the wrapper code for a system225/* Define a macro which expands inline into the wrapper code for a system
240 call. This use is for internal calls that do not need to handle errors226 call. This use is for internal calls that do not need to handle errors
241 normally. It will never touch errno. This returns just what the kernel227 normally. It will never touch errno. This returns just what the kernel
242 gave back. */228 gave back. */
243#undef INTERNAL_SYSCALL229#undef INTERNAL_SYSCALL
244#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \230#define INTERNAL_SYSCALL_NCS(name, nr, args...) \
245 ({ unsigned int _sys_result; \231 ({ unsigned int _sys_result; \
246 { \232 { \
247 /* Load argument values in temporary variables233 /* Load argument values in temporary variables
...@@ -257,15 +243,8 @@ SYSCALL_ERROR_LABEL: \...@@ -257,15 +243,8 @@ SYSCALL_ERROR_LABEL: \
257 _sys_result = _d0; \243 _sys_result = _d0; \
258 } \244 } \
259 (int) _sys_result; })245 (int) _sys_result; })
260#define INTERNAL_SYSCALL(name, err, nr, args...) \246#define INTERNAL_SYSCALL(name, nr, args...) \
261 INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args)247 INTERNAL_SYSCALL_NCS (__NR_##name, 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))
269248
270#define LOAD_ARGS_0()249#define LOAD_ARGS_0()
271#define LOAD_REGS_0250#define LOAD_REGS_0
...@@ -313,6 +292,9 @@ SYSCALL_ERROR_LABEL: \...@@ -313,6 +292,9 @@ SYSCALL_ERROR_LABEL: \
313 LOAD_REGS_5292 LOAD_REGS_5
314#define ASM_ARGS_6 ASM_ARGS_5, "a" (_a0)293#define ASM_ARGS_6 ASM_ARGS_5, "a" (_a0)
315294
295#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
296#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
297
316#endif /* not __ASSEMBLER__ */298#endif /* not __ASSEMBLER__ */
317299
318/* Pointer mangling is not yet supported for M68K. */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
39struct 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. */
83struct 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
124struct 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,4 +1,4 @@
1/* Copyright (C) 2011-2020 Free Software Foundation, Inc.1/* Copyright (C) 2011-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -28,8 +28,6 @@...@@ -28,8 +28,6 @@
28#define __ASSUME_SEND_SYSCALL 128#define __ASSUME_SEND_SYSCALL 1
29#define __ASSUME_RECV_SYSCALL 129#define __ASSUME_RECV_SYSCALL 1
30#define __ASSUME_SHUTDOWN_SYSCALL 130#define __ASSUME_SHUTDOWN_SYSCALL 1
31#define __ASSUME_GETSOCKOPT_SYSCALL 1
32#define __ASSUME_SETSOCKOPT_SYSCALL 1
3331
34#include_next <kernel-features.h>32#include_next <kernel-features.h>
3533
lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/sysdep.h+65-62
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 2000-2020 Free Software Foundation, Inc.1/* Copyright (C) 2000-2021 Free Software Foundation, Inc.
22
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
...@@ -26,6 +26,8 @@...@@ -26,6 +26,8 @@
26/* Defines RTLD_PRIVATE_ERRNO. */26/* Defines RTLD_PRIVATE_ERRNO. */
27#include <dl-sysdep.h>27#include <dl-sysdep.h>
2828
29#include <tls.h>
30
29/* In order to get __set_errno() definition in INLINE_SYSCALL. */31/* In order to get __set_errno() definition in INLINE_SYSCALL. */
30#ifndef __ASSEMBLER__32#ifndef __ASSEMBLER__
31# include <errno.h>33# include <errno.h>
...@@ -60,6 +62,7 @@...@@ -60,6 +62,7 @@
6062
61/* We don't want the label for the error handler to be visible in the symbol63/* We don't want the label for the error handler to be visible in the symbol
62 table when we define it here. */64 table when we define it here. */
65# undef SYSCALL_ERROR_LABEL
63# ifdef PIC66# ifdef PIC
64# define SYSCALL_ERROR_LABEL 0f67# define SYSCALL_ERROR_LABEL 0f
65# else68# else
...@@ -163,42 +166,18 @@ SYSCALL_ERROR_LABEL_DCL: \...@@ -163,42 +166,18 @@ SYSCALL_ERROR_LABEL_DCL: \
163166
164#else /* not __ASSEMBLER__ */167#else /* not __ASSEMBLER__ */
165168
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/* Define a macro which expands inline into the wrapper code for a system169/* Define a macro which expands inline into the wrapper code for a system
184 call. This use is for internal calls that do not need to handle errors170 call. This use is for internal calls that do not need to handle errors
185 normally. It will never touch errno. This returns just what the kernel171 normally. It will never touch errno. This returns just what the kernel
186 gave back. */172 gave back. */
187# undef INTERNAL_SYSCALL173# undef INTERNAL_SYSCALL
188# define INTERNAL_SYSCALL(name, err, nr, args...) \174# define INTERNAL_SYSCALL(name, nr, args...) \
189 inline_syscall##nr(SYS_ify(name), args)175 inline_syscall##nr(SYS_ify(name), args)
190176
191# undef INTERNAL_SYSCALL_NCS177# undef INTERNAL_SYSCALL_NCS
192# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \178# define INTERNAL_SYSCALL_NCS(name, nr, args...) \
193 inline_syscall##nr(name, args)179 inline_syscall##nr(name, args)
194180
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# define SYSCALL_CLOBBERS_6 "r11", "r4", "memory"181# define SYSCALL_CLOBBERS_6 "r11", "r4", "memory"
203# define SYSCALL_CLOBBERS_5 "r10", SYSCALL_CLOBBERS_6182# define SYSCALL_CLOBBERS_5 "r10", SYSCALL_CLOBBERS_6
204# define SYSCALL_CLOBBERS_4 "r9", SYSCALL_CLOBBERS_5183# define SYSCALL_CLOBBERS_4 "r9", SYSCALL_CLOBBERS_5
...@@ -209,8 +188,8 @@ SYSCALL_ERROR_LABEL_DCL: \...@@ -209,8 +188,8 @@ SYSCALL_ERROR_LABEL_DCL: \
209188
210# define inline_syscall0(name,dummy) \189# define inline_syscall0(name,dummy) \
211 ({ \190 ({ \
212 register long __ret __asm__("r3"); \191 register long int __ret __asm__("r3"); \
213 register long __r12 __asm__("r12") = name; \192 register long int __r12 __asm__("r12") = name; \
214 __asm__ __volatile__( "brki r14,8; nop;" \193 __asm__ __volatile__( "brki r14,8; nop;" \
215 : "=r"(__ret) \194 : "=r"(__ret) \
216 : "r"(__r12) \195 : "r"(__r12) \
...@@ -219,9 +198,10 @@ SYSCALL_ERROR_LABEL_DCL: \...@@ -219,9 +198,10 @@ SYSCALL_ERROR_LABEL_DCL: \
219198
220# define inline_syscall1(name,arg1) \199# define inline_syscall1(name,arg1) \
221 ({ \200 ({ \
222 register long __ret __asm__("r3"); \201 long int __arg1 = (long int) (arg1); \
223 register long __r12 __asm__("r12") = name; \202 register long int __ret __asm__("r3"); \
224 register long __r5 __asm__("r5") = (long)(arg1); \203 register long int __r12 __asm__("r12") = name; \
204 register long int __r5 __asm__("r5") = __arg1; \
225 __asm__ __volatile__( "brki r14,8; nop;" \205 __asm__ __volatile__( "brki r14,8; nop;" \
226 : "=r"(__ret) \206 : "=r"(__ret) \
227 : "r"(__r5), "r"(__r12) \207 : "r"(__r5), "r"(__r12) \
...@@ -230,10 +210,12 @@ SYSCALL_ERROR_LABEL_DCL: \...@@ -230,10 +210,12 @@ SYSCALL_ERROR_LABEL_DCL: \
230210
231# define inline_syscall2(name,arg1,arg2) \211# define inline_syscall2(name,arg1,arg2) \
232 ({ \212 ({ \
233 register long __ret __asm__("r3"); \213 long int __arg1 = (long int) (arg1); \
234 register long __r12 __asm__("r12") = name; \214 long int __arg2 = (long int) (arg2); \
235 register long __r5 __asm__("r5") = (long)(arg1); \215 register long int __ret __asm__("r3"); \
236 register long __r6 __asm__("r6") = (long)(arg2); \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 __asm__ __volatile__( "brki r14,8; nop;" \219 __asm__ __volatile__( "brki r14,8; nop;" \
238 : "=r"(__ret) \220 : "=r"(__ret) \
239 : "r"(__r5), "r"(__r6), "r"(__r12) \221 : "r"(__r5), "r"(__r6), "r"(__r12) \
...@@ -243,11 +225,14 @@ SYSCALL_ERROR_LABEL_DCL: \...@@ -243,11 +225,14 @@ SYSCALL_ERROR_LABEL_DCL: \
243225
244# define inline_syscall3(name,arg1,arg2,arg3) \226# define inline_syscall3(name,arg1,arg2,arg3) \
245 ({ \227 ({ \
246 register long __ret __asm__("r3"); \228 long int __arg1 = (long int) (arg1); \
247 register long __r12 __asm__("r12") = name; \229 long int __arg2 = (long int) (arg2); \
248 register long __r5 __asm__("r5") = (long)(arg1); \230 long int __arg3 = (long int) (arg3); \
249 register long __r6 __asm__("r6") = (long)(arg2); \231 register long int __ret __asm__("r3"); \
250 register long __r7 __asm__("r7") = (long)(arg3); \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 __asm__ __volatile__( "brki r14,8; nop;" \236 __asm__ __volatile__( "brki r14,8; nop;" \
252 : "=r"(__ret) \237 : "=r"(__ret) \
253 : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r12) \238 : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r12) \
...@@ -257,12 +242,16 @@ SYSCALL_ERROR_LABEL_DCL: \...@@ -257,12 +242,16 @@ SYSCALL_ERROR_LABEL_DCL: \
257242
258# define inline_syscall4(name,arg1,arg2,arg3,arg4) \243# define inline_syscall4(name,arg1,arg2,arg3,arg4) \
259 ({ \244 ({ \
260 register long __ret __asm__("r3"); \245 long int __arg1 = (long int) (arg1); \
261 register long __r12 __asm__("r12") = name; \246 long int __arg2 = (long int) (arg2); \
262 register long __r5 __asm__("r5") = (long)(arg1); \247 long int __arg3 = (long int) (arg3); \
263 register long __r6 __asm__("r6") = (long)(arg2); \248 long int __arg4 = (long int) (arg4); \
264 register long __r7 __asm__("r7") = (long)(arg3); \249 register long int __ret __asm__("r3"); \
265 register long __r8 __asm__("r8") = (long)(arg4); \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 __asm__ __volatile__( "brki r14,8; nop;" \255 __asm__ __volatile__( "brki r14,8; nop;" \
267 : "=r"(__ret) \256 : "=r"(__ret) \
268 : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r12) \257 : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r12) \
...@@ -272,13 +261,18 @@ SYSCALL_ERROR_LABEL_DCL: \...@@ -272,13 +261,18 @@ SYSCALL_ERROR_LABEL_DCL: \
272261
273# define inline_syscall5(name,arg1,arg2,arg3,arg4,arg5) \262# define inline_syscall5(name,arg1,arg2,arg3,arg4,arg5) \
274 ({ \263 ({ \
275 register long __ret __asm__("r3"); \264 long int __arg1 = (long int) (arg1); \
276 register long __r12 __asm__("r12") = name; \265 long int __arg2 = (long int) (arg2); \
277 register long __r5 __asm__("r5") = (long)(arg1); \266 long int __arg3 = (long int) (arg3); \
278 register long __r6 __asm__("r6") = (long)(arg2); \267 long int __arg4 = (long int) (arg4); \
279 register long __r7 __asm__("r7") = (long)(arg3); \268 long int __arg5 = (long int) (arg5); \
280 register long __r8 __asm__("r8") = (long)(arg4); \269 register long int __ret __asm__("r3"); \
281 register long __r9 __asm__("r9") = (long)(arg5); \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 __asm__ __volatile__( "brki r14,8; nop;" \276 __asm__ __volatile__( "brki r14,8; nop;" \
283 : "=r"(__ret) \277 : "=r"(__ret) \
284 : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r9), "r"(__r12) \278 : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r9), "r"(__r12) \
...@@ -288,14 +282,20 @@ SYSCALL_ERROR_LABEL_DCL: \...@@ -288,14 +282,20 @@ SYSCALL_ERROR_LABEL_DCL: \
288282
289# define inline_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \283# define inline_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \
290 ({ \284 ({ \
291 register long __ret __asm__("r3"); \285 long int __arg1 = (long int) (arg1); \
292 register long __r12 __asm__("r12") = name; \286 long int __arg2 = (long int) (arg2); \
293 register long __r5 __asm__("r5") = (long)(arg1); \287 long int __arg3 = (long int) (arg3); \
294 register long __r6 __asm__("r6") = (long)(arg2); \288 long int __arg4 = (long int) (arg4); \
295 register long __r7 __asm__("r7") = (long)(arg3); \289 long int __arg5 = (long int) (arg5); \
296 register long __r8 __asm__("r8") = (long)(arg4); \290 long int __arg6 = (long int) (arg6); \
297 register long __r9 __asm__("r9") = (long)(arg5); \291 register long int __ret __asm__("r3"); \
298 register long __r10 __asm__("r10") = (long)(arg6); \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 __asm__ __volatile__( "brki r14,8; nop;" \299 __asm__ __volatile__( "brki r14,8; nop;" \
300 : "=r"(__ret) \300 : "=r"(__ret) \
301 : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r9), "r"(__r10), \301 : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r9), "r"(__r10), \
...@@ -310,6 +310,9 @@ SYSCALL_ERROR_LABEL_DCL: \...@@ -310,6 +310,9 @@ SYSCALL_ERROR_LABEL_DCL: \
310310
311# define SINGLE_THREAD_BY_GLOBAL 1311# define SINGLE_THREAD_BY_GLOBAL 1
312312
313#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
314#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
315
313#endif /* not __ASSEMBLER__ */316#endif /* not __ASSEMBLER__ */
314317
315#endif /* _LINUX_MICROBLAZE_SYSDEP_H */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. */
42struct 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
97struct 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
134struct 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
188struct 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,6 +1,6 @@
1/* Set flags signalling availability of kernel features based on given1/* Set flags signalling availability of kernel features based on given
2 kernel version number.2 kernel version number.
3 Copyright (C) 1999-2020 Free Software Foundation, Inc.3 Copyright (C) 1999-2021 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
6 The GNU C Library is free software; you can redistribute it and/or6 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,4 +1,4 @@
1/* Copyright (C) 2000-2020 Free Software Foundation, Inc.1/* Copyright (C) 2000-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -25,11 +25,6 @@...@@ -25,11 +25,6 @@
2525
26#include <tls.h>26#include <tls.h>
2727
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 file28/* For Linux we can use the system call table in the header file
34 /usr/include/asm/unistd.h29 /usr/include/asm/unistd.h
35 of the kernel. But these symbols do not follow the SYS_* syntax30 of the kernel. But these symbols do not follow the SYS_* syntax
...@@ -42,32 +37,14 @@...@@ -42,32 +37,14 @@
42/* We don't want the label for the error handler to be visible in the symbol37/* We don't want the label for the error handler to be visible in the symbol
43 table when we define it here. */38 table when we define it here. */
44#ifdef __PIC__39#ifdef __PIC__
40# undef SYSCALL_ERROR_LABEL
45# define SYSCALL_ERROR_LABEL 99b41# define SYSCALL_ERROR_LABEL 99b
46#endif42#endif
4743
48#else /* ! __ASSEMBLER__ */44#else /* ! __ASSEMBLER__ */
4945
50/* Define a macro which expands into the inline wrapper code for a system46#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
51 call. */47#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
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)
7148
72/* Note that the original Linux syscall restart convention required the49/* Note that the original Linux syscall restart convention required the
73 instruction immediately preceding SYSCALL to initialize $v0 with the50 instruction immediately preceding SYSCALL to initialize $v0 with the
...@@ -103,11 +80,11 @@...@@ -103,11 +80,11 @@
10380
104union __mips_syscall_return81union __mips_syscall_return
105 {82 {
106 long long val;83 long long int val;
107 struct84 struct
108 {85 {
109 long v0;86 long int v0;
110 long v1;87 long int v1;
111 }88 }
112 reg;89 reg;
113 };90 };
...@@ -121,14 +98,13 @@ union __mips_syscall_return...@@ -121,14 +98,13 @@ union __mips_syscall_return
12198
122# include <mips16-syscall.h>99# include <mips16-syscall.h>
123100
124# define INTERNAL_SYSCALL(name, err, nr, args...) \101# define INTERNAL_SYSCALL(name, nr, args...) \
125 INTERNAL_SYSCALL_NCS (SYS_ify (name), err, nr, args)102 INTERNAL_SYSCALL_NCS (SYS_ify (name), nr, args)
126103
127# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \104# define INTERNAL_SYSCALL_NCS(number, nr, args...) \
128({ \105({ \
129 union __mips_syscall_return _sc_ret; \106 union __mips_syscall_return _sc_ret; \
130 _sc_ret.val = __mips16_syscall##nr (args, number); \107 _sc_ret.val = __mips16_syscall##nr (args, number); \
131 err = _sc_ret.reg.v1; \
132 _sc_ret.reg.v0; \108 _sc_ret.reg.v0; \
133})109})
134110
...@@ -138,12 +114,12 @@ union __mips_syscall_return...@@ -138,12 +114,12 @@ union __mips_syscall_return
138 number, err, args)114 number, err, args)
139115
140#else /* !__mips16 */116#else /* !__mips16 */
141# define INTERNAL_SYSCALL(name, err, nr, args...) \117# define INTERNAL_SYSCALL(name, nr, args...) \
142 internal_syscall##nr ("li\t%0, %2\t\t\t# " #name "\n\t", \118 internal_syscall##nr ("li\t%0, %2\t\t\t# " #name "\n\t", \
143 "IK" (SYS_ify (name)), \119 "IK" (SYS_ify (name)), \
144 SYS_ify (name), err, args)120 SYS_ify (name), err, args)
145121
146# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \122# define INTERNAL_SYSCALL_NCS(number, nr, args...) \
147 internal_syscall##nr (MOVE32 "\t%0, %2\n\t", \123 internal_syscall##nr (MOVE32 "\t%0, %2\n\t", \
148 "r" (__s0), \124 "r" (__s0), \
149 number, err, args)125 number, err, args)
...@@ -152,13 +128,13 @@ union __mips_syscall_return...@@ -152,13 +128,13 @@ union __mips_syscall_return
152128
153#define internal_syscall0(v0_init, input, number, err, dummy...) \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 = (number); \135 = (number); \
160 register long __v0 asm ("$2"); \136 register long int __v0 asm ("$2"); \
161 register long __a3 asm ("$7"); \137 register long int __a3 asm ("$7"); \
162 __asm__ volatile ( \138 __asm__ volatile ( \
163 ".set\tnoreorder\n\t" \139 ".set\tnoreorder\n\t" \
164 v0_init \140 v0_init \
...@@ -167,22 +143,22 @@ union __mips_syscall_return...@@ -167,22 +143,22 @@ union __mips_syscall_return
167 : "=r" (__v0), "=r" (__a3) \143 : "=r" (__v0), "=r" (__a3) \
168 : input \144 : input \
169 : __SYSCALL_CLOBBERS); \145 : __SYSCALL_CLOBBERS); \
170 err = __a3; \146 _sys_result = __a3 != 0 ? -__v0 : __v0; \
171 _sys_result = __v0; \
172 } \147 } \
173 _sys_result; \148 _sys_result; \
174})149})
175150
176#define internal_syscall1(v0_init, input, number, err, arg1) \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 = (number); \158 = (number); \
183 register long __v0 asm ("$2"); \159 register long int __v0 asm ("$2"); \
184 register long __a0 asm ("$4") = (long) (arg1); \160 register long int __a0 asm ("$4") = _arg1; \
185 register long __a3 asm ("$7"); \161 register long int __a3 asm ("$7"); \
186 __asm__ volatile ( \162 __asm__ volatile ( \
187 ".set\tnoreorder\n\t" \163 ".set\tnoreorder\n\t" \
188 v0_init \164 v0_init \
...@@ -191,23 +167,24 @@ union __mips_syscall_return...@@ -191,23 +167,24 @@ union __mips_syscall_return
191 : "=r" (__v0), "=r" (__a3) \167 : "=r" (__v0), "=r" (__a3) \
192 : input, "r" (__a0) \168 : input, "r" (__a0) \
193 : __SYSCALL_CLOBBERS); \169 : __SYSCALL_CLOBBERS); \
194 err = __a3; \170 _sys_result = __a3 != 0 ? -__v0 : __v0; \
195 _sys_result = __v0; \
196 } \171 } \
197 _sys_result; \172 _sys_result; \
198})173})
199174
200#define internal_syscall2(v0_init, input, number, err, arg1, arg2) \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 = (number); \183 = (number); \
207 register long __v0 asm ("$2"); \184 register long int __v0 asm ("$2"); \
208 register long __a0 asm ("$4") = (long) (arg1); \185 register long int __a0 asm ("$4") = _arg1; \
209 register long __a1 asm ("$5") = (long) (arg2); \186 register long int __a1 asm ("$5") = _arg2; \
210 register long __a3 asm ("$7"); \187 register long int __a3 asm ("$7"); \
211 __asm__ volatile ( \188 __asm__ volatile ( \
212 ".set\tnoreorder\n\t" \189 ".set\tnoreorder\n\t" \
213 v0_init \190 v0_init \
...@@ -216,8 +193,7 @@ union __mips_syscall_return...@@ -216,8 +193,7 @@ union __mips_syscall_return
216 : "=r" (__v0), "=r" (__a3) \193 : "=r" (__v0), "=r" (__a3) \
217 : input, "r" (__a0), "r" (__a1) \194 : input, "r" (__a0), "r" (__a1) \
218 : __SYSCALL_CLOBBERS); \195 : __SYSCALL_CLOBBERS); \
219 err = __a3; \196 _sys_result = __a3 != 0 ? -__v0 : __v0; \
220 _sys_result = __v0; \
221 } \197 } \
222 _sys_result; \198 _sys_result; \
223})199})
...@@ -225,16 +201,19 @@ union __mips_syscall_return...@@ -225,16 +201,19 @@ union __mips_syscall_return
225#define internal_syscall3(v0_init, input, number, err, \201#define internal_syscall3(v0_init, input, number, err, \
226 arg1, arg2, arg3) \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 = (number); \211 = (number); \
233 register long __v0 asm ("$2"); \212 register long int __v0 asm ("$2"); \
234 register long __a0 asm ("$4") = (long) (arg1); \213 register long int __a0 asm ("$4") = _arg1; \
235 register long __a1 asm ("$5") = (long) (arg2); \214 register long int __a1 asm ("$5") = _arg2; \
236 register long __a2 asm ("$6") = (long) (arg3); \215 register long int __a2 asm ("$6") = _arg3; \
237 register long __a3 asm ("$7"); \216 register long int __a3 asm ("$7"); \
238 __asm__ volatile ( \217 __asm__ volatile ( \
239 ".set\tnoreorder\n\t" \218 ".set\tnoreorder\n\t" \
240 v0_init \219 v0_init \
...@@ -243,8 +222,7 @@ union __mips_syscall_return...@@ -243,8 +222,7 @@ union __mips_syscall_return
243 : "=r" (__v0), "=r" (__a3) \222 : "=r" (__v0), "=r" (__a3) \
244 : input, "r" (__a0), "r" (__a1), "r" (__a2) \223 : input, "r" (__a0), "r" (__a1), "r" (__a2) \
245 : __SYSCALL_CLOBBERS); \224 : __SYSCALL_CLOBBERS); \
246 err = __a3; \225 _sys_result = __a3 != 0 ? -__v0 : __v0; \
247 _sys_result = __v0; \
248 } \226 } \
249 _sys_result; \227 _sys_result; \
250})228})
...@@ -252,16 +230,20 @@ union __mips_syscall_return...@@ -252,16 +230,20 @@ union __mips_syscall_return
252#define internal_syscall4(v0_init, input, number, err, \230#define internal_syscall4(v0_init, input, number, err, \
253 arg1, arg2, arg3, arg4) \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 = (number); \241 = (number); \
260 register long __v0 asm ("$2"); \242 register long int __v0 asm ("$2"); \
261 register long __a0 asm ("$4") = (long) (arg1); \243 register long int __a0 asm ("$4") = _arg1; \
262 register long __a1 asm ("$5") = (long) (arg2); \244 register long int __a1 asm ("$5") = _arg2; \
263 register long __a2 asm ("$6") = (long) (arg3); \245 register long int __a2 asm ("$6") = _arg3; \
264 register long __a3 asm ("$7") = (long) (arg4); \246 register long int __a3 asm ("$7") = _arg4; \
265 __asm__ volatile ( \247 __asm__ volatile ( \
266 ".set\tnoreorder\n\t" \248 ".set\tnoreorder\n\t" \
267 v0_init \249 v0_init \
...@@ -270,8 +252,7 @@ union __mips_syscall_return...@@ -270,8 +252,7 @@ union __mips_syscall_return
270 : "=r" (__v0), "+r" (__a3) \252 : "=r" (__v0), "+r" (__a3) \
271 : input, "r" (__a0), "r" (__a1), "r" (__a2) \253 : input, "r" (__a0), "r" (__a1), "r" (__a2) \
272 : __SYSCALL_CLOBBERS); \254 : __SYSCALL_CLOBBERS); \
273 err = __a3; \255 _sys_result = __a3 != 0 ? -__v0 : __v0; \
274 _sys_result = __v0; \
275 } \256 } \
276 _sys_result; \257 _sys_result; \
277})258})
...@@ -285,65 +266,65 @@ union __mips_syscall_return...@@ -285,65 +266,65 @@ union __mips_syscall_return
285 compiler specifics required for the stack arguments to be pushed,266 compiler specifics required for the stack arguments to be pushed,
286 which would be the case if these syscalls were inlined. */267 which would be the case if these syscalls were inlined. */
287268
288long long __nomips16 __mips_syscall5 (long arg1, long arg2, long arg3,269long long int __nomips16 __mips_syscall5 (long int arg1, long int arg2,
289 long arg4, long arg5,270 long int arg3, long int arg4,
290 long number);271 long int arg5,
272 long int number);
291libc_hidden_proto (__mips_syscall5, nomips16)273libc_hidden_proto (__mips_syscall5, nomips16)
292274
293#define internal_syscall5(v0_init, input, number, err, \275#define internal_syscall5(v0_init, input, number, err, \
294 arg1, arg2, arg3, arg4, arg5) \276 arg1, arg2, arg3, arg4, arg5) \
295({ \277({ \
296 union __mips_syscall_return _sc_ret; \278 union __mips_syscall_return _sc_ret; \
297 _sc_ret.val = __mips_syscall5 ((long) (arg1), \279 _sc_ret.val = __mips_syscall5 ((long int) (arg1), \
298 (long) (arg2), \280 (long int) (arg2), \
299 (long) (arg3), \281 (long int) (arg3), \
300 (long) (arg4), \282 (long int) (arg4), \
301 (long) (arg5), \283 (long int) (arg5), \
302 (long) (number)); \284 (long int) (number)); \
303 err = _sc_ret.reg.v1; \285 _sc_ret.reg.v1 != 0 ? -_sc_ret.reg.v0 : _sc_ret.reg.v0; \
304 _sc_ret.reg.v0; \
305})286})
306287
307long long __nomips16 __mips_syscall6 (long arg1, long arg2, long arg3,288long long int __nomips16 __mips_syscall6 (long int arg1, long int arg2,
308 long arg4, long arg5, long arg6,289 long int arg3, long int arg4,
309 long number);290 long int arg5, long int arg6,
291 long int number);
310libc_hidden_proto (__mips_syscall6, nomips16)292libc_hidden_proto (__mips_syscall6, nomips16)
311293
312#define internal_syscall6(v0_init, input, number, err, \294#define internal_syscall6(v0_init, input, number, err, \
313 arg1, arg2, arg3, arg4, arg5, arg6) \295 arg1, arg2, arg3, arg4, arg5, arg6) \
314({ \296({ \
315 union __mips_syscall_return _sc_ret; \297 union __mips_syscall_return _sc_ret; \
316 _sc_ret.val = __mips_syscall6 ((long) (arg1), \298 _sc_ret.val = __mips_syscall6 ((long int) (arg1), \
317 (long) (arg2), \299 (long int) (arg2), \
318 (long) (arg3), \300 (long int) (arg3), \
319 (long) (arg4), \301 (long int) (arg4), \
320 (long) (arg5), \302 (long int) (arg5), \
321 (long) (arg6), \303 (long int) (arg6), \
322 (long) (number)); \304 (long int) (number)); \
323 err = _sc_ret.reg.v1; \305 _sc_ret.reg.v1 != 0 ? -_sc_ret.reg.v0 : _sc_ret.reg.v0; \
324 _sc_ret.reg.v0; \
325})306})
326307
327long long __nomips16 __mips_syscall7 (long arg1, long arg2, long arg3,308long long int __nomips16 __mips_syscall7 (long int arg1, long int arg2,
328 long arg4, long arg5, long arg6,309 long int arg3, long int arg4,
329 long arg7,310 long int arg5, long int arg6,
330 long number);311 long int arg7,
312 long int number);
331libc_hidden_proto (__mips_syscall7, nomips16)313libc_hidden_proto (__mips_syscall7, nomips16)
332314
333#define internal_syscall7(v0_init, input, number, err, \315#define internal_syscall7(v0_init, input, number, err, \
334 arg1, arg2, arg3, arg4, arg5, arg6, arg7) \316 arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
335({ \317({ \
336 union __mips_syscall_return _sc_ret; \318 union __mips_syscall_return _sc_ret; \
337 _sc_ret.val = __mips_syscall7 ((long) (arg1), \319 _sc_ret.val = __mips_syscall7 ((long int) (arg1), \
338 (long) (arg2), \320 (long int) (arg2), \
339 (long) (arg3), \321 (long int) (arg3), \
340 (long) (arg4), \322 (long int) (arg4), \
341 (long) (arg5), \323 (long int) (arg5), \
342 (long) (arg6), \324 (long int) (arg6), \
343 (long) (arg7), \325 (long int) (arg7), \
344 (long) (number)); \326 (long int) (number)); \
345 err = _sc_ret.reg.v1; \327 _sc_ret.reg.v1 != 0 ? -_sc_ret.reg.v0 : _sc_ret.reg.v0; \
346 _sc_ret.reg.v0; \
347})328})
348329
349#if __mips_isa_rev >= 6330#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
46struct 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
100struct 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
141struct 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
194struct 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,6 +1,6 @@
1/* Set flags signalling availability of kernel features based on given1/* Set flags signalling availability of kernel features based on given
2 kernel version number. PowerPC version.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 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
6 The GNU C Library is free software; you can redistribute it and/or6 The GNU C Library is free software; you can redistribute it and/or
...@@ -28,8 +28,6 @@...@@ -28,8 +28,6 @@
28#define __ASSUME_SEND_SYSCALL 128#define __ASSUME_SEND_SYSCALL 1
29#define __ASSUME_RECV_SYSCALL 129#define __ASSUME_RECV_SYSCALL 1
30#define __ASSUME_SHUTDOWN_SYSCALL 130#define __ASSUME_SHUTDOWN_SYSCALL 1
31#define __ASSUME_GETSOCKOPT_SYSCALL 1
32#define __ASSUME_SETSOCKOPT_SYSCALL 1
3331
34/* Define this if your 32-bit syscall API requires 64-bit register32/* Define this if your 32-bit syscall API requires 64-bit register
35 pairs to start with an even-number register. */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,4 +1,4 @@
1/* Copyright (C) 1992-2020 Free Software Foundation, Inc.1/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -17,202 +17,10 @@...@@ -17,202 +17,10 @@
1717
18/* Alan Modra <amodra@bigpond.net.au> rewrote the INLINE_SYSCALL macro */18/* Alan Modra <amodra@bigpond.net.au> rewrote the INLINE_SYSCALL macro */
1919
20#ifndef _LINUX_POWERPC_SYSDEP_H20#ifndef _LINUX_POWERPC64_SYSDEP_H
21#define _LINUX_POWERPC_SYSDEP_H 121#define _LINUX_POWERPC64_SYSDEP_H 1
2222
23#include <sysdeps/unix/sysv/linux/powerpc/sysdep.h>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
21624
217/* In the PowerPC64 ABI, the unadorned F_GETLK* opcodes should be used25/* In the PowerPC64 ABI, the unadorned F_GETLK* opcodes should be used
218 even by largefile64 code. */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,6 +1,6 @@
1/* Set flags signalling availability of kernel features based on given1/* Set flags signalling availability of kernel features based on given
2 kernel version number. RISC-V version.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 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
6 The GNU C Library is free software; you can redistribute it and/or6 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,6 +22,32 @@
22#include <sysdeps/unix/sysv/linux/generic/sysdep.h>22#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
23#include <tls.h>23#include <tls.h>
2424
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#ifdef __ASSEMBLER__51#ifdef __ASSEMBLER__
2652
27# include <sys/asm.h>53# include <sys/asm.h>
...@@ -107,56 +133,38 @@...@@ -107,56 +133,38 @@
107# undef ret_ERRVAL133# undef ret_ERRVAL
108# define ret_ERRVAL ret134# define ret_ERRVAL ret
109135
110#endif /* __ASSEMBLER__ */136#else /* !__ASSEMBLER__ */
111137
112/* In order to get __set_errno() definition in INLINE_SYSCALL. */138# if __WORDSIZE == 64
113#ifndef __ASSEMBLER__139# define VDSO_NAME "LINUX_4.15"
114# include <errno.h>140# define VDSO_HASH 182943605
115#endif
116141
117#include <sysdeps/unix/sysdep.h>142/* List of system calls which are supported as vsyscalls only
118143 for RV64. */
119#undef SYS_ify144# define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres"
120#define SYS_ify(syscall_name) __NR_##syscall_name145# define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime"
121146# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
122#ifndef __ASSEMBLER__147# else
148# define VDSO_NAME "LINUX_5.4"
149# define VDSO_HASH 61765876
123150
124# define VDSO_NAME "LINUX_4.15"151/* RV32 does not support the gettime VDSO syscalls. */
125# define VDSO_HASH 182943605152# endif
126153
127/* List of system calls which are supported as vsyscalls. */154/* List of system calls which are supported as vsyscalls (for RV32 and
128# define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres"155 RV64). */
129# define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime"
130# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
131# define HAVE_GETCPU_VSYSCALL "__vdso_getcpu"156# define HAVE_GETCPU_VSYSCALL "__vdso_getcpu"
132157
133/* Define a macro which expands into the inline wrapper code for a system158# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
134 call. */159# define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
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)
152160
153# define INTERNAL_SYSCALL(name, err, nr, args...) \161# define INTERNAL_SYSCALL(name, nr, args...) \
154 internal_syscall##nr (SYS_ify (name), err, args)162 internal_syscall##nr (SYS_ify (name), args)
155163
156# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \164# define INTERNAL_SYSCALL_NCS(number, nr, args...) \
157 internal_syscall##nr (number, err, args)165 internal_syscall##nr (number, args)
158166
159# define internal_syscall0(number, err, dummy...) \167# define internal_syscall0(number, dummy...) \
160({ \168({ \
161 long int _sys_result; \169 long int _sys_result; \
162 \170 \
...@@ -173,13 +181,14 @@...@@ -173,13 +181,14 @@
173 _sys_result; \181 _sys_result; \
174})182})
175183
176# define internal_syscall1(number, err, arg0) \184# define internal_syscall1(number, arg0) \
177({ \185({ \
178 long int _sys_result; \186 long int _sys_result; \
187 long int _arg0 = (long int) (arg0); \
179 \188 \
180 { \189 { \
181 register long int __a7 asm ("a7") = number; \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 __asm__ volatile ( \192 __asm__ volatile ( \
184 "scall\n\t" \193 "scall\n\t" \
185 : "+r" (__a0) \194 : "+r" (__a0) \
...@@ -190,14 +199,16 @@...@@ -190,14 +199,16 @@
190 _sys_result; \199 _sys_result; \
191})200})
192201
193# define internal_syscall2(number, err, arg0, arg1) \202# define internal_syscall2(number, arg0, arg1) \
194({ \203({ \
195 long int _sys_result; \204 long int _sys_result; \
205 long int _arg0 = (long int) (arg0); \
206 long int _arg1 = (long int) (arg1); \
196 \207 \
197 { \208 { \
198 register long int __a7 asm ("a7") = number; \209 register long int __a7 asm ("a7") = number; \
199 register long int __a0 asm ("a0") = (long int) (arg0); \210 register long int __a0 asm ("a0") = _arg0; \
200 register long int __a1 asm ("a1") = (long int) (arg1); \211 register long int __a1 asm ("a1") = _arg1; \
201 __asm__ volatile ( \212 __asm__ volatile ( \
202 "scall\n\t" \213 "scall\n\t" \
203 : "+r" (__a0) \214 : "+r" (__a0) \
...@@ -208,15 +219,18 @@...@@ -208,15 +219,18 @@
208 _sys_result; \219 _sys_result; \
209})220})
210221
211# define internal_syscall3(number, err, arg0, arg1, arg2) \222# define internal_syscall3(number, arg0, arg1, arg2) \
212({ \223({ \
213 long int _sys_result; \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 register long int __a7 asm ("a7") = number; \230 register long int __a7 asm ("a7") = number; \
217 register long int __a0 asm ("a0") = (long int) (arg0); \231 register long int __a0 asm ("a0") = _arg0; \
218 register long int __a1 asm ("a1") = (long int) (arg1); \232 register long int __a1 asm ("a1") = _arg1; \
219 register long int __a2 asm ("a2") = (long int) (arg2); \233 register long int __a2 asm ("a2") = _arg2; \
220 __asm__ volatile ( \234 __asm__ volatile ( \
221 "scall\n\t" \235 "scall\n\t" \
222 : "+r" (__a0) \236 : "+r" (__a0) \
...@@ -227,16 +241,20 @@...@@ -227,16 +241,20 @@
227 _sys_result; \241 _sys_result; \
228})242})
229243
230# define internal_syscall4(number, err, arg0, arg1, arg2, arg3) \244# define internal_syscall4(number, arg0, arg1, arg2, arg3) \
231({ \245({ \
232 long int _sys_result; \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 register long int __a7 asm ("a7") = number; \253 register long int __a7 asm ("a7") = number; \
236 register long int __a0 asm ("a0") = (long int) (arg0); \254 register long int __a0 asm ("a0") = _arg0; \
237 register long int __a1 asm ("a1") = (long int) (arg1); \255 register long int __a1 asm ("a1") = _arg1; \
238 register long int __a2 asm ("a2") = (long int) (arg2); \256 register long int __a2 asm ("a2") = _arg2; \
239 register long int __a3 asm ("a3") = (long int) (arg3); \257 register long int __a3 asm ("a3") = _arg3; \
240 __asm__ volatile ( \258 __asm__ volatile ( \
241 "scall\n\t" \259 "scall\n\t" \
242 : "+r" (__a0) \260 : "+r" (__a0) \
...@@ -247,17 +265,22 @@...@@ -247,17 +265,22 @@
247 _sys_result; \265 _sys_result; \
248})266})
249267
250# define internal_syscall5(number, err, arg0, arg1, arg2, arg3, arg4) \268# define internal_syscall5(number, arg0, arg1, arg2, arg3, arg4) \
251({ \269({ \
252 long int _sys_result; \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 register long int __a7 asm ("a7") = number; \278 register long int __a7 asm ("a7") = number; \
256 register long int __a0 asm ("a0") = (long int) (arg0); \279 register long int __a0 asm ("a0") = _arg0; \
257 register long int __a1 asm ("a1") = (long int) (arg1); \280 register long int __a1 asm ("a1") = _arg1; \
258 register long int __a2 asm ("a2") = (long int) (arg2); \281 register long int __a2 asm ("a2") = _arg2; \
259 register long int __a3 asm ("a3") = (long int) (arg3); \282 register long int __a3 asm ("a3") = _arg3; \
260 register long int __a4 asm ("a4") = (long int) (arg4); \283 register long int __a4 asm ("a4") = _arg4; \
261 __asm__ volatile ( \284 __asm__ volatile ( \
262 "scall\n\t" \285 "scall\n\t" \
263 : "+r" (__a0) \286 : "+r" (__a0) \
...@@ -268,18 +291,24 @@...@@ -268,18 +291,24 @@
268 _sys_result; \291 _sys_result; \
269})292})
270293
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 long int _sys_result; \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 register long int __a7 asm ("a7") = number; \305 register long int __a7 asm ("a7") = number; \
277 register long int __a0 asm ("a0") = (long int) (arg0); \306 register long int __a0 asm ("a0") = _arg0; \
278 register long int __a1 asm ("a1") = (long int) (arg1); \307 register long int __a1 asm ("a1") = _arg1; \
279 register long int __a2 asm ("a2") = (long int) (arg2); \308 register long int __a2 asm ("a2") = _arg2; \
280 register long int __a3 asm ("a3") = (long int) (arg3); \309 register long int __a3 asm ("a3") = _arg3; \
281 register long int __a4 asm ("a4") = (long int) (arg4); \310 register long int __a4 asm ("a4") = _arg4; \
282 register long int __a5 asm ("a5") = (long int) (arg5); \311 register long int __a5 asm ("a5") = _arg5; \
283 __asm__ volatile ( \312 __asm__ volatile ( \
284 "scall\n\t" \313 "scall\n\t" \
285 : "+r" (__a0) \314 : "+r" (__a0) \
...@@ -291,19 +320,26 @@...@@ -291,19 +320,26 @@
291 _sys_result; \320 _sys_result; \
292})321})
293322
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 long int _sys_result; \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 register long int __a7 asm ("a7") = number; \335 register long int __a7 asm ("a7") = number; \
300 register long int __a0 asm ("a0") = (long int) (arg0); \336 register long int __a0 asm ("a0") = _arg0; \
301 register long int __a1 asm ("a1") = (long int) (arg1); \337 register long int __a1 asm ("a1") = _arg1; \
302 register long int __a2 asm ("a2") = (long int) (arg2); \338 register long int __a2 asm ("a2") = _arg2; \
303 register long int __a3 asm ("a3") = (long int) (arg3); \339 register long int __a3 asm ("a3") = _arg3; \
304 register long int __a4 asm ("a4") = (long int) (arg4); \340 register long int __a4 asm ("a4") = _arg4; \
305 register long int __a5 asm ("a5") = (long int) (arg5); \341 register long int __a5 asm ("a5") = _arg5; \
306 register long int __a6 asm ("a6") = (long int) (arg6); \342 register long int __a6 asm ("a6") = _arg6; \
307 __asm__ volatile ( \343 __asm__ volatile ( \
308 "scall\n\t" \344 "scall\n\t" \
309 : "+r" (__a0) \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
50struct 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
87struct 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. */
147struct 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
184struct 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,5 +1,5 @@
1/* bits/typesizes.h -- underlying types for *_t. Linux/s390 version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -50,6 +50,7 @@...@@ -50,6 +50,7 @@
50#define __TIME_T_TYPE __SLONGWORD_TYPE50#define __TIME_T_TYPE __SLONGWORD_TYPE
51#define __USECONDS_T_TYPE __U32_TYPE51#define __USECONDS_T_TYPE __U32_TYPE
52#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE52#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE
53#define __SUSECONDS64_T_TYPE __SQUAD_TYPE
53#define __DADDR_T_TYPE __S32_TYPE54#define __DADDR_T_TYPE __S32_TYPE
54#define __KEY_T_TYPE __S32_TYPE55#define __KEY_T_TYPE __S32_TYPE
55#define __CLOCKID_T_TYPE __S32_TYPE56#define __CLOCKID_T_TYPE __S32_TYPE
...@@ -81,10 +82,16 @@...@@ -81,10 +82,16 @@
8182
82/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */83/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */
83# define __STATFS_MATCHES_STATFS64 184# define __STATFS_MATCHES_STATFS64 1
85
86/* And for getitimer, setitimer and rusage */
87# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1
84#else88#else
85# define __RLIM_T_MATCHES_RLIM64_T 089# define __RLIM_T_MATCHES_RLIM64_T 0
8690
87# define __STATFS_MATCHES_STATFS64 091# define __STATFS_MATCHES_STATFS64 0
92
93/* And for getitimer, setitimer and rusage */
94# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0
88#endif95#endif
8996
90/* Number of descriptors that can fit in an `fd_set'. */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,6 +1,6 @@
1/* Set flags signalling availability of kernel features based on given1/* Set flags signalling availability of kernel features based on given
2 kernel version number. S/390 version.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 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
6 The GNU C Library is free software; you can redistribute it and/or6 The GNU C Library is free software; you can redistribute it and/or
...@@ -23,8 +23,6 @@...@@ -23,8 +23,6 @@
23# define __ASSUME_SOCKETPAIR_SYSCALL 123# define __ASSUME_SOCKETPAIR_SYSCALL 1
24# define __ASSUME_BIND_SYSCALL 124# define __ASSUME_BIND_SYSCALL 1
25# define __ASSUME_LISTEN_SYSCALL 125# define __ASSUME_LISTEN_SYSCALL 1
26# define __ASSUME_GETSOCKOPT_SYSCALL 1
27# define __ASSUME_SETSOCKOPT_SYSCALL 1
28# define __ASSUME_GETSOCKNAME_SYSCALL 126# define __ASSUME_GETSOCKNAME_SYSCALL 1
29# define __ASSUME_GETPEERNAME_SYSCALL 127# define __ASSUME_GETPEERNAME_SYSCALL 1
30# define __ASSUME_SHUTDOWN_SYSCALL 128# define __ASSUME_SHUTDOWN_SYSCALL 1
...@@ -43,6 +41,8 @@...@@ -43,6 +41,8 @@
43# undef __ASSUME_CONNECT_SYSCALL41# undef __ASSUME_CONNECT_SYSCALL
44# undef __ASSUME_RECVFROM_SYSCALL42# undef __ASSUME_RECVFROM_SYSCALL
45# undef __ASSUME_SENDTO_SYSCALL43# undef __ASSUME_SENDTO_SYSCALL
44# undef __ASSUME_GETSOCKOPT_SYSCALL
45# undef __ASSUME_SETSOCKOPT_SYSCALL
46#endif46#endif
4747
48/* s390 only supports ipc syscall before 5.1. */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,4 +1,4 @@
1/* Copyright (C) 2000-2020 Free Software Foundation, Inc.1/* Copyright (C) 2000-2021 Free Software Foundation, Inc.
2 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).2 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
...@@ -26,11 +26,6 @@...@@ -26,11 +26,6 @@
26#include <dl-sysdep.h> /* For RTLD_PRIVATE_ERRNO. */26#include <dl-sysdep.h> /* For RTLD_PRIVATE_ERRNO. */
27#include <tls.h>27#include <tls.h>
2828
29/* Define __set_errno() for INLINE_SYSCALL macro below. */
30#ifndef __ASSEMBLER__
31#include <errno.h>
32#endif
33
34/* For Linux we can use the system call table in the header file29/* For Linux we can use the system call table in the header file
35 /usr/include/asm/unistd.h30 /usr/include/asm/unistd.h
36 of the kernel. But these symbols do not follow the SYS_* syntax31 of the kernel. But these symbols do not follow the SYS_* syntax
...@@ -38,9 +33,6 @@...@@ -38,9 +33,6 @@
38/* in newer 2.1 kernels __NR_syscall is missing so we define it here */33/* in newer 2.1 kernels __NR_syscall is missing so we define it here */
39#define __NR_syscall 034#define __NR_syscall 0
4035
41#undef SYS_ify
42#define SYS_ify(syscall_name) __NR_##syscall_name
43
44#ifdef __ASSEMBLER__36#ifdef __ASSEMBLER__
4537
46/* Linux uses a negative return value to indicate syscall errors, unlike38/* Linux uses a negative return value to indicate syscall errors, unlike
...@@ -88,7 +80,9 @@...@@ -88,7 +80,9 @@
88#define PSEUDO_END_ERRVAL(name) \80#define PSEUDO_END_ERRVAL(name) \
89 END (name)81 END (name)
9082
83#undef SYSCALL_ERROR_LABEL
91#ifndef PIC84#ifndef PIC
85# undef SYSCALL_ERROR_LABEL
92# define SYSCALL_ERROR_LABEL 0f86# define SYSCALL_ERROR_LABEL 0f
93# define SYSCALL_ERROR_HANDLER \87# define SYSCALL_ERROR_HANDLER \
940: basr %r1,0; \880: basr %r1,0; \
...@@ -97,6 +91,7 @@...@@ -97,6 +91,7 @@
972: .long syscall_error912: .long syscall_error
98#else92#else
99# if RTLD_PRIVATE_ERRNO93# if RTLD_PRIVATE_ERRNO
94# undef SYSCALL_ERROR_LABEL
100# define SYSCALL_ERROR_LABEL 0f95# define SYSCALL_ERROR_LABEL 0f
101# define SYSCALL_ERROR_HANDLER \96# define SYSCALL_ERROR_HANDLER \
1020: basr %r1,0; \970: basr %r1,0; \
...@@ -112,6 +107,7 @@...@@ -112,6 +107,7 @@
112# else107# else
113# define SYSCALL_ERROR_ERRNO errno108# define SYSCALL_ERROR_ERRNO errno
114# endif109# endif
110# undef SYSCALL_ERROR_LABEL
115# define SYSCALL_ERROR_LABEL 0f111# define SYSCALL_ERROR_LABEL 0f
116# define SYSCALL_ERROR_HANDLER \112# define SYSCALL_ERROR_HANDLER \
1170: lcr %r0,%r2; \1130: lcr %r0,%r2; \
...@@ -124,6 +120,7 @@...@@ -124,6 +120,7 @@
124 br %r14; \120 br %r14; \
1252: .long _GLOBAL_OFFSET_TABLE_-1b1212: .long _GLOBAL_OFFSET_TABLE_-1b
126# else122# else
123# undef SYSCALL_ERROR_LABEL
127# define SYSCALL_ERROR_LABEL 0f124# define SYSCALL_ERROR_LABEL 0f
128# define SYSCALL_ERROR_HANDLER \125# define SYSCALL_ERROR_HANDLER \
1290: basr %r1,0; \1260: basr %r1,0; \
...@@ -178,99 +175,12 @@...@@ -178,99 +175,12 @@
178#define ret_ERRVAL \175#define ret_ERRVAL \
179 br 14176 br 14
180177
181#endif /* __ASSEMBLER__ */178#else
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))
247179
248#define DECLARGS_0()180# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
249#define DECLARGS_1(arg1) \181# define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
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);
266182
267#define ASMFMT_0183#endif /* __ASSEMBLER__ */
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)
274184
275/* Pointer mangling support. */185/* Pointer mangling support. */
276#if IS_IN (rtld)186#if IS_IN (rtld)
lib/libc/glibc/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h+10-110
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Assembler macros for 64 bit S/390.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 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).3 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
4 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
...@@ -27,11 +27,6 @@...@@ -27,11 +27,6 @@
27#include <dl-sysdep.h> /* For RTLD_PRIVATE_ERRNO. */27#include <dl-sysdep.h> /* For RTLD_PRIVATE_ERRNO. */
28#include <tls.h>28#include <tls.h>
2929
30/* Define __set_errno() for INLINE_SYSCALL macro below. */
31#ifndef __ASSEMBLER__
32#include <errno.h>
33#endif
34
35/* For Linux we can use the system call table in the header file30/* For Linux we can use the system call table in the header file
36 /usr/include/asm/unistd.h31 /usr/include/asm/unistd.h
37 of the kernel. But these symbols do not follow the SYS_* syntax32 of the kernel. But these symbols do not follow the SYS_* syntax
...@@ -39,17 +34,6 @@...@@ -39,17 +34,6 @@
39/* In newer 2.1 kernels __NR_syscall is missing so we define it here. */34/* In newer 2.1 kernels __NR_syscall is missing so we define it here. */
40#define __NR_syscall 035#define __NR_syscall 0
4136
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#undef SYS_ify37#undef SYS_ify
54#define SYS_ify(syscall_name) __NR_##syscall_name38#define SYS_ify(syscall_name) __NR_##syscall_name
5539
...@@ -102,11 +86,14 @@...@@ -102,11 +86,14 @@
102 SYSCALL_ERROR_HANDLER; \86 SYSCALL_ERROR_HANDLER; \
103 END (name)87 END (name)
10488
89#undef SYSCALL_ERROR_LABEL
105#ifndef PIC90#ifndef PIC
91# undef SYSCALL_ERROR_LABEL
106# define SYSCALL_ERROR_LABEL syscall_error92# define SYSCALL_ERROR_LABEL syscall_error
107# define SYSCALL_ERROR_HANDLER93# define SYSCALL_ERROR_HANDLER
108#else94#else
109# if RTLD_PRIVATE_ERRNO95# if RTLD_PRIVATE_ERRNO
96# undef SYSCALL_ERROR_LABEL
110# define SYSCALL_ERROR_LABEL 0f97# define SYSCALL_ERROR_LABEL 0f
111# define SYSCALL_ERROR_HANDLER \98# define SYSCALL_ERROR_HANDLER \
1120: larl %r1,rtld_errno; \990: larl %r1,rtld_errno; \
...@@ -120,6 +107,7 @@...@@ -120,6 +107,7 @@
120# else107# else
121# define SYSCALL_ERROR_ERRNO errno108# define SYSCALL_ERROR_ERRNO errno
122# endif109# endif
110# undef SYSCALL_ERROR_LABEL
123# define SYSCALL_ERROR_LABEL 0f111# define SYSCALL_ERROR_LABEL 0f
124# define SYSCALL_ERROR_HANDLER \112# define SYSCALL_ERROR_HANDLER \
1250: lcr %r0,%r2; \1130: lcr %r0,%r2; \
...@@ -132,6 +120,7 @@...@@ -132,6 +120,7 @@
132 lghi %r2,-1; \120 lghi %r2,-1; \
133 br %r14121 br %r14
134# else122# else
123# undef SYSCALL_ERROR_LABEL
135# define SYSCALL_ERROR_LABEL 0f124# define SYSCALL_ERROR_LABEL 0f
136# define SYSCALL_ERROR_HANDLER \125# define SYSCALL_ERROR_HANDLER \
1370: larl %r1,_GLOBAL_OFFSET_TABLE_; \1260: larl %r1,_GLOBAL_OFFSET_TABLE_; \
...@@ -184,101 +173,12 @@...@@ -184,101 +173,12 @@
184#define ret_ERRVAL \173#define ret_ERRVAL \
185 br 14174 br 14
186175
187#endif /* __ASSEMBLER__ */176#else
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);
272177
273#define ASMFMT_0178# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
274#define ASMFMT_1 , "0" (gpr2)179# define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
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)
280180
281#define SINGLE_THREAD_BY_GLOBAL 1181#endif /* __ASSEMBLER__ */
282182
283/* Pointer mangling support. */183/* Pointer mangling support. */
284#if IS_IN (rtld)184#if IS_IN (rtld)
lib/libc/glibc/sysdeps/unix/sysv/linux/s390/sys/elf.h+1-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 2000-2020 Free Software Foundation, Inc.1/* Copyright (C) 2000-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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,6 +1,6 @@
1/* Set flags signalling availability of kernel features based on given1/* Set flags signalling availability of kernel features based on given
2 kernel version number. SH version.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 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
6 The GNU C Library is free software; you can redistribute it and/or6 The GNU C Library is free software; you can redistribute it and/or
...@@ -33,8 +33,6 @@...@@ -33,8 +33,6 @@
33#define __ASSUME_SEND_SYSCALL 133#define __ASSUME_SEND_SYSCALL 1
34#define __ASSUME_RECV_SYSCALL 134#define __ASSUME_RECV_SYSCALL 1
35#define __ASSUME_SHUTDOWN_SYSCALL 135#define __ASSUME_SHUTDOWN_SYSCALL 1
36#define __ASSUME_GETSOCKOPT_SYSCALL 1
37#define __ASSUME_SETSOCKOPT_SYSCALL 1
3836
39#include_next <kernel-features.h>37#include_next <kernel-features.h>
4038
lib/libc/glibc/sysdeps/unix/sysv/linux/sh/sysdep.h+3-24
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 1992-2020 Free Software Foundation, Inc.1/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.3 Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.
4 Changed by Kaz Kojima, <kkojima@rr.iij4u.or.jp>.4 Changed by Kaz Kojima, <kkojima@rr.iij4u.or.jp>.
...@@ -287,19 +287,8 @@...@@ -287,19 +287,8 @@
287 register long int r1 asm ("%r1") = (long int) (_arg6); \287 register long int r1 asm ("%r1") = (long int) (_arg6); \
288 register long int r2 asm ("%r2") = (long int) (_arg7)288 register long int r2 asm ("%r2") = (long int) (_arg7)
289289
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#undef INTERNAL_SYSCALL290#undef INTERNAL_SYSCALL
302#define INTERNAL_SYSCALL(name, err, nr, args...) \291#define INTERNAL_SYSCALL(name, nr, args...) \
303 ({ \292 ({ \
304 unsigned long int resultvar; \293 unsigned long int resultvar; \
305 register long int r3 asm ("%r3") = SYS_ify (name); \294 register long int r3 asm ("%r3") = SYS_ify (name); \
...@@ -313,7 +302,7 @@...@@ -313,7 +302,7 @@
313 (int) resultvar; })302 (int) resultvar; })
314303
315/* The _NCS variant allows non-constant syscall numbers. */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 unsigned long int resultvar; \307 unsigned long int resultvar; \
319 register long int r3 asm ("%r3") = (name); \308 register long int r3 asm ("%r3") = (name); \
...@@ -326,16 +315,6 @@...@@ -326,16 +315,6 @@
326 \315 \
327 (int) resultvar; })316 (int) resultvar; })
328317
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#endif /* __ASSEMBLER__ */318#endif /* __ASSEMBLER__ */
340319
341/* Pointer mangling support. */320/* Pointer mangling support. */
lib/libc/glibc/sysdeps/unix/sysv/linux/single-thread.h+13-31
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Single thread optimization, Linux version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -27,36 +27,18 @@...@@ -27,36 +27,18 @@
27 The ABI might define SINGLE_THREAD_BY_GLOBAL to enable the single thread27 The ABI might define SINGLE_THREAD_BY_GLOBAL to enable the single thread
28 check to use global variables instead of the pthread_t field. */28 check to use global variables instead of the pthread_t field. */
2929
30#ifdef SINGLE_THREAD_BY_GLOBAL30#ifndef __ASSEMBLER__
31# if IS_IN (libc)
32extern int __libc_multiple_threads;31extern int __libc_multiple_threads;
33# define SINGLE_THREAD_P \32libc_hidden_proto (__libc_multiple_threads)
34 __glibc_likely (__libc_multiple_threads == 0)33#endif
35# elif IS_IN (libpthread)34
36extern int __pthread_multiple_threads;35#if !defined SINGLE_THREAD_BY_GLOBAL || IS_IN (rtld)
37# define SINGLE_THREAD_P \36# define SINGLE_THREAD_P \
38 __glibc_likely (__pthread_multiple_threads == 0)37 (THREAD_GETMEM (THREAD_SELF, header.multiple_threads) == 0)
39# elif IS_IN (librt)38#else
40# define SINGLE_THREAD_P \39# define SINGLE_THREAD_P (__libc_multiple_threads == 0)
41 __glibc_likely (THREAD_GETMEM (THREAD_SELF, \40#endif
42 header.multiple_threads) == 0)41
43# else42#define RTLD_SINGLE_THREAD_P SINGLE_THREAD_P
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)
6143
62#endif /* _SINGLE_THREAD_H */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
38struct 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
91struct 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,5 +1,5 @@
1/* bits/typesizes.h -- underlying types for *_t. Linux/SPARC version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -50,6 +50,7 @@...@@ -50,6 +50,7 @@
50#define __TIME_T_TYPE __SLONGWORD_TYPE50#define __TIME_T_TYPE __SLONGWORD_TYPE
51#define __USECONDS_T_TYPE __U32_TYPE51#define __USECONDS_T_TYPE __U32_TYPE
52#define __SUSECONDS_T_TYPE __S32_TYPE52#define __SUSECONDS_T_TYPE __S32_TYPE
53#define __SUSECONDS64_T_TYPE __SQUAD_TYPE
53#define __DADDR_T_TYPE __S32_TYPE54#define __DADDR_T_TYPE __S32_TYPE
54#define __KEY_T_TYPE __S32_TYPE55#define __KEY_T_TYPE __S32_TYPE
55#define __CLOCKID_T_TYPE __S32_TYPE56#define __CLOCKID_T_TYPE __S32_TYPE
...@@ -75,10 +76,16 @@...@@ -75,10 +76,16 @@
7576
76/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */77/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */
77# define __STATFS_MATCHES_STATFS64 178# define __STATFS_MATCHES_STATFS64 1
79
80/* And for getitimer, setitimer and rusage */
81# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1
78#else82#else
79# define __RLIM_T_MATCHES_RLIM64_T 083# define __RLIM_T_MATCHES_RLIM64_T 0
8084
81# define __STATFS_MATCHES_STATFS64 085# define __STATFS_MATCHES_STATFS64 0
86
87/* And for getitimer, setitimer and rusage */
88# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0
82#endif89#endif
8390
84/* Number of descriptors that can fit in an `fd_set'. */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,6 +1,6 @@
1/* Set flags signalling availability of kernel features based on given1/* Set flags signalling availability of kernel features based on given
2 kernel version number. SPARC version.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 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
6 The GNU C Library is free software; you can redistribute it and/or6 The GNU C Library is free software; you can redistribute it and/or
...@@ -38,10 +38,11 @@...@@ -38,10 +38,11 @@
38# undef __ASSUME_CONNECT_SYSCALL38# undef __ASSUME_CONNECT_SYSCALL
39# undef __ASSUME_RECVFROM_SYSCALL39# undef __ASSUME_RECVFROM_SYSCALL
40# undef __ASSUME_SENDTO_SYSCALL40# undef __ASSUME_SENDTO_SYSCALL
41# undef __ASSUME_GETSOCKOPT_SYSCALL
42# undef __ASSUME_SETSOCKOPT_SYSCALL
41#else43#else
42# define __ASSUME_SOCKET_SYSCALL 144# define __ASSUME_SOCKET_SYSCALL 1
43# define __ASSUME_SOCKETPAIR_SYSCALL 145# define __ASSUME_SOCKETPAIR_SYSCALL 1
44# define __ASSUME_GETSOCKOPT_SYSCALL 1
45# define __ASSUME_SHUTDOWN_SYSCALL 146# define __ASSUME_SHUTDOWN_SYSCALL 1
46#endif47#endif
4748
...@@ -49,7 +50,6 @@...@@ -49,7 +50,6 @@
49#if __LINUX_KERNEL_VERSION >= 0x04040050#if __LINUX_KERNEL_VERSION >= 0x040400
50# define __ASSUME_BIND_SYSCALL 151# define __ASSUME_BIND_SYSCALL 1
51# define __ASSUME_LISTEN_SYSCALL 152# define __ASSUME_LISTEN_SYSCALL 1
52# define __ASSUME_SETSOCKOPT_SYSCALL 1
53#endif53#endif
5454
55#ifdef __arch64__55#ifdef __arch64__
lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h+5-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 1997-2020 Free Software Foundation, Inc.1/* Copyright (C) 1997-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
3 Contributed by Miguel de Icaza <miguel@gnu.ai.mit.edu>, January 1997.3 Contributed by Miguel de Icaza <miguel@gnu.ai.mit.edu>, January 1997.
44
...@@ -110,9 +110,8 @@ ENTRY(name); \...@@ -110,9 +110,8 @@ ENTRY(name); \
110#define __SYSCALL_STRING \110#define __SYSCALL_STRING \
111 "ta 0x10;" \111 "ta 0x10;" \
112 "bcc 1f;" \112 "bcc 1f;" \
113 " mov 0, %%g1;" \113 " nop;" \
114 "sub %%g0, %%o0, %%o0;" \114 "sub %%g0, %%o0, %%o0;" \
115 "mov 1, %%g1;" \
116 "1:"115 "1:"
117116
118#define __SYSCALL_CLOBBERS \117#define __SYSCALL_CLOBBERS \
...@@ -122,6 +121,9 @@ ENTRY(name); \...@@ -122,6 +121,9 @@ ENTRY(name); \
122 "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \121 "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \
123 "cc", "memory"122 "cc", "memory"
124123
124#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
125#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
126
125#endif /* __ASSEMBLER__ */127#endif /* __ASSEMBLER__ */
126128
127/* Pointer mangling support. */129/* Pointer mangling support. */
lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h+2-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 1997-2020 Free Software Foundation, Inc.1/* Copyright (C) 1997-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
3 Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.3 Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
44
...@@ -109,9 +109,8 @@ ENTRY(name); \...@@ -109,9 +109,8 @@ ENTRY(name); \
109#define __SYSCALL_STRING \109#define __SYSCALL_STRING \
110 "ta 0x6d;" \110 "ta 0x6d;" \
111 "bcc,pt %%xcc, 1f;" \111 "bcc,pt %%xcc, 1f;" \
112 " mov 0, %%g1;" \112 " nop;" \
113 "sub %%g0, %%o0, %%o0;" \113 "sub %%g0, %%o0, %%o0;" \
114 "mov 1, %%g1;" \
115 "1:"114 "1:"
116115
117#define __SYSCALL_CLOBBERS \116#define __SYSCALL_CLOBBERS \
lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sysdep.h+90-94
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 2000-2020 Free Software Foundation, Inc.1/* Copyright (C) 2000-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
3 Contributed by Jakub Jelinek <jakub@redhat.com>, 2000.3 Contributed by Jakub Jelinek <jakub@redhat.com>, 2000.
44
...@@ -34,13 +34,6 @@...@@ -34,13 +34,6 @@
3434
35#else /* __ASSEMBLER__ */35#else /* __ASSEMBLER__ */
3636
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# define VDSO_NAME "LINUX_2.6"37# define VDSO_NAME "LINUX_2.6"
45# define VDSO_HASH 6176511038# define VDSO_HASH 61765110
4639
...@@ -52,121 +45,119 @@...@@ -52,121 +45,119 @@
52# endif45# endif
53# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"46# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
5447
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#undef INTERNAL_SYSCALL48#undef INTERNAL_SYSCALL
72#define INTERNAL_SYSCALL(name, err, nr, args...) \49#define INTERNAL_SYSCALL(name, nr, args...) \
73 inline_syscall##nr(__SYSCALL_STRING, err, __NR_##name, args)50 internal_syscall##nr(__SYSCALL_STRING, __NR_##name, args)
7451
75#undef INTERNAL_SYSCALL_NCS52#undef INTERNAL_SYSCALL_NCS
76#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \53#define INTERNAL_SYSCALL_NCS(name, nr, args...) \
77 inline_syscall##nr(__SYSCALL_STRING, err, name, args)54 internal_syscall##nr(__SYSCALL_STRING, 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))
8555
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 register long __o0 __asm__ ("o0"); \59 register long __o0 __asm__ ("o0"); \
89 err = name; \60 __asm __volatile (string : "=r" (__o0) : \
90 __asm __volatile (string : "=r" (err), "=r" (__o0) : \61 "r" (__g1) : \
91 "0" (err) : \
92 __SYSCALL_CLOBBERS); \62 __SYSCALL_CLOBBERS); \
93 __o0; \63 __o0; \
94})64})
9565
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); \68 long int _arg1 = (long int) (arg1); \
99 err = name; \69 register long int __g1 __asm__("g1") = (name); \
100 __asm __volatile (string : "=r" (err), "=r" (__o0) : \70 register long int __o0 __asm__ ("o0") = _arg1; \
101 "0" (err), "1" (__o0) : \71 __asm __volatile (string : "=r" (__o0) : \
72 "r" (__g1), "0" (__o0) : \
102 __SYSCALL_CLOBBERS); \73 __SYSCALL_CLOBBERS); \
103 __o0; \74 __o0; \
104})75})
10576
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); \79 long int _arg1 = (long int) (arg1); \
109 register long __o1 __asm__ ("o1") = (long)(arg2); \80 long int _arg2 = (long int) (arg2); \
110 err = name; \81 register long int __g1 __asm__("g1") = (name); \
111 __asm __volatile (string : "=r" (err), "=r" (__o0) : \82 register long int __o0 __asm__ ("o0") = _arg1; \
112 "0" (err), "1" (__o0), "r" (__o1) : \83 register long int __o1 __asm__ ("o1") = _arg2; \
84 __asm __volatile (string : "=r" (__o0) : \
85 "r" (__g1), "0" (__o0), "r" (__o1) : \
113 __SYSCALL_CLOBBERS); \86 __SYSCALL_CLOBBERS); \
114 __o0; \87 __o0; \
115})88})
11689
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); \92 long int _arg1 = (long int) (arg1); \
120 register long __o1 __asm__ ("o1") = (long)(arg2); \93 long int _arg2 = (long int) (arg2); \
121 register long __o2 __asm__ ("o2") = (long)(arg3); \94 long int _arg3 = (long int) (arg3); \
122 err = name; \95 register long int __g1 __asm__("g1") = (name); \
123 __asm __volatile (string : "=r" (err), "=r" (__o0) : \96 register long int __o0 __asm__ ("o0") = _arg1; \
124 "0" (err), "1" (__o0), "r" (__o1), \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 "r" (__o2) : \101 "r" (__o2) : \
126 __SYSCALL_CLOBBERS); \102 __SYSCALL_CLOBBERS); \
127 __o0; \103 __o0; \
128})104})
129105
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); \108 long int _arg1 = (long int) (arg1); \
133 register long __o1 __asm__ ("o1") = (long)(arg2); \109 long int _arg2 = (long int) (arg2); \
134 register long __o2 __asm__ ("o2") = (long)(arg3); \110 long int _arg3 = (long int) (arg3); \
135 register long __o3 __asm__ ("o3") = (long)(arg4); \111 long int _arg4 = (long int) (arg4); \
136 err = name; \112 register long int __g1 __asm__("g1") = (name); \
137 __asm __volatile (string : "=r" (err), "=r" (__o0) : \113 register long int __o0 __asm__ ("o0") = _arg1; \
138 "0" (err), "1" (__o0), "r" (__o1), \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 "r" (__o2), "r" (__o3) : \119 "r" (__o2), "r" (__o3) : \
140 __SYSCALL_CLOBBERS); \120 __SYSCALL_CLOBBERS); \
141 __o0; \121 __o0; \
142})122})
143123
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); \126 long int _arg1 = (long int) (arg1); \
147 register long __o1 __asm__ ("o1") = (long)(arg2); \127 long int _arg2 = (long int) (arg2); \
148 register long __o2 __asm__ ("o2") = (long)(arg3); \128 long int _arg3 = (long int) (arg3); \
149 register long __o3 __asm__ ("o3") = (long)(arg4); \129 long int _arg4 = (long int) (arg4); \
150 register long __o4 __asm__ ("o4") = (long)(arg5); \130 long int _arg5 = (long int) (arg5); \
151 err = name; \131 register long int __g1 __asm__("g1") = (name); \
152 __asm __volatile (string : "=r" (err), "=r" (__o0) : \132 register long int __o0 __asm__ ("o0") = _arg1; \
153 "0" (err), "1" (__o0), "r" (__o1), \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 "r" (__o2), "r" (__o3), "r" (__o4) : \139 "r" (__o2), "r" (__o3), "r" (__o4) : \
155 __SYSCALL_CLOBBERS); \140 __SYSCALL_CLOBBERS); \
156 __o0; \141 __o0; \
157})142})
158143
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); \146 long int _arg1 = (long int) (arg1); \
162 register long __o1 __asm__ ("o1") = (long)(arg2); \147 long int _arg2 = (long int) (arg2); \
163 register long __o2 __asm__ ("o2") = (long)(arg3); \148 long int _arg3 = (long int) (arg3); \
164 register long __o3 __asm__ ("o3") = (long)(arg4); \149 long int _arg4 = (long int) (arg4); \
165 register long __o4 __asm__ ("o4") = (long)(arg5); \150 long int _arg5 = (long int) (arg5); \
166 register long __o5 __asm__ ("o5") = (long)(arg6); \151 long int _arg6 = (long int) (arg6); \
167 err = name; \152 register long int __g1 __asm__("g1") = (name); \
168 __asm __volatile (string : "=r" (err), "=r" (__o0) : \153 register long int __o0 __asm__ ("o0") = _arg1; \
169 "0" (err), "1" (__o0), "r" (__o1), \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 "r" (__o2), "r" (__o3), "r" (__o4), \161 "r" (__o2), "r" (__o3), "r" (__o4), \
171 "r" (__o5) : \162 "r" (__o5) : \
172 __SYSCALL_CLOBBERS); \163 __SYSCALL_CLOBBERS); \
...@@ -175,20 +166,25 @@...@@ -175,20 +166,25 @@
175166
176#define INLINE_CLONE_SYSCALL(arg1,arg2,arg3,arg4,arg5) \167#define INLINE_CLONE_SYSCALL(arg1,arg2,arg3,arg4,arg5) \
177({ \168({ \
178 register long __o0 __asm__ ("o0") = (long)(arg1); \169 long int _arg1 = (long int) (arg1); \
179 register long __o1 __asm__ ("o1") = (long)(arg2); \170 long int _arg2 = (long int) (arg2); \
180 register long __o2 __asm__ ("o2") = (long)(arg3); \171 long int _arg3 = (long int) (arg3); \
181 register long __o3 __asm__ ("o3") = (long)(arg4); \172 long int _arg4 = (long int) (arg4); \
182 register long __o4 __asm__ ("o4") = (long)(arg5); \173 long int _arg5 = (long int) (arg5); \
183 register long __g1 __asm__ ("g1") = __NR_clone; \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 __asm __volatile (__SYSCALL_STRING : \180 __asm __volatile (__SYSCALL_STRING : \
185 "=r" (__g1), "=r" (__o0), "=r" (__o1) : \181 "=r" (__o0), "=r" (__o1) : \
186 "0" (__g1), "1" (__o0), "2" (__o1), \182 "r" (__g1), "0" (__o0), "1" (__o1), \
187 "r" (__o2), "r" (__o3), "r" (__o4) : \183 "r" (__o2), "r" (__o3), "r" (__o4) : \
188 __SYSCALL_CLOBBERS); \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 __o0 = -1L; \188 __o0 = -1L; \
193 } \189 } \
194 else \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
27struct __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,4 +1,4 @@
1/* Copyright (C) 1995-2020 Free Software Foundation, Inc.1/* Copyright (C) 1995-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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,4 +1,4 @@
1/* Copyright (C) 1995-2020 Free Software Foundation, Inc.1/* Copyright (C) 1995-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -54,17 +54,34 @@ struct ntptimeval...@@ -54,17 +54,34 @@ struct ntptimeval
5454
55__BEGIN_DECLS55__BEGIN_DECLS
5656
57extern int __adjtimex (struct timex *__ntx) __THROW;57#ifndef __USE_TIME_BITS64
58extern int adjtimex (struct timex *__ntx) __THROW;58extern int adjtimex (struct timex *__ntx) __THROW;
59extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW;
5960
60#ifdef __REDIRECT_NTH61# ifdef __REDIRECT_NTH
61extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv),62extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv),
62 ntp_gettimex);63 ntp_gettimex);
64# else
65# define ntp_gettime ntp_gettimex
66# endif
67extern int ntp_adjtime (struct timex *__tntx) __THROW;
63#else68#else
64extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW;69# ifdef __REDIRECT_NTH
65# define ntp_gettime ntp_gettimex70extern int __REDIRECT_NTH (adjtimex, (struct timex *__ntx),
71 ___adjtimex64);
72extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv),
73 __ntp_gettime64);
74extern int __REDIRECT_NTH (ntp_gettimex, (struct ntptimeval *__ntv),
75 __ntp_gettimex64);
76extern 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#endif84#endif
67extern int ntp_adjtime (struct timex *__tntx) __THROW;
6885
69__END_DECLS86__END_DECLS
7087
lib/libc/glibc/sysdeps/unix/sysv/linux/sysdep.h+38-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 2015-2020 Free Software Foundation, Inc.1/* Copyright (C) 2015-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -15,8 +15,40 @@...@@ -15,8 +15,40 @@
15 License along with the GNU C Library; if not, see15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */16 <https://www.gnu.org/licenses/>. */
1717
18#ifndef _SYSDEP_LINUX_H
19#define _SYSDEP_LINUX_H
20
18#include <bits/wordsize.h>21#include <bits/wordsize.h>
19#include <kernel-features.h>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))
2052
21/* Set error number and return -1. A target may choose to return the53/* Set error number and return -1. A target may choose to return the
22 internal function, __syscall_error, which sets errno and returns -1.54 internal function, __syscall_error, which sets errno and returns -1.
...@@ -63,6 +95,8 @@...@@ -63,6 +95,8 @@
63 (long) (val), \95 (long) (val), \
64 (long) (((uint64_t) (val)) >> 32)96 (long) (((uint64_t) (val)) >> 32)
6597
66/* Exports the __send symbol on send.c linux implementation (some ABI have98/* Export the ___brk_addr symbol on brk.c implementation (some ABIs export
67 it missing due the usage of a old generic version without it). */99 it due and old crtstuff.c code). */
68#define HAVE_INTERNAL_SEND_SYMBOL 1100#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
46struct 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. */
119struct 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,5 +1,5 @@
1/* bits/typesizes.h -- underlying types for *_t. Linux/x86-64 version.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -64,6 +64,7 @@...@@ -64,6 +64,7 @@
64#define __TIME_T_TYPE __SYSCALL_SLONG_TYPE64#define __TIME_T_TYPE __SYSCALL_SLONG_TYPE
65#define __USECONDS_T_TYPE __U32_TYPE65#define __USECONDS_T_TYPE __U32_TYPE
66#define __SUSECONDS_T_TYPE __SYSCALL_SLONG_TYPE66#define __SUSECONDS_T_TYPE __SYSCALL_SLONG_TYPE
67#define __SUSECONDS64_T_TYPE __SQUAD_TYPE
67#define __DADDR_T_TYPE __S32_TYPE68#define __DADDR_T_TYPE __S32_TYPE
68#define __KEY_T_TYPE __S32_TYPE69#define __KEY_T_TYPE __S32_TYPE
69#define __CLOCKID_T_TYPE __S32_TYPE70#define __CLOCKID_T_TYPE __S32_TYPE
...@@ -87,10 +88,15 @@...@@ -87,10 +88,15 @@
8788
88/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */89/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */
89# define __STATFS_MATCHES_STATFS64 190# define __STATFS_MATCHES_STATFS64 1
91
92/* And for getitimer, setitimer and rusage */
93# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1
90#else94#else
91# define __RLIM_T_MATCHES_RLIM64_T 095# define __RLIM_T_MATCHES_RLIM64_T 0
9296
93# define __STATFS_MATCHES_STATFS64 097# define __STATFS_MATCHES_STATFS64 0
98
99# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0
94#endif100#endif
95101
96/* Number of descriptors that can fit in an `fd_set'. */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,4 +1,4 @@
1/* Copyright (C) 1998-2020 Free Software Foundation, Inc.1/* Copyright (C) 1998-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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,6 +1,6 @@
1/* Set flags signalling availability of kernel features based on given1/* Set flags signalling availability of kernel features based on given
2 kernel version number. x86-64 version.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 This file is part of the GNU C Library.4 This file is part of the GNU C Library.
55
6 The GNU C Library is free software; you can redistribute it and/or6 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,4 +1,4 @@
1/* Copyright (C) 2001-2020 Free Software Foundation, Inc.1/* Copyright (C) 2001-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -33,13 +33,6 @@...@@ -33,13 +33,6 @@
33#undef SYS_ify33#undef SYS_ify
34#define SYS_ify(syscall_name) __NR_##syscall_name34#define SYS_ify(syscall_name) __NR_##syscall_name
3535
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#ifdef __ASSEMBLER__36#ifdef __ASSEMBLER__
4437
45/* Linux uses a negative return value to indicate syscall errors,38/* Linux uses a negative return value to indicate syscall errors,
...@@ -55,19 +48,40 @@...@@ -55,19 +48,40 @@
5548
56/* We don't want the label for the error handle to be global when we define49/* We don't want the label for the error handle to be global when we define
57 it here. */50 it here. */
51# undef SYSCALL_ERROR_LABEL
58# ifdef PIC52# ifdef PIC
53# undef SYSCALL_ERROR_LABEL
59# define SYSCALL_ERROR_LABEL 0f54# define SYSCALL_ERROR_LABEL 0f
60# else55# else
56# undef SYSCALL_ERROR_LABEL
61# define SYSCALL_ERROR_LABEL syscall_error57# define SYSCALL_ERROR_LABEL syscall_error
62# endif58# endif
6359
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# undef PSEUDO69# undef PSEUDO
65# define PSEUDO(name, syscall_name, args) \70# if SYSCALL_ULONG_ARG_1
66 .text; \71# define PSEUDO(name, syscall_name, args, ulong_arg_1, ulong_arg_2) \
67 ENTRY (name) \72 .text; \
68 DO_CALL (syscall_name, args); \73 ENTRY (name) \
69 cmpq $-4095, %rax; \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 jae SYSCALL_ERROR_LABEL83 jae SYSCALL_ERROR_LABEL
84# endif
7185
72# undef PSEUDO_END86# undef PSEUDO_END
73# define PSEUDO_END(name) \87# define PSEUDO_END(name) \
...@@ -75,10 +89,17 @@...@@ -75,10 +89,17 @@
75 END (name)89 END (name)
7690
77# undef PSEUDO_NOERRNO91# undef PSEUDO_NOERRNO
78# define PSEUDO_NOERRNO(name, syscall_name, args) \92# if SYSCALL_ULONG_ARG_1
79 .text; \93# define PSEUDO_NOERRNO(name, syscall_name, args, ulong_arg_1, ulong_arg_2) \
80 ENTRY (name) \94 .text; \
81 DO_CALL (syscall_name, args)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
82103
83# undef PSEUDO_END_NOERRNO104# undef PSEUDO_END_NOERRNO
84# define PSEUDO_END_NOERRNO(name) \105# define PSEUDO_END_NOERRNO(name) \
...@@ -87,11 +108,19 @@...@@ -87,11 +108,19 @@
87# define ret_NOERRNO ret108# define ret_NOERRNO ret
88109
89# undef PSEUDO_ERRVAL110# undef PSEUDO_ERRVAL
90# define PSEUDO_ERRVAL(name, syscall_name, args) \111# if SYSCALL_ULONG_ARG_1
91 .text; \112# define PSEUDO_ERRVAL(name, syscall_name, args, ulong_arg_1, ulong_arg_2) \
92 ENTRY (name) \113 .text; \
93 DO_CALL (syscall_name, args); \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 negq %rax122 negq %rax
123# endif
95124
96# undef PSEUDO_END_ERRVAL125# undef PSEUDO_END_ERRVAL
97# define PSEUDO_END_ERRVAL(name) \126# define PSEUDO_END_ERRVAL(name) \
...@@ -163,8 +192,10 @@...@@ -163,8 +192,10 @@
163 Syscalls of more than 6 arguments are not supported. */192 Syscalls of more than 6 arguments are not supported. */
164193
165# undef DO_CALL194# undef DO_CALL
166# define DO_CALL(syscall_name, args) \195# define DO_CALL(syscall_name, args, ulong_arg_1, ulong_arg_2) \
167 DOARGS_##args \196 DOARGS_##args \
197 ZERO_EXTEND_##ulong_arg_1 \
198 ZERO_EXTEND_##ulong_arg_2 \
168 movl $SYS_ify (syscall_name), %eax; \199 movl $SYS_ify (syscall_name), %eax; \
169 syscall;200 syscall;
170201
...@@ -176,57 +207,39 @@...@@ -176,57 +207,39 @@
176# define DOARGS_5 DOARGS_4207# define DOARGS_5 DOARGS_4
177# define DOARGS_6 DOARGS_5208# define DOARGS_6 DOARGS_5
178209
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#else /* !__ASSEMBLER__ */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)
209219
210/* Registers clobbered by syscall. */220/* Registers clobbered by syscall. */
211# define REGISTERS_CLOBBERED_BY_SYSCALL "cc", "r11", "cx"221# define REGISTERS_CLOBBERED_BY_SYSCALL "cc", "r11", "cx"
212222
213/* Create a variable 'name' based on type 'X' to avoid explicit types.223/* NB: This also works when X is an array. For an array X, type of
214 This is mainly used set use 64-bits arguments in x32. */224 (X) - (X) is ptrdiff_t, which is signed, since size of ptrdiff_t
215#define TYPEFY(X, name) __typeof__ ((X) - (X)) name225 == size of pointer, cast is a NOP. */
216/* Explicit cast the argument to avoid integer from pointer warning on226#define TYPEFY1(X) __typeof__ ((X) - (X))
217 x32. */227/* Explicit cast the argument. */
218#define ARGIFY(X) ((__typeof__ ((X) - (X))) (X))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
219232
220#undef INTERNAL_SYSCALL233#undef INTERNAL_SYSCALL
221#define INTERNAL_SYSCALL(name, err, nr, args...) \234#define INTERNAL_SYSCALL(name, nr, args...) \
222 internal_syscall##nr (SYS_ify (name), err, args)235 internal_syscall##nr (SYS_ify (name), args)
223236
224#undef INTERNAL_SYSCALL_NCS237#undef INTERNAL_SYSCALL_NCS
225#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \238#define INTERNAL_SYSCALL_NCS(number, nr, args...) \
226 internal_syscall##nr (number, err, args)239 internal_syscall##nr (number, args)
227240
228#undef internal_syscall0241#undef internal_syscall0
229#define internal_syscall0(number, err, dummy...) \242#define internal_syscall0(number, dummy...) \
230({ \243({ \
231 unsigned long int resultvar; \244 unsigned long int resultvar; \
232 asm volatile ( \245 asm volatile ( \
...@@ -238,7 +251,7 @@...@@ -238,7 +251,7 @@
238})251})
239252
240#undef internal_syscall1253#undef internal_syscall1
241#define internal_syscall1(number, err, arg1) \254#define internal_syscall1(number, arg1) \
242({ \255({ \
243 unsigned long int resultvar; \256 unsigned long int resultvar; \
244 TYPEFY (arg1, __arg1) = ARGIFY (arg1); \257 TYPEFY (arg1, __arg1) = ARGIFY (arg1); \
...@@ -252,7 +265,7 @@...@@ -252,7 +265,7 @@
252})265})
253266
254#undef internal_syscall2267#undef internal_syscall2
255#define internal_syscall2(number, err, arg1, arg2) \268#define internal_syscall2(number, arg1, arg2) \
256({ \269({ \
257 unsigned long int resultvar; \270 unsigned long int resultvar; \
258 TYPEFY (arg2, __arg2) = ARGIFY (arg2); \271 TYPEFY (arg2, __arg2) = ARGIFY (arg2); \
...@@ -268,7 +281,7 @@...@@ -268,7 +281,7 @@
268})281})
269282
270#undef internal_syscall3283#undef internal_syscall3
271#define internal_syscall3(number, err, arg1, arg2, arg3) \284#define internal_syscall3(number, arg1, arg2, arg3) \
272({ \285({ \
273 unsigned long int resultvar; \286 unsigned long int resultvar; \
274 TYPEFY (arg3, __arg3) = ARGIFY (arg3); \287 TYPEFY (arg3, __arg3) = ARGIFY (arg3); \
...@@ -286,7 +299,7 @@...@@ -286,7 +299,7 @@
286})299})
287300
288#undef internal_syscall4301#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 unsigned long int resultvar; \304 unsigned long int resultvar; \
292 TYPEFY (arg4, __arg4) = ARGIFY (arg4); \305 TYPEFY (arg4, __arg4) = ARGIFY (arg4); \
...@@ -306,7 +319,7 @@...@@ -306,7 +319,7 @@
306})319})
307320
308#undef internal_syscall5321#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 unsigned long int resultvar; \324 unsigned long int resultvar; \
312 TYPEFY (arg5, __arg5) = ARGIFY (arg5); \325 TYPEFY (arg5, __arg5) = ARGIFY (arg5); \
...@@ -329,7 +342,7 @@...@@ -329,7 +342,7 @@
329})342})
330343
331#undef internal_syscall6344#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 unsigned long int resultvar; \347 unsigned long int resultvar; \
335 TYPEFY (arg6, __arg6) = ARGIFY (arg6); \348 TYPEFY (arg6, __arg6) = ARGIFY (arg6); \
...@@ -353,12 +366,6 @@...@@ -353,12 +366,6 @@
353 (long int) resultvar; \366 (long int) resultvar; \
354})367})
355368
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))
362369
363# define VDSO_NAME "LINUX_2.6"370# define VDSO_NAME "LINUX_2.6"
364# define VDSO_HASH 61765110371# define VDSO_HASH 61765110
...@@ -370,6 +377,8 @@...@@ -370,6 +377,8 @@
370# define HAVE_GETCPU_VSYSCALL "__vdso_getcpu"377# define HAVE_GETCPU_VSYSCALL "__vdso_getcpu"
371# define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres"378# define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres"
372379
380# define HAVE_CLONE3_WRAPPER 1
381
373# define SINGLE_THREAD_BY_GLOBAL 1382# define SINGLE_THREAD_BY_GLOBAL 1
374383
375#endif /* __ASSEMBLER__ */384#endif /* __ASSEMBLER__ */
lib/libc/glibc/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h+36-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* Copyright (C) 2012-2020 Free Software Foundation, Inc.1/* Copyright (C) 2012-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 The GNU C Library is free software; you can redistribute it and/or
...@@ -26,4 +26,39 @@...@@ -26,4 +26,39 @@
26#undef LO_HI_LONG26#undef LO_HI_LONG
27#define LO_HI_LONG(val) (val)27#define LO_HI_LONG(val) (val)
2828
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#endif /* linux/x86_64/x32/sysdep.h */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,4 +1,4 @@
1/* Copyright (C) 1991-2020 Free Software Foundation, Inc.1/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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,5 +1,5 @@
1/* Hacks needed for divdi3 symbol manipulation.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,4 +1,4 @@
1/* Copyright (C) 2002-2020 Free Software Foundation, Inc.1/* Copyright (C) 2002-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.2 This file is part of the GNU C Library.
33
4 The GNU C Library is free software; you can redistribute it and/or4 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,5 +1,5 @@
1/* Assembler macros for x86.1/* Assembler macros for x86.
2 Copyright (C) 2017-2020 Free Software Foundation, Inc.2 Copyright (C) 2017-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -57,6 +57,11 @@ enum cf_protection_level...@@ -57,6 +57,11 @@ enum cf_protection_level
57#define STATE_SAVE_MASK \57#define STATE_SAVE_MASK \
58 ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 5) | (1 << 6) | (1 << 7))58 ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 5) | (1 << 6) | (1 << 7))
5959
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#ifdef __ASSEMBLER__65#ifdef __ASSEMBLER__
6166
62/* Syntactic details of assembler. */67/* Syntactic details of assembler. */
lib/libc/glibc/sysdeps/x86_64/crti.S+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Special .init and .fini section support for x86-64.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Special .init and .fini section support for x86-64.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,5 +1,5 @@
1/* Startup code compliant to the ELF x86-64 ABI.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
4 Contributed by Andreas Jaeger <aj@suse.de>, 2001.4 Contributed by Andreas Jaeger <aj@suse.de>, 2001.
55
...@@ -96,17 +96,13 @@ ENTRY (_start)...@@ -96,17 +96,13 @@ ENTRY (_start)
96 which grow downwards). */96 which grow downwards). */
97 pushq %rsp97 pushq %rsp
9898
99#ifdef PIC99 /* These used to be the addresses of .fini and .init. */
100 /* Pass address of our own entry points to .fini and .init. */100 xorl %r8d, %r8d
101 mov __libc_csu_fini@GOTPCREL(%rip), %R8_LP101 xorl %ecx, %ecx
102 mov __libc_csu_init@GOTPCREL(%rip), %RCX_LP
103102
103#ifdef PIC
104 mov main@GOTPCREL(%rip), %RDI_LP104 mov main@GOTPCREL(%rip), %RDI_LP
105#else105#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 mov $main, %RDI_LP106 mov $main, %RDI_LP
111#endif107#endif
112108
lib/libc/glibc/sysdeps/x86_64/sysdep.h+23-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Assembler macros for x86-64.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 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 The GNU C Library is free software; you can redistribute it and/or
...@@ -95,6 +95,28 @@ lose: \...@@ -95,6 +95,28 @@ lose: \
95#define R14_LP r1495#define R14_LP r14
96#define R15_LP r1596#define R15_LP r15
9797
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; \
1051: \
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#else /* __ASSEMBLER__ */120#else /* __ASSEMBLER__ */
99121
100/* Long and pointer size in bytes. */122/* Long and pointer size in bytes. */
lib/libc/glibc/sysdeps/x86_64/x32/sysdep.h+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1/* Assembler macros for x32.1/* Assembler macros for x32.
2 Copyright (C) 2012-2020 Free Software Foundation, Inc.2 Copyright (C) 2012-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.3 This file is part of the GNU C Library.
44
5 The GNU C Library is free software; you can redistribute it and/or5 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,15 +4,20 @@
44
5#include <bits/types.h>5#include <bits/types.h>
6#include <bits/endian.h>6#include <bits/endian.h>
7#include <bits/types/time_t.h>
78
8/* POSIX.1b structure for a time value. This is like a `struct timeval' but9/* POSIX.1b structure for a time value. This is like a `struct timeval' but
9 has nanoseconds instead of microseconds. */10 has nanoseconds instead of microseconds. */
10struct timespec11struct timespec
11{12{
13#ifdef __USE_TIME_BITS64
14 __time64_t tv_sec; /* Seconds. */
15#else
12 __time_t tv_sec; /* Seconds. */16 __time_t tv_sec; /* Seconds. */
17#endif
13#if __WORDSIZE == 64 \18#if __WORDSIZE == 64 \
14 || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) \19 || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) \
15 || __TIMESIZE == 3220 || (__TIMESIZE == 32 && !defined __USE_TIME_BITS64)
16 __syscall_slong_t tv_nsec; /* Nanoseconds. */21 __syscall_slong_t tv_nsec; /* Nanoseconds. */
17#else22#else
18# if __BYTE_ORDER == __BIG_ENDIAN23# if __BYTE_ORDER == __BIG_ENDIAN
lib/libc/glibc/time/bits/types/struct_timeval.h+5
...@@ -7,7 +7,12 @@...@@ -7,7 +7,12 @@
7 microsecond but also has a range of years. */7 microsecond but also has a range of years. */
8struct timeval8struct timeval
9{9{
10#ifdef __USE_TIME_BITS64
11 __time64_t tv_sec; /* Seconds. */
12 __suseconds64_t tv_usec; /* Microseconds. */
13#else
10 __time_t tv_sec; /* Seconds. */14 __time_t tv_sec; /* Seconds. */
11 __suseconds_t tv_usec; /* Microseconds. */15 __suseconds_t tv_usec; /* Microseconds. */
16#endif
12};17};
13#endif18#endif
lib/libc/glibc/time/bits/types/time_t.h+4
...@@ -4,6 +4,10 @@...@@ -4,6 +4,10 @@
4#include <bits/types.h>4#include <bits/types.h>
55
6/* Returned by `time'. */6/* Returned by `time'. */
7#ifdef __USE_TIME_BITS64
8typedef __time64_t time_t;
9#else
7typedef __time_t time_t;10typedef __time_t time_t;
11#endif
812
9#endif13#endif
src/glibc.zig+5-38
...@@ -282,46 +282,13 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {...@@ -282,46 +282,13 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
282 lib_libc_glibc ++ "io" ++ path.sep_str ++ "fstatat64.c",282 lib_libc_glibc ++ "io" ++ path.sep_str ++ "fstatat64.c",
283 lib_libc_glibc ++ "io" ++ path.sep_str ++ "mknod.c",283 lib_libc_glibc ++ "io" ++ path.sep_str ++ "mknod.c",
284 lib_libc_glibc ++ "io" ++ path.sep_str ++ "mknodat.c",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 lib_libc_glibc ++ "debug" ++ path.sep_str ++ "stack_chk_fail_local.c",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 };
288290
289 var c_source_files: [deps.len + 1]Compilation.CSourceFile = undefined;291 var c_source_files: [deps.len]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 };
325292
326 for (deps) |dep, i| {293 for (deps) |dep, i| {
327 var args = std.ArrayList([]const u8).init(arena);294 var args = std.ArrayList([]const u8).init(arena);
...@@ -347,7 +314,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {...@@ -347,7 +314,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
347 "-DLIBC_NONSHARED=1",314 "-DLIBC_NONSHARED=1",
348 "-DTOP_NAMESPACE=glibc",315 "-DTOP_NAMESPACE=glibc",
349 });316 });
350 c_source_files[i + 1] = .{317 c_source_files[i] = .{
351 .src_path = try lib_path(comp, arena, dep),318 .src_path = try lib_path(comp, arena, dep),
352 .extra_flags = args.items,319 .extra_flags = args.items,
353 };320 };
test/standalone.zig+1
...@@ -84,5 +84,6 @@ pub fn addCases(cases: *tests.StandaloneContext) void {...@@ -84,5 +84,6 @@ pub fn addCases(cases: *tests.StandaloneContext) void {
84 cases.add("tools/gen_stubs.zig");84 cases.add("tools/gen_stubs.zig");
85 cases.add("tools/update_clang_options.zig");85 cases.add("tools/update_clang_options.zig");
86 cases.add("tools/update_cpu_features.zig");86 cases.add("tools/update_cpu_features.zig");
87 cases.add("tools/update_glibc.zig");
87 cases.add("tools/update_spirv_features.zig");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
9const std = @import("std");
10const mem = std.mem;
11const log = std.log;
12const fs = std.fs;
13
14const 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
24pub 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
68fn fatal(comptime format: []const u8, args: anytype) noreturn {
69 log.err(format, args);
70 std.process.exit(1);
71}