server: Use default_fd_get_poll_events() for file objects.

This avoids sending the server into a busy-loop when trying to perform an
asynchronous read from a non-regular file (say, a FIFO).

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-01-21 18:16:41 -06:00 committed by Alexandre Julliard
parent fe11ff87ac
commit 70d1263071
1 changed files with 1 additions and 12 deletions

View File

@ -75,7 +75,6 @@ static struct object *file_open_file( struct object *obj, unsigned int access,
static struct list *file_get_kernel_obj_list( struct object *obj );
static void file_destroy( struct object *obj );
static int file_get_poll_events( struct fd *fd );
static enum server_fd_type file_get_fd_type( struct fd *fd );
static const struct object_ops file_ops =
@ -104,7 +103,7 @@ static const struct object_ops file_ops =
static const struct fd_ops file_fd_ops =
{
file_get_poll_events, /* get_poll_events */
default_fd_get_poll_events, /* get_poll_events */
default_poll_event, /* poll_event */
file_get_fd_type, /* get_fd_type */
no_fd_read, /* read */
@ -287,16 +286,6 @@ struct object_type *file_get_type( struct object *obj )
return get_object_type( &str );
}
static int file_get_poll_events( struct fd *fd )
{
struct file *file = get_fd_user( fd );
int events = 0;
assert( file->obj.ops == &file_ops );
if (file->access & FILE_UNIX_READ_ACCESS) events |= POLLIN;
if (file->access & FILE_UNIX_WRITE_ACCESS) events |= POLLOUT;
return events;
}
static enum server_fd_type file_get_fd_type( struct fd *fd )
{
struct file *file = get_fd_user( fd );