summaryrefslogtreecommitdiff
path: root/manual
AgeCommit message (Collapse)Author
2025-11-20Implement C23 const-preserving standard library macrosJoseph Myers
C23 makes various standard library functions, that return a pointer into an input array, into macros that return a pointer to const when the relevant argument passed to the macro is a pointer to const. (The requirement is for macros, with the existing function types applying when macro expansion is suppressed. When a null pointer constant is passed, such as integer 0, that's the same as a pointer to non-const.) Implement this feature. This only applies to C, not C++, since such macros are not an appropriate way of doing this for C++ and all the affected functions other than bsearch have overloads to implement an equivalent feature for C++ anyway. Nothing is done to apply such a change to any non-C23 functions with the same property of returning a pointer into an input array. The feature is also disabled when _LIBC is defined, since there are various places in glibc that either redefine these identifiers as macros, or define the functions themselves, and would need changing to work in the presence of these macro definitions. A natural question is whether we should in fact change those places and not disable the macro definitions for _LIBC. If so, we'd need a solution for the places in glibc that define the macro *before* including the relevant header (in order in effect to disable the header declaration of the function by renaming that declaration). One testcase has #undef added to avoid conflicting with this feature and another has const added; -Wno-discarded-qualifiers is added for building zic (but could be removed once there's a new upstream tzcode release that's const-safe with this C23 change and glibc has updated to code from that new release). Probably other places in glibc proper would need const added if we remove the _LIBC conditionals. Another question would be whether some GCC extension should be added to support this feature better with macros that only expand each argument once (as well as reducing duplication of diagnostics for bad usages such as non-pointer and pointer-to-volatile-qualfied arguments). Tested for x86_64.
2025-11-19malloc: add free_sized and free_aligned_sized from C23Justin King
Signed-off-by: Justin King <jcking@google.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-11-18Remove support for lock elision.Stefan Liebler
The support for lock elision was already deprecated with glibc 2.42: commit 77438db8cfa6ee66b3906230156bdae11c49a195 "Mark support for lock elision as deprecated." See also discussions: https://sourceware.org/pipermail/libc-alpha/2025-July/168492.html This patch removes the architecture specific support for lock elision for x86, powerpc and s390 by removing the elision-conf.h, elision-conf.c, elision-lock.c, elision-timed.c, elision-unlock.c, elide.h, htm.h/hle.h files. Those generic files are also removed. The architecture specific structures are adjusted and the elision fields are marked as unused. See struct_mutex.h files. Furthermore in struct_rwlock.h, the leftover __rwelision was also removed. Those were originally removed with commit 0377a7fde6dfcc078dda29a1225d7720a0931357 "nptl: Remove rwlock elision definitions" and by chance reintroduced with commit 7df8af43ad1cd8ce527444de50bee6f35eebe071 "nptl: Add struct_rwlock.h" The common code (e.g. the pthread_mutex-files) are changed back to the time before lock elision was introduced with the x86-support: - commit 1cdbe579482c07e9f4bb3baa4864da2d3e7eb837 "Add the low level infrastructure for pthreads lock elision with TSX" - commit b023e4ca99f5e81f90d87d23cd267ef2abd2388c "Add new internal mutex type flags for elision." - commit 68cc29355f3334c7ad18f648ff9a6383a0916d23 "Add minimal test suite changes for elision enabled kernels" - commit e8c659d74e011346785355eeef03b7fb6f533c61 "Add elision to pthread_mutex_{try,timed,un}lock" - commit 49186d21ef2d87986bccaf0a7c45c48c91b265f3 "Disable elision for any pthread_mutexattr_settype call" - commit 1717da59aed9612becd56aaa1249aac695af4c8a "Add a configure option to enable lock elision and disable by default" Elision is removed also from the tunables, the initialization part, the pretty-printers and the manual. Some extra handling in the testsuite is removed as well as the full tst-mutex10 testcase, which tested a race while enabling lock elision. I've also searched the code for "elision", "elide", "transaction" and e.g. cleaned some comments. I've run the testsuite on x86_64 and s390x and run the build-many-glibcs.py script. Thanks to Sachin Monga, this patch is also tested on powerpc. A NEWS entry also mentions the removal. Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2025-11-17manual: don't use the FSF's old address in license text.Collin Funk
Update to latest text from Gnulib commit 08f579c56d81cf78c60fcd3568190f97e6e7f684, file doc/lgpl-2.1.texi. Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-11-13Change fromfp functions to return floating types following C23 (bug 28327)Joseph Myers
As discussed in bug 28327, C23 changed the fromfp functions to return floating types instead of intmax_t / uintmax_t. (Although the motivation in N2548 was reducing the use of intmax_t in library interfaces, the new version does have the advantage of being able to specify arbitrary integer widths for e.g. assigning the result to a _BitInt, as well as being able to indicate an error case in-band with a NaN return.) As with other such changes from interfaces introduced in TS 18661, implement the new types as a replacement for the old ones, with the old functions remaining as compat symbols but not supported as an API. The test generator used for many of the tests is updated to handle both versions of the functions. Tested for x86_64 and x86, and with build-many-glibcs.py. Also tested tgmath tests for x86_64 with GCC 7 to make sure that the modified case for older compilers in <tgmath.h> does work. Also tested for powerpc64le to cover the ldbl-128ibm implementation and the other things that are handled differently for that configuration. The new tests fail for ibm128, but all the failures relate to incorrect signs of zero results and turn out to arise from bugs in the underlying roundl, ceill, truncl and floorl implementations that I've reported in bug 33623, rather than indicating any bug in the actual new implementation of the functions for that format. So given fixes for those functions (which shouldn't be hard, and of course should add to the tests for those functions rather than relying only on indirect testing via fromfp), the fromfp tests should start passing for ibm128 as well.
2025-11-12linux: Add mseal syscall supportAdhemerval Zanella
It has been added on Linux 6.10 (8be7258aad44b5e25977a98db136f677fa6f4370) as a way to block operations such as mapping, moving to another location, shrinking the size, expanding the size, or modifying it to a pre-existing memory mapping. Although the system only works on 64-bit CPUs, the entrypoint was added for all ABIs (since the kernel might eventually implement it for additional ones and/or the ABI can execute on a 64-bit kernel). Checked on x86_64-linux-gnu and aarch64-linux-gnu. Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-11-11stdlib: Do not define once_flag, ONCE_FLAG_INIT for C++Florian Weimer
The definition of once_flag conflicts with std::once_flag in if “using namespace std;” is active. Updates commit a7ddbf456d97ac8d1aa7afd735e196a1488bd874 ("Add once_flag, ONCE_FLAG_INIT and call_once to stdlib.h for C23"). Suggested-by: Jonathan Wakely <jwakely@redhat.com> Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-11-04Add feature test macros for POSIX.1-2024.Collin Funk
* include/features.h (_POSIX_C_SOURCE): Document the value of 202405L for POSIX.1-2024. Set it to 202405L when _GNU_SOURCE or _DEFAULT_SOURCE is defined. (_XOPEN_SOURCE): Document the value of 800 for POSIX-1.2024. Set it to 800 when _GNU_SOURCE is defined. (__USE_XOPEN2K24, __USE_XOPEN2K24XSI): New internal macros. Set them when _POSIX_C_SOURCE is 202405L or greater and/or when _XOPEN_SOURCE is 800 or greater. * manual/creature.texi (Feature Test Macros): Document the new values for _POSIX_C_SOURCE and _XOPEN_SOURCE. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Signed-off-by: Collin Funk <collin.funk1@gmail.com>
2025-11-03docs: Add dynamic linker environment variable docsFrédéric Bérat
The Dynamic Linker chapter now includes a new section detailing environment variables that influence its behavior. This new section documents the `LD_DEBUG` environment variable, explaining how to enable debugging output and listing its various keywords like `libs`, `reloc`, `files`, `symbols`, `bindings`, `versions`, `scopes`, `tls`, `all`, `statistics`, `unused`, and `help`. It also documents `LD_DEBUG_OUTPUT`, which controls where the debug output is written, allowing redirection to a file with the process ID appended. This provides users with essential information for controlling and debugging the dynamic linker. Reviewed-by: DJ Delorie <dj@redhat.com>
2025-10-28Rename uimaxabs to umaxabs (bug 33325)Joseph Myers
The C2y function uimaxabs has been renamed to umaxabs. Implement this change in glibc, keeping a compat symbol under the old name, copying the test to test the new name and changing the old test to test the compat symbol. Jakub has done the corresponding change to the built-in function in GCC. Tested for x86_64 and x86.
2025-10-17Implement C23 memalignmentJoseph Myers
Add the C23 memalignment function (query the alignment of a pointer) to glibc. Given how simple this operation is, it would make sense for compilers to inline calls to this function, but I'm treating that as a compiler matter (compilers should add it as a built-in function) rather than adding an inline version to glibc headers (although such an inline version would be reasonable as well). I've filed https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122117 for this feature in GCC. Tested for x86_64 and x86.
2025-10-06manual: check the correct variable in SIOCATMARK example [BZ #33093]Collin Funk
* manual/socket.texi (Out-of-Band Data): Check the atmark variable which is set by the ioctl instead of the undefined result variable. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-10-06manual: describe syscall numbers not supported via syscall()Yury Khrustalev
The syscall() function allows to make system calls directly, however, in the case of system calls that affect internal state of process or thread, the caller would have to take care of extensive setup necessary for the internals of Glibc to work correctly in the child threads. This may make using syscall() with these syscall numbers impractical and prone to undefined behaviour. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-10-05manual: fix some mistakes in the indices [BZ #24657]Bruno Haible
* manual/errno.texi (Error Messages): Add error_print_progname to the variable index. * manual/sysinfo.texi (Host Identification): Fix typo of the getdomainname function. Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-10-03manual: Fix missing reference to the mmap function [BZ #20473]Collin Funk
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-10-01Add once_flag, ONCE_FLAG_INIT and call_once to stdlib.h for C23Joseph Myers
C23 adds once_flag, ONCE_FLAG_INIT and call_once to stdlib.h (in C11 they were only in threads.h, in C23 they are in both headers; this change came from N2840). Implement this change, with a bits/types/once_flag.h header for the common type and initializer definitions. Note that there's an omnibus bug (bug 33001) that covers more than just these missing definitions. This doesn't seem a significant enough feature to be worth mentioning in NEWS. ISO C is not concerned with whether functions are in libc or libpthread, but POSIX links this to what header they are declared in, so functions declared in stdlib.h are supposed to be in libc. However, the current edition of POSIX is based on C17; hopefully Hurd glibc will have completed the merge of libpthread into libc (in particular, moving call_once) well before a future edition of POSIX based on C23 (or a later version of ISO C) is released. Tested for x86_64 and x86.
2025-10-01Implement C23 memset_explicit (bug 32378)Joseph Myers
Add the C23 memset_explicit function to glibc. Everything here is closely based on the approach taken for explicit_bzero. This includes the bits that relate to internal uses of explicit_bzero within glibc (although we don't currently have any such internal uses of memset_explicit), and also includes the nonnull attribute (when we move to nonnull_if_nonzero for various functions following C2y, this function should be included in that change). The function is declared both for __USE_MISC and for __GLIBC_USE (ISOC23) (so by default not just for compilers defaulting to C23 mode). Tested for x86_64 and x86.
2025-09-29manual: Fix missing declaration in inetcli example.Collin Funk
Previously this file failed to compile with the following errors: $ gcc manual/examples/inetcli.c manual/examples/inetcli.c: In function ‘write_to_server’: manual/examples/inetcli.c:36:37: error: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration] 36 | nbytes = write (filedes, MESSAGE, strlen (MESSAGE) + 1); | ^~~~~~ manual/examples/inetcli.c:26:1: note: include ‘<string.h>’ or provide a declaration of ‘strlen’ 25 | #include <netdb.h> +++ |+#include <string.h> 26 | manual/examples/inetcli.c:36:37: warning: incompatible implicit declaration of built-in function ‘strlen’ [-Wbuiltin-declaration-mismatch] 36 | nbytes = write (filedes, MESSAGE, strlen (MESSAGE) + 1); | ^~~~~~ manual/examples/inetcli.c:36:37: note: include ‘<string.h>’ or provide a declaration of ‘strlen’ Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-09-29manual: Fix compiler errors in inetsrv example.Collin Funk
Previously this file failed to compile with the following errors: $ gcc manual/examples/inetsrv.c manual/examples/inetsrv.c: In function ‘main’: manual/examples/inetsrv.c:97:31: error: passing argument 3 of ‘accept’ from incompatible pointer type [-Wincompatible-pointer-types] 97 | &size); | ^~~~~ | | | size_t * {aka long unsigned int *} In file included from manual/examples/inetsrv.c:23: /usr/include/sys/socket.h:307:42: note: expected ‘socklen_t * restrict’ {aka ‘unsigned int * restrict’} but argument is of type ‘size_t *’ {aka ‘long unsigned int *’} 307 | socklen_t *__restrict __addr_len); | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~ manual/examples/inetsrv.c:105:26: error: implicit declaration of function ‘inet_ntoa’ [-Wimplicit-function-declaration] 105 | inet_ntoa (clientname.sin_addr), Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-09-29manual: Fix compiler errors in filesrv example.Collin Funk
Previously this file failed to compile with the following errors: $ gcc manual/examples/filesrv.c manual/examples/filesrv.c: In function ‘main’: manual/examples/filesrv.c:37:3: error: implicit declaration of function ‘unlink’ [-Wimplicit-function-declaration] 37 | unlink (SERVER); | ^~~~~~ manual/examples/filesrv.c:40:10: error: implicit declaration of function ‘make_named_socket’ [-Wimplicit-function-declaration] 40 | sock = make_named_socket (SERVER); | ^~~~~~~~~~~~~~~~~ manual/examples/filesrv.c:46:54: error: passing argument 6 of ‘recvfrom’ from incompatible pointer type [-Wincompatible-pointer-types] 46 | (struct sockaddr *) & name, &size); | ^~~~~ | | | size_t * {aka long unsigned int *} In file included from manual/examples/filesrv.c:21: /usr/include/sys/socket.h:165:48: note: expected ‘socklen_t * restrict’ {aka ‘unsigned int * restrict’} but argument is of type ‘size_t *’ {aka ‘long unsigned int *’} 165 | socklen_t *__restrict __addr_len); | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~ This patch fixes the missing declaration for unlink and uses 'socklen_t *' for the fourth argument of recv from. The make_named_socket function is defined in the manual. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-09-29manual: Fix missing declaration in select example.Collin Funk
Without _GNU_SOURCE defined this file fails to compile with the following error: $ gcc manual/examples/select.c manual/examples/select.c: In function ‘input_timeout’: manual/examples/select.c:44:10: error: implicit declaration of function ‘TEMP_FAILURE_RETRY’ [-Wimplicit-function-declaration] 44 | return TEMP_FAILURE_RETRY (select (FD_SETSIZE, | ^~~~~~~~~~~~~~~~~~ Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-09-29manual: Fix missing declaration in setjmp example.Collin Funk
Previously this file would fail to compile with the following error: $ gcc manual/examples/setjmp.c manual/examples/setjmp.c: In function ‘main’: manual/examples/setjmp.c:37:7: error: implicit declaration of function ‘do_command’ [-Wimplicit-function-declaration] 37 | do_command (); | ^~~~~~~~~~ manual/examples/setjmp.c: At top level: manual/examples/setjmp.c:42:1: warning: conflicting types for ‘do_command’; have ‘void(void)’ 42 | do_command (void) | ^~~~~~~~~~ manual/examples/setjmp.c:37:7: note: previous implicit declaration of ‘do_command’ with type ‘void(void)’ 37 | do_command (); | ^~~~~~~~~~ Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-09-29manual: fix missing include in sigh1 example.Collin Funk
Previously this file would fail to compile with the following error: $ gcc manual/examples/sigh1.c manual/examples/sigh1.c: In function ‘main’: manual/examples/sigh1.c:46:3: error: implicit declaration of function ‘alarm’ [-Wimplicit-function-declaration] 46 | alarm (2); | ^~~~~ Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-09-29manual: Fix missing declaration in strdupa example.Collin Funk
Without _GNU_SOURCE defined this file fails to compile with the following error: $ gcc manual/examples/strdupa.c manual/examples/strdupa.c: In function ‘main’: manual/examples/strdupa.c:27:19: error: implicit declaration of function ‘strdupa’; did you mean ‘strdup’? [-Wimplicit-function-declaration] 27 | char *wr_path = strdupa (path); | ^~~~~~~ | strdup manual/examples/strdupa.c:27:19: error: initialization of ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion] Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-09-29manual: Allow getsubopt example to compile with GCC 15.Collin Funk
GCC 15 turned -Wincompatible-pointer-types into a compiler error instead of a warning by default. This patch prevents the following error: $ gcc manual/examples/subopt.c manual/examples/subopt.c: In function ‘main’: manual/examples/subopt.c:64:40: error: passing argument 2 of ‘getsubopt’ from incompatible pointer type [-Wincompatible-pointer-types] 64 | switch (getsubopt (&subopts, mount_opts, &value)) | ^~~~~~~~~~ | | | const char ** In file included from manual/examples/subopt.c:19: /usr/include/stdlib.h:1100:47: note: expected ‘char * const* restrict’ but argument is of type ‘const char **’ 1100 | char *const *__restrict __tokens, | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-09-29manual: Fix missing include in memopen example.Collin Funk
Previously this file would fail to compile with the following error: $ gcc manual/examples/memopen.c manual/examples/memopen.c: In function ‘main’: manual/examples/memopen.c:28:30: error: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration] 28 | stream = fmemopen (buffer, strlen (buffer), "r"); | ^~~~~~ manual/examples/memopen.c:19:1: note: include ‘<string.h>’ or provide a declaration of ‘strlen’ 18 | #include <stdio.h> +++ |+#include <string.h> 19 | manual/examples/memopen.c:28:30: warning: incompatible implicit declaration of built-in function ‘strlen’ [-Wbuiltin-declaration-mismatch] 28 | stream = fmemopen (buffer, strlen (buffer), "r"); | ^~~~~~ manual/examples/memopen.c:28:30: note: include ‘<string.h>’ or provide a declaration of ‘strlen’ Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-09-29manual: Fix missing declaration in twalk example.Collin Funk
Without _GNU_SOURCE defined this file fails to compile with the following error: $ gcc manual/examples/twalk.c manual/examples/twalk.c: In function ‘twalk’: manual/examples/twalk.c:55:3: error: implicit declaration of function ‘twalk_r’; did you mean ‘twalk’? [-Wimplicit-function-declaration] 55 | twalk_r (root, twalk_with_twalk_r_action, &closure); | ^~~~~~~ | twalk Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-09-29manual: Fix missing include in sigusr example.Collin Funk
Previously this file would fail to compile with the following error: $ gcc manual/examples/sigusr.c manual/examples/sigusr.c: In function ‘child_function’: manual/examples/sigusr.c:46:3: error: implicit declaration of function ‘exit’ [-Wimplicit-function-declaration] 46 | exit (0); | ^~~~ manual/examples/sigusr.c:23:1: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’ 22 | #include <unistd.h> +++ |+#include <stdlib.h> 23 | /*@end group*/ manual/examples/sigusr.c:46:3: warning: incompatible implicit declaration of built-in function ‘exit’ [-Wbuiltin-declaration-mismatch] 46 | exit (0); | ^~~~ manual/examples/sigusr.c:46:3: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’ Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-09-29manual: Fix missing includes in the mbstouwcs example.Collin Funk
Previously this file would fail to compile with the following error: $ gcc manual/examples/mbstouwcs.c manual/examples/mbstouwcs.c: In function ‘mbstouwcs’: manual/examples/mbstouwcs.c:34:11: error: ‘errno’ undeclared (first use in this function) 34 | errno = EILSEQ; | ^~~~~ manual/examples/mbstouwcs.c:5:1: note: ‘errno’ is defined in header ‘<errno.h>’; this is probably fixable by adding ‘#include <errno.h>’ 4 | #include <wchar.h> +++ |+#include <errno.h> 5 | manual/examples/mbstouwcs.c:34:11: note: each undeclared identifier is reported only once for each function it appears in 34 | errno = EILSEQ; | ^~~~~ manual/examples/mbstouwcs.c:34:19: error: ‘EILSEQ’ undeclared (first use in this function) 34 | errno = EILSEQ; | ^~~~~~ manual/examples/mbstouwcs.c:47:20: error: implicit declaration of function ‘towupper’ [-Wimplicit-function-declaration] 47 | *wcp++ = towupper (wc); | ^~~~~~~~ manual/examples/mbstouwcs.c:5:1: note: include ‘<wctype.h>’ or provide a declaration of ‘towupper’ 4 | #include <wchar.h> +++ |+#include <wctype.h> 5 | manual/examples/mbstouwcs.c:47:20: warning: incompatible implicit declaration of built-in function ‘towupper’ [-Wbuiltin-declaration-mismatch] 47 | *wcp++ = towupper (wc); | ^~~~~~~~ manual/examples/mbstouwcs.c:47:20: note: include ‘<wctype.h>’ or provide a declaration of ‘towupper’ Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-09-29manual: Fix missing include in group and user database example.Collin Funk
Previously this file would fail to compile with the following error: $ gcc manual/examples/db.c db.c: In function ‘main’: db.c:37:7: error: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration] 37 | printf ("Couldn't find out about user %d.\n", (int) me); | ^~~~~~ db.c:23:1: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’ 22 | #include <stdlib.h> +++ |+#include <stdio.h> 23 | db.c:37:7: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch] 37 | printf ("Couldn't find out about user %d.\n", (int) me); | ^~~~~~ db.c:37:7: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’ db.c:42:3: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch] 42 | printf ("I am %s.\n", my_passwd->pw_gecos); | ^~~~~~ db.c:42:3: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’ Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-09-25manual: Improve documentation of the shutdown functionFlorian Weimer
Document the SHUT_* constants and attempt to explain the implications for Linux TCP and UNIX domain sockets. The Linux TCP behavior was discovered when writing the socket/tst-shutdown test. Suggested by Sergey Organov in <https://inbox.sourceware.org/libc-help/qblfrh$4m4i$1@blaine.gmane.org/>. Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-09-19manual: Explain our implementation-defined memstream semanticsDJ Delorie
Posix Issue 8 adds an implementation-defined item we don't already cover, about seeking backwards. This defines our implentation. https://issues.redhat.com/browse/RHEL-3008 https://pubs.opengroup.org/onlinepubs/9799919799/functions/open_memstream.html Reviewed-by: Florian Weimer <fweimer@redhat.com> Reviewed-by Collin Funk <collin.funk1@gmail.com>
2025-09-19manual: fix typo in tunables.texiYury Khrustalev
2025-09-11manual: fix typoYury Khrustalev
2025-09-10atomics: Remove unused atomicsWilco Dijkstra
Remove all unused atomics. Replace uses of catomic_increment and catomic_decrement with atomic_fetch_add_relaxed which maps to a standard compiler builtin. Relaxed memory ordering is correct for simple counters since they only need atomicity. Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-08misc: Add support for Linux uio.h RWF_DONTCACHE flagXi Ruoyao
Linux 6.14 adds the new flag for uncached buffered IO on a filesystem supporting it. This caused two test failures as these tests expected the flag 0x00000080 is unused. Add the flag definition to fix these tests on Linux >= 6.14: FAIL: misc/tst-preadvwritev2 FAIL: misc/tst-preadvwritev64v2 The test failures were not detected in routine test suite runs because normally we create the test file in /tmp, where a tmpfs is usually mounted, and tmpfs does not support this flag. But it can be reproduced with TMPDIR set to some directory in an ext4 file system. Link: https://git.kernel.org/torvalds/c/af6505e5745b Signed-off-by: Xi Ruoyao <xry111@xry111.site> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-25manual: Refer to libc-alpha instead of a dead mailing list.Collin Funk
* manual/message.texi (Advanced gettext functions): Refer to libc-alpha@sourceware.org instead of bug-glibc-manual@gnu.org which no longer exists. * NEWS: Likewise. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-08-04manual: Adjust documentation to standardization of selectCollin Funk
The select function, fd_set, and FD_* macros were standardized by POSIX in the sys/select.h header. They are still defined in sys/types.h if __USE_MISC is defined, but we should recommend the more portable and standardized sys/select.h. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-04manual: Use sys/select.h instead of sys/time.h for select example.Collin Funk
The original example works on glibc since sys/time.h includes sys/select.h. However, since POSIX requires that select is defined in sys/select.h this change makes the example more portable. Reported by Gavin Smith <gavinsmith0123@gmail.com> in: <https://lists.gnu.org/archive/html/bug-texinfo/2025-07/msg00091.html>. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-04manual: document getsubopt standardization.Collin Funk
The getsubopt function was an XSI extension since POSIX issue 4 until it was added to Base in POSIX Issue 7. This also adds the 'restrict' qualifier to the arguments as done in POSIX.1-2024, and has been the case in glibc. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-07-28INSTALL: Update newest tested binutils versionAndreas K. Hüttel
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-07-26install.texi: Update tested build tool versionsAndreas K. Hüttel
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-07-26contrib.texi: UpdateAndreas K. Hüttel
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-07-24Disable SFrame support by defaultAdhemerval Zanella
And add extra checks to enable for binutils 2.45 and if the architecture explicitly enables it. When SFrame is disabled, all the related code is also not enabled for backtrace() and _dl_find_object(), so SFrame backtracking is not used even if the binary has the SFrame segment. This patch also adds some other related fixes: * Fixed an issue with AC_CHECK_PROG_VER, where the READELF_SFRAME usage prevented specifying a different readelf through READELF environment variable at configure time. * Add an extra arch-specific internal definition, libc_cv_support_sframe, to disable --enable-sframe on architectures that have binutils but not glibc support (s390x). * Renamed the tests without the .sframe segment and move the tst-backtrace1 from pthread to debug. * Use the built compiler strip to remove the .sframe segment, instead of the system one (which might not support SFrame). Checked on x86_64-linux-gnu and aarch64-linux-gnu. Reviewed-by: Sam James <sam@gentoo.org>
2025-07-24manual: Use @Theglibc{} at sentence start in terminal documentationFlorian Weimer
Fixes commit 5dd2a19ad5218261cee064 ("termios: manual: improve the explanation of various tty concepts") and commit c744519bad8106769760 ("termios: manual: document the SPEED_MAX and BAUD_MAX constants"). Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-07-20termios: manual: document the SPEED_MAX and BAUD_MAX constantsH. Peter Anvin
Add the SPEED_MAX and BAUD_MAX constants to the manual. [ v3: drop leading underscores ] Signed-off-by: "H. Peter Anvin" (Intel) <hpa@zytor.com> Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-07-20termios: manual: improve the explanation of various tty conceptsH. Peter Anvin
It is a lot easier to understand the meaning of the tty interface if it is explained from the beginning as conceptually emulating an RS232 serial port. This greatly simplifies the discussions of specific items like the meaning of line speed. Distinguish between "modem disconnect request" (deasserting DTR) and "modem disconnect" (DCD deasserted). Conflating the two terms is confusing, especially for non-RS232 devices. In particular, on most systems, a pseudo-terminal will *not* respond to a modem disconnect request by triggering a modem disconnect event for the purpose of the HUPCL flag. It is not necessarily true that the line speed has no effect on non-serial port devices: e.g. an SPI port may interpret it as the clock frequency to use; however, SPI does not use asynchronous framing bits, instead synchronization is handled by the SS# wire. Similarly, it is common but not by any means universal for interfaces that employ various forms of fixed data to symbol rate encodings to encode the data link layer bit rate rather than the physical symbol rate, which may be higher (e.g. 8B10B) or lower (e.g. QAM/Trellis), without the encoding or framing overhead. Finally, a handful of devices use the line rate for entirely nonstandard purposes. One example is Arduino USB interfaces, which often interprets changing the baud rate to 1200 baud as a command to reset the device. [ v2: removed a bogus stray chunk from editing ] Signed-off-by: H. Peter Anvin <hpa@zytor.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-07-20termios: manual: remove duplicate cfgetospeed() definitionH. Peter Anvin
The function cfsetospeed() is defined twice in the manual. Remove the one that seems out of place. Signed-off-by: "H. Peter Anvin" (Intel) <hpa@zytor.com> Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-07-20termios: manual: fix typo: tcsettattr -> tcsetattrH. Peter Anvin
Fix a typo in the manual: tcsetattr misspelled as tcsettattr. Signed-off-by: "H. Peter Anvin" (Intel) <hpa@zytor.com> Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-07-14configure: Add --enable-sframe optionClaudiu Zissulescu
Enable SFrame stack track information. The --enable-sframe option allows the glibc build to compile with SFrame stack track information. Thus, enabling glibc's backtrace to work within glibc. Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com> Reviewed-by: DJ Delorie <dj@redhat.com> Reviewed-by: Sam James <sam@gentoo.org>