-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Access to the BSD sysctl(3) interface
--
-- 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.
@package bsd-sysctl
@version 1.0.3
-- | This module allows access to the BSD sysctl(3) interface via the
-- Haskell FFI.
--
-- Convenience functions to read and write the usual sysctl types are
-- provided, as well as more advanced functions to handle binary values
-- given a suitable 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.
module System.BSD.Sysctl
-- | The class of types that can be used to identify a sysctl node.
class SysctlKey k
-- | An efficient representation of a sysctl OID for maximum
-- performance.
data OID
-- | Prepare an OID for later use.
sysctlPrepareOid :: [Int32] -> IO OID
-- | Extract the list of integers contained in an OID.
sysctlExtractOid :: OID -> IO [Int32]
-- | Read a signed integer from a sysctl (the C int type).
sysctlReadInt :: (SysctlKey k) => k -> IO Int32
-- | Read an unsigned integer from a sysctl (the C unsigned int type).
sysctlReadUInt :: (SysctlKey k) => k -> IO Word32
-- | Read a signed long integer from a sysctl (the C long type).
sysctlReadLong :: (SysctlKey k) => k -> IO Int32
-- | Read an unsigned long integer from a sysctl (the C unsigned long
-- type).
sysctlReadULong :: (SysctlKey k) => k -> IO Word32
-- | Read a signed 64-bit integer from a sysctl.
sysctlReadQuad :: (SysctlKey k) => k -> IO Int64
-- | Read an unsigned 64-bit integer from a sysctl.
sysctlReadUQuad :: (SysctlKey k) => k -> IO Word64
-- | Read a string from a sysctl. If the string can possibly change with
-- time, use sysctlPeekArray for characters instead.
sysctlReadString :: (SysctlKey k) => k -> IO String
-- | Read a storable value from a sysctl node. This is useful to read
-- binary values such as C structures, otherwise the ad-hoc reading
-- functions should be used instead.
sysctlPeek :: (SysctlKey k, Storable a) => k -> IO a
-- | Like sysctlPeek, but allows to retrieve a list of elements
-- whose length can possibly change at runtime.
sysctlPeekArray :: (SysctlKey k, Storable a) => k -> IO [a]
-- | Write a signed integer to a sysctl (the C int type).
sysctlWriteInt :: (SysctlKey k) => k -> Int32 -> IO ()
-- | Write an unsigned integer to a sysctl (the C unsigned int type).
sysctlWriteUInt :: (SysctlKey k) => k -> Word32 -> IO ()
-- | Write a signed long integer to a sysctl (the C long type).
sysctlWriteLong :: (SysctlKey k) => k -> Int32 -> IO ()
-- | Write an unsigned long integer to a sysctl (the C unsigned long type).
sysctlWriteULong :: (SysctlKey k) => k -> Word32 -> IO ()
-- | Write a signed 64-bit integer to a sysctl.
sysctlWriteQuad :: (SysctlKey k) => k -> Int64 -> IO ()
-- | Write an unsigned 64-bit integer to a sysctl.
sysctlWriteUQuad :: (SysctlKey k) => k -> Word64 -> IO ()
-- | Write a string to a sysctl.
sysctlWriteString :: (SysctlKey k) => k -> String -> IO ()
-- | Write a storable value to a sysctl node. This is useful to write
-- binary values such as C structures, otherwise the ad-hoc writing
-- functions should be used instead.
sysctlPoke :: (SysctlKey k, Storable a) => k -> a -> IO ()
instance SysctlKey [Int32]
instance SysctlKey OID