Fix: force the poll() return value to be nb_fd
[lttng-tools.git] / src / common / compat / compat-epoll.c
index 008dba7028dff9d0756914d50c4a1baf7effdbe7..e1672c4c3178afbbce32acddebf2b30cea66fe09 100644 (file)
@@ -1,18 +1,18 @@
 /*
  * Copyright (C)  2011 - David Goulet <david.goulet@polymtl.ca>
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; only version 2 of the License.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2 only,
+ * as published by the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  * more details.
  *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA  02111-1307, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #define _GNU_SOURCE
@@ -43,7 +43,7 @@ int compat_epoll_create(struct lttng_poll_event *events, int size, int flags)
        }
 
        /* Don't bust the limit here */
-       if (size > poll_max_size) {
+       if (size > poll_max_size && poll_max_size != 0) {
                size = poll_max_size;
        }
 
@@ -188,6 +188,10 @@ int compat_epoll_wait(struct lttng_poll_event *events, int timeout)
                goto error;
        }
 
+       /*
+        * Since the returned events are set sequentially in the "events" structure
+        * we only need to return the epoll_wait value and iterate over it.
+        */
        return ret;
 
 error:
This page took 0.024655 seconds and 4 git commands to generate.