chickadee » ioctl

Outdated egg!

This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

ioctl

An interface to the ioctl(2) system call.

ioctl(2) provides an interface to the operating system terminal drivers (or more commonly these days to ptys (pseudo-terminals)). ioctl is very low-level - most aspects of the terminal can be controlled with the higher-level termios(4), available in Chicken as the even higher-level stty egg.

Procedures

ioctl-winsize #!optional <port-or-fileno>procedure

Returns a list of the form (<num-rows> <num-columns>) for the given port or file descriptor, defaulting to current-output-port.

(ioctl <port-or-fileno> <request> [<args> ...])procedure

Makes the given ioctl request with any arguments provided. The following requests are available:

  • TIOCSETD int *ldisc change the line discipline:
    • TTYDISC termios interactive line discipline
    • TABLDISC tablet line discipline
    • SLIPDISC serial IP line discipline
    • PPPDISC PPP line discipline
  • TIOCGETD int *ldisc return the current line discipline
  • TIOCSBRK set the terminal into BREAK condition
  • TIOCCBRK clear the terminal BREAK condition
  • TIOCSDTR assert data terminal ready
  • TIOCCDTR clear data terminal ready
  • TIOCGPGRP int *tpgrp return the terminal's process group
  • TIOCSPGRP int *tpgrp associate the terminal's process group
  • TIOCGETA struct termios *term get the terminal's termios attributes
  • TIOCSETA struct termios *term set the terminal's termios attributes
  • TIOCSETAW struct termios *term set the termios attrs after any output completes
  • TIOCSETAF struct termios *term after any output completes, clear input and set termios attrs
  • TIOCOUTQ int *num current number of characters in the output queue
  • TIOCSTI char *cp manually send a character to the terminal
  • TIOCSTOP stop output (like typing ^S)
  • TIOCSTART start output (like typing ^Q)
  • TIOCSCTTY make this the controlling terminal for the process
  • TIOCDRAIN wait until all output is drained
  • TIOCEXCL set exclusive use on the terminal
  • TIOCNXCL clear exclusive use of the terminal
  • TIOCFLUSH int *what clear input/output if `what' has FREAD/FWRITE set
  • TIOCGWINSZ struct winsize *ws get the winsize information
  • TIOCSWINSZ struct winsize *ws set the winsize information
  • TIOCCONS int *on redirect kernel console messages
  • TIOCMSET int *state set the modem state bit flags according to the following:
    • TIOCM_LE Line Enable
    • TIOCM_DTR Data Terminal Ready
    • TIOCM_RTS Request To Send
    • TIOCM_ST Secondary Transmit
    • TIOCM_SR Secondary Receive
    • TIOCM_CTS Clear To Send
    • TIOCM_CAR Carrier Detect
    • TIOCM_CD Carrier Detect (synonym)
    • TIOCM_RNG Ring Indication
    • TIOCM_RI Ring Indication (synonym)
    • TIOCM_DSR Data Set Ready
  • TIOCMGET int *state get the modem state bit flags
  • TIOCMBIS int *state add modem state bit flags, OR-ing in the new states
  • TIOCMBIC int *state clear modem state bit flags

The struct winsize *ws arguments use the winsize record:

   make-winsize free-winsize
   winsize-row winsize-col
   winsize-row-set! winsize-col-set!

The struct termios *term arguments use the term-attrs record from the stty egg.

The integer pointer arguments can be handled with pointers from the lolevel extension.

Author

Alex Shinn

License

BSD

History

1.0
Initial release

Contents »