W3cubDocs

/Haskell 8

Foreign.C.Error

Copyright (c) The FFI task force 2001
License BSD-style (see the file libraries/base/LICENSE)
Maintainer [email protected]
Stability provisional
Portability portable
Safe Haskell Trustworthy
Language Haskell2010

Description

C-specific Marshalling support: Handling of C "errno" error codes.

Haskell representations of errno values

newtype Errno Source

Haskell representation for errno values. The implementation is deliberately exposed, to allow users to add their own definitions of Errno values.

Constructors

Errno CInt

Instances

Eq Errno

Methods

(==) :: Errno -> Errno -> Bool Source

(/=) :: Errno -> Errno -> Bool Source

Common errno symbols

Different operating systems and/or C libraries often support different values of errno. This module defines the common values, but due to the open definition of Errno users may add definitions which are not predefined.

eOK :: Errno Source

e2BIG :: Errno Source

eACCES :: Errno Source

eADDRINUSE :: Errno Source

eADDRNOTAVAIL :: Errno Source

eADV :: Errno Source

eAFNOSUPPORT :: Errno Source

eAGAIN :: Errno Source

eALREADY :: Errno Source

eBADF :: Errno Source

eBADMSG :: Errno Source

eBADRPC :: Errno Source

eBUSY :: Errno Source

eCHILD :: Errno Source

eCOMM :: Errno Source

eCONNABORTED :: Errno Source

eCONNREFUSED :: Errno Source

eCONNRESET :: Errno Source

eDEADLK :: Errno Source

eDESTADDRREQ :: Errno Source

eDIRTY :: Errno Source

eDOM :: Errno Source

eDQUOT :: Errno Source

eEXIST :: Errno Source

eFAULT :: Errno Source

eFBIG :: Errno Source

eFTYPE :: Errno Source

eHOSTDOWN :: Errno Source

eHOSTUNREACH :: Errno Source

eIDRM :: Errno Source

eILSEQ :: Errno Source

eINPROGRESS :: Errno Source

eINTR :: Errno Source

eINVAL :: Errno Source

eIO :: Errno Source

eISCONN :: Errno Source

eISDIR :: Errno Source

eLOOP :: Errno Source

eMFILE :: Errno Source

eMLINK :: Errno Source

eMSGSIZE :: Errno Source

eMULTIHOP :: Errno Source

eNAMETOOLONG :: Errno Source

eNETDOWN :: Errno Source

eNETRESET :: Errno Source

eNETUNREACH :: Errno Source

eNFILE :: Errno Source

eNOBUFS :: Errno Source

eNODATA :: Errno Source

eNODEV :: Errno Source

eNOENT :: Errno Source

eNOEXEC :: Errno Source

eNOLCK :: Errno Source

eNOLINK :: Errno Source

eNOMEM :: Errno Source

eNOMSG :: Errno Source

eNONET :: Errno Source

eNOPROTOOPT :: Errno Source

eNOSPC :: Errno Source

eNOSR :: Errno Source

eNOSTR :: Errno Source

eNOSYS :: Errno Source

eNOTBLK :: Errno Source

eNOTCONN :: Errno Source

eNOTDIR :: Errno Source

eNOTEMPTY :: Errno Source

eNOTSOCK :: Errno Source

eNOTSUP :: Errno Source

Since: 4.7.0.0

eNOTTY :: Errno Source

eNXIO :: Errno Source

eOPNOTSUPP :: Errno Source

ePERM :: Errno Source

ePFNOSUPPORT :: Errno Source

ePIPE :: Errno Source

ePROCLIM :: Errno Source

ePROCUNAVAIL :: Errno Source

ePROGMISMATCH :: Errno Source

ePROGUNAVAIL :: Errno Source

ePROTO :: Errno Source

ePROTONOSUPPORT :: Errno Source

ePROTOTYPE :: Errno Source

eRANGE :: Errno Source

eREMCHG :: Errno Source

eREMOTE :: Errno Source

eROFS :: Errno Source

eRPCMISMATCH :: Errno Source

eRREMOTE :: Errno Source

eSHUTDOWN :: Errno Source

eSOCKTNOSUPPORT :: Errno Source

eSPIPE :: Errno Source

eSRCH :: Errno Source

eSRMNT :: Errno Source

eSTALE :: Errno Source

eTIME :: Errno Source

eTIMEDOUT :: Errno Source

eTOOMANYREFS :: Errno Source

eTXTBSY :: Errno Source

eUSERS :: Errno Source

eWOULDBLOCK :: Errno Source

eXDEV :: Errno Source

Errno functions

isValidErrno :: Errno -> Bool Source

Yield True if the given Errno value is valid on the system. This implies that the Eq instance of Errno is also system dependent as it is only defined for valid values of Errno.

getErrno :: IO Errno Source

Get the current value of errno in the current thread.

