+/*
+ * Modify an fd's events..
+ */
+int compat_poll_mod(struct lttng_poll_event *events, int fd,
+ uint32_t req_events)
+{
+ int i;
+ struct compat_poll_event_array *current;
+
+ if (events == NULL || events->current.nb_fd == 0 ||
+ events->current.events == NULL || fd < 0) {
+ ERR("Bad compat poll mod arguments");
+ goto error;
+ }
+
+ current = &events->current;
+
+ for (i = 0; i < current->nb_fd; i++) {
+ if (current->events[i].fd == fd) {
+ current->events[i].events = req_events;
+ events->need_update = 1;
+ break;
+ }
+ }
+
+ /*
+ * The epoll flavor doesn't flag modifying a non-included FD as an
+ * error.
+ */
+
+ return 0;
+
+error:
+ return -1;
+}
+