0
0
mirror of https://github.com/hufrea/byedpi.git synced 2025-07-04 21:14:18 +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; val->cb = cb;
#ifndef NOEPOLL #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)) { if (epoll_ctl(pool->efd, EPOLL_CTL_ADD, fd, &ev)) {
uniperror("add event"); uniperror("add event");
return 0; return 0;
@ -69,7 +69,7 @@ struct eval *add_event(struct poolhd *pool, evcb_t cb,
struct pollfd *pfd = &(pool->pevents[pool->count]); struct pollfd *pfd = &(pool->pevents[pool->count]);
pfd->fd = fd; pfd->fd = fd;
pfd->events = POLLRDHUP | e; pfd->events = _POLLDEF | e;
pfd->revents = 0; pfd->revents = 0;
#endif #endif
@ -178,7 +178,7 @@ int mod_etype(struct poolhd *pool, struct eval *val, int type)
{ {
assert(val->fd > 0); assert(val->fd > 0);
struct epoll_event ev = { 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); 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) int mod_etype(struct poolhd *pool, struct eval *val, int type)
{ {
assert(val->index >= 0 && val->index < pool->count); assert(val->index >= 0 && val->index < pool->count);
pool->pevents[val->index].events = POLLRDHUP | type; pool->pevents[val->index].events = _POLLDEF | type;
return 0; return 0;
} }
#endif #endif

View File

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