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