Skip to content
This repository was archived by the owner on Nov 26, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 14 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
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,14 @@ apps/*/build/
**/target/
**/Cargo.lock
!/vendor/**/Cargo.lock
/.axconfig.*
/.axconfig.*
/sdcard-la.img
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DONOT NEED TO add these items

/sdcard-rv.img
/sdcard-x86_64.img
/sdcard-aarch64.img
/riscv64-linux-musl-cross
/x86_64-linux-musl-cross
/aarch64-linux-musl-cross
/gcc-13.2.0-loongarch64-linux-gnu
/musl-loongarch64-1.2.2
/apps/tests
1 change: 1 addition & 0 deletions apps/junior/testcase_list
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
brk
chdir
clone
execve
10 changes: 10 additions & 0 deletions apps/oscomp/judge_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,17 @@ def get_runner(name):
target_testcases = [
"test_brk",
"test_chdir",
"test_clone",
"test_getpid",
"test_getppid",
"test_exit",
"test_wait",
"test_execve",
"test_waitpid",
"test_yield",
"test_gettimeofday",
"test_sleep",
"test_times"
"test_pipe",
"test_close",
"test_dup",
Expand Down
6 changes: 5 additions & 1 deletion apps/oscomp/judge_libctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
import sys

# TODO: Add more commands to test here
libctest_baseline = """"""
libctest_baseline = """
========== START entry-static.exe argv ==========
Pass!
========== END entry-static.exe argv ==========
"""

def parse_libctest(output):
ans = {}
Expand Down
2 changes: 1 addition & 1 deletion apps/oscomp/testcase_list
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/musl/basic/waitpid
/musl/runtest.exe -w entry-static.exe argv
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DONOT need to modify it

10 changes: 10 additions & 0 deletions scripts/oscomp_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,17 @@ fi
basic_testlist=(
"/$LIBC/basic/brk"
"/$LIBC/basic/chdir"
"/$LIBC/basic/clone"
"/$LIBC/basic/getpid"
"/$LIBC/basic/getppid"
"/$LIBC/basic/exit"
"/$LIBC/basic/wait"
"/$LIBC/basic/execve"
"/$LIBC/basic/waitpid"
"/$LIBC/basic/yield"
"/$LIBC/basic/gettimeofday"
"/$LIBC/basic/sleep"
"/$LIBC/basic/times"
"/$LIBC/basic/pipe"
"/$LIBC/basic/close"
"/$LIBC/basic/dup"
Expand Down
3 changes: 3 additions & 0 deletions src/syscall_imp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ fn handle_syscall(tf: &TrapFrame, syscall_num: usize) -> isize {
),
Sysno::ioctl => sys_ioctl(tf.arg0() as _, tf.arg1() as _, tf.arg2().into()),
Sysno::writev => sys_writev(tf.arg0() as _, tf.arg1().into(), tf.arg2() as _),
Sysno::prlimit64 => Ok(0),
Sysno::rt_sigtimedwait => Ok(0),
Sysno::sched_yield => sys_sched_yield(),
Sysno::nanosleep => sys_nanosleep(tf.arg0().into(), tf.arg1().into()),
Sysno::getpid => sys_getpid(),
Expand Down Expand Up @@ -150,6 +152,7 @@ fn handle_syscall(tf: &TrapFrame, syscall_num: usize) -> isize {
Sysno::clock_gettime => sys_clock_gettime(tf.arg0() as _, tf.arg1().into()),
Sysno::exit_group => sys_exit_group(tf.arg0() as _),
Sysno::getuid => sys_getuid(),
Sysno::gettid => sys_gettid(),
Sysno::rt_sigprocmask => sys_rt_sigprocmask(
tf.arg0() as _,
tf.arg1().into(),
Expand Down
5 changes: 5 additions & 0 deletions src/syscall_imp/task/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ pub fn sys_getppid() -> LinuxResult<isize> {
Ok(axtask::current().task_ext().get_parent() as _)
}

#[apply(syscall_instrument)]
pub fn sys_gettid() -> LinuxResult<isize> {
Ok(current().id().as_u64() as _)
}

pub fn sys_exit(status: i32) -> ! {
let curr = current();
let clear_child_tid = curr.task_ext().clear_child_tid() as *mut i32;
Expand Down
Loading