|
version 1.41.4.1, 2023/08/17 14:13:07
|
version 1.42.20.1, 2026/11/12 12:03:39
|
|
Line 12 terms:
|
Line 12 terms:
|
| All of the documentation and software included in the ELWIX and AITNET |
All of the documentation and software included in the ELWIX and AITNET |
| Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
| |
|
| Copyright 2004 - 2023 | Copyright 2004 - 2026 |
| by Michael Pounov <misho@elwix.org>. All rights reserved. |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
| |
|
| Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
|
Line 149 sched_hook_init(void *root, void *arg __unused)
|
Line 149 sched_hook_init(void *root, void *arg __unused)
|
| r->root_kq ^= r->root_kq; |
r->root_kq ^= r->root_kq; |
| #endif |
#endif |
| |
|
| FD_ZERO(&r->root_fds[0]); | SCHED_FD_ZERO(&r->root_fds[0]); |
| FD_ZERO(&r->root_fds[1]); | SCHED_FD_ZERO(&r->root_fds[1]); |
| FD_ZERO(&r->root_fds[2]); | SCHED_FD_ZERO(&r->root_fds[2]); |
| |
|
| return NULL; |
return NULL; |
| } |
} |
|
Line 180 sched_hook_fini(void *root, void *arg __unused)
|
Line 180 sched_hook_fini(void *root, void *arg __unused)
|
| r->root_kq ^= r->root_kq; |
r->root_kq ^= r->root_kq; |
| #endif |
#endif |
| |
|
| FD_ZERO(&r->root_fds[2]); | SCHED_FD_ZERO(&r->root_fds[2]); |
| FD_ZERO(&r->root_fds[1]); | SCHED_FD_ZERO(&r->root_fds[1]); |
| FD_ZERO(&r->root_fds[0]); | SCHED_FD_ZERO(&r->root_fds[0]); |
| |
|
| return NULL; |
return NULL; |
| } |
} |
|
Line 238 sched_hook_cancel(void *task, void *arg __unused)
|
Line 238 sched_hook_cancel(void *task, void *arg __unused)
|
| #elif SUP_ENABLE == EP_SUPPORT |
#elif SUP_ENABLE == EP_SUPPORT |
| ee.data.fd = TASK_FD(t); |
ee.data.fd = TASK_FD(t); |
| ee.events ^= ee.events; |
ee.events ^= ee.events; |
| if (FD_ISSET(TASK_FD(t), &r->root_fds[1])) | if (SCHED_FD_ISSET(TASK_FD(t), &r->root_fds[1])) |
| ee.events |= EPOLLOUT; |
ee.events |= EPOLLOUT; |
| |
|
| if (flg < 2) { |
if (flg < 2) { |
| FD_CLR(TASK_FD(t), &r->root_fds[0]); | SCHED_FD_CLR(TASK_FD(t), &r->root_fds[0]); |
| FD_CLR(TASK_FD(t), &r->root_fds[2]); | SCHED_FD_CLR(TASK_FD(t), &r->root_fds[2]); |
| } else { |
} else { |
| if (FD_ISSET(TASK_FD(t), &r->root_fds[0])) | if (SCHED_FD_ISSET(TASK_FD(t), &r->root_fds[0])) |
| ee.events |= EPOLLIN; |
ee.events |= EPOLLIN; |
| if (FD_ISSET(TASK_FD(t), &r->root_fds[2])) | if (SCHED_FD_ISSET(TASK_FD(t), &r->root_fds[2])) |
| ee.events |= EPOLLPRI; |
ee.events |= EPOLLPRI; |
| } |
} |
| #else |
#else |
| if (flg < 2) { |
if (flg < 2) { |
| FD_CLR(TASK_FD(t), &r->root_fds[0]); | SCHED_FD_CLR(TASK_FD(t), &r->root_fds[0]); |
| FD_CLR(TASK_FD(t), &r->root_fds[2]); | SCHED_FD_CLR(TASK_FD(t), &r->root_fds[2]); |
| |
|
| /* optimize select */ |
/* optimize select */ |
| for (i = r->root_kq - 1; i >= 0; i--) |
for (i = r->root_kq - 1; i >= 0; i--) |
| if (FD_ISSET(i, &r->root_fds[0]) || | if (SCHED_FD_ISSET(i, &r->root_fds[0]) || |
| FD_ISSET(i, &r->root_fds[1]) || | SCHED_FD_ISSET(i, &r->root_fds[1]) || |
| FD_ISSET(i, &r->root_fds[2])) | SCHED_FD_ISSET(i, &r->root_fds[2])) |
| break; |
break; |
| r->root_kq = i + 1; |
r->root_kq = i + 1; |
| } |
} |
|
Line 281 sched_hook_cancel(void *task, void *arg __unused)
|
Line 281 sched_hook_cancel(void *task, void *arg __unused)
|
| #elif SUP_ENABLE == EP_SUPPORT |
#elif SUP_ENABLE == EP_SUPPORT |
| ee.data.fd = TASK_FD(t); |
ee.data.fd = TASK_FD(t); |
| ee.events ^= ee.events; |
ee.events ^= ee.events; |
| if (FD_ISSET(TASK_FD(t), &r->root_fds[0])) | if (SCHED_FD_ISSET(TASK_FD(t), &r->root_fds[0])) |
| ee.events |= EPOLLIN; |
ee.events |= EPOLLIN; |
| if (FD_ISSET(TASK_FD(t), &r->root_fds[2])) | if (SCHED_FD_ISSET(TASK_FD(t), &r->root_fds[2])) |
| ee.events |= EPOLLPRI; |
ee.events |= EPOLLPRI; |
| |
|
| if (flg < 2) |
if (flg < 2) |
| FD_CLR(TASK_FD(t), &r->root_fds[1]); | SCHED_FD_CLR(TASK_FD(t), &r->root_fds[1]); |
| else |
else |
| ee.events |= EPOLLOUT; |
ee.events |= EPOLLOUT; |
| #else |
#else |
| if (flg < 2) { |
if (flg < 2) { |
| FD_CLR(TASK_FD(t), &r->root_fds[1]); | SCHED_FD_CLR(TASK_FD(t), &r->root_fds[1]); |
| |
|
| /* optimize select */ |
/* optimize select */ |
| for (i = r->root_kq - 1; i >= 0; i--) |
for (i = r->root_kq - 1; i >= 0; i--) |
| if (FD_ISSET(i, &r->root_fds[0]) || | if (SCHED_FD_ISSET(i, &r->root_fds[0]) || |
| FD_ISSET(i, &r->root_fds[1]) || | SCHED_FD_ISSET(i, &r->root_fds[1]) || |
| FD_ISSET(i, &r->root_fds[2])) | SCHED_FD_ISSET(i, &r->root_fds[2])) |
| break; |
break; |
| r->root_kq = i + 1; |
r->root_kq = i + 1; |
| } |
} |
|
Line 564 sched_hook_read(void *task, void *arg)
|
Line 564 sched_hook_read(void *task, void *arg)
|
| mask = EPOLLIN | EPOLLPRI; |
mask = EPOLLIN | EPOLLPRI; |
| ee.data.fd = TASK_FD(t); |
ee.data.fd = TASK_FD(t); |
| ee.events = mask; |
ee.events = mask; |
| if (FD_ISSET(TASK_FD(t), &r->root_fds[2])) { | if (SCHED_FD_ISSET(TASK_FD(t), &r->root_fds[2])) { |
| flg |= 4; |
flg |= 4; |
| ee.events |= EPOLLPRI; |
ee.events |= EPOLLPRI; |
| } |
} |
| if (FD_ISSET(TASK_FD(t), &r->root_fds[0])) { | if (SCHED_FD_ISSET(TASK_FD(t), &r->root_fds[0])) { |
| flg |= 1; |
flg |= 1; |
| ee.events |= EPOLLIN; |
ee.events |= EPOLLIN; |
| } |
} |
| if (FD_ISSET(TASK_FD(t), &r->root_fds[1])) { | if (SCHED_FD_ISSET(TASK_FD(t), &r->root_fds[1])) { |
| flg |= 2; |
flg |= 2; |
| ee.events |= EPOLLOUT; |
ee.events |= EPOLLOUT; |
| } |
} |
|
Line 585 sched_hook_read(void *task, void *arg)
|
Line 585 sched_hook_read(void *task, void *arg)
|
| return (void*) -1; |
return (void*) -1; |
| } else { |
} else { |
| if (mask & EPOLLIN) |
if (mask & EPOLLIN) |
| FD_SET(TASK_FD(t), &r->root_fds[0]); | SCHED_FD_SET(TASK_FD(t), &r->root_fds[0]); |
| if (mask & EPOLLPRI) |
if (mask & EPOLLPRI) |
| FD_SET(TASK_FD(t), &r->root_fds[2]); | SCHED_FD_SET(TASK_FD(t), &r->root_fds[2]); |
| } |
} |
| #else |
#else |
| if (!mask) { |
if (!mask) { |
| FD_SET(TASK_FD(t), &r->root_fds[0]); | SCHED_FD_SET(TASK_FD(t), &r->root_fds[0]); |
| FD_SET(TASK_FD(t), &r->root_fds[2]); | SCHED_FD_SET(TASK_FD(t), &r->root_fds[2]); |
| } else { |
} else { |
| if (mask & 1) |
if (mask & 1) |
| FD_SET(TASK_FD(t), &r->root_fds[0]); | SCHED_FD_SET(TASK_FD(t), &r->root_fds[0]); |
| if (mask & 2) |
if (mask & 2) |
| FD_SET(TASK_FD(t), &r->root_fds[2]); | SCHED_FD_SET(TASK_FD(t), &r->root_fds[2]); |
| } |
} |
| |
|
| if (TASK_FD(t) >= r->root_kq) |
if (TASK_FD(t) >= r->root_kq) |
|
Line 654 sched_hook_write(void *task, void *arg)
|
Line 654 sched_hook_write(void *task, void *arg)
|
| ee.data.fd = TASK_FD(t); |
ee.data.fd = TASK_FD(t); |
| ee.events = mask; |
ee.events = mask; |
| |
|
| if (FD_ISSET(TASK_FD(t), &r->root_fds[2])) { | if (SCHED_FD_ISSET(TASK_FD(t), &r->root_fds[2])) { |
| flg |= 4; |
flg |= 4; |
| ee.events |= EPOLLPRI; |
ee.events |= EPOLLPRI; |
| } |
} |
| if (FD_ISSET(TASK_FD(t), &r->root_fds[0])) { | if (SCHED_FD_ISSET(TASK_FD(t), &r->root_fds[0])) { |
| flg |= 1; |
flg |= 1; |
| ee.events |= EPOLLIN; |
ee.events |= EPOLLIN; |
| } |
} |
| if (FD_ISSET(TASK_FD(t), &r->root_fds[1])) { | if (SCHED_FD_ISSET(TASK_FD(t), &r->root_fds[1])) { |
| flg |= 2; |
flg |= 2; |
| ee.events |= EPOLLOUT; |
ee.events |= EPOLLOUT; |
| } |
} |
|
Line 675 sched_hook_write(void *task, void *arg)
|
Line 675 sched_hook_write(void *task, void *arg)
|
| return (void*) -1; |
return (void*) -1; |
| } else |
} else |
| if (mask & EPOLLOUT) |
if (mask & EPOLLOUT) |
| FD_SET(TASK_FD(t), &r->root_fds[1]); | SCHED_FD_SET(TASK_FD(t), &r->root_fds[1]); |
| #else |
#else |
| if (!mask) |
if (!mask) |
| FD_SET(TASK_FD(t), &r->root_fds[1]); | SCHED_FD_SET(TASK_FD(t), &r->root_fds[1]); |
| else |
else |
| if (mask & 1) |
if (mask & 1) |
| FD_SET(TASK_FD(t), &r->root_fds[1]); | SCHED_FD_SET(TASK_FD(t), &r->root_fds[1]); |
| |
|
| if (TASK_FD(t) >= r->root_kq) |
if (TASK_FD(t) >= r->root_kq) |
| r->root_kq = TASK_FD(t) + 1; |
r->root_kq = TASK_FD(t) + 1; |
|
Line 1156 fetch_hook_epoll_proceed(int en, struct epoll_event *r
|
Line 1156 fetch_hook_epoll_proceed(int en, struct epoll_event *r
|
| insert_task_to(task, &r->root_ready); |
insert_task_to(task, &r->root_ready); |
| } |
} |
| |
|
| if (!(res[i].events & EPOLLOUT) && FD_ISSET(evt->data.fd, &r->root_fds[1])) { | if (!(res[i].events & EPOLLOUT) && SCHED_FD_ISSET(evt->data.fd, &r->root_fds[1])) { |
| evt->events |= EPOLLOUT; |
evt->events |= EPOLLOUT; |
| wflg = 42; |
wflg = 42; |
| } |
} |
| if (rflg > 1) { |
if (rflg > 1) { |
| if (FD_ISSET(evt->data.fd, &r->root_fds[0])) | if (SCHED_FD_ISSET(evt->data.fd, &r->root_fds[0])) |
| evt->events |= EPOLLIN; |
evt->events |= EPOLLIN; |
| if (FD_ISSET(evt->data.fd, &r->root_fds[2])) | if (SCHED_FD_ISSET(evt->data.fd, &r->root_fds[2])) |
| evt->events |= EPOLLPRI; |
evt->events |= EPOLLPRI; |
| } else { |
} else { |
| FD_CLR(evt->data.fd, &r->root_fds[0]); | SCHED_FD_CLR(evt->data.fd, &r->root_fds[0]); |
| FD_CLR(evt->data.fd, &r->root_fds[2]); | SCHED_FD_CLR(evt->data.fd, &r->root_fds[2]); |
| } |
} |
| } |
} |
| } |
} |
|
Line 1200 fetch_hook_epoll_proceed(int en, struct epoll_event *r
|
Line 1200 fetch_hook_epoll_proceed(int en, struct epoll_event *r
|
| insert_task_to(task, &r->root_ready); |
insert_task_to(task, &r->root_ready); |
| } |
} |
| |
|
| if (!(res[i].events & EPOLLIN) && FD_ISSET(evt->data.fd, &r->root_fds[0])) { | if (!(res[i].events & EPOLLIN) && SCHED_FD_ISSET(evt->data.fd, &r->root_fds[0])) { |
| evt->events |= EPOLLIN; |
evt->events |= EPOLLIN; |
| rflg = 42; |
rflg = 42; |
| } |
} |
| if (!(res[i].events & EPOLLPRI) && FD_ISSET(evt->data.fd, &r->root_fds[2])) { | if (!(res[i].events & EPOLLPRI) && SCHED_FD_ISSET(evt->data.fd, &r->root_fds[2])) { |
| evt->events |= EPOLLPRI; |
evt->events |= EPOLLPRI; |
| rflg = 42; |
rflg = 42; |
| } |
} |
| if (wflg > 1) |
if (wflg > 1) |
| evt->events |= EPOLLOUT; |
evt->events |= EPOLLOUT; |
| else |
else |
| FD_CLR(evt->data.fd, &r->root_fds[1]); | SCHED_FD_CLR(evt->data.fd, &r->root_fds[1]); |
| } |
} |
| } |
} |
| |
|
|
Line 1241 fetch_hook_select_proceed(int en, fd_set rfd, fd_set w
|
Line 1241 fetch_hook_select_proceed(int en, fd_set rfd, fd_set w
|
| return; |
return; |
| |
|
| for (i = 0; i < r->root_kq; i++) { |
for (i = 0; i < r->root_kq; i++) { |
| if (!FD_ISSET(i, &r->root_fds[0]) && | if (!SCHED_FD_ISSET(i, &r->root_fds[0]) && |
| !FD_ISSET(i, &r->root_fds[1]) && | !SCHED_FD_ISSET(i, &r->root_fds[1]) && |
| !FD_ISSET(i, &r->root_fds[2])) | !SCHED_FD_ISSET(i, &r->root_fds[2])) |
| continue; |
continue; |
| |
|
| rflg = wflg = 0; |
rflg = wflg = 0; |
| |
|
| if (FD_ISSET(i, &rfd) || FD_ISSET(i, &xfd)) { | if (SCHED_FD_ISSET(i, &rfd) || SCHED_FD_ISSET(i, &xfd)) { |
| task = NULL; |
task = NULL; |
| TAILQ_FOREACH_SAFE(t, &r->root_read, task_node, tmp) { |
TAILQ_FOREACH_SAFE(t, &r->root_read, task_node, tmp) { |
| if (TASK_FD(t) == i) { |
if (TASK_FD(t) == i) { |
|
Line 1279 fetch_hook_select_proceed(int en, fd_set rfd, fd_set w
|
Line 1279 fetch_hook_select_proceed(int en, fd_set rfd, fd_set w
|
| |
|
| /* remove resouce */ |
/* remove resouce */ |
| if (rflg == 1) { |
if (rflg == 1) { |
| FD_CLR(i, &r->root_fds[0]); | SCHED_FD_CLR(i, &r->root_fds[0]); |
| FD_CLR(i, &r->root_fds[2]); | SCHED_FD_CLR(i, &r->root_fds[2]); |
| } |
} |
| } |
} |
| } |
} |
| if (FD_ISSET(i, &wfd)) { | if (SCHED_FD_ISSET(i, &wfd)) { |
| task = NULL; |
task = NULL; |
| TAILQ_FOREACH_SAFE(t, &r->root_write, task_node, tmp) { |
TAILQ_FOREACH_SAFE(t, &r->root_write, task_node, tmp) { |
| if (TASK_FD(t) == i) { |
if (TASK_FD(t) == i) { |
|
Line 1315 fetch_hook_select_proceed(int en, fd_set rfd, fd_set w
|
Line 1315 fetch_hook_select_proceed(int en, fd_set rfd, fd_set w
|
| |
|
| /* remove resouce */ |
/* remove resouce */ |
| if (wflg == 1) |
if (wflg == 1) |
| FD_CLR(i, &r->root_fds[1]); | SCHED_FD_CLR(i, &r->root_fds[1]); |
| } |
} |
| } |
} |
| } |
} |
| |
|
| /* optimize select */ |
/* optimize select */ |
| for (i = r->root_kq - 1; i >= 0; i--) |
for (i = r->root_kq - 1; i >= 0; i--) |
| if (FD_ISSET(i, &r->root_fds[0]) || | if (SCHED_FD_ISSET(i, &r->root_fds[0]) || |
| FD_ISSET(i, &r->root_fds[1]) || | SCHED_FD_ISSET(i, &r->root_fds[1]) || |
| FD_ISSET(i, &r->root_fds[2])) | SCHED_FD_ISSET(i, &r->root_fds[2])) |
| break; |
break; |
| r->root_kq = i + 1; |
r->root_kq = i + 1; |
| } |
} |