aw_rtc: bump settime() delays
There are delay loops, checking the BUSY status bit, before writing to
the date or time registers. Each iteration contains a 1usec delay, for a
maximum of 70 iterations.
This is frequently not enough on the D1 platform, where the message is
emitted:
rtc0: could not set date, RTC busy
Bump the loop delay to 10usecs each, and the maximum number of
iterations to 150, for a maximum delay of 1.5msecs between each write of
the register.
In my testing this seems to be adequate.
The loop variable is renamed for clarity/simplicity.
[6 lines not shown]
pf tests: avoid cleanup failures on skipped tests
If we skip the nat:binat_* tests (e.g. because pf.ko isn't loaded) the
inetd_tester.pid file isn't created. We still run the cleanup function,
which tries to use this file to clean up the test environment. This
results in 'broken: Test case cleanup did not terminate successfully'.
Avoid this by checking if the pid file exists before using it.
Sponsored by: Rubicon Communications, LLC ("Netgate")
zfs: rename several printf attribute declarations to __printf__
For kernel builds, we redefine `__printf__` to `__freebsd_kprintf__`, to
support FreeBSD kernel printf(9) extensions with clang.
In OpenZFS various printf related functions are declared with
__attribute__((format(printf, X, Y))), so these won't work with the
above redefinition. With clang 21 and higher, this leads to errors
similar to:
sys/contrib/openzfs/module/zfs/spa_misc.c:414:38: error: passing 'printf' format string where 'freebsd_kprintf' format string is expected [-Werror,-Wformat]
414 | (void) vsnprintf(buf, sizeof (buf), fmt, adx);
| ^
Since attribute names can always be spelled with leading and trailing
double underscores, rename these instances.
Note that in FreeBSD proper we usually use `__printflike` from
<sys/cdefs.h>, but that does not apply to OpenZFS.
[4 lines not shown]
ncurses: avoid warnings about too-long initializer strings
Increase the size of `assoc::from` to 8 bytes, to avoid warnings from
clang 21 similar to:
contrib/ncurses/progs/infocmp.c:702:10: error: initializer-string for character array is too long, array size is 4 but initializer has size 5 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization]
702 | DATA("\033[2J", "ED2"), /* clear page */
| ^~~~~~~~~
contrib/ncurses/progs/infocmp.c:716:10: error: initializer-string for character array is too long, array size is 4 but initializer has size 5 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization]
716 | DATA("\033[!p", "DECSTR"), /* soft reset */
| ^~~~~~~~~
Reviewed by: markj
Obtained from: https://invisible-island.net/archives/ncurses/6.5/ncurses-6.5-20241207.patch.gz
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D54371
crypto: avoid warnings about too-long initializer strings
Mark `sigma` and `tau` as `__non_string`, to avoid warnings from clang
21 similar to:
sys/crypto/chacha20/chacha.c:53:31: error: initializer-string for character array is too long, array size is 16 but initializer has size 17 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization]
53 | static const char sigma[16] = "expand 32-byte k";
| ^~~~~~~~~~~~~~~~~~
sys/crypto/chacha20/chacha.c:54:29: error: initializer-string for character array is too long, array size is 16 but initializer has size 17 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization]
54 | static const char tau[16] = "expand 16-byte k";
| ^~~~~~~~~~~~~~~~~~
MFC after: 3 days
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D54364
vm_object_coalesce(): do not account holes twice
alc wrote:
Suppose that the object is OBJ_ONEMAPPING and that we, in fact,
have a single mapping to it. Then, we punch a hole in that mapping.
vm_map_entry_delete() only subtracts from the object's charge when
we shrink the size of the object. Now, suppose that we perform
mmap(MAP_ANON) to reallocate some of the hole. Aren't we going to add to
the charge here, even though vm_map_entry_delete() never subtracted from
the charge for the hole that was created?
Only account the change in the charged object size that was added to it.
Noted by: alc
Reviewed by: alc, markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D54263
vm_object_coalesce(): return swap reservation back if overcharged
It is possible for both vm_map_insert() and vm_object_coalesce() to charge
both for the same region. The issue is that vm_map_insert() must charge
in advance to ensure that the mapping would not exceed the swap limit,
but then the coalesce might decide to extend the object, and already
(partially) backs the mapped region.
Handle this by passing to vm_object_coalesce() exact information about
the charging mode of the extending range 'not charging', 'charged' using
flags instead of simple boolean. In vm_object_coalesce(), detect
overcharge and undo it if needed.
Note that this relies on vm_object_coalesce() call being the last action
in vm_map_insert() before extending the previous map entry.
Reported and tested by: pho
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
[2 lines not shown]
cdefs: Add __deprecated1 which accepts a message as an argument
This message will be included in any warning issued by the compiler
for use of the deprecated function.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D47701
(cherry picked from commit 6da04bcff9efedeae7d4046553002b9e3b2bc24f)
cdefs: Add __deprecated
Add __deprecated decorator. This is for a deprecated interface. copystr
is tagged with this today in copy(9), but don't actually provide it or
use it. copystr is a #define so adding it will have to wait.
LinuxKPI was defining this away completely in compiler.h. Since this is
shared between Linux KPI consumers and OpenZFS, if it's already defined,
use the FreeBSD sys/cdefs.h version, otherwise define it away. For
OpenZFS this will retain it, while for Linux KPI it will tend to drop it
(I think always, but I didn't look at everything).
Sponsored by: Netflix
Reviewed by: jhb, emaste
Differential Revision: https://reviews.freebsd.org/D46137
(cherry picked from commit 16672453f12586703f1c51d909bd1900691bf884)
sys/cdefs.h: add __noexcept and __noexcept_if
These macros provide the C++11 noexcept and noexcept(...) keywords if
we're compiling in a C++11 environment. Otherwise, they expand to an
empty string.
This will be used to add the required noexcept specifier to several libc
functions as required in C++11.
MFC after: 2 weeks
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1085
(cherry picked from commit 02b0d4b688cc4deb14cb6e7534a2a4958e48b753)