Minor documentation improvements (RHEL-95259)

Resolves: RHEL-95259
This commit is contained in:
DJ Delorie 2025-11-03 22:56:29 -05:00
parent b69345d750
commit 420da6862a
13 changed files with 508 additions and 0 deletions

31
glibc-RHEL-95259-1.patch Normal file
View File

@ -0,0 +1,31 @@
commit 7c1ec1b7d0b476610c811b0babeab831e626c088
Author: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat Jun 15 08:40:41 2024 -0700
Minor code improvement to timespec_subtract example
This saves a few instructions.
BORROW cannot be -1, since NSEC_DIFF is at most 999999999.
Idea taken from Gnulib, here:
https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=fe33f943054b93af8b965ce6564b8713b0979a21
diff --git a/manual/examples/timespec_subtract.c b/manual/examples/timespec_subtract.c
index 380d173aab..26607409c8 100644
--- a/manual/examples/timespec_subtract.c
+++ b/manual/examples/timespec_subtract.c
@@ -22,12 +22,12 @@
bool
timespec_subtract (struct timespec *r,
- struct timespec x, struct timespec y)
+ struct timespec x, struct timespec y)
{
- /* Compute nanoseconds, setting @var{borrow} to 1, 0, or -1
+ /* Compute nanoseconds, setting @var{borrow} to 1 or 0
for propagation into seconds. */
long int nsec_diff = x.tv_nsec - y.tv_nsec;
- int borrow = (nsec_diff < 0) - ! (nsec_diff < 1000000000);
+ bool borrow = nsec_diff < 0;
r->tv_nsec = nsec_diff + 1000000000 * borrow;
/* Compute seconds, returning true if this overflows. */

80
glibc-RHEL-95259-10.patch Normal file
View File

@ -0,0 +1,80 @@
commit 521b4d6c4d5a7c84efd2742e0aac6311eaef005b
Author: Matteo Croce <teknoraver@meta.com>
Date: Tue Jun 24 18:40:13 2025 +0200
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.
diff --git a/io/tst-stat.c b/io/tst-stat.c
index 61bdbfb638..aeea435ca1 100644
--- a/io/tst-stat.c
+++ b/io/tst-stat.c
@@ -62,12 +62,23 @@ fstatat_check (int fd, const char *path, struct stat *st)
TEST_COMPARE (fstatat (fd, path, st, 0), 0);
}
+static void
+fstatat_link (const char *path, struct stat *st)
+{
+ TEST_COMPARE (fstatat (AT_FDCWD, path, st, 0), -1);
+ TEST_COMPARE (errno, ENOENT);
+
+ TEST_COMPARE (fstatat (AT_FDCWD, path, st, AT_SYMLINK_NOFOLLOW), 0);
+ TEST_COMPARE (!S_ISLNK(st->st_mode), 0);
+}
+
typedef void (*test_t)(int, const char *path, struct stat *);
static int
do_test (void)
{
char *path;
+ const char *linkame = "tst-fstat.linkname";
int fd = create_temp_file ("tst-fstat.", &path);
TEST_VERIFY_EXIT (fd >= 0);
support_write_file_string (path, "abc");
@@ -81,13 +92,13 @@ do_test (void)
printf ("warning: timestamp with nanoseconds not supported\n");
struct statx stx;
+ struct stat st;
TEST_COMPARE (statx (fd, path, 0, STATX_BASIC_STATS, &stx), 0);
test_t tests[] = { stat_check, lstat_check, fstat_check, fstatat_check };
for (int i = 0; i < array_length (tests); i++)
{
- struct stat st;
tests[i](fd, path, &st);
TEST_COMPARE (stx.stx_dev_major, major (st.st_dev));
@@ -111,6 +122,10 @@ do_test (void)
}
}
+ TEST_COMPARE (symlink ("tst-fstat.target", linkame), 0);
+ add_temp_file (linkame);
+ fstatat_link (linkame, &st);
+
return 0;
}
diff --git a/manual/filesys.texi b/manual/filesys.texi
index fb7986cff7..f49d7d7572 100644
--- a/manual/filesys.texi
+++ b/manual/filesys.texi
@@ -2400,8 +2400,9 @@ The descriptor @var{filedes} is not associated with a directory, and
@var{filename} is a relative file name.
@item ENOENT
-The file named by @var{filename} does not exist, or @var{filename} is an
-empty string and @var{flags} does not contain @code{AT_EMPTY_PATH}.
+The file named by @var{filename} does not exist, it's a dangling symbolic link
+and @var{flags} does not contain @code{AT_SYMLINK_NOFOLLOW}, or @var{filename}
+is an empty string and @var{flags} does not contain @code{AT_EMPTY_PATH}.
@end table
When the sources are compiled with @code{_FILE_OFFSET_BITS == 64} this

