[torquedev] poll() vs select() in torque

Michael Barnes barnes at jlab.org
Wed Mar 25 14:06:08 MDT 2009


On Wed, Mar 25, 2009 at 01:19:59PM -0600, Josh Butikofer wrote:
> Hmmmm...I don't know how those snuck past. The repository has these lines 
> of code in it already. We must have made the patch incorrectly.
> 
> In any case, good catch. :)


I may of caught a bigger bug:

-  tv.tv_sec = timeout;
-  tv.tv_usec = 0;
+  /*
+   * some operating systems (like FreeBSD) cannot have a value for tv.tv_usec
+   * larger than 1,000,000 so we need to split up the timeout duration between
+   * seconds and microseconds
+   */

-  FD_ZERO(&fs);
-  FD_SET(sockd, &fs);
+  tv.tv_sec = timeout / 1000000;
+  tv.tv_usec = timeout % 1000000;


If the API hasn't changed (ie, timeout is expected in seconds, not
microseconds), then this is a bug.

-mb

-- 
+-----------------------------------------------
| Michael Barnes
|
| Thomas Jefferson National Accelerator Facility
| 12000 Jefferson Ave.
| Newport News, VA 23606
| (757) 269-7634
+-----------------------------------------------



More information about the torquedev mailing list