Commit Graph

1825 Commits

Author SHA1 Message Date
Joseph Myers 096fcdc0a5 Rename uimaxabs to umaxabs (bug 33325)
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-28 12:15:02 +00:00
Joseph Myers ea18d5a4c2 Implement C23 memalignment
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-17 16:56:59 +00:00
Collin Funk fcfbc3ee31 manual: check the correct variable in SIOCATMARK example [BZ #33093]
* 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-06 19:14:59 -07:00
Yury Khrustalev b96031cb56 manual: describe syscall numbers not supported via syscall()
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-06 16:48:07 +01:00
Bruno Haible ed5b1fad62 manual: fix some mistakes in the indices [BZ #24657]
* 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-05 21:05:26 -07:00
Collin Funk e6cbc38bfb manual: Fix missing reference to the mmap function [BZ #20473]
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-10-03 14:42:41 -07:00
Joseph Myers a7ddbf456d Add once_flag, ONCE_FLAG_INIT and call_once to stdlib.h for C23
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-01 15:15:15 +00:00
Joseph Myers 0f201f4a81 Implement C23 memset_explicit (bug 32378)
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-10-01 15:14:09 +00:00
Collin Funk a8ad2e9e43 manual: Fix missing declaration in inetcli example.
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-29 17:01:54 -07:00
Collin Funk 1c539d79f6 manual: Fix compiler errors in inetsrv example.
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-29 17:01:54 -07:00
Collin Funk e465aeed59 manual: Fix compiler errors in filesrv example.
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-29 17:01:54 -07:00
Collin Funk ae77ce91c8 manual: Fix missing declaration in select example.
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-29 17:01:54 -07:00
Collin Funk 8df2a7811e manual: Fix missing declaration in setjmp example.
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-29 17:01:54 -07:00
Collin Funk dd4e8ae64e manual: fix missing include in sigh1 example.
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-29 17:01:54 -07:00
Collin Funk 8a80c7f9d7 manual: Fix missing declaration in strdupa example.
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-29 17:01:54 -07:00
Collin Funk 0d98af2e1d manual: Allow getsubopt example to compile with GCC 15.
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-29 17:01:54 -07:00
Collin Funk 85a31b7764 manual: Fix missing include in memopen example.
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-29 17:01:54 -07:00
Collin Funk a2a773992d manual: Fix missing declaration in twalk example.
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-29 17:01:54 -07:00
Collin Funk 5af86c5eb0 manual: Fix missing include in sigusr example.
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-29 17:01:54 -07:00
Collin Funk 1912550f62 manual: Fix missing includes in the mbstouwcs example.
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-29 17:01:54 -07:00
Collin Funk a86118d661 manual: Fix missing include in group and user database example.
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-29 17:01:54 -07:00
Florian Weimer afce5fccdf manual: Improve documentation of the shutdown function
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-25 08:37:13 +02:00
DJ Delorie 8aa99c592b manual: Explain our implementation-defined memstream semantics
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-19 14:51:05 -04:00
Yury Khrustalev 20446e3502 manual: fix typo in tunables.texi 2025-09-19 12:03:38 +01:00
Yury Khrustalev f0b88eb784 manual: fix typo 2025-09-11 10:50:43 +01:00
Wilco Dijkstra 210ee29503 atomics: Remove unused atomics
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-10 09:18:06 +00:00
Xi Ruoyao 3b39822a82 misc: Add support for Linux uio.h RWF_DONTCACHE flag
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-09-08 08:22:20 -03:00
Collin Funk 596dc7b676 manual: Refer to libc-alpha instead of a dead mailing list.
* 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-25 16:45:42 -07:00
Collin Funk 4d059af105 manual: Adjust documentation to standardization of select
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-04 11:18:02 -03:00
Collin Funk 6e3e14fd4c manual: Use sys/select.h instead of sys/time.h for select example.
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-04 11:16:23 -03:00
Collin Funk 0f8c3c4329 manual: document getsubopt standardization.
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-08-04 11:15:08 -03:00
Andreas K. Hüttel 54851e392d
INSTALL: Update newest tested binutils version
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-07-28 16:49:01 +02:00
Andreas K. Hüttel 4e42971a03
install.texi: Update tested build tool versions
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-07-26 17:05:21 +02:00
Andreas K. Hüttel 015483f8a1
contrib.texi: Update
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-07-26 16:53:43 +02:00
Adhemerval Zanella 20528165bd Disable SFrame support by default
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-24 15:51:58 -03:00
Florian Weimer c7742069a6
manual: Use @Theglibc{} at sentence start in terminal documentation
Fixes commit 5dd2a19ad5 ("termios: manual: improve the
explanation of various tty concepts") and commit c744519bad
("termios: manual: document the SPEED_MAX and BAUD_MAX constants").

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-07-24 19:27:44 +02:00
H. Peter Anvin c744519bad
termios: manual: document the SPEED_MAX and BAUD_MAX constants
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-20 17:17:44 +02:00
H. Peter Anvin 5dd2a19ad5
termios: manual: improve the explanation of various tty concepts
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-20 17:11:02 +02:00
H. Peter Anvin 5e78997c56
termios: manual: remove duplicate cfgetospeed() definition
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-20 17:10:59 +02:00
H. Peter Anvin 118370fd78
termios: manual: fix typo: tcsettattr -> tcsetattr
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-20 17:10:56 +02:00
Claudiu Zissulescu 3d780a44eb
configure: Add --enable-sframe option
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>
2025-07-14 10:57:53 +01:00
Claudiu Zissulescu 0ebe4fba88
elf: Add SFrame support to _dl_find_object function
The SFrame provides information to be able to do stack trace is now
well defined and implemented in Binutils 2.41.  The format simply
contains enough information to be able to do stack trace given a
program counter (PC) value, the stack pointer, and the frame pointer.
The SFrame information is stored in a .sframe ELF section, which is
loaded into its own PT_GNU_SFRAME segment. We consider for this support
SFrame version 2.

This patch adds the bits to _dl_find_object to recognize and store in
struct dl_find_object the necessary info about SFrame section.

Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-07-14 10:56:35 +01:00
Matteo Croce 521b4d6c4d fstat: add test and documentation for an edge case.
The fstatat behaviour when the target is a dangling symlink is different
if flags contains AT_SYMLINK_NOFOLLOW or not.
Add a test for this and document it.
2025-07-08 13:18:20 -03:00
Matteo Croce 652c36b3ea fstatat: extend tests and documentation
Document the fstatat behaviour leading to a ENOENT errno, and extend
tests to test the case where filename does not exist.

Signed-off-by: Matteo Croce <teknoraver@meta.com>
2025-07-08 13:18:08 -03:00
Collin Funk 4900f993c8
manual: Remove '.info' suffix in manual names passed to @ref [BZ #32962].
Texinfo 7.2 began warning about the '.info' suffix in the manual names
passed to @ref and similar commands.  They eventually plan to stop
stripping the '.info' suffix internally which will lead to broken links
in the manuals without this change.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2025-07-03 05:19:42 +01:00
Jitka Obselkova 53ea6db9fd manual: Clarify renameat documentation
Clarify the meaning of renameat arguments.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-06-26 14:24:40 +02:00
Florian Weimer 1149b4f64f Revert "manual: Clarify renameat documentation"
This reverts commit abc2e954af.
Reason for revert: Wrong version of the patch.
2025-06-26 14:22:58 +02:00
Ravina Jain b2a8d19f4a manual: Add missing free to open_memstream example [BZ #27866]
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-06-25 14:26:32 +02:00
Jitka Obselkova abc2e954af manual: Clarify renameat documentation
Clarify the meaning of renameat arguments.

Signed-off-by: Jitka Obselkova <jobselko@redhat.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-06-18 16:03:20 -03:00
H. Peter Anvin (Intel) 5f138519eb termios: add new baud_t interface, defined to be explicitly numeric
Add an explicitly numeric interface for baudrate setting. For glibc,
this only announces what is a fair accompli, but this is a plausible
way forward for standardization, and may be possible to infill on
non-compliant systems. The POSIX committee has stated:

[https://www.austingroupbugs.net/view.php?id=1916#c7135]

	A future version of this standard is expected to add at least
	the following symbolic constants for use as values of objects
	of type speed_t: B57600, B115200, B230400, B460800, and
	B921600.

	Implementations are encouraged to propose additional
	interfaces which will make it possible to set and query a
	wider range of speeds than just those enumerated by the
	constants beginning with B. If a set of common interfaces
	emerges between several implementations, a future version of
	this standard will likely add those interfaces.

This is exactly that interface.

The use of the term "baud" is due to the need to have a term
contrasting "speed", and it is already well established as a legacy
term -- including in the names of the legacy Bxxx
constants. Futhermore, it *is* valid from the point of view that the
termios interface fundamentally emulates an RS-232 serial port as far
as the application software is concerned.

The documentation states that for the current version of glibc,
speed_t == baud_t, but explicitly declares that this may not be the
case in the future.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-06-17 09:11:38 -03:00