12 Commits
Author SHA1 Message Date
Nicolas LacasseandgVisor bot cceb04f05a Clean up host.TTYFileOperations.
We used to track the foreground process group & session on the
TTYFileOperation, but these are already tracked in kernel.TTY.ThreadGroup.

So remove TTYFileOperations.fgProcessGroup and .session, and replace them with
a kernel.TTY.

This is analogous to how sentry-internal tty's already work.

Updates #10925

PiperOrigin-RevId: 681957240
2024-10-03 11:25:52 -07:00
Nicolas LacasseandgVisor bot 72193f12c9 Implement /dev/tty for sentry-internal ttys.
The /dev/tty acts as a replica for the current thread group's controlling
terminal.

In a follow-up, I will make /dev/tty work for donated host ttys.

Updates #10925

PiperOrigin-RevId: 681629892
2024-10-02 16:23:54 -07:00
Nicolas LacasseandgVisor bot 8184fa1db0 Clean up devpts code, and deduplicate the foreground process state.
We no longer store the foreground process directly in the terminal. Instead, we
get it from the terminal TTY's ThreadGroup. Added a new method:
tty.SignalForegroundProcessGroup to simplify this.

Cleaned up some things along the way:
* Terminal had a bunch of methods to get/set foreground process group and
  controlling TTY, but those methods were only usable by Ioctl, since they
  read/wrote to syscall arguments. I moved that logic to Ioctl, and deleted the
  methods from Terminal, which is now a very simple type.
* Fixed a bug in ThreadGroud.SetForegroundProcessGroup where we were
  overwriting the ID of an existing process group, rather than setting a new
  process group on the session.
* Simplified the construction of lineDiscipline type.

Reported-by: syzbot+ae5b769cec8ad969c086@syzkaller.appspotmail.com
PiperOrigin-RevId: 512330758
2023-02-25 14:08:58 -08:00
Wim a88680b765 Implement code review remarks 2023-02-23 13:16:56 +01:00
Wim 1dc92a8c71 Add reference to terminal in lineDiscipline 2023-02-22 22:33:37 +01:00
Wim a547fffe1e Support some PTY control characters 2023-02-19 17:08:17 +01:00
Kevin KrakauerandgVisor bot ae8d966f5a Assign controlling terminal when tty is opened and support NOCTTY
PiperOrigin-RevId: 357015186
2021-02-11 11:09:22 -08:00
Rahat MahmoodandgVisor bot 3ca73841d7 Move the 'marshal' and 'primitive' packages to the 'pkg' directory.
PiperOrigin-RevId: 331256608
2020-09-11 17:42:49 -07:00
Ayush RanjanandgVisor bot 2eaf54dd59 Refactor tty codebase to use master-replica terminology.
Updates #2972

PiperOrigin-RevId: 329584905
2020-09-01 14:43:41 -07:00
Ayush RanjanandgVisor bot 723fb5c116 [go-marshal] Enable auto-marshalling for fs/tty.
PiperOrigin-RevId: 329564614
2020-09-01 13:02:17 -07:00
Fabricio VoznikaandgVisor bot 20e6efd302 Remove IfChange/ThenChange lint from VFS2
As new functionality is added to VFS2, corresponding files in VFS1
don't need to be changed.

PiperOrigin-RevId: 312153799
2020-05-18 14:26:09 -07:00
Nicolas LacasseandgVisor bot 696feaf10c Port devpts to VFS2.
PiperOrigin-RevId: 308164359
2020-04-23 17:34:29 -07:00