unix-bytestring 0.3.7.3 → 0.3.7.4
raw patch · 5 files changed
+155/−117 lines, 5 filesdep ~basedep ~bytestringnew-uploaderPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, bytestring
API changes (from Hackage documentation)
- System.Posix.Types.Iovec: instance Storable CIovec
- System.Posix.Types.Iovec: iov_base :: CIovec -> {-# UNPACK #-} !(Ptr Word8)
- System.Posix.Types.Iovec: iov_len :: CIovec -> {-# UNPACK #-} !CSize
+ System.Posix.Types.Iovec: [iov_base] :: CIovec -> {-# UNPACK #-} !Ptr Word8
+ System.Posix.Types.Iovec: [iov_len] :: CIovec -> {-# UNPACK #-} !CSize
+ System.Posix.Types.Iovec: instance Foreign.Storable.Storable System.Posix.Types.Iovec.CIovec
- System.Posix.Types.Iovec: CIovec :: {-# UNPACK #-} !(Ptr Word8) -> {-# UNPACK #-} !CSize -> CIovec
+ System.Posix.Types.Iovec: CIovec :: {-# UNPACK #-} !Ptr Word8 -> {-# UNPACK #-} !CSize -> CIovec
Files
- README +0/−90
- README.md +116/−0
- src/System/Posix/IO/ByteString.hsc +12/−12
- src/System/Posix/IO/ByteString/Lazy.hs +4/−4
- unix-bytestring.cabal +23/−11
− README
@@ -1,90 +0,0 @@-unix-bytestring-===============--In general, this is a simple package and should be easy to install.-You must have hsc2hs installed in order to compile the package (but-then you probably already do). With the cabal-install program you-can just do:-- $> cabal install unix-bytestring--Or if you don't have cabal-install, then you can use the Cabal library:-- $> runhaskell Setup.hs configure- $> runhaskell Setup.hs build- $> runhaskell Setup.hs test- $> runhaskell Setup.hs haddock --hyperlink-source- $> runhaskell Setup.hs copy- $> runhaskell Setup.hs register--The test step is optional and currently does nothing. The Haddock-step is also optional.---FFI Problems-============--The unix-bytestring package uses standard POSIX header files-<sys/types.h>, <sys/uio.h>, and <unistd.h>. If Cabal has difficulty-finding these files or reports another error, be sure your include-path variables are correct. If the problem persists, contact the-maintainer.---Building for GHC (6.8 and above)-================================--Nothing special to mention. ---Building for Hugs (September 2006)-==================================--I haven't actually compiled this for Hugs because I don't have a-new enough version of Cabal for it, but I don't forsee any difficulties.-If you do compile this for Hugs, let the maintainer know how it-went.--When compiling for Hugs, see the following bugs for Cabal's interaction-with ffihugs. These bugs do not currently affect this package, but-this notice is here in case they affect future versions. For more-details and a minimal regression suite, see:-- <http://community.haskell.org/~wren/cabal-ffihugstest/>---(1) <http://hackage.haskell.org/trac/hackage/ticket/526>-Options in hugs-options aren't passed through to ffihugs, most-importantly -98 and +o are the ones we'd like to pass. For enabling-the +o flag Hugs-Sept06 does not honor:- pragma {-# LANGUAGE OverlappingInstances #-}- pragma {-# OPTIONS_HUGS +o #-}- cabal extensions: OverlappingInstances-And the -98 flag has similar issues. Therefore this is a real-problem.--Immediate solution: The options set in hugs-options should be passed-to ffihugs as well. As of Cabal 1.6 they are not passed (verified-by Duncan Coutts). The two programs accept all the same options,-so this is valid.--Ideal solution: Based on the extensions field, Cabal should-automatically determine whether -98 and +o need to be enabled (for-both hugs and ffihugs).---(2) <http://hackage.haskell.org/trac/hackage/ticket/527>-If CPP is being used in conjunction with FFI, then cpp/cpphs is not-called before ffihugs is called. Thus, users must pass an -F flag-to ffihugs in order to declare a code filter (and must pass all-cpp-options to -F manually). For example:-- --ffihugs-option=-F'cpp -P -traditional -D__HUGS__ -D__BLAH__'--This requires duplicating the build specifications, which defeats-the point of Cabal. Also it leads to tricky issues about ensuring-the proper level of quoting/escaping. (e.g. using the plural,---ffihugs-options=..., breaks it. Wrapping the -F'cpp...' in double-quotes breaks it.)------------------------------------------------------------- fin.
+ README.md view
@@ -0,0 +1,116 @@+unix-bytestring+===============+[](https://hackage.haskell.org/package/unix-bytestring) +[](https://github.com/wrengr/unix-bytestring/actions?query=workflow%3Aci)+[](http://packdeps.haskellers.com/specific?package=unix-bytestring)++Unix/Posix-specific functions for `ByteString`s.++This package provides `ByteString` file-descriptor based I/O API,+designed loosely after the `String` file-descriptor based I/O API+in `System.Posix.IO`. The functions here wrap standard C implementations+of the functions specified by the ISO/IEC 9945-1:1990 (“POSIX.1”)+and X/Open Portability Guide Issue 4, Version 2 (“XPG4.2”)+specifications.++Note that this package doesn't require the unix package as a+dependency. But you'll need it in order to get your hands on an+`Fd`, so we're not offering a complete replacement.+++## Install++In general, this is a simple package and should be easy to install.+You must have hsc2hs installed in order to compile the package (but+then you probably already do). With the cabal-install program you+can just do:++ $> cabal install unix-bytestring++Or if you don't have cabal-install, then you can use the Cabal library:++ $> runhaskell Setup.hs configure+ $> runhaskell Setup.hs build+ $> runhaskell Setup.hs test+ $> runhaskell Setup.hs haddock --hyperlink-source+ $> runhaskell Setup.hs copy+ $> runhaskell Setup.hs register++The test step is optional and currently does nothing. The Haddock+step is also optional.+++### FFI Problems++The unix-bytestring package uses standard POSIX header files+`<sys/types.h>`, `<sys/uio.h>`, and `<unistd.h>`. If Cabal has+difficulty finding these files or reports another error, be sure+your include path variables are correct. If the problem persists,+contact the maintainer.+++### Building for GHC (6.8 and above)++Nothing special to mention. +++### Building for Hugs (September 2006)++I haven't actually compiled this for Hugs because I don't have a+new enough version of Cabal for it, but I don't forsee any difficulties.+If you do compile this for Hugs, let the maintainer know how it+went.++When compiling for Hugs, see the following bugs for Cabal's interaction+with ffihugs. These bugs do not currently affect this package, but+this notice is here in case they affect future versions. For more+details and a minimal regression suite, see:++ <http://community.haskell.org/~wren/cabal-ffihugstest/>+++(1) <http://hackage.haskell.org/trac/hackage/ticket/526>+Options in hugs-options aren't passed through to ffihugs, most+importantly -98 and +o are the ones we'd like to pass. For enabling+the +o flag Hugs-Sept06 does not honor:+ pragma {-# LANGUAGE OverlappingInstances #-}+ pragma {-# OPTIONS_HUGS +o #-}+ cabal extensions: OverlappingInstances+And the -98 flag has similar issues. Therefore this is a real+problem.++Immediate solution: The options set in hugs-options should be passed+to ffihugs as well. As of Cabal 1.6 they are not passed (verified+by Duncan Coutts). The two programs accept all the same options,+so this is valid.++Ideal solution: Based on the extensions field, Cabal should+automatically determine whether -98 and +o need to be enabled (for+both hugs and ffihugs).+++(2) <http://hackage.haskell.org/trac/hackage/ticket/527>+If CPP is being used in conjunction with FFI, then cpp/cpphs is not+called before ffihugs is called. Thus, users must pass an -F flag+to ffihugs in order to declare a code filter (and must pass all+cpp-options to -F manually). For example:++ --ffihugs-option=-F'cpp -P -traditional -D__HUGS__ -D__BLAH__'++This requires duplicating the build specifications, which defeats+the point of Cabal. Also it leads to tricky issues about ensuring+the proper level of quoting/escaping. (e.g. using the plural,+--ffihugs-options=..., breaks it. Wrapping the -F'cpp...' in double+quotes breaks it.)+++## Links++* [Website](http://cl.indiana.edu/~wren/)+* [Blog](http://winterkoninkje.dreamwidth.org/)+* [Twitter](https://twitter.com/wrengr)+* [Hackage](http://hackage.haskell.org/package/unix-bytestring)+* [Darcs](http://code.haskell.org/~wren/unix-bytestring)+* [GitHub (clone)](https://github.com/wrengr/unix-bytestring)+* [Haddock (Darcs version)+ ](http://code.haskell.org/~wren/unix-bytestring/dist/doc/html/unix-bytestring)
src/System/Posix/IO/ByteString.hsc view
@@ -24,10 +24,10 @@ {-# LANGUAGE ForeignFunctionInterface #-} {-# OPTIONS_GHC -fwarn-tabs #-} ------------------------------------------------------------------- 2013.08.08+-- 2021.10.16 -- | -- Module : System.Posix.IO.ByteString--- Copyright : Copyright (c) 2010--2015 wren gayle romano+-- Copyright : Copyright (c) 2010--2021 wren gayle romano -- License : BSD -- Maintainer : wren@community.haskell.org -- Stability : experimental@@ -58,7 +58,7 @@ , fdPreadBuf , tryFdPreadBuf , fdPreads- + -- ** Writing -- *** The POSIX.1 @write(2)@ syscall , fdWrite@@ -73,9 +73,9 @@ , fdPwrite , fdPwriteBuf , tryFdPwriteBuf- + -- ** Seeking- -- | These functions are not 'ByteString' related, but are+ -- | These functions are not 'BS.ByteString' related, but are -- provided here for API completeness. -- *** The POSIX.1 @lseek(2)@ syscall@@ -189,7 +189,7 @@ -> IO BS.ByteString -- ^ The bytes read. fdRead fd nbytes | nbytes <= 0 = return BS.empty- | otherwise = + | otherwise = BSI.createAndTrim (fromIntegral nbytes) $ \buf -> do rc <- fdReadBuf fd buf nbytes if 0 == rc@@ -269,7 +269,7 @@ -- if iovcnt <= 0 || > 16, -- if one of the iov_len values in the iov array was negative, -- if the sum of the iov_len values in the iov array overflowed a 32-bit integer.- + fdReadvBufSafe :: Fd -> Ptr CIovec -> Int -> IO ByteCount fdReadvBufSafe fd = go 0 where@@ -477,7 +477,7 @@ ---------------------------------------------------------------- -----------------------------------------------------------------foreign import ccall safe "write" +foreign import ccall safe "write" -- ssize_t write(int fildes, const void *buf, size_t nbyte); c_safe_write :: CInt -> Ptr CChar -> CSize -> IO CSsize @@ -498,7 +498,7 @@ -> IO ByteCount -- ^ How many bytes were actually written. fdWriteBuf fd buf nbytes | nbytes <= 0 = return 0- | otherwise = + | otherwise = fmap fromIntegral $ C.throwErrnoIfMinus1Retry _fdWriteBuf $ c_safe_write@@ -578,9 +578,9 @@ -- but we need to have an early exit for incomplete writes -- (which normally requires a right fold). Hence this recursion. go acc [] = return (acc, 0, [])- go acc ccs@(c:cs) = do- rc <- fdWrite fd c- let acc' = acc+rc in acc' `seq` do+ go acc ccs@(c:cs) =+ fdWrite fd c >>= \rc ->+ let acc' = acc+rc in acc' `seq` if rc == fromIntegral (BS.length c) then go acc' cs else return (acc', rc, ccs)
src/System/Posix/IO/ByteString/Lazy.hs view
@@ -89,10 +89,10 @@ -- but we need to have an early exit for incomplete writes -- (which normally requires a right fold). Hence this recursion. go acc BLI.Empty = return (acc, BL.empty)- go acc (BLI.Chunk c cs) = do- rc <- PosixBS.fdWrite fd c- let acc' = acc+rc in acc' `seq` do- let rcInt = fromIntegral rc in rcInt `seq` do+ go acc (BLI.Chunk c cs) =+ PosixBS.fdWrite fd c >>= \rc ->+ let acc' = acc+rc in acc' `seq`+ let rcInt = fromIntegral rc in rcInt `seq` if rcInt == BS.length c then go acc' cs else return (acc', BLI.Chunk (BSU.unsafeDrop rcInt c) cs)
unix-bytestring.cabal view
@@ -1,19 +1,19 @@ ------------------------------------------------------------------- wren gayle romano <wren@community.haskell.org> ~ 2015.05.30+-- wren gayle romano <wren@community.haskell.org> ~ 2021.10.16 ---------------------------------------------------------------- --- By and large Cabal >=1.2 is fine; but >= 1.6 gives tested-with:--- and source-repository:.-Cabal-Version: >= 1.6+-- Cabal >=1.10 is required by Hackage.+Cabal-Version: >= 1.10 Build-Type: Simple Name: unix-bytestring-Version: 0.3.7.3+Version: 0.3.7.4 Stability: provisional Homepage: http://code.haskell.org/~wren/+Bug-Reports: http://github.com/wrengr/unix-bytestring/issues Author: wren gayle romano Maintainer: wren@community.haskell.org-Copyright: Copyright (c) 2010--2015 wren gayle romano+Copyright: Copyright (c) 2010--2021 wren gayle romano License: BSD3 License-File: LICENSE @@ -32,16 +32,28 @@ dependency. But you'll need it in order to get your hands on an @Fd@, so we're not offering a complete replacement. -Tested-With:- GHC ==6.12.1, GHC ==6.12.3, GHC ==7.4.2, GHC ==7.6.1, GHC ==7.8.0 Extra-source-files:- README, CHANGELOG+ README.md, CHANGELOG++-- This used to work with GHC 6.12.1, 6.12.3, 7.4.2, 7.6.1, 7.8.0,+-- but we don't verify any of those with CI.+-- <https://github.com/wrengr/unix-bytestring/actions?query=workflow%3Aci>+Tested-With:+ GHC ==8.0.2,+ GHC ==8.2.2,+ GHC ==8.4.4,+ GHC ==8.6.5,+ GHC ==8.8.4,+ GHC ==8.10.3,+ GHC ==9.0.1+ Source-Repository head Type: darcs Location: http://community.haskell.org/~wren/unix-bytestring ---------------------------------------------------------------- Library+ Default-Language: Haskell2010 Hs-Source-Dirs: src Exposed-Modules: Foreign.C.Error.Safe , System.Posix.IO.ByteString@@ -55,8 +67,8 @@ -- them on our own for better backwards compatibility. -- -- Not sure what the real minbound is on bytestring...- Build-Depends: base >= 4.1 && < 5- , bytestring >= 0.9.1.5+ Build-Depends: base >= 4.1 && < 4.16+ , bytestring >= 0.9.1.5 && < 0.12 ---------------------------------------------------------------- ----------------------------------------------------------- fin.