diff --git a/patches/eventfd_synchronization/0020-server-Create-eventfd-file-descriptors-for-message-q.patch b/patches/eventfd_synchronization/0020-server-Create-eventfd-file-descriptors-for-message-q.patch index 242e6f11..b72c5f48 100644 --- a/patches/eventfd_synchronization/0020-server-Create-eventfd-file-descriptors-for-message-q.patch +++ b/patches/eventfd_synchronization/0020-server-Create-eventfd-file-descriptors-for-message-q.patch @@ -1,17 +1,17 @@ -From 2da453ad472ce69926e158bd4e933facd985d1cd Mon Sep 17 00:00:00 2001 +From a273680e7cbdc66e9fdb6fd6482803ddfed94dca Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 16:01:56 -0500 Subject: [PATCH] server: Create eventfd file descriptors for message queues. --- - server/queue.c | 22 +++++++++++++++++++++- - 1 file changed, 21 insertions(+), 1 deletion(-) + server/queue.c | 29 ++++++++++++++++++++++++++++- + 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/server/queue.c b/server/queue.c -index 1f1392387df..d34bc284d08 100644 +index b6decc521e9..e70c0f5ad81 100644 --- a/server/queue.c +++ b/server/queue.c -@@ -43,6 +43,7 @@ +@@ -41,6 +41,7 @@ #include "process.h" #include "request.h" #include "user.h" @@ -19,7 +19,7 @@ index 1f1392387df..d34bc284d08 100644 #define WM_NCMOUSEFIRST WM_NCMOUSEMOVE #define WM_NCMOUSELAST (WM_NCMOUSEFIRST+(WM_MOUSELAST-WM_MOUSEFIRST)) -@@ -144,6 +145,7 @@ struct msg_queue +@@ -142,6 +143,7 @@ struct msg_queue timeout_t last_get_msg; /* time of last get message call */ int keystate_lock; /* owns an input keystate lock */ unsigned int ignore_post_msg; /* ignore post messages newer than this unique id */ @@ -27,7 +27,7 @@ index 1f1392387df..d34bc284d08 100644 }; struct hotkey -@@ -160,6 +162,7 @@ static void msg_queue_dump( struct object *obj, int verbose ); +@@ -158,6 +160,7 @@ static void msg_queue_dump( struct object *obj, int verbose ); static int msg_queue_add_queue( struct object *obj, struct wait_queue_entry *entry ); static void msg_queue_remove_queue( struct object *obj, struct wait_queue_entry *entry ); static int msg_queue_signaled( struct object *obj, struct wait_queue_entry *entry ); @@ -35,7 +35,7 @@ index 1f1392387df..d34bc284d08 100644 static void msg_queue_satisfied( struct object *obj, struct wait_queue_entry *entry ); static void msg_queue_destroy( struct object *obj ); static void msg_queue_poll_event( struct fd *fd, int event ); -@@ -175,7 +178,7 @@ static const struct object_ops msg_queue_ops = +@@ -173,7 +176,7 @@ static const struct object_ops msg_queue_ops = msg_queue_add_queue, /* add_queue */ msg_queue_remove_queue, /* remove_queue */ msg_queue_signaled, /* signaled */ @@ -44,7 +44,7 @@ index 1f1392387df..d34bc284d08 100644 msg_queue_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ -@@ -315,12 +318,16 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_ +@@ -313,12 +316,16 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_ queue->last_get_msg = current_time; queue->keystate_lock = 0; queue->ignore_post_msg = 0; @@ -61,7 +61,7 @@ index 1f1392387df..d34bc284d08 100644 thread->queue = queue; } if (new_input) release_object( new_input ); -@@ -534,6 +541,9 @@ static inline void clear_queue_bits( struct msg_queue *queue, unsigned int bits +@@ -533,6 +540,9 @@ static inline void clear_queue_bits( struct msg_queue *queue, unsigned int bits if (queue->keystate_lock) unlock_input_keystate( queue->input ); queue->keystate_lock = 0; } @@ -71,7 +71,7 @@ index 1f1392387df..d34bc284d08 100644 } /* check whether msg is a keyboard message */ -@@ -1047,6 +1057,13 @@ static int msg_queue_signaled( struct object *obj, struct wait_queue_entry *entr +@@ -1046,6 +1056,13 @@ static int msg_queue_signaled( struct object *obj, struct wait_queue_entry *entr return ret || is_signaled( queue ); } @@ -85,7 +85,17 @@ index 1f1392387df..d34bc284d08 100644 static void msg_queue_satisfied( struct object *obj, struct wait_queue_entry *entry ) { struct msg_queue *queue = (struct msg_queue *)obj; -@@ -2425,6 +2442,9 @@ DECL_HANDLER(get_queue_status) +@@ -2485,6 +2502,9 @@ DECL_HANDLER(set_queue_mask) + if (req->skip_wait) queue->wake_mask = queue->changed_mask = 0; + else wake_up( &queue->obj, 0 ); + } ++ ++ if (do_esync() && !is_signaled( queue )) ++ esync_clear( queue->esync_fd ); + } + } + +@@ -2498,6 +2518,9 @@ DECL_HANDLER(get_queue_status) reply->wake_bits = queue->wake_bits; reply->changed_bits = queue->changed_bits; queue->changed_bits &= ~req->clear_bits; @@ -95,6 +105,17 @@ index 1f1392387df..d34bc284d08 100644 } else reply->wake_bits = reply->changed_bits = 0; } +@@ -2746,6 +2769,10 @@ DECL_HANDLER(get_message) + queue->wake_mask = req->wake_mask; + queue->changed_mask = req->changed_mask; + set_error( STATUS_PENDING ); /* FIXME */ ++ ++ if (do_esync() && !is_signaled( queue )) ++ esync_clear( queue->esync_fd ); ++ + return; + + found_msg: -- -2.30.2 +2.34.1