`M-x delete-trailing-whitespace`
[packages/haskell2010.git] / Foreign / C / Error.hs
1 {-# LANGUAGE CPP, PackageImports #-}
2 #if __GLASGOW_HASKELL__ >= 701
3 {-# LANGUAGE Safe #-}
4 #endif
5
6 -- | The module "Foreign.C.Error" facilitates C-specific error
7 -- handling of @errno@.
8 module Foreign.C.Error (
9
10 -- * Haskell representations of @errno@ values
11
12 Errno(..), -- instance: Eq
13
14 -- ** Common @errno@ symbols
15 -- | Different operating systems and\/or C libraries often support
16 -- different values of @errno@. This module defines the common values,
17 -- but due to the open definition of 'Errno' users may add definitions
18 -- which are not predefined.
19 eOK, e2BIG, eACCES, eADDRINUSE, eADDRNOTAVAIL, eADV, eAFNOSUPPORT, eAGAIN,
20 eALREADY, eBADF, eBADMSG, eBADRPC, eBUSY, eCHILD, eCOMM, eCONNABORTED,
21 eCONNREFUSED, eCONNRESET, eDEADLK, eDESTADDRREQ, eDIRTY, eDOM, eDQUOT,
22 eEXIST, eFAULT, eFBIG, eFTYPE, eHOSTDOWN, eHOSTUNREACH, eIDRM, eILSEQ,
23 eINPROGRESS, eINTR, eINVAL, eIO, eISCONN, eISDIR, eLOOP, eMFILE, eMLINK,
24 eMSGSIZE, eMULTIHOP, eNAMETOOLONG, eNETDOWN, eNETRESET, eNETUNREACH,
25 eNFILE, eNOBUFS, eNODATA, eNODEV, eNOENT, eNOEXEC, eNOLCK, eNOLINK,
26 eNOMEM, eNOMSG, eNONET, eNOPROTOOPT, eNOSPC, eNOSR, eNOSTR, eNOSYS,
27 eNOTBLK, eNOTCONN, eNOTDIR, eNOTEMPTY, eNOTSOCK, eNOTTY, eNXIO,
28 eOPNOTSUPP, ePERM, ePFNOSUPPORT, ePIPE, ePROCLIM, ePROCUNAVAIL,
29 ePROGMISMATCH, ePROGUNAVAIL, ePROTO, ePROTONOSUPPORT, ePROTOTYPE,
30 eRANGE, eREMCHG, eREMOTE, eROFS, eRPCMISMATCH, eRREMOTE, eSHUTDOWN,
31 eSOCKTNOSUPPORT, eSPIPE, eSRCH, eSRMNT, eSTALE, eTIME, eTIMEDOUT,
32 eTOOMANYREFS, eTXTBSY, eUSERS, eWOULDBLOCK, eXDEV,
33
34 -- ** 'Errno' functions
35 -- :: Errno
36 isValidErrno, -- :: Errno -> Bool
37
38 -- access to the current thread's "errno" value
39 --
40 getErrno, -- :: IO Errno
41 resetErrno, -- :: IO ()
42
43 -- conversion of an "errno" value into IO error
44 --
45 errnoToIOError, -- :: String -- location
46 -- -> Errno -- errno
47 -- -> Maybe Handle -- handle
48 -- -> Maybe String -- filename
49 -- -> IOError
50
51 -- throw current "errno" value
52 --
53 throwErrno, -- :: String -> IO a
54
55 -- ** Guards for IO operations that may fail
56
57 throwErrnoIf, -- :: (a -> Bool) -> String -> IO a -> IO a
58 throwErrnoIf_, -- :: (a -> Bool) -> String -> IO a -> IO ()
59 throwErrnoIfRetry, -- :: (a -> Bool) -> String -> IO a -> IO a
60 throwErrnoIfRetry_, -- :: (a -> Bool) -> String -> IO a -> IO ()
61 throwErrnoIfMinus1, -- :: Num a
62 -- => String -> IO a -> IO a
63 throwErrnoIfMinus1_, -- :: Num a
64 -- => String -> IO a -> IO ()
65 throwErrnoIfMinus1Retry,
66 -- :: Num a
67 -- => String -> IO a -> IO a
68 throwErrnoIfMinus1Retry_,
69 -- :: Num a
70 -- => String -> IO a -> IO ()
71 throwErrnoIfNull, -- :: String -> IO (Ptr a) -> IO (Ptr a)
72 throwErrnoIfNullRetry,-- :: String -> IO (Ptr a) -> IO (Ptr a)
73
74 throwErrnoIfRetryMayBlock,
75 throwErrnoIfRetryMayBlock_,
76 throwErrnoIfMinus1RetryMayBlock,
77 throwErrnoIfMinus1RetryMayBlock_,
78 throwErrnoIfNullRetryMayBlock,
79
80 throwErrnoPath,
81 throwErrnoPathIf,
82 throwErrnoPathIf_,
83 throwErrnoPathIfNull,
84 throwErrnoPathIfMinus1,
85 throwErrnoPathIfMinus1_,
86
87 ) where
88
89 import "base" Foreign.C.Error