Bug 5677 – Calling Socket.select with a timeval hangs using -m64 on linux

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2011-03-01T11:50:00Z
Last change time
2011-07-02T02:53:14Z
Assigned to
nobody
Creator
benshiflet

Comments

Comment #0 by benshiflet — 2011-03-01T11:50:22Z
Calling Socket.select with a timeval hangs using -m64 on linux (Ubuntu 10.10), but works fine with -m32 (I'm using DMD 2.052). To reproduce, save the following lines to a file (bug.d): import std.stdio, std.socket; void main(string[] args) { writeln("About to call select..."); Socket.select(null, null, null, 2_000_000); // 2s writeln("Select has returned."); } The following correctly returns after 2s: dmd -m32 bug.d && ./bug But the following hangs: dmd -m64 bug.d && ./bug Using strace shows the issue: dmd -m32 bug.d && strace ./bug prints: select(0, NULL, NULL, NULL, {2, 0}) dmd -m64 bug.d && strace ./bug prints: select(0, NULL, NULL, NULL, {2, 140733585617248} Speculation: I believe this happens because std/socket.d defines 'struct timeval' as two ints, whereas druntime/src/core/sys/posix/sys/time.d defines it as (time_t, suseconds_t).
Comment #1 by izenja — 2011-07-02T02:53:14Z