mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 20:58:22 +00:00
poll: init changes
This commit is contained in:
+1
-1
@@ -213,7 +213,7 @@ static void enumeratefunction(int bus, int device, int function) {
|
||||
}
|
||||
|
||||
char *irqtype = e->msix.exists ? "msi-x" : (e->msi.exists ? "msi" : "no interrupts");
|
||||
printf("pci: found %02x:%02x.%x %02x%02x: %04x:%04x (rev %2x) (%s)\n", bus, device, function, e->class, e->subclass, e->vendor, e->device, e->revision, irqtype);
|
||||
printf("pci: found %02x:%02x.%x %02x%02x: %04x:%04x (rev %2x) (%s)\n", bus, device, function, e->class, e->subclass, e->vendor, e->deviceid, e->revision, irqtype);
|
||||
}
|
||||
|
||||
static void enumeratedevice(int bus, int device) {
|
||||
|
||||
@@ -30,6 +30,8 @@ static void removefromlist(polldata_t **list, polldata_t *data) {
|
||||
int poll_initdesc(polldesc_t *desc, size_t size) {
|
||||
__assert(size);
|
||||
|
||||
memset(desc, 0, sizeof(polldesc_t));
|
||||
|
||||
desc->data = alloc(sizeof(polldata_t) * size);
|
||||
if (desc->data == NULL)
|
||||
return ENOMEM;
|
||||
@@ -40,6 +42,7 @@ int poll_initdesc(polldesc_t *desc, size_t size) {
|
||||
MUTEX_INIT(&desc->eventlock);
|
||||
for (uintmax_t i = 0; i < size; ++i)
|
||||
desc->data[i].desc = desc;
|
||||
__assert(spinlock_try(&desc->lock));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -118,7 +121,6 @@ void poll_event(pollheader_t *header, int events) {
|
||||
polldesc_t *desc = iterator->desc;
|
||||
polldata_t *next = iterator->next;
|
||||
MUTEX_ACQUIRE(&desc->eventlock, false);
|
||||
// TODO POLLHUP and POLLERR
|
||||
int revents = iterator->events & events;
|
||||
|
||||
if (spinlock_try(&desc->lock) == false) {
|
||||
|
||||
@@ -52,7 +52,6 @@ static mmuflags_t flagstommuflags(int flags) {
|
||||
}
|
||||
|
||||
static int load(vnode_t *vnode, elfph64_t *ph) {
|
||||
// TODO verify that the load address doesn't intersect the kernel
|
||||
int error = 0;
|
||||
uintmax_t foffset = ph->offset;
|
||||
uintptr_t mempos = ph->memaddr;
|
||||
|
||||
@@ -30,14 +30,13 @@ syscallret_t syscall_poll(context_t *, pollfd_t *fds, size_t nfds, int timeoutms
|
||||
|
||||
memcpy(fdsbuff, fds, fdsbuffsize);
|
||||
|
||||
polldesc_t desc = {0};
|
||||
polldesc_t desc;
|
||||
// when nfds is 0, poll is used as a sleep.
|
||||
// therefore, initialize the desc size to one descriptor in that case.
|
||||
ret.errno = poll_initdesc(&desc, nfds == 0 ? 1 : nfds);
|
||||
if (ret.errno) {
|
||||
goto cleanup;
|
||||
}
|
||||
__assert(spinlock_try(&desc.lock));
|
||||
|
||||
size_t eventcount = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user