19
glibc-RHEL-95259-11.patch Normal file
View File

@ -0,0 +1,19 @@
commit f0b88eb78416ec822b4c1fd43b85525594dc054f
Author: Yury Khrustalev <yury.khrustalev@arm.com>
Date: Thu Sep 11 10:50:43 2025 +0100
manual: fix typo
diff --git a/manual/startup.texi b/manual/startup.texi
index c444750479..9545fcc526 100644
--- a/manual/startup.texi
+++ b/manual/startup.texi
@@ -667,7 +667,7 @@ defined in @file{elf.h}. If a matching entry is found, the value is
returned; if the entry is not found, zero is returned and @code{errno}
is set to @code{ENOENT}.
-@strong{Note:} There is no relationship between the @samp{AT_} contants
+@strong{Note:} There is no relationship between the @samp{AT_} constants
defined in @file{elf.h} and the file name lookup flags in
@file{fcntl.h}. @xref{Descriptor-Relative Access}.
@end deftypefun

85
glibc-RHEL-95259-12.patch Normal file
View File

@ -0,0 +1,85 @@
commit afce5fccdf680113cdb6fc44d1b4ca7daea42c25
Author: Florian Weimer <fweimer@redhat.com>
Date: Thu Sep 25 08:37:13 2025 +0200
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>
diff --git a/manual/socket.texi b/manual/socket.texi
index d804c7a48b..56948073d5 100644
--- a/manual/socket.texi
+++ b/manual/socket.texi
@@ -2317,22 +2317,23 @@ The @code{shutdown} function shuts down the connection of socket
@var{socket}. The argument @var{how} specifies what action to
perform:
-@table @code
-@item 0
-Stop receiving data for this socket. If further data arrives,
-reject it.
+@vtable @code
+@item SHUT_RD
+Stop receiving data on the socket.
-@item 1
-Stop trying to transmit data from this socket. Discard any data
-waiting to be sent. Stop looking for acknowledgement of data already
-sent; don't retransmit it if it is lost.
+@item SHUT_WR
+Indicate to the peer that no further data will be transmitted on the
+socket. This indication is ordered with regard to past send
+operations on the socket, and data pending at the time of the call is
+still delivered.
-@item 2
-Stop both reception and transmission.
-@end table
+@item SHUT_RDWR
+Combine the actions of @code{SHUT_RD} and @code{SHUT_WR}.
+@end vtable
The return value is @code{0} on success and @code{-1} on failure. The
-following @code{errno} error conditions are defined for this function:
+following generic @code{errno} error conditions are defined for this
+function:
@table @code
@item EBADF
@@ -2346,6 +2347,27 @@ following @code{errno} error conditions are defined for this function:
@end table
@end deftypefun
+Additional errors can be reported for specific socket types.
+
+The exact impact of the @code{shutdown} function depends on the socket
+protocol and its implementation. In portable code, the @code{shutdown}
+function cannot be used on its own to gracefully terminate a connection
+which is operated in full-duplex mode (with both peers sending data).
+
+On Linux, when @code{SHUT_RD} is used to shut down a TCP socket, any
+pending data in the incoming socket buffer and any data that arrives
+subsequently is discarded, without reporting an error or generating a
+TCP RST segment. Attempts to read data from this socket using
+@code{recv} and similar functions (@pxref{Receiving Data}) return zero.
+(Other systems may treat @code{SHUT_RD} with pending data as a data loss
+event and generate RST segments. Linux @code{AF_LOCAL}/@code{AF_UNIX}
+sockets also report errors to peers.)
+
+Similarly, when @code{SHUT_WR} is used on a Linux TCP socket, a FIN
+segment is sent to the peer, ordered after any data written previously
+to the socket. After encountering the FIN segment, the peer will
+recognize this as an end-of-stream condition.
+
@node Socket Pairs
@subsection Socket Pairs
@cindex creating a socket pair

