From: miquels@cistron-office.nl (Miquel van Smoorenburg)
To: linux-kernel@vger.kernel.org
Subject: Re: Controlling Terminal
Date: Tue, 31 Jul 2001 15:47:20 +0000 (UTC) [thread overview]
Message-ID: <9k6ju8$suo$3@ncc1701.cistron.net> (raw)
In-Reply-To: <Pine.LNX.3.95.1010731093430.18329A-100000@chaos.analogic.com>
In article <Pine.LNX.3.95.1010731093430.18329A-100000@chaos.analogic.com>,
Richard B. Johnson <root@chaos.analogic.com> wrote:
>Sorry about off-topic, but how do I create a "controlling
>terminal" for a process.
a) make sure that the process
!(is session leader && already has a controlling tty)
b) then make the process a session leader by calling setsid()
c) make sure the tty you want to use isn't already the controlling
tty for another session
d) open tty -> voila
If you're root you can force it by using ioctl(tty, TIOSCTTY, 1)
to steal away a controlling tty from another process, but generally
that is not a good idea.
>I know how to open the device,
>dup it to 0, 1, 2, set up signals, etc. However, the
>shell (bash) won't allow job-control, and ^C kills bash
>instead of what it's executing.
close(0); close(1); close(2); setsid(); fd = open(tty, O_RDWR);
dup(fd); dup(fd);
>I'm trying to run a shell off a multiplexed RF link. I've
>got a good clean 8-bit link. I should not have to use
>a pty. The driver's output "looks" like a terminal so it
>should be able to be a controlling terminal.
But it must be a tty-style device, ofcourse. You can't make a
socket or a block device a controlling tty.
Mike.
--
"dselect has a user interface which scares small children"
-- Theodore Tso, on debian-devel
prev parent reply other threads:[~2001-07-31 15:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-07-31 13:41 Richard B. Johnson
2001-07-31 15:47 ` Miquel van Smoorenburg [this message]
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='9k6ju8$suo$3@ncc1701.cistron.net' \
--to=miquels@cistron-office.nl \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®