Zebediah Figura : server: Use default_fd_get_poll_events() for file objects.

Alexandre Julliard julliard at winehq.org
Fri Jan 22 15:59:14 CST 2021


Module: wine
Branch: master
Commit: 70d12630716f1edf28f555abdd2ea306711140d4
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=70d12630716f1edf28f555abdd2ea306711140d4

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Thu Jan 21 18:16:41 2021 -0600

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 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 server/file.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/server/file.c b/server/file.c
index 2cc4a9d978c..fd8e3f96033 100644
--- a/server/file.c
+++ b/server/file.c
@@ -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 );




More information about the wine-cvs mailing list