many things, cosmo build!

This commit is contained in:
veclavtlica
2026-10-12 21:12:47 +03:00
parent ba4131abbf
commit 8d2bb5575e
29 changed files with 699 additions and 312 deletions
+18
View File
@@ -6,6 +6,7 @@
#include "../std.h"
#include <fcntl.h>
#include <poll.h>
#include <stdint.h>
#include <sys/socket.h>
#include <sys/un.h>
@@ -44,6 +45,23 @@ inline int32_t com_std_read(com_std_fd fd, void *data, uint32_t upto) {
return ret;
}
inline bool com_std_has_data(com_std_fd fd) {
struct pollfd pfd = {
.fd = (intptr_t)fd,
.events = POLLIN,
};
long ret;
__asm__ volatile("int $0x80"
: "=a"(ret)
: "a"(168), "b"(&pfd), "c"(1), "d"(0)
: "memory", "cc");
if (ret > 0) {
return pfd.revents & POLLIN;
} else
return false;
}
inline bool com_std_sfwd(com_std_fd fd, uint32_t bytes) {
long ret;
__asm__ volatile("int $0x80"