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 --- I can provide a simple test program which reproduces that behaviour if desired.
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 );
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- server/sock.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/server/sock.c b/server/sock.c index 5f207e7f180..8c146a0a8f8 100644 --- a/server/sock.c +++ b/server/sock.c @@ -1473,7 +1473,11 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) return 0; }
- if (!(req = alloc_accept_req( acceptsock, async, params ))) return 0; + if (!(req = alloc_accept_req( acceptsock, async, params ))) + { + release_object( acceptsock ); + return 0; + } list_add_tail( &sock->accept_list, &req->entry ); acceptsock->accept_recv_req = req; release_object( acceptsock );