packages feed

bsd-sysctl 1.0.1 → 1.0.2

raw patch · 2 files changed

+20/−7 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ System.BSD.Sysctl: sysctlNameToOid :: String -> IO OID
+ System.BSD.Sysctl: sysctlNameToOidArgs :: String -> [Int32] -> IO OID

Files

System/BSD/Sysctl.hsc view
@@ -20,6 +20,11 @@ -- 'Storable' instance.  It is also possible to retrieve data whose size changes -- at runtime with the 'sysctlPeekArray' function. --+-- On some platforms, there are sysctl nodes that accept parameters via+-- additional components in the OID (see for instance the "kern.proc.pid" sysctl+-- described in sysctl(3) on FreeBSD).  The 'sysctlNameToOidArgs' makes it easy+-- to query such nodes as well.+-- -- Nodes may be queried either by their OID as a list of integers, by their -- binary OID for maximum speed, or by their names on platforms that support it.  -------------------------------------------------------------------------------@@ -37,10 +42,8 @@   OID,    -- * OID creation and extraction-#ifdef HAVE_SYSCTLNAMETOMIB   sysctlNameToOid,	-- :: String -> IO OID   sysctlNameToOidArgs,	-- :: String -> [#{type int}] -> IO OID-#endif   sysctlPrepareOid,	-- :: [#{type int}] -> IO OID   sysctlExtractOid,	-- :: OID -> IO [#{type int}] @@ -112,15 +115,21 @@ -- on (at least) Linux and OpenBSD. foreign import ccall unsafe "sysctlnametomib"   c_sysctlnametomib :: CString -> Ptr CInt -> Ptr CSize -> IO CInt+#endif  -- | Get the 'OID' corresponding to a sysctl name. sysctlNameToOid :: String -> IO OID+#ifdef HAVE_SYSCTLNAMETOMIB sysctlNameToOid name = sysctlNameToOidArgs name []+#else+sysctlNameToOid name = error "not available on this platform"+#endif  -- | Like 'sysctlNameToOid', but allows to provide a list of -- additional integers to append to the OID, for specific sysctl -- nodes that support parameters this way. sysctlNameToOidArgs :: String -> [#{type int}] -> IO OID+#ifdef HAVE_SYSCTLNAMETOMIB sysctlNameToOidArgs name args =   withCString name $ \cname -> do     allocaArray (fromIntegral maxlen) $ \oid -> do@@ -138,7 +147,11 @@         return (OID fp (fromIntegral len))   where maxlen = #{const CTL_MAXNAME}         alen   = length args+#else+sysctlNameToOidArgs name args = error "not available on this platform"+#endif +#ifdef HAVE_SYSCTLNAMETOMIB instance SysctlKey String where   withKey name f = sysctlNameToOid name >>= flip withKey f #endif
bsd-sysctl.cabal view
@@ -1,5 +1,5 @@ Name:		bsd-sysctl-Version:	1.0.1+Version:	1.0.2 License-File:	LICENSE License:	BSD3 Author:		Maxime Henrion@@ -8,11 +8,11 @@ Category:	System, BSD Synopsis:	Access to the BSD sysctl(3) interface Description:-  This module provides efficient access to the BSD sysctl(3)-  interface via the Haskell FFI.+  This module provides efficient access to the BSD sysctl(3) interface via the+  Haskell FFI.   .-  It allows to read and write both basic sysctl types, as well as complex-  opaque types (typically C structures) described via Storable instances.+  It allows to read and write both basic sysctl types, as well as complex opaque+  types (typically C structures) described via Storable instances. Build-Type:	Simple Cabal-Version:	>= 1.2 Tested-with:	GHC ==6.10