SchOS/kernel/proc
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Nexoniarz 0b39f8bad1 proc: the controlling terminal crosses fork()
`ps` listed the shell and nothing the shell had started -- background jobs
included, which is how it was noticed.

p->ctty was set by TIOCSCTTY and never inherited, so every child of a shell had
ctty 0. `ps` with no arguments shows only processes on *this* terminal, so a
job running on your terminal was invisible because the only process that had
ever claimed one was the shell itself.

The controlling terminal is a property of the session, not of the process that
happened to call the ioctl. It crosses fork() with pgid and sid, three lines
above where it now sits.

    # sleep 60 & ; sleep 61 &
    # ps
       PID TTY          TIME CMD
        14 1:11     00:00:00 sleep
         9 1:11     00:00:00 zsh
        15 1:11     00:00:00 sleep
        17 1:11     00:00:00 ps

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 09:21:06 +02:00
..
proc.c proc: the controlling terminal crosses fork() 2026-09-22 09:21:06 +02:00