Skip to content
This repository was archived by the owner on Nov 26, 2025. It is now read-only.
This repository was archived by the owner on Nov 26, 2025. It is now read-only.

Proposal: Integrate arceos_posix_api into this repository to enhance maintainability #16

@AsakuraMizu

Description

@AsakuraMizu

Background

I was trying to implement a few system calls and found that we now have a messy split between starry-next and arceos_posix_api.

Let's say, ppoll. I wanted to implement it in arceos_posix_api at first, because this crate already has similar functions such as select and epoll. But then I noticed that ppoll also needs to handle signals. Although we don't have a signal mechanism now, if we are going to implement it in starry-next in the future, then ppoll is best implemented in starry-next (or even only here). Also note that since select is implemented in arceos_posix_api, it would be tricky to implement pselect later.

Proposal

Currently, we have some syscalls that are proxied to arceos_posix_api functions, mainly file system related parts. This causes some maintenance inconveniences, for example, some syscalls depend on our TaskExt, others require the internal structure of arceos_posix_api, and some may require both. As a result, when implementing new features, you may need to modify both upstream and downstream repositories simultaneously.

My proposal is that we no longer rely on the arceos_posix_api crate, and maintain a separate syscall interface crate in this repository. This does not mean a complete rewrite, the existing code in arceos_posix_api can be ported and improved, and then other functions implemented for the monolithic kernel can be added.

Benefits

  • More convenient development - Single source for syscall implementations, developing in a single repository
  • Reduce duplication of functionality - We now repeat the same interface as arceos_posix_api in starry-next.
  • More secure - Although we have UserPtr to check the safety of the user address, the raw pointer is still passed to the implementation instead of the safe Rust-style wrapper. And for the case of writev with nested pointers, we currently do not check it.

Implementation details

No changes to upstream repositories are required. We can divide starry-next into the following three crates:

  • starry-core: mainly contains the current mm.rs, ptr.rs and task.rs, providing core functionality in the monolithic kernel
  • starry-api: the current syscall_imp module merged with arceos_posix_api, where arceos_posix_api can enjoy the convenience brought by syscall_instrument or UserPtr when porting
  • starry (already exists): entry main.rs and syscall handler handle_syscall

Thoughts

This is just a preliminary idea and may have some imperfections, so discussion and suggestions are welcome. Even if this proposal is not adopted, I still strongly recommend that we at least solve this issue to reduce the pain of future development.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions