| Copyright | (c) The FFI task force 2001 |
|---|---|
| License | BSD-style (see the file libraries/base/LICENSE) |
| Maintainer | ffi@haskell.org |
| Stability | provisional |
| Portability | portable |
| Safe Haskell | Trustworthy |
| Language | Haskell2010 |
Foreign.C.Error
Contents
Description
C-specific Marshalling support: Handling of C "errno" error codes.
errno valuesHaskell representation forerrno values. The implementation is deliberately exposed, to allow users to add their own definitions ofErrno values.
errno symbolsDifferent operating systems and/or C libraries often support different values oferrno. This module defines the common values, but due to the open definition ofErrno users may add definitions which are not predefined.
Errno functionsresetErrno ::IO ()Source#
Reset the current thread'serrno value toeOK.
Arguments
| ::String | the location where the error occurred |
| ->Errno | the error number |
| ->MaybeHandle | optional handle associated with the error |
| ->MaybeString | optional filename associated with the error |
| ->IOError |
Construct anIOException based on the givenErrno value. The optional information can be used to improve the accuracy of error messages.
Throw anIOException corresponding to the current value ofgetErrno.
Arguments
| :: (a ->Bool) | predicate to apply to the result value of the |
| ->String | textual description of the location |
| ->IO a | the |
| ->IO a |
Throw anIOException corresponding to the current value ofgetErrno if the result value of theIO action meets the given predicate.
throwErrnoIf_ :: (a ->Bool) ->String ->IO a ->IO ()Source#
asthrowErrnoIf, but discards the result of theIO action after error handling.
throwErrnoIfRetry :: (a ->Bool) ->String ->IO a ->IO aSource#
asthrowErrnoIf, but retry theIO action when it yields the error codeeINTR - this amounts to the standard retry loop for interrupted POSIX system calls.
throwErrnoIfRetry_ :: (a ->Bool) ->String ->IO a ->IO ()Source#
asthrowErrnoIfRetry, but discards the result.
throwErrnoIfMinus1 :: (Eq a,Num a) =>String ->IO a ->IO aSource#
Throw anIOException corresponding to the current value ofgetErrno if theIO action returns a result of-1.
throwErrnoIfMinus1_ :: (Eq a,Num a) =>String ->IO a ->IO ()Source#
asthrowErrnoIfMinus1, but discards the result.
throwErrnoIfMinus1Retry :: (Eq a,Num a) =>String ->IO a ->IO aSource#
Throw anIOException corresponding to the current value ofgetErrno if theIO action returns a result of-1, but retries in case of an interrupted operation.
throwErrnoIfMinus1Retry_ :: (Eq a,Num a) =>String ->IO a ->IO ()Source#
asthrowErrnoIfMinus1, but discards the result.
throwErrnoIfNull ::String ->IO (Ptr a) ->IO (Ptr a)Source#
Throw anIOException corresponding to the current value ofgetErrno if theIO action returnsnullPtr.
throwErrnoIfNullRetry ::String ->IO (Ptr a) ->IO (Ptr a)Source#
Throw anIOException corresponding to the current value ofgetErrno if theIO action returnsnullPtr, but retry in case of an interrupted operation.
throwErrnoIfRetryMayBlockSource#
Arguments
| :: (a ->Bool) | predicate to apply to the result value of the |
| ->String | textual description of the location |
| ->IO a | the |
| ->IO b | action to execute before retrying if an immediate retry would block |
| ->IO a |
asthrowErrnoIfRetry, but additionally if the operation yields the error codeeAGAIN oreWOULDBLOCK, an alternative action is executed before retrying.
throwErrnoIfRetryMayBlock_ :: (a ->Bool) ->String ->IO a ->IO b ->IO ()Source#
asthrowErrnoIfRetryMayBlock, but discards the result.
throwErrnoIfMinus1RetryMayBlock :: (Eq a,Num a) =>String ->IO a ->IO b ->IO aSource#
asthrowErrnoIfMinus1Retry, but checks for operations that would block.
throwErrnoIfMinus1RetryMayBlock_ :: (Eq a,Num a) =>String ->IO a ->IO b ->IO ()Source#
asthrowErrnoIfMinus1RetryMayBlock, but discards the result.
throwErrnoIfNullRetryMayBlock ::String ->IO (Ptr a) ->IO b ->IO (Ptr a)Source#
asthrowErrnoIfNullRetry, but checks for operations that would block.
throwErrnoPath ::String ->FilePath ->IO aSource#
asthrowErrno, but exceptions include the given path when appropriate.
throwErrnoPathIf :: (a ->Bool) ->String ->FilePath ->IO a ->IO aSource#
asthrowErrnoIf, but exceptions include the given path when appropriate.
throwErrnoPathIf_ :: (a ->Bool) ->String ->FilePath ->IO a ->IO ()Source#
asthrowErrnoIf_, but exceptions include the given path when appropriate.
throwErrnoPathIfNull ::String ->FilePath ->IO (Ptr a) ->IO (Ptr a)Source#
asthrowErrnoIfNull, but exceptions include the given path when appropriate.
throwErrnoPathIfMinus1 :: (Eq a,Num a) =>String ->FilePath ->IO a ->IO aSource#
asthrowErrnoIfMinus1, but exceptions include the given path when appropriate.
throwErrnoPathIfMinus1_ :: (Eq a,Num a) =>String ->FilePath ->IO a ->IO ()Source#
asthrowErrnoIfMinus1_, but exceptions include the given path when appropriate.
Produced byHaddock version 2.20.0