posix-api 0.7.0.0 → 0.7.1.0
raw patch · 4 files changed
+78/−1 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Posix.File: uninterruptibleOpenModeUntypedFlags :: ManagedCString -> CInt -> CMode -> IO (Either Errno Fd)
+ Posix.Struct.AddressInfo.Poke: address :: Ptr AddressInfo -> Ptr SocketAddress -> IO ()
+ Posix.Struct.AddressInfo.Poke: addressLength :: Ptr AddressInfo -> CInt -> IO ()
+ Posix.Struct.AddressInfo.Poke: family :: Ptr AddressInfo -> Family -> IO ()
+ Posix.Struct.AddressInfo.Poke: flags :: Ptr AddressInfo -> AddressInfoFlags -> IO ()
+ Posix.Struct.AddressInfo.Poke: next :: Ptr AddressInfo -> Ptr AddressInfo -> IO ()
+ Posix.Struct.AddressInfo.Poke: protocol :: Ptr AddressInfo -> Protocol -> IO ()
+ Posix.Struct.AddressInfo.Poke: socketType :: Ptr AddressInfo -> Type -> IO ()
Files
- CHANGELOG.md +5/−0
- posix-api.cabal +2/−1
- src/Posix/File.hs +11/−0
- src/Posix/Struct/AddressInfo/Poke.hsc +60/−0
CHANGELOG.md view
@@ -7,6 +7,11 @@ This project adheres to the [Haskell Package Versioning Policy](https://pvp.haskell.org/). +## [0.7.1.0] - 2023-??-??++- Add `uninterruptibleOpenModeUntypedFlags`.+- Add `Posix.Struct.AddressInfo.Poke`.+ ## [0.7.0.0] - 2023-08-30 - For now, remove all of the functions that work on UnliftedArray. These
posix-api.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: posix-api-version: 0.7.0.0+version: 0.7.1.0 synopsis: posix bindings description: This library provides a very thin wrapper around POSIX APIs. It can be@@ -98,6 +98,7 @@ Posix.Types Posix.Struct.SocketAddressInternet.Peek Posix.Struct.AddressInfo.Peek+ Posix.Struct.AddressInfo.Poke other-modules: Linux.Epoll.Types Linux.MessageQueue.Types
src/Posix/File.hs view
@@ -17,6 +17,7 @@ , uninterruptibleOpen , uninterruptibleOpenMode , uninterruptibleOpenUntypedFlags+ , uninterruptibleOpenModeUntypedFlags , writeByteArray , writeMutableByteArray , close@@ -126,6 +127,16 @@ -> IO (Either Errno Fd) uninterruptibleOpenUntypedFlags (ManagedCString (ByteArray name)) x = c_unsafe_open name x >>= errorsFromFd++-- | Variant of 'uninterruptibleOpenMode' that does not help the caller with+-- the types of the flags.+uninterruptibleOpenModeUntypedFlags ::+ ManagedCString -- ^ NULL-terminated file name+ -> CInt -- ^ Flags+ -> CMode -- ^ Mode+ -> IO (Either Errno Fd)+uninterruptibleOpenModeUntypedFlags (ManagedCString (ByteArray name)) !x !mode =+ c_unsafe_open_mode name x mode >>= errorsFromFd uninterruptibleOpenMode :: ManagedCString -- ^ NULL-terminated file name
+ src/Posix/Struct/AddressInfo/Poke.hsc view
@@ -0,0 +1,60 @@+#include <sys/socket.h>+#include <netdb.h>+#include <netinet/in.h>++{-# language DataKinds #-}++-- | Setters for assigning fields of @struct addrinfo@:+--+-- > struct addrinfo {+-- > int ai_flags;+-- > int ai_family;+-- > int ai_socktype;+-- > int ai_protocol;+-- > socklen_t ai_addrlen;+-- > struct sockaddr *ai_addr;+-- > char *ai_canonname;+-- > struct addrinfo *ai_next;+-- > };+module Posix.Struct.AddressInfo.Poke+ ( flags+ , family+ , socketType+ , protocol+ , addressLength+ , address+ , next+ ) where++import Posix.Socket.Types (AddressInfoFlags(..),SocketAddress,Family,Type,AddressInfo,Protocol)+import Foreign.C.Types (CInt)+import Foreign.Ptr (Ptr)+import Foreign.Storable (pokeByteOff)++-- | Get @ai_flags@.+flags :: Ptr AddressInfo -> AddressInfoFlags -> IO ()+flags ptr = #{poke struct addrinfo, ai_flags} ptr++-- | Get @ai_family@.+family :: Ptr AddressInfo -> Family -> IO ()+family ptr = #{poke struct addrinfo, ai_family} ptr++-- | Get @ai_socktype@.+socketType :: Ptr AddressInfo -> Type -> IO ()+socketType ptr = #{poke struct addrinfo, ai_socktype} ptr++-- | Get @ai_protocol@.+protocol :: Ptr AddressInfo -> Protocol -> IO ()+protocol ptr = #{poke struct addrinfo, ai_protocol} ptr++-- | Get @ai_addrlen@.+addressLength :: Ptr AddressInfo -> CInt -> IO ()+addressLength ptr = #{poke struct addrinfo, ai_addrlen} ptr++-- | Get @ai_addr@.+address :: Ptr AddressInfo -> Ptr SocketAddress -> IO ()+address ptr = #{poke struct addrinfo, ai_addr} ptr++-- | Get @ai_next@.+next :: Ptr AddressInfo -> Ptr AddressInfo -> IO ()+next ptr = #{poke struct addrinfo, ai_next} ptr