[MLton-commit] r4462

Matthew Fluet MLton@mlton.org
Sat, 6 May 2006 08:35:56 -0700


Bugfixes for signal masks
----------------------------------------------------------------------

U   mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/mlton/signal.sml
U   mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/posix/process.sml

----------------------------------------------------------------------

Modified: mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/mlton/signal.sml
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/mlton/signal.sml	2006-05-06 02:31:26 UTC (rev 4461)
+++ mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/mlton/signal.sml	2006-05-06 15:35:55 UTC (rev 4462)
@@ -29,7 +29,11 @@
 val validSignals = 
    Array.tabulate 
    (C_Int.toInt Prim.NSIG, fn i => 
-    (C_Errno.check (Prim.sigismember(fromInt i))) <> (C_Int.fromInt ~1))
+    SysCall.syscallErr
+    ({clear = false, restart = false, errVal = C_Int.fromInt ~1}, fn () =>
+     {return = Prim.sigismember (fromInt i),
+      post = fn _ => true,
+      handlers = [(Error.inval, fn () => false)]}))
 
 structure Mask =
    struct
@@ -48,9 +52,16 @@
          (Array.foldri
           (fn (i, b, sigs) =>
            if b
-              then if (C_Errno.check (Prim.sigismember(fromInt i))) = (C_Int.fromInt ~1)
-                      then sigs
-                      else (fromInt i)::sigs
+              then let
+                      val s = fromInt i
+                      val res =
+                         SysCall.simpleResult
+                         (fn () => Prim.sigismember s)
+                   in
+                      if res = C_Int.fromInt 1
+                         then s::sigs
+                         else sigs
+                   end
               else sigs)
           []
           validSignals)
@@ -101,11 +112,11 @@
    val r = ref false
 in
    fun initHandler (s: signal): Handler.t =
-      if C_Errno.check (Prim.isDefault (s, r)) = C_Int.fromInt 0
-         then if !r
-                 then Default
-              else Ignore
-      else InvalidSignal
+      SysCall.syscallErr
+      ({clear = false, restart = false, errVal = C_Int.fromInt ~1}, fn () =>
+       {return = Prim.isDefault (s, r),
+        post = fn _ => if !r then Default else Ignore,
+        handlers = [(Error.inval, fn () => InvalidSignal)]})
 end
 
 val (getHandler, setHandler, handlers) =

Modified: mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/posix/process.sml
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/posix/process.sml	2006-05-06 02:31:26 UTC (rev 4461)
+++ mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/posix/process.sml	2006-05-06 15:35:55 UTC (rev 4462)
@@ -168,7 +168,7 @@
                handle Overflow => Error.raiseSys Error.inval)))
       in
          val alarm = wrap Prim.alarm
-(*       val sleep = wrap Prim.sleep *)
+         (* val sleep = wrap Prim.sleep *)
       end
 
       fun sleep (t: Time.time): Time.time =