0
0
mirror of https://github.com/hufrea/byedpi.git synced 2025-06-30 02:31:15 +00:00

Dont use POLLRDHUP

This commit is contained in:
ruti 2025-02-16 19:44:20 +03:00
parent 51c8c29701
commit cf05424bd0
2 changed files with 9 additions and 6 deletions

View File

@ -60,7 +60,7 @@ struct eval *add_event(struct poolhd *pool, evcb_t cb,
val->cb = cb;
#ifndef NOEPOLL
struct epoll_event ev = { .events = EPOLLRDHUP | e, .data = {val} };
struct epoll_event ev = { .events = _POLLDEF | e, .data = {val} };
if (epoll_ctl(pool->efd, EPOLL_CTL_ADD, fd, &ev)) {
uniperror("add event");
return 0;
@ -69,7 +69,7 @@ struct eval *add_event(struct poolhd *pool, evcb_t cb,
struct pollfd *pfd = &(pool->pevents[pool->count]);
pfd->fd = fd;
pfd->events = POLLRDHUP | e;
pfd->events = _POLLDEF | e;
pfd->revents = 0;
#endif
@ -178,7 +178,7 @@ int mod_etype(struct poolhd *pool, struct eval *val, int type)
{
assert(val->fd > 0);
struct epoll_event ev = {
.events = EPOLLRDHUP | type, .data = {val}
.events = _POLLDEF | type, .data = {val}
};
return epoll_ctl(pool->efd, EPOLL_CTL_MOD, val->fd, &ev);
}
@ -217,7 +217,7 @@ struct eval *next_event(struct poolhd *pool, int *offs, int *typel, int ms)
int mod_etype(struct poolhd *pool, struct eval *val, int type)
{
assert(val->index >= 0 && val->index < pool->count);
pool->pevents[val->index].events = POLLRDHUP | type;
pool->pevents[val->index].events = _POLLDEF | type;
return 0;
}
#endif

View File

@ -31,8 +31,11 @@
#endif
#ifdef __APPLE__
#define POLLRDHUP POLLHUP
#elif !defined POLLRDHUP
#define _POLLDEF POLLHUP
#else
#define _POLLDEF 0
#endif
#ifndef POLLRDHUP
#define POLLRDHUP 0
#endif
#define POLLTIMEOUT 0