poll syscall: add volatile keyword to fd count to prevent a loop from being optimized out

This commit is contained in:
Matheus
2023-01-02 23:42:25 -03:00
parent 5fb8398c1a
commit 78b9724b38
+2 -3
View File
@@ -11,7 +11,7 @@
#define MAXNFDS 4096
syscallret syscall_poll(pollfd *fds, size_t nfds, int timeoutms){
syscallret syscall_poll(pollfd *fds, volatile int nfds, int timeoutms){
syscallret retv;
retv.ret = -1;
@@ -117,8 +117,7 @@ syscallret syscall_poll(pollfd *fds, size_t nfds, int timeoutms){
size_t eventcount = 0;
for(uintmax_t i = 0; i < nfds; ++i){
for(int i = 0; i < nfds; ++i){
if(ilist[i].fd < 0)
continue;