Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
67 changes: 48 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,49 @@ env:
CARGO_TERM_COLOR: always

jobs:
lint:
name: Clippy + fmt
format:
name: fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt

- uses: Swatinem/rust-cache@v2
components: rustfmt

- name: Check formatting
run: cargo fmt --all -- --check

lint:
name: Clippy (${{ matrix.target }})
runs-on: ${{ matrix.runner }}

strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
target: i686-unknown-linux-gnu

steps:
- uses: actions/checkout@v6

- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
components: clippy

- uses: Swatinem/rust-cache@v2

- name: Clippy
run: cargo clippy --all --lib --tests --all-features -- -D warnings
run: |
cargo clippy \
--target ${{ matrix.target }} \
--all \
--lib \
--tests \
--all-features \
-- -D warnings

test:
name: Tests (${{ matrix.target }})
Expand All @@ -40,10 +66,6 @@ jobs:
include:
- runner: ubuntu-latest
target: i686-unknown-linux-gnu
- runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
- runner: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu

steps:
- uses: actions/checkout@v6
Expand Down Expand Up @@ -85,12 +107,6 @@ jobs:
- runner: ubuntu-latest
target: i686-unknown-linux-gnu

- runner: ubuntu-latest
target: x86_64-unknown-linux-gnu

- runner: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu

steps:
- uses: actions/checkout@v6
with:
Expand Down Expand Up @@ -146,14 +162,22 @@ jobs:
parallel-finished: true

miri:
name: Miri
runs-on: ubuntu-latest
name: Miri (${{ matrix.target }})
runs-on: ${{ matrix.runner }}

strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
target: i686-unknown-linux-gnu

steps:
- uses: actions/checkout@v6

- uses: dtolnay/rust-toolchain@nightly
with:
targets: ${{ matrix.target }}
components: miri

- uses: Swatinem/rust-cache@v2
Expand All @@ -162,4 +186,9 @@ jobs:
run: cargo +nightly miri setup

- name: Run Miri tests
run: MIRIFLAGS="-Zmiri-strict-provenance" cargo +nightly miri test --workspace --lib --tests
run: |
MIRIFLAGS="-Zmiri-strict-provenance" cargo +nightly miri test \
--target ${{ matrix.target }} \
--workspace \
--lib \
--tests
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ repository = "https://github.com/olukowski/celer"
readme = "README.md"

[workspace]
members = ["system/linux/syscalls"]
members = ["system/linux/ctypes", "system/linux/syscalls"]

[workspace.dependencies]
libc = "0.2.183"
celer_system_linux_ctypes = { path = "system/linux/ctypes", version = "0.1.0" }
celer_system_linux_syscalls = { path = "system/linux/syscalls", version = "0.1.0" }
8 changes: 8 additions & 0 deletions system/linux/ctypes/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "celer_system_linux_ctypes"
version = "0.1.0"
edition = "2024"
license = "MIT OR Apache-2.0"
description = "Linux C types for Celer"
repository = "https://github.com/olukowski/celer"
readme = "README.md"
3 changes: 3 additions & 0 deletions system/linux/ctypes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Celer System Linux C Types

This crate provides Linux C types for use with Celer.
56 changes: 56 additions & 0 deletions system/linux/ctypes/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#![no_std]
#![cfg(target_os = "linux")]
#![cfg(target_arch = "x86")]

use core::ffi::{
c_char, c_int, c_long, c_longlong, c_short, c_uchar, c_uint, c_ulong,
c_ulonglong, c_ushort, c_void,
};

/// Equivalent to the `ssize_t` type in C.
pub type SsizeT = isize;

/// Equivalent to the `size_t` type in C.
pub type SizeT = usize;

/// Equivalent to the `char` type in C.
pub type Char = c_char;

/// Equivalent to the `unsigned char` type in C.
pub type UnsignedChar = c_uchar;

/// Equivalent to the `short` type in C.
pub type Short = c_short;

/// Equivalent to the `unsigned short` type in C.
pub type UnsignedShort = c_ushort;

/// Equivalent to the `int` type in C.
pub type Int = c_int;

/// Equivalent to the `unsigned int` type in C.
pub type UnsignedInt = c_uint;

/// Equivalent to the `long` type in C.
pub type Long = c_long;

/// Equivalent to the `unsigned long` type in C.
pub type UnsignedLong = c_ulong;

/// Equivalent to the `long long` type in C.
pub type LongLong = c_longlong;

/// Equivalent to the `unsigned long long` type in C.
pub type UnsignedLongLong = c_ulonglong;

/// Equivalent to the `void` type in C.
pub type Void = c_void;

/// Equivalent to the `umode_t` type in the Linux kernel.
pub type UModeT = UnsignedShort;

/// Equivalent to the `off_t` type in the Linux kernel.
pub type OffT = Long;

/// Equivalent to the `pid_t` type in the Linux kernel.
pub type PidT = Int;
6 changes: 1 addition & 5 deletions system/linux/syscalls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ repository = "https://github.com/olukowski/celer"
readme = "README.md"

[dependencies]
libc.workspace = true

[[example]]
name = "hello"
test = false
celer_system_linux_ctypes.workspace = true

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage,coverage_nightly)'] }
2 changes: 1 addition & 1 deletion system/linux/syscalls/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Celer System Linux Syscalls

Very thin wrappers around Linux syscalls.
Currently only supports aarch64 and x86_64.
Currently supports x86.
26 changes: 0 additions & 26 deletions system/linux/syscalls/examples/hello.rs

This file was deleted.

Loading