- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- select() does not behave correctly for sufficientl...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2011 04:10 PM
11-08-2011 04:10 PM
select() does not behave correctly for sufficiently large timeout values
According to POSIX...
Implementations may place limitations on the maximum timeout interval supported. On all implementations, the maximum timeout interval supported will be at least 31 days. If the timeout argument specifies a timeout interval greater than the implementation-dependent maximum value, the maximum value will be used as the actual timeout value. Implementations may also place limitations on the granularity of timeout intervals. If the requested timeout interval requires a finer granularity than the implementation supports, the actual timeout interval will be rounded up to the next supported value.
In testing our libraries, I discovered that when using sufficiently large timeout values, calls to select() return -1 and set errno to EINVAL. For an implementation that follows the spec, I would expect the call to select() to either timeout before the requested time (the implementation limit was less than the requested timeout and the attribute was never selected), or the call should succeed if the requested attributes were selected.
The following testcase and output illustrate the problem.
[vitek@hokie] 201 % cat t.cpp #include <assert.h> // for assert() #include <string.h> // for memset() used in FD_ZERO on acc-6.25 #include <limits.h> // for LONG_MAX #include <unistd.h> // for STDOUT_FILENO #include <sys/select.h> // for select() int main () { fd_set fds; FD_ZERO(&fds); FD_SET(STDOUT_FILENO, &fds); timeval tv; tv.tv_sec = LONG_MAX; tv.tv_usec = 0; // wait until we can read or write stdout assert (-1 != select (FD_SETSIZE, &fds, &fds, 0, &tv)); return 0; } [vitek@hokie] 202 % aCC +DD32 t.cpp && ./a.out [vitek@hokie] 203 % aCC +DD64 t.cpp && ./a.out Assertion failed: -1 != select (FD_SETSIZE, &fds, &fds, 0, &tv), file t.cpp, line 19 ABORT instruction (core dumped) [vitek@hokie] 204 %
- Tags:
- select
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2011 09:54 PM - edited 11-10-2011 07:49 PM
11-08-2011 09:54 PM - edited 11-10-2011 07:49 PM
Re: select() does not behave correctly for sufficiently large timeout values +DD64
>According to POSIX
Which version? Only 11.31 supports 2003.
Your test case works fine on 11.31 after inserting "struct" before timeval.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2011 02:21 PM
11-09-2011 02:21 PM
Re: select() does not behave correctly for sufficiently large timeout values
Dennis,
I'm fairly certain it was in 1003.1-2003, but the requirement is found in the select() manual page on the HP box I'm testing on. There is a chance that there is a patch we don't have installed that may fix this, but I have doubts. Here is some information that may or may not be pertinent.
[vitek@hokie] 68 % ldd ./a.out ./a.out: libstd_v2.so.1 => /usr/lib/hpux64/libstd_v2.so.1 libCsup.so.1 => /usr/lib/hpux64/libCsup.so.1 libm.so.1 => /usr/lib/hpux64/libm.so.1 libunwind.so.1 => /usr/lib/hpux64/libunwind.so.1 libc.so.1 => /usr/lib/hpux64/libc.so.1 libdl.so.1 => /usr/lib/hpux64/libdl.so.1 libuca.so.1 => /usr/lib/hpux64/libuca.so.1 [vitek@hokie] 69 % ls -l /usr/lib/hpux64/libc.so.1 -r-xr-xr-x 1 bin bin 4898536 Apr 8 2009 /usr/lib/hpux64/libc.so.1 [vitek@hokie] 70 % aCC -V aCC: HP C/aC++ B3910B A.06.25.01 [May 17 2010] [vitek@hokie] 71 % uname -smnrvl HP-UX hokie B.11.31 U ia64 unlimited-user license [vitek@hokie] 72 %
I'm unsure why you'd need to insert the `struct' keyword unless you were compiling with a C compiler. Have you tried compiling with a C++ compiler and the 64-bit compile option as I did above?
Travis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2011 12:41 AM - edited 11-10-2011 07:49 PM
11-10-2011 12:41 AM - edited 11-10-2011 07:49 PM
Re: select() does not behave correctly for sufficiently large timeout values +DD64
>is a chance that there is a patch we don't have installed that may fix this
Oops, I may not have tested it with +DD64, I'll try again.
>I'm unsure why you'd need to insert the `struct' keyword unless you were compiling with a C compiler.
Right. If you are testing libc, you should have a test case that works with both C and C++.
In general, if you have a pure C interface, it's probably good idea to insert the optional "struct" keyword.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2011 07:47 PM - edited 11-10-2011 07:57 PM
11-10-2011 07:47 PM - edited 11-10-2011 07:57 PM
Re: select() does not behave correctly for sufficiently large timeout values +DD64
>I may not have tested it with +DD64, I'll try again.
You're right, it fails there for me with EINVAL.
You need to contact the Response Center to see if there is a patch for it.
A quick check indicates the kernel only checks the tv_usec field but I'm looking at the latest sources.