FreeBSD/src 3542d60sys/compat/linuxkpi/common/include/linux kstrtox.h

linuxkpi: Don't clobber result on failure

In kstrto*(), don't assign to *res until we know the conversion is
successful, and address issues that may result in warnings if code
that uses <linux/kstrtox.h> is compiled at high warning levels.

MFC after:      1 week
Sponsored by:   Klara, Inc.
Sponsored by:   NetApp, Inc.
Reviewed by:    bz, emaste
Differential Revision:  https://reviews.freebsd.org/D54440
DeltaFile
+30-13sys/compat/linuxkpi/common/include/linux/kstrtox.h
+30-131 files

FreeBSD/src 5484910lib/libc/tests/string stpncpy_test.c

libc/tests/string: improve stpncpy() "bounds" unit test

The test is extended the same way I previously extended the memccpy()
test to fix what is probably the same kind of bug.

PR:             291359
Reported by:    Collin Funk <collin.funk1 at gmail.com>
Reviewed by:    ngie
Approved by:    markj (mentor)
Fixes:          6fa9e7d8737548ef93c573387ce62402c368d486 (D42519)
See also:       61ed5748e4e9c7397fcb2638b442f46ac5c9e7c5 (D46051)
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D54169

(cherry picked from commit 123c086200491819595abc271d360e605288fd18)
(cherry picked from commit 8be8642826099368208efb2c1222f2a102cc5b08)
DeltaFile
+39-16lib/libc/tests/string/stpncpy_test.c
+39-161 files

FreeBSD/src be65a18lib/libc/string ffs.3, share/man/man3 intro.3 bitstring.3

man/man3: add cross references to stdbit(3)

Add cross references to relevant stdbit man pages

Approved by:    markj (mentor)
MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D53661

(cherry picked from commit 5bfdb66ad985774b123ecd0cadee65c071b7ded0)
DeltaFile
+9-2share/man/man3/intro.3
+2-0lib/libc/string/ffs.3
+1-0share/man/man3/bitstring.3
+12-23 files

FreeBSD/src 41b346alib/libc/tests/stdbit Makefile

libc: Fix TESTSDIR for new stdbit tests

