epoll_wait - 35 minutes equals infinity?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I was doing epoll_wait calls with timeout values of over an hour and I was
wondering why the call never returned. Then I read the code in
fs/eventpoll.c:

#define EP_MAX_MSTIMEO min(1000ULL * MAX_SCHEDULE_TIMEOUT / HZ, (LONG_MAX -
999ULL) / HZ)
...
jtimeout = (timeout < 0 || timeout >= EP_MAX_MSTIMEO) ?
		MAX_SCHEDULE_TIMEOUT : (timeout * HZ + 999) / 1000;

I.e., with LONG_MAX of 2^31-1 and HZ=1000, any timeouts larger than 35
minutes are treated the same as -1 ("infinity").
Although I'm using 2.6.24, the code doesn't seem to have changed in 2.6.35.
I'm apparently not the first to have this problem
(http://www.provos.org/index.php?/archives/36-Libevent-1.4.4-stable-released
.html).

I suppose it is too late to change the interface to return an error when
setting too high a timeout and too tricky to fix epoll_wait to accept all
positive ints as timeouts.
Still, shouldn't the man page mention that there is a maximum allowable
value to the timeout and that it depends on whether you have a 64- or 32-bit
machine and what the timer frequency is?

/Fredrik Arnerup

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux