[project @ 2002-09-06 14:38:15 by simonmar]
[haskell-directory.git] / System / Posix / Types.hs
1 {-# OPTIONS -fno-implicit-prelude #-}
2 -----------------------------------------------------------------------------
3 -- |
4 -- Module      :  System.Posix.Types
5 -- Copyright   :  (c) The University of Glasgow 2002
6 -- License     :  BSD-style (see the file libraries/base/LICENSE)
7 -- 
8 -- Maintainer  :  libraries@haskell.org
9 -- Stability   :  provisional
10 -- Portability :  non-portable (requires POSIX)
11 --
12 -- POSIX data types
13 --
14 -----------------------------------------------------------------------------
15
16 #include "config.h"
17
18 module System.Posix.Types (
19   CDev(..), CIno(..), CMode(..), COff(..), CPid(..), CSsize(..),
20
21 #ifndef mingw32_TARGET_OS
22   CGid(..), CNlink(..), CSsize(..), CUid(..), CCc(..), CSpeed(..),
23   CTcflag(..), CBlkCnt(..), 
24 #endif
25
26   Fd(..),
27
28 #ifndef mingw32_TARGET_OS
29   LinkCount,
30   UserID,
31   GroupID,
32 #endif
33
34   ByteCount,
35   ClockTick,
36   EpochTime,
37   FileOffset,
38   ProcessID,
39   ProcessGroupID,
40   DeviceID,
41   FileID,
42   FileMode
43  ) where
44
45 import Foreign
46 import Foreign.C
47 import Data.Dynamic
48 import Data.Bits
49
50 #ifdef __GLASGOW_HASKELL__
51 import GHC.Base
52 import GHC.Enum
53 import GHC.Num
54 import GHC.Real
55 import GHC.Prim
56 import GHC.Read
57 import GHC.Show
58 #endif
59
60 #include "Dynamic.h"
61 #include "CTypes.h"
62
63 NUMERIC_TYPE(CDev,tyConCDev,"CDev",HTYPE_DEV_T)
64 INTEGRAL_TYPE(CIno,tyConCIno,"CIno",HTYPE_INO_T)
65 INTEGRAL_TYPE(CMode,tyConCMode,"CMode",HTYPE_MODE_T)
66 INTEGRAL_TYPE(COff,tyConCOff,"COff",HTYPE_OFF_T)
67 INTEGRAL_TYPE(CPid,tyConCPid,"CPid",HTYPE_PID_T)
68
69 #ifdef mingw32_TARGET_OS
70 INTEGRAL_TYPE(CSsize,tyConCSsize,"CSsize",HTYPE_SIZE_T)
71 #else
72 INTEGRAL_TYPE(CSsize,tyConCSsize,"CSsize",HTYPE_SSIZE_T)
73 #endif
74
75 #ifndef mingw32_TARGET_OS
76 INTEGRAL_TYPE(CGid,tyConCGid,"CGid",HTYPE_GID_T)
77 INTEGRAL_TYPE(CNlink,tyConCNlink,"CNlink",HTYPE_NLINK_T)
78 INTEGRAL_TYPE(CUid,tyConCUid,"CUid",HTYPE_UID_T)
79 NUMERIC_TYPE(CCc,tyConCCc,"CCc",HTYPE_CC_T)
80 NUMERIC_TYPE(CSpeed,tyConCSpeed,"CSpeed",HTYPE_SPEED_T)
81 INTEGRAL_TYPE(CTcflag,tyConCTcflag,"CTcflag",HTYPE_TCFLAG_T)
82 INTEGRAL_TYPE(CBlkCnt,tyConBlkCnd,"CBlkCnt",HTYPE_BLKCNT_T)
83 #endif
84
85 -- Make an Fd type rather than using CInt everywhere
86 INTEGRAL_TYPE(Fd,tyConFd,"Fd",CInt)
87
88 -- nicer names, and backwards compatibility with POSIX library:
89 #ifndef mingw32_TARGET_OS
90 type LinkCount      = CNlink
91 type UserID         = CUid
92 type GroupID        = CGid
93 #endif
94
95 type ByteCount      = CSize
96 type ClockTick      = CClock
97 type EpochTime      = CTime
98 type DeviceID       = CDev
99 type FileID         = CIno
100 type FileMode       = CMode
101 type ProcessID      = CPid
102 type FileOffset     = COff
103 type ProcessGroupID = CPid