MojoLlama
Archived Mojo/MAX quantizer and serving research repository (read-only history)
Brought by drakestapleton
MojoLlama / src / mojollama / mojo_engine / quant_io.c
| 1 | /* I/O bridge for MojoLlama Quantizer |
| 2 | Wraps POSIX write() so Mojo can call it without @extern("write") stdlib conflict. |
| 3 | WHY: Mojo 1.0.0b1 std/ffi declares @extern("write") and @extern("close") which |
| 4 | conflicts with Mojo code declaring the same extern. Our C helper uses different |
| 5 | function names ("qwrite", "qclose") that don't conflict. |
| 6 | */ |
| 7 | #include <unistd.h> |
| 8 | |
| 9 | long qwrite(int fd, const void *buf, unsigned long n) { |
| 10 | return write(fd, buf, n); |
| 11 | } |
| 12 | |
| 13 | int qclose(int fd) { |
| 14 | return close(fd); |
| 15 | } |