[MLton] cvs commit: Added PosixError.SysCall structure.

Stephen Weeks MLton@mlton.org
Fri, 30 Apr 2004 11:31:16 -0700


> I can move the assignment to blocker to the let, but not Mask.handled.

That seems sufficient.

> Note, unfortunately, if an ML handled signal arrives while the signals are
> blocked, unblocking the signals don't seem to deliver those signals.  So,
> we might miss some signals here.

Odd.  I'm 99% sure the OS is supposed to hold onto the signals and
deliver them when the program unblocks.

> > BTW, another thing I noticed is that syscall is only restarting if the
> > error is EINTR.  I think EAGAIN should also cause a restart.
> 
> O.k.  In one of the past emails, there is a reference to ERESTART (which I
> couldn't find documented anywhere else), but I guess it should have been
> EAGAIN.

I'm confused.  We have EAGAIN, ERESTART, and EINTR.  I think
restarting on EINTR is clearly right.  I've only heard of ERESTART
from Henry.  As to EAGAIN, I take back what I said.  I think that
sometimes it used to mean that a system call was interrupted, but it
can clearly mean other things that should not cause a restart.  For
example, the man pages for fcntl and write say

write
	EAGAIN Non-blocking  I/O  has  been  selected  using O_NONBLOCK and the
              write would block.

fcntl
       EACCES or EAGAIN
              Operation is prohibited by locks held by other  processes.   Or,
              operation  is prohibited because the file has been memory-mapped
              by another process.

We may in the end have to extend syscall to take an argument that
gives a list of other error codes that should cause a restart.  But
for now, just doing EINTR is safest.