aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2018-02-01 15:21:13 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2018-02-01 16:29:49 -0500
commitd7ebbe46f445d8c64fa37812818597dc466d74bb (patch)
treee838166b2931d8339a4c49e346e9093ba3191f20
parente78cd95bebd94ede71285722f5bf2464bfa4c599 (diff)
ep_send_events_proc(): return result via esed->res
preparations for not mixing __poll_t and int in ep_scan_ready_list() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/eventpoll.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 42e35a6977c9..87452875eaec 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -260,6 +260,7 @@ struct ep_pqueue {
260struct ep_send_events_data { 260struct ep_send_events_data {
261 int maxevents; 261 int maxevents;
262 struct epoll_event __user *events; 262 struct epoll_event __user *events;
263 int res;
263}; 264};
264 265
265/* 266/*
@@ -1616,7 +1617,6 @@ static int ep_send_events_proc(struct eventpoll *ep, struct list_head *head,
1616 void *priv) 1617 void *priv)
1617{ 1618{
1618 struct ep_send_events_data *esed = priv; 1619 struct ep_send_events_data *esed = priv;
1619 int eventcnt;
1620 unsigned int revents; 1620 unsigned int revents;
1621 struct epitem *epi; 1621 struct epitem *epi;
1622 struct epoll_event __user *uevent; 1622 struct epoll_event __user *uevent;
@@ -1630,8 +1630,8 @@ static int ep_send_events_proc(struct eventpoll *ep, struct list_head *head,
1630 * Items cannot vanish during the loop because ep_scan_ready_list() is 1630 * Items cannot vanish during the loop because ep_scan_ready_list() is
1631 * holding "mtx" during this call. 1631 * holding "mtx" during this call.
1632 */ 1632 */
1633 for (eventcnt = 0, uevent = esed->events; 1633 for (esed->res = 0, uevent = esed->events;
1634 !list_empty(head) && eventcnt < esed->maxevents;) { 1634 !list_empty(head) && esed->res < esed->maxevents;) {
1635 epi = list_first_entry(head, struct epitem, rdllink); 1635 epi = list_first_entry(head, struct epitem, rdllink);
1636 1636
1637 /* 1637 /*
@@ -1665,9 +1665,11 @@ static int ep_send_events_proc(struct eventpoll *ep, struct list_head *head,
1665 __put_user(epi->event.data, &uevent->data)) { 1665 __put_user(epi->event.data, &uevent->data)) {
1666 list_add(&epi->rdllink, head); 1666 list_add(&epi->rdllink, head);
1667 ep_pm_stay_awake(epi); 1667 ep_pm_stay_awake(epi);
1668 return eventcnt ? eventcnt : -EFAULT; 1668 if (!esed->res)
1669 esed->res = -EFAULT;
1670 return 0;
1669 } 1671 }
1670 eventcnt++; 1672 esed->res++;
1671 uevent++; 1673 uevent++;
1672 if (epi->event.events & EPOLLONESHOT) 1674 if (epi->event.events & EPOLLONESHOT)
1673 epi->event.events &= EP_PRIVATE_BITS; 1675 epi->event.events &= EP_PRIVATE_BITS;
@@ -1689,7 +1691,7 @@ static int ep_send_events_proc(struct eventpoll *ep, struct list_head *head,
1689 } 1691 }
1690 } 1692 }
1691 1693
1692 return eventcnt; 1694 return 0;
1693} 1695}
1694 1696
1695static int ep_send_events(struct eventpoll *ep, 1697static int ep_send_events(struct eventpoll *ep,
@@ -1700,7 +1702,8 @@ static int ep_send_events(struct eventpoll *ep,
1700 esed.maxevents = maxevents; 1702 esed.maxevents = maxevents;
1701 esed.events = events; 1703 esed.events = events;
1702 1704
1703 return ep_scan_ready_list(ep, ep_send_events_proc, &esed, 0, false); 1705 ep_scan_ready_list(ep, ep_send_events_proc, &esed, 0, false);
1706 return esed.res;
1704} 1707}
1705 1708
1706static inline struct timespec64 ep_set_mstimeout(long ms) 1709static inline struct timespec64 ep_set_mstimeout(long ms)