kernel: poll system and poll syscall

This commit is contained in:
Matheus
2023-07-08 22:02:36 -03:00
parent 0ed524f456
commit e938d0332e
11 changed files with 287 additions and 22 deletions
+13
View File
@@ -5,6 +5,7 @@
#include <kernel/alloc.h>
#include <errno.h>
#include <arch/cpu.h>
#include <kernel/poll.h>
#define PATHNAME_MAX 512
#define MAXLINKDEPTH 64
@@ -27,6 +28,18 @@ static cred_t *getcred() {
return &_cpu()->thread->proc->cred;
}
int vfs_pollstub(vnode_t *node, struct polldata *, int events) {
int revents = 0;
if (events & POLLIN)
revents |= POLLIN;
if (events & POLLOUT)
revents |= POLLOUT;
return revents;
}
void vfs_init() {
__assert(hashtable_init(&fstable, 20) == 0);
vfsroot = alloc(sizeof(vnode_t));