Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2e76031
feat(library-config): make libdd-library-config and libdd-library-con…
pawelchcki Mar 20, 2026
f2492fd
feat(library-config-ffi): add global allocator for no_std builds
pawelchcki Mar 20, 2026
686ba3d
feat(library-config-ffi): enable FFI configurator functions in no_std…
pawelchcki Mar 20, 2026
859cd05
feat(library-config-ffi): make LibraryConfig available in no_std builds
pawelchcki Mar 20, 2026
8cc7d0c
refactor(library-config-ffi): use alloc::ffi::CString directly in no_std
pawelchcki Mar 20, 2026
2ab5c3e
fix(library-config-ffi): exclude common.h types from cbindgen output
pawelchcki Mar 20, 2026
3eb69ce
fix: address CI failures (rustfmt, cbindgen excludes, LICENSE-3rdparty)
pawelchcki Mar 20, 2026
db1be94
refactor(common-ffi): make slice and cstr modules available in no_std…
pawelchcki Mar 20, 2026
a6e4615
refactor(library-config): replace HashMap with BTreeMap, drop hashbro…
pawelchcki Mar 20, 2026
16bf3ed
refactor(library-config): replace serde_yaml with yaml-peg for no_std…
pawelchcki Mar 20, 2026
641fc8e
chore: update Cargo.lock for yaml-peg dependency
pawelchcki Mar 20, 2026
3370b92
refactor(common-ffi): use imports instead of fully qualified alloc:: …
pawelchcki Mar 20, 2026
1ca7bf2
refactor(common-ffi): consolidate std re-exports into a single cfg block
pawelchcki Mar 20, 2026
a7fbecd
refactor(common-ffi): consolidate cfg-gated imports in slice.rs
pawelchcki Mar 20, 2026
e77ef42
fix(library-config-ffi): gate #![no_std] on no_std_entry feature for …
pawelchcki Mar 20, 2026
dc6bf5c
chore: regenerate LICENSE-3rdparty.yml
pawelchcki Mar 20, 2026
3ec10c9
fix(common-ffi): make vec module available in no_std, propagate std f…
pawelchcki Mar 20, 2026
e5ac4c4
feat(library-config): make get_config_from_bytes available in no_std
pawelchcki Mar 20, 2026
3243266
style(common-ffi): fix rustfmt for single-line use block
pawelchcki Mar 20, 2026
6723b65
fix(library-config): replace yaml_peg with yaml_serde, address review
pawelchcki Apr 7, 2026
8a8e1d3
feat(library-config-ffi): add no_std FFI entry point, address review …
pawelchcki Apr 7, 2026
5f89b6c
Merge remote-tracking branch 'origin/main' into pawel/no-std-library-…
pawelchcki Apr 7, 2026
7e50e99
style(library-config): fix rustfmt blank line between doc comment and…
pawelchcki Apr 7, 2026
da96080
fix: use main's Cargo.lock with minimal dep additions
pawelchcki Apr 7, 2026
b6c41a1
chore: regenerate LICENSE-3rdparty.csv
pawelchcki Apr 7, 2026
464fcec
Merge branch 'main' into pawel/no-std-library-config
pawelchcki Apr 8, 2026
b757c8c
fix(library-config-ffi): wrap get_from_bytes in catch_unwind for pani…
pawelchcki Apr 8, 2026
6263db2
refactor(library-config-ffi): generalize catch_panic macro for multip…
pawelchcki Apr 8, 2026
a045a89
fix(library-config-ffi): move panic prefix into catch_panic macro to …
pawelchcki Apr 10, 2026
ef56bfe
feat(library-config): add ConfigRead trait for virtual filesystem sup…
pawelchcki Apr 10, 2026
07362bd
fix(library-config): address PR review findings
pawelchcki Apr 10, 2026
bc5fdf6
refactor(library-config): extract ConfigRead to config_read.rs, remov…
pawelchcki Apr 10, 2026
f03aa7f
Merge remote-tracking branch 'origin/main' into pawel/no-std-library-…
pawelchcki Apr 13, 2026
eca2b55
style(library-config): fix rustfmt and clippy findings
pawelchcki Apr 13, 2026
c1e7872
style(library-config): fix nightly rustfmt doc comment wrapping
pawelchcki Apr 13, 2026
4b014b6
Merge origin/main and remove ddog_library_configurator_get_from_bytes
pawelchcki Apr 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ jobs:
- name: "[${{ steps.rust-version.outputs.version}}] cargo build --workspace --exclude builder --verbose"
shell: bash
run: cargo build --workspace --exclude builder --verbose
- name: "[${{ steps.rust-version.outputs.version}}] cargo check no_std (library-config)"
if: runner.os == 'Linux'
shell: bash
run: cargo check -p libdd-library-config --no-default-features && cargo check -p libdd-library-config-ffi --no-default-features
- name: "[${{ steps.rust-version.outputs.version}}] cargo nextest run --workspace --features libdd-crashtracker/generate-unit-test-files --exclude builder --profile ci --verbose -E '!test(tracing_integration_tests::)'"
shell: bash
# Run doc tests with cargo test and run tests with nextest and generate junit.xml
Expand Down
75 changes: 55 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ diff,https://github.com/utkarshkukreti/diff.rs,MIT OR Apache-2.0,Utkarsh Kukreti
digest,https://github.com/RustCrypto/traits,MIT OR Apache-2.0,RustCrypto Developers
dispatch2,https://github.com/madsmtm/objc2,Zlib OR Apache-2.0 OR MIT,"Mads Marquart <mads@marquart.dk>, Mary <mary@mary.zone>"
displaydoc,https://github.com/yaahc/displaydoc,MIT OR Apache-2.0,Jane Lusby <jlusby@yaah.dev>
dlmalloc,https://github.com/alexcrichton/dlmalloc-rs,MIT OR Apache-2.0,Alex Crichton <alex@alexcrichton.com>
dyn-clone,https://github.com/dtolnay/dyn-clone,MIT OR Apache-2.0,David Tolnay <dtolnay@gmail.com>
either,https://github.com/rayon-rs/either,MIT OR Apache-2.0,bluss
encoding_rs,https://github.com/hsivonen/encoding_rs,(Apache-2.0 OR MIT) AND BSD-3-Clause,Henri Sivonen <hsivonen@hsivonen.fi>
Expand Down Expand Up @@ -221,6 +222,7 @@ lazy_static,https://github.com/rust-lang-nursery/lazy-static.rs,MIT OR Apache-2.
libc,https://github.com/rust-lang/libc,MIT OR Apache-2.0,The Rust Project Developers
libloading,https://github.com/nagisa/rust_libloading,ISC,Simonas Kazlauskas <libloading@kazlauskas.me>
libredox,https://gitlab.redox-os.org/redox-os/libredox,MIT,4lDO2 <4lDO2@protonmail.com>
libyaml-rs,https://github.com/yaml/libyaml-rs,MIT,"David Tolnay <dtolnay@gmail.com>, YAML Organization <noreply@yaml.org>"
libz-rs-sys,https://github.com/trifectatechfoundation/zlib-rs,Zlib,The libz-rs-sys Authors
link-cplusplus,https://github.com/dtolnay/link-cplusplus,MIT OR Apache-2.0,David Tolnay <dtolnay@gmail.com>
linux-raw-sys,https://github.com/sunfishcode/linux-raw-sys,Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT,Dan Gohman <dev@sunfishcode.online>
Expand Down Expand Up @@ -344,6 +346,8 @@ rustc-demangle,https://github.com/rust-lang/rustc-demangle,MIT OR Apache-2.0,Ale
rustc-hash,https://github.com/rust-lang-nursery/rustc-hash,Apache-2.0 OR MIT,The Rust Project Developers
rustc-hash,https://github.com/rust-lang/rustc-hash,Apache-2.0 OR MIT,The Rust Project Developers
rustix,https://github.com/bytecodealliance/rustix,Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT,"Dan Gohman <dev@sunfishcode.online>, Jakub Konka <kubkon@jakubkonka.com>"
rustix-dlmalloc,https://github.com/sunfishcode/rustix-dlmalloc,MIT OR Apache-2.0,"Alex Crichton <alex@alexcrichton.com>, Dan Gohman <dev@sunfishcode.online>"
rustix-futex-sync,https://github.com/sunfishcode/rustix-futex-sync,Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT,Dan Gohman <dev@sunfishcode.online>
rustls,https://github.com/rustls/rustls,Apache-2.0 OR ISC OR MIT,The rustls Authors
rustls-native-certs,https://github.com/rustls/rustls-native-certs,Apache-2.0 OR ISC OR MIT,The rustls-native-certs Authors
rustls-pki-types,https://github.com/rustls/pki-types,MIT OR Apache-2.0,The rustls-pki-types Authors
Expand Down Expand Up @@ -380,7 +384,6 @@ serde_regex,https://github.com/tailhook/serde-regex,MIT OR Apache-2.0,paul@colom
serde_spanned,https://github.com/toml-rs/toml,MIT OR Apache-2.0,The serde_spanned Authors
serde_with,https://github.com/jonasbb/serde_with,MIT OR Apache-2.0,"Jonas Bushart, Marcin Kaźmierczak"
serde_with_macros,https://github.com/jonasbb/serde_with,MIT OR Apache-2.0,Jonas Bushart
serde_yaml,https://github.com/dtolnay/serde-yaml,MIT OR Apache-2.0,David Tolnay <dtolnay@gmail.com>
serial_test_derive,https://github.com/palfrey/serial_test,MIT,Tom Parker-Shemilt <palfrey@tevp.net>
sha1,https://github.com/RustCrypto/hashes,MIT OR Apache-2.0,RustCrypto Developers
sha2,https://github.com/RustCrypto/hashes,MIT OR Apache-2.0,RustCrypto Developers
Expand Down Expand Up @@ -466,7 +469,6 @@ unicase,https://github.com/seanmonstar/unicase,MIT OR Apache-2.0,Sean McArthur <
unicode-ident,https://github.com/dtolnay/unicode-ident,(MIT OR Apache-2.0) AND Unicode-DFS-2016,David Tolnay <dtolnay@gmail.com>
unicode-width,https://github.com/unicode-rs/unicode-width,MIT OR Apache-2.0,"kwantam <kwantam@gmail.com>, Manish Goregaokar <manishsmail@gmail.com>"
unicode-xid,https://github.com/unicode-rs/unicode-xid,MIT OR Apache-2.0,"erick.tryzelaar <erick.tryzelaar@gmail.com>, kwantam <kwantam@gmail.com>, Manish Goregaokar <manishsmail@gmail.com>"
unsafe-libyaml,https://github.com/dtolnay/unsafe-libyaml,MIT,David Tolnay <dtolnay@gmail.com>
untrusted,https://github.com/briansmith/untrusted,ISC,Brian Smith <brian@briansmith.org>
url,https://github.com/servo/rust-url,MIT OR Apache-2.0,The rust-url developers
urlencoding,https://github.com/kornelski/rust_urlencoding,MIT,"Kornel <kornel@geekhood.net>, Bertram Truong <b@bertramtruong.com>"
Expand Down Expand Up @@ -525,6 +527,7 @@ wit-bindgen-rt,https://github.com/bytecodealliance/wit-bindgen,Apache-2.0 WITH L
write16,https://github.com/hsivonen/write16,Apache-2.0 OR MIT,The write16 Authors
writeable,https://github.com/unicode-org/icu4x,Unicode-3.0,The ICU4X Project Developers
xattr,https://github.com/Stebalien/xattr,MIT OR Apache-2.0,Steven Allen <steven@stebalien.com>
yaml_serde,https://github.com/yaml/yaml-serde,MIT OR Apache-2.0,YAML Organization <noreply@yaml.org>
yansi,https://github.com/SergioBenitez/yansi,MIT OR Apache-2.0,Sergio Benitez <sb@sergio.bz>
yoke,https://github.com/unicode-org/icu4x,Unicode-3.0,Manish Goregaokar <manishsmail@gmail.com>
yoke-derive,https://github.com/unicode-org/icu4x,Unicode-3.0,Manish Goregaokar <manishsmail@gmail.com>
Expand Down
2 changes: 1 addition & 1 deletion datadog-ffe-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ build_common = { path = "../build-common" }
[dependencies]
anyhow = "1.0.93"
datadog-ffe = { path = "../datadog-ffe", version = "=1.0.0" }
libdd-common-ffi = { path = "../libdd-common-ffi", default-features = false }
libdd-common-ffi = { path = "../libdd-common-ffi", default-features = false, features = ["std"] }
function_name = "0.3.0"

