Skip to content

Commit

Permalink
add loopback
Browse files Browse the repository at this point in the history
  • Loading branch information
lhw committed Nov 24, 2024
1 parent 2d79877 commit 6184915
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion api/ruxos_posix_api/src/imp/pipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* See the Mulan PSL v2 for more details.
*/

use alloc::sync::{Weak, Arc};
use alloc::sync::{Arc, Weak};
use core::ffi::c_int;

use axerrno::{LinuxError, LinuxResult};
Expand Down
2 changes: 1 addition & 1 deletion api/ruxos_posix_api/src/imp/pthread/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ pub fn sys_exit_group(status: c_int) -> ! {
debug!("sys_exit_group <= status: {:#?}", status);

// TODO: exit all threads, send signal to all threads

// drop all file opened by current task
current().fs.lock().as_mut().unwrap().close_all_files();

Expand Down
4 changes: 2 additions & 2 deletions api/ruxos_posix_api/src/imp/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub fn sys_wait4(
// lower 8 bits of exit_code is the signal number, while upper 8 bits of exit_code is the exit status
// according to "bits/waitstatus.h" in glibc source code.
// TODO: add signal number to wstatus
wstatus.write(task.exit_code()<<8);
wstatus.write(task.exit_code() << 8);
}
process_map.remove(&(pid as u64));
return pid;
Expand Down Expand Up @@ -108,7 +108,7 @@ pub fn sys_wait4(
// lower 8 bits of exit_code is the signal number, while upper 8 bits of exit_code is the exit status
// according to "bits/waitstatus.h" in glibc source code.
// TODO: add signal number to wstatus
wstatus.write(task.exit_code()<<8);
wstatus.write(task.exit_code() << 8);
}
let _ = to_remove.insert(*child_pid);
break;
Expand Down
4 changes: 3 additions & 1 deletion api/ruxos_posix_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ pub use imp::pthread::sys_clone;
#[cfg(all(feature = "multitask", feature = "musl"))]
pub use imp::pthread::sys_set_tid_address;
#[cfg(feature = "multitask")]
pub use imp::pthread::{sys_pthread_create, sys_pthread_exit, sys_exit_group, sys_pthread_join, sys_pthread_self};
pub use imp::pthread::{
sys_exit_group, sys_pthread_create, sys_pthread_exit, sys_pthread_join, sys_pthread_self,
};

#[cfg(feature = "fs")]
pub use imp::execve::sys_execve;
2 changes: 1 addition & 1 deletion modules/ruxhal/src/arch/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ pub unsafe fn init_syscall_entry() {
.has_syscall_sysret());

x86_64::registers::model_specific::LStar::write(x86_64::VirtAddr::new(
x86_syscall_entry as usize,
x86_syscall_entry as u64,
));
x86_64::registers::model_specific::Efer::update(|efer| {
efer.insert(
Expand Down
10 changes: 6 additions & 4 deletions modules/ruxtask/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,14 @@ pub fn fork_task() -> Option<AxTaskRef> {
// Judge whether the parent process is blocked, if yes, add it to the blocking queue of the child process
if current().id().as_u64() == current_id {
RUN_QUEUE.lock().add_task(children_process.clone());

return Some(children_process);
}

unsafe {RUN_QUEUE.force_unlock(); }


unsafe {
RUN_QUEUE.force_unlock();
}

// should not drop the children_process here, because it will be taken in the parent process
// and dropped in the parent process
let _ = ManuallyDrop::new(children_process);
Expand Down
12 changes: 5 additions & 7 deletions modules/ruxtask/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -629,14 +629,12 @@ impl TaskInner {
let tls = VirtAddr::from(t.tls.tls_ptr() as usize);
#[cfg(not(feature = "tls"))]
let tls = VirtAddr::from(0);

debug!("new idle task: {}", t.id_name());
t.ctx.get_mut().init(
task_entry as usize,
idle_kstack.top(),
tls,
);

t.ctx
.get_mut()
.init(task_entry as usize, idle_kstack.top(), tls);

let task_ref = Arc::new(AxTask::new(t));

task_ref
Expand Down
4 changes: 1 addition & 3 deletions ulib/ruxmusl/src/aarch64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,7 @@ pub fn syscall(syscall_id: SyscallId, args: [usize; 6]) -> isize {
SyscallId::EXIT => {
ruxos_posix_api::sys_pthread_exit(args[0] as *mut core::ffi::c_void) as _
}
SyscallId::EXIT_GROUP => {
ruxos_posix_api::sys_exit_group(args[0] as c_int)
}
SyscallId::EXIT_GROUP => ruxos_posix_api::sys_exit_group(args[0] as c_int),
#[cfg(feature = "multitask")]
SyscallId::SET_TID_ADDRESS => ruxos_posix_api::sys_set_tid_address(args[0]) as _,
#[cfg(feature = "multitask")]
Expand Down

0 comments on commit 6184915

Please sign in to comment.