package core_unix

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type t = UnixLabels.terminal_io = {
  1. mutable c_ignbrk : bool;
    (*

    Ignore the break condition.

    *)
  2. mutable c_brkint : bool;
    (*

    Signal interrupt on break condition.

    *)
  3. mutable c_ignpar : bool;
    (*

    Ignore characters with parity errors.

    *)
  4. mutable c_parmrk : bool;
    (*

    Mark parity errors.

    *)
  5. mutable c_inpck : bool;
    (*

    Enable parity check on input.

    *)
  6. mutable c_istrip : bool;
    (*

    Strip 8th bit on input characters.

    *)
  7. mutable c_inlcr : bool;
    (*

    Map NL to CR on input.

    *)
  8. mutable c_igncr : bool;
    (*

    Ignore CR on input.

    *)
  9. mutable c_icrnl : bool;
    (*

    Map CR to NL on input.

    *)
  10. mutable c_ixon : bool;
    (*

    Recognize XON/XOFF characters on input.

    *)
  11. mutable c_ixoff : bool;
    (*

    Emit XON/XOFF chars to control input flow.

    *)
  12. mutable c_opost : bool;
    (*

    Enable output processing.

    *)
  13. mutable c_obaud : int;
    (*

    Output baud rate (0 means close connection).

    *)
  14. mutable c_ibaud : int;
    (*

    Input baud rate.

    *)
  15. mutable c_csize : int;
    (*

    Number of bits per character (5-8).

    *)
  16. mutable c_cstopb : int;
    (*

    Number of stop bits (1-2).

    *)
  17. mutable c_cread : bool;
    (*

    Reception is enabled.

    *)
  18. mutable c_parenb : bool;
    (*

    Enable parity generation and detection.

    *)
  19. mutable c_parodd : bool;
    (*

    Specify odd parity instead of even.

    *)
  20. mutable c_hupcl : bool;
    (*

    Hang up on last close.

    *)
  21. mutable c_clocal : bool;
    (*

    Ignore modem status lines.

    *)
  22. mutable c_isig : bool;
    (*

    Generate signal on INTR, QUIT, SUSP.

    *)
  23. mutable c_icanon : bool;
    (*

    Enable canonical processing (line buffering and editing)

    *)
  24. mutable c_noflsh : bool;
    (*

    Disable flush after INTR, QUIT, SUSP.

    *)
  25. mutable c_echo : bool;
    (*

    Echo input characters.

    *)
  26. mutable c_echoe : bool;
    (*

    Echo ERASE (to erase previous character).

    *)
  27. mutable c_echok : bool;
    (*

    Echo KILL (to erase the current line).

    *)
  28. mutable c_echonl : bool;
    (*

    Echo NL even if c_echo is not set.

    *)
  29. mutable c_vintr : char;
    (*

    Interrupt character (usually ctrl-C).

    *)
  30. mutable c_vquit : char;
    (*

    Quit character (usually ctrl-\).

    *)
  31. mutable c_verase : char;
    (*

    Erase character (usually DEL or ctrl-H).

    *)
  32. mutable c_vkill : char;
    (*

    Kill line character (usually ctrl-U).

    *)
  33. mutable c_veof : char;
    (*

    End-of-file character (usually ctrl-D).

    *)
  34. mutable c_veol : char;
    (*

    Alternate end-of-line char. (usually none).

    *)
  35. mutable c_vmin : int;
    (*

    Minimum number of characters to read before the read request is satisfied.

    *)
  36. mutable c_vtime : int;
    (*

    Maximum read wait (in 0.1s units).

    *)
  37. mutable c_vstart : char;
    (*

    Start character (usually ctrl-Q).

    *)
  38. mutable c_vstop : char;
    (*

    Stop character (usually ctrl-S).

    *)
}
val sexp_of_t : t -> Sexplib0.Sexp.t
type setattr_when = UnixLabels.setattr_when =
  1. | TCSANOW
  2. | TCSADRAIN
  3. | TCSAFLUSH
val sexp_of_setattr_when : setattr_when -> Sexplib0.Sexp.t
val tcgetattr : File_descr.t -> t

Return the status of the terminal referred to by the given file descriptor.

val tcsetattr : t -> File_descr.t -> mode:setattr_when -> unit

Set the status of the terminal referred to by the given file descriptor. The second argument indicates when the status change takes place: immediately (TCSANOW), when all pending output has been transmitted (TCSADRAIN), or after flushing all input that has been received but not read (TCSAFLUSH). TCSADRAIN is recommended when changing the output parameters; TCSAFLUSH, when changing the input parameters.

val tcsendbreak : File_descr.t -> duration:int -> unit

Send a break condition on the given file descriptor. The second argument is the duration of the break, in 0.1s units; 0 means standard duration (0.25s).

val tcdrain : File_descr.t -> unit

Waits until all output written on the given file descriptor has been transmitted.

type flush_queue = UnixLabels.flush_queue =
  1. | TCIFLUSH
  2. | TCOFLUSH
  3. | TCIOFLUSH
val sexp_of_flush_queue : flush_queue -> Sexplib0.Sexp.t
val flush_queue_of_sexp : Sexplib0.Sexp.t -> flush_queue
val tcflush : File_descr.t -> mode:flush_queue -> unit

Discard data written on the given file descriptor but not yet transmitted, or data received but not yet read, depending on the second argument: TCIFLUSH flushes data received but not read, TCOFLUSH flushes data written but not transmitted, and TCIOFLUSH flushes both.

type flow_action = UnixLabels.flow_action =
  1. | TCOOFF
  2. | TCOON
  3. | TCIOFF
  4. | TCION
val sexp_of_flow_action : flow_action -> Sexplib0.Sexp.t
val flow_action_of_sexp : Sexplib0.Sexp.t -> flow_action
val tcflow : File_descr.t -> mode:flow_action -> unit

Suspend or restart reception or transmission of data on the given file descriptor, depending on the second argument: TCOOFF suspends output, TCOON restarts output, TCIOFF transmits a STOP character to suspend input, and TCION transmits a START character to restart input.

val setsid : unit -> int

Put the calling process in a new session and detach it from its controlling terminal.