24
glibc-RHEL-95259-13.patch Normal file
View File

@ -0,0 +1,24 @@
commit fcfbc3ee310519f600b712c699e2f411c6a5c7d6
Author: Collin Funk <collin.funk1@gmail.com>
Date: Sat Oct 4 00:52:57 2025 -0700
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>
diff --git a/manual/socket.texi b/manual/socket.texi
index 56948073d5..2ed8112344 100644
--- a/manual/socket.texi
+++ b/manual/socket.texi
@@ -2999,7 +2999,7 @@ discard_until_mark (int socket)
success = ioctl (socket, SIOCATMARK, &atmark);
if (success < 0)
perror ("ioctl");
- if (result)
+ if (atmark)
return;
/* @r{Otherwise, read a bunch of ordinary data and discard it.}

26
glibc-RHEL-95259-2.patch Normal file
View File

@ -0,0 +1,26 @@
commit 41d6461484d6d456fb07f495fb595e06b44758c4
Author: Andreas K. Hüttel <dilfridge@gentoo.org>
Date: Sat Jun 15 15:41:22 2024 +0200
manual: minor language fix (bz 31340)
Resolves: https://sourceware.org/bugzilla/show_bug.cgi?id=31340
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
Conflicts
manual/resource.texi
line numbers
diff --git a/manual/resource.texi b/manual/resource.texi
index 37462abc9e..c9b21dedeb 100644
--- a/manual/resource.texi
+++ b/manual/resource.texi
@@ -1321,7 +1321,7 @@ nice (int increment)
On a multi-processor system the operating system usually distributes
the different processes which are runnable on all available CPUs in a
way which allows the system to work most efficiently. Which processes
-and threads run can be to some extend be control with the scheduling
+and threads run can to some extend be controlled with the scheduling
functionality described in the last sections. But which CPU finally
executes which process or thread is not covered.

30
glibc-RHEL-95259-3.patch Normal file
View File

@ -0,0 +1,30 @@
commit aedbf08891069fc029ed021e4dba933eb877b394
Author: Lukas Bulwahn <lukas.bulwahn@redhat.com>
Date: Mon Jul 29 11:08:17 2024 +0200
manual: make setrlimit() description less ambiguous
The existing description for setrlimit() has some ambiguity. It could be
understood to have the semantics of getrlimit(), i.e., the limits from the
process are stored in the provided rlp pointer.
Make the description more explicit that rlp are the input values, and that
the limits of the process is changed with this function.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/manual/resource.texi b/manual/resource.texi
index c9b21dedeb..25966bcb64 100644
--- a/manual/resource.texi
+++ b/manual/resource.texi
@@ -192,8 +192,8 @@ If the sources are compiled with @code{_FILE_OFFSET_BITS == 64} on a
@standards{BSD, sys/resource.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
@c Direct syscall on most systems; lock-taking critical section on HURD.
-Store the current and maximum limits for the resource @var{resource}
-in @code{*@var{rlp}}.
+Change the current and maximum limits of the process for the resource
+@var{resource} to the values provided in @code{*@var{rlp}}.
The return value is @code{0} on success and @code{-1} on failure. The
following @code{errno} error condition is possible:

36
glibc-RHEL-95259-4.patch Normal file
View File

@ -0,0 +1,36 @@
commit f47596fcfe32ef96ba9b322a414803b25b8ce608
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Sep 27 11:41:12 2024 +0200
manual: Document that feof and ferror are mutually exclusive
This is not completely clear from the C standard (although there
is footnote number 289 in C11), but I assume that our implementation
works this way.
Reviewed-by: DJ Delorie <dj@redhat.com>
Conflicts:
manual/stdio.texi
line numbers
diff --git a/manual/stdio.texi b/manual/stdio.texi
index 8590ae955a..c7a2b4a9a1 100644
--- a/manual/stdio.texi
+++ b/manual/stdio.texi
@@ -4124,6 +4124,15 @@ check indicators that are part of the internal state of the stream
object, indicators set if the appropriate condition was detected by a
previous I/O operation on that stream.
+The end of file and error conditions are mutually exclusive. For a
+narrow oriented stream, end of file is not considered an error. For
+wide oriented streams, reaching the end of the underlying file can
+result an error if the underlying file ends with an incomplete multibyte
+sequence. This is reported as an error by @code{ferror}, and not as an
+end of file by @code{feof}. End of file on wide oriented streams that
+does not fall into the middle of a multibyte sequence is reported via
+@code{feof}.
+
@deftypevr Macro int EOF
@standards{ISO, stdio.h}
This macro is an integer value that is returned by a number of narrow

21
glibc-RHEL-95259-5.patch Normal file
View File

@ -0,0 +1,21 @@
commit bc4202521c2aaf587690ea6cbb67c22ee578c86e
Author: Maciej W. Rozycki <macro@redhat.com>
Date: Fri May 30 15:01:50 2025 +0100
manual: Fix duplicate 'consult' erratum
Remove 'consult' duplication appearing in Extensible Scheduling section.
diff --git a/manual/resource.texi b/manual/resource.texi
index 39df1c4cb6..1fd0310c6b 100644
--- a/manual/resource.texi
+++ b/manual/resource.texi
@@ -977,7 +977,7 @@ multiple parameters (not just priority and niceness).
It is expected that these interfaces will be compatible with all future
scheduling policies.
-For additional information about scheduling policies, consult consult
+For additional information about scheduling policies, consult
the manual pages @manpageurl{sched,7} and @manpageurl{sched_setattr,2}.
@xref{Linux Kernel}.

33
glibc-RHEL-95259-6.patch Normal file
View File

@ -0,0 +1,33 @@
commit 62fba6d9807fc12334d7c5513407715d59539611
Author: Maciej W. Rozycki <macro@redhat.com>
Date: Fri Jun 6 18:14:34 2025 +0100
manual: Add a comparative example of 'clock_nanosleep' use
Add an illustrative example of how to express 'nanosleep' in terms of
'clock_nanosleep'.
diff --git a/manual/time.texi b/manual/time.texi
index 697a6287f2..d003ddb637 100644
--- a/manual/time.texi
+++ b/manual/time.texi
@@ -3240,6 +3240,19 @@ different from @code{nanosleep}, which returns @math{-1} upon failure and
sets the global variable @code{errno} according to the error encountered
instead.
+Except for the return value convention and the way to communicate an error
+condition the call:
+
+@smallexample
+nanosleep (@var{requested_time}, @var{remaining_time})
+@end smallexample
+
+is analogous to:
+
+@smallexample
+clock_nanosleep (CLOCK_REALTIME, 0, @var{requested_time}, @var{remaining_time})
+@end smallexample
+
The @var{clock} argument specifies the clock to use.
@xref{Getting the Time}, for the @code{clockid_t} type and possible values
of @var{clock}. Not all clocks listed are supported for use with

26
glibc-RHEL-95259-7.patch Normal file
View File

@ -0,0 +1,26 @@
commit 53ea6db9fd25af7486b14cd2bf3b0ae1046e0e98
Author: Jitka Obselkova <jobselko@redhat.com>
Date: Sat Jun 14 11:19:46 2025 +0200
manual: Clarify renameat documentation
Clarify the meaning of renameat arguments.
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
diff --git a/manual/filesys.texi b/manual/filesys.texi
index f21f218042..e1c7be867e 100644
--- a/manual/filesys.texi
+++ b/manual/filesys.texi
@@ -1940,7 +1940,10 @@ file systems.
@comment Unaudited and therefore marked AC-Unsafe and AS-Unsafe by default
@safety{@mtsafe{}@asunsafe{@asucorrupt{}}@acunsafe{@acucorrupt{}}}
This function is a descriptor-relative version of the @code{rename}
-function above. @xref{Descriptor-Relative Access}.
+function above. @xref{Descriptor-Relative Access}. If @var{oldname} or
+@var{newname} is a relative path, it is interpreted relative to the
+directory associated with @var{oldfiledes} or @var{newfiledes},
+respectively. Absolute paths are interpreted in the usual way.
Compared to @code{rename}, some additional error conditions can occur.
@xref{Descriptor-Relative Access}.

57
glibc-RHEL-95259-8.patch Normal file
View File

@ -0,0 +1,57 @@
commit 652c36b3ea917093bf60ad2a345987530c192821
Author: Matteo Croce <teknoraver@meta.com>
Date: Sat Jun 14 11:59:03 2025 +0200
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>
diff --git a/io/tst-stat-time64.c b/io/tst-stat-time64.c
index a20265c570..4415765c8a 100644
--- a/io/tst-stat-time64.c
+++ b/io/tst-stat-time64.c
@@ -52,6 +52,12 @@ fstat_check (int fd, const char *path, struct stat *st)
static void
fstatat_check (int fd, const char *path, struct stat *st)
{
+ TEST_COMPARE (fstatat (fd, "", st, 0), -1);
+ TEST_COMPARE (errno, ENOENT);
+
+ TEST_COMPARE (fstatat (AT_FDCWD, "_non_existing_file", st, 0), -1);
+ TEST_COMPARE (errno, ENOENT);
+
TEST_COMPARE (fstatat (fd, path, st, 0), 0);
}
diff --git a/io/tst-stat.c b/io/tst-stat.c
index cc57aec45c..61bdbfb638 100644
--- a/io/tst-stat.c
+++ b/io/tst-stat.c
@@ -56,6 +56,9 @@ fstatat_check (int fd, const char *path, struct stat *st)
TEST_COMPARE (fstatat (fd, "", st, 0), -1);
TEST_COMPARE (errno, ENOENT);
+ TEST_COMPARE (fstatat (AT_FDCWD, "_non_existing_file", st, 0), -1);
+ TEST_COMPARE (errno, ENOENT);
+
TEST_COMPARE (fstatat (fd, path, st, 0), 0);
}
diff --git a/manual/filesys.texi b/manual/filesys.texi
index e1c7be867e..fb7986cff7 100644
--- a/manual/filesys.texi
+++ b/manual/filesys.texi
@@ -2398,6 +2398,10 @@ The @var{flags} argument is not valid for this function.
@item ENOTDIR
The descriptor @var{filedes} is not associated with a directory, and
@var{filename} is a relative file name.
+
+@item ENOENT
+The file named by @var{filename} does not exist, or @var{filename} is an
+empty string and @var{flags} does not contain @code{AT_EMPTY_PATH}.
@end table
When the sources are compiled with @code{_FILE_OFFSET_BITS == 64} this

40
glibc-RHEL-95259-9.patch Normal file
View File

@ -0,0 +1,40 @@
commit b96031cb5662f0b7a086c869ea265de922b4de7e
Author: Yury Khrustalev <yury.khrustalev@arm.com>
Date: Fri Jun 20 13:37:34 2025 +0100
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>
diff --git a/manual/startup.texi b/manual/startup.texi
index 9545fcc526..11fe58c5a6 100644
--- a/manual/startup.texi
+++ b/manual/startup.texi
@@ -736,6 +736,12 @@ anyway.
@code{syscall} does not provide cancellation logic, even if the system
call you're calling is listed as cancellable above.
+Using @code{syscall} with system calls that affect the internal state of
+process of thread will likely result in undefined behavior. For this reason,
+at least the following system call numbers are not supported when invoked via
+@code{syscall}: @code{SYS_clone}, @code{SYS_clone2}, @code{SYS_clone3},
+@code{SYS_rt_sigreturn}, @code{SYS_sigreturn}, @code{SYS_vfork}.
+
@code{syscall} is declared in @file{unistd.h}.
@deftypefun {long int} syscall (long int @var{sysno}, @dots{})
@@ -804,7 +810,6 @@ if (rc == -1)
@end deftypefun
-
@node Program Termination
@section Program Termination
@cindex program termination