This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

add basic-init test package

+55
+30
packages/basic-init/init.c
··· 1 + #include <sched.h> 2 + #include <stdio.h> 3 + #include <sys/utsname.h> 4 + #include <unistd.h> 5 + 6 + int main(int argc, char *argv[], char *envp[]) { 7 + printf("Hello, world!\n"); 8 + 9 + printf("pid = %d\n", getpid()); 10 + 11 + struct utsname sysinfo; 12 + if (uname(&sysinfo) == -1) { 13 + perror("uname"); 14 + return 1; 15 + } 16 + 17 + printf("%s %s %s\n", sysinfo.sysname, sysinfo.release, sysinfo.version); 18 + 19 + printf("argc = %d\n", argc); 20 + for (int i = 0; i < argc; i++) 21 + printf("argv[%d] = %s\n", i, argv[i]); 22 + for (int i = 0; envp[i]; i++) 23 + printf("envp[%d] = %s\n", i, envp[i]); 24 + 25 + printf("idling forever\n"); 26 + for (;;) 27 + sched_yield(); 28 + 29 + return 0; 30 + }
+25
packages/basic-init/package.nix
··· 1 + { 2 + run, 3 + 4 + clang, 5 + lld, 6 + musl, 7 + compiler-rt, 8 + }: 9 + 10 + run 11 + { 12 + name = "basic-init"; 13 + src = ./.; 14 + path = [ 15 + clang 16 + lld 17 + ]; 18 + } 19 + '' 20 + clang -c -o init.o init.c --target=wasm32 -nostdinc -isystem ${musl}/include 21 + wasm-ld -o init init.o ${compiler-rt}/libclang_rt.builtins-wasm32.a ${musl}/lib/crt1.o -L${musl}/lib -lc --fatal-warnings --initial-memory=655360 22 + 23 + mkdir -p $out/bin 24 + cp init $out/bin 25 + ''