Copyright | (c) Dong Han 2020 |
---|---|
License | BSD |
Maintainer | winterland1989@gmail.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
This module provide methods for retrieving various environment infomation. There's no encoding guarantee about these information, if you want textual representation, use UTF8 assumption is recommended. i.e. use "Z.Data.Text.validate".
Synopsis
- getArgs :: IO [CBytes]
- getAllEnv :: HasCallStack => IO [(CBytes, CBytes)]
- getEnv :: HasCallStack => CBytes -> IO (Maybe CBytes)
- getEnv' :: HasCallStack => CBytes -> IO CBytes
- setEnv :: HasCallStack => CBytes -> CBytes -> IO ()
- unsetEnv :: HasCallStack => CBytes -> IO ()
- getResUsage :: HasCallStack => IO ResUsage
- getResidentSetMemory :: HasCallStack => IO CSize
- getUpTime :: HasCallStack => IO Double
- getHighResolutionTime :: IO Word64
- newtype PID = PID CInt
- getPID :: IO PID
- getPPID :: IO PID
- getHostname :: HasCallStack => IO CBytes
- getOSName :: IO OSName
- data OSName = OSName {
- os_sysname :: Text
- os_release :: Text
- os_version :: Text
- os_machine :: Text
- getRandom :: Int -> IO Bytes
- getRandomT :: Int -> IO Bytes
arguments
environment variables
getAllEnv :: HasCallStack => IO [(CBytes, CBytes)] Source #
Retrieves the environment variable.
Warning: This function is not thread safe.
getEnv :: HasCallStack => CBytes -> IO (Maybe CBytes) Source #
Retrieves the environment variable specified by name.
Warning: This function is not thread safe.
getEnv' :: HasCallStack => CBytes -> IO CBytes Source #
Retrieves the environment variable specified by name, throw NoSuchThing
if not exists.
Warning: This function is not thread safe.
setEnv :: HasCallStack => CBytes -> CBytes -> IO () Source #
Creates or updates the environment variable specified by name with value.
Warning: This function is not thread safe.
unsetEnv :: HasCallStack => CBytes -> IO () Source #
Deletes the environment variable specified by name if such environment variable exists.
Warning: This function is not thread safe.
other environment infos
getResUsage :: HasCallStack => IO ResUsage Source #
Gets the resource usage measures for the current process.
On Windows not all fields are set, the unsupported fields are filled with zeroes.
See ResUsage
for more details.
getResidentSetMemory :: HasCallStack => IO CSize Source #
Gets the resident set size (RSS) for the current process.
getHighResolutionTime :: IO Word64 Source #
Returns the current high-resolution real time.
This is expressed in nanoseconds. It is relative to an arbitrary time in the past. It is not related to the time of day and therefore not subject to clock drift. The primary use is for measuring performance between intervals.
Instances
getHostname :: HasCallStack => IO CBytes Source #
Returns the hostname as a null-terminated string.
OSName | |
|
Instances
Eq OSName Source # | |
Ord OSName Source # | |
Show OSName Source # | |
Generic OSName Source # | |
ToValue OSName Source # | |
Defined in Z.IO.UV.FFI | |
EncodeJSON OSName Source # | |
Defined in Z.IO.UV.FFI encodeJSON :: OSName -> Builder () # | |
FromValue OSName Source # | |
ShowT OSName Source # | |
Defined in Z.IO.UV.FFI toTextBuilder :: Int -> OSName -> TextBuilder () # | |
type Rep OSName Source # | |
Defined in Z.IO.UV.FFI type Rep OSName = D1 (MetaData "OSName" "Z.IO.UV.FFI" "Z-IO-0.1.5.2-E8snmgiQshiGGBBWzHXGeM" False) (C1 (MetaCons "OSName" PrefixI True) ((S1 (MetaSel (Just "os_sysname") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text) :*: S1 (MetaSel (Just "os_release") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) :*: (S1 (MetaSel (Just "os_version") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text) :*: S1 (MetaSel (Just "os_machine") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))) |