Whamcloud - gitweb
- landing of b_hd_cleanup_merge to HEAD.
[fs/lustre-release.git] / lnet / ulnds / socklnd / select.c
index c4f84f4..c4ccae1 100644 (file)
@@ -4,19 +4,19 @@
  *  Copyright (c) 2002 Cray Inc.
  *  Copyright (c) 2002 Eric Hoffman
  *
- *   This file is part of Portals, http://www.sf.net/projects/sandiaportals/
+ *   This file is part of Lustre, http://www.lustre.org.
  *
- *   Portals is free software; you can redistribute it and/or
- *   modify it under the terms of version 2.1 of the GNU Lesser General
- *   Public License as published by the Free Software Foundation.
+ *   Lustre is free software; you can redistribute it and/or
+ *   modify it under the terms of version 2 of the GNU General Public
+ *   License as published by the Free Software Foundation.
  *
- *   Portals is distributed in the hope that it will be useful,
+ *   Lustre 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 Lesser General Public License for more details.
+ *   GNU General Public License for more details.
  *
- *   You should have received a copy of the GNU Lesser General Public
- *   License along with Portals; if not, write to the Free Software
+ *   You should have received a copy of the GNU General Public License
+ *   along with Lustre; if not, write to the Free Software
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
@@ -97,9 +97,9 @@ void remove_io_handler (io_handler i)
 
 static void set_flag(io_handler n,fd_set *fds)
 {
-    if (n->type & READ_HANDLER) FD_SET(n->fd,fds);
-    if (n->type & WRITE_HANDLER) FD_SET(n->fd,fds+1);
-    if (n->type & EXCEPTION_HANDLER) FD_SET(n->fd,fds+2);
+    if (n->type & READ_HANDLER) FD_SET(n->fd, &fds[0]);
+    if (n->type & WRITE_HANDLER) FD_SET(n->fd,&fds[1]);
+    if (n->type & EXCEPTION_HANDLER) FD_SET(n->fd, &fds[2]);
 }
 
 
@@ -126,9 +126,9 @@ void select_timer_block(when until)
         timeout_pointer=&timeout;
     } else timeout_pointer=0;
 
-    FD_ZERO(fds);
-    FD_ZERO(fds+1);
-    FD_ZERO(fds+2);
+    FD_ZERO(&fds[0]);
+    FD_ZERO(&fds[1]);
+    FD_ZERO(&fds[2]);
     for (k=&io_handlers;*k;){
         if ((*k)->disabled){
             j=*k;
@@ -140,14 +140,15 @@ void select_timer_block(when until)
            k=&(*k)->next;
        }
     }
-    result=select(FD_SETSIZE,fds,fds+1,fds+2,timeout_pointer);
+
+    result=select(FD_SETSIZE, &fds[0], &fds[1], &fds[2], timeout_pointer);
 
     if (result > 0)
         for (j=io_handlers;j;j=j->next){
             if (!(j->disabled) && 
-                ((FD_ISSET(j->fd,fds) && (j->type & READ_HANDLER)) ||
-                 (FD_ISSET(j->fd,fds+1) && (j->type & WRITE_HANDLER)) ||
-                 (FD_ISSET(j->fd,fds+2) && (j->type & EXCEPTION_HANDLER)))){
+                ((FD_ISSET(j->fd, &fds[0]) && (j->type & READ_HANDLER)) ||
+                 (FD_ISSET(j->fd, &fds[1]) && (j->type & WRITE_HANDLER)) ||
+                 (FD_ISSET(j->fd, &fds[2]) && (j->type & EXCEPTION_HANDLER)))){
                 if (!(*j->function)(j->argument))
                     j->disabled=1;
             }