[dev-dependencies]
2 changes: 1 addition & 1 deletion datadog-live-debugger-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ bench = false
[dependencies]
datadog-live-debugger = { path = "../datadog-live-debugger" }
libdd-common = { path = "../libdd-common" }
libdd-common-ffi = { path = "../libdd-common-ffi", default-features = false }
libdd-common-ffi = { path = "../libdd-common-ffi", default-features = false, features = ["std"] }
percent-encoding = "2.1"
uuid = { version = "1.7.0", features = ["v4"] }
serde_json = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion datadog-sidecar-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ datadog-sidecar = { path = "../datadog-sidecar" }
libdd-trace-utils = { path = "../libdd-trace-utils" }
datadog-ipc = { path = "../datadog-ipc" }
libdd-common = { path = "../libdd-common" }
libdd-common-ffi = { path = "../libdd-common-ffi", default-features = false }
libdd-common-ffi = { path = "../libdd-common-ffi", default-features = false, features = ["std"] }
libdd-telemetry-ffi = { path = "../libdd-telemetry-ffi", default-features = false }
datadog-remote-config = { path = "../datadog-remote-config" }
datadog-live-debugger = { path = "../datadog-live-debugger" }
Expand Down
2 changes: 1 addition & 1 deletion datadog-sidecar/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ nix = { version = "0.29", features = ["socket", "mman"] }
sendfd = { version = "0.4", features = ["tokio"] }

