|
version 1.30.4.2, 2016/09/29 13:43:10
|
version 1.31.2.2, 2017/08/31 12:19:07
|
|
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 - 2016 | Copyright 2004 - 2017 |
| 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 245 sched_hook_cancel(void *task, void *arg __unused)
|
Line 245 sched_hook_cancel(void *task, void *arg __unused)
|
| #endif |
#endif |
| #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; |
| if (FD_ISSET(TASK_FD(t), &r->root_fds[1])) |
if (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]); |
FD_CLR(TASK_FD(t), &r->root_fds[0]); |
| else |
else |
| ee.events |= (EPOLLIN | EPOLLPRI | EPOLLRDHUP); | ee.events |= EPOLLIN | EPOLLPRI; |
| #else |
#else |
| if (flg < 2) { |
if (flg < 2) { |
| FD_CLR(TASK_FD(t), &r->root_fds[0]); |
FD_CLR(TASK_FD(t), &r->root_fds[0]); |
|
Line 283 sched_hook_cancel(void *task, void *arg __unused)
|
Line 284 sched_hook_cancel(void *task, void *arg __unused)
|
| #endif |
#endif |
| #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; |
| if (FD_ISSET(TASK_FD(t), &r->root_fds[0])) |
if (FD_ISSET(TASK_FD(t), &r->root_fds[0])) |
| ee.events = EPOLLIN | EPOLLPRI | EPOLLRDHUP; | ee.events = EPOLLIN | EPOLLPRI; |
| |
|
| if (flg < 2) |
if (flg < 2) |
| FD_CLR(TASK_FD(t), &r->root_fds[1]); |
FD_CLR(TASK_FD(t), &r->root_fds[1]); |
|
Line 553 sched_hook_read(void *task, void *arg __unused)
|
Line 555 sched_hook_read(void *task, void *arg __unused)
|
| struct kevent chg[1]; |
struct kevent chg[1]; |
| struct timespec timeout = { 0, 0 }; |
struct timespec timeout = { 0, 0 }; |
| #elif SUP_ENABLE == EP_SUPPORT |
#elif SUP_ENABLE == EP_SUPPORT |
| struct epoll_event ee = { .events = EPOLLIN | EPOLLPRI | EPOLLRDHUP, .data.fd = 0 }; | struct epoll_event ee = { .events = EPOLLIN | EPOLLPRI, .data.fd = 0 }; |
| int flg = 0; |
int flg = 0; |
| #endif |
#endif |
| |
|
|
Line 642 sched_hook_write(void *task, void *arg __unused)
|
Line 644 sched_hook_write(void *task, void *arg __unused)
|
| #elif SUP_ENABLE == EP_SUPPORT |
#elif SUP_ENABLE == EP_SUPPORT |
| if (FD_ISSET(TASK_FD(t), &r->root_fds[0])) { |
if (FD_ISSET(TASK_FD(t), &r->root_fds[0])) { |
| flg |= 1; |
flg |= 1; |
| ee.events |= EPOLLIN | EPOLLPRI | EPOLLRDHUP; | ee.events |= EPOLLIN | EPOLLPRI; |
| } |
} |
| if (FD_ISSET(TASK_FD(t), &r->root_fds[1])) |
if (FD_ISSET(TASK_FD(t), &r->root_fds[1])) |
| flg |= 2; |
flg |= 2; |
|
Line 1065 fetch_hook_kevent_proceed(int en, struct kevent *res,
|
Line 1067 fetch_hook_kevent_proceed(int en, struct kevent *res,
|
| static inline void |
static inline void |
| fetch_hook_epoll_proceed(int en, struct epoll_event *res, sched_root_task_t *r) |
fetch_hook_epoll_proceed(int en, struct epoll_event *res, sched_root_task_t *r) |
| { |
{ |
| register int i, flg; | register int i, flg, oevt; |
| int ops = EPOLL_CTL_DEL; |
int ops = EPOLL_CTL_DEL; |
| sched_task_t *task, *tmp; |
sched_task_t *task, *tmp; |
| struct epoll_event evt[1]; |
struct epoll_event evt[1]; |
| |
|
| for (i = 0; i < en; i++) { |
for (i = 0; i < en; i++) { |
| memcpy(evt, &res[i], sizeof evt); |
memcpy(evt, &res[i], sizeof evt); |
| |
oevt = evt->events & EPOLLOUT; |
| |
|
| if (evt->events & (EPOLLIN | EPOLLPRI | EPOLLET)) { | if (evt->events & (EPOLLIN | EPOLLPRI)) { |
| flg = 0; |
flg = 0; |
| TAILQ_FOREACH_SAFE(task, &r->root_read, task_node, tmp) { |
TAILQ_FOREACH_SAFE(task, &r->root_read, task_node, tmp) { |
| if (TASK_FD(task) != evt->data.fd) |
if (TASK_FD(task) != evt->data.fd) |
| continue; |
continue; |
| else { |
else { |
| flg++; |
flg++; |
| FD_CLR(TASK_FD(task), &r->root_fds[0]); |
|
| TASK_FLAG(task) = ioctl(TASK_FD(task), FIONREAD, &TASK_RET(task)); |
TASK_FLAG(task) = ioctl(TASK_FD(task), FIONREAD, &TASK_RET(task)); |
| |
|
| evt->events &= ~(EPOLLIN | EPOLLPRI | EPOLLET | EPOLLRDHUP); |
|
| if (FD_ISSET(TASK_FD(task), &r->root_fds[1])) { |
|
| ops = EPOLL_CTL_MOD; |
|
| evt->events |= EPOLLOUT; |
|
| } |
|
| } |
} |
| /* remove read handle */ |
/* remove read handle */ |
| remove_task_from(task, &r->root_read); |
remove_task_from(task, &r->root_read); |
|
Line 1106 fetch_hook_epoll_proceed(int en, struct epoll_event *r
|
Line 1102 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 (flg > 1) | |
| ops = EPOLL_CTL_MOD; | if (flg) { |
| | evt->events ^= evt->events; |
| | if (FD_ISSET(evt->data.fd, &r->root_fds[1])) { |
| | ops = EPOLL_CTL_MOD; |
| | evt->events |= EPOLLOUT; |
| | } |
| | if (flg > 1) { |
| | ops = EPOLL_CTL_MOD; |
| | evt->events |= EPOLLIN | EPOLLPRI; |
| | } else |
| | FD_CLR(evt->data.fd, &r->root_fds[0]); |
| | } |
| } |
} |
| |
|
| if (evt->events & EPOLLOUT) { | if (oevt) { |
| flg = 0; |
flg = 0; |
| TAILQ_FOREACH_SAFE(task, &r->root_write, task_node, tmp) { |
TAILQ_FOREACH_SAFE(task, &r->root_write, task_node, tmp) { |
| if (TASK_FD(task) != evt->data.fd) |
if (TASK_FD(task) != evt->data.fd) |
| continue; |
continue; |
| else { |
else { |
| flg++; |
flg++; |
| FD_CLR(TASK_FD(task), &r->root_fds[1]); |
|
| TASK_FLAG(task) = ioctl(TASK_FD(task), |
TASK_FLAG(task) = ioctl(TASK_FD(task), |
| FIONWRITE, &TASK_RET(task)); |
FIONWRITE, &TASK_RET(task)); |
| |
|
| evt->events &= ~EPOLLOUT; |
|
| if (FD_ISSET(TASK_FD(task), &r->root_fds[0])) { |
|
| ops = EPOLL_CTL_MOD; |
|
| evt->events |= EPOLLIN | EPOLLPRI | EPOLLRDHUP; |
|
| } |
|
| } |
} |
| /* remove write handle */ |
/* remove write handle */ |
| remove_task_from(task, &r->root_write); |
remove_task_from(task, &r->root_write); |
|
Line 1144 fetch_hook_epoll_proceed(int en, struct epoll_event *r
|
Line 1144 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 (flg > 1) | |
| ops = EPOLL_CTL_MOD; | if (flg) { |
| | evt->events ^= evt->events; |
| | if (FD_ISSET(evt->data.fd, &r->root_fds[0])) { |
| | ops = EPOLL_CTL_MOD; |
| | evt->events |= EPOLLIN | EPOLLPRI; |
| | } |
| | if (flg > 1) { |
| | ops = EPOLL_CTL_MOD; |
| | evt->events |= EPOLLOUT; |
| | } else |
| | FD_CLR(evt->data.fd, &r->root_fds[1]); |
| | } |
| } |
} |
| |
|
| if (epoll_ctl(r->root_kq, ops, evt->data.fd, evt) == -1) { |
if (epoll_ctl(r->root_kq, ops, evt->data.fd, evt) == -1) { |