Skip to content

Commit c009556

Browse files
committed
Add open()
1 parent b2c0c3d commit c009556

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

docs/tcc-wasm.wasm

6.16 KB
Binary file not shown.

tcc-wasm.wasm

6.16 KB
Binary file not shown.

zig/tcc-wasm.zig

+6-2
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,14 @@ extern fn main(_argc: c_int, argv: [*:null]const ?[*:0]const u8) c_int;
4545
// File Functions
4646

4747
export fn open(path: [*:0]const u8, oflag: c_uint, ...) c_int {
48-
debug("open: path={s}, oflag={}", .{ path, oflag });
49-
@panic("TODO: open");
48+
debug("open: path={s}, oflag={}, return fd={}", .{ path, oflag, fd });
49+
const ret = fd;
50+
fd += 1;
51+
return ret;
5052
}
5153

54+
var fd: c_int = 3;
55+
5256
///////////////////////////////////////////////////////////////////////////////
5357
// Memory Allocator for malloc
5458

0 commit comments

Comments
 (0)