Otherwise the directory created by etc/mtree/BSD.tests.dist, which is
where these belong, and referred to by the generated Kyuafile for
/usr/tests/lib/libc (via stdbit's existence in TESTS_SUBDIRS), ends up
empty with no Kyuafile, which is an error for kyua.

Reported by:    kp
Fixes:          2fb8cbc6ef1b ("libc/tests: add stdbit test framework and unit tests")

(cherry picked from commit 5f529f9e292a30c065c316ed5fd0d23e07b26e5c)
DeltaFile
+2-0lib/libc/tests/stdbit/Makefile
+2-01 files

FreeBSD/src 6b7ed28share/man/man3 stdbit.3 Makefile

man/man3: add stdbit.3

This is the overview man page for the <stdbit.h> functions.

Reviewed by:    pauamma at gundo.com, adrian
Approved by:    markj (mentor)
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D53658

(cherry picked from commit d39e310c7d6a42b459aa7919310e3c99cc478d50)
DeltaFile
+120-0share/man/man3/stdbit.3
+1-0share/man/man3/Makefile
+121-02 files

FreeBSD/src fff2795lib/libc/stdbit stdc_has_single_bit.c

libc/stdc_has_single_bit.c: fix gcc warning (-Wparentheses)

gcc14 is concerned that the operator precedence between - and & might
be confusing.  Throw in some redundant parentheses to make it shut up.
The LLVM build was fine before this change.

Reported by:    Martin Filla <freebsd at sysctl.cz>
Approved by:    markj (mentor)
MFC after:      1 month
Fixes:          6296500a85c8474e3ff3fe2f8e4a9d56dd0acd64
Differential Revision:  https://reviews.freebsd.org/D54057

(cherry picked from commit 3d71ce92eae9f1417f35a0d07912858fd8f6fa0b)
DeltaFile
+5-5lib/libc/stdbit/stdc_has_single_bit.c
+5-51 files

FreeBSD/src c9ec3fclib/libc/tests/stdbit stdbit-test-framework.c stdbit-test-kernel.c

libc/tests: add stdbit test framework and unit tests

This adds unit tests for all 70 functions in <stdbit.h>.

I'm sorry for the test framework, but it makes it so I don't
have to write 70 unit tests by hand.

Reviewed by:    adrian, des
Approved by:    markj (mentor)
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D53660

(cherry picked from commit 2fb8cbc6ef1b3cc6cd60e5db07f8305623f9b044)
DeltaFile
+80-0lib/libc/tests/stdbit/stdbit-test-framework.c
+68-0lib/libc/tests/stdbit/stdbit-test-kernel.c
+30-0lib/libc/tests/stdbit/stdc_first_leading_zero_test.c
+29-0lib/libc/tests/stdbit/stdc_first_leading_one_test.c
+27-0lib/libc/tests/stdbit/stdc_first_trailing_zero_test.c
+26-0lib/libc/tests/stdbit/stdc_leading_ones_test.c
+260-013 files not shown
+513-019 files

FreeBSD/src 27de656lib/libc/stdbit stdc_first_trailing_one.3 stdc_bit_width.3

libc/stdbit: add man pages for stdbit functions

This adds man pages for each group of functions in <stdbit.h>.
The man pages have cross references to one-another.
Cross references from external man pages to these will be added
in a later commit.

Reviewed by:    pauamma at gundo.com, kib
Approved by:    markj (mentor)
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D53659

(cherry picked from commit d790b16bbf0c3055ef00200d01659dfb3c0e5e5e)
DeltaFile
+110-0lib/libc/stdbit/stdc_first_trailing_one.3
+104-0lib/libc/stdbit/stdc_bit_width.3
+98-0lib/libc/stdbit/stdc_has_single_bit.3
+93-0lib/libc/stdbit/stdc_first_trailing_zero.3
+93-0lib/libc/stdbit/stdc_first_leading_one.3
+92-0lib/libc/stdbit/stdc_first_leading_zero.3
+590-09 files not shown
+1,283-015 files

FreeBSD/src 325b327lib/libc/tests/gen limits_test.c

libc/limits_test: add no-op testcase to satisfy kyua

This test suite is purely tested with compile-time assertions, so
it needs a dummy runtime test to ensure that kyua reports the
file as passing.

Pull Request:   https://github.com/freebsd/freebsd-src/pull/1915
Sponsored by:   The FreeBSD Foundation
Reviewed by:    fuz
Approved by:    markj (mentor)
MFC after:      1 month
Signed-off-by:  Siva Mahadevan <me at svmhdvn.name>

(cherry picked from commit 27ff0bbcfd27df588d3f486cb21180a26031b889)
DeltaFile
+4-1lib/libc/tests/gen/limits_test.c
+4-11 files

FreeBSD/src 44fcd99sys/powerpc/include _stdint.h

powerpc/_stdint.h: fix SIG_ATOMIC_{MIN,MAX,WIDTH}

On powerpc/powerpc64, sig_atomic_t is an int, but was treated as if
it was a long by <machine/_stdint.h>.  This was finally caught by the
unit test added with 4a1c752 / D53831.

Reported by:    kib
Reviewed by:    kib, imp
Approved by:    markj (mentor)
Fixes:          c3e289e1ce8c9af8d14e9f727632e22b3bf901f9
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D54026

(cherry picked from commit f417c9ed6642836c386c922d6e184b618d28127d)
DeltaFile
+5-10sys/powerpc/include/_stdint.h
+5-101 files

FreeBSD/src ff50acesys/arm/include _stdint.h, sys/arm64/include _stdint.h

sys/stdint.h: add C23 _WIDTH macros

The platform-dependent macros are added to the various
_stdint.h headers, those that are always the same are
added directly to _stdint.h.

We may want to move the definitions for WCHAR_* and
WINT_* out of the platform header files as those are
always the same.

Approved by:    markj (mentor)
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D53830

(cherry picked from commit 7998a82d2f99a00086baf64b2a3343ba10f8806d)
DeltaFile
+33-0sys/x86/include/_stdint.h
+33-0sys/powerpc/include/_stdint.h
+29-0sys/sys/stdint.h
+23-0sys/arm/include/_stdint.h
+23-0sys/riscv/include/_stdint.h
+23-0sys/arm64/include/_stdint.h
+164-06 files

FreeBSD/src 12f8788lib/libc/tests/gen limits_test.c Makefile

libc/tests: add test for *_MAX, *_MIN, and *_WIDTH

This file checks the correctness of the various _MAX, _MIN, and
_WIDTH macros defined for the libc types.  It assumes that none
of the types have padding bits.

Approved by:    markj (mentor)
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D53831

(cherry picked from commit 4a1c7529c96ff54657ef701fa89b92230ee6bac2)
DeltaFile
+101-0lib/libc/tests/gen/limits_test.c
+1-0lib/libc/tests/gen/Makefile
+102-02 files

FreeBSD/src 275c11binclude stdbit.h, lib/libc/stdbit Symbol.map stdc_bit_ceil.c

libc: implement C23 <stdbit.h> functions

This new header complies with ISO/IEC 9899:2024 (C23).

Contrary to glibc, we do not provide inline definitions in
<stdbit.h> as we expect our system compiler to soon recognise
these as builtins anyway.

Relnotes:       yes
MFC after:      1 month
Reviewed by:    adrian
Approved by:    markj (mentor)
Differential Revision:  https://reviews.freebsd.org/D53657

(cherry picked from commit 6296500a85c8474e3ff3fe2f8e4a9d56dd0acd64)
DeltaFile
+124-0include/stdbit.h
+85-0lib/libc/stdbit/Symbol.map
+71-0lib/libc/stdbit/stdc_bit_ceil.c
+60-0lib/libc/stdbit/stdc_leading_ones.c
+60-0lib/libc/stdbit/stdc_leading_zeros.c
+57-0lib/libc/stdbit/stdc_first_leading_zero.c
+457-013 files not shown
+973-219 files

FreeBSD/src 2ff4e6asys/sys _types.h

sys/_types.h: recognise char8_t as a builtin type in C++20

Unlike in C23 where it's a typedef, char8_t is a built in type in
C++20.  Recognise it as such.

PR:             291449
Reported by:    Tomoaki AOKI <junchoon at dec.sakura.ne.jp>
Approved by:    markj (mentor)
Reviewed by:    imp
Fixes:          f0e541118c374869a8226eaa1320bb6eda248a20
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D54124

(cherry picked from commit 66129def7bdaf8a0447aba55e736d27687204555)
DeltaFile
+4-0sys/sys/_types.h
+4-01 files

FreeBSD/src cbad54bsys/arm/include _limits.h, sys/arm64/include _limits.h

sys/limits.h: add C23 _WIDTH macros

For compliance with IOS/IEC 9899:2024 ("C23").

These macros define the width in bits of the basic integer types.
Another new macro, BITINT_MAXWIDTH, is not yet included as I do not
understand what it should be set to.  Perhaps it is compiler-specific.

Approved by:    markj (mentor)
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D53825

(cherry picked from commit 7326bc7f9c14f86976a7769906b167ff96140809)
DeltaFile
+20-0sys/sys/limits.h
+3-0sys/x86/include/_limits.h
+3-0sys/arm/include/_limits.h
+3-0sys/arm64/include/_limits.h
+3-0sys/powerpc/include/_limits.h
+3-0sys/riscv/include/_limits.h
+35-06 files

FreeBSD/src 72609bbinclude uchar.h, sys/sys stdatomic.h

uchar.h: add char8_t

A type similar to char16 and char32_t, for compliance with C23.
The related type atomic_char8_t is added to stdatomic.h.
As char8_t is always unsigned char, I've skipped adding __char8_t.
This can be added, too, if desired.

Reviewed by:    imp
Approved by:    markj (mentor)
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D53952

(cherry picked from commit f0e541118c374869a8226eaa1320bb6eda248a20)
DeltaFile
+6-0sys/sys/stdatomic.h
+5-0include/uchar.h
+11-02 files

FreeBSD/src 141cec0contrib/mandoc mdoc.7

contrib/mandoc: document .St -ieee754-2008 in mdoc(7)

Approved by:    markj (mentor)
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D53784

(cherry picked from commit 63cd0841de76b215f5d5078fab097b515b42cc93)
DeltaFile
+5-0contrib/mandoc/mdoc.7
+5-01 files

FreeBSD/src 1044886lib/msun/src math.h

msun: expose the C23 functions we already support in <math.h>

This is the *pi family of trigonometric functions. Quite a few C23
functions are still missing.  These seem to be:
acospi, acospif, acospil, asinpi, asinpif, asinpil, atan2pi, atan2pif,
atan2pil, atanpi, atanpif, atanpil, canonicalize, canonicalizef,
canonicalizel, compoundn, compoundnf, compoundnl, daddl, ddivl, dfmal,
dmull, dsqrtl, dsubl, exp10, exp10f, exp10l, exp10m1, exp10m1f,
exp10m1l, exp2m1, exp2m1f, exp2m1l, fadd, faddl, fdiv, fdivl, ffma,
ffmal, fmaximum, fmaximum_mag, fmaximum_mag_num, fmaximum_mag_numf,
fmaximum_mag_numl, fmaximum_magf, fmaximum_magl, fmaximum_num,
fmaximum_numf, fmaximum_numl, fmaximumf, fmaximuml, fminimum,
fminimum_mag, fminimum_mag_num, fminimum_mag_numf, fminimum_mag_numl,
fminimum_magf, fminimum_magl, fminimum_num, fminimum_numf,
fminimum_numl, fminimumf, fminimuml, fmul, fmull, fromfp, fromfpf,
fromfpl, fromfpx, fromfpxf, fromfpxl, fsqrt, fsqrtl, fsub, fsubl,
iscanonical, iseqsig, issignaling, issubnormal, iszero, nextdown,
nextdownf, nextdownl, nextup, nextupf, nextupl, pown, pownf, pownl,
powr, powrf, powrl, rootf, rootl, rootn, roundeven, roundevenf,

    [10 lines not shown]
DeltaFile
+4-1lib/msun/src/math.h
+4-11 files

FreeBSD/src 3578796include time.h

time.h: add timegm() to the C23 namespace

This function is part of ISO/IEC 9899:2024 (C23) and was forgotten in D47856.

Reviewed by:    imp
Approved by:    markj (mentor)
See also:       D47856
Fixes:          59677aecb67bbedcfa2ee5d7d2b189193cdc4af7
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D53951

(cherry picked from commit 5da388c633f8da8fbb35b8407ca848373e3ea977)
DeltaFile
+1-1include/time.h
+1-11 files

FreeBSD/src 6fc2808lib/msun/man tanpi.3 cospi.3

msun: document that {sin,cos,tan}pi(3) follow C23

 - also use new .St -ieee754-2008 request in *pi.3

Reviewed by:    imp
Approved by     markj (mentor)
See also:       D53784
Differential Revision:  https://reviews.freebsd.org/D53783

(cherry picked from commit 4fcc58afbff924293c721f4c4056bb7f94580f22)
DeltaFile
+5-8lib/msun/man/tanpi.3
+5-8lib/msun/man/cospi.3
+5-7lib/msun/man/sinpi.3
+15-233 files

FreeBSD/src e53890ccontrib/mandoc st.c

contrib/mandoc: add -ieee754-2008

This is needed to simplify the msun manpages {sin,cos,tan}pi.3

Approved by:    markj (mentor)
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D53784

(cherry picked from commit db3884b03989b095d746087afab8e5e649c3699a)
DeltaFile
+1-0contrib/mandoc/st.c
+1-01 files

FreeBSD/src 74c8530sbin/camcontrol camcontrol.8

camcontrol.8: Descriptions before examples

This page has a lot of examples, so having them in the previous order
can be confusing. Rewrite to the normal order where the descriptions
come before the command, followed by a colon, which is still clear even
jumping to the middle of the section.

PR:                     291759
MFC after:              3 days
Reviewed by:            imp
Differential Revision:  https://reviews.freebsd.org/D54285

(cherry picked from commit fbc321b9cdceecd3c97742868da5d500423cf484)
DeltaFile
+149-202sbin/camcontrol/camcontrol.8
+149-2021 files

FreeBSD/src 0637149contrib/kyua/doc kyua-db-exec.1.in kyua-db-migrate.1.in

kyua manuals: Correct --results-file short form

PR:             290647
Ref:            kyua/cli/common.cpp#104
MFC after:      3 days
Reviewed by:    ziaee
Closes:         https://github.com/freebsd/kyua/issues/267

(cherry picked from commit bbaa7d628175ee484e31a054fb3cf7b7866cad13)
DeltaFile
+1-1contrib/kyua/doc/kyua-db-exec.1.in
+1-1contrib/kyua/doc/kyua-db-migrate.1.in
+1-1contrib/kyua/doc/kyua-report-html.1.in
+1-1contrib/kyua/doc/kyua-report-junit.1.in
+1-1contrib/kyua/doc/kyua-report.1.in
+1-1contrib/kyua/doc/kyua-test.1.in
+6-66 files

FreeBSD/src 7fa8625lib/libc/sys ioctl.2

ioctl.2: Mention EACCES

ioctls can fail with EACCES, see sys/kern/tty.c

PR:                     239504
MFC after:              3 days
Reviewed by:            ziaee
Reported by:            Brennan Vincent <brennan at umanwizard.com>
Differential Revision:  https://reviews.freebsd.org/D49072

(cherry picked from commit e2afbc45258f2fa4bdcf126e959ac660e76fc802)
DeltaFile
+4-1lib/libc/sys/ioctl.2
+4-11 files

FreeBSD/src 47db87fshare/man/man4 vt.4

vt.4: Remove Xr to nonexistent vidcontrol(8)

PR: 291985
Fixes: a8740ba860bf ("vt.4: Document increasing scrollback size")
(cherry picked from commit f22cffe43343d9d48c731952d94976c5deb9659e)
DeltaFile
+0-1share/man/man4/vt.4
+0-11 files

FreeBSD/src ce92b9dshare/man/man4 vt.4

vt.4: Document increasing scrollback size

MFC:                    immediately as 2 llms say this is impossible
Reviewed by:            adrian, emaste
Differential Revision:  https://reviews.freebsd.org/D53860

(cherry picked from commit a8740ba860bfc35879f886b80b30327d0d3b16bd)
DeltaFile
+8-1share/man/man4/vt.4
+8-11 files

FreeBSD/src 1b23b79share/man/man4 vt.4

vt.4: Style pass

Outstanding: I'm not sure kernel configuration declarations are defined
variables. Dv does not allow arguments, but some why allowed paths, so
non-path arguments were being incorrectly marked up as paths.

MFC after:              3 days (with resolved conflicts)
Reviewed by:            0mp, emaste
Differential Revision:  https://reviews.freebsd.org/D49565

(cherry picked from commit 7cd6da268a8fbf34b16564dd9a94c86853eb7c56)
DeltaFile
+24-24share/man/man4/vt.4
+24-241 files

FreeBSD/src c330c43share/man/man4 vt.4

vt.4: explain console fonts

Add explaination about console fonts, how to convert them, which subset
of things support them and how to use them.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1063

(cherry picked from commit 7bd6cbbf69c7a9b952ebed096625a4a4a6b7bbfd)
DeltaFile
+15-0share/man/man4/vt.4
+15-01 files

FreeBSD/src c0512bbshare/man/man4 vt.4

vt.4: Remove Xr to nonexistent vidcontrol(8)

PR: 291985
Fixes: a8740ba860bf ("vt.4: Document increasing scrollback size")
(cherry picked from commit f22cffe43343d9d48c731952d94976c5deb9659e)
DeltaFile
+0-1share/man/man4/vt.4
+0-11 files

FreeBSD/src b2b4901lib/libpathconv abs2rel.3 rel2abs.3

libpathconv: Document library in the man pages

Reviewed by:            ziaee, imp
Differential Revision:  https://reviews.freebsd.org/D54213

(cherry picked from commit 2c75ac14d7e9d1d57d70bbf26716868607f0d1fe)
DeltaFile
+2-1lib/libpathconv/abs2rel.3
+2-1lib/libpathconv/rel2abs.3
+4-22 files