2-- Module : Streamly.FileSystem.IOVec
3-- Copyright : (c) 2019 Composewell Technologies
6-- Maintainer : streamly@composewell.com
7-- Stability : experimental
10-- Low level IO routines interfacing the operating system.
13module Streamly.FileSystem.IOVec
20import Data.Word (Word8)
21#if defined(i386_HOST_ARCH)
22import Data.Word (Word32)
24import Data.Word (Word64)
26import Foreign.C.Types (CInt(..))
27import Foreign.Ptr (Ptr)
28import System.Posix.Types (CSsize(..))
29#if !defined(mingw32_HOST_OS)
30import Foreign.Storable (Storable(..))
33-------------------------------------------------------------------------------
35-------------------------------------------------------------------------------
38 { iovBase :: {-# UNPACK #-} !(Ptr Word8)
39#if defined(i386_HOST_ARCH)
40 , iovLen :: {-# UNPACK #-} !Word32
42 , iovLen :: {-# UNPACK #-} !Word64
46#if !defined(mingw32_HOST_OS)
50instance Storable IOVec where
51 sizeOf _ = #{size struct iovec}
52 alignment _ = #{alignment struct iovec}
54 base <- #{peek struct iovec, iov_base} ptr
55 len :: #{type size_t} <- #{peek struct iovec, iov_len} ptr
56 return $ IOVec base len
58 let base = iovBase vec
59 len :: #{type size_t} = iovLen vec
60 #{poke struct iovec, iov_base} ptr base
61 #{poke struct iovec, iov_len} ptr len
64-- capi calling convention does not work without -fobject-code option with GHCi
65-- so using this in DEVBUILD only for now.
67#if !defined(mingw32_HOST_OS) && defined DEVBUILD
68foreign import capi unsafe "sys/uio.h writev"
69 c_writev :: CInt -> Ptr IOVec -> CInt -> IO CSsize
71foreign import capi safe "sys/uio.h writev"
72 c_safe_writev :: CInt -> Ptr IOVec -> CInt -> IO CSsize
75c_writev :: CInt -> Ptr IOVec -> CInt -> IO CSsize
76c_writev = error "writev not implemented"
78c_safe_writev :: CInt -> Ptr IOVec -> CInt -> IO CSsize
79c_safe_writev = error "writev not implemented"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list