7.3. Posix Process Environment
Prev | Chapter 7. The `posix` package: POSIX support | Next

## 7.3. Posix Process Environment

    getProcessID :: IO ProcessID

`getProcessID` calls `getpid` to obtain the `ProcessID` for the current process.

    getParentProcessID :: IO ProcessID

`getProcessID` calls `getppid` to obtain the `ProcessID` for the parent of the current process.

    getRealUserID :: IO UserID

`getRealUserID` calls `getuid` to obtain the real `UserID` associated with the current process.

    getEffectiveUserID :: IO UserID

`getEffectiveUserID` calls `geteuid` to obtain the effective `UserID` associated with the current process.

    setUserID :: UserID -> IO ()

`setUserID uid` calls `setuid` to set the real, effective, and saved set-user-id associated with the current process to `uid`.

    getLoginName :: IO String

`getLoginName` calls `getlogin` to obtain the login name associated with the current process.

    getRealGroupID :: IO GroupID

`getRealGroupID` calls `getgid` to obtain the real `GroupID` associated with the current process.

    getEffectiveGroupID :: IO GroupID

`getEffectiveGroupID` calls `getegid` to obtain the effective `GroupID` associated with the current process.

    setGroupID :: GroupID -> IO ()

`setGroupID gid` calls `setgid` to set the real, effective, and saved set-group-id associated with the current process to `gid`.

    getGroups :: IO [GroupID]

`getGroups` calls `getgroups` to obtain the list of supplementary `GroupID`s associated with the current process.

    getEffectiveUserName :: IO String

`getEffectiveUserName` calls `cuserid` to obtain a name associated with the effective `UserID` of the process.

    getProcessGroupID :: IO ProcessGroupID

`getProcessGroupID` calls `getpgrp` to obtain the `ProcessGroupID` for the current process.

    createProcessGroup :: ProcessID -> IO ProcessGroupID

`createProcessGroup pid` calls `setpgid` to make process `pid` a new process group leader.

    joinProcessGroup :: ProcessGroupID -> IO ProcessGroupID

`joinProcessGroup pgid` calls `setpgid` to set the `ProcessGroupID` of the current process to `pgid`.

    setProcessGroupID :: ProcessID -> ProcessGroupID -> IO ()

`setProcessGroupID pid pgid` calls `setpgid` to set the `ProcessGroupID` for process `pid` to `pgid`.

    createSession :: IO ProcessGroupID

`createSession` calls `setsid` to create a new session with the current process as session leader.

    systemName :: SystemID -> String
    nodeName :: SystemID -> String
    release :: SystemID -> String
    version :: SystemID -> String
    machine :: SystemID -> String

    getSystemID :: IO SystemID

`getSystemID` calls `uname` to obtain information about the current operating system.

    > epochTime :: IO EpochTime

`epochTime` calls `time` to obtain the number of seconds that have elapsed since the epoch (Jan 01 00:00:00 GMT 1970).

    elapsedTime     :: ProcessTimes -> ClockTick
    userTime        :: ProcessTimes -> ClockTick
    systemTime      :: ProcessTimes -> ClockTick
    childUserTime   :: ProcessTimes -> ClockTick
    childSystemTime :: ProcessTimes -> ClockTick

    getProcessTimes :: IO ProcessTimes

`getProcessTimes` calls `times` to obtain time-accounting information for the current process and its children.

    getControllingTerminalName :: IO FilePath

`getControllingTerminalName` calls `ctermid` to obtain a name associated with the controlling terminal for the process. If a controlling terminal exists, `getControllingTerminalName` returns the name of the controlling terminal.

The operation may fail with:

`NoSuchThing`

  There is no controlling terminal, or its name cannot be determined.

`SystemError`

  Various other causes.

    getTerminalName :: Fd -> IO FilePath

`getTerminalName fd` calls `ttyname` to obtain a name associated with the terminal for `Fd` `fd`. If `fd` is associated with a terminal, `getTerminalName` returns the name of the terminal.

The operation may fail with:

`InappropriateType`

  The channel is not associated with a terminal.

`NoSuchThing`

  The channel is associated with a terminal, but it has no name.

`SystemError`

  Various other causes.

    queryTerminal :: Fd -> IO Bool

`queryTerminal fd` calls `isatty` to determine whether or not `Fd` `fd` is associated with a terminal.

    getSysVar :: SysVar -> IO Limit

`getSysVar var` calls `sysconf` to obtain the dynamic value of the requested configurable system limit or option. For defined system limits, `getSysVar` returns the associated value. For defined system options, the result of `getSysVar` is undefined, but not failure.

The operation may fail with:

`NoSuchThing`

  The requested system limit or option is undefined.

Prev | Up | Next
7.2. Posix Process Primitives | Home | 7.4. Posix operations on files and directories