1 {-# OPTIONS_NHC98 -I/usr/include #-}
2 -----------------------------------------------------------------------------
4 -- Module : NHC.PosixTypes
5 -- Copyright : (c) Malcolm Wallace 2007
6 -- License : BSD-style (see the file libraries/base/LICENSE)
8 -- Maintainer : libraries@haskell.org
9 -- Stability : provisional
10 -- Portability : non-portable (requires POSIX)
12 -- POSIX data types: Haskell equivalents of the types defined by the
13 -- @\<sys\/types.h>@ C header on a POSIX system.
15 -----------------------------------------------------------------------------
17 module NHC.PosixTypes (
51 -- Curious hack to ensure that the CTypes macros are expanded *after* hsc2hs.
53 -- C header files that contain all the types we are looking for here.
59 #include <sys/resource.h>
62 ARITHMETIC_TYPE(CDev,tyConCDev,"CDev",#{type dev_t})
63 INTEGRAL_TYPE(CIno,tyConCIno,"CIno",#{type ino_t})
64 INTEGRAL_TYPE(CMode,tyConCMode,"CMode",#{type mode_t})
65 INTEGRAL_TYPE(COff,tyConCOff,"COff",#{type off_t})
66 INTEGRAL_TYPE(CPid,tyConCPid,"CPid",#{type pid_t})
68 INTEGRAL_TYPE(CSsize,tyConCSsize,"CSsize",#{type ssize_t})
70 INTEGRAL_TYPE(CGid,tyConCGid,"CGid",#{type gid_t})
71 INTEGRAL_TYPE(CNlink,tyConCNlink,"CNlink",#{type nlink_t})
73 INTEGRAL_TYPE(CUid,tyConCUid,"CUid",#{type uid_t})
74 ARITHMETIC_TYPE(CCc,tyConCCc,"CCc",#{type cc_t})
75 ARITHMETIC_TYPE(CSpeed,tyConCSpeed,"CSpeed",#{type speed_t})
76 INTEGRAL_TYPE(CTcflag,tyConCTcflag,"CTcflag",#{type tcflag_t})
77 INTEGRAL_TYPE(CRLim,tyConCRlim,"CRLim",#{type rlim_t})
79 -- ToDo: blksize_t, clockid_t, blkcnt_t, fsblkcnt_t, fsfilcnt_t, id_t, key_t
80 -- suseconds_t, timer_t, useconds_t
82 -- Make an Fd type rather than using CInt everywhere
83 INTEGRAL_TYPE(Fd,tyConFd,"Fd",CInt)
85 -- nicer names, and backwards compatibility with POSIX library:
86 type LinkCount = CNlink