[MLton] a few remaining Solaris bugs with the new runtime

Stephen Weeks sweeks@sweeks.com
Thu, 13 Jul 2006 14:08:55 -0700


> I've successfully cross-compiled MLton to run on Solaris with the new
> runtime.  The resulting MLton compiles all the regressions, and there
> is only one regression failure: echo.sml, which reports
> 
>   unhandled exception: Error
> 
> instead of
> 
>   server processed 1900 bytes
> 
> The only other failures I see are in testing the stuff in
> doc/examples.  ffi/export fails with
> 
>   Illegal Instruction (core dumped)
> 
> and profile/tak, when compiled with -profile time, segfaults.

I've fixed the profiling and FFI bugs.  The only remaning bug on
Solaris is the echo regression failure.  Looking with truss, I see
that the following system call fails:

  setsockopt(4, 65535, 4, 0x7F921608, 8, 1)       Err#22 EINVAL

The problem seems to be the "8", which the the "optlen" argument to
setsockopt.

  int setsockopt(int s, int level, int optname, const void *optval, int optlen);

That length is computed in basis-library/net/socket.sml with

  val intLen = Int.quot (C_Int.precision', 4)

What I don't understand is why the precision is divided by 4 (yielding
8) and not 8 (yielding 4, which I think is the correct value for
optlen).  The same question applies to the definition of sizeLen in
the same file.

  val sizeLen = Int.quot (C_Size.wordSize, 4)

If I change those 4's to 8's, the echo regression works fine on
Solaris.