Skip to content
This repository was archived by the owner on Nov 26, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all 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
14 changes: 12 additions & 2 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ axconfig = { git = "https://github.com/oscomp/arceos.git" }
axfs = { git = "https://github.com/oscomp/arceos.git" }
axhal = { git = "https://github.com/oscomp/arceos.git", features = ["uspace"] }
axlog = { git = "https://github.com/oscomp/arceos.git" }
axmm = { git = "https://github.com/oscomp/arceos.git" }
axmm = { git = "https://github.com/oscomp/arceos.git", features = ["cow"] }
axnet = { git = "https://github.com/oscomp/arceos.git" }
axns = { git = "https://github.com/oscomp/arceos.git", features = [
"thread-local",
Expand Down Expand Up @@ -90,5 +90,5 @@ shlex = { version = "1.3.0", default-features = false }
syscalls = { git = "https://github.com/jasonwhite/syscalls.git", rev = "92624de", default-features = false }

[patch.crates-io]
page_table_multiarch = { git = "https://github.com/Mivik/page_table_multiarch.git", rev = "19ededd" }
page_table_entry = { git = "https://github.com/Mivik/page_table_multiarch.git", rev = "19ededd" }
page_table_multiarch = { git = "https://github.com/Mivik/page_table_multiarch.git", rev = "5c222f2" }
page_table_entry = { git = "https://github.com/Mivik/page_table_multiarch.git", rev = "5c222f2" }
51 changes: 51 additions & 0 deletions apps/libc/c/forkcow/forkcow.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>
#include <sys/mman.h>

#define N 150
#define LEN (1024 * 1024)

void forktest(void) {
int n, pid;

printf("fork test\n");

char *ptr = mmap(NULL, LEN * sizeof(char), PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);

for (n = 0; n < LEN; n++) {
*(ptr + n) = 'a';
}

for (n = 0; n < N; n++) {
pid = fork();
if (pid < 0)
break;
if (pid == 0)
exit(0);
}

if (n == N) {
printf("fork test OK\n");
exit(0);
}

for (; n > 0; n--) {
if (wait(0) < 0) {
printf("wait stopped early\n");
exit(1);
}
}

if (wait(0) != -1) {
printf("wait got too many\n");
exit(1);
}
}

int main(void) {
forktest();
exit(1);
}
3 changes: 3 additions & 0 deletions apps/libc/expect_off.out
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ test_sigwait ok3
test_sigsuspend ok1
test_sigsuspend ok2
test_sigsuspend ok3

fork test
fork test OK
1 change: 1 addition & 0 deletions apps/libc/testcase_list
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
helloworld_c
sleep_c
signal_c
forkcow_c
mmap_c
2 changes: 1 addition & 1 deletion scripts/get_deps.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

AX_ROOT=.arceos
COMMIT=54d5739
COMMIT=a634925
test ! -d "$AX_ROOT" && echo "Cloning repositories ..." || true
test ! -d "$AX_ROOT" && git clone https://github.com/oscomp/arceos "$AX_ROOT" || true

Expand Down
Loading