libc/dbm: Differentiate between uninitialized and end-of-db cursors
Commit `3a686b851f8f` fixed a `dbm_nextkey` edge case when using
the function after reaching the end of the database, but it inadvertently
broke the following `R_NEXT` behaviour:
"If the cursor is not yet set, this is the same as the R_FIRST flag."
Fix this by adding a new cursor constant that allows us to differentiate
between an unset cursor and a cursor that overflowed.
Reported by: ae
Fixes: 3a686b851f8f
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D57670
Reviewed by: markj
efirt(9): in verbose mode, announce the attachment and fw spec version
Reviewed by: emaste, imp
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D57710
adjtime(2): document that delta can be NULL
The current verbiage somewhat indicates that always adjusts the time,
which hasn't been true as far back as I had the energy to `git blame`.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D57676
rights(4): fix our representation of the unused bits
The current format seems to be a little confusing, and the version of it
for index 0 was broken by the below-referenced commit. Break our
UNUSED macros out into one per unused bit to enumerate the entirety of
the space and make it easier to claim an unused one.
Fixes: b165e9e3ea4e327fc ("Add fchroot(2)")
Reviewed by: oshogbo (previous version), kib, markj
Differential Revision: https://reviews.freebsd.org/D57505
linuxkpi: Change `strscpy()` and `strscpy_pad()` to make their `len` argument optional
The previous implementation always took the `len` but now, it is
optional and defaults to the size of `dst`.
The DRM drivers started to use `strscpy()` without the `len` in Linux 6.13.
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57585
linuxkpi: Define `COUNT_ARGS()` and `CONCATENATE()`
`COUNT_ARGS()` counts the number of arguments it is passed. The
implementation is heavily inspired from the one of `CTR()`.
`CONCATENATE()` is an alias for `__CONCAT()`.
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57584
linuxkpi: Add 'fd_empty()`
The DRM drivers generic code started to use it in Linux 6.13.
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57582
linuxkpi: Add `pm_resume_via_firmware()`
This function is unimplemented, always return false.
While here, fix the return type of `pm_suspend_via_firmware()`: it
should be a boolean, not an integer.
The amdgpu DRM driver started to use `pm_resume_via_firmware()` in Linux
6.13.
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57580
linuxkpi: Define a bunch of constants in <acpi/video.h>
`ACPI_VIDEO_NOTIFY_PROBE` was already defined. Let's define the whole
set once and for all.
The amdgpu DRM driver started to use `ACPI_VIDEO_DISPLAY_LCD` in Linux
6.13.
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57575
linuxkpi: Define `__ATTR_RO_MODE()` and `__ATTR_RW_MODE()`
They are the same as their `__ATTR_RO()` and `_ATTR_RW()` equivalents
but they take the file mode as an extra argument.
We now use these new macros to redefine `__ATTR_RO()` and `__ATTR_RW()`
on top of them.
The amdgpu DRM driver started to use `__ATTR_RW_MODE()` in Linux 6.13.
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57574
MFV: file 5.47.
(cherry picked from commit e949ce9dc0e6fff26e83904f1008b76d36ba0a37)
file: normalize .result files to ensure trailing newline on install
Some upstream result files introduced in file 5.47 (e.g., bgcode.result)
lack a trailing newline, causing the contrib_file_tests ATF test to
fail with "cmp: EOF on bgcode.result". Generate normalized copies
of the expected results and install those instead.
Fixes: e949ce9dc0e6fff26e83904f1008b76d36ba0a37
(cherry picked from commit f7c0bd206fe4f3a956b3ecb4dc11a7386b85fa22)
MFV: file 5.47.
(cherry picked from commit e949ce9dc0e6fff26e83904f1008b76d36ba0a37)
file: normalize .result files to ensure trailing newline on install
Some upstream result files introduced in file 5.47 (e.g., bgcode.result)
lack a trailing newline, causing the contrib_file_tests ATF test to
fail with "cmp: EOF on bgcode.result". Generate normalized copies
of the expected results and install those instead.
Fixes: e949ce9dc0e6fff26e83904f1008b76d36ba0a37
(cherry picked from commit f7c0bd206fe4f3a956b3ecb4dc11a7386b85fa22)
GCE: Apply public-image label on GCE images
Update the GCE image creation process to automatically apply the
'public-image=true' label when publishing new images. This aligns
with standard labeling expectations for images hosted in public
projects.
(cherry picked from commit c85542b92acd286d9e4b034b2ab4d6b6cd46c740)
GCE: Apply public-image label on GCE images
Update the GCE image creation process to automatically apply the
'public-image=true' label when publishing new images. This aligns
with standard labeling expectations for images hosted in public
projects.
(cherry picked from commit c85542b92acd286d9e4b034b2ab4d6b6cd46c740)
libc: Enforce lock-free atomic_flag and C23-safe initialisation
Select the `atomic_flag` backing type according to the C standard
requirements that `atomic_flag` operations be lock-free.
C11 §7.17.1.5 defines `atomic_flag` as:
> a structure type representing a lock-free, primitive atomic flag
and §7.17.8.2 further requires:
> Operations on an object of type atomic_flag shall be lock free
Therefore:
- Prefer `atomic_bool` when `ATOMIC_BOOL_LOCK_FREE == 2`
- Fall back to `atomic_uchar` when `ATOMIC_CHAR_LOCK_FREE == 2`
- Trigger a translation failure if neither type is lock-free
[13 lines not shown]
libc: Fix GCC pointer semantics for atomic_fetch_add/sub
Correct the GCC implementation of `atomic_fetch_add_explicit()`
and `atomic_fetch_sub_explicit()` for atomic pointer types.
The previous implementation passed the operand directly to the
builtins. For pointer objects, this could result in raw byte-wise
address arithmetic rather than the required C atomic pointer
semantics, where the operand is interpreted as a `ptrdiff_t`
element count.
As a result, operations such as `atomic_fetch_sub_explicit(&p, 2, ...)`
could produce an incorrect post-operation pointer value.
Fix this by applying pointer scaling in the GCC path before invoking
the builtin, mirroring the existing legacy fallback implementation.
Pointer operands are now scaled by the size of the pointed-to type,
while integer atomic behaviour remains unchanged.
[3 lines not shown]
libc: Fix atomic_init for GCC atomic objects
Add a dedicated `__GNUC_ATOMICS` path that initialises via
`atomic_store_explicit(obj, value, memory_order_relaxed)`.
This ensures the required initialisation semantics without
assuming any particular object representation.
Previously, `atomic_init` on GCC fell through to the legacy
`__val` member path intended only for old struct-backed
atomic objects. For current atomic objects, this caused the
following compilation error:
> error: request for member '__val' in something not a
structure or union
As a result, valid code such as `atomic_init(&x, 1)` failed
to compile when using GCC.
[6 lines not shown]
libc: Reorder atomic operations to match ISO C standard
Reorder definitions of specified generic operations on atomic types
so they follow the sequence in ISO/IEC 9899:2024 §7.17.7:
1. `atomic_store`
2. `atomic_load`
3. `atomic_exchange`
4. `atomic_compare_exchange`
5. `atomic_fetch`
This aligns the header layout with the standard, making it easier
to cross-check against the normative text and maintain consistency
with the rest of the header.
The behaviour of the macros remains unchanged; this is purely a
reorganisation and documentation improvement.
Signed-off-by: Faraz Vahedi <kfv at kfv.io>
[2 lines not shown]
libc: Add missing kill_dependency macro
Add `kill_dependency` as specified by C11 §7.17.3.1.
The macro is required to break dependency chains in
expressions without affecting the value.
No functional impact beyond providing the required,
value-preserving definition.
Signed-off-by: Faraz Vahedi <kfv at kfv.io>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/2185
rtw88: Fix typo in portability glue
Fix typo in if statement for compiling rtw88 against a Linux target.
Signed-off-by: Lambert Lim <lambert at sanesecurityguy.com>
Reviewed by: imp,ziaee
Pull Request: https://github.com/freebsd/freebsd-src/pull/2262
libc: Restrict ATOMIC_VAR_INIT for C23 conformance
Omit `ATOMIC_VAR_INIT` when targeting C23, where it has been removed.
Retain it for earlier C standards and for C++ (as it still remains in
C++23, albeit marked as deprecated since C17 and C++20.)
Also separate `atomic_init` definitions from `ATOMIC_VAR_INIT` to
avoid coupling with a deprecated initialisation mechanism.
No functional change intended for `atomic_init`; this is purely a
conformance and cleanup adjustment.
Signed-off-by: Faraz Vahedi <kfv at kfv.io>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/2185
libc: Reorganise memory_order enumeration constants
Place the `memory_order` enumeration constants alongside the corresponding
typedef under the §7.17.3 heading.
The previous layout separated the fallback constant definitions from the
enum, which could obscure their relationship. These fallbacks exist only
to provide values when the compiler does not supply the builtins.
The removed comment encoded implementation-specific assumptions about
compiler-provided definitions and implied a relationship between Clang/GCC
macros and fallback values. In practice, the fallback definitions exist
solely to ensure the enumerators are defined when compiler intrinsics are
absent, and do not depend on any particular numeric mapping.
No functional change; this is a mere structural and clarity improvement.
Signed-off-by: Faraz Vahedi <kfv at kfv.io>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/2185
powerpc64le: switch long double to IEEE binary128
Change powerpc64le's long double from 64-bit double to IEEE 754
binary128 (quad, 113-bit mantissa), matching aarch64 and riscv64.
Gated on FreeBSD 16 and powerpc64le only.
Differential Revision: https://reviews.freebsd.org/D57388
Reviewed by: adrian
Relnotes: yes
Update dirdpes.mk et al
Update to latest dirdeps related makefiles.
dirdeps.mk tweaks useful for universe among other corner cases.
also additional filtering for bogus paths ending in /
gendirdeps.mk allow more debugging
also additional filtering for bogus paths ending in /
install-new.mk fix bug when isPOSIX_SHELL is true
meta2deps.?? handle file names with spaces by ignoring them
Reviewed by: stevek
Differential Revision: https://reviews.freebsd.org/D57683