resetErrno :: IO () Source

Reset the current thread's errno value to eOK.

errnoToIOError Source

Arguments

:: String

the location where the error occurred

-> Errno

the error number

-> Maybe Handle

optional handle associated with the error

-> Maybe String

optional filename associated with the error

-> IOError

Construct an IOError based on the given Errno value. The optional information can be used to improve the accuracy of error messages.

throwErrno Source

Arguments

:: String

textual description of the error location

-> IO a

Throw an IOError corresponding to the current value of getErrno.

Guards for IO operations that may fail

throwErrnoIf Source

Arguments

:: (a -> Bool)

predicate to apply to the result value of the IO operation

-> String

textual description of the location

-> IO a

the IO operation to be executed

-> IO a

Throw an IOError corresponding to the current value of getErrno if the result value of the IO action meets the given predicate.

throwErrnoIf_ :: (a -> Bool) -> String -> IO a -> IO () Source

as throwErrnoIf, but discards the result of the IO action after error handling.

throwErrnoIfRetry :: (a -> Bool) -> String -> IO a -> IO a Source

as throwErrnoIf, but retry the IO action when it yields the error code eINTR - this amounts to the standard retry loop for interrupted POSIX system calls.

throwErrnoIfRetry_ :: (a -> Bool) -> String -> IO a -> IO () Source

as throwErrnoIfRetry, but discards the result.

throwErrnoIfMinus1 :: (Eq a, Num a) => String -> IO a -> IO a Source

Throw an IOError corresponding to the current value of getErrno if the IO action returns a result of -1.

throwErrnoIfMinus1_ :: (Eq a, Num a) => String -> IO a -> IO () Source

as throwErrnoIfMinus1, but discards the result.

throwErrnoIfMinus1Retry :: (Eq a, Num a) => String -> IO a -> IO a Source

Throw an IOError corresponding to the current value of getErrno if the IO action returns a result of -1, but retries in case of an interrupted operation.

throwErrnoIfMinus1Retry_ :: (Eq a, Num a) => String -> IO a -> IO () Source

as throwErrnoIfMinus1, but discards the result.

throwErrnoIfNull :: String -> IO (Ptr a) -> IO (Ptr a) Source

Throw an IOError corresponding to the current value of getErrno if the IO action returns nullPtr.

throwErrnoIfNullRetry :: String -> IO (Ptr a) -> IO (Ptr a) Source

Throw an IOError corresponding to the current value of getErrno if the IO action returns nullPtr, but retry in case of an interrupted operation.

throwErrnoIfRetryMayBlock Source

Arguments

:: (a -> Bool)

predicate to apply to the result value of the IO operation

-> String

textual description of the location

-> IO a

the IO operation to be executed

-> IO b

action to execute before retrying if an immediate retry would block

-> IO a

as throwErrnoIfRetry, but additionally if the operation yields the error code eAGAIN or eWOULDBLOCK, an alternative action is executed before retrying.

throwErrnoIfRetryMayBlock_ :: (a -> Bool) -> String -> IO a -> IO b -> IO () Source

as throwErrnoIfRetryMayBlock, but discards the result.

throwErrnoIfMinus1RetryMayBlock :: (Eq a, Num a) => String -> IO a -> IO b -> IO a Source

as throwErrnoIfMinus1Retry, but checks for operations that would block.

throwErrnoIfMinus1RetryMayBlock_ :: (Eq a, Num a) => String -> IO a -> IO b -> IO () Source

as throwErrnoIfMinus1RetryMayBlock, but discards the result.

throwErrnoIfNullRetryMayBlock :: String -> IO (Ptr a) -> IO b -> IO (Ptr a) Source

as throwErrnoIfNullRetry, but checks for operations that would block.

throwErrnoPath :: String -> FilePath -> IO a Source

as throwErrno, but exceptions include the given path when appropriate.

throwErrnoPathIf :: (a -> Bool) -> String -> FilePath -> IO a -> IO a Source

as throwErrnoIf, but exceptions include the given path when appropriate.

throwErrnoPathIf_ :: (a -> Bool) -> String -> FilePath -> IO a -> IO () Source

as throwErrnoIf_, but exceptions include the given path when appropriate.

throwErrnoPathIfNull :: String -> FilePath -> IO (Ptr a) -> IO (Ptr a) Source

as throwErrnoIfNull, but exceptions include the given path when appropriate.

throwErrnoPathIfMinus1 :: (Eq a, Num a) => String -> FilePath -> IO a -> IO a Source

as throwErrnoIfMinus1, but exceptions include the given path when appropriate.

throwErrnoPathIfMinus1_ :: (Eq a, Num a) => String -> FilePath -> IO a -> IO () Source

as throwErrnoIfMinus1_, but exceptions include the given path when appropriate.

© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/8.0.1/docs/html/libraries/base-4.9.0.0/Foreign-C-Error.html