    {-# LINE 1 "Foundation/System/Bindings/Posix.hsc" #-}
    -----------------------------------------------------------------------------
    -- |
    -- Module      :  Foundation.System.Bindings.Posix
    -- Copyright   :  (c) Vincent Hanquez 2014-2017
    -- License     :  BSD-style
    --
    -- Maintainer  :  Vincent Hanquez
    -- Stability   :  provisional
    -- Portability :  non-portable (requires POSIX)
    --
    -- Functions defined by the POSIX standards
    --
    -----------------------------------------------------------------------------
    {-# LANGUAGE CApiFFI #-}
    {-# OPTIONS_HADDOCK hide #-}
    module Foundation.System.Bindings.Posix
       where

    import Basement.Compat.Base
    import Basement.Compat.C.Types
    import Data.Bits
    import Foundation.System.Bindings.PosixDef

    data CDir
    data CDirent

    sysPosix_E2BIG
        , sysPosix_EACCES
        , sysPosix_EADDRINUSE
        , sysPosix_EADDRNOTAVAIL
        , sysPosix_EAFNOSUPPORT
        , sysPosix_EAGAIN
        , sysPosix_EALREADY
        , sysPosix_EBADF
        , sysPosix_EBUSY
        , sysPosix_ECANCELED
        , sysPosix_ECHILD
        , sysPosix_ECONNABORTED
        , sysPosix_ECONNREFUSED
        , sysPosix_ECONNRESET
        , sysPosix_EDEADLK
        , sysPosix_EDESTADDRREQ
        , sysPosix_EDOM
        , sysPosix_EDQUOT
        , sysPosix_EEXIST
        , sysPosix_EFAULT
        , sysPosix_EFBIG
        , sysPosix_EHOSTUNREACH
        , sysPosix_EIDRM
        , sysPosix_EILSEQ
        , sysPosix_EINPROGRESS
        , sysPosix_EINTR
        , sysPosix_EINVAL
        , sysPosix_EIO
        , sysPosix_EISCONN
        , sysPosix_EISDIR
        , sysPosix_ELOOP
        , sysPosix_EMFILE
        , sysPosix_EMLINK
        , sysPosix_EMSGSIZE
        , sysPosix_ENAMETOOLONG
        , sysPosix_ENETDOWN
        , sysPosix_ENETRESET
        , sysPosix_ENETUNREACH
        , sysPosix_ENFILE
        , sysPosix_ENOBUFS
        , sysPosix_ENODEV
        , sysPosix_ENOENT
        , sysPosix_ENOEXEC
        , sysPosix_ENOLCK
        , sysPosix_ENOMEM
        , sysPosix_ENOMSG
        , sysPosix_ENOPROTOOPT
        , sysPosix_ENOSPC
        , sysPosix_ENOSYS
        , sysPosix_ENOTCONN
        , sysPosix_ENOTDIR
        , sysPosix_ENOTEMPTY
        , sysPosix_ENOTSOCK
        , sysPosix_ENOTSUP
        , sysPosix_ENOTTY
        , sysPosix_ENXIO
        , sysPosix_EOPNOTSUPP
        , sysPosix_EOVERFLOW
        , sysPosix_EPERM
        , sysPosix_EPIPE
        , sysPosix_EPROTONOSUPPORT
        , sysPosix_EPROTOTYPE
        , sysPosix_ERANGE
        , sysPosix_EROFS
        , sysPosix_ESPIPE
        , sysPosix_ESRCH
        , sysPosix_ESTALE
        , sysPosix_ETIMEDOUT
        , sysPosix_ETXTBSY
        , sysPosix_EWOULDBLOCK
        , sysPosix_EXDEV :: CErrno
    sysPosix_E2BIG :: CSysconfName
    sysPosix_E2BIG = (CSysconfName
    7)
    {-# LINE 105 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EACCES = (13)
    {-# LINE 106 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EADDRINUSE = (98)
    {-# LINE 107 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EADDRNOTAVAIL = (99)
    {-# LINE 108 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EAFNOSUPPORT = (97)
    {-# LINE 109 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EAGAIN = (11)
    {-# LINE 110 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EALREADY = (114)
    {-# LINE 111 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EBADF = (9)
    {-# LINE 112 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EBUSY = (16)
    {-# LINE 113 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ECANCELED = (125)
    {-# LINE 114 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ECHILD = (10)
    {-# LINE 115 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ECONNABORTED = (103)
    {-# LINE 116 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ECONNREFUSED = (111)
    {-# LINE 117 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ECONNRESET = (104)
    {-# LINE 118 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EDEADLK = (35)
    {-# LINE 119 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EDESTADDRREQ = (89)
    {-# LINE 120 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EDOM = (33)
    {-# LINE 121 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EDQUOT = (122)
    {-# LINE 122 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EEXIST = (17)
    {-# LINE 123 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EFAULT = (14)
    {-# LINE 124 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EFBIG = (27)
    {-# LINE 125 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EHOSTUNREACH = (113)
    {-# LINE 126 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EIDRM = (43)
    {-# LINE 127 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EILSEQ = (84)
    {-# LINE 128 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EINPROGRESS = (115)
    {-# LINE 129 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EINTR = (4)
    {-# LINE 130 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EINVAL = (22)
    {-# LINE 131 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EIO = (5)
    {-# LINE 132 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EISCONN = (106)
    {-# LINE 133 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EISDIR = (21)
    {-# LINE 134 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ELOOP = (40)
    {-# LINE 135 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EMFILE = (24)
    {-# LINE 136 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EMLINK = (31)
    {-# LINE 137 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EMSGSIZE = (90)
    {-# LINE 138 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENAMETOOLONG = (36)
    {-# LINE 139 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENETDOWN = (100)
    {-# LINE 140 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENETRESET = (102)
    {-# LINE 141 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENETUNREACH = (101)
    {-# LINE 142 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENFILE = (23)
    {-# LINE 143 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENOBUFS = (105)
    {-# LINE 144 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENODEV = (19)
    {-# LINE 145 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENOENT = (2)
    {-# LINE 146 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENOEXEC = (8)
    {-# LINE 147 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENOLCK = (37)
    {-# LINE 148 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENOMEM = (12)
    {-# LINE 149 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENOMSG = (42)
    {-# LINE 150 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENOPROTOOPT = (92)
    {-# LINE 151 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENOSPC = (28)
    {-# LINE 152 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENOSYS = (38)
    {-# LINE 153 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENOTCONN = (107)
    {-# LINE 154 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENOTDIR = (20)
    {-# LINE 155 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENOTEMPTY = (39)
    {-# LINE 156 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENOTSOCK = (88)
    {-# LINE 157 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENOTSUP = (95)
    {-# LINE 158 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENOTTY = (25)
    {-# LINE 159 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENXIO = (6)
    {-# LINE 160 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EOPNOTSUPP = (95)
    {-# LINE 161 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EOVERFLOW = (75)
    {-# LINE 162 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EPERM = (1)
    {-# LINE 163 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EPIPE = (32)
    {-# LINE 164 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EPROTONOSUPPORT = (93)
    {-# LINE 165 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EPROTOTYPE = (91)
    {-# LINE 166 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ERANGE = (34)
    {-# LINE 167 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EROFS = (30)
    {-# LINE 168 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ESPIPE = (29)
    {-# LINE 169 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ESRCH = (3)
    {-# LINE 170 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ESTALE = (116)
    {-# LINE 171 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ETIMEDOUT = (110)
    {-# LINE 172 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ETXTBSY = (26)
    {-# LINE 173 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EWOULDBLOCK = (11)
    {-# LINE 174 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EXDEV = (18)
    {-# LINE 175 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 177 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENODATA :: CErrno
    sysPosix_ENODATA :: CSysconfName
    sysPosix_ENODATA = (CSysconfName
    61)
    {-# LINE 179 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 180 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 182 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENOSR :: CErrno
    sysPosix_ENOSR :: CSysconfName
    sysPosix_ENOSR = (CSysconfName
    63)
    {-# LINE 184 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 185 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 187 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENOSTR :: CErrno
    sysPosix_ENOSTR :: CSysconfName
    sysPosix_ENOSTR = (CSysconfName
    60)
    {-# LINE 189 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 190 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 192 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ETIME :: CErrno
    sysPosix_ETIME :: CSysconfName
    sysPosix_ETIME = (CSysconfName
    62)
    {-# LINE 194 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 195 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 197 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EBADMSG :: CErrno
    sysPosix_EBADMSG :: CSysconfName
    sysPosix_EBADMSG = (CSysconfName
    74)
    {-# LINE 199 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 200 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 202 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EMULTIHOP :: CErrno
    sysPosix_EMULTIHOP :: CSysconfName
    sysPosix_EMULTIHOP = (CSysconfName
    72)
    {-# LINE 204 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 205 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 207 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENOLINK :: CErrno
    sysPosix_ENOLINK :: CSysconfName
    sysPosix_ENOLINK = (CSysconfName
    67)
    {-# LINE 209 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 210 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 212 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_ENOTRECOVERABLE :: CErrno
    sysPosix_ENOTRECOVERABLE :: CSysconfName
    sysPosix_ENOTRECOVERABLE = (CSysconfName
    131)
    {-# LINE 214 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 215 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 217 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EOWNERDEAD :: CErrno
    sysPosix_EOWNERDEAD :: CSysconfName
    sysPosix_EOWNERDEAD = (CSysconfName
    130)
    {-# LINE 219 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 220 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 222 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_EPROTO :: CErrno
    sysPosix_EPROTO :: CSysconfName
    sysPosix_EPROTO = (CSysconfName
    71)
    {-# LINE 224 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 225 "Foundation/System/Bindings/Posix.hsc" #-}

    sysPosix_O_RDONLY
        , sysPosix_O_WRONLY
        , sysPosix_O_RDWR
        , sysPosix_O_NONBLOCK
        , sysPosix_O_APPEND
        , sysPosix_O_CREAT
        , sysPosix_O_TRUNC
        , sysPosix_O_EXCL :: COpenFlags
    sysPosix_O_RDONLY :: CSysconfName
    sysPosix_O_RDONLY   = (CSysconfName
    0)
    {-# LINE 235 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_O_WRONLY   = (1)
    {-# LINE 236 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_O_RDWR     = ((0) .|. (1))
    {-# LINE 237 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_O_NONBLOCK = (2048)
    {-# LINE 238 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_O_APPEND   = (1024)
    {-# LINE 239 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_O_CREAT    = (64)
    {-# LINE 240 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_O_TRUNC    = (512)
    {-# LINE 241 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_O_EXCL     = (128)
    {-# LINE 242 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 244 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_O_NOFOLLOW :: COpenFlags
    sysPosix_O_NOFOLLOW :: CSysconfName
    sysPosix_O_NOFOLLOW = (CSysconfName
    131072)
    {-# LINE 246 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 247 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 249 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_O_CLOEXEC :: COpenFlags
    sysPosix_O_CLOEXEC :: CSysconfName
    sysPosix_O_CLOEXEC  = (CSysconfName
    524288)
    {-# LINE 251 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 252 "Foundation/System/Bindings/Posix.hsc" #-}

    sysPosix_PROT_NONE
        , sysPosix_PROT_READ
        , sysPosix_PROT_WRITE
        , sysPosix_PROT_EXEC :: CMemProtFlags
    sysPosix_PROT_NONE :: CSysconfName
    sysPosix_PROT_NONE  = (CSysconfName
    0)
    {-# LINE 258 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_PROT_READ  = (1)
    {-# LINE 259 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_PROT_WRITE = (2)
    {-# LINE 260 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_PROT_EXEC  = (4)
    {-# LINE 261 "Foundation/System/Bindings/Posix.hsc" #-}

    sysPosix_MAP_SHARED
        , sysPosix_MAP_PRIVATE
        , sysPosix_MAP_FIXED
        , sysPosix_MAP_ANONYMOUS :: CMemMappingFlags
    sysPosix_MAP_SHARED :: CSysconfName
    sysPosix_MAP_SHARED    = (CSysconfName
    1)
    {-# LINE 267 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_MAP_PRIVATE   = (2)
    {-# LINE 268 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_MAP_FIXED     = (16)
    {-# LINE 269 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 272 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_MAP_ANONYMOUS :: CSysconfName
    sysPosix_MAP_ANONYMOUS = (CSysconfName
    32)
    {-# LINE 273 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 274 "Foundation/System/Bindings/Posix.hsc" #-}

    sysPosix_MADV_NORMAL
        , sysPosix_MADV_RANDOM
        , sysPosix_MADV_SEQUENTIAL
        , sysPosix_MADV_WILLNEED
        , sysPosix_MADV_DONTNEED :: CMemAdvice

    {-# LINE 281 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_MADV_NORMAL     = (0)
    {-# LINE 282 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_MADV_RANDOM     = (1)
    {-# LINE 283 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_MADV_SEQUENTIAL = (2)
    {-# LINE 284 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_MADV_WILLNEED   = (3)
    {-# LINE 285 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_MADV_DONTNEED   = (4)
    {-# LINE 286 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 293 "Foundation/System/Bindings/Posix.hsc" #-}

    sysPosix_MS_ASYNC
        , sysPosix_MS_SYNC
        , sysPosix_MS_INVALIDATE :: CMemSyncFlags
    sysPosix_MS_ASYNC :: CSysconfName
    sysPosix_MS_ASYNC      = (CSysconfName
    1)
    {-# LINE 298 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_MS_SYNC       = (4)
    {-# LINE 299 "Foundation/System/Bindings/Posix.hsc" #-}
    sysPosix_MS_INVALIDATE = (2)
    {-# LINE 300 "Foundation/System/Bindings/Posix.hsc" #-}

    foreign import ccall unsafe "mmap"
        sysPosixMmap :: Ptr a -> CSize -> CMemProtFlags -> CMemMappingFlags -> CFd -> COff -> IO (Ptr a)

    foreign import ccall unsafe "munmap"
        sysPosixMunmap :: Ptr a -> CSize -> IO CInt

    {-# LINE 308 "Foundation/System/Bindings/Posix.hsc" #-}
    foreign import ccall unsafe "posix_madvise"
        sysPosixMadvise :: Ptr a -> CSize -> CMemAdvice -> IO CInt

    {-# LINE 314 "Foundation/System/Bindings/Posix.hsc" #-}

    foreign import ccall unsafe "msync"
        sysPosixMsync :: Ptr a -> CSize -> CMemSyncFlags -> IO CInt

    foreign import ccall unsafe "mprotect"
        sysPosixMprotect :: Ptr a -> CSize -> CMemProtFlags -> IO CInt

    {-# LINE 322 "Foundation/System/Bindings/Posix.hsc" #-}
    foreign import ccall unsafe "mlock"
        sysPosixMlock :: Ptr a -> CSize -> IO CInt

    {-# LINE 328 "Foundation/System/Bindings/Posix.hsc" #-}

    {-# LINE 330 "Foundation/System/Bindings/Posix.hsc" #-}
    foreign import ccall unsafe "munlock"
        sysPosixMunlock :: Ptr a -> CSize -> IO CInt

    {-# LINE 336 "Foundation/System/Bindings/Posix.hsc" #-}

    sysPosix_SC_PAGESIZE :: CSysconfName
    sysPosix_SC_PAGESIZE :: CSysconfName
    sysPosix_SC_PAGESIZE = (CSysconfName
    30)
    {-# LINE 339 "Foundation/System/Bindings/Posix.hsc" #-}

    foreign import ccall unsafe "sysconf"
        sysPosixSysconf :: CSysconfName -> CLong
    --------------------------------------------------------------------------------
    -- files
    --------------------------------------------------------------------------------
    foreign import ccall unsafe "open"
        sysPosixOpen :: Ptr CChar -> COpenFlags -> CMode -> IO CFd
    foreign import ccall unsafe "openat"
        sysPosixOpenAt :: CFd -> Ptr CChar -> COpenFlags -> CMode -> IO CFd
    foreign import ccall unsafe "close"
        sysPosixClose :: CFd -> IO CInt

    foreign import capi "fcntl.h fcntl"
        sysPosixFnctlNoArg :: CFd -> CInt -> IO CInt
    foreign import capi "fcntl.h fcntl"
        sysPosixFnctlPtr :: CFd -> CInt -> Ptr a -> IO CInt

    foreign import ccall unsafe "ftruncate"
        sysPosixFtruncate :: CFd -> COff -> IO CInt

    --------------------------------------------------------------------------------
    -- directories
    --------------------------------------------------------------------------------

    foreign import ccall unsafe "opendir"
        sysPosixOpendir :: Ptr CChar -> IO (Ptr CDir)
    foreign import ccall unsafe "fdopendir"
        sysPosixFdopendir :: CFd -> IO (Ptr CDir)
    foreign import ccall unsafe "readdir"
        sysPosixReaddir :: Ptr CDir -> IO (Ptr CDirent)
    foreign import ccall unsafe "readdir_r"
        sysPosixReaddirR :: Ptr CDir -> Ptr CDirent -> Ptr (Ptr CDirent) -> IO CInt
    foreign import ccall unsafe "telldir"
        sysPosixTelldir :: Ptr CDir -> IO CLong
    foreign import ccall unsafe "seekdir"
        sysPosixSeekdir :: Ptr CDir -> CLong -> IO ()
    foreign import ccall unsafe "rewinddir"
        sysPosixRewinddir :: Ptr CDir -> IO ()
    foreign import ccall unsafe "closedir"
        sysPosixClosedir :: Ptr CDir -> IO CInt
    foreign import ccall unsafe "dirfd"
        sysPosixDirfd :: Ptr CDir -> IO CFd