procps-bindings-0.1.0.0: Haskell bindings to the procps library
Safe HaskellSafe-Inferred
LanguageHaskell2010

System.Proc.Bindings.Tab

Synopsis

Documentation

data ProcTab Source #

The proctab (process table) is a persistent handle-like data structure holding the information the library needs to read process information. While Procs are typically ephemeral, the ProcTab is more long lived.

Typically it will be created and populated by openProcTab (or withProcTab, which handles memory management); the TableConfig tells the underlying library what information we want to read, but no actual process information is read yet.

We then query the ProcTab for information about processes, using functions like readNextProc or readNextProcInfo

withProcTab :: HasCallStack => TableConfig -> (ProcTab -> IO a) -> IO (Either ProcError a) Source #

Bracketed access to a ProcTab. The internal pointers will be freed after use.

openProcTab :: HasCallStack => TableConfig -> IO (Either ProcError ProcTab, IO ()) Source #

Open a ProcTab according to a TableConfig. It is the caller's responsibility to free the internal Ptrs once they're done with it.

It's safer to use withProcTab, which will automatically clean up all the pointers.

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.

closeProcTab :: HasCallStack => ProcTab -> IO () Source #

Free the internal Ptrs of a ProcTab, if they're not null.

data ProcTabInfo Source #

Information about a ProcTab. Most of this information is just a copy of the arguments passed to openproc or readproctab.

This in an "escape hatch": while we have to be careful managing the pointers underlying a ProcTab, a ProcTabInfo is just a normal Haskell datatype without any of that stuff going on, so you can do what you want with it.

Constructors

ProcTabInfo 

Fields

Instances

Instances details
Show ProcTabInfo Source # 
Instance details

Defined in System.Proc.Bindings.Tab

getProcTabInfo :: HasCallStack => ProcTab -> IO ProcTabInfo Source #

Read information about a ProcTab.

readProcTabInfo :: HasCallStack => TableConfig -> IO (Either ProcError ProcTabInfo) Source #

For convenience: read ProcTabInfo according to a TableConfig, skipping all the C stuff in the middle.