[target.'cfg(windows)'.dependencies]
libdd-common-ffi = { path = "../libdd-common-ffi", default-features = false }
libdd-common-ffi = { path = "../libdd-common-ffi", default-features = false, features = ["std"] }
libdd-crashtracker-ffi = { path = "../libdd-crashtracker-ffi", default-features = false, features = ["collector", "collector_windows"] }
winapi = { version = "0.3.9", features = ["securitybaseapi", "sddl", "winerror", "winbase"] }
windows-sys = { version = "0.52.0", features = ["Win32_System_SystemInformation"] }
Expand Down
17 changes: 9 additions & 8 deletions libdd-common-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@ publish = false
bench =false

[features]
default = ["cbindgen"]
cbindgen = ["build_common/cbindgen"]
default = ["std", "cbindgen"]
std = ["dep:anyhow", "dep:chrono", "dep:crossbeam-queue", "dep:hyper", "dep:serde", "dep:libdd-common"]
cbindgen = ["std", "build_common/cbindgen"]

[build-dependencies]
build_common = { path = "../build-common" }

[dependencies]
anyhow = "1.0"
chrono = { version = "0.4.38", features = ["std"] }
crossbeam-queue = "0.3.11"
libdd-common = { path = "../libdd-common" }
hyper = { workspace = true}
serde = "1.0"
anyhow = { version = "1.0", optional = true }
chrono = { version = "0.4.38", features = ["std"], optional = true }
crossbeam-queue = { version = "0.3.11", optional = true }
libdd-common = { path = "../libdd-common", optional = true }
hyper = { workspace = true, optional = true }
serde = { version = "1.0", optional = true }

