Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/system/Basis/Implementation/Posix/posix-process.sml
ViewVC logotype

Diff of /sml/trunk/src/system/Basis/Implementation/Posix/posix-process.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 416, Fri Sep 3 23:50:31 1999 UTC revision 1506, Thu Jun 17 22:19:15 2004 UTC
# Line 17  Line 17 
17    
18      structure Sig = POSIX_Signal      structure Sig = POSIX_Signal
19    
     val ++ = SysWord.orb  
     val & = SysWord.andb  
     infix ++ &  
   
20      type word = SysWord.word      type word = SysWord.word
21      type s_int = SysInt.int      type s_int = SysInt.int
22    
# Line 84  Line 80 
80        | mkExitStatus (1,s) = W_SIGNALED (Sig.SIG s)        | mkExitStatus (1,s) = W_SIGNALED (Sig.SIG s)
81        | mkExitStatus (_,s) = W_STOPPED (Sig.SIG s)        | mkExitStatus (_,s) = W_STOPPED (Sig.SIG s)
82    
83        fun fromStatus s = mkExitStatus (Int.quot (s, 256), Int.rem (s, 256))
84    
85      val wnohang = w_osval "WNOHANG"      structure W = struct
86      structure W =          local structure W0 = BitFlagsFn ()
87        struct          in
88          datatype flags = WF of word              open W0
89            end
         fun fromWord w = WF w  
         fun toWord (WF w) = w  
   
         fun flags ms = WF(List.foldl (fn (WF m,acc) => m ++ acc) 0w0 ms)  
         fun anySet (WF m, WF m') = (m & m') <> 0w0  
         fun allSet (WF m, WF m') = (m & m') = m  
   
         fun orF (WF f,acc) = f ++ acc  
90    
91          val untraced =          val untraced =
92            WF(sysconf "JOB_CONTROL"; w_osval "WUNTRACED") handle _ => WF 0w0              fromWord ((sysconf "JOB_CONTROL"; w_osval "WUNTRACED")
93                          handle _ => 0w0)
94        end        end
95    
96        val wnohang = W.fromWord (w_osval "WNOHANG")
97    
98      fun waitpid (arg,flags) = let      fun waitpid (arg,flags) = let
99            val (pid,status,sv) = waitpid'(argToInt arg, List.foldl W.orF 0w0 flags)          val (pid,status,sv) = waitpid'(argToInt arg, W.toWord (W.flags flags))
100            in            in
101              (PID pid, mkExitStatus(status,sv))              (PID pid, mkExitStatus(status,sv))
102            end            end
103    
104      fun waitpid_nh (arg,flags) =      fun waitpid_nh (arg,flags) =
105            case waitpid'(argToInt arg, List.foldl W.orF wnohang flags) of          case waitpid'(argToInt arg, W.toWord (W.flags (wnohang :: flags))) of
106              (0,_,_) => NONE              (0,_,_) => NONE
107            | (pid,status,sv) => SOME(PID pid, mkExitStatus(status,sv))            | (pid,status,sv) => SOME(PID pid, mkExitStatus(status,sv))
108    

Legend:
Removed from v.416  
changed lines
  Added in v.1506

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0