chiark / gitweb /
shared: add PTY helper
authorDavid Herrmann <dh.herrmann@gmail.com>
Fri, 11 Jul 2014 14:29:56 +0000 (16:29 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Thu, 17 Jul 2014 09:39:48 +0000 (11:39 +0200)
commita47d1dfd0823cd3978dd10e217dadcee7e01b265
treed9850af170b2d42b85444697ac466c1109a2df95
parenta2da110b78abe4e4b1b6d8ae4ef78b087c4dcc8b
shared: add PTY helper

This Pty API wraps the ugliness that is POSIX PTY. It takes care of:
  - edge-triggered HUP handling (avoid heavy CPU-usage on vhangup)
  - HUP vs. input-queue draining (handle HUP _after_ draining the whole
    input queue)
  - SIGCHLD vs. HUP (HUP is no reliable way to catch PTY deaths, always
    use SIGCHLD. Otherwise, vhangup() and friends will break.)
  - Output queue buffering (async EPOLLOUT handling)
  - synchronous setup (via Barrier API)

At the same time, the PTY API does not execve(). It simply fork()s and
leaves everything else to the caller. Usually, they execve() but we
support other setups, too.

This will be needed by multiple UI binaries (systemd-console, systemd-er,
...) so it's placed in src/shared/. It's not strictly related to
libsystemd-terminal, so it's not included there.
.gitignore
Makefile.am
src/shared/pty.c [new file with mode: 0644]
src/shared/pty.h [new file with mode: 0644]
src/test/test-pty.c [new file with mode: 0644]