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
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
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
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
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
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
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
aq(4): Fix VLAN tag test
Previously emitted a compiler warning "warning: bitwise comparison
always evaluates to false."
Looking at the OpenBSD driver (which is based on this code) it looks
like the VLAN flag should be set if either of these bits is. In the
OpenBSD driver these are AQ_RXDESC_TYPE_VLAN and AQ_RXDESC_TYPE_VLAN2
rather than a magic number 0x60.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53836
aq(4): Remove unimplemented functions
aq_if_priv_ioctl and aq_if_debug have prototypes but are not yet
implemented. Just remove the commented-out DEVMETHODs and the unused
prototypes, to clear a build-time warning; the DEVMETHODs and prototypes
can be readded if / when they are implemented.
aq(4): Port to IfAPI
Direct access to struct ifnet members is not possible in FreeBSD 15;
accessors must be used. These exist in all supported FreeBSD versions,
so we do not need to make this conditional.
sys: Import snapshot of Aquantia ACQ107 vendor driver
Obtained from https://github.com/Aquantia/aqtion-freebsd commit
c61d27b1d94af72c642deefa0595884481ea7377.
This is not using a vendor branch. The formerly-upstream repo is
abandoned and I do not believe it will receive updates. This initial
import serves as a snapshot of the vendor code, but from here we will
iterate on it in the tree as our own code.
Bug fixes, code cleanup, and build infrastructure will follow.
NetBSD and OpenBSD have derivatives of this driver (with additional
hardware support). We can look to changes in those drivers, and the
Linux driver, to add support here.
Reviewed by: adrian
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53813
pf: handle divert packets
In a divert setup pf_test_state() may return PF_PASS, but not set the state
pointer. We didn't handle that, and as a result crashed immediately afterwards
trying to dereference that NULL state pointer.
Add a test case to provoke the problem.
PR: 260867
MFC after: 2 weeks
Submitted by: Phil Budne <phil.budne at gmail.com>
Sponsored by: Rubicon Communications, LLC ("Netgate")
(cherry picked from commit 66f2f1c83247f05a3a599d7e88c7e7efbedd16b5)
pf: handle divert packets
In a divert setup pf_test_state() may return PF_PASS, but not set the state
pointer. We didn't handle that, and as a result crashed immediately afterwards
trying to dereference that NULL state pointer.
Add a test case to provoke the problem.
PR: 260867
MFC after: 2 weeks
Submitted by: Phil Budne <phil.budne at gmail.com>
Sponsored by: Rubicon Communications, LLC ("Netgate")
(cherry picked from commit 66f2f1c83247f05a3a599d7e88c7e7efbedd16b5)
depend-cleanup.sh: clean up after riscv64 enhanced string function patch set
This ensures an incremental build succeeds after import of
D47275, D46023, D45730, D45693, D46139, D46230, D46047, and D53248.
Approved by: markj (mentor)
MFC after: 1 month
MFC to: stable/15
Differential Revision: https://reviews.freebsd.org/D53485
(cherry picked from commit d59e924d2969ce2c8bec0fc4500989865fbece75)
simd.7: add scalar strchrnul() for RISC-V to manpage
index() and strchr() are implemented by calling strchrnul(), so they
also get to be marked as platform-specific.
MFC after: 1 month
MFC to: stable/15
Approved by: markj (mentor)
Reviewed by: fuz
Sponsored by: Google LLC (GSoC 2024)
Differential Revision: https://reviews.freebsd.org/D46047
(cherry picked from commit 39fef5b9fa943f301776e0b0bf406cedd7c29af2)
libc: scalar strlen() in RISC-V assembly
Includes a scalar implementation of strlen() for the RISC-V
architecture and changes to the corresponding manpage.
Performance was benchamarked using before and after:
https://github.com/clausecker/strperf
os: FreeBSD
arch: riscv
│ strlen_baseline │ strlen_scalar │
│ sec/op │ sec/op vs base │
Short 541.2µ ± 17% 401.6µ ± 0% -25.78% (p=0.000 n=21+20)
Mid 249.6µ ± 3% 191.9µ ± 0% -23.13% (p=0.000 n=21+20)
Long 124.6µ ± 0% 110.7µ ± 0% -11.13% (p=0.000 n=21+20)
geomean 256.3µ 204.3µ -20.26%
│ strlen_baseline │ strlen_scalar │
│ B/s │ B/s vs base │
[13 lines not shown]