| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
System.LibFuse3.Utils
Description
Miscellaneous utilities provided for convenience.
These can be used for general purpose and are not directly related to FUSE.
Bitsets
testBitSet :: Bits a => a -> a -> Bool Source #
testBitSet bits mask is True iff all bits in mask are set in bits.
testBitSet bits mask ≡ bits .&. mask == mask
Errno
ioErrorToErrno :: IOError -> Maybe Errno Source #
Attempts to extract an Errno from an IOError assuming it is
constructed with errnoToIOError (typically via throwErrno).
tryErrno :: IO a -> IO (Either Errno a) Source #
Catches an exception constructed with errnoToIOError and extracts Errno from it.
Marshalling strings
pokeCStringLen0 :: CStringLen -> String -> IO () Source #
Marshals a Haskell string into a NUL terminated C string in a locale-dependent way.
Does withCStringLen and copies it into the destination buffer.
The Haskell string should not contain NUL characters.
If the destination buffer is not long enough to hold the source string, it is truncated and a NUL byte is inserted at the end of the buffer.