HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleunix-2.8.7.0Haskell2010

System.Posix.Terminal.PosixString

POSIX Terminal support

  • 7 types
  • 29 values
  • Packageunix-2.8.7.0
  • Exports67
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourcePosixString.hsc

Terminal support

0 declarations

Terminal attributes

datadata TerminalMode
#

Constructors

newtypenewtype BaudRate
#

Serial line baudrate. The set of supported speeds is system-dependent. Portable use of the provided pattern synonyms that are outside the list mandated by POSIX requires #ifdef guards.

Applications may need to be prepared to encounter speeds not known at compile time, these can be handled generically via the BaudRate constructor. In other words, the provided pattern synonyms are not necessarily a COMPLETE set.

All non-zero pseudo-terminal baud rates are functionally equivalent, and the pty driver may accept any speed within a suitable range. Requested speeds may be rounded up or down to fit into the supported range.

Constructors

Instances6Enum, Eq, Num, Ord, Real, Show
  • Enum BaudRateDefined in unix-2.8.7.0 · System.Posix.Terminal.Common
  • Eq BaudRateDefined in unix-2.8.7.0 · System.Posix.Terminal.Common
  • Num BaudRateDefined in unix-2.8.7.0 · System.Posix.Terminal.Common
  • Ord BaudRateDefined in unix-2.8.7.0 · System.Posix.Terminal.Common
  • Real BaudRateDefined in unix-2.8.7.0 · System.Posix.Terminal.Common
  • Show BaudRateDefined in unix-2.8.7.0 · System.Posix.Terminal.Common
patternpattern B1000000 :: BaudRate
#

1000000 baud, non-POSIX system-dependent extension

patternpattern B115200 :: BaudRate
#

115200 baud, non-POSIX system-dependent extension

patternpattern B1152000 :: BaudRate
#

1152000 baud, non-POSIX system-dependent extension

patternpattern B1500000 :: BaudRate
#

1500000 baud, non-POSIX system-dependent extension

patternpattern B2000000 :: BaudRate
#

2000000 baud, non-POSIX system-dependent extension

patternpattern B230400 :: BaudRate
#

230400 baud, non-POSIX system-dependent extension

patternpattern B2500000 :: BaudRate
#

2500000 baud, non-POSIX system-dependent extension

patternpattern B3000000 :: BaudRate
#

3000000 baud, non-POSIX system-dependent extension

patternpattern B3500000 :: BaudRate
#

3500000 baud, non-POSIX system-dependent extension

patternpattern B4000000 :: BaudRate
#

4000000 baud, non-POSIX system-dependent extension

patternpattern B460800 :: BaudRate
#

460800 baud, non-POSIX system-dependent extension

patternpattern B500000 :: BaudRate
#

500000 baud, non-POSIX system-dependent extension

patternpattern B57600 :: BaudRate
#

57600 baud, non-POSIX system-dependent extension

patternpattern B576000 :: BaudRate
#

576000 baud, non-POSIX system-dependent extension

patternpattern B921600 :: BaudRate
#

921600 baud, non-POSIX system-dependent extension

Terminal operations

valuesendBreak :: Fd -> Int -> IO ()
#

sendBreak fd duration calls tcsendbreak to transmit a continuous stream of zero-valued bits on Fd fd for the specified implementation-dependent duration.

valuedrainOutput :: Fd -> IO ()
#

drainOutput fd calls tcdrain to block until all output written to Fd fd has been transmitted.

Throws IOError ("unsupported operation") if platform does not provide tcdrain(3) (use #if HAVE_TCDRAIN CPP guard to detect availability).

valuediscardData :: Fd -> QueueSelector -> IO ()
#

discardData fd queues calls tcflush to discard pending input and/or output for Fd fd, as indicated by the QueueSelector queues.

valuecontrolFlow :: Fd -> FlowAction -> IO ()
#

controlFlow fd action calls tcflow to control the flow of data on Fd fd, as indicated by action.

Process groups

setTerminalProcessGroupID fd pgid calls tcsetpgrp to set the ProcessGroupID of the foreground process group associated with the terminal attached to Fd fd to pgid.

Testing a file descriptor

valuequeryTerminal :: Fd -> IO Bool
#

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

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.

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.

Throws IOError ("unsupported operation") if platform does not provide ctermid(3) (use #if HAVE_CTERMID CPP guard to detect availability).

Pseudoterminal operations

valueopenPseudoTerminal :: IO (Fd, Fd)
#

openPseudoTerminal creates a pseudoterminal (pty) pair, and returns the newly created pair as a (master, slave) tuple.

getSlaveTerminalName calls ptsname to obtain the name of the slave terminal associated with a pseudoterminal pair. The file descriptor to pass in must be that of the master.