1

Whenever I create a new terminal its PPID is set to the one as gnome-terminal-server even when it's created using bash:

 3340 22404 22404 22404 ?           -1 Ssl   1000   1:16  \_ /usr/lib/gnome-terminal/gnome-terminal-server
22404 23096 23096 23096 pts/1    23096 Ss+   1000   0:00      \_ bash
22404 23563 23563 23563 pts/0    23613 Ss    1000   0:00      \_ bash
23563 23613 23613 23563 pts/0    23613 R+    1000   0:00          \_ ps jfax

I was particularly interested in how it acquires new pty before realizing the PPID issue (named pts/1 here) so I did strace -ff gnome-terminal and it shows two exec, one for gnome-terminal an another for gnome-terminal.real and none of the PIDs is that of our newly created terminal.

I'm assuming it sends some message to terminal server over a unix socket or something but I can't quite find it and I can't strace the gnome-terminal-server either, even with sudo because Operation not permitted.

If I grep socket I can find some unix sockets indeed but I can't find any useful clue connecting it to PID 22404.

Anyone knows the steps of spawning a new terminal and how it acquires new ptys, or alternatively how I can investigate this socket or ...?

2
  • 1
    Like all the gnome sticky brown matter, gnome-terminal-server and gnome-terminal-client communicate over dbus, which itself runs over Unix domain sockets. The gnome-terminal-server itself implements all the terminal related stuff via the vte library, so it's there you should look for the lower level stuff. If you're just about "acquiring a new pty" and such simple stuff, look at the openpty(3) implementation in glibc.
    – mosvy
    Apr 9 '20 at 21:34
  • 1
    I already described the architecture back in 2017 at unix.stackexchange.com/a/407863/5132 .
    – JdeBP
    Apr 10 '20 at 6:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.