+
+/* It turns out you can't just update the pollfd->reqevents
+ * field. Instead you have to remove the pollfd and reregister
+ * it in the pollset.
+ */
+static void
+modify_pollfd_reqevents (struct guest_description *hval,
+ apr_int16_t new_reqevents)
+{
+ apr_status_t r;
+
+ if (hval->pollfd.reqevents != new_reqevents) {
+ r = apr_pollset_remove (set, &hval->pollfd);
+ if (r != APR_SUCCESS) {
+ paprerror (r, "%s: apr_pollset_remove", hval->name);
+ return;
+ }
+
+ hval->pollfd.reqevents = new_reqevents;
+ r = apr_pollset_add (set, &hval->pollfd);
+ if (r != APR_SUCCESS)
+ paprerror (r, "%s: apr_pollset_add", hval->name);
+ }
+}