Commit Graph

5 Commits

Author SHA1 Message Date
Jonas 'Sortie' Termansen d51fbffb97 Work around pty deadlock. 2023-03-21 23:59:17 +01:00
Jonas 'Sortie' Termansen 68a278ddb3 Fix pty write and read logic. 2022-12-03 22:36:34 +01:00
Jonas 'Sortie' Termansen b9898086c6 Add file descriptor table reservations.
The file descriptor table now allows reserving room for multiple file
descriptors without assigning their numbers. This functionality means
any error conditions happen up front and the subsequent number
assignment will never fail.

This change uses the new functionality to fix troublesome error handling
when allocating multiple file descriptors. One pty allocation error path
was even wrong.

There were subtle race conditions where one (kernel) thread may have
allocated one file descriptor, and another thread spuciously replaces it
with something else, and then the second file descriptor allocation
failed in the first thread, and it closes the first file descriptor now
pointing to a different file description. This case seems harmless but
it's not a great class of bugs to exist in the first place. The new
behavior means the file descriptions appear in the file descriptor table
without fail and never needs to be cleaned up midway and is certainly
immune to shenangians from other threads.

Reviewed-by: Pedro Falcato <pedro.falcato@gmail.com>
2021-12-31 22:24:07 +01:00
Jonas 'Sortie' Termansen fff849b151 Fix improper uses of ScopedLockSignal. 2021-02-11 20:47:47 +01:00
Jonas 'Sortie' Termansen b38c84852c Add pseudo terminals.
This is a compatible ABI change riding on the previous commit's bump.
2016-11-23 22:31:05 +01:00