#libc #linux

nightly no-std c-scape

A libc bottom-half implementation in Rust

89 releases (20 breaking)

new 0.20.2 Oct 20, 2024
0.19.2 Oct 9, 2024
0.16.1 May 22, 2024
0.15.41 Feb 29, 2024
0.3.0 Nov 18, 2021

#53 in No standard library

Download history 31/week @ 2024-07-05 11/week @ 2024-07-12 5/week @ 2024-07-19 613/week @ 2024-07-26 88/week @ 2024-08-02 18/week @ 2024-08-09 133/week @ 2024-08-16 63/week @ 2024-08-23 29/week @ 2024-08-30 8/week @ 2024-09-06 14/week @ 2024-09-13 60/week @ 2024-09-20 212/week @ 2024-09-27 1069/week @ 2024-10-04 577/week @ 2024-10-11 268/week @ 2024-10-18

2,148 downloads per month
Used in 6 crates (via c-gull)

Apache-2.0…

570KB
16K SLoC

Contains (static library, 1KB) empty/riscv64/libxnet.a, (static library, 1KB) empty/aarch64/libc.a, (static library, 1KB) empty/aarch64/libcrypt.a, (static library, 1KB) empty/aarch64/libdl.a, (static library, 1KB) empty/aarch64/libgcc.a, (static library, 1KB) empty/aarch64/libgcc_s.a and 54 more.

c-scape

A layer underneath c-gull

Github Actions CI Status zulip chat crates.io page docs.rs docs

c-scape is a layer underneath c-gull. It provides a subset of libc features, containing only features that don't require Rust's std to implement. This allows it to be used by std itself.

This is currently highly experimental, incomplete, and some things aren't optimized. And it depends on Nightly Rust.

c-scape's two modes

Similar to c-gull, c-scape has "take-charge" and "coexist-with-libc" modes. One of these must be enabled.

In "take-charge" mode, c-scape takes charge of the process, handling program startup (via Origin) providing malloc (via c-scape), and other things. This requires some additional setup; see the c-scape-example example crate for more details.

In "coexist-with-libc" mode, c-scape can be used as a drop-in (partial) libc replacement. To use it, just change your typical libc dependency in Cargo.toml to this:

libc = { version = "<c-scape version>", package = "c-scape", features = ["coexist-with-libc"] }

Dependencies

~11–20MB
~368K SLoC