[MLton] Port of OpenBSD to MLton

Stephen Weeks MLton@mlton.org
Sat, 12 Jun 2004 20:57:22 -0700

> Patch for OpenBSD follows. 

Thanks.   I've applied the patch and committed it.

> ; OpenBSD does not define _PC_SYNC_IO for the fpathconf()
>   system call. I've set the value to 0, but I am not sure
>   this is correct.

That looks good to me.  It will cause a call to
Posix.FileSys.{f,}pathconf with "SYNC_IO" to raise SysErr inval.

> ; The socket.sml regression fails, but this is due to 
>   OpenBSD handling it that way rather than an error in
>   MLton. A little test I made with my webserver pulled
>   data from it without problems.

It seems that the problem with the test is that the parent process
connects to the socket before the child has accepted -- and unlike all
our other platforms, OpenBSD chooses to implement this as failure
rather than completing the connect and waiting for the other end to
accept.  Jesper, do you agree that that is the problem?  Any ideas on
how to fix it?  I'm willing to change the regression test.

> ; Nitpick: Do we want the OS's listed in alphabetical 
>   order? I've done it for the #defines, but not for the
>   case xxx of ... statements

Yes, I went ahead and put things in order.

With the patch, I built MLton for OpenBSD and everything worked fine
(other than the socket problem).  The package is at


I built the package by cross compiling from a Linux machine, since I
can't bootstrap on OpenBSD because I can't get OpenBSD to let me have
more than 256M memory for my processes.  I've tried using ulimit -d,
but to no avail.  Jesper, any ideas?  My machine has 1G RAM and when I
login as root, OpenBSD gives it to me.  But it won't let me have it
with a normal user account.  Once I've fixed that problem, I'll build
again, this time by bootstrapping on the OpenBSD machine.