[Issue 5677] New: Calling Socket.select with a timeval hangs using -m64 on linux

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 1 11:53:13 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5677

           Summary: Calling Socket.select with a timeval hangs using -m64
                    on linux
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: benshiflet at gmail.com


--- Comment #0 from benshiflet at gmail.com 2011-03-01 11:50:22 PST ---
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).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list