| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
System.Proc.Bindings.Tab.Config
Synopsis
- data TableConfig = TableConfig {}
- data Filter
- data Flags
- flagsAsInt :: Flags -> CInt
- noFlags :: Flags
- fillMem :: Flags
- fillCom :: Flags
- fillEnv :: Flags
- fillUser :: Flags
- fillGroup :: Flags
- fillStatus :: Flags
- fillStat :: Flags
- fillArg :: Flags
- fillCGroup :: Flags
- fillSupGroup :: Flags
- fillOOM :: Flags
- fillNS :: Flags
- fillSystemd :: Flags
- fillLxc :: Flags
- fillLooseTasks :: Flags
- editCGroupAsSingleVector :: Flags
- editCmdlineAsSingleVector :: Flags
- editEnvironAsSingleVector :: Flags
- flagMem :: Flags -> Bool
- flagCom :: Flags -> Bool
- flagEnv :: Flags -> Bool
- flagUser :: Flags -> Bool
- flagGroup :: Flags -> Bool
- flagStatus :: Flags -> Bool
- flagStat :: Flags -> Bool
- flagArg :: Flags -> Bool
- flagCGroup :: Flags -> Bool
- flagSupGroup :: Flags -> Bool
- flagOOM :: Flags -> Bool
- flagNS :: Flags -> Bool
- flagSystemd :: Flags -> Bool
- flagLxc :: Flags -> Bool
- flagLooseTasks :: Flags -> Bool
- flagEditCGroupSingleVector :: Flags -> Bool
- flagEditCmdlineSingleVector :: Flags -> Bool
- flagEditEnvironSingleVector :: Flags -> Bool
- branchTableConfig :: HasCallStack => (CInt -> IO a) -> (CInt -> Ptr CPid -> IO a) -> (CInt -> Ptr CUid -> CInt -> IO a) -> TableConfig -> IO a
- openTableConfig :: (CInt -> IO a) -> (CInt -> Ptr CPid -> IO a) -> (CInt -> Ptr CUid -> CInt -> IO a) -> TableConfig -> IO (a, IO ())
Documentation
data TableConfig Source #
This type represents our preference of what processes we want information about,
and what information we want about them. It'll be translated into a list of arguments
to be passed to openproc (openProcTab) or
readproctab (openAllProcs).
Constructors
| TableConfig | |
Fields
| |
Instances
| Show TableConfig Source # | |
Defined in System.Proc.Bindings.Tab.Config | |
| Eq TableConfig Source # | |
Defined in System.Proc.Bindings.Tab.Config Methods (==) :: TableConfig -> TableConfig -> Bool Source # (/=) :: TableConfig -> TableConfig -> Bool Source # | |
Table filters
Which processes do we want to read information about?
This will determine which extra arguments we pass to openproc or readproctab.
Constructors
| NoFilter | Read all processes |
| ByUids [CUid] | Filter process by user IDs |
| ByPids [CPid] | Filter process by process IDs |
Binary flags
What information do we want about the processes?
This type will be translated into a C int to be passed to the underlying library
(see flagsAsInt).
It's easiest to construct these using the Semigroup instance:
myFlags ::FlagsmyFlags =fillMem<>fillCom<>fillEnv<>fillUser<>fillGroup
flagsAsInt :: Flags -> CInt Source #
Translate our nice haskell Flags type into a C int. Basically a bitwise OR of
the fields (see all the lines at the end of readproc.h starting with #define PROC_).
Constructing flags
fillStatus :: Flags Source #
Read /proc/#/status.
fillCGroup :: Flags Source #
Read /proc/#/cgroup.
fillSupGroup :: Flags Source #
Resolve supplementary group id -> group name
fillSystemd :: Flags Source #
Read systemd information.
fillLooseTasks :: Flags Source #
Treat threads as if they were processes.
editCGroupAsSingleVector :: Flags Source #
Edit cgroup as a single vector.
editCmdlineAsSingleVector :: Flags Source #
Edit cmdline as a single vector.
editEnvironAsSingleVector :: Flags Source #
Edit environ as a single vector.
Accessors
flagStatus :: Flags -> Bool Source #
Read /proc/#/status?
flagCGroup :: Flags -> Bool Source #
Read /proc/#/cgroup?
flagSupGroup :: Flags -> Bool Source #
Resolve supplementary group id -> group name?
flagSystemd :: Flags -> Bool Source #
Read systemd information?
flagLooseTasks :: Flags -> Bool Source #
Treat threads as if they were processes?
flagEditCGroupSingleVector :: Flags -> Bool Source #
Edit cgroup as a single vector?
flagEditCmdlineSingleVector :: Flags -> Bool Source #
Edit cmdline as a single vector?
flagEditEnvironSingleVector :: Flags -> Bool Source #
Edit environ as a single vector?
Util
branchTableConfig :: HasCallStack => (CInt -> IO a) -> (CInt -> Ptr CPid -> IO a) -> (CInt -> Ptr CUid -> CInt -> IO a) -> TableConfig -> IO a Source #
Case analysis on TableConfig. The three continuation arguments correspond to the three
constructors of Filter.
Handles memory management and makes sure we pass the correct argument to
openproc or readproctab.
openTableConfig :: (CInt -> IO a) -> (CInt -> Ptr CPid -> IO a) -> (CInt -> Ptr CUid -> CInt -> IO a) -> TableConfig -> IO (a, IO ()) Source #
Same as branchTableConfig, but without the bracketing.
The IO () return value is a cleanup function to free any memory that was allocated for
openproc, e.g an array of uid_ts or pid_ts.