4-- Module : Streamly.Internal.FileSystem.IOVec
5-- Copyright : (c) 2019 Composewell Technologies
8-- Maintainer : streamly@composewell.com
9-- Stability : experimental
12-- Low level IO routines interfacing the operating system.
15module Streamly.Internal.FileSystem.IOVec
23import Data.Word (Word8)
24#if (WORD_SIZE_IN_BITS == 32)
25import Data.Word (Word32)
27import Data.Word (Word64)
29import Foreign.C.Types (CInt(..))
30import Foreign.Ptr (Ptr)
31import System.Posix.Types (CSsize(..))
32#if !defined(mingw32_HOST_OS)
33import Foreign.Storable (Storable(..))
36-------------------------------------------------------------------------------
38-------------------------------------------------------------------------------
41 { iovBase :: {-# UNPACK #-} !(Ptr Word8)
42#if (WORD_SIZE_IN_BITS == 32)
43 , iovLen :: {-# UNPACK #-} !Word32
45 , iovLen :: {-# UNPACK #-} !Word64
49#if !defined(mingw32_HOST_OS)
53instance Storable IOVec where
54 sizeOf _ = #{size struct iovec}
55 alignment _ = #{alignment struct iovec}
57 base <- #{peek struct iovec, iov_base} ptr
58 len :: #{type size_t} <- #{peek struct iovec, iov_len} ptr
59 return $ IOVec base len
61 let base = iovBase vec
62 len :: #{type size_t} = iovLen vec
63 #{poke struct iovec, iov_base} ptr base
64 #{poke struct iovec, iov_len} ptr len
67-- capi calling convention does not work without -fobject-code option with GHCi
68-- so using this in DEVBUILD only for now.
70#if !defined(mingw32_HOST_OS) && defined DEVBUILD
71foreign import capi unsafe "sys/uio.h writev"
72 c_writev :: CInt -> Ptr IOVec -> CInt -> IO CSsize
74foreign import capi safe "sys/uio.h writev"
75 c_safe_writev :: CInt -> Ptr IOVec -> CInt -> IO CSsize
78c_writev :: CInt -> Ptr IOVec -> CInt -> IO CSsize
79c_writev = error "writev not implemented"
81c_safe_writev :: CInt -> Ptr IOVec -> CInt -> IO CSsize
82c_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