public inbox for linux-api@vger.kernel.org
 help / color / mirror / Atom feed
From: Devin Bayer <dev@doubly.so>
To: linux-api@vger.kernel.org, linux-console@vger.kernel.org
Subject: setsid2(sid) proposal - assign current process to existing session
Date: Fri, 14 Aug 2020 13:09:54 +0200	[thread overview]
Message-ID: <ecede52e-1f5d-8357-37f8-948456688862@doubly.so> (raw)

Hello,

I'm wondering about the possibility of introducing a new system call for 
moving a process to an existing session. If `sid` is an existing session 
with the same owner as the current process, one could call:

	setsid2(sid)

This would have similar behavior to setpgid(), and would probably 
effectively call setpgid() internally too.

The use case is for something like `flatpak-spawn --host`, which allows 
you to launch a program in an outer namespace from an inner namespace. 
It behaves as a child of the caller but is actually a child of an 
external daemon.

It works by connecting stdin/out/err to those of the caller, for example 
a PTY for xterm running in the inner namespace. This works fine for 
non-interactive programs, but it's impossible for the spawned task to 
share the controlling TTY with the shell running in xterm.

I can't see where the problems are, though I'm surprised such 
functionally doesn't yet exist. Because it deals with such basic 
concepts, I'm wondering if such a change will even be considered.

There is a workaround; one can create a new PTY on the host and copy the 
I/O streams manually. Not ideal, but okay.

Any comments welcome.

Cheers
~ dev

             reply	other threads:[~2020-08-14 11:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-14 11:09 Devin Bayer [this message]
2020-08-14 11:33 ` setsid2(sid) proposal - assign current process to existing session Christian Brauner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ecede52e-1f5d-8357-37f8-948456688862@doubly.so \
    --to=dev@doubly.so \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-console@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox