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/branches/blume-private-devel/src/system/Basis/Implementation/Posix/posix-process.sml
ViewVC logotype

Diff of /sml/branches/blume-private-devel/src/system/Basis/Implementation/Posix/posix-process.sml

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

revision 1401, Thu Oct 2 16:09:02 2003 UTC revision 1453, Mon Feb 9 20:33:28 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 85  Line 81 
81        | mkExitStatus (_,s) = W_STOPPED (Sig.SIG s)        | mkExitStatus (_,s) = W_STOPPED (Sig.SIG s)
82    
83    
84      val wnohang = w_osval "WNOHANG"      structure W = struct
85      structure W =          local structure W0 = BitFlagsFn ()
86        struct          in
87          datatype flags = WF of word              open W0
88            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  
89    
90          val untraced =          val untraced =
91            WF(sysconf "JOB_CONTROL"; w_osval "WUNTRACED") handle _ => WF 0w0              fromWord ((sysconf "JOB_CONTROL"; w_osval "WUNTRACED")
92                          handle _ => 0w0)
93        end        end
94    
95        val wnohang = W.fromWord (w_osval "WNOHANG")
96    
97      fun waitpid (arg,flags) = let      fun waitpid (arg,flags) = let
98            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))
99            in            in
100              (PID pid, mkExitStatus(status,sv))              (PID pid, mkExitStatus(status,sv))
101            end            end
102    
103      fun waitpid_nh (arg,flags) =      fun waitpid_nh (arg,flags) =
104            case waitpid'(argToInt arg, List.foldl W.orF wnohang flags) of          case waitpid'(argToInt arg, W.toWord (W.flags (wnohang :: flags))) of
105              (0,_,_) => NONE              (0,_,_) => NONE
106            | (pid,status,sv) => SOME(PID pid, mkExitStatus(status,sv))            | (pid,status,sv) => SOME(PID pid, mkExitStatus(status,sv))
107    

Legend:
Removed from v.1401  
changed lines
  Added in v.1453

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