From e781ef080ea03839ea1cea922bedb5aa3231fb16 Mon Sep 17 00:00:00 2001 From: John Hood Date: Fri, 30 Aug 2024 21:20:50 -0400 Subject: [PATCH 1/2] Copy ish-lld.lldb to build dir --- meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 4a8ea6df48..eb273920ba 100644 --- a/meson.build +++ b/meson.build @@ -181,8 +181,8 @@ endif subdir('tools') -gdb_scripts = ['ish-gdb.gdb'] -foreach script : gdb_scripts +debugger_scripts = ['ish-gdb.gdb', 'ish-lldb.lldb'] +foreach script : debugger_scripts custom_target(script, output: script, input: script, command: ['ln', '-sf', '@INPUT@', '@OUTPUT@'], From 6b0856c09ddac28534cad0857b6be5b7a3fca68c Mon Sep 17 00:00:00 2001 From: John Hood Date: Fri, 30 Aug 2024 21:21:34 -0400 Subject: [PATCH 2/2] Support pty slave reuse and behave more like Linux --- fs/pty.c | 6 ++++++ fs/tty.c | 1 + 2 files changed, 7 insertions(+) diff --git a/fs/pty.c b/fs/pty.c index 1b272296cf..0ecd0cd295 100644 --- a/fs/pty.c +++ b/fs/pty.c @@ -66,6 +66,12 @@ static int pty_slave_open(struct tty *tty) { return _EIO; if (tty->pty.locked) return _EIO; + // If userland's reference count on the pty slave is now 1, clear + // hang_up on the pty master. But the session leader may have a + // reference, and the pty master always has a reference. + if (tty->refcount - 1 == (tty->session ? 2 : 1)) { + tty->pty.other->hung_up = false; + } return 0; } diff --git a/fs/tty.c b/fs/tty.c index 3a70ca2943..a9a950531e 100644 --- a/fs/tty.c +++ b/fs/tty.c @@ -446,6 +446,7 @@ static ssize_t tty_read(struct fd *fd, void *buf, size_t bufsize) { lock(&tty->lock); if (tty->hung_up || pty_is_half_closed_master(tty)) { unlock(&pids_lock); + err = -1; goto error; }