many things, cosmo build!
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user