aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2017-07-16 23:51:03 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2017-11-28 11:07:13 -0500
commitfb3679372bd7967f39ea48e701fcd1e8f55e75cd (patch)
tree371c4e45a7ef3cd7e280cb51712d9cda82b49a9d
parent7594bf37ae9ffc434da425120c576909eb33b0bc (diff)
annotate poll(2) guts
struct pollfd contains two 16bit fields (mask and result) that encode the POLL... bitmaps. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/select.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/select.c b/fs/select.c
index 8d6d47912134..b2deeb215dbe 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -803,9 +803,9 @@ struct poll_list {
803 * pwait poll_table will be used by the fd-provided poll handler for waiting, 803 * pwait poll_table will be used by the fd-provided poll handler for waiting,
804 * if pwait->_qproc is non-NULL. 804 * if pwait->_qproc is non-NULL.
805 */ 805 */
806static inline unsigned int do_pollfd(struct pollfd *pollfd, poll_table *pwait, 806static inline __poll_t do_pollfd(struct pollfd *pollfd, poll_table *pwait,
807 bool *can_busy_poll, 807 bool *can_busy_poll,
808 unsigned int busy_flag) 808 __poll_t busy_flag)
809{ 809{
810 __poll_t mask; 810 __poll_t mask;
811 int fd; 811 int fd;
@@ -816,20 +816,24 @@ static inline unsigned int do_pollfd(struct pollfd *pollfd, poll_table *pwait,
816 struct fd f = fdget(fd); 816 struct fd f = fdget(fd);
817 mask = POLLNVAL; 817 mask = POLLNVAL;
818 if (f.file) { 818 if (f.file) {
819 /* userland u16 ->events contains POLL... bitmap */
820 __poll_t filter = (__force __poll_t)pollfd->events |
821 POLLERR | POLLHUP;
819 mask = DEFAULT_POLLMASK; 822 mask = DEFAULT_POLLMASK;
820 if (f.file->f_op->poll) { 823 if (f.file->f_op->poll) {
821 pwait->_key = pollfd->events|POLLERR|POLLHUP; 824 pwait->_key = filter;
822 pwait->_key |= busy_flag; 825 pwait->_key |= busy_flag;
823 mask = f.file->f_op->poll(f.file, pwait); 826 mask = f.file->f_op->poll(f.file, pwait);
824 if (mask & busy_flag) 827 if (mask & busy_flag)
825 *can_busy_poll = true; 828 *can_busy_poll = true;
826 } 829 }
827 /* Mask out unneeded events. */ 830 /* Mask out unneeded events. */
828 mask &= pollfd->events | POLLERR | POLLHUP; 831 mask &= filter;
829 fdput(f); 832 fdput(f);
830 } 833 }
831 } 834 }
832 pollfd->revents = mask; 835 /* ... and so does ->revents */
836 pollfd->revents = (__force u16)mask;
833 837
834 return mask; 838 return mask;
835} 839}
@@ -841,7 +845,7 @@ static int do_poll(struct poll_list *list, struct poll_wqueues *wait,
841 ktime_t expire, *to = NULL; 845 ktime_t expire, *to = NULL;
842 int timed_out = 0, count = 0; 846 int timed_out = 0, count = 0;
843 u64 slack = 0; 847 u64 slack = 0;
844 unsigned int busy_flag = net_busy_loop_on() ? POLL_BUSY_LOOP : 0; 848 __poll_t busy_flag = net_busy_loop_on() ? POLL_BUSY_LOOP : 0;
845 unsigned long busy_start = 0; 849 unsigned long busy_start = 0;
846 850
847 /* Optimise the no-wait case */ 851 /* Optimise the no-wait case */