data_type large_stringclasses 3
values | source large_stringclasses 29
values | code large_stringlengths 98 49.4M | filepath large_stringlengths 5 161 ⌀ | message large_stringclasses 234
values | commit large_stringclasses 234
values | subject large_stringclasses 418
values | critique large_stringlengths 101 1.26M ⌀ | metadata dict |
|---|---|---|---|---|---|---|---|---|
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <linux/vm_sockets.h>
#include <unistd.h>
#include <string.h>
#define PORT 4321
int main()
{
int sock, new_sock;
char *hello = "Hello from asterinas";
char buffer[1024] = { 0 };
struct sockaddr_vm serv_addr... | test/initramfs/src/apps/network/vsock/vsock_server.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#include "../common/test.h"
#include <unistd.h>
#include <sys/wait.h>
static pid_t current;
static pid_t child1, child2;
FN_SETUP(setpgrp)
{
CHECK(setpgid(0, 0));
}
END_SETUP()
FN_SETUP(spawn_child)
{
current = CHECK(getpid());
if ((child1 = CHECK(fork())) == 0) {
sleep(60... | test/initramfs/src/apps/process/group_session.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#include "../common/test.h"
#include <unistd.h>
#include <pty.h>
#include <sys/wait.h>
static pid_t sid, child;
static int master, slave;
FN_SETUP(openpty)
{
CHECK(openpty(&master, &slave, NULL, NULL, NULL));
}
END_SETUP()
FN_SETUP(run_in_new_session)
{
int status;
if (CHECK... | test/initramfs/src/apps/process/job_control.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#include "../common/test.h"
#include <unistd.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/poll.h>
#include <fcntl.h>
#include <signal.h>
static int child_pid;
static int pid_fd;
FN_SETUP(create_child)
{
child_pid = CHECK(fork());
if (ch... | test/initramfs/src/apps/process/pidfd.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <pthread.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/mman.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "../common/test.h"
st... | test/initramfs/src/apps/process/pidfd_getfd.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#include "../common/test.h"
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <signal.h>
#include <linux/wait.h>
#include <pthread.h>
#include <sys/mman.h>
#include <fcntl.h>
static pid_t pid;
static int status;
FN_SETUP(fork_child)
{
... | test/initramfs/src/apps/process/wait4.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#include <unistd.h>
int main()
{
alarm(3);
while (1) {
}
return 0;
} | test/initramfs/src/apps/process/alarm/alarm.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#define _GNU_SOURCE
#include <err.h>
#include <linux/sched.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/syscall.h>
#include <sys/wait.h>
static pid_t sys_clone3(struct clone_args *args)
{
return syscall(SYS_clone3, args, sizeof(struct clone_args));
}... | test/initramfs/src/apps/process/clone3/clone_exit_signal.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#define _GNU_SOURCE
#include "../../common/test.h"
#include <fcntl.h>
#include <sched.h>
#include <sys/wait.h>
#include <unistd.h>
static char child_stack[4096];
#define CHILD_STACK_TOP \
(child_stack + sizeof(child_stack) / sizeof(child_stack[0]))
static int fd1, fd2;
static ... | test/initramfs/src/apps/process/clone3/clone_files.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#define _GNU_SOURCE
#include <err.h>
#include <linux/sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/syscall.h>
#include <sys/wait.h>
static pid_t sys_clone3(struct clone_args *args)
{
return syscall(SYS_clone3, args, sizeof(struct clone_args));
}
int main(int argc,... | test/initramfs/src/apps/process/clone3/clone_no_exit_signal.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#define _GNU_SOURCE
#include <linux/sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/prctl.h>
#include <sys/syscall.h>
#include <sys/wait.h>
#include <unistd.h>
#include <sched.h>
#include <fcntl.h>
#include "../../common/test.h"
pid_t sys_clone3(struct clone_args *arg... | test/initramfs/src/apps/process/clone3/clone_parent.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#define _GNU_SOURCE
#include <err.h>
#include <errno.h>
#include <linux/sched.h>
#include <linux/types.h>
#include <sched.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include... | test/initramfs/src/apps/process/clone3/clone_process.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#define _GNU_SOURCE
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
int main()
{
pid_t pid = getpid();
cpu_set_t mask;
// Get current affinity mask
if (sched_getaffinity(pid, sizeof(cpu_set_t), &mask) == -1) {
perror("sched_... | test/initramfs/src/apps/process/cpu_affinity/cpu_affinity.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#include <stdio.h>
#include <unistd.h>
int main()
{
char *argv[] = { "argv1", "argv2", NULL };
char *envp[] = { "home=/", "version=1.1", NULL };
// The hello will be put at /execve/hello in InitRamfs
printf("Execve a new file /execve/hello:\n");
// flush the stdout content to ... | test/initramfs/src/apps/process/execve/execve.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#include <elf.h>
#include <stddef.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/fcntl.h>
#include "../../common/test.h"
struct custom_elf {
Elf64_Ehdr ehdr;
Elf64_Phdr phdr[3]; // See `push_interp` and `pop_interp` below.
char buf[128];
};
static struct custom_elf... | test/initramfs/src/apps/process/execve/execve_err.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <errno.h>
#include <assert.h>
#include "../../common/test.h"
#define EXECUTABLE_PATH "/te... | test/initramfs/src/apps/process/execve/execve_memfd.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#define _GNU_SOURCE
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <syscall.h>
#include "../../common/test.h"
#define FILENAME "/tmp/exec_test.stat"
FN_SETUP(check_child_stat)
{
int pid = -1;
int exit_code = -1;
int pipefd = -1;
FILE *file = CHECK_WITH(fo... | test/initramfs/src/apps/process/execve/execve_mt_child.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#define _GNU_SOURCE
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/syscall.h>
#include <sys/wait.h>
#include <stdbool.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <libgen.h>
#include <sched.h>
#include <linux/sched.h>
#include <f... | test/initramfs/src/apps/process/execve/execve_mt_parent.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#include <stdio.h>
int main(int argc, char *argv[], char *envp[])
{
printf("Hello world from hello.c!\n");
printf("argc = %d\n", argc);
for (int i = 0; i < argc; i++) {
printf("%s\n", argv[i]);
}
for (int i = 0;; i++) {
if (envp[i] == NULL) {
break;
}
printf("%s\n",... | test/initramfs/src/apps/process/execve/hello.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#include "../../common/test.h"
#include <pthread.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/wait.h>
struct exit_info {
int should_use_exit_group;
int should_exit_master_first;
};
static void *thread_slave(void *info_)
{
struct exit_info *info = info_;
if (... | test/initramfs/src/apps/process/exit/exit_code.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#include "../../common/test.h"
#include <unistd.h>
#include <pthread.h>
#include <sys/syscall.h>
#include <sys/wait.h>
#define EXIT_PARENT_FIRST ((void *)1)
#define EXIT_CHILD_FIRST ((void *)2)
// TODO: Use `system` directly after we implement `vfork`.
static int mini_system(cons... | test/initramfs/src/apps/process/exit/exit_procfs.c | null | null | null | null | null |
source | asterinas | # SPDX-License-Identifier: MPL-2.0
# FIXME: WNOHANG option currently does not work properly without preemption, so we have temporarily
# removed it. Once preemption is supported, the following macro can be uncommented to add the WNOHANG
# option back.
# #define PREEMPTION_ENABLE
.global _start
.section .text
_star... | test/initramfs/src/apps/process/fork/fork.S | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#include <stdio.h>
#include <unistd.h>
int main()
{
printf("before fork\n");
fflush(stdout);
if (fork() == 0) {
printf("after fork: Hello from child\n");
} else {
printf("after fork: Hello from parent\n");
}
fflush(stdout);
return 0;
} | test/initramfs/src/apps/process/fork_c/fork.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#include "../../common/test.h"
#include <sys/syscall.h>
#include <unistd.h>
FN_TEST(getcpu)
{
struct int_pair {
unsigned int first;
unsigned int second;
};
struct int_pair cpu = { .first = 0xdeadbeef, .second = 0xbeefdead };
struct int_pair node = { .first = 0xbeefdead, .... | test/initramfs/src/apps/process/getcpu/getcpu.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#define _GNU_SOURCE
#include <stdio.h>
#include <sys/syscall.h>
#include <time.h>
#include <unistd.h>
#define NUM_OF_CALLS 1000000
int main()
{
struct timespec start, end;
long seconds, nanoseconds, total_nanoseconds, avg_latency;
pid_t pid;
clock_gettime(CLOCK_MONOTONIC, &st... | test/initramfs/src/apps/process/getpid/getpid.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#include <stdio.h>
#include <sys/time.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <string.h>
volatile sig_atomic_t counter = 0;
void timer_handler(int signum)
{
counter++;
}
int main()
{
struct itimerval timer;
struct sigaction sa;... | test/initramfs/src/apps/process/itimer/setitimer.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <time.h>
#include <sys/syscall.h>
#include <linux/types.h>
#include <string.h>
#define CLOCKID CLOCK_REALTIME
#define SIG SIGRTMIN
static void handler(int sig, siginfo_t *si... | test/initramfs/src/apps/process/itimer/timer_create.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#define _GNU_SOURCE
#include "../../common/test.h"
#include <sys/prctl.h>
#include <sys/wait.h>
#include <linux/capability.h>
#include <linux/securebits.h>
#include <unistd.h>
FN_TEST(get_initial_securebits)
{
// Initially, all securebits should be 0
TEST_RES(prctl(PR_GET_SECURE... | test/initramfs/src/apps/process/prctl/secure_bits.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#include <sys/prctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#include <errno.h>
void set_child_subreaper()
{
if (prctl(PR_SET_CHILD_SUBREAPER, 1) == -1) {
perror("prctl: PR_SET_CHILD_SUBREAPER failed");
exit(EXIT_FAILURE);
}
printf(... | test/initramfs/src/apps/process/prctl/subreaper.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
// A regression test for the futex lost wakeup bug fixed in https://github.com/asterinas/asterinas/pull/1642
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <stdatomic.h>
pthread_mutex_t mutex;
atomic_int sync_flag = ATOM... | test/initramfs/src/apps/process/pthread/pthread_signal_test.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
// This test file is from occlum pthread test.
#include <sys/types.h>
#include <pthread.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/syscall.h>
#ifndef SYS_gettid
#error "SYS_gettid unavailable on this system"
#e... | test/initramfs/src/apps/process/pthread/pthread_test.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#include <sys/syscall.h>
#include <unistd.h>
#include <linux/sched/types.h>
#include "../../common/test.h"
static int sched_setattr(pid_t pid, struct sched_attr *attr, unsigned int flags)
{
return syscall(SYS_sched_setattr, pid, attr, flags);
}
static int sched_getattr(pid_t pid... | test/initramfs/src/apps/process/sched/sched_attr_getset.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#define _GNU_SOURCE
#include <sched.h>
#include <unistd.h>
#include "../../common/test.h"
FN_TEST(sched_param)
{
struct sched_param param;
TEST_ERRNO(sched_getscheduler(-100), EINVAL);
TEST_ERRNO(sched_getscheduler(1234567890), ESRCH);
TEST_RES(sched_getscheduler(0), _ret ==... | test/initramfs/src/apps/process/sched/sched_param_getset.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#define _GNU_SOURCE
#include <assert.h>
#include <pthread.h>
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define SCHED_IDLE 5
void *test(void *__arg)
{
struct sched_param param = { .sched_priority = 0 };
assert(sched_setscheduler(0, SCHED_IDLE, ... | test/initramfs/src/apps/process/sched/sched_param_idle.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#define _GNU_SOURCE
#include <pthread.h>
#include <signal.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/wait.h>
#include "../../common/test.h"
FN_SETUP(setpgrp)
{
CHECK(setpgrp());
}
END_SETUP()
FN_TEST(kill_dead_process)
{
pid_t ppid, cpid;
int status;
ppid... | test/initramfs/src/apps/process/signal/kill.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#define _GNU_SOURCE
#include <sys/prctl.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
void signal_handler(int signum)
{
if (signum == SIGTERM) {
printf("child process receives SIGTERM\n");
exit(EXIT_SUCCESS);
}
}
int main()
{
pid_t pid = ... | test/initramfs/src/apps/process/signal/parent_death_signal.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#define _GNU_SOURCE
#include <pthread.h>
#include <signal.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/wait.h>
#include <fcntl.h>
#include "../../common/test.h"
// Reference: <https://elixir.bootlin.com/linux/v6.18/source/include/uapi/linux/fcntl.h#L110>.
#define... | test/initramfs/src/apps/process/signal/pidfd_send_signal.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#define _GNU_SOURCE
#include <stdlib.h>
#include <signal.h>
#include <ucontext.h>
#include <unistd.h>
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include "../../common/test.h"
#define ALT_STACK_SIZE (SIGSTKSZ + 40960)
#ifndef SS_AUTODISARM
#define SS_AUTODISARM ... | test/initramfs/src/apps/process/signal/sigaltstack.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/signalfd.h>
#include <sys/wait.h>
#include <linux/wait.h>
#include <poll.h>
#include <pthread.h>
#include "../../common/test.h"
int sfd;
sigset_t mask;
FN_SETUP(install_signalfd)
{
sigemp... | test/initramfs/src/apps/process/signal/signal_fd.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <signal.h>
#include <stdint.h>
#include <stdbool.h>
volatile bool ok = true;
void set_xmm8(uint64_t xmm8_low, uint64_t xmm8_high)
{
// Create a buffer to hold 128 bits (16 bytes)
uint8_t xmm8_b... | test/initramfs/src/apps/process/signal/signal_fpu.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdatomic.h>
#include <assert.h>
volatile sig_atomic_t signaled = 0; // Volatile to avoid optimization issues
void read_df_flag_and_assert(int expect)
{
unsigned long rflags;
asm volatile("p... | test/initramfs/src/apps/process/signal/signal_rflags_df.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
// This test file is from occlum signal test.
#define _GNU_SOURCE
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/wait.h>
#include <unistd.h>
#include <ucontext.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <spawn.h>
#includ... | test/initramfs/src/apps/process/signal/signal_test.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#include "../../common/test.h"
#include <unistd.h>
#include <signal.h>
static volatile int received_signals;
static void signal_handler(int signum)
{
++received_signals;
}
static sigset_t sigs;
FN_SETUP(sigs)
{
CHECK(sigemptyset(&sigs));
CHECK(sigaddset(&sigs, SIGCHLD));
}
E... | test/initramfs/src/apps/process/signal/signal_test2.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <linux/capability.h>
int set_caps(__u32 target_pid, __u32 capabilities)
{
struct __user_cap_header_struct capheader;
struct __user_cap_data_struct capdata[2];
caphead... | test/initramfs/src/apps/security/capability/capabilities.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#include <stdint.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <linux/capability.h>
#include "../../common/test.h"
static struct __user_cap_header_struct caphdr = {
.version = _LINUX_CAPABILITY_VERSION_3
};
static struct __user_cap_data_struct capdat[2];
#define CAPS_... | test/initramfs/src/apps/security/capability/capset.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/wait.h>
#include <linux/capability.h>
#include "../../common/test.h"
static uid_t root = 0;
static uid_t nobody = 65534;
#define CAPS_ALL "000001ffffffffff"
#define CAPS_NONE "0000000000000000"
stati... | test/initramfs/src/apps/security/capability/execve.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#include <stdint.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <linux/capability.h>
#include "../../common/test.h"
static uint64_t effective;
static uint64_t permitted;
static uint64_t inheritable;
FN_SETUP(parse_cmdline)
{
FILE *fp;
fp = CHECK_WITH(fopen("/proc/sel... | test/initramfs/src/apps/security/capability/execve_child.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#define _GNU_SOURCE
#include <fcntl.h>
#include <sched.h>
#include <sys/mount.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include "../../common/test.h"
#define STACK_SIZE (1024 * 1024)
// --- Test for unshare(CLONE_NEWNS) ---
#define UNSHARE_MNT "/mn... | test/initramfs/src/apps/security/namespace/mnt_ns.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#define _GNU_SOURCE
#include <sched.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/syscall.h>
#include "../../common/test.h"
FN_TEST(set_ns_empty_flags)
{
// FIXME: The following test will fail on Asterinas
// because it currently does not support ns file.
#ifndef __ast... | test/initramfs/src/apps/security/namespace/setns.c | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#define _GNU_SOURCE
#include <unistd.h>
#include <sched.h>
#include <sys/stat.h>
#include <pthread.h>
#include <fcntl.h>
#include "../../common/test.h"
FN_TEST(invalid_flags)
{
TEST_ERRNO(unshare(CLONE_CHILD_CLEARTID), EINVAL);
TEST_ERRNO(unshare(CLONE_CHILD_SETTID), EINVAL);
T... | test/initramfs/src/apps/security/namespace/unshare.c | null | null | null | null | null |
source | asterinas | # Asterinas Benchmark Collection
The Asterinas Benchmark Collection evaluates the performance of Asterinas in comparison to Linux across a range of benchmarking tools (e.g., LMbench, Sysbench, iPerf) and real-world applications (e.g., Nginx, Redis, SQLite, Memcached). These benchmarks are conducted under various confi... | test/initramfs/src/benchmark/README.md | null | null | null | null | null |
source | asterinas | #DESCRIPTION:Kernel system calls
# abort01
# accept01
# accept02
# accept03
# accept4_01
# access01
# access02
# access03
# access04
# acct01
# acct02
# add_key01
# add_key02
# add_key03
# add_key04
# add_key05
# adjtimex01
# adjtimex02
# adjtimex03
# alarm02
alarm03
alarm05
alarm06
alarm07
# arch_prctl01
# bi... | test/initramfs/src/syscall/ltp/testcases/all.txt | null | null | null | null | null |
source | asterinas | bind04
chdir01A
chmod01
chmod01A
chmod08
chown05
creat03
dup05
dup203
dup205
fallocate03
fchmod01
fchmodat01
fchown05
fchownat01
fchownat02
fstat02
fstat02_64
fsync02
ftruncate01
ftruncate01_64
getcwd03
lchown01
link01
link02
link05
linkat01
lstat01
lstat01_64
mkdir04
mknod01
mmap06
mmap19
mprotect02
mprotect03
msync01... | test/initramfs/src/syscall/ltp/testcases/blocked/exfat.txt | null | null | null | null | null |
source | asterinas | dup05
getcwd02
linkat01
mknod01
# FIXME: The inode number of ext2 will be exhausted by `rename14`.
rename14
rmdir01
rmdir03A
rt_sigaction01
rt_sigaction02
rt_sigaction03
rt_sigprocmask01
rt_sigprocmask02
select01
select03
sendfile02
sendfile02_64
sendfile05
sendfile05_64
sendfile06
sendfile06_64
sendfile08
sendfile08_6... | test/initramfs/src/syscall/ltp/testcases/blocked/ext2.txt | null | null | null | null | null |
source | asterinas | # NixOS-Based Test Suites
This directory contains NixOS-based tests and a framework for writing and running them. The framework executes tests by interacting with a live instance of the operating system in a virtual environment. Thanks to this interactive design, the framework can test virtually any behavior that a re... | test/nixos/README.md | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
//! An imperative testing framework for NixOS-based tests.
//!
//! # Core Concepts
//!
//! ## Test Registration
//!
//! Use the `#[nixos_test]` attribute to register test cases. The framework
//! automatically discovers and runs all registered tests.
//!
//! ## Session Interaction
/... | test/nixos/common/framework/src/lib.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use rexpect::session::PtySession;
use super::Error;
/// Describes a runtime session configuration.
///
/// A session descriptor defines how to interact with a particular execution context,
/// such as a shell environment, container, or remote session. It specifies the prompt
/// p... | test/nixos/common/framework/src/session.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
//! The test suite for <TargetAppName> on Asterinas NixOS.
//!
//! # Document maintenance
//!
//! An application's test suite and its "Verified Usage" section in Asterinas Book
//! should always be kept in sync.
//! So whenever you modify the test suite,
//! review the documentation... | test/nixos/common/template/src/main.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
//! A procedural macro to register NixOS test cases.
//!
//! This crate should work together with `nixos_test_framework` crate. The
//! registered test cases will be collected and run by the test framework.
use proc_macro::TokenStream;
use quote::quote;
use syn::{ItemFn, parse_macr... | test/nixos/common/test_macro/src/lib.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
//! The test suite for hello-asterinas on Asterinas NixOS.
//!
//! # Document maintenance
//!
//! An application's test suite and its "Verified Usage" section in Asterinas Book
//! should always be kept in sync.
//! So whenever you modify the test suite,
//! review the documentation... | test/nixos/tests/hello/src/main.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
//! The test suite for nix on Asterinas NixOS.
//!
//! # Document maintenance
//!
//! An application's test suite and its "Verified Usage" section in Asterinas Book
//! should always be kept in sync.
//! So whenever you modify the test suite,
//! review the documentation and see if ... | test/nixos/tests/nix/src/main.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
//! The test suite for podman on Asterinas NixOS.
//!
//! # Document maintenance
//!
//! An application's test suite and its "Verified Usage" section in Asterinas Book
//! should always be kept in sync.
//! So whenever you modify the test suite,
//! review the documentation and see ... | test/nixos/tests/podman/src/main.rs | null | null | null | null | null |
source | asterinas | # Asterinas Development Docker Images
Asterinas development Docker images are provided to facilitate developing and testing Asterinas project. These images can be found in the [asterinas/asterinas](https://hub.docker.com/r/asterinas/asterinas/) repository on DockerHub.
## Building Docker Images
Asterinas development... | tools/docker/README.md | null | null | null | null | null |
source | asterinas | # Syscall Compatibility Tracer
Syscall Compatibility Tracer (`sctrace`) is an oracle
to answer the following questions
for developers and users of a Linux ABI-compatible OS
(such as [Asterinas](https://github.com/asterinas/asterinas)):
**Is a target Linux application supported by the OS?
If not, where are the gaps?**
... | tools/sctrace/README.md | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
//! # Sctrace - Syscall Compatibility Tracer
//!
//! `sctrace` is a library for analyzing `strace` logs against SCML (Syscall Matching Language)
//! patterns to determine syscall compatibility. It provides APIs for parsing `strace` output,
//! matching syscalls against pattern speci... | tools/sctrace/src/lib.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
mod parameter;
use std::env;
use parameter::Parameters;
use sctrace::{CliReporterBuilder, Patterns, SctraceBuilder, StraceLogStream};
fn run() -> Result<(), String> {
let args: Vec<String> = env::args().collect();
let params = Parameters::new(args)?;
let sctrace = Sc... | tools/sctrace/src/main.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use std::{error::Error, fmt};
use clap::{Arg, ArgAction, Command};
/// Holds parsed command-line parameters for the sctrace tool.
#[derive(Debug)]
pub(crate) struct Parameters {
/// Path to the SCML pattern files
scml_paths: Vec<String>,
/// Path to the input strace lo... | tools/sctrace/src/parameter.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use crate::{
scml_parser::{
ParserCtx, Pattern, PatternArg, PatternArray, PatternFlagSet, PatternStruct, Patterns,
},
strace_parser::{Syscall, SyscallArg, SyscallArray, SyscallFlagSet, SyscallStruct},
};
/// Matcher for syscalls against SCML patterns.
pub(crate)... | tools/sctrace/src/scml_matcher.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use std::{collections::HashMap, error::Error, fmt, fs, path::Path};
use nom::{
IResult,
branch::alt,
bytes::complete::{tag, take_while},
character::complete::{char, multispace0},
combinator::{opt, recognize},
multi::{separated_list0, separated_list1},
se... | tools/sctrace/src/scml_parser.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use std::{cell::RefCell, collections::HashMap, error::Error, fmt};
use nom::{
IResult,
branch::alt,
bytes::complete::{tag, take_until, take_while1},
character::complete::{char, digit1, space0, space1},
combinator::{map, opt, peek, recognize, rest, value},
mu... | tools/sctrace/src/strace_parser.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use std::{
error::Error,
fmt,
fs::File,
io::{BufRead, BufReader, Lines, Read},
os::unix::io::FromRawFd,
path::Path,
process::Command,
};
#[derive(Debug)]
pub struct TraceError {
message: String,
}
impl fmt::Display for TraceError {
fn fmt(&self,... | tools/sctrace/src/trace.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use sctrace::{CliReporterBuilder, Patterns, SctraceBuilder, StraceLogStream};
#[test]
fn test_open_syscall() {
let scml_content = r#"
access_mode =
O_RDONLY |
O_WRONLY |
O_RDWR;
creation_flags =
O_CLOEXEC |
... | tools/sctrace/tests/integration_test.rs | null | null | null | null | null |
source | musl | __asm__(
".text \n"
".global " START "\n"
".type " START ",%function\n"
START ":\n"
" mov x29, #0\n"
" mov x30, #0\n"
" mov x0, sp\n"
".weak _DYNAMIC\n"
".hidden _DYNAMIC\n"
" adrp x1, _DYNAMIC\n"
" add x1, x1, #:lo12:_DYNAMIC\n"
" and sp, x0, #-16\n"
" b " START "_c\n"
); | arch/aarch64/crt_arch.h | null | null | null | null | null |
source | musl | struct kstat {
dev_t st_dev;
ino_t st_ino;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
unsigned long __pad;
off_t st_size;
blksize_t st_blksize;
int __pad2;
blkcnt_t st_blocks;
long st_atime_sec;
long st_atime_nsec;
long st_mtime_sec;
long st_mtime_nsec;
long st_ctime_s... | arch/aarch64/kstat.h | null | null | null | null | null |
source | musl | static inline uintptr_t __get_tp()
{
uintptr_t tp;
__asm__ ("mrs %0,tpidr_el0" : "=r"(tp));
return tp;
}
#define TLS_ABOVE_TP
#define GAP_ABOVE_TP 16
#define MC_PC pc | arch/aarch64/pthread_arch.h | null | null | null | null | null |
source | musl | #if __BYTE_ORDER == __BIG_ENDIAN
#define ENDIAN_SUFFIX "_be"
#else
#define ENDIAN_SUFFIX ""
#endif
#define LDSO_ARCH "aarch64" ENDIAN_SUFFIX
#define NO_LEGACY_INITFINI
#define TPOFF_K 0
#define REL_SYMBOLIC R_AARCH64_ABS64
#define REL_GOT R_AARCH64_GLOB_DAT
#define REL_PLT R_AARCH64_JUMP_SLOT
#de... | arch/aarch64/reloc.h | null | null | null | null | null |
source | musl | #define __SYSCALL_LL_E(x) (x)
#define __SYSCALL_LL_O(x) (x)
#define __asm_syscall(...) do { \
__asm__ __volatile__ ( "svc 0" \
: "=r"(x0) : __VA_ARGS__ : "memory", "cc"); \
return x0; \
} while (0)
static inline long __syscall0(long n)
{
register long x8 __asm__("x8") = n;
register long x0 __asm__("x0");
__asm... | arch/aarch64/syscall_arch.h | null | null | null | null | null |
source | musl | #define O_CREAT 0100
#define O_EXCL 0200
#define O_NOCTTY 0400
#define O_TRUNC 01000
#define O_APPEND 02000
#define O_NONBLOCK 04000
#define O_DSYNC 010000
#define O_SYNC 04010000
#define O_RSYNC 04010000
#define O_DIRECTORY 040000
#define O_NOFOLLOW 0100000
#define O_CL... | arch/aarch64/bits/fcntl.h | null | null | null | null | null |
source | musl | #define FE_INVALID 1
#define FE_DIVBYZERO 2
#define FE_OVERFLOW 4
#define FE_UNDERFLOW 8
#define FE_INEXACT 16
#define FE_ALL_EXCEPT 31
#define FE_TONEAREST 0
#define FE_DOWNWARD 0x800000
#define FE_UPWARD 0x400000
#define FE_TOWARDZERO 0xc00000
typedef unsigned int fexcept_t;
typedef struct {
unsig... | arch/aarch64/bits/fenv.h | null | null | null | null | null |
source | musl | #define FLT_EVAL_METHOD 0
#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L
#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
#define LDBL_MANT_DIG 113
#define LDB... | arch/aarch64/bits/float.h | null | null | null | null | null |
source | musl | #define HWCAP_FP (1 << 0)
#define HWCAP_ASIMD (1 << 1)
#define HWCAP_EVTSTRM (1 << 2)
#define HWCAP_AES (1 << 3)
#define HWCAP_PMULL (1 << 4)
#define HWCAP_SHA1 (1 << 5)
#define HWCAP_SHA2 (1 << 6)
#define HWCAP_CRC32 (1 << 7)
#define HWCAP_ATOMICS (1 << 8)
#define HWCAP_FPHP (1 << 9)
#define HWCAP_ASIMDHP (... | arch/aarch64/bits/hwcap.h | null | null | null | null | null |
source | musl | #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define MINSIGSTKSZ 6144
#define SIGSTKSZ 12288
#endif
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
typedef... | arch/aarch64/bits/signal.h | null | null | null | null | null |
source | musl | struct user_regs_struct {
unsigned long long regs[31];
unsigned long long sp;
unsigned long long pc;
unsigned long long pstate;
};
struct user_fpsimd_struct {
__uint128_t vregs[32];
unsigned int fpsr;
unsigned int fpcr;
};
#define ELF_NREG 34
typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NREG];
typedef s... | arch/aarch64/bits/user.h | null | null | null | null | null |
source | musl | __asm__(
".text \n"
".global " START " \n"
".type " START ",%function \n"
START ": \n"
" mov fp, #0 \n"
" mov lr, #0 \n"
" ldr a2, 1f \n"
" add a2, pc, a2 \n"
" mov a1, sp \n"
"2: and ip, a1, #-16 \n"
" mov sp, ip \n"
" bl " START "_c \n"
".weak _DYNAMIC \n"
".hidden _DYNAMIC \n"
".align 2 \n"
"1: .word _DYNAMIC-2b \n"... | arch/arm/crt_arch.h | null | null | null | null | null |
source | musl | struct kstat {
dev_t st_dev;
int __st_dev_padding;
long __st_ino_truncated;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
int __st_rdev_padding;
off_t st_size;
blksize_t st_blksize;
blkcnt_t st_blocks;
long st_atime_sec;
long st_atime_nsec;
long st_mtime_sec;
long st_mtime... | arch/arm/kstat.h | null | null | null | null | null |
source | musl | #if ((__ARM_ARCH_6K__ || __ARM_ARCH_6KZ__ || __ARM_ARCH_6ZK__) && !__thumb__) \
|| __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
static inline uintptr_t __get_tp()
{
uintptr_t tp;
__asm__ ( "mrc p15,0,%0,c13,c0,3" : "=r"(tp) );
return tp;
}
#else
#if __ARM_ARCH_4__ || __ARM_ARCH_4T__ || __ARM_ARCH == 4
#... | arch/arm/pthread_arch.h | null | null | null | null | null |
source | musl | #if __BYTE_ORDER == __BIG_ENDIAN
#define ENDIAN_SUFFIX "eb"
#else
#define ENDIAN_SUFFIX ""
#endif
#if __ARM_PCS_VFP
#define FP_SUFFIX "hf"
#else
#define FP_SUFFIX ""
#endif
#define LDSO_ARCH "arm" ENDIAN_SUFFIX FP_SUFFIX
#define NO_LEGACY_INITFINI
#define TPOFF_K 0
#define REL_SYMBOLIC R_ARM_ABS32
#define REL_G... | arch/arm/reloc.h | null | null | null | null | null |
source | musl | #define __SYSCALL_LL_E(x) \
((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
((union { long long ll; long l[2]; }){ .ll = x }).l[1]
#define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x))
#ifdef __thumb__
/* Avoid use of r7 in asm constraints when producing thumb code,
* since it's reserved as frame pointer and mi... | arch/arm/syscall_arch.h | null | null | null | null | null |
source | musl | #define O_CREAT 0100
#define O_EXCL 0200
#define O_NOCTTY 0400
#define O_TRUNC 01000
#define O_APPEND 02000
#define O_NONBLOCK 04000
#define O_DSYNC 010000
#define O_SYNC 04010000
#define O_RSYNC 04010000
#define O_DIRECTORY 040000
#define O_NOFOLLOW 0100000
#define O_CL... | arch/arm/bits/fcntl.h | null | null | null | null | null |
source | musl | #ifndef __ARM_PCS_VFP
#define FE_ALL_EXCEPT 0
#define FE_TONEAREST 0
#else
#define FE_INVALID 1
#define FE_DIVBYZERO 2
#define FE_OVERFLOW 4
#define FE_UNDERFLOW 8
#define FE_INEXACT 16
#define FE_ALL_EXCEPT 31
#define FE_TONEAREST 0
#define FE_DOWNWARD 0x800000
#define FE_UPWARD 0x400000
#define FE_T... | arch/arm/bits/fenv.h | null | null | null | null | null |
source | musl | #define FLT_EVAL_METHOD 0
#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
#define LDBL_MIN 2.22507385850720138309e-308L
#define LDBL_MAX 1.79769313486231570815e+308L
#define LDBL_EPSILON 2.22044604925031308085e-16L
#define LDBL_MANT_DIG 53
#define LDBL_MIN_EXP (-1021)
#define LDBL_MAX_EXP 1024
#define LDBL_DIG 15... | arch/arm/bits/float.h | null | null | null | null | null |
source | musl | #define HWCAP_SWP (1 << 0)
#define HWCAP_HALF (1 << 1)
#define HWCAP_THUMB (1 << 2)
#define HWCAP_26BIT (1 << 3)
#define HWCAP_FAST_MULT (1 << 4)
#define HWCAP_FPA (1 << 5)
#define HWCAP_VFP (1 << 6)
#define HWCAP_EDSP (1 << 7)
#define HWCAP_JAVA (1 << 8)
#define HWCAP_IWMMXT (1 << 9)
#define HWCAP_CRUNCH (1 << 10)
#de... | arch/arm/bits/hwcap.h | null | null | null | null | null |
source | musl | struct msqid_ds {
struct ipc_perm msg_perm;
unsigned long __msg_stime_lo;
unsigned long __msg_stime_hi;
unsigned long __msg_rtime_lo;
unsigned long __msg_rtime_hi;
unsigned long __msg_ctime_lo;
unsigned long __msg_ctime_hi;
unsigned long msg_cbytes;
msgqnum_t msg_qnum;
msglen_t msg_qbytes;
pid_t msg_lspid;
... | arch/arm/bits/msg.h | null | null | null | null | null |
source | musl | #define PTRACE_GETWMMXREGS 18
#define PTRACE_SETWMMXREGS 19
#define PTRACE_GET_THREAD_AREA 22
#define PTRACE_SET_SYSCALL 23
#define PTRACE_GETCRUNCHREGS 25
#define PTRACE_SETCRUNCHREGS 26
#define PTRACE_GETVFPREGS 27
#define PTRACE_SETVFPREGS 28
#define PTRACE_GETHBPREGS 29
#define PTRACE_SETHBPREGS 30
#define PTRACE_G... | arch/arm/bits/ptrace.h | null | null | null | null | null |
source | musl | struct semid_ds {
struct ipc_perm sem_perm;
unsigned long __sem_otime_lo;
unsigned long __sem_otime_hi;
unsigned long __sem_ctime_lo;
unsigned long __sem_ctime_hi;
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned short sem_nsems;
char __sem_nsems_pad[sizeof(long)-sizeof(short)];
#else
char __sem_nsems_pad[sizeof(lo... | arch/arm/bits/sem.h | null | null | null | null | null |
source | musl | #define SHMLBA 4096
struct shmid_ds {
struct ipc_perm shm_perm;
size_t shm_segsz;
unsigned long __shm_atime_lo;
unsigned long __shm_atime_hi;
unsigned long __shm_dtime_lo;
unsigned long __shm_dtime_hi;
unsigned long __shm_ctime_lo;
unsigned long __shm_ctime_hi;
pid_t shm_cpid;
pid_t shm_lpid;
unsigned long ... | arch/arm/bits/shm.h | null | null | null | null | null |
source | musl | #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define MINSIGSTKSZ 2048
#define SIGSTKSZ 8192
#endif
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
typedef ... | arch/arm/bits/signal.h | null | null | null | null | null |
source | musl | /* copied from kernel definition, but with padding replaced
* by the corresponding correctly-sized userspace types. */
struct stat {
dev_t st_dev;
int __st_dev_padding;
long __st_ino_truncated;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
int __st_rdev_padding;
off_t st_size;... | arch/arm/bits/stat.h | null | null | null | null | null |
source | musl | typedef struct user_fpregs {
struct fp_reg {
unsigned sign1:1;
unsigned unused:15;
unsigned sign2:1;
unsigned exponent:14;
unsigned j:1;
unsigned mantissa1:31;
unsigned mantissa0:32;
} fpregs[8];
unsigned fpsr:32;
unsigned fpcr:32;
unsigned char ftype[8];
unsigned int init_flag;
} elf_fpregset_t;
s... | arch/arm/bits/user.h | null | null | null | null | null |
source | musl | #define _DIRENT_HAVE_D_RECLEN
#define _DIRENT_HAVE_D_OFF
#define _DIRENT_HAVE_D_TYPE
struct dirent {
ino_t d_ino;
off_t d_off;
unsigned short d_reclen;
unsigned char d_type;
char d_name[256];
}; | arch/generic/bits/dirent.h | null | null | null | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.