Skip to content

Commit

Permalink
remove ruxlibc from ulibc.
Browse files Browse the repository at this point in the history
  • Loading branch information
ken4647 committed Jan 13, 2025
1 parent 92c63a9 commit 4b5e851
Show file tree
Hide file tree
Showing 160 changed files with 50 additions and 10,429 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,12 @@ jobs:
with:
arch: ${{ matrix.arch }}

# TODO: enable these tests after fixing the build errors
# - name: Build display/basic_painting
# run: make ARCH=${{ matrix.arch }} A=apps/display/basic_painting
# - name: Build display/draw_map
# run: make ARCH=${{ matrix.arch }} A=apps/display/draw_map
# - name: Build fs/shell
# run: make ARCH=${{ matrix.arch }} A=apps/fs/shell
- name: Build display/basic_painting
run: make ARCH=${{ matrix.arch }} A=apps/display/basic_painting
- name: Build display/draw_map
run: make ARCH=${{ matrix.arch }} A=apps/display/draw_map
- name: Build fs/shell
run: make ARCH=${{ matrix.arch }} A=apps/fs/shell

- name: Build c/helloworld
run: make ARCH=${{ matrix.arch }} A=apps/c/helloworld
Expand Down
13 changes: 2 additions & 11 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ members = [
"api/ruxos_posix_api",

"ulib/axstd",
"ulib/ruxlibc",
"ulib/ruxmusl",

"apps/display/basic_painting",
Expand Down
9 changes: 1 addition & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,6 @@ doc_check_missing:
fmt:
cargo fmt --all

fmt_c:
@clang-format --style=file -i $(shell find ulib/ruxlibc -iname '*.c' -o -iname '*.h')

test:
$(call app_test)

Expand All @@ -273,13 +270,9 @@ clean: clean_c clean_musl
rm -rf $(APP)/*.bin $(APP)/*.elf
cargo clean

clean_c::
rm -rf ulib/ruxlibc/build_*
rm -rf $(app-objs)

clean_musl:
rm -rf ulib/ruxmusl/build_*
rm -rf ulib/ruxmusl/install

.PHONY: all build disasm run justrun debug clippy fmt fmt_c test test_no_fail_fast clean clean_c\
.PHONY: all build disasm run justrun debug clippy fmt fmt_c test test_no_fail_fast clean \
clean_musl doc disk_image debug_no_attach prebuild _force
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ The currently supported applications and programming languages, as well as their

| Language | Description |
|- | - |
| C | Run C apps by RuxOS ruxlibc or standard musl libc supported by ruxmusl. Evaluated by libc-bench. |
| C | Run C apps by standard musl libc supported by ruxmusl. Evaluated by libc-bench. |
| C++ | Run C++ apps by c++ static library provided by musl libc. Passed c++ benchmark. Evaluated by c++ benchmark. |
| [Perl](https://github.com/syswonder/rux-perl) | Run Perl standard library by musl libc. Evaluated by Perl benchmark. |
| [Python](https://github.com/syswonder/rux-python3) | Run Python apps by dynamically loading Python modules. Evaluated by Python benchmark. |
Expand Down
2 changes: 2 additions & 0 deletions api/arceos_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ myfs = ["ruxfeat/myfs"]
dummy-if-not-enabled = []

[dependencies]
crate_interface = "0.1.1"
ruxfeat = { path = "../ruxfeat" }
ruxruntime = { path = "../../modules/ruxruntime" }
ruxconfig = { path = "../../modules/ruxconfig" }
ruxmm = {path = "../../modules/ruxmm"}
axlog = { path = "../../modules/axlog" }
axio = { path = "../../crates/axio" }
axerrno = { path = "../../crates/axerrno" }
Expand Down
2 changes: 2 additions & 0 deletions api/arceos_api/src/imp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

mod mem;
mod task;
#[cfg(feature = "paging")]
mod trap;

cfg_fs! {
mod fs;
Expand Down
15 changes: 8 additions & 7 deletions ulib/ruxlibc/src/utils.rs → api/arceos_api/src/imp/trap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
* See the Mulan PSL v2 for more details.
*/

use core::ffi::c_int;
use ruxhal::trap::{PageFaultCause, TrapHandler};

pub fn e(ret: c_int) -> c_int {
if ret < 0 {
crate::errno::set_errno(ret.abs());
-1
} else {
ret as _
struct TrapHandlerImpl;

#[crate_interface::impl_interface]
impl TrapHandler for TrapHandlerImpl {
fn handle_page_fault(vaddr: usize, cause: PageFaultCause) -> bool {
// TODO: handle page fault
panic!("Page fault at {:#x} with cause {:?}.", vaddr, cause);
}
}
6 changes: 3 additions & 3 deletions api/ruxos_posix_api/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ typedef struct {{

let mut builder = bindgen::Builder::default()
.header(in_file)
.clang_arg("-I./../../ulib/ruxlibc/include")
.clang_arg("-I./../../ulib/include")
.parse_callbacks(Box::new(MyCallbacks))
.derive_default(true)
.size_t_is_usize(false)
Expand All @@ -167,7 +167,7 @@ typedef struct {{
.expect("Couldn't write bindings!");
}

gen_pthread_mutex("../../ulib/ruxlibc/include/ax_pthread_mutex.h").unwrap();
gen_pthread_cond("../../ulib/ruxlibc/include/ax_pthread_cond.h").unwrap();
gen_pthread_mutex("../../ulib/include/ax_pthread_mutex.h").unwrap();
gen_pthread_cond("../../ulib/include/ax_pthread_cond.h").unwrap();
gen_c_to_rust_bindings("ctypes.h", "src/ctypes_gen.rs");
}
4 changes: 2 additions & 2 deletions modules/ruxruntime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ smp = ["ruxhal/smp"]
irq = ["ruxhal/irq", "ruxtask?/irq", "percpu", "kernel_guard"]
tls = ["ruxhal/tls", "ruxtask?/tls"]
alloc = ["axalloc", "dtb"]
paging = ["ruxhal/paging", "ruxmm/paging", "lazy_init", "ruxmm", "ruxtask/paging"]
paging = ["ruxhal/paging", "ruxmm/paging", "lazy_init", "ruxtask/paging"]
rtc = ["ruxhal/rtc"]
virtio_console = []

Expand Down Expand Up @@ -51,7 +51,7 @@ rux9p = { path = "../rux9p", optional = true }
ruxnet = { path = "../ruxnet", optional = true }
ruxdisplay = { path = "../ruxdisplay", optional = true }
ruxtask = { path = "../ruxtask", optional = true }
ruxmm = { path = "../ruxmm", optional = true }
ruxmm = { path = "../ruxmm" }
axsync = { path = "../axsync", optional = true }
ruxfutex = { path = "../ruxfutex", optional = true }
ruxrand = { path = "../ruxrand", optional = true }
Expand Down
1 change: 1 addition & 0 deletions modules/ruxtask/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ impl TaskInner {
///
/// And there is no need to set the `entry`, `kstack` or `tls` fields, as
/// they will be filled automatically when the task is switches out.
#[allow(unused_mut)]
pub(crate) fn new_init(name: String) -> AxTaskRef {
let mut t: TaskInner = Self {
parent_process: None,
Expand Down
6 changes: 1 addition & 5 deletions scripts/make/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ ifeq ($(APP_TYPE), rust)
$(call cargo_build,--manifest-path $(APP)/Cargo.toml,$(RUX_FEAT) $(LIB_FEAT) $(APP_FEAT))
@cp $(rust_elf) $(OUT_ELF)
else ifeq ($(APP_TYPE), c)
ifeq ($(MUSL), y)
$(call cargo_build,-p ruxmusl,$(RUX_FEAT) $(LIB_FEAT))
else
$(call cargo_build,-p ruxlibc,$(RUX_FEAT) $(LIB_FEAT))
endif
$(call cargo_build,-p ruxmusl,$(RUX_FEAT) $(LIB_FEAT))
endif

$(OUT_DIR):
Expand Down
4 changes: 2 additions & 2 deletions scripts/make/build_c.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
rust_lib_name := ruxlibc
rust_lib_name := ruxmusl
rust_lib := target/$(TARGET)/$(MODE)/lib$(rust_lib_name).a

ulib_dir := ulib/ruxlibc
ulib_dir := ulib/ruxmusl
src_dir := $(ulib_dir)/c
obj_dir := $(ulib_dir)/build_$(ARCH)
inc_dir := $(ulib_dir)/include
Expand Down
2 changes: 1 addition & 1 deletion scripts/make/cargo.mk
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ endef
all_packages := \
$(shell ls $(CURDIR)/crates) \
$(shell ls $(CURDIR)/modules) \
ruxfeat arceos_api axstd ruxlibc ruxmusl
ruxfeat arceos_api axstd ruxmusl

define cargo_doc
$(call run_cmd,cargo doc,--no-deps --all-features --workspace --exclude "arceos-*" --exclude "ruxos-*" --exclude "ruxos-*" $(verbose))
Expand Down
10 changes: 3 additions & 7 deletions scripts/make/features.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,17 @@
# Inputs:
# - `FEATURES`: a list of features to be enabled split by spaces or commas.
# The features can be selected from the crate `ruxfeat` or the user library
# (crate `axstd` or `ruxlibc`).
# (crate `axstd` or `ruxmusl`).
# - `APP_FEATURES`: a list of features to be enabled for the Rust app.
#
# Outputs:
# - `RUX_FEAT`: features to be enabled for Ruxos modules (crate `ruxfeat`).
# - `LIB_FEAT`: features to be enabled for the user library (crate `axstd`, `ruxlibc`, `ruxmusl`).
# - `LIB_FEAT`: features to be enabled for the user library (crate `axstd`, `ruxmusl`, `ruxmusl`).
# - `APP_FEAT`: features to be enabled for the Rust app.

ifeq ($(APP_TYPE),c)
ax_feat_prefix := ruxfeat/
ifeq ($(MUSL), y)
lib_feat_prefix := ruxmusl/
else
lib_feat_prefix := ruxlibc/
endif
lib_feat_prefix := ruxmusl/
lib_features := fp_simd alloc irq sched_rr paging multitask fs net fd pipe select poll epoll random-hw signal
else
# TODO: it's better to use `ruxfeat/` as `ax_feat_prefix`, but all apps need to have `ruxfeat` as a dependency
Expand Down
2 changes: 1 addition & 1 deletion ulib/axstd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ alloc = ["arceos_api/alloc", "ruxfeat/alloc", "axio/alloc"]
alloc-tlsf = ["ruxfeat/alloc-tlsf"]
alloc-slab = ["ruxfeat/alloc-slab"]
alloc-buddy = ["ruxfeat/alloc-buddy"]
paging = ["ruxfeat/paging"]
paging = ["ruxfeat/paging", "arceos_api/paging"]
tls = ["ruxfeat/tls"]

# Multi-threading and scheduler
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions ulib/include/ax_pthread_cond.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Generated by ruxos_posix_api/build.rs, DO NOT edit!

typedef struct {
long __l[5];
} pthread_cond_t;

8 changes: 8 additions & 0 deletions ulib/include/ax_pthread_mutex.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Generated by ruxos_posix_api/build.rs, DO NOT edit!

typedef struct {
long __l[6];
} pthread_mutex_t;

#define PTHREAD_MUTEX_INITIALIZER { .__l = {0, 8, 0, 0, 0, 0}}

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 0 additions & 4 deletions ulib/ruxlibc/.gitignore

This file was deleted.

67 changes: 0 additions & 67 deletions ulib/ruxlibc/Cargo.toml

This file was deleted.

33 changes: 0 additions & 33 deletions ulib/ruxlibc/build.rs

This file was deleted.

17 changes: 0 additions & 17 deletions ulib/ruxlibc/c/assert.c

This file was deleted.

Loading

0 comments on commit 4b5e851

Please sign in to comment.