summaryrefslogtreecommitdiff
path: root/src/shared/pty.c
AgeCommit message (Collapse)Author
2014-10-03pty: optimize read loopDavid Herrmann
As it turns out, I can actually send data to the pty faster than the terminal can read. Therefore, make sure we read as much data as possible but bail out early enough to not cause starvation. Kernel TTY buffers are 4k, so reduce the overall buffer size, but read more than once if possible (up to 8 times sounds reasonable).
2014-10-01Remove repeated includesThomas Hindoe Paaboel Andersen
In pty.c there was both an include of our pty.h and the system installed pty.h. The latter contains only two functions openpty and forkpty. We use neither so I assume it was a typo and removed it. We still compile and pass all tests.
2014-09-19pty: include linux/ioctl.h for TIOCSIGDavid Herrmann
TIOCSIG is linux specific, so include the linux ioctl header to make sure it's defined. We currently rely on some rather non-obvious recursive includes. Make sure its always defined regardless of the system headers.
2014-07-18barrier: initalize file descriptors with -1Zbigniew Jędrzejewski-Szmek
Explicitly initalize descriptors using explicit assignment like bus_error. This makes barriers follow the same conventions as everything else and makes things a bit simpler too. Rename barier_init to barier_create so it is obvious that it is not about initialization. Remove some parens, etc.
2014-07-17shared: add PTY helperDavid Herrmann
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.