mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
Linux leaves the session's controlling terminal in place after the last file descriptor on the slave is closed, so a later open of /dev/tty succeeds. FreeBSD drops the session vnode reference on that close. /dev/tty then fails, which breaks Linux programs such as xterm that close the pty slave during startup and expect /dev/tty to keep working. When the closer is a Linux process, leave the session reference in place. Still pass FLASTCLOSE to the driver so the master sees hangup. Native close behavior is unchanged. Add the SV_PERSISTENT_CTTY sysentvec flag for ABIs that retain the controlling terminal after the last slave descriptor is closed. This keeps the devfs behavior ABI-agnostic and allows other ABIs to request the same semantics if needed. Use the flag in devfs_close(). Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D60701