Conversation
|
Plz do not close and reopen one pr over and over again... 😢 |
Im SORRY. Some bugs fixed and I am adapting to the contribution process. Sorry teacher. |
I have tested the Asterinas testing program as per your request, and the main functional test results have been recorded in the discussion: https://github.com/orgs/Starry-OS/discussions/21 |
AsakuraMizu
left a comment
There was a problem hiding this comment.
Using traits is overkill. I prefer to use type conversion to achieve uniformity.
|
Sorry I forgot to commit my review 😢 |
|
|
||
| /// Structure passed to clone3() system call. | ||
| #[repr(C)] | ||
| #[derive(Debug, Clone, Copy, Default, bytemuck::Zeroable, bytemuck::AnyBitPattern)] |
There was a problem hiding this comment.
AnyBitPattern already implements Zeroable
| if flags.contains(CloneFlags::VFORK) && flags.contains(CloneFlags::THREAD) { | ||
| return Err(AxError::InvalidInput); | ||
| } | ||
| if *exit_signal >= 64 { |
There was a problem hiding this comment.
Should be > 64. Also use Signo::from_repr instead of this
| impl TryFrom<Clone3Args> for CloneArgs { | ||
| type Error = axerrno::AxError; | ||
|
|
||
| fn try_from(args: Clone3Args) -> AxResult<Self> { |
There was a problem hiding this comment.
EINVAL (clone3() only)
CLONE_THREAD or CLONE_PARENT was specified in the flags mask, but a signal was specified in exit_signal.
There was a problem hiding this comment.
EINVAL (clone3() only)
CLONE_DETACHED was specified in the flags mask.
| proc_data | ||
| }; | ||
| let thr = Thread::new(tid, new_proc_data); | ||
| if flags.contains(CloneFlags::CHILD_CLEARTID) && child_tid != 0 { |
There was a problem hiding this comment.
child_tid != 0
This check doesn't exist in the original version, why enforce it?
|
This is already lowkey outdated. Could you rebase it over the main branch? |
Description
This PR adds initial support for the
clone3system call in StarryOS.The implementation introduces the basic
clone3syscall path and supportsa commonly used subset of
clone3flags, enabling user programs and teststo create new processes using the modern
clone3interface.This work lays the groundwork for improving Linux compatibility and enables
future support for thread creation and synchronization primitives built on
top of
clone3(e.g., futex-based threading).Implementation
clone3syscall handler and integrated it into the syscalldispatch framework.
clone3arguments and flags,including:
exit_signalCLONE_PARENT_SETTIDCHILD_CLEARTIDexpected Linux error semantics where possible.
Some Linux features related to
clone3(e.g., session/process group semanticsand
PR_SET_CHILD_SUBREAPER) are not yet supported in StarryOS and aredocumented as known limitations.
Additional Context
clone3test programsand passes basic functionality tests.
do not block the correctness of this initial
clone3support.focused on establishing a correct and minimal clone3 syscall foundation.