mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 23:18:21 +00:00
poll: fix 0 timeout
This commit is contained in:
@@ -24,7 +24,7 @@ syscallret syscall_poll(pollfd *fds, size_t nfds, int timeoutms){
|
|||||||
|
|
||||||
// create the internal list
|
// create the internal list
|
||||||
|
|
||||||
pollfd* ilist = alloc(1);
|
pollfd* ilist = alloc(nfds * sizeof(pollfd));
|
||||||
|
|
||||||
if(!ilist){
|
if(!ilist){
|
||||||
retv.errno = ENOMEM;
|
retv.errno = ENOMEM;
|
||||||
@@ -32,13 +32,6 @@ syscallret syscall_poll(pollfd *fds, size_t nfds, int timeoutms){
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(size_t fd = 0; fd < nfds; ++fd){
|
for(size_t fd = 0; fd < nfds; ++fd){
|
||||||
|
|
||||||
void* tmp = realloc(ilist,(fd+1)*sizeof(pollfd));
|
|
||||||
if(!tmp){
|
|
||||||
retv.errno = ENOMEM;
|
|
||||||
goto ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
ilist[fd].fd = fds[fd].fd;
|
ilist[fd].fd = fds[fd].fd;
|
||||||
ilist[fd].events = fds[fd].events;
|
ilist[fd].events = fds[fd].events;
|
||||||
}
|
}
|
||||||
@@ -84,6 +77,7 @@ syscallret syscall_poll(pollfd *fds, size_t nfds, int timeoutms){
|
|||||||
|
|
||||||
// TODO check for signal or timeout
|
// TODO check for signal or timeout
|
||||||
|
|
||||||
|
if(timeoutms == 0) break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user