MCPcopy Create free account
hub / github.com/Simple-XX/SimpleKernel / sys_write

Function sys_write

src/syscall.cpp:85–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85[[nodiscard]] auto sys_write(int fd, const char* buf, size_t len) -> int {
86 // 简单实现:仅支持向标准输出(1)和错误输出(2)打印
87 if (fd == 1 || fd == 2) {
88 /// @todo应该检查 buf 是否在用户空间合法范围内
89 for (size_t i = 0; i < len; ++i) {
90 etl_putchar(buf[i]);
91 }
92 return static_cast<int>(len);
93 }
94 return -1;
95}
96
97auto sys_exit(int code) -> int {
98 klog::Info("[Syscall] Process {} exited with code {}",

Callers 1

syscall_dispatcherFunction · 0.85

Calls 1

etl_putcharFunction · 0.50

Tested by

no test coverage detected