lio 0.11.3.0 → 0.11.4.0
raw patch · 4 files changed
+36/−42 lines, 4 files
Files
- LIO/Concurrent/LMVar.hs +15/−15
- LIO/LIORef.hs +19/−25
- LIO/Label.hs +1/−1
- lio.cabal +1/−1
LIO/Concurrent/LMVar.hs view
@@ -45,7 +45,6 @@ import safe LIO.Core import safe LIO.Error import safe LIO.Label-import LIO.TCB import LIO.TCB.LObj --@@ -63,17 +62,16 @@ newEmptyLMVar :: Label l => l -- ^ Label of @LMVar@ -> LIO l (LMVar l a) -- ^ New mutable location-newEmptyLMVar l = do- withContext "newEmptyLMVar" $ guardAlloc l- ioTCB (LObjTCB l `fmap` newEmptyMVar)+newEmptyLMVar l = guardIOTCB (withContext "newEmptyLMVar" $ guardAlloc l) $+ LObjTCB l `fmap` newEmptyMVar -- | Same as 'newEmptyLMVar' except it takes a set of privileges which -- are accounted for in comparing the label of the MVar to the current -- label and clearance. newEmptyLMVarP :: PrivDesc l p => Priv p -> l -> LIO l (LMVar l a)-newEmptyLMVarP p l = do- withContext "newEmptyLMVarP" $ guardAllocP p l- ioTCB $ LObjTCB l `fmap` newEmptyMVar+newEmptyLMVarP p l =+ guardIOTCB (withContext "newEmptyLMVarP" $ guardAllocP p l) $+ LObjTCB l `fmap` newEmptyMVar -- | Create a new labeled MVar, in an filled state with the supplied -- value. Note that the supplied label must be above the current label@@ -82,17 +80,15 @@ => l -- ^ Label of @LMVar@ -> a -- ^ Initial value of @LMVar@ -> LIO l (LMVar l a) -- ^ New mutable location-newLMVar l a = do- withContext "newLMVar" $ guardAlloc l- ioTCB (LObjTCB l `fmap` newMVar a)+newLMVar l a = guardIOTCB (withContext "newLMVar" $ guardAlloc l) $+ LObjTCB l `fmap` newMVar a -- | Same as 'newLMVar' except it takes a set of privileges which are -- accounted for in comparing the label of the MVar to the current label -- and clearance. newLMVarP :: PrivDesc l p => Priv p -> l -> a -> LIO l (LMVar l a)-newLMVarP p l a = do- withContext "newLMVarP" $ guardAllocP p l- ioTCB $ LObjTCB l `fmap` newMVar a+newLMVarP p l a = guardIOTCB (withContext "newLMVarP" $ guardAllocP p l) $+ LObjTCB l `fmap` newMVar a -- -- Take 'LMVar'@@ -208,8 +204,12 @@ -- clearance -- the current label is raised to the join of the 'LMVar' -- label and the current label. isEmptyLMVar :: Label l => LMVar l a -> LIO l Bool-isEmptyLMVar = blessTCB "isEmptyLMVar" isEmptyMVar+isEmptyLMVar (LObjTCB l m) =+ guardIOTCB (withContext "isEmptyLMVar" $ taint l) $+ isEmptyMVar m -- | Same as 'isEmptyLMVar', but uses privileges when raising current label. isEmptyLMVarP :: PrivDesc l p => Priv p -> LMVar l a -> LIO l Bool-isEmptyLMVarP = blessPTCB "isEmptyLMVarP" isEmptyMVar+isEmptyLMVarP p (LObjTCB l m) =+ guardIOTCB (withContext "isEmptyLMVarP" $ taintP p l) $+ isEmptyMVar m
LIO/LIORef.hs view
@@ -33,7 +33,6 @@ import safe LIO.Core import safe LIO.Error import safe LIO.Label-import LIO.TCB import LIO.TCB.LObj --@@ -55,17 +54,15 @@ => l -- ^ Label of reference -> a -- ^ Initial value -> LIO l (LIORef l a) -- ^ Mutable reference-newLIORef l a = do- withContext "newLIORef" $ guardAlloc l- ioTCB (LObjTCB l `fmap` newIORef a)+newLIORef l a = guardIOTCB (withContext "newLIORef" $ guardAlloc l) $+ LObjTCB l `fmap` newIORef a -- | Same as 'newLIORef' except @newLIORefP@ takes privileges which -- make the comparison to the current label more permissive, as -- enforced by 'guardAllocP'. newLIORefP :: PrivDesc l p => Priv p -> l -> a -> LIO l (LIORef l a)-newLIORefP p l a = do- withContext "newLIORefP" $ guardAllocP p l- ioTCB (LObjTCB l `fmap` newIORef a)+newLIORefP p l a = guardIOTCB (withContext "newLIORefP" $ guardAllocP p l) $+ LObjTCB l `fmap` newIORef a -- -- Read 'LIORef's@@ -78,17 +75,15 @@ -- (introduced by the 'taint' guard) use 'labelOf' to check that a -- read will succeed. readLIORef :: Label l => LIORef l a -> LIO l a-readLIORef (LObjTCB l r) = do- withContext "readLIORef" $ taint l- ioTCB (readIORef r)+readLIORef (LObjTCB l r) =+ guardIOTCB (withContext "readLIORef" $ taint l) $ readIORef r -- | Same as 'readLIORef', except @readLIORefP@ takes a privilege -- object which is used when the current label is raised (using -- 'taintP' instead of 'taint'). readLIORefP :: PrivDesc l p => Priv p -> LIORef l a -> LIO l a-readLIORefP p (LObjTCB l r) = do- withContext "readLIORefP" $ taintP p l- ioTCB (readIORef r)+readLIORefP p (LObjTCB l r) =+ guardIOTCB (withContext "readLIORefP" $ taintP p l) $ readIORef r -- -- Write 'LIORef's@@ -99,17 +94,16 @@ -- label of the reference can-flow-to the current clearance. Otherwise, -- an exception is raised by the underlying 'guardAlloc' guard. writeLIORef :: Label l => LIORef l a -> a -> LIO l ()-writeLIORef (LObjTCB l r) a = do- withContext "writeLIORef" $ guardAlloc l- ioTCB (writeIORef r a)+writeLIORef (LObjTCB l r) a =+ guardIOTCB (withContext "writeLIORef" $ guardAlloc l) $ writeIORef r a -- | Same as 'writeLIORef' except @writeLIORefP@ takes a set of -- privileges which are accounted for in comparing the label of the -- reference to the current label. writeLIORefP :: PrivDesc l p => Priv p -> LIORef l a -> a -> LIO l ()-writeLIORefP p (LObjTCB l r) a = do- withContext "writeLIORefP" $ guardAllocP p l- ioTCB (writeIORef r a)+writeLIORefP p (LObjTCB l r) a =+ guardIOTCB (withContext "writeLIORefP" $ guardAllocP p l) $+ writeIORef r a -- -- Modify 'LIORef's@@ -127,17 +121,17 @@ => LIORef l a -- ^ Labeled reference -> (a -> a) -- ^ Modifier -> LIO l ()-modifyLIORef (LObjTCB l r) f = do- withContext "modifyLIORef" $ guardAlloc l- ioTCB (modifyIORef r f)+modifyLIORef (LObjTCB l r) f =+ guardIOTCB (withContext "modifyLIORef" $ guardAlloc l)+ modifyIORef r f -- | Like 'modifyLIORef', but takes a privilege argument and guards -- execution with 'guardAllocP' instead of 'guardAlloc'. modifyLIORefP :: PrivDesc l p => Priv p -> LIORef l a -> (a -> a) -> LIO l ()-modifyLIORefP p (LObjTCB l r) f = do- withContext "modifyLIORefP" $ guardAllocP p l- ioTCB (modifyIORef r f)+modifyLIORefP p (LObjTCB l r) f =+ guardIOTCB (withContext "modifyLIORefP" $ guardAllocP p l) $+ modifyIORef r f -- | Atomically modifies the contents of an 'LIORef'. It is required -- that the label of the reference be above the current label, but
LIO/Label.hs view
@@ -56,7 +56,7 @@ -- 'canFlowTo' partially orders labels. -- 'lub' and 'glb' compute the least upper bound and greatest lower -- bound of two labels, respectively.-class (Eq l, Show l, Typeable l) => Label l where+class (Eq l, Show l, Read l, Typeable l) => Label l where -- | Compute the /least upper bound/, or join, of two labels. When -- data carrying two different labels is mixed together in a -- document, the @lub@ of the two labels is the lowest safe value
lio.cabal view
@@ -1,5 +1,5 @@ Name: lio-Version: 0.11.3.0+Version: 0.11.4.0 Cabal-Version: >= 1.8 Build-type: Simple License: GPL