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
- getPriority :: HasCallStack => PID -> IO CInt
- setPriority :: HasCallStack => PID -> CInt -> IO ()
- pattern PRIORITY_LOW :: CInt
- pattern PRIORITY_BELOW_NORMAL :: CInt
- pattern PRIORITY_NORMAL :: CInt
- pattern PRIORITY_ABOVE_NORMAL :: CInt
- pattern PRIORITY_HIGH :: CInt
- pattern PRIORITY_HIGHEST :: CInt
- 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
Eq PID Source # | |
Ord PID Source # | |
Show PID Source # | |
Generic PID Source # | |
ToValue PID Source # | |
Defined in Z.IO.UV.FFI | |
EncodeJSON PID Source # | |
Defined in Z.IO.UV.FFI encodeJSON :: PID -> Builder () # | |
FromValue PID Source # | |
ShowT PID Source # | |
Defined in Z.IO.UV.FFI toTextBuilder :: Int -> PID -> TextBuilder () # | |
Unaligned PID Source # | |
Defined in Z.IO.UV.FFI unalignedSize :: PID -> Int # indexWord8ArrayAs# :: ByteArray# -> Int# -> PID # readWord8ArrayAs# :: MutableByteArray# s -> Int# -> State# s -> (#State# s, PID#) # writeWord8ArrayAs# :: MutableByteArray# s -> Int# -> PID -> State# s -> State# s # peekMBA :: MutableByteArray# RealWorld -> Int -> IO PID # pokeMBA :: MutableByteArray# RealWorld -> Int -> PID -> IO () # indexBA :: ByteArray# -> Int -> PID # | |
Storable PID Source # | |
Defined in Z.IO.UV.FFI | |
type Rep PID Source # | |
Defined in Z.IO.UV.FFI |
getPriority :: HasCallStack => PID -> IO CInt Source #
Retrieves the scheduling priority of the process specified by pid.
The returned value of priority is between -20 (high priority) and 19 (low priority). On Windows, the returned priority will equal one of the PRIORITY constants.
setPriority :: HasCallStack => PID -> CInt -> IO () Source #
Sets the scheduling priority of the process specified by pid.
The priority value range is between -20 (high priority) and 19 (low priority).
The constants PRIORITY_LOW
, PRIORITY_BELOW_NORMAL
, PRIORITY_NORMAL
,
PRIORITY_ABOVE_NORMAL
, PRIORITY_HIGH
, and PRIORITY_HIGHEST
are also provided for convenience.
pattern PRIORITY_LOW :: CInt Source #
pattern PRIORITY_BELOW_NORMAL :: CInt Source #
pattern PRIORITY_NORMAL :: CInt Source #
pattern PRIORITY_ABOVE_NORMAL :: CInt Source #
pattern PRIORITY_HIGH :: CInt Source #
pattern PRIORITY_HIGHEST :: CInt Source #
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.4.0-IfRX4KH4mesBaX238HlX2d" 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)))) |