snap-server 1.0.3.2 → 1.0.3.3
raw patch · 2 files changed
+29/−92 lines, 2 filesdep ~basedep ~criteriondep ~unix-compat
Dependency ranges changed: base, criterion, unix-compat
Files
- snap-server.cabal +29/−17
- src/System/SendFile/Darwin.hsc +0/−75
snap-server.cabal view
@@ -1,5 +1,5 @@ name: snap-server-version: 1.0.3.2+version: 1.0.3.3 synopsis: A web server for the Snap Framework description: Snap is a simple and fast web development framework and server written in@@ -145,8 +145,15 @@ System.SendFile, System.SendFile.Linux +-- Disabling sendfile() on OSX for now. See+--+-- https://github.com/snapframework/snap-core/issues/274 and+-- https://github.com/snapframework/snap-core/issues/91+-- if os(darwin) && !flag(portable)- cpp-options: -DOSX -DHAS_UNIX_SOCKETS+ cpp-options: -DHAS_UNIX_SOCKETS+ -- if os(darwin) && !flag(portable)+ -- cpp-options: -DOSX -DHAS_UNIX_SOCKETS if os(freebsd) && !flag(portable) cpp-options: -DFREEBSD -DHAS_SENDFILE -DHAS_UNIX_SOCKETS@@ -270,14 +277,15 @@ System.SendFile.Tests c-sources: test/cbits/errno_util.c - if os(darwin) && !flag(portable)- cpp-options: -DOSX -DHAS_SENDFILE -DHAS_UNIX_SOCKETS- other-modules:- System.SendFile,- System.SendFile.Darwin,- System.SendFile.Tests- c-sources: test/cbits/errno_util.c+ cpp-options: -DHAS_UNIX_SOCKETS+-- if os(darwin) && !flag(portable)+-- cpp-options: -DOSX -DHAS_SENDFILE -DHAS_UNIX_SOCKETS+-- other-modules:+-- System.SendFile,+-- System.SendFile.Darwin,+-- System.SendFile.Tests+-- c-sources: test/cbits/errno_util.c if os(freebsd) && !flag(portable) cpp-options: -DFREEBSD -DHAS_SENDFILE -DHAS_UNIX_SOCKETS@@ -369,10 +377,12 @@ System.SendFile.Linux if os(darwin) && !flag(portable)- cpp-options: -DOSX -DHAS_SENDFILE -DHAS_UNIX_SOCKETS- other-modules:- System.SendFile,- System.SendFile.Darwin+ cpp-options: -DHAS_UNIX_SOCKETS+-- if os(darwin) && !flag(portable)+-- cpp-options: -DOSX -DHAS_SENDFILE -DHAS_UNIX_SOCKETS+-- other-modules:+-- System.SendFile,+-- System.SendFile.Darwin if os(freebsd) && !flag(portable) cpp-options: -DFREEBSD -DHAS_SENDFILE -DHAS_UNIX_SOCKETS@@ -465,10 +475,12 @@ System.SendFile.Linux if os(darwin) && !flag(portable)- cpp-options: -DOSX -DHAS_SENDFILE -DHAS_UNIX_SOCKETS- other-modules:- System.SendFile,- System.SendFile.Darwin+ cpp-options: -DHAS_UNIX_SOCKETS+ -- if os(darwin) && !flag(portable)+ -- cpp-options: -DOSX -DHAS_SENDFILE -DHAS_UNIX_SOCKETS+ -- other-modules:+ -- System.SendFile,+ -- System.SendFile.Darwin if os(freebsd) && !flag(portable) cpp-options: -DFREEBSD -DHAS_SENDFILE -DHAS_UNIX_SOCKETS
− src/System/SendFile/Darwin.hsc
@@ -1,75 +0,0 @@-{-# LANGUAGE BangPatterns #-}-{-# LANGUAGE CPP #-}-{-# LANGUAGE ForeignFunctionInterface #-}--- | Darwin system-dependent code for 'sendfile'.-module System.SendFile.Darwin- ( sendFile- , sendFileImpl- , sendFileMode- ) where--import Control.Concurrent (threadWaitWrite)-import Data.Int-import Data.Word-import Foreign.C.Error (throwErrnoIfMinus1RetryMayBlock_)-#if __GLASGOW_HASKELL__ >= 703-import Foreign.C.Types (CInt (CInt))-#else-import Foreign.C.Types (CInt)-#endif-import Foreign.Marshal (alloca)-import Foreign.Ptr (Ptr, nullPtr)-import Foreign.Storable (peek, poke)-#if __GLASGOW_HASKELL__ >= 703-import System.Posix.Types (COff (COff), Fd (Fd))-#else-import System.Posix.Types (COff, Fd)-#endif---------------------------------------------------------------------------------sendFile :: Fd -> Fd -> Word64 -> Word64 -> IO Int64-sendFile = sendFileImpl c_sendfile threadWaitWrite-{-# INLINE sendFile #-}----------------------------------------------------------------------------------sendFileImpl :: (Fd -> Fd -> COff -> Ptr COff -> IO CInt)- -> (Fd -> IO ())- -> Fd -> Fd -> Word64 -> Word64 -> IO Int64-sendFileImpl !rawSendFile !wait out_fd in_fd off count- | count == 0 = return 0- | otherwise = alloca $ \pbytes -> do- poke pbytes $ fromIntegral count- sbytes <- sendfile rawSendFile wait out_fd in_fd (fromIntegral off)- pbytes- return $ fromIntegral sbytes-{-# INLINE sendFileImpl #-}----------------------------------------------------------------------------------sendfile :: (Fd -> Fd -> COff -> Ptr COff -> IO CInt)- -> (Fd -> IO ())- -> Fd -> Fd -> COff -> Ptr COff -> IO COff-sendfile rawSendFile wait out_fd in_fd off pbytes = do- throwErrnoIfMinus1RetryMayBlock_ "sendfile"- (rawSendFile out_fd in_fd off pbytes)- (wait out_fd)- peek pbytes-{-# INLINE sendfile #-}----------------------------------------------------------------------------------- in Darwin sendfile gives LFS support (no sendfile64 routine)-foreign import ccall unsafe "sys/uio.h sendfile" c_sendfile_darwin- :: Fd -> Fd -> COff -> Ptr COff -> Ptr () -> CInt -> IO CInt----------------------------------------------------------------------------------c_sendfile :: Fd -> Fd -> COff -> Ptr COff -> IO CInt-c_sendfile out_fd in_fd off pbytes =- c_sendfile_darwin in_fd out_fd off pbytes nullPtr 0-{-# INLINE c_sendfile #-}----------------------------------------------------------------------------------sendFileMode :: String-sendFileMode = "DARWIN_SENDFILE"