[dev-dependencies]
bolero = "0.13"
Expand Down
30 changes: 16 additions & 14 deletions libdd-common-ffi/src/cstr.rs
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
// Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/
// SPDX-License-Identifier: Apache-2.0

use alloc::ffi;
use alloc::vec::Vec;
use core::fmt;
use std::{
use core::{
ffi::c_char,
marker::PhantomData,
mem::{self, ManuallyDrop},
ptr::{self, NonNull},
};

/// Ffi safe type representing a borrowed null-terminated C array
/// Equivalent to a std::ffi::CStr
/// Equivalent to a core::ffi::CStr
#[repr(C)]
pub struct CStr<'a> {
/// Null terminated char array
ptr: ptr::NonNull<c_char>,
/// Length of the array, not counting the null-terminator
length: usize,
_lifetime_marker: std::marker::PhantomData<&'a c_char>,
_lifetime_marker: PhantomData<&'a c_char>,
}

impl<'a> CStr<'a> {
pub fn from_std(s: &'a std::ffi::CStr) -> Self {
pub fn from_std(s: &'a core::ffi::CStr) -> Self {
Self {
ptr: unsafe { ptr::NonNull::new_unchecked(s.as_ptr().cast_mut()) },
length: s.to_bytes().len(),
_lifetime_marker: std::marker::PhantomData,
_lifetime_marker: PhantomData,
}
}

pub fn into_std(&self) -> &'a std::ffi::CStr {
pub fn into_std(&self) -> &'a core::ffi::CStr {
unsafe {
std::ffi::CStr::from_bytes_with_nul_unchecked(std::slice::from_raw_parts(
core::ffi::CStr::from_bytes_with_nul_unchecked(core::slice::from_raw_parts(
self.ptr.as_ptr().cast_const().cast(),
self.length + 1,
))
Expand All @@ -40,7 +42,7 @@ impl<'a> CStr<'a> {
}

/// Ffi safe type representing an owned null-terminated C array
/// Equivalent to a std::ffi::CString
/// Equivalent to an ffi::CString
#[repr(C)]
pub struct CString {
/// Null terminated char array
Expand All @@ -56,8 +58,8 @@ impl fmt::Debug for CString {
}

impl CString {
pub fn new<T: Into<Vec<u8>>>(t: T) -> Result<Self, std::ffi::NulError> {
Ok(Self::from_std(std::ffi::CString::new(t)?))
pub fn new<T: Into<Vec<u8>>>(t: T) -> Result<Self, ffi::NulError> {
Ok(Self::from_std(ffi::CString::new(t)?))
}

/// Creates a new `CString` from the given input, or returns an empty `CString`
Expand Down Expand Up @@ -99,18 +101,18 @@ impl CString {
}
}

pub fn from_std(s: std::ffi::CString) -> Self {
pub fn from_std(s: ffi::CString) -> Self {
let length = s.to_bytes().len();
Self {
ptr: unsafe { ptr::NonNull::new_unchecked(s.into_raw()) },
length,
}
}

pub fn into_std(self) -> std::ffi::CString {
pub fn into_std(self) -> ffi::CString {
let s = ManuallyDrop::new(self);
unsafe {
std::ffi::CString::from_vec_with_nul_unchecked(Vec::from_raw_parts(
ffi::CString::from_vec_with_nul_unchecked(Vec::from_raw_parts(
s.ptr.as_ptr().cast(),
s.length + 1, // +1 for the null terminator
s.length + 1, // +1 for the null terminator
Expand All @@ -123,7 +125,7 @@ impl Drop for CString {
fn drop(&mut self) {
let ptr = mem::replace(&mut self.ptr, NonNull::dangling());
drop(unsafe {
std::ffi::CString::from_vec_with_nul_unchecked(Vec::from_raw_parts(
ffi::CString::from_vec_with_nul_unchecked(Vec::from_raw_parts(
ptr.as_ptr().cast(),
self.length + 1,
self.length + 1,
Expand Down
Loading
Loading