2{-# LANGUAGE BangPatterns #-}
3{-# LANGUAGE CApiFFI #-}
4{-# LANGUAGE ScopedTypeVariables #-}
7-- Module : Streamly.FileSystem.IOVec
8-- Copyright : (c) 2019 Composewell Technologies
11-- Maintainer : harendra.kumar@gmail.com
12-- Stability : experimental
15-- Low level IO routines interfacing the operating system.
18module Streamly.FileSystem.IOVec
25import Data.Word (Word8, Word64)
26import Foreign.C.Types (CInt(..))
27import Foreign.Ptr (Ptr)
28import Foreign.Storable (Storable(..))
29import System.Posix.Types (CSsize(..))
31-------------------------------------------------------------------------------
33-------------------------------------------------------------------------------
35#if !defined(mingw32_HOST_OS)
40 { iovBase :: {-# UNPACK #-} !(Ptr Word8)
41 , iovLen :: {-# UNPACK #-} !Word64
44instance Storable IOVec where
45 sizeOf _ = #{size struct iovec}
46 alignment _ = #{alignment struct iovec}
48 base <- #{peek struct iovec, iov_base} ptr
49 len :: #{type size_t} <- #{peek struct iovec, iov_len} ptr
50 return $ IOVec base len
52 let base = iovBase vec
53 len :: #{type size_t} = iovLen vec
54 #{poke struct iovec, iov_base} ptr base
55 #{poke struct iovec, iov_len} ptr len
57foreign import capi unsafe "sys/uio.h writev"
58 c_writev :: CInt -> Ptr IOVec -> CInt -> IO CSsize
60foreign import capi safe "sys/uio.h writev"
61 c_safe_writev :: CInt -> Ptr IOVec -> CInt -> IO CSsize
64c_writev = error "writev not implemented for windows"
65c_safe_writev = error "writev not implemented for windows"
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