Skip to content

Commit

Permalink
autoformat
Browse files Browse the repository at this point in the history
  • Loading branch information
jiixyj committed Jun 8, 2024
1 parent 538cf42 commit 0cf7c44
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
18 changes: 10 additions & 8 deletions src/epollfd_ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,9 @@ registered_fds_node_feed_event(RegisteredFDsNode *fd2_node, int kq,
assert(!(fd2_node->revents &
~(uint32_t)(POLLIN | POLLOUT | POLLERR | POLLHUP
#ifdef POLLRDHUP
| POLLRDHUP
| POLLRDHUP
#endif
)));
)));
goto maybe_translate_rdhup;
}

Expand Down Expand Up @@ -577,7 +577,8 @@ registered_fds_node_feed_event(RegisteredFDsNode *fd2_node, int kq,
}

maybe_translate_rdhup:
if ((fd2_node->revents & EPOLLRDHUP) != 0 && fd2_node->needs_rdhup_translation) {
if ((fd2_node->revents & EPOLLRDHUP) != 0 &&
fd2_node->needs_rdhup_translation) {
fd2_node->revents &= ~EPOLLRDHUP;
fd2_node->revents |= 0x2000;
}
Expand Down Expand Up @@ -1253,11 +1254,12 @@ epollfd_ctx_ctl(EpollFDCtx *epollfd, int kq, int op, int fd2,

if (op != EPOLL_CTL_DEL &&
((ev->events &
~(uint32_t)(EPOLLIN | EPOLLOUT | EPOLLRDHUP | 0x2000 | /**/
EPOLLPRI | /* unsupported by FreeBSD's kqueue! */
EPOLLHUP | EPOLLERR | /**/
EPOLLET | EPOLLONESHOT)) != 0 ||
(EPOLLRDHUP != 0x2000 && (ev->events & EPOLLRDHUP) != 0 && (ev->events & 0x2000) != 0))) {
~(uint32_t)(EPOLLIN | EPOLLOUT | EPOLLRDHUP | 0x2000 | /**/
EPOLLPRI | /* unsupported by FreeBSD's kqueue! */
EPOLLHUP | EPOLLERR | /**/
EPOLLET | EPOLLONESHOT)) != 0 ||
(EPOLLRDHUP != 0x2000 && (ev->events & EPOLLRDHUP) != 0 &&
(ev->events & 0x2000) != 0))) {
return EINVAL;
}

Expand Down
10 changes: 5 additions & 5 deletions test/epoll-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@ ATF_TC_BODY_FD_LEAKCHECK(epoll__rdhup_linux, tcptr)
struct epoll_event event = {
.events = EPOLLIN | EPOLLRDHUP | 0x2000 | EPOLLPRI | EPOLLET,
};
ATF_REQUIRE_ERRNO(EINVAL, epoll_ctl(ep, EPOLL_CTL_ADD, fds[0], &event) < 0);
ATF_REQUIRE_ERRNO(EINVAL,
epoll_ctl(ep, EPOLL_CTL_ADD, fds[0], &event) < 0);

ATF_REQUIRE(close(ep) == 0);
ATF_REQUIRE(close(fds[0]) == 0);
Expand Down Expand Up @@ -2015,12 +2016,11 @@ ATF_TC_BODY_FD_LEAKCHECK(epoll__epoll_pwait, tcptr)
int n = ppoll(
#endif
&pfd, 1,
&(struct timespec) {
0,
&(struct timespec) { 0,
#if defined(__DragonFly__)
1
1
#else
0
0
#endif
},
&emptyset);
Expand Down

0 comments on commit 0cf7c44

Please sign in to comment.