Commit Graph

1731 Commits

Author SHA1 Message Date
Adhemerval Zanella 3e8814903c math: Refactor how to use libm-test-ulps
The current approach tracks math maximum supported errors by explicitly
setting them per function and architecture. On newer implementations or
new compiler versions, the file is updated with newer values if it
shows higher results. The idea is to track the maximum known error, to
update the manual with the obtained values.

The constant libm-test-ulps shows little value, where it is usually a
mechanical change done by the maintainer, for past releases it is
usually ignored whether the ulp change resulted from a compiler
regression, and the math tests already have a maximum ulp error that
triggers a regression.

It was shown by a recent update after the new acosf [1] implementation
that is correctly rounded, where the libm-test-ulps was indeed from a
compiler issue.

This patch removes all arch-specific libm-test-ulps, adds system generic
libm-test-ulps where applicable, and changes its semantics. The generic
files now track specific implementation constraints, like if it is
expected to be correctly rounded, or if the system-specific has
different error expectations.

Now multiple libm-test-ulps can be defined, and system-specific
overrides generic implementation.  This is for the case where
arch-specific implementation might show worse precision than generic
implementation, for instance, the cbrtf on i686.

Regressions are only reported if the implementation shows larger errors
than 9 ulps (13 for IBM long double) unless it is overridden by
libm-test-ulps and the maximum error is not printed at the end of tests.
The regen-ulps rule is also removed since it does not make sense to
update the libm-test-ulps automatically.

The manual error table is also removed, Paul Zimmermann and others have
been tracking libm precision with a more comprehensive analysis for some
releases; so link to his work instead.

[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=9cc9f8e11e8fb8f54f1e84d9f024917634a78201
2025-03-12 13:40:07 -03:00
Florian Weimer 74d463c50b Linux: Add the pthread_gettid_np function (bug 27880)
Current Bionic has this function, with enhanced error checking
(the undefined case terminates the process).

Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-12 10:23:35 +01:00
Joseph Myers 77261698b4 Implement C23 rsqrt
C23 adds various <math.h> function families originally defined in TS
18661-4.  Add the rsqrt functions (1/sqrt(x)).  The test inputs are
taken from those for sqrt.

Tested for x86_64 and x86, and with build-many-glibcs.py.
2025-03-07 19:15:26 +00:00
Carlos O'Donell 5b30907545 manual: Mark perror as MT-unsafe and update check-safety.sh
The manual marked perror as MT-safe, but then listed a remark
indicating that it was unsafe because of a race between the function
and access to stderr.  The function is indeed MT-unsafe because
of the unlocked access to stderr internals and bug 32730 has been
filed to address this issue.

The script manual/check-safety.sh should have caught this issue,
but a missed escaping of "?" along with searching of all inputs
again via "$@" resulted in a non-functional regexp.

In order to avoid regressions we also update check-safety.sh.

The script manual/check-safety.sh is updated in the following ways:

 * The MT-unsafe remarks in MT-safe context check is fixed.
   - It now detects the perror safety note mistake.

 * Comments updated indicating that we allow MT context marks
   to count for other contexts if they are related.
   - This is why commit ad9c4c5361
     failed and the failure is now understood as expected.

 * All checks now have verbose output.

 * Back reference based duplicate checks are removed.
   - They are too complex and don't cover all cases.

No regressions on x86_64.
2025-03-06 22:19:25 -05:00
Siddhesh Poyarekar 226476e322 manual: Explain sched_yield semantics with different schedulers
The manual entry for sched_yield mentions that the function call could
be a nop if there are no other tasks with the same absolute priority.
Expand the explanation to include example schedulers on Linux so that
it's clear that sched_yield may not always result in a different task
being scheduled.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-04 19:36:40 -05:00
Carlos O'Donell 6d24313e4a manual: Mark setlogmask as AS-unsafe and AC-unsafe.
This fixes the check-safety.sh failure with commit
ad9c4c5361, and correctly marks
the function AS-unsafe and AC-unsafe due to the use of the
non-recursive lock.

Tested on x86_64 without regressions.
Reviewed-by: Frédéric Bérat <fberat@redhat.com>
2025-02-20 11:55:21 -05:00
Carlos O'Donell ad9c4c5361 manual: Document setlogmask as MT-safe.
setlogmask(3) was made MT-safe in glibc-2.33 with the fix for
bug 26100.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-02-19 16:22:54 -05:00
DJ Delorie bb6496b964 manual: Update signal descriptions
Based on auditing all the signals and source trees for Hurd and
Linux...

SIGSYS - This is not used for a bad system call (ENOSYS is used
for that).  This is used by SECCOMP and some cases where an invalid
sub-function was requested.

SIGSTKFLT - Note it used to be a coprocessor stack fault but is now
obsolete and available for general user use.

SIGLOST - Hurd only now; note that its original purpose as an NFS
lock lost signal is obsolete.

SIGPWR - Note this is for power lost *and* power restored, and is
more a user-mode signal than a kernel-generated signal.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-02-05 23:35:29 -05:00
DJ Delorie 37a0933e1b manual: make @manpageurl more specific to each output
Tweak the @manpageurl macro to customize the output for
each of html, info, and pdf output.  HTML and PDF (at
least, these days) support clicking on the link title,
whereas info does not.  Add text to the intro section
explaining which man pages are normative and which
aren't.
2025-02-04 14:30:13 -05:00
Tulio Magno Quites Machado Filho 1b29cb7b78 manual: Safety annotations for timespec_get and timespec_getres
Add preliminary annotations that are consistent with clock_gettime and
clock_getres.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-01-31 12:13:20 -03:00
Arjun Shankar 47c4f4045c manual: Add links to POSIX Semaphores man-pages documentation
The POSIX Semaphores functions are currently undocumented in our info
pages.  This commit adds links to the man-pages documentation for all
the `sem_*' functions (except `sem_clockwait') so that they refer to
some useful documentation instead of just being stubs.  `sem_clockwait'
isn't documented by man-pages but thankfully already has a small useful
blurb in our own docs.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-01-30 15:18:45 +01:00
Arjun Shankar a3a5634d9b manual: Consolidate POSIX Semaphores docs in Threads chapter
This commit moves the `sem_*' family of functions from the IPC chapter,
replacing them with a reference to their new location in the Threads
chapter.  `sem_clockwait' is also moved out of the Non-POSIX Extensions
subsection since it is now included in the standard since Issue 8:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/sem_clockwait.html

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-01-30 15:18:45 +01:00
Florian Weimer 32ac9f8049 manual: Update compatibility note on flushing of line-oriented files
Operation systems which represent text files in a line-oriented
fashion (and not as byte streams with a character sequence reserved
for line termination) logically cannot flush a buffer without
also creating a terminated line.

Update this portability note and move it to the Binary Streams
section.  Add another related compatibility concern, too.
2025-01-29 13:16:50 +01:00
Andreas K. Hüttel fda82f6e80
INSTALL: update last tested version numbers
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-28 12:31:08 +01:00
Andreas K. Hüttel 27bebf9b4f
contrib.texi: minor improvements
Mention CORE-MATH developers by name
Fix accent

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-27 16:30:54 +01:00
Andreas K. Hüttel 604a340e91
contrib.texi: Update from 2.40..2.41 commit log
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-27 01:06:16 +01:00
Florian Weimer b3a6bd625c Linux: Do not check unused bytes after sched_getattr in tst-sched_setattr
Linux 6.13 was released with a change that overwrites those bytes.
This means that the check_unused subtest fails.

Update the manual accordingly.

Tested-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-01-20 15:20:57 +01:00
Szabolcs Nagy 9ad3d9267d aarch64: Add glibc.cpu.aarch64_gcs tunable
This tunable controls Guarded Control Stack (GCS) for the process.

0 = disabled: do not enable GCS
1 = enforced: check markings and fail if any binary is not marked
2 = optional: check markings but keep GCS off if a binary is unmarked
3 = override: enable GCS, markings are ignored

By default it is 0, so GCS is disabled, value 1 will enable GCS.

The status is stored into GL(dl_aarch64_gcs) early and only applied
later, since enabling GCS is tricky: it must happen on a top level
stack frame. Using GL instead of GLRO because it may need updates
depending on loaded libraries that happen after readonly protection
is applied, however library marking based GCS setting is not yet
implemented.

Describe new tunable in the manual.

Co-authored-by: Yury Khrustalev <yury.khrustalev@arm.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-01-20 09:31:33 +00:00
Paul Eggert 2642002380 Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
Adhemerval Zanella 58272284b6 elf: Add glibc.rtld.execstack
The new tunable can be used to control whether executable stacks are
allowed from either the main program or dependencies.  The default is
to allow executable stacks.

The executable stacks default permission is checked agains the one
provided by the PT_GNU_STACK from program headers (if present).  The
tunable also disables the stack permission change if any dependency
requires an executable stack at loading time.

Checked on x86_64-linux-gnu, i686-linux-gnu, and aarch64-linux-gnu.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2024-12-31 09:04:20 -03:00
Andreas K. Hüttel 0feb6da94c
INSTALL, NEWS: Document requirement of gawk with MPFR support
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2024-12-30 17:03:36 +01:00
Florian Weimer cb4692ce1e libio: asprintf should write NULL upon failure
This was suggested most recently by Solar Designer, noting
that code replacing vsprintf with vasprintf in a security fix
was subtly wrong:

  Re: GStreamer Security Advisory 2024-0003: Orc compiler
  stack-based buffer overflow
  <https://www.openwall.com/lists/oss-security/2024/07/26/2>

Previous libc-alpha discussions:

  I: [PATCH] asprintf error handling fix
  <https://inbox.sourceware.org/libc-alpha/20011205185828.GA8376@ldv.office.alt-linux.org/>

  asprintf() issue
  <https://inbox.sourceware.org/libc-alpha/CANSoFxt-cdc-+C4u-rTENMtY4X9RpRSuv+axDswSPxbDgag8_Q@mail.gmail.com/>

I don't think we need a compatibility symbol for this.  As the
GStreamer example shows, this change is much more likely to fix bugs
than cause compatibility issues.

Suggested-by: Dmitry V. Levin <ldv@altlinux.org>
Suggested-by: Archie Cobbs <archie.cobbs@gmail.com>
Suggested-by: Solar Designer <solar@openwall.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-27 09:18:21 +01:00
H.J. Lu 0c36c983ec NEWS: Mention testing glibc build with a different set of compilers
Also document C and C++ compilers used to test glibc should come from
the same set of compilers.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-24 16:16:38 +08:00
DJ Delorie 87cd94bba4 manual: Document more sigaction flags
Adds documentation for three-argument handler

Adds remainder of the SA_* flags

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2024-12-16 18:23:43 -05:00
Joseph Myers 3374de9038 Implement C23 atan2pi
C23 adds various <math.h> function families originally defined in TS
18661-4.  Add the atan2pi functions (atan2(y,x)/pi).

Tested for x86_64 and x86, and with build-many-glibcs.py.
2024-12-12 20:57:44 +00:00
Joseph Myers ffe79c446c Implement C23 atanpi
C23 adds various <math.h> function families originally defined in TS
18661-4.  Add the atanpi functions (atan(x)/pi).

Tested for x86_64 and x86, and with build-many-glibcs.py.
2024-12-11 21:51:49 +00:00
H.J. Lu b79f257533 Add TEST_CC and TEST_CXX support
Support testing glibc build with a different C compiler or a different
C++ compiler with

$ ../glibc-VERSION/configure TEST_CC="gcc-6.4.1" TEST_CXX="g++-6.4.1"

1. Add LIBC_TRY_CC_AND_TEST_CC_OPTION, LIBC_TRY_CC_AND_TEST_CC_COMMAND
and LIBC_TRY_CC_AND_TEST_LINK to test both CC and TEST_CC.
2. Add check and xcheck targets to Makefile.in and override build compiler
options with ones from TEST_CC and TEST_CXX.

Tested on Fedora 41/x86-64:

1. Building with GCC 14.2.1 and testing with GCC 6.4.1 and GCC 11.2.1.
2. Building with GCC 15 and testing with GCC 6.4.1.

Support for GCC versions older than GCC 6.2 may need to change the test
sources.  Other targets may need to update configure.ac under sysdeps and
modify Makefile.in to override target build compiler options.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-11 18:31:00 +08:00
Joseph Myers f962932206 Implement C23 asinpi
C23 adds various <math.h> function families originally defined in TS
18661-4.  Add the asinpi functions (asin(x)/pi).

Tested for x86_64 and x86, and with build-many-glibcs.py.
2024-12-10 20:42:20 +00:00
Joseph Myers 28d102d15c Implement C23 acospi
C23 adds various <math.h> function families originally defined in TS
18661-4.  Add the acospi functions (acos(x)/pi).

Tested for x86_64 and x86, and with build-many-glibcs.py.
2024-12-09 23:01:29 +00:00
Joseph Myers f9e90e4b4c Implement C23 tanpi
C23 adds various <math.h> function families originally defined in TS
18661-4.  Add the tanpi functions (tan(pi*x)).

Tested for x86_64 and x86, and with build-many-glibcs.py.
2024-12-05 21:42:10 +00:00
Joseph Myers 776938e8b8 Implement C23 sinpi
C23 adds various <math.h> function families originally defined in TS
18661-4.  Add the sinpi functions (sin(pi*x)).

Tested for x86_64 and x86, and with build-many-glibcs.py.
2024-12-04 20:04:04 +00:00
Joseph Myers 0ae0af68d8 Implement C23 cospi
C23 adds various <math.h> function families originally defined in TS
18661-4.  Add the cospi functions (cos(pi*x)).

Tested for x86_64 and x86, and with build-many-glibcs.py.
2024-12-04 10:20:44 +00:00
Florian Weimer b7d4de086c manual: Describe struct link_map, support link maps with dlinfo
This does not describe how to use RTLD_DI_ORIGIN and l_name
to reconstruct a full path for the an object. The reason
is that I think we should not recommend further use of
RTLD_DI_ORIGIN due to its buffer overflow potential (bug 24298).
This should be covered by another dlinfo extension.  It would
also obsolete the need for the dladdr approach to obtain
the file name for the main executable.

Obtaining the lowest address from load segments in program
headers is quite clumsy and should be provided directly
via dlinfo.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2024-12-02 11:38:14 +01:00
Yury Khrustalev 47311cca31 manual: Add description of AArch64-specific pkey flags
Describe AArch64 specific flags PKEY_DISABLE_READ and PKEY_DISABLE_EXECUTE that
are available on AArch64 systems with enabled Stage 1 permission overlays
feature introduced in Armv8.9 / 9.4 (FEAT_S1POE).

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2024-11-20 11:30:58 +00:00
Jonathan Wakely 8d3fb43797 manual: Fix overeager s/int/size_t/ in memory.texi
The change in e3960d1c57 should only have
affected 'int' not 'internally'.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
2024-11-13 14:43:58 +00:00
Yury Khrustalev 0c38c59f75 manual: Use more precise wording for memory protection keys
Update the name of the argument in several pkey_*() functions that refers
to access restrictions rather than access rights: change access "rights"
to access "restrictions".

Specify that the result of the pkey_get() should be checked using bitwise
operations rather than plain equals comparison.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2024-11-06 13:11:33 +00:00
Lenard Mollenkopf e442e8376d Add feature test macro _ISOC2Y_SOURCE
This patch starts preparation for C2Y support in glibc headers by
adding a feature test macro _ISOC2Y_SOURCE and corresponding
__GLIBC_USE (ISOC2Y). (I mostly copied the work of Joseph Myers
for C2X). As with other such macros, C2Y features are also
enabled by compiling for a standard newer than C23, or by using
_GNU_SOURCE.

This patch does not itself enable anything new in the headers for C2Y;
that is to be done in followup patches. (For example an implementation
of WG14 N3349.)

Once C2Y becomes an actual standard we'll presumably move to using the
actual year in the feature test macro and __GLIBC_USE, with some
period when both macro spellings are accepted, as was done with
_ISOC2X_SOURCE.

Tested for x86_64.

Signed-off-by: Lenard Mollenkopf <glibc@lenardmollenkopf.de>
2024-11-04 22:40:55 +00:00
Joseph Myers 7fe1fde499 Document further requirement on mixing streams / file descriptors
The gilbc manual has some documentation in llio.texi of requirements
for moving between I/O on FILE * streams and file descriptors on the
same open file description.

The documentation of what must be done on a FILE * stream to move from
it to either a file descriptor or another FILE * for the same open
file description seems to match POSIX.  However, there is an
additional requirement in POSIX on the *second* of the two handles
being moved between, which is not mentioned in the glibc manual: "If
any previous active handle has been used by a function that explicitly
changed the file offset, except as required above for the first
handle, the application shall perform an lseek() or fseek() (as
appropriate to the type of handle) to an appropriate location.".

Document this requirement on seeking in the glibc manual, limited to
the case that seems relevant to glibc (the new channel is a previously
active stream, on which the seeking previously occurred).  Note that
I'm not sure what the "except as required above for the first handle"
is meant to be about, so I haven't documented anything for it.  As far
as I can tell, nothing specified for moving from the first handle
actually list calling a seek function as one of the steps to be done.
(Current POSIX doesn't seem to have any relevant rationale for this
section.  The rationale in the 1996 edition says "In requiring the
seek to an appropriate location for the new handle, the application is
required to know what it is doing if it is passing streams with seeks
involved.  If the required seek is not done, the results are undefined
(and in fact the program probably will not work on many common
implementations)." - which also doesn't help in understanding the
purpose of "except as required above for the first handle".)

Tested with "make info" and "make pdf".
2024-10-28 22:22:26 +00:00
DJ Delorie dcad785074 manual: Document stdio.h functions that may be macros
Glibc has two gnu-extension functions that are implemented as
macros but not documented as such: fread_unlocked and
fwrite_unlocked.  Document them as such.

Additionally, putc_unlocked and getc_unlocked are documented in
POSIX as possibly being macros.  Update the manual to add a warning
about those also, depite glibc not implementing them as macros.
2024-10-21 17:08:31 -04:00
Carlos O'Donell 83a1cc3bc3 manual: Fix and test @deftypef* function formatting
The manual contained several instances of incorrect formatting
that were correct texinfo but produced incorrectly rendered manuals
or incorrect behaviour from the tooling.

The most important was incorrect quoting of function returns
by failing to use {} to quote the return.  The impact of this
mistake means that 'info libc func' does not jump to the function
in question but instead to the introductory page under the assumption
that func doesn't exist.  The function returns are now correctly
quoted.

The second issue was the use of a category specifier with
@deftypefun which doesn't accept a category specifier.  If a category
specifier is required then @deftypefn needs to be used. This is
corrected by changing the command to @deftypefn for such functions
that used {Deprecated function} as a category.

The last issue is a missing space between the function name and the
arguments which results in odd function names like "epoll_wait(int"
instead of "epoll_wait".  This also impacts the use of 'info libc'
and is corrected.

We additionally remove ';' from the end of function arguments and
add an 'int' return type for dprintf.

Lastly we add a new test check-deftype.sh which verifies the expected
formatting of @deftypefun, @deftypefunx, @deftypefn, and
@deftypefnx.  The new test is also run as the summary file is
generated to ensure we don't generate incorrect results.

The existing check-safety.sh is also run directly as a test to increase
coverage since the existing tests only ran on manual install.

The new tests now run as part of the standard "make check" that
pre-commit CI runs and developers should run.

No regressions on x86_64.

HTML and PDF rendering reviewed and looks correct for all changes.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2024-10-11 10:35:35 -04:00
Adhemerval Zanella 5ffc903216 misc: Add support for Linux uio.h RWF_ATOMIC flag
Linux 6.11 adds the new flag for pwritev2 (commit
c34fc6f26ab86d03a2d47446f42b6cd492dfdc56).

Checked on x86_64-linux-gnu on 6.11 kernel.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2024-10-10 10:28:01 -03:00
Adhemerval Zanella f6e849fd7c linux: Add MAP_DROPPABLE from Linux 6.11
This request the page to be never written out to swap, it will be zeroed
under memory pressure (so kernel can just drop the page), it is inherited
by fork, it is not counted against @code{mlock} budget, and if there is
no enough memory to service a page faults there is no fatal error (so not
signal is sent).

Tested with build-many-glibcs.py.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2024-10-10 10:27:53 -03:00
Adhemerval Zanella d40ac01cbb stdlib: Make abort/_Exit AS-safe (BZ 26275)
The recursive lock used on abort does not synchronize with a new process
creation (either by fork-like interfaces or posix_spawn ones), nor it
is reinitialized after fork().

Also, the SIGABRT unblock before raise() shows another race condition,
where a fork or posix_spawn() call by another thread, just after the
recursive lock release and before the SIGABRT signal, might create
programs with a non-expected signal mask.  With the default option
(without POSIX_SPAWN_SETSIGDEF), the process can see SIG_DFL for
SIGABRT, where it should be SIG_IGN.

To fix the AS-safe, raise() does not change the process signal mask,
and an AS-safe lock is used if a SIGABRT is installed or the process
is blocked or ignored.  With the signal mask change removal,
there is no need to use a recursive loc.  The lock is also taken on
both _Fork() and posix_spawn(), to avoid the spawn process to see the
abort handler as SIG_DFL.

A read-write lock is used to avoid serialize _Fork and posix_spawn
execution.  Both sigaction (SIGABRT) and abort() requires to lock
as writer (since both change the disposition).

The fallback is also simplified: there is no need to use a loop of
ABORT_INSTRUCTION after _exit() (if the syscall does not terminate the
process, the system is broken).

The proposed fix changes how setjmp works on a SIGABRT handler, where
glibc does not save the signal mask.  So usage like the below will now
always abort.

  static volatile int chk_fail_ok;
  static jmp_buf chk_fail_buf;

  static void
  handler (int sig)
  {
    if (chk_fail_ok)
      {
        chk_fail_ok = 0;
        longjmp (chk_fail_buf, 1);
      }
    else
      _exit (127);
  }
  [...]
  signal (SIGABRT, handler);
  [....]
  chk_fail_ok = 1;
  if (! setjmp (chk_fail_buf))
    {
      // Something that can calls abort, like a failed fortify function.
      chk_fail_ok = 0;
      printf ("FAIL\n");
    }

Such cases will need to use sigsetjmp instead.

The _dl_start_profile calls sigaction through _profil, and to avoid
pulling abort() on loader the call is replaced with __libc_sigaction.

Checked on x86_64-linux-gnu and aarch64-linux-gnu.

Reviewed-by: DJ Delorie <dj@redhat.com>
2024-10-08 14:40:12 -03:00
Florian Weimer f47596fcfe 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>
2024-09-27 11:41:14 +02:00
Florian Weimer 00ba299787 manual: __is_last is no longer part of iconv internals
The __is_last field was replaced with a bitmask in
commit 85830c4c46 in 2000,
and multiple bits are in use today.

Reviewed-by: DJ Delorie <dj@redhat.com>
2024-09-20 13:51:09 +02:00
Florian Weimer 21571ca0d7 Linux: Add the sched_setattr and sched_getattr functions
And struct sched_attr.

In sysdeps/unix/sysv/linux/bits/sched.h, the hack that defines
sched_param around the inclusion of <linux/sched/types.h> is quite
ugly, but the definition of struct sched_param has already been
dropped by the kernel, so there is nothing else we can do and maintain
compatibility of <sched.h> with a wide range of kernel header
versions.  (An alternative would involve introducing a separate header
for this functionality, but this seems unnecessary.)

The existing sched_* functions that change scheduler parameters
are already incompatible with PTHREAD_PRIO_PROTECT mutexes, so
there is no harm in adding more functionality in this area.

The documentation mostly defers to the Linux manual pages.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2024-09-11 10:05:08 +02:00
Florian Weimer 298bc488fd manual: Extract the @manpageurl{func,sec} macro
From the existing @manpagefunctionstub{func,sec} macro,
so that URLs can be included in the manual without the
stub text.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2024-09-11 10:05:08 +02:00
Joseph Myers a2509a8bc9 Document limitations on streams passed to freopen
As recently discussed, document that freopen does not work with
streams opened with functions such as popen, fmemopen, open_memstream
or fopencookie.  I've filed
<https://austingroupbugs.net/view.php?id=1855> to clarify this issue
in POSIX.

Tested with "make info" and "make html".
2024-09-06 20:38:23 +00:00
Florian Weimer 6efd6cd46b manual: Safety annotations for clock_gettime, clock_getres
The annotations are preliminary, for consistency with existing
annotations on gettimeofday etc.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2024-09-06 14:07:00 +02:00
Florian Weimer 3de73f974f manual: Add Descriptor-Relative Access section
Reference this new section from the O_PATH documentation.

And document the functions openat, openat64, fstatat, fstatat64.
(The safety assessment for fstatat was already obsolete because
current glibc assumes kernel support for the underlying system
call.)

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2024-08-27 10:16:10 +02:00