// lib/c/libc — minimal libc bindings. Each declaration is body-less, // imported from the C side at link time. The @symbol attribute pins // the linker name; without it, the binding name itself is used. // // These declarations cover the small surface the bootstrap wants: // process exit, three io syscalls, and the malloc/free pair. Higher // ergonomics live in sibling pure-ww packages. @symbol("malloc") fn malloc(n: u64) *void; @symbol("free") fn free(p: *void) void; @symbol("calloc") fn calloc(n: u64, sz: u64) *void; @symbol("read") fn read(fd: i32, buf: *u8, n: u64) i64; @symbol("write") fn write(fd: i32, buf: *u8, n: u64) i64; @symbol("open") fn open(path: *u8, flags: i32, mode: i32) i32; @symbol("close") fn close(fd: i32) i32; @symbol("exit") fn exit(code: i32) void; @symbol("strlen") fn strlen(s: *u8) u64; @symbol("memcpy") fn memcpy(dst: *void, src: *void, n: u64) *void; @symbol("memset") fn memset(p: *void, b: i32, n: u64) *void;