{{ message }}
Repository navigation
lib/ukatomic: Import FreeBSD stdatomic.h header - #1919
Open
mogasergiu wants to merge 1 commit into
Open
mogasergiu wants to merge 1 commit into
mogasergiu wants to merge 1 commit into
Conversation
Import the `stdatomic.h` header from FreeBSD, providing C11 atomics.
It normally comes with the compiler, not the libc (musl/glibc don't
ship it), and -nostdinc hides the compiler's copy, so anything
including it fails to build.
Pinned to a main commit, as the latest release (15.1.0) predates the
pointer atomic_fetch_{add,sub} stride fix for GCC.
Changed to:
- use compiler predefines instead of sys/cdefs.h and sys/_types.h, so it
has no includes and one copy serves nolibc and musl. Downside:
atomic_{u,}int_fast{16,32}_t follow the compiler's ABI, not musl's
- pick the backend w/ #ifdef __clang__; upstream's __has_extension and
__GNUC_PREREQ__ checks always land there for our GCC-7/Clang-9 floor
- gate C23 bits on __STDC_VERSION__ (upstream's __ISO_C_VISIBLE defaults
to 2023, i.e. on for any -std)
- make ATOMIC_VAR_INIT() (value) on GCC too: upstream's { .__val = }
wants a struct-wrapped _Atomic and breaks with GCC's native one
- drop the pre-GCC-4.7 __sync fallback, C++ _Bool shim and _KERNEL bits
Source of import:
Repository: https://git.FreeBSD.org/src.git
Commit: 5076e9b5463afa47cf2e7689431d3dd33e5b15cb
Path: sys/sys/stdatomic.h
Checkpatch-Ignore: BRACES
Checkpatch-Ignore: CAMELCASE
Checkpatch-Ignore: COMMIT_LOG_USE_LINK
Checkpatch-Ignore: INLINE
Checkpatch-Ignore: LEADING_SPACE
Checkpatch-Ignore: MACRO_ARG_REUSE
Checkpatch-Ignore: PARENTHESIS_ALIGNMENT
Checkpatch-Ignore: SPACING
Checkpatch-Ignore: SPDX_LICENSE_TAG
Checkpatch-Ignore: VOLATILE
Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
michpappas
approved these changes
Oct 8, 2026
michpappas
left a comment
Member
There was a problem hiding this comment.
Reviewed-by: Michalis Pappas michalis@unikraft.io
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

stdatomic.hcomes with the compiler, not the libc (musl/glibc don't ship it), and-nostdinchides the compiler's copy, so anything including it fails withfatal error: stdatomic.h: No such file or directory. Context: #1843.This imports FreeBSD's
sys/sys/stdatomic.h(BSD-2-Clause, upstream5076e9b5463a) intolib/ukatomic/include. Itssys/cdefs.h/sys/_types.hdeps are swapped for compiler predefines, so it has no includes: one copy serves nolibc and musl, and ukatomic stays libc-free. It's exported through ukatomic's existing include path. No API or Kconfig changes. The commit message lists every deviation from upstream and why.Description of Changes
Related Work
N/A
PR Checklist
checkpatch.ukon your commit series before opening this PR;