Kernel/LibC: Implement basic epoll
This implementation is on top of inodes instead of fds as linux does it. If I start finding ports/software that relies on epoll allowing duplicate inodes, I will do what linux does. I'm probably missing multiple epoll_notify's which may cause hangs but the system seems to work fine :dd:
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <string.h>
|
||||
#include <stropts.h>
|
||||
#include <sys/banan-os.h>
|
||||
#include <sys/epoll.h>
|
||||
#include <sys/sysmacros.h>
|
||||
|
||||
namespace Kernel
|
||||
@@ -40,6 +41,7 @@ namespace Kernel
|
||||
bool can_read_impl() const override { return false; }
|
||||
bool can_write_impl() const override { return false; }
|
||||
bool has_error_impl() const override { return false; }
|
||||
bool has_hangup_impl() const override { return false; }
|
||||
|
||||
private:
|
||||
DevTTY(mode_t mode, uid_t uid, gid_t gid)
|
||||
@@ -238,6 +240,7 @@ namespace Kernel
|
||||
if (ch == '\x04' && (m_termios.c_lflag & ICANON))
|
||||
{
|
||||
m_output.flush = true;
|
||||
epoll_notify(EPOLLIN);
|
||||
m_output.thread_blocker.unblock();
|
||||
return;
|
||||
}
|
||||
@@ -280,6 +283,7 @@ namespace Kernel
|
||||
if (ch == '\n' || !(m_termios.c_lflag & ICANON))
|
||||
{
|
||||
m_output.flush = true;
|
||||
epoll_notify(EPOLLIN);
|
||||
m_output.thread_blocker